c3266dc5af3ae89b5521743dde42d11229e5c924
[gd/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         ZERO_STRUCT(r->out);
948         r->out.info = talloc_zero(r, union spoolss_DriverInfo);
949         if (r->out.info == NULL) {
950                 talloc_free(r);
951                 return false;
952         }
953
954         r->out.needed = talloc_zero(r, uint32_t);
955         if (r->out.needed == NULL) {
956                 talloc_free(r);
957                 return false;
958         }
959
960         r->out.result = _spoolss_GetPrinterDriver(p, r);
961
962         if (p->rng_fault_state) {
963                 talloc_free(r);
964                 /* Return true here, srv_pipe_hnd.c will take care */
965                 return true;
966         }
967
968         if (DEBUGLEVEL >= 10) {
969                 NDR_PRINT_OUT_DEBUG(spoolss_GetPrinterDriver, r);
970         }
971
972         push = ndr_push_init_ctx(r, NULL);
973         if (push == NULL) {
974                 talloc_free(r);
975                 return false;
976         }
977
978         ndr_err = call->ndr_push(push, NDR_OUT, r);
979         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
980                 talloc_free(r);
981                 return false;
982         }
983
984         blob = ndr_push_blob(push);
985         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
986                 talloc_free(r);
987                 return false;
988         }
989
990         talloc_free(r);
991
992         return true;
993 }
994
995 static bool api_spoolss_GetPrinterDriverDirectory(pipes_struct *p)
996 {
997         const struct ndr_interface_call *call;
998         struct ndr_pull *pull;
999         struct ndr_push *push;
1000         enum ndr_err_code ndr_err;
1001         DATA_BLOB blob;
1002         struct spoolss_GetPrinterDriverDirectory *r;
1003
1004         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_GETPRINTERDRIVERDIRECTORY];
1005
1006         r = talloc(talloc_tos(), struct spoolss_GetPrinterDriverDirectory);
1007         if (r == NULL) {
1008                 return false;
1009         }
1010
1011         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1012                 talloc_free(r);
1013                 return false;
1014         }
1015
1016         pull = ndr_pull_init_blob(&blob, r, NULL);
1017         if (pull == NULL) {
1018                 talloc_free(r);
1019                 return false;
1020         }
1021
1022         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1023         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1024         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1025                 talloc_free(r);
1026                 return false;
1027         }
1028
1029         if (DEBUGLEVEL >= 10) {
1030                 NDR_PRINT_IN_DEBUG(spoolss_GetPrinterDriverDirectory, r);
1031         }
1032
1033         ZERO_STRUCT(r->out);
1034         r->out.info = talloc_zero(r, union spoolss_DriverDirectoryInfo);
1035         if (r->out.info == NULL) {
1036                 talloc_free(r);
1037                 return false;
1038         }
1039
1040         r->out.needed = talloc_zero(r, uint32_t);
1041         if (r->out.needed == NULL) {
1042                 talloc_free(r);
1043                 return false;
1044         }
1045
1046         r->out.result = _spoolss_GetPrinterDriverDirectory(p, r);
1047
1048         if (p->rng_fault_state) {
1049                 talloc_free(r);
1050                 /* Return true here, srv_pipe_hnd.c will take care */
1051                 return true;
1052         }
1053
1054         if (DEBUGLEVEL >= 10) {
1055                 NDR_PRINT_OUT_DEBUG(spoolss_GetPrinterDriverDirectory, r);
1056         }
1057
1058         push = ndr_push_init_ctx(r, NULL);
1059         if (push == NULL) {
1060                 talloc_free(r);
1061                 return false;
1062         }
1063
1064         ndr_err = call->ndr_push(push, NDR_OUT, r);
1065         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1066                 talloc_free(r);
1067                 return false;
1068         }
1069
1070         blob = ndr_push_blob(push);
1071         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1072                 talloc_free(r);
1073                 return false;
1074         }
1075
1076         talloc_free(r);
1077
1078         return true;
1079 }
1080
1081 static bool api_spoolss_DeletePrinterDriver(pipes_struct *p)
1082 {
1083         const struct ndr_interface_call *call;
1084         struct ndr_pull *pull;
1085         struct ndr_push *push;
1086         enum ndr_err_code ndr_err;
1087         DATA_BLOB blob;
1088         struct spoolss_DeletePrinterDriver *r;
1089
1090         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEPRINTERDRIVER];
1091
1092         r = talloc(talloc_tos(), struct spoolss_DeletePrinterDriver);
1093         if (r == NULL) {
1094                 return false;
1095         }
1096
1097         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1098                 talloc_free(r);
1099                 return false;
1100         }
1101
1102         pull = ndr_pull_init_blob(&blob, r, NULL);
1103         if (pull == NULL) {
1104                 talloc_free(r);
1105                 return false;
1106         }
1107
1108         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1109         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1110         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1111                 talloc_free(r);
1112                 return false;
1113         }
1114
1115         if (DEBUGLEVEL >= 10) {
1116                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrinterDriver, r);
1117         }
1118
1119         r->out.result = _spoolss_DeletePrinterDriver(p, r);
1120
1121         if (p->rng_fault_state) {
1122                 talloc_free(r);
1123                 /* Return true here, srv_pipe_hnd.c will take care */
1124                 return true;
1125         }
1126
1127         if (DEBUGLEVEL >= 10) {
1128                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrinterDriver, r);
1129         }
1130
1131         push = ndr_push_init_ctx(r, NULL);
1132         if (push == NULL) {
1133                 talloc_free(r);
1134                 return false;
1135         }
1136
1137         ndr_err = call->ndr_push(push, NDR_OUT, r);
1138         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1139                 talloc_free(r);
1140                 return false;
1141         }
1142
1143         blob = ndr_push_blob(push);
1144         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1145                 talloc_free(r);
1146                 return false;
1147         }
1148
1149         talloc_free(r);
1150
1151         return true;
1152 }
1153
1154 static bool api_spoolss_AddPrintProcessor(pipes_struct *p)
1155 {
1156         const struct ndr_interface_call *call;
1157         struct ndr_pull *pull;
1158         struct ndr_push *push;
1159         enum ndr_err_code ndr_err;
1160         DATA_BLOB blob;
1161         struct spoolss_AddPrintProcessor *r;
1162
1163         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ADDPRINTPROCESSOR];
1164
1165         r = talloc(talloc_tos(), struct spoolss_AddPrintProcessor);
1166         if (r == NULL) {
1167                 return false;
1168         }
1169
1170         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1171                 talloc_free(r);
1172                 return false;
1173         }
1174
1175         pull = ndr_pull_init_blob(&blob, r, NULL);
1176         if (pull == NULL) {
1177                 talloc_free(r);
1178                 return false;
1179         }
1180
1181         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1182         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1183         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1184                 talloc_free(r);
1185                 return false;
1186         }
1187
1188         if (DEBUGLEVEL >= 10) {
1189                 NDR_PRINT_IN_DEBUG(spoolss_AddPrintProcessor, r);
1190         }
1191
1192         r->out.result = _spoolss_AddPrintProcessor(p, r);
1193
1194         if (p->rng_fault_state) {
1195                 talloc_free(r);
1196                 /* Return true here, srv_pipe_hnd.c will take care */
1197                 return true;
1198         }
1199
1200         if (DEBUGLEVEL >= 10) {
1201                 NDR_PRINT_OUT_DEBUG(spoolss_AddPrintProcessor, r);
1202         }
1203
1204         push = ndr_push_init_ctx(r, NULL);
1205         if (push == NULL) {
1206                 talloc_free(r);
1207                 return false;
1208         }
1209
1210         ndr_err = call->ndr_push(push, NDR_OUT, r);
1211         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1212                 talloc_free(r);
1213                 return false;
1214         }
1215
1216         blob = ndr_push_blob(push);
1217         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1218                 talloc_free(r);
1219                 return false;
1220         }
1221
1222         talloc_free(r);
1223
1224         return true;
1225 }
1226
1227 static bool api_spoolss_EnumPrintProcessors(pipes_struct *p)
1228 {
1229         const struct ndr_interface_call *call;
1230         struct ndr_pull *pull;
1231         struct ndr_push *push;
1232         enum ndr_err_code ndr_err;
1233         DATA_BLOB blob;
1234         struct spoolss_EnumPrintProcessors *r;
1235
1236         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ENUMPRINTPROCESSORS];
1237
1238         r = talloc(talloc_tos(), struct spoolss_EnumPrintProcessors);
1239         if (r == NULL) {
1240                 return false;
1241         }
1242
1243         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1244                 talloc_free(r);
1245                 return false;
1246         }
1247
1248         pull = ndr_pull_init_blob(&blob, r, NULL);
1249         if (pull == NULL) {
1250                 talloc_free(r);
1251                 return false;
1252         }
1253
1254         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1255         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1256         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1257                 talloc_free(r);
1258                 return false;
1259         }
1260
1261         if (DEBUGLEVEL >= 10) {
1262                 NDR_PRINT_IN_DEBUG(spoolss_EnumPrintProcessors, r);
1263         }
1264
1265         ZERO_STRUCT(r->out);
1266         r->out.count = talloc_zero(r, uint32_t);
1267         if (r->out.count == NULL) {
1268                 talloc_free(r);
1269                 return false;
1270         }
1271
1272         r->out.info = talloc_zero(r, union spoolss_PrintProcessorInfo *);
1273         if (r->out.info == NULL) {
1274                 talloc_free(r);
1275                 return false;
1276         }
1277
1278         r->out.needed = talloc_zero(r, uint32_t);
1279         if (r->out.needed == NULL) {
1280                 talloc_free(r);
1281                 return false;
1282         }
1283
1284         r->out.result = _spoolss_EnumPrintProcessors(p, r);
1285
1286         if (p->rng_fault_state) {
1287                 talloc_free(r);
1288                 /* Return true here, srv_pipe_hnd.c will take care */
1289                 return true;
1290         }
1291
1292         if (DEBUGLEVEL >= 10) {
1293                 NDR_PRINT_OUT_DEBUG(spoolss_EnumPrintProcessors, r);
1294         }
1295
1296         push = ndr_push_init_ctx(r, NULL);
1297         if (push == NULL) {
1298                 talloc_free(r);
1299                 return false;
1300         }
1301
1302         ndr_err = call->ndr_push(push, NDR_OUT, r);
1303         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1304                 talloc_free(r);
1305                 return false;
1306         }
1307
1308         blob = ndr_push_blob(push);
1309         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1310                 talloc_free(r);
1311                 return false;
1312         }
1313
1314         talloc_free(r);
1315
1316         return true;
1317 }
1318
1319 static bool api_spoolss_GetPrintProcessorDirectory(pipes_struct *p)
1320 {
1321         const struct ndr_interface_call *call;
1322         struct ndr_pull *pull;
1323         struct ndr_push *push;
1324         enum ndr_err_code ndr_err;
1325         DATA_BLOB blob;
1326         struct spoolss_GetPrintProcessorDirectory *r;
1327
1328         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_GETPRINTPROCESSORDIRECTORY];
1329
1330         r = talloc(talloc_tos(), struct spoolss_GetPrintProcessorDirectory);
1331         if (r == NULL) {
1332                 return false;
1333         }
1334
1335         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1336                 talloc_free(r);
1337                 return false;
1338         }
1339
1340         pull = ndr_pull_init_blob(&blob, r, NULL);
1341         if (pull == NULL) {
1342                 talloc_free(r);
1343                 return false;
1344         }
1345
1346         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1347         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1348         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1349                 talloc_free(r);
1350                 return false;
1351         }
1352
1353         if (DEBUGLEVEL >= 10) {
1354                 NDR_PRINT_IN_DEBUG(spoolss_GetPrintProcessorDirectory, r);
1355         }
1356
1357         ZERO_STRUCT(r->out);
1358         r->out.info = talloc_zero(r, union spoolss_PrintProcessorDirectoryInfo);
1359         if (r->out.info == NULL) {
1360                 talloc_free(r);
1361                 return false;
1362         }
1363
1364         r->out.needed = talloc_zero(r, uint32_t);
1365         if (r->out.needed == NULL) {
1366                 talloc_free(r);
1367                 return false;
1368         }
1369
1370         r->out.result = _spoolss_GetPrintProcessorDirectory(p, r);
1371
1372         if (p->rng_fault_state) {
1373                 talloc_free(r);
1374                 /* Return true here, srv_pipe_hnd.c will take care */
1375                 return true;
1376         }
1377
1378         if (DEBUGLEVEL >= 10) {
1379                 NDR_PRINT_OUT_DEBUG(spoolss_GetPrintProcessorDirectory, r);
1380         }
1381
1382         push = ndr_push_init_ctx(r, NULL);
1383         if (push == NULL) {
1384                 talloc_free(r);
1385                 return false;
1386         }
1387
1388         ndr_err = call->ndr_push(push, NDR_OUT, r);
1389         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1390                 talloc_free(r);
1391                 return false;
1392         }
1393
1394         blob = ndr_push_blob(push);
1395         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1396                 talloc_free(r);
1397                 return false;
1398         }
1399
1400         talloc_free(r);
1401
1402         return true;
1403 }
1404
1405 static bool api_spoolss_StartDocPrinter(pipes_struct *p)
1406 {
1407         const struct ndr_interface_call *call;
1408         struct ndr_pull *pull;
1409         struct ndr_push *push;
1410         enum ndr_err_code ndr_err;
1411         DATA_BLOB blob;
1412         struct spoolss_StartDocPrinter *r;
1413
1414         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_STARTDOCPRINTER];
1415
1416         r = talloc(talloc_tos(), struct spoolss_StartDocPrinter);
1417         if (r == NULL) {
1418                 return false;
1419         }
1420
1421         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1422                 talloc_free(r);
1423                 return false;
1424         }
1425
1426         pull = ndr_pull_init_blob(&blob, r, NULL);
1427         if (pull == NULL) {
1428                 talloc_free(r);
1429                 return false;
1430         }
1431
1432         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1433         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1434         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1435                 talloc_free(r);
1436                 return false;
1437         }
1438
1439         if (DEBUGLEVEL >= 10) {
1440                 NDR_PRINT_IN_DEBUG(spoolss_StartDocPrinter, r);
1441         }
1442
1443         ZERO_STRUCT(r->out);
1444         r->out.job_id = talloc_zero(r, uint32_t);
1445         if (r->out.job_id == NULL) {
1446                 talloc_free(r);
1447                 return false;
1448         }
1449
1450         r->out.result = _spoolss_StartDocPrinter(p, r);
1451
1452         if (p->rng_fault_state) {
1453                 talloc_free(r);
1454                 /* Return true here, srv_pipe_hnd.c will take care */
1455                 return true;
1456         }
1457
1458         if (DEBUGLEVEL >= 10) {
1459                 NDR_PRINT_OUT_DEBUG(spoolss_StartDocPrinter, r);
1460         }
1461
1462         push = ndr_push_init_ctx(r, NULL);
1463         if (push == NULL) {
1464                 talloc_free(r);
1465                 return false;
1466         }
1467
1468         ndr_err = call->ndr_push(push, NDR_OUT, r);
1469         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1470                 talloc_free(r);
1471                 return false;
1472         }
1473
1474         blob = ndr_push_blob(push);
1475         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1476                 talloc_free(r);
1477                 return false;
1478         }
1479
1480         talloc_free(r);
1481
1482         return true;
1483 }
1484
1485 static bool api_spoolss_StartPagePrinter(pipes_struct *p)
1486 {
1487         const struct ndr_interface_call *call;
1488         struct ndr_pull *pull;
1489         struct ndr_push *push;
1490         enum ndr_err_code ndr_err;
1491         DATA_BLOB blob;
1492         struct spoolss_StartPagePrinter *r;
1493
1494         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_STARTPAGEPRINTER];
1495
1496         r = talloc(talloc_tos(), struct spoolss_StartPagePrinter);
1497         if (r == NULL) {
1498                 return false;
1499         }
1500
1501         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1502                 talloc_free(r);
1503                 return false;
1504         }
1505
1506         pull = ndr_pull_init_blob(&blob, r, NULL);
1507         if (pull == NULL) {
1508                 talloc_free(r);
1509                 return false;
1510         }
1511
1512         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1513         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1514         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1515                 talloc_free(r);
1516                 return false;
1517         }
1518
1519         if (DEBUGLEVEL >= 10) {
1520                 NDR_PRINT_IN_DEBUG(spoolss_StartPagePrinter, r);
1521         }
1522
1523         r->out.result = _spoolss_StartPagePrinter(p, r);
1524
1525         if (p->rng_fault_state) {
1526                 talloc_free(r);
1527                 /* Return true here, srv_pipe_hnd.c will take care */
1528                 return true;
1529         }
1530
1531         if (DEBUGLEVEL >= 10) {
1532                 NDR_PRINT_OUT_DEBUG(spoolss_StartPagePrinter, r);
1533         }
1534
1535         push = ndr_push_init_ctx(r, NULL);
1536         if (push == NULL) {
1537                 talloc_free(r);
1538                 return false;
1539         }
1540
1541         ndr_err = call->ndr_push(push, NDR_OUT, r);
1542         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1543                 talloc_free(r);
1544                 return false;
1545         }
1546
1547         blob = ndr_push_blob(push);
1548         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1549                 talloc_free(r);
1550                 return false;
1551         }
1552
1553         talloc_free(r);
1554
1555         return true;
1556 }
1557
1558 static bool api_spoolss_WritePrinter(pipes_struct *p)
1559 {
1560         const struct ndr_interface_call *call;
1561         struct ndr_pull *pull;
1562         struct ndr_push *push;
1563         enum ndr_err_code ndr_err;
1564         DATA_BLOB blob;
1565         struct spoolss_WritePrinter *r;
1566
1567         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_WRITEPRINTER];
1568
1569         r = talloc(talloc_tos(), struct spoolss_WritePrinter);
1570         if (r == NULL) {
1571                 return false;
1572         }
1573
1574         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1575                 talloc_free(r);
1576                 return false;
1577         }
1578
1579         pull = ndr_pull_init_blob(&blob, r, NULL);
1580         if (pull == NULL) {
1581                 talloc_free(r);
1582                 return false;
1583         }
1584
1585         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1586         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1587         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1588                 talloc_free(r);
1589                 return false;
1590         }
1591
1592         if (DEBUGLEVEL >= 10) {
1593                 NDR_PRINT_IN_DEBUG(spoolss_WritePrinter, r);
1594         }
1595
1596         ZERO_STRUCT(r->out);
1597         r->out.num_written = talloc_zero(r, uint32_t);
1598         if (r->out.num_written == NULL) {
1599                 talloc_free(r);
1600                 return false;
1601         }
1602
1603         r->out.result = _spoolss_WritePrinter(p, r);
1604
1605         if (p->rng_fault_state) {
1606                 talloc_free(r);
1607                 /* Return true here, srv_pipe_hnd.c will take care */
1608                 return true;
1609         }
1610
1611         if (DEBUGLEVEL >= 10) {
1612                 NDR_PRINT_OUT_DEBUG(spoolss_WritePrinter, r);
1613         }
1614
1615         push = ndr_push_init_ctx(r, NULL);
1616         if (push == NULL) {
1617                 talloc_free(r);
1618                 return false;
1619         }
1620
1621         ndr_err = call->ndr_push(push, NDR_OUT, r);
1622         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1623                 talloc_free(r);
1624                 return false;
1625         }
1626
1627         blob = ndr_push_blob(push);
1628         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1629                 talloc_free(r);
1630                 return false;
1631         }
1632
1633         talloc_free(r);
1634
1635         return true;
1636 }
1637
1638 static bool api_spoolss_EndPagePrinter(pipes_struct *p)
1639 {
1640         const struct ndr_interface_call *call;
1641         struct ndr_pull *pull;
1642         struct ndr_push *push;
1643         enum ndr_err_code ndr_err;
1644         DATA_BLOB blob;
1645         struct spoolss_EndPagePrinter *r;
1646
1647         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ENDPAGEPRINTER];
1648
1649         r = talloc(talloc_tos(), struct spoolss_EndPagePrinter);
1650         if (r == NULL) {
1651                 return false;
1652         }
1653
1654         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1655                 talloc_free(r);
1656                 return false;
1657         }
1658
1659         pull = ndr_pull_init_blob(&blob, r, NULL);
1660         if (pull == NULL) {
1661                 talloc_free(r);
1662                 return false;
1663         }
1664
1665         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1666         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1667         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1668                 talloc_free(r);
1669                 return false;
1670         }
1671
1672         if (DEBUGLEVEL >= 10) {
1673                 NDR_PRINT_IN_DEBUG(spoolss_EndPagePrinter, r);
1674         }
1675
1676         r->out.result = _spoolss_EndPagePrinter(p, r);
1677
1678         if (p->rng_fault_state) {
1679                 talloc_free(r);
1680                 /* Return true here, srv_pipe_hnd.c will take care */
1681                 return true;
1682         }
1683
1684         if (DEBUGLEVEL >= 10) {
1685                 NDR_PRINT_OUT_DEBUG(spoolss_EndPagePrinter, r);
1686         }
1687
1688         push = ndr_push_init_ctx(r, NULL);
1689         if (push == NULL) {
1690                 talloc_free(r);
1691                 return false;
1692         }
1693
1694         ndr_err = call->ndr_push(push, NDR_OUT, r);
1695         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1696                 talloc_free(r);
1697                 return false;
1698         }
1699
1700         blob = ndr_push_blob(push);
1701         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1702                 talloc_free(r);
1703                 return false;
1704         }
1705
1706         talloc_free(r);
1707
1708         return true;
1709 }
1710
1711 static bool api_spoolss_AbortPrinter(pipes_struct *p)
1712 {
1713         const struct ndr_interface_call *call;
1714         struct ndr_pull *pull;
1715         struct ndr_push *push;
1716         enum ndr_err_code ndr_err;
1717         DATA_BLOB blob;
1718         struct spoolss_AbortPrinter *r;
1719
1720         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ABORTPRINTER];
1721
1722         r = talloc(talloc_tos(), struct spoolss_AbortPrinter);
1723         if (r == NULL) {
1724                 return false;
1725         }
1726
1727         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1728                 talloc_free(r);
1729                 return false;
1730         }
1731
1732         pull = ndr_pull_init_blob(&blob, r, NULL);
1733         if (pull == NULL) {
1734                 talloc_free(r);
1735                 return false;
1736         }
1737
1738         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1739         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1740         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1741                 talloc_free(r);
1742                 return false;
1743         }
1744
1745         if (DEBUGLEVEL >= 10) {
1746                 NDR_PRINT_IN_DEBUG(spoolss_AbortPrinter, r);
1747         }
1748
1749         r->out.result = _spoolss_AbortPrinter(p, r);
1750
1751         if (p->rng_fault_state) {
1752                 talloc_free(r);
1753                 /* Return true here, srv_pipe_hnd.c will take care */
1754                 return true;
1755         }
1756
1757         if (DEBUGLEVEL >= 10) {
1758                 NDR_PRINT_OUT_DEBUG(spoolss_AbortPrinter, r);
1759         }
1760
1761         push = ndr_push_init_ctx(r, NULL);
1762         if (push == NULL) {
1763                 talloc_free(r);
1764                 return false;
1765         }
1766
1767         ndr_err = call->ndr_push(push, NDR_OUT, r);
1768         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1769                 talloc_free(r);
1770                 return false;
1771         }
1772
1773         blob = ndr_push_blob(push);
1774         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1775                 talloc_free(r);
1776                 return false;
1777         }
1778
1779         talloc_free(r);
1780
1781         return true;
1782 }
1783
1784 static bool api_spoolss_ReadPrinter(pipes_struct *p)
1785 {
1786         const struct ndr_interface_call *call;
1787         struct ndr_pull *pull;
1788         struct ndr_push *push;
1789         enum ndr_err_code ndr_err;
1790         DATA_BLOB blob;
1791         struct spoolss_ReadPrinter *r;
1792
1793         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_READPRINTER];
1794
1795         r = talloc(talloc_tos(), struct spoolss_ReadPrinter);
1796         if (r == NULL) {
1797                 return false;
1798         }
1799
1800         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1801                 talloc_free(r);
1802                 return false;
1803         }
1804
1805         pull = ndr_pull_init_blob(&blob, r, NULL);
1806         if (pull == NULL) {
1807                 talloc_free(r);
1808                 return false;
1809         }
1810
1811         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1812         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1813         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1814                 talloc_free(r);
1815                 return false;
1816         }
1817
1818         if (DEBUGLEVEL >= 10) {
1819                 NDR_PRINT_IN_DEBUG(spoolss_ReadPrinter, r);
1820         }
1821
1822         ZERO_STRUCT(r->out);
1823         r->out.data = talloc_zero_array(r, uint8_t, r->in.data_size);
1824         if (r->out.data == NULL) {
1825                 talloc_free(r);
1826                 return false;
1827         }
1828
1829         r->out._data_size = talloc_zero(r, uint32_t);
1830         if (r->out._data_size == NULL) {
1831                 talloc_free(r);
1832                 return false;
1833         }
1834
1835         r->out.result = _spoolss_ReadPrinter(p, r);
1836
1837         if (p->rng_fault_state) {
1838                 talloc_free(r);
1839                 /* Return true here, srv_pipe_hnd.c will take care */
1840                 return true;
1841         }
1842
1843         if (DEBUGLEVEL >= 10) {
1844                 NDR_PRINT_OUT_DEBUG(spoolss_ReadPrinter, r);
1845         }
1846
1847         push = ndr_push_init_ctx(r, NULL);
1848         if (push == NULL) {
1849                 talloc_free(r);
1850                 return false;
1851         }
1852
1853         ndr_err = call->ndr_push(push, NDR_OUT, r);
1854         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1855                 talloc_free(r);
1856                 return false;
1857         }
1858
1859         blob = ndr_push_blob(push);
1860         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1861                 talloc_free(r);
1862                 return false;
1863         }
1864
1865         talloc_free(r);
1866
1867         return true;
1868 }
1869
1870 static bool api_spoolss_EndDocPrinter(pipes_struct *p)
1871 {
1872         const struct ndr_interface_call *call;
1873         struct ndr_pull *pull;
1874         struct ndr_push *push;
1875         enum ndr_err_code ndr_err;
1876         DATA_BLOB blob;
1877         struct spoolss_EndDocPrinter *r;
1878
1879         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ENDDOCPRINTER];
1880
1881         r = talloc(talloc_tos(), struct spoolss_EndDocPrinter);
1882         if (r == NULL) {
1883                 return false;
1884         }
1885
1886         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1887                 talloc_free(r);
1888                 return false;
1889         }
1890
1891         pull = ndr_pull_init_blob(&blob, r, NULL);
1892         if (pull == NULL) {
1893                 talloc_free(r);
1894                 return false;
1895         }
1896
1897         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1898         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1899         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1900                 talloc_free(r);
1901                 return false;
1902         }
1903
1904         if (DEBUGLEVEL >= 10) {
1905                 NDR_PRINT_IN_DEBUG(spoolss_EndDocPrinter, r);
1906         }
1907
1908         r->out.result = _spoolss_EndDocPrinter(p, r);
1909
1910         if (p->rng_fault_state) {
1911                 talloc_free(r);
1912                 /* Return true here, srv_pipe_hnd.c will take care */
1913                 return true;
1914         }
1915
1916         if (DEBUGLEVEL >= 10) {
1917                 NDR_PRINT_OUT_DEBUG(spoolss_EndDocPrinter, r);
1918         }
1919
1920         push = ndr_push_init_ctx(r, NULL);
1921         if (push == NULL) {
1922                 talloc_free(r);
1923                 return false;
1924         }
1925
1926         ndr_err = call->ndr_push(push, NDR_OUT, r);
1927         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1928                 talloc_free(r);
1929                 return false;
1930         }
1931
1932         blob = ndr_push_blob(push);
1933         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1934                 talloc_free(r);
1935                 return false;
1936         }
1937
1938         talloc_free(r);
1939
1940         return true;
1941 }
1942
1943 static bool api_spoolss_AddJob(pipes_struct *p)
1944 {
1945         const struct ndr_interface_call *call;
1946         struct ndr_pull *pull;
1947         struct ndr_push *push;
1948         enum ndr_err_code ndr_err;
1949         DATA_BLOB blob;
1950         struct spoolss_AddJob *r;
1951
1952         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ADDJOB];
1953
1954         r = talloc(talloc_tos(), struct spoolss_AddJob);
1955         if (r == NULL) {
1956                 return false;
1957         }
1958
1959         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1960                 talloc_free(r);
1961                 return false;
1962         }
1963
1964         pull = ndr_pull_init_blob(&blob, r, NULL);
1965         if (pull == NULL) {
1966                 talloc_free(r);
1967                 return false;
1968         }
1969
1970         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1971         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1972         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1973                 talloc_free(r);
1974                 return false;
1975         }
1976
1977         if (DEBUGLEVEL >= 10) {
1978                 NDR_PRINT_IN_DEBUG(spoolss_AddJob, r);
1979         }
1980
1981         ZERO_STRUCT(r->out);
1982         r->out.buffer = r->in.buffer;
1983         r->out.needed = talloc_zero(r, uint32_t);
1984         if (r->out.needed == NULL) {
1985                 talloc_free(r);
1986                 return false;
1987         }
1988
1989         r->out.result = _spoolss_AddJob(p, r);
1990
1991         if (p->rng_fault_state) {
1992                 talloc_free(r);
1993                 /* Return true here, srv_pipe_hnd.c will take care */
1994                 return true;
1995         }
1996
1997         if (DEBUGLEVEL >= 10) {
1998                 NDR_PRINT_OUT_DEBUG(spoolss_AddJob, r);
1999         }
2000
2001         push = ndr_push_init_ctx(r, NULL);
2002         if (push == NULL) {
2003                 talloc_free(r);
2004                 return false;
2005         }
2006
2007         ndr_err = call->ndr_push(push, NDR_OUT, r);
2008         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2009                 talloc_free(r);
2010                 return false;
2011         }
2012
2013         blob = ndr_push_blob(push);
2014         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2015                 talloc_free(r);
2016                 return false;
2017         }
2018
2019         talloc_free(r);
2020
2021         return true;
2022 }
2023
2024 static bool api_spoolss_ScheduleJob(pipes_struct *p)
2025 {
2026         const struct ndr_interface_call *call;
2027         struct ndr_pull *pull;
2028         struct ndr_push *push;
2029         enum ndr_err_code ndr_err;
2030         DATA_BLOB blob;
2031         struct spoolss_ScheduleJob *r;
2032
2033         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_SCHEDULEJOB];
2034
2035         r = talloc(talloc_tos(), struct spoolss_ScheduleJob);
2036         if (r == NULL) {
2037                 return false;
2038         }
2039
2040         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2041                 talloc_free(r);
2042                 return false;
2043         }
2044
2045         pull = ndr_pull_init_blob(&blob, r, NULL);
2046         if (pull == NULL) {
2047                 talloc_free(r);
2048                 return false;
2049         }
2050
2051         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2052         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2053         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2054                 talloc_free(r);
2055                 return false;
2056         }
2057
2058         if (DEBUGLEVEL >= 10) {
2059                 NDR_PRINT_IN_DEBUG(spoolss_ScheduleJob, r);
2060         }
2061
2062         r->out.result = _spoolss_ScheduleJob(p, r);
2063
2064         if (p->rng_fault_state) {
2065                 talloc_free(r);
2066                 /* Return true here, srv_pipe_hnd.c will take care */
2067                 return true;
2068         }
2069
2070         if (DEBUGLEVEL >= 10) {
2071                 NDR_PRINT_OUT_DEBUG(spoolss_ScheduleJob, r);
2072         }
2073
2074         push = ndr_push_init_ctx(r, NULL);
2075         if (push == NULL) {
2076                 talloc_free(r);
2077                 return false;
2078         }
2079
2080         ndr_err = call->ndr_push(push, NDR_OUT, r);
2081         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2082                 talloc_free(r);
2083                 return false;
2084         }
2085
2086         blob = ndr_push_blob(push);
2087         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2088                 talloc_free(r);
2089                 return false;
2090         }
2091
2092         talloc_free(r);
2093
2094         return true;
2095 }
2096
2097 static bool api_spoolss_GetPrinterData(pipes_struct *p)
2098 {
2099         const struct ndr_interface_call *call;
2100         struct ndr_pull *pull;
2101         struct ndr_push *push;
2102         enum ndr_err_code ndr_err;
2103         DATA_BLOB blob;
2104         struct spoolss_GetPrinterData *r;
2105
2106         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_GETPRINTERDATA];
2107
2108         r = talloc(talloc_tos(), struct spoolss_GetPrinterData);
2109         if (r == NULL) {
2110                 return false;
2111         }
2112
2113         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2114                 talloc_free(r);
2115                 return false;
2116         }
2117
2118         pull = ndr_pull_init_blob(&blob, r, NULL);
2119         if (pull == NULL) {
2120                 talloc_free(r);
2121                 return false;
2122         }
2123
2124         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2125         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2126         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2127                 talloc_free(r);
2128                 return false;
2129         }
2130
2131         if (DEBUGLEVEL >= 10) {
2132                 NDR_PRINT_IN_DEBUG(spoolss_GetPrinterData, r);
2133         }
2134
2135         ZERO_STRUCT(r->out);
2136         r->out.type = talloc_zero(r, enum winreg_Type);
2137         if (r->out.type == NULL) {
2138                 talloc_free(r);
2139                 return false;
2140         }
2141
2142         r->out.data = talloc_zero(r, union spoolss_PrinterData);
2143         if (r->out.data == NULL) {
2144                 talloc_free(r);
2145                 return false;
2146         }
2147
2148         r->out.needed = talloc_zero(r, uint32_t);
2149         if (r->out.needed == NULL) {
2150                 talloc_free(r);
2151                 return false;
2152         }
2153
2154         r->out.result = _spoolss_GetPrinterData(p, r);
2155
2156         if (p->rng_fault_state) {
2157                 talloc_free(r);
2158                 /* Return true here, srv_pipe_hnd.c will take care */
2159                 return true;
2160         }
2161
2162         if (DEBUGLEVEL >= 10) {
2163                 NDR_PRINT_OUT_DEBUG(spoolss_GetPrinterData, r);
2164         }
2165
2166         push = ndr_push_init_ctx(r, NULL);
2167         if (push == NULL) {
2168                 talloc_free(r);
2169                 return false;
2170         }
2171
2172         ndr_err = call->ndr_push(push, NDR_OUT, r);
2173         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2174                 talloc_free(r);
2175                 return false;
2176         }
2177
2178         blob = ndr_push_blob(push);
2179         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2180                 talloc_free(r);
2181                 return false;
2182         }
2183
2184         talloc_free(r);
2185
2186         return true;
2187 }
2188
2189 static bool api_spoolss_SetPrinterData(pipes_struct *p)
2190 {
2191         const struct ndr_interface_call *call;
2192         struct ndr_pull *pull;
2193         struct ndr_push *push;
2194         enum ndr_err_code ndr_err;
2195         DATA_BLOB blob;
2196         struct spoolss_SetPrinterData *r;
2197
2198         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_SETPRINTERDATA];
2199
2200         r = talloc(talloc_tos(), struct spoolss_SetPrinterData);
2201         if (r == NULL) {
2202                 return false;
2203         }
2204
2205         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2206                 talloc_free(r);
2207                 return false;
2208         }
2209
2210         pull = ndr_pull_init_blob(&blob, r, NULL);
2211         if (pull == NULL) {
2212                 talloc_free(r);
2213                 return false;
2214         }
2215
2216         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2217         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2218         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2219                 talloc_free(r);
2220                 return false;
2221         }
2222
2223         if (DEBUGLEVEL >= 10) {
2224                 NDR_PRINT_IN_DEBUG(spoolss_SetPrinterData, r);
2225         }
2226
2227         r->out.result = _spoolss_SetPrinterData(p, r);
2228
2229         if (p->rng_fault_state) {
2230                 talloc_free(r);
2231                 /* Return true here, srv_pipe_hnd.c will take care */
2232                 return true;
2233         }
2234
2235         if (DEBUGLEVEL >= 10) {
2236                 NDR_PRINT_OUT_DEBUG(spoolss_SetPrinterData, r);
2237         }
2238
2239         push = ndr_push_init_ctx(r, NULL);
2240         if (push == NULL) {
2241                 talloc_free(r);
2242                 return false;
2243         }
2244
2245         ndr_err = call->ndr_push(push, NDR_OUT, r);
2246         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2247                 talloc_free(r);
2248                 return false;
2249         }
2250
2251         blob = ndr_push_blob(push);
2252         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2253                 talloc_free(r);
2254                 return false;
2255         }
2256
2257         talloc_free(r);
2258
2259         return true;
2260 }
2261
2262 static bool api_spoolss_WaitForPrinterChange(pipes_struct *p)
2263 {
2264         const struct ndr_interface_call *call;
2265         struct ndr_pull *pull;
2266         struct ndr_push *push;
2267         enum ndr_err_code ndr_err;
2268         DATA_BLOB blob;
2269         struct spoolss_WaitForPrinterChange *r;
2270
2271         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_WAITFORPRINTERCHANGE];
2272
2273         r = talloc(talloc_tos(), struct spoolss_WaitForPrinterChange);
2274         if (r == NULL) {
2275                 return false;
2276         }
2277
2278         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2279                 talloc_free(r);
2280                 return false;
2281         }
2282
2283         pull = ndr_pull_init_blob(&blob, r, NULL);
2284         if (pull == NULL) {
2285                 talloc_free(r);
2286                 return false;
2287         }
2288
2289         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2290         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2291         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2292                 talloc_free(r);
2293                 return false;
2294         }
2295
2296         if (DEBUGLEVEL >= 10) {
2297                 NDR_PRINT_IN_DEBUG(spoolss_WaitForPrinterChange, r);
2298         }
2299
2300         r->out.result = _spoolss_WaitForPrinterChange(p, r);
2301
2302         if (p->rng_fault_state) {
2303                 talloc_free(r);
2304                 /* Return true here, srv_pipe_hnd.c will take care */
2305                 return true;
2306         }
2307
2308         if (DEBUGLEVEL >= 10) {
2309                 NDR_PRINT_OUT_DEBUG(spoolss_WaitForPrinterChange, r);
2310         }
2311
2312         push = ndr_push_init_ctx(r, NULL);
2313         if (push == NULL) {
2314                 talloc_free(r);
2315                 return false;
2316         }
2317
2318         ndr_err = call->ndr_push(push, NDR_OUT, r);
2319         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2320                 talloc_free(r);
2321                 return false;
2322         }
2323
2324         blob = ndr_push_blob(push);
2325         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2326                 talloc_free(r);
2327                 return false;
2328         }
2329
2330         talloc_free(r);
2331
2332         return true;
2333 }
2334
2335 static bool api_spoolss_ClosePrinter(pipes_struct *p)
2336 {
2337         const struct ndr_interface_call *call;
2338         struct ndr_pull *pull;
2339         struct ndr_push *push;
2340         enum ndr_err_code ndr_err;
2341         DATA_BLOB blob;
2342         struct spoolss_ClosePrinter *r;
2343
2344         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_CLOSEPRINTER];
2345
2346         r = talloc(talloc_tos(), struct spoolss_ClosePrinter);
2347         if (r == NULL) {
2348                 return false;
2349         }
2350
2351         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2352                 talloc_free(r);
2353                 return false;
2354         }
2355
2356         pull = ndr_pull_init_blob(&blob, r, NULL);
2357         if (pull == NULL) {
2358                 talloc_free(r);
2359                 return false;
2360         }
2361
2362         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2363         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2364         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2365                 talloc_free(r);
2366                 return false;
2367         }
2368
2369         if (DEBUGLEVEL >= 10) {
2370                 NDR_PRINT_IN_DEBUG(spoolss_ClosePrinter, r);
2371         }
2372
2373         ZERO_STRUCT(r->out);
2374         r->out.handle = r->in.handle;
2375         r->out.result = _spoolss_ClosePrinter(p, r);
2376
2377         if (p->rng_fault_state) {
2378                 talloc_free(r);
2379                 /* Return true here, srv_pipe_hnd.c will take care */
2380                 return true;
2381         }
2382
2383         if (DEBUGLEVEL >= 10) {
2384                 NDR_PRINT_OUT_DEBUG(spoolss_ClosePrinter, r);
2385         }
2386
2387         push = ndr_push_init_ctx(r, NULL);
2388         if (push == NULL) {
2389                 talloc_free(r);
2390                 return false;
2391         }
2392
2393         ndr_err = call->ndr_push(push, NDR_OUT, r);
2394         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2395                 talloc_free(r);
2396                 return false;
2397         }
2398
2399         blob = ndr_push_blob(push);
2400         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2401                 talloc_free(r);
2402                 return false;
2403         }
2404
2405         talloc_free(r);
2406
2407         return true;
2408 }
2409
2410 static bool api_spoolss_AddForm(pipes_struct *p)
2411 {
2412         const struct ndr_interface_call *call;
2413         struct ndr_pull *pull;
2414         struct ndr_push *push;
2415         enum ndr_err_code ndr_err;
2416         DATA_BLOB blob;
2417         struct spoolss_AddForm *r;
2418
2419         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ADDFORM];
2420
2421         r = talloc(talloc_tos(), struct spoolss_AddForm);
2422         if (r == NULL) {
2423                 return false;
2424         }
2425
2426         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2427                 talloc_free(r);
2428                 return false;
2429         }
2430
2431         pull = ndr_pull_init_blob(&blob, r, NULL);
2432         if (pull == NULL) {
2433                 talloc_free(r);
2434                 return false;
2435         }
2436
2437         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2438         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2439         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2440                 talloc_free(r);
2441                 return false;
2442         }
2443
2444         if (DEBUGLEVEL >= 10) {
2445                 NDR_PRINT_IN_DEBUG(spoolss_AddForm, r);
2446         }
2447
2448         r->out.result = _spoolss_AddForm(p, r);
2449
2450         if (p->rng_fault_state) {
2451                 talloc_free(r);
2452                 /* Return true here, srv_pipe_hnd.c will take care */
2453                 return true;
2454         }
2455
2456         if (DEBUGLEVEL >= 10) {
2457                 NDR_PRINT_OUT_DEBUG(spoolss_AddForm, r);
2458         }
2459
2460         push = ndr_push_init_ctx(r, NULL);
2461         if (push == NULL) {
2462                 talloc_free(r);
2463                 return false;
2464         }
2465
2466         ndr_err = call->ndr_push(push, NDR_OUT, r);
2467         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2468                 talloc_free(r);
2469                 return false;
2470         }
2471
2472         blob = ndr_push_blob(push);
2473         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2474                 talloc_free(r);
2475                 return false;
2476         }
2477
2478         talloc_free(r);
2479
2480         return true;
2481 }
2482
2483 static bool api_spoolss_DeleteForm(pipes_struct *p)
2484 {
2485         const struct ndr_interface_call *call;
2486         struct ndr_pull *pull;
2487         struct ndr_push *push;
2488         enum ndr_err_code ndr_err;
2489         DATA_BLOB blob;
2490         struct spoolss_DeleteForm *r;
2491
2492         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEFORM];
2493
2494         r = talloc(talloc_tos(), struct spoolss_DeleteForm);
2495         if (r == NULL) {
2496                 return false;
2497         }
2498
2499         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2500                 talloc_free(r);
2501                 return false;
2502         }
2503
2504         pull = ndr_pull_init_blob(&blob, r, NULL);
2505         if (pull == NULL) {
2506                 talloc_free(r);
2507                 return false;
2508         }
2509
2510         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2511         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2512         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2513                 talloc_free(r);
2514                 return false;
2515         }
2516
2517         if (DEBUGLEVEL >= 10) {
2518                 NDR_PRINT_IN_DEBUG(spoolss_DeleteForm, r);
2519         }
2520
2521         r->out.result = _spoolss_DeleteForm(p, r);
2522
2523         if (p->rng_fault_state) {
2524                 talloc_free(r);
2525                 /* Return true here, srv_pipe_hnd.c will take care */
2526                 return true;
2527         }
2528
2529         if (DEBUGLEVEL >= 10) {
2530                 NDR_PRINT_OUT_DEBUG(spoolss_DeleteForm, r);
2531         }
2532
2533         push = ndr_push_init_ctx(r, NULL);
2534         if (push == NULL) {
2535                 talloc_free(r);
2536                 return false;
2537         }
2538
2539         ndr_err = call->ndr_push(push, NDR_OUT, r);
2540         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2541                 talloc_free(r);
2542                 return false;
2543         }
2544
2545         blob = ndr_push_blob(push);
2546         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2547                 talloc_free(r);
2548                 return false;
2549         }
2550
2551         talloc_free(r);
2552
2553         return true;
2554 }
2555
2556 static bool api_spoolss_GetForm(pipes_struct *p)
2557 {
2558         const struct ndr_interface_call *call;
2559         struct ndr_pull *pull;
2560         struct ndr_push *push;
2561         enum ndr_err_code ndr_err;
2562         DATA_BLOB blob;
2563         struct spoolss_GetForm *r;
2564
2565         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_GETFORM];
2566
2567         r = talloc(talloc_tos(), struct spoolss_GetForm);
2568         if (r == NULL) {
2569                 return false;
2570         }
2571
2572         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2573                 talloc_free(r);
2574                 return false;
2575         }
2576
2577         pull = ndr_pull_init_blob(&blob, r, NULL);
2578         if (pull == NULL) {
2579                 talloc_free(r);
2580                 return false;
2581         }
2582
2583         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2584         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2585         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2586                 talloc_free(r);
2587                 return false;
2588         }
2589
2590         if (DEBUGLEVEL >= 10) {
2591                 NDR_PRINT_IN_DEBUG(spoolss_GetForm, r);
2592         }
2593
2594         ZERO_STRUCT(r->out);
2595         r->out.info = talloc_zero(r, union spoolss_FormInfo);
2596         if (r->out.info == NULL) {
2597                 talloc_free(r);
2598                 return false;
2599         }
2600
2601         r->out.needed = talloc_zero(r, uint32_t);
2602         if (r->out.needed == NULL) {
2603                 talloc_free(r);
2604                 return false;
2605         }
2606
2607         r->out.result = _spoolss_GetForm(p, r);
2608
2609         if (p->rng_fault_state) {
2610                 talloc_free(r);
2611                 /* Return true here, srv_pipe_hnd.c will take care */
2612                 return true;
2613         }
2614
2615         if (DEBUGLEVEL >= 10) {
2616                 NDR_PRINT_OUT_DEBUG(spoolss_GetForm, r);
2617         }
2618
2619         push = ndr_push_init_ctx(r, NULL);
2620         if (push == NULL) {
2621                 talloc_free(r);
2622                 return false;
2623         }
2624
2625         ndr_err = call->ndr_push(push, NDR_OUT, r);
2626         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2627                 talloc_free(r);
2628                 return false;
2629         }
2630
2631         blob = ndr_push_blob(push);
2632         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2633                 talloc_free(r);
2634                 return false;
2635         }
2636
2637         talloc_free(r);
2638
2639         return true;
2640 }
2641
2642 static bool api_spoolss_SetForm(pipes_struct *p)
2643 {
2644         const struct ndr_interface_call *call;
2645         struct ndr_pull *pull;
2646         struct ndr_push *push;
2647         enum ndr_err_code ndr_err;
2648         DATA_BLOB blob;
2649         struct spoolss_SetForm *r;
2650
2651         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_SETFORM];
2652
2653         r = talloc(talloc_tos(), struct spoolss_SetForm);
2654         if (r == NULL) {
2655                 return false;
2656         }
2657
2658         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2659                 talloc_free(r);
2660                 return false;
2661         }
2662
2663         pull = ndr_pull_init_blob(&blob, r, NULL);
2664         if (pull == NULL) {
2665                 talloc_free(r);
2666                 return false;
2667         }
2668
2669         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2670         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2671         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2672                 talloc_free(r);
2673                 return false;
2674         }
2675
2676         if (DEBUGLEVEL >= 10) {
2677                 NDR_PRINT_IN_DEBUG(spoolss_SetForm, r);
2678         }
2679
2680         r->out.result = _spoolss_SetForm(p, r);
2681
2682         if (p->rng_fault_state) {
2683                 talloc_free(r);
2684                 /* Return true here, srv_pipe_hnd.c will take care */
2685                 return true;
2686         }
2687
2688         if (DEBUGLEVEL >= 10) {
2689                 NDR_PRINT_OUT_DEBUG(spoolss_SetForm, r);
2690         }
2691
2692         push = ndr_push_init_ctx(r, NULL);
2693         if (push == NULL) {
2694                 talloc_free(r);
2695                 return false;
2696         }
2697
2698         ndr_err = call->ndr_push(push, NDR_OUT, r);
2699         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2700                 talloc_free(r);
2701                 return false;
2702         }
2703
2704         blob = ndr_push_blob(push);
2705         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2706                 talloc_free(r);
2707                 return false;
2708         }
2709
2710         talloc_free(r);
2711
2712         return true;
2713 }
2714
2715 static bool api_spoolss_EnumForms(pipes_struct *p)
2716 {
2717         const struct ndr_interface_call *call;
2718         struct ndr_pull *pull;
2719         struct ndr_push *push;
2720         enum ndr_err_code ndr_err;
2721         DATA_BLOB blob;
2722         struct spoolss_EnumForms *r;
2723
2724         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ENUMFORMS];
2725
2726         r = talloc(talloc_tos(), struct spoolss_EnumForms);
2727         if (r == NULL) {
2728                 return false;
2729         }
2730
2731         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2732                 talloc_free(r);
2733                 return false;
2734         }
2735
2736         pull = ndr_pull_init_blob(&blob, r, NULL);
2737         if (pull == NULL) {
2738                 talloc_free(r);
2739                 return false;
2740         }
2741
2742         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2743         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2744         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2745                 talloc_free(r);
2746                 return false;
2747         }
2748
2749         if (DEBUGLEVEL >= 10) {
2750                 NDR_PRINT_IN_DEBUG(spoolss_EnumForms, r);
2751         }
2752
2753         ZERO_STRUCT(r->out);
2754         r->out.count = talloc_zero(r, uint32_t);
2755         if (r->out.count == NULL) {
2756                 talloc_free(r);
2757                 return false;
2758         }
2759
2760         r->out.info = talloc_zero(r, union spoolss_FormInfo *);
2761         if (r->out.info == NULL) {
2762                 talloc_free(r);
2763                 return false;
2764         }
2765
2766         r->out.needed = talloc_zero(r, uint32_t);
2767         if (r->out.needed == NULL) {
2768                 talloc_free(r);
2769                 return false;
2770         }
2771
2772         r->out.result = _spoolss_EnumForms(p, r);
2773
2774         if (p->rng_fault_state) {
2775                 talloc_free(r);
2776                 /* Return true here, srv_pipe_hnd.c will take care */
2777                 return true;
2778         }
2779
2780         if (DEBUGLEVEL >= 10) {
2781                 NDR_PRINT_OUT_DEBUG(spoolss_EnumForms, r);
2782         }
2783
2784         push = ndr_push_init_ctx(r, NULL);
2785         if (push == NULL) {
2786                 talloc_free(r);
2787                 return false;
2788         }
2789
2790         ndr_err = call->ndr_push(push, NDR_OUT, r);
2791         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2792                 talloc_free(r);
2793                 return false;
2794         }
2795
2796         blob = ndr_push_blob(push);
2797         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2798                 talloc_free(r);
2799                 return false;
2800         }
2801
2802         talloc_free(r);
2803
2804         return true;
2805 }
2806
2807 static bool api_spoolss_EnumPorts(pipes_struct *p)
2808 {
2809         const struct ndr_interface_call *call;
2810         struct ndr_pull *pull;
2811         struct ndr_push *push;
2812         enum ndr_err_code ndr_err;
2813         DATA_BLOB blob;
2814         struct spoolss_EnumPorts *r;
2815
2816         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ENUMPORTS];
2817
2818         r = talloc(talloc_tos(), struct spoolss_EnumPorts);
2819         if (r == NULL) {
2820                 return false;
2821         }
2822
2823         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2824                 talloc_free(r);
2825                 return false;
2826         }
2827
2828         pull = ndr_pull_init_blob(&blob, r, NULL);
2829         if (pull == NULL) {
2830                 talloc_free(r);
2831                 return false;
2832         }
2833
2834         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2835         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2836         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2837                 talloc_free(r);
2838                 return false;
2839         }
2840
2841         if (DEBUGLEVEL >= 10) {
2842                 NDR_PRINT_IN_DEBUG(spoolss_EnumPorts, r);
2843         }
2844
2845         ZERO_STRUCT(r->out);
2846         r->out.count = talloc_zero(r, uint32_t);
2847         if (r->out.count == NULL) {
2848                 talloc_free(r);
2849                 return false;
2850         }
2851
2852         r->out.info = talloc_zero(r, union spoolss_PortInfo *);
2853         if (r->out.info == NULL) {
2854                 talloc_free(r);
2855                 return false;
2856         }
2857
2858         r->out.needed = talloc_zero(r, uint32_t);
2859         if (r->out.needed == NULL) {
2860                 talloc_free(r);
2861                 return false;
2862         }
2863
2864         r->out.result = _spoolss_EnumPorts(p, r);
2865
2866         if (p->rng_fault_state) {
2867                 talloc_free(r);
2868                 /* Return true here, srv_pipe_hnd.c will take care */
2869                 return true;
2870         }
2871
2872         if (DEBUGLEVEL >= 10) {
2873                 NDR_PRINT_OUT_DEBUG(spoolss_EnumPorts, r);
2874         }
2875
2876         push = ndr_push_init_ctx(r, NULL);
2877         if (push == NULL) {
2878                 talloc_free(r);
2879                 return false;
2880         }
2881
2882         ndr_err = call->ndr_push(push, NDR_OUT, r);
2883         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2884                 talloc_free(r);
2885                 return false;
2886         }
2887
2888         blob = ndr_push_blob(push);
2889         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2890                 talloc_free(r);
2891                 return false;
2892         }
2893
2894         talloc_free(r);
2895
2896         return true;
2897 }
2898
2899 static bool api_spoolss_EnumMonitors(pipes_struct *p)
2900 {
2901         const struct ndr_interface_call *call;
2902         struct ndr_pull *pull;
2903         struct ndr_push *push;
2904         enum ndr_err_code ndr_err;
2905         DATA_BLOB blob;
2906         struct spoolss_EnumMonitors *r;
2907
2908         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ENUMMONITORS];
2909
2910         r = talloc(talloc_tos(), struct spoolss_EnumMonitors);
2911         if (r == NULL) {
2912                 return false;
2913         }
2914
2915         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2916                 talloc_free(r);
2917                 return false;
2918         }
2919
2920         pull = ndr_pull_init_blob(&blob, r, NULL);
2921         if (pull == NULL) {
2922                 talloc_free(r);
2923                 return false;
2924         }
2925
2926         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2927         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2928         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2929                 talloc_free(r);
2930                 return false;
2931         }
2932
2933         if (DEBUGLEVEL >= 10) {
2934                 NDR_PRINT_IN_DEBUG(spoolss_EnumMonitors, r);
2935         }
2936
2937         ZERO_STRUCT(r->out);
2938         r->out.count = talloc_zero(r, uint32_t);
2939         if (r->out.count == NULL) {
2940                 talloc_free(r);
2941                 return false;
2942         }
2943
2944         r->out.info = talloc_zero(r, union spoolss_MonitorInfo *);
2945         if (r->out.info == NULL) {
2946                 talloc_free(r);
2947                 return false;
2948         }
2949
2950         r->out.needed = talloc_zero(r, uint32_t);
2951         if (r->out.needed == NULL) {
2952                 talloc_free(r);
2953                 return false;
2954         }
2955
2956         r->out.result = _spoolss_EnumMonitors(p, r);
2957
2958         if (p->rng_fault_state) {
2959                 talloc_free(r);
2960                 /* Return true here, srv_pipe_hnd.c will take care */
2961                 return true;
2962         }
2963
2964         if (DEBUGLEVEL >= 10) {
2965                 NDR_PRINT_OUT_DEBUG(spoolss_EnumMonitors, r);
2966         }
2967
2968         push = ndr_push_init_ctx(r, NULL);
2969         if (push == NULL) {
2970                 talloc_free(r);
2971                 return false;
2972         }
2973
2974         ndr_err = call->ndr_push(push, NDR_OUT, r);
2975         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2976                 talloc_free(r);
2977                 return false;
2978         }
2979
2980         blob = ndr_push_blob(push);
2981         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2982                 talloc_free(r);
2983                 return false;
2984         }
2985
2986         talloc_free(r);
2987
2988         return true;
2989 }
2990
2991 static bool api_spoolss_AddPort(pipes_struct *p)
2992 {
2993         const struct ndr_interface_call *call;
2994         struct ndr_pull *pull;
2995         struct ndr_push *push;
2996         enum ndr_err_code ndr_err;
2997         DATA_BLOB blob;
2998         struct spoolss_AddPort *r;
2999
3000         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ADDPORT];
3001
3002         r = talloc(talloc_tos(), struct spoolss_AddPort);
3003         if (r == NULL) {
3004                 return false;
3005         }
3006
3007         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3008                 talloc_free(r);
3009                 return false;
3010         }
3011
3012         pull = ndr_pull_init_blob(&blob, r, NULL);
3013         if (pull == NULL) {
3014                 talloc_free(r);
3015                 return false;
3016         }
3017
3018         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3019         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3020         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3021                 talloc_free(r);
3022                 return false;
3023         }
3024
3025         if (DEBUGLEVEL >= 10) {
3026                 NDR_PRINT_IN_DEBUG(spoolss_AddPort, r);
3027         }
3028
3029         r->out.result = _spoolss_AddPort(p, r);
3030
3031         if (p->rng_fault_state) {
3032                 talloc_free(r);
3033                 /* Return true here, srv_pipe_hnd.c will take care */
3034                 return true;
3035         }
3036
3037         if (DEBUGLEVEL >= 10) {
3038                 NDR_PRINT_OUT_DEBUG(spoolss_AddPort, r);
3039         }
3040
3041         push = ndr_push_init_ctx(r, NULL);
3042         if (push == NULL) {
3043                 talloc_free(r);
3044                 return false;
3045         }
3046
3047         ndr_err = call->ndr_push(push, NDR_OUT, r);
3048         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3049                 talloc_free(r);
3050                 return false;
3051         }
3052
3053         blob = ndr_push_blob(push);
3054         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3055                 talloc_free(r);
3056                 return false;
3057         }
3058
3059         talloc_free(r);
3060
3061         return true;
3062 }
3063
3064 static bool api_spoolss_ConfigurePort(pipes_struct *p)
3065 {
3066         const struct ndr_interface_call *call;
3067         struct ndr_pull *pull;
3068         struct ndr_push *push;
3069         enum ndr_err_code ndr_err;
3070         DATA_BLOB blob;
3071         struct spoolss_ConfigurePort *r;
3072
3073         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_CONFIGUREPORT];
3074
3075         r = talloc(talloc_tos(), struct spoolss_ConfigurePort);
3076         if (r == NULL) {
3077                 return false;
3078         }
3079
3080         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3081                 talloc_free(r);
3082                 return false;
3083         }
3084
3085         pull = ndr_pull_init_blob(&blob, r, NULL);
3086         if (pull == NULL) {
3087                 talloc_free(r);
3088                 return false;
3089         }
3090
3091         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3092         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3093         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3094                 talloc_free(r);
3095                 return false;
3096         }
3097
3098         if (DEBUGLEVEL >= 10) {
3099                 NDR_PRINT_IN_DEBUG(spoolss_ConfigurePort, r);
3100         }
3101
3102         r->out.result = _spoolss_ConfigurePort(p, r);
3103
3104         if (p->rng_fault_state) {
3105                 talloc_free(r);
3106                 /* Return true here, srv_pipe_hnd.c will take care */
3107                 return true;
3108         }
3109
3110         if (DEBUGLEVEL >= 10) {
3111                 NDR_PRINT_OUT_DEBUG(spoolss_ConfigurePort, r);
3112         }
3113
3114         push = ndr_push_init_ctx(r, NULL);
3115         if (push == NULL) {
3116                 talloc_free(r);
3117                 return false;
3118         }
3119
3120         ndr_err = call->ndr_push(push, NDR_OUT, r);
3121         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3122                 talloc_free(r);
3123                 return false;
3124         }
3125
3126         blob = ndr_push_blob(push);
3127         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3128                 talloc_free(r);
3129                 return false;
3130         }
3131
3132         talloc_free(r);
3133
3134         return true;
3135 }
3136
3137 static bool api_spoolss_DeletePort(pipes_struct *p)
3138 {
3139         const struct ndr_interface_call *call;
3140         struct ndr_pull *pull;
3141         struct ndr_push *push;
3142         enum ndr_err_code ndr_err;
3143         DATA_BLOB blob;
3144         struct spoolss_DeletePort *r;
3145
3146         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEPORT];
3147
3148         r = talloc(talloc_tos(), struct spoolss_DeletePort);
3149         if (r == NULL) {
3150                 return false;
3151         }
3152
3153         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3154                 talloc_free(r);
3155                 return false;
3156         }
3157
3158         pull = ndr_pull_init_blob(&blob, r, NULL);
3159         if (pull == NULL) {
3160                 talloc_free(r);
3161                 return false;
3162         }
3163
3164         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3165         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3166         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3167                 talloc_free(r);
3168                 return false;
3169         }
3170
3171         if (DEBUGLEVEL >= 10) {
3172                 NDR_PRINT_IN_DEBUG(spoolss_DeletePort, r);
3173         }
3174
3175         r->out.result = _spoolss_DeletePort(p, r);
3176
3177         if (p->rng_fault_state) {
3178                 talloc_free(r);
3179                 /* Return true here, srv_pipe_hnd.c will take care */
3180                 return true;
3181         }
3182
3183         if (DEBUGLEVEL >= 10) {
3184                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePort, r);
3185         }
3186
3187         push = ndr_push_init_ctx(r, NULL);
3188         if (push == NULL) {
3189                 talloc_free(r);
3190                 return false;
3191         }
3192
3193         ndr_err = call->ndr_push(push, NDR_OUT, r);
3194         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3195                 talloc_free(r);
3196                 return false;
3197         }
3198
3199         blob = ndr_push_blob(push);
3200         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3201                 talloc_free(r);
3202                 return false;
3203         }
3204
3205         talloc_free(r);
3206
3207         return true;
3208 }
3209
3210 static bool api_spoolss_CreatePrinterIC(pipes_struct *p)
3211 {
3212         const struct ndr_interface_call *call;
3213         struct ndr_pull *pull;
3214         struct ndr_push *push;
3215         enum ndr_err_code ndr_err;
3216         DATA_BLOB blob;
3217         struct spoolss_CreatePrinterIC *r;
3218
3219         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_CREATEPRINTERIC];
3220
3221         r = talloc(talloc_tos(), struct spoolss_CreatePrinterIC);
3222         if (r == NULL) {
3223                 return false;
3224         }
3225
3226         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3227                 talloc_free(r);
3228                 return false;
3229         }
3230
3231         pull = ndr_pull_init_blob(&blob, r, NULL);
3232         if (pull == NULL) {
3233                 talloc_free(r);
3234                 return false;
3235         }
3236
3237         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3238         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3239         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3240                 talloc_free(r);
3241                 return false;
3242         }
3243
3244         if (DEBUGLEVEL >= 10) {
3245                 NDR_PRINT_IN_DEBUG(spoolss_CreatePrinterIC, r);
3246         }
3247
3248         ZERO_STRUCT(r->out);
3249         r->out.gdi_handle = talloc_zero(r, struct policy_handle);
3250         if (r->out.gdi_handle == NULL) {
3251                 talloc_free(r);
3252                 return false;
3253         }
3254
3255         r->out.result = _spoolss_CreatePrinterIC(p, r);
3256
3257         if (p->rng_fault_state) {
3258                 talloc_free(r);
3259                 /* Return true here, srv_pipe_hnd.c will take care */
3260                 return true;
3261         }
3262
3263         if (DEBUGLEVEL >= 10) {
3264                 NDR_PRINT_OUT_DEBUG(spoolss_CreatePrinterIC, r);
3265         }
3266
3267         push = ndr_push_init_ctx(r, NULL);
3268         if (push == NULL) {
3269                 talloc_free(r);
3270                 return false;
3271         }
3272
3273         ndr_err = call->ndr_push(push, NDR_OUT, r);
3274         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3275                 talloc_free(r);
3276                 return false;
3277         }
3278
3279         blob = ndr_push_blob(push);
3280         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3281                 talloc_free(r);
3282                 return false;
3283         }
3284
3285         talloc_free(r);
3286
3287         return true;
3288 }
3289
3290 static bool api_spoolss_PlayGDIScriptOnPrinterIC(pipes_struct *p)
3291 {
3292         const struct ndr_interface_call *call;
3293         struct ndr_pull *pull;
3294         struct ndr_push *push;
3295         enum ndr_err_code ndr_err;
3296         DATA_BLOB blob;
3297         struct spoolss_PlayGDIScriptOnPrinterIC *r;
3298
3299         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_PLAYGDISCRIPTONPRINTERIC];
3300
3301         r = talloc(talloc_tos(), struct spoolss_PlayGDIScriptOnPrinterIC);
3302         if (r == NULL) {
3303                 return false;
3304         }
3305
3306         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3307                 talloc_free(r);
3308                 return false;
3309         }
3310
3311         pull = ndr_pull_init_blob(&blob, r, NULL);
3312         if (pull == NULL) {
3313                 talloc_free(r);
3314                 return false;
3315         }
3316
3317         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3318         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3319         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3320                 talloc_free(r);
3321                 return false;
3322         }
3323
3324         if (DEBUGLEVEL >= 10) {
3325                 NDR_PRINT_IN_DEBUG(spoolss_PlayGDIScriptOnPrinterIC, r);
3326         }
3327
3328         r->out.result = _spoolss_PlayGDIScriptOnPrinterIC(p, r);
3329
3330         if (p->rng_fault_state) {
3331                 talloc_free(r);
3332                 /* Return true here, srv_pipe_hnd.c will take care */
3333                 return true;
3334         }
3335
3336         if (DEBUGLEVEL >= 10) {
3337                 NDR_PRINT_OUT_DEBUG(spoolss_PlayGDIScriptOnPrinterIC, r);
3338         }
3339
3340         push = ndr_push_init_ctx(r, NULL);
3341         if (push == NULL) {
3342                 talloc_free(r);
3343                 return false;
3344         }
3345
3346         ndr_err = call->ndr_push(push, NDR_OUT, r);
3347         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3348                 talloc_free(r);
3349                 return false;
3350         }
3351
3352         blob = ndr_push_blob(push);
3353         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3354                 talloc_free(r);
3355                 return false;
3356         }
3357
3358         talloc_free(r);
3359
3360         return true;
3361 }
3362
3363 static bool api_spoolss_DeletePrinterIC(pipes_struct *p)
3364 {
3365         const struct ndr_interface_call *call;
3366         struct ndr_pull *pull;
3367         struct ndr_push *push;
3368         enum ndr_err_code ndr_err;
3369         DATA_BLOB blob;
3370         struct spoolss_DeletePrinterIC *r;
3371
3372         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEPRINTERIC];
3373
3374         r = talloc(talloc_tos(), struct spoolss_DeletePrinterIC);
3375         if (r == NULL) {
3376                 return false;
3377         }
3378
3379         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3380                 talloc_free(r);
3381                 return false;
3382         }
3383
3384         pull = ndr_pull_init_blob(&blob, r, NULL);
3385         if (pull == NULL) {
3386                 talloc_free(r);
3387                 return false;
3388         }
3389
3390         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3391         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3392         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3393                 talloc_free(r);
3394                 return false;
3395         }
3396
3397         if (DEBUGLEVEL >= 10) {
3398                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrinterIC, r);
3399         }
3400
3401         ZERO_STRUCT(r->out);
3402         r->out.gdi_handle = r->in.gdi_handle;
3403         r->out.result = _spoolss_DeletePrinterIC(p, r);
3404
3405         if (p->rng_fault_state) {
3406                 talloc_free(r);
3407                 /* Return true here, srv_pipe_hnd.c will take care */
3408                 return true;
3409         }
3410
3411         if (DEBUGLEVEL >= 10) {
3412                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrinterIC, r);
3413         }
3414
3415         push = ndr_push_init_ctx(r, NULL);
3416         if (push == NULL) {
3417                 talloc_free(r);
3418                 return false;
3419         }
3420
3421         ndr_err = call->ndr_push(push, NDR_OUT, r);
3422         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3423                 talloc_free(r);
3424                 return false;
3425         }
3426
3427         blob = ndr_push_blob(push);
3428         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3429                 talloc_free(r);
3430                 return false;
3431         }
3432
3433         talloc_free(r);
3434
3435         return true;
3436 }
3437
3438 static bool api_spoolss_AddPrinterConnection(pipes_struct *p)
3439 {
3440         const struct ndr_interface_call *call;
3441         struct ndr_pull *pull;
3442         struct ndr_push *push;
3443         enum ndr_err_code ndr_err;
3444         DATA_BLOB blob;
3445         struct spoolss_AddPrinterConnection *r;
3446
3447         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ADDPRINTERCONNECTION];
3448
3449         r = talloc(talloc_tos(), struct spoolss_AddPrinterConnection);
3450         if (r == NULL) {
3451                 return false;
3452         }
3453
3454         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3455                 talloc_free(r);
3456                 return false;
3457         }
3458
3459         pull = ndr_pull_init_blob(&blob, r, NULL);
3460         if (pull == NULL) {
3461                 talloc_free(r);
3462                 return false;
3463         }
3464
3465         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3466         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3467         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3468                 talloc_free(r);
3469                 return false;
3470         }
3471
3472         if (DEBUGLEVEL >= 10) {
3473                 NDR_PRINT_IN_DEBUG(spoolss_AddPrinterConnection, r);
3474         }
3475
3476         r->out.result = _spoolss_AddPrinterConnection(p, r);
3477
3478         if (p->rng_fault_state) {
3479                 talloc_free(r);
3480                 /* Return true here, srv_pipe_hnd.c will take care */
3481                 return true;
3482         }
3483
3484         if (DEBUGLEVEL >= 10) {
3485                 NDR_PRINT_OUT_DEBUG(spoolss_AddPrinterConnection, r);
3486         }
3487
3488         push = ndr_push_init_ctx(r, NULL);
3489         if (push == NULL) {
3490                 talloc_free(r);
3491                 return false;
3492         }
3493
3494         ndr_err = call->ndr_push(push, NDR_OUT, r);
3495         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3496                 talloc_free(r);
3497                 return false;
3498         }
3499
3500         blob = ndr_push_blob(push);
3501         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3502                 talloc_free(r);
3503                 return false;
3504         }
3505
3506         talloc_free(r);
3507
3508         return true;
3509 }
3510
3511 static bool api_spoolss_DeletePrinterConnection(pipes_struct *p)
3512 {
3513         const struct ndr_interface_call *call;
3514         struct ndr_pull *pull;
3515         struct ndr_push *push;
3516         enum ndr_err_code ndr_err;
3517         DATA_BLOB blob;
3518         struct spoolss_DeletePrinterConnection *r;
3519
3520         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEPRINTERCONNECTION];
3521
3522         r = talloc(talloc_tos(), struct spoolss_DeletePrinterConnection);
3523         if (r == NULL) {
3524                 return false;
3525         }
3526
3527         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3528                 talloc_free(r);
3529                 return false;
3530         }
3531
3532         pull = ndr_pull_init_blob(&blob, r, NULL);
3533         if (pull == NULL) {
3534                 talloc_free(r);
3535                 return false;
3536         }
3537
3538         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3539         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3540         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3541                 talloc_free(r);
3542                 return false;
3543         }
3544
3545         if (DEBUGLEVEL >= 10) {
3546                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrinterConnection, r);
3547         }
3548
3549         r->out.result = _spoolss_DeletePrinterConnection(p, r);
3550
3551         if (p->rng_fault_state) {
3552                 talloc_free(r);
3553                 /* Return true here, srv_pipe_hnd.c will take care */
3554                 return true;
3555         }
3556
3557         if (DEBUGLEVEL >= 10) {
3558                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrinterConnection, r);
3559         }
3560
3561         push = ndr_push_init_ctx(r, NULL);
3562         if (push == NULL) {
3563                 talloc_free(r);
3564                 return false;
3565         }
3566
3567         ndr_err = call->ndr_push(push, NDR_OUT, r);
3568         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3569                 talloc_free(r);
3570                 return false;
3571         }
3572
3573         blob = ndr_push_blob(push);
3574         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3575                 talloc_free(r);
3576                 return false;
3577         }
3578
3579         talloc_free(r);
3580
3581         return true;
3582 }
3583
3584 static bool api_spoolss_PrinterMessageBox(pipes_struct *p)
3585 {
3586         const struct ndr_interface_call *call;
3587         struct ndr_pull *pull;
3588         struct ndr_push *push;
3589         enum ndr_err_code ndr_err;
3590         DATA_BLOB blob;
3591         struct spoolss_PrinterMessageBox *r;
3592
3593         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_PRINTERMESSAGEBOX];
3594
3595         r = talloc(talloc_tos(), struct spoolss_PrinterMessageBox);
3596         if (r == NULL) {
3597                 return false;
3598         }
3599
3600         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3601                 talloc_free(r);
3602                 return false;
3603         }
3604
3605         pull = ndr_pull_init_blob(&blob, r, NULL);
3606         if (pull == NULL) {
3607                 talloc_free(r);
3608                 return false;
3609         }
3610
3611         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3612         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3613         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3614                 talloc_free(r);
3615                 return false;
3616         }
3617
3618         if (DEBUGLEVEL >= 10) {
3619                 NDR_PRINT_IN_DEBUG(spoolss_PrinterMessageBox, r);
3620         }
3621
3622         r->out.result = _spoolss_PrinterMessageBox(p, r);
3623
3624         if (p->rng_fault_state) {
3625                 talloc_free(r);
3626                 /* Return true here, srv_pipe_hnd.c will take care */
3627                 return true;
3628         }
3629
3630         if (DEBUGLEVEL >= 10) {
3631                 NDR_PRINT_OUT_DEBUG(spoolss_PrinterMessageBox, r);
3632         }
3633
3634         push = ndr_push_init_ctx(r, NULL);
3635         if (push == NULL) {
3636                 talloc_free(r);
3637                 return false;
3638         }
3639
3640         ndr_err = call->ndr_push(push, NDR_OUT, r);
3641         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3642                 talloc_free(r);
3643                 return false;
3644         }
3645
3646         blob = ndr_push_blob(push);
3647         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3648                 talloc_free(r);
3649                 return false;
3650         }
3651
3652         talloc_free(r);
3653
3654         return true;
3655 }
3656
3657 static bool api_spoolss_AddMonitor(pipes_struct *p)
3658 {
3659         const struct ndr_interface_call *call;
3660         struct ndr_pull *pull;
3661         struct ndr_push *push;
3662         enum ndr_err_code ndr_err;
3663         DATA_BLOB blob;
3664         struct spoolss_AddMonitor *r;
3665
3666         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ADDMONITOR];
3667
3668         r = talloc(talloc_tos(), struct spoolss_AddMonitor);
3669         if (r == NULL) {
3670                 return false;
3671         }
3672
3673         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3674                 talloc_free(r);
3675                 return false;
3676         }
3677
3678         pull = ndr_pull_init_blob(&blob, r, NULL);
3679         if (pull == NULL) {
3680                 talloc_free(r);
3681                 return false;
3682         }
3683
3684         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3685         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3686         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3687                 talloc_free(r);
3688                 return false;
3689         }
3690
3691         if (DEBUGLEVEL >= 10) {
3692                 NDR_PRINT_IN_DEBUG(spoolss_AddMonitor, r);
3693         }
3694
3695         r->out.result = _spoolss_AddMonitor(p, r);
3696
3697         if (p->rng_fault_state) {
3698                 talloc_free(r);
3699                 /* Return true here, srv_pipe_hnd.c will take care */
3700                 return true;
3701         }
3702
3703         if (DEBUGLEVEL >= 10) {
3704                 NDR_PRINT_OUT_DEBUG(spoolss_AddMonitor, r);
3705         }
3706
3707         push = ndr_push_init_ctx(r, NULL);
3708         if (push == NULL) {
3709                 talloc_free(r);
3710                 return false;
3711         }
3712
3713         ndr_err = call->ndr_push(push, NDR_OUT, r);
3714         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3715                 talloc_free(r);
3716                 return false;
3717         }
3718
3719         blob = ndr_push_blob(push);
3720         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3721                 talloc_free(r);
3722                 return false;
3723         }
3724
3725         talloc_free(r);
3726
3727         return true;
3728 }
3729
3730 static bool api_spoolss_DeleteMonitor(pipes_struct *p)
3731 {
3732         const struct ndr_interface_call *call;
3733         struct ndr_pull *pull;
3734         struct ndr_push *push;
3735         enum ndr_err_code ndr_err;
3736         DATA_BLOB blob;
3737         struct spoolss_DeleteMonitor *r;
3738
3739         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEMONITOR];
3740
3741         r = talloc(talloc_tos(), struct spoolss_DeleteMonitor);
3742         if (r == NULL) {
3743                 return false;
3744         }
3745
3746         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3747                 talloc_free(r);
3748                 return false;
3749         }
3750
3751         pull = ndr_pull_init_blob(&blob, r, NULL);
3752         if (pull == NULL) {
3753                 talloc_free(r);
3754                 return false;
3755         }
3756
3757         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3758         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3759         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3760                 talloc_free(r);
3761                 return false;
3762         }
3763
3764         if (DEBUGLEVEL >= 10) {
3765                 NDR_PRINT_IN_DEBUG(spoolss_DeleteMonitor, r);
3766         }
3767
3768         r->out.result = _spoolss_DeleteMonitor(p, r);
3769
3770         if (p->rng_fault_state) {
3771                 talloc_free(r);
3772                 /* Return true here, srv_pipe_hnd.c will take care */
3773                 return true;
3774         }
3775
3776         if (DEBUGLEVEL >= 10) {
3777                 NDR_PRINT_OUT_DEBUG(spoolss_DeleteMonitor, r);
3778         }
3779
3780         push = ndr_push_init_ctx(r, NULL);
3781         if (push == NULL) {
3782                 talloc_free(r);
3783                 return false;
3784         }
3785
3786         ndr_err = call->ndr_push(push, NDR_OUT, r);
3787         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3788                 talloc_free(r);
3789                 return false;
3790         }
3791
3792         blob = ndr_push_blob(push);
3793         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3794                 talloc_free(r);
3795                 return false;
3796         }
3797
3798         talloc_free(r);
3799
3800         return true;
3801 }
3802
3803 static bool api_spoolss_DeletePrintProcessor(pipes_struct *p)
3804 {
3805         const struct ndr_interface_call *call;
3806         struct ndr_pull *pull;
3807         struct ndr_push *push;
3808         enum ndr_err_code ndr_err;
3809         DATA_BLOB blob;
3810         struct spoolss_DeletePrintProcessor *r;
3811
3812         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEPRINTPROCESSOR];
3813
3814         r = talloc(talloc_tos(), struct spoolss_DeletePrintProcessor);
3815         if (r == NULL) {
3816                 return false;
3817         }
3818
3819         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3820                 talloc_free(r);
3821                 return false;
3822         }
3823
3824         pull = ndr_pull_init_blob(&blob, r, NULL);
3825         if (pull == NULL) {
3826                 talloc_free(r);
3827                 return false;
3828         }
3829
3830         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3831         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3832         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3833                 talloc_free(r);
3834                 return false;
3835         }
3836
3837         if (DEBUGLEVEL >= 10) {
3838                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrintProcessor, r);
3839         }
3840
3841         r->out.result = _spoolss_DeletePrintProcessor(p, r);
3842
3843         if (p->rng_fault_state) {
3844                 talloc_free(r);
3845                 /* Return true here, srv_pipe_hnd.c will take care */
3846                 return true;
3847         }
3848
3849         if (DEBUGLEVEL >= 10) {
3850                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrintProcessor, r);
3851         }
3852
3853         push = ndr_push_init_ctx(r, NULL);
3854         if (push == NULL) {
3855                 talloc_free(r);
3856                 return false;
3857         }
3858
3859         ndr_err = call->ndr_push(push, NDR_OUT, r);
3860         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3861                 talloc_free(r);
3862                 return false;
3863         }
3864
3865         blob = ndr_push_blob(push);
3866         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3867                 talloc_free(r);
3868                 return false;
3869         }
3870
3871         talloc_free(r);
3872
3873         return true;
3874 }
3875
3876 static bool api_spoolss_AddPrintProvidor(pipes_struct *p)
3877 {
3878         const struct ndr_interface_call *call;
3879         struct ndr_pull *pull;
3880         struct ndr_push *push;
3881         enum ndr_err_code ndr_err;
3882         DATA_BLOB blob;
3883         struct spoolss_AddPrintProvidor *r;
3884
3885         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ADDPRINTPROVIDOR];
3886
3887         r = talloc(talloc_tos(), struct spoolss_AddPrintProvidor);
3888         if (r == NULL) {
3889                 return false;
3890         }
3891
3892         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3893                 talloc_free(r);
3894                 return false;
3895         }
3896
3897         pull = ndr_pull_init_blob(&blob, r, NULL);
3898         if (pull == NULL) {
3899                 talloc_free(r);
3900                 return false;
3901         }
3902
3903         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3904         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3905         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3906                 talloc_free(r);
3907                 return false;
3908         }
3909
3910         if (DEBUGLEVEL >= 10) {
3911                 NDR_PRINT_IN_DEBUG(spoolss_AddPrintProvidor, r);
3912         }
3913
3914         r->out.result = _spoolss_AddPrintProvidor(p, r);
3915
3916         if (p->rng_fault_state) {
3917                 talloc_free(r);
3918                 /* Return true here, srv_pipe_hnd.c will take care */
3919                 return true;
3920         }
3921
3922         if (DEBUGLEVEL >= 10) {
3923                 NDR_PRINT_OUT_DEBUG(spoolss_AddPrintProvidor, r);
3924         }
3925
3926         push = ndr_push_init_ctx(r, NULL);
3927         if (push == NULL) {
3928                 talloc_free(r);
3929                 return false;
3930         }
3931
3932         ndr_err = call->ndr_push(push, NDR_OUT, r);
3933         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3934                 talloc_free(r);
3935                 return false;
3936         }
3937
3938         blob = ndr_push_blob(push);
3939         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3940                 talloc_free(r);
3941                 return false;
3942         }
3943
3944         talloc_free(r);
3945
3946         return true;
3947 }
3948
3949 static bool api_spoolss_DeletePrintProvidor(pipes_struct *p)
3950 {
3951         const struct ndr_interface_call *call;
3952         struct ndr_pull *pull;
3953         struct ndr_push *push;
3954         enum ndr_err_code ndr_err;
3955         DATA_BLOB blob;
3956         struct spoolss_DeletePrintProvidor *r;
3957
3958         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEPRINTPROVIDOR];
3959
3960         r = talloc(talloc_tos(), struct spoolss_DeletePrintProvidor);
3961         if (r == NULL) {
3962                 return false;
3963         }
3964
3965         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3966                 talloc_free(r);
3967                 return false;
3968         }
3969
3970         pull = ndr_pull_init_blob(&blob, r, NULL);
3971         if (pull == NULL) {
3972                 talloc_free(r);
3973                 return false;
3974         }
3975
3976         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3977         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3978         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3979                 talloc_free(r);
3980                 return false;
3981         }
3982
3983         if (DEBUGLEVEL >= 10) {
3984                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrintProvidor, r);
3985         }
3986
3987         r->out.result = _spoolss_DeletePrintProvidor(p, r);
3988
3989         if (p->rng_fault_state) {
3990                 talloc_free(r);
3991                 /* Return true here, srv_pipe_hnd.c will take care */
3992                 return true;
3993         }
3994
3995         if (DEBUGLEVEL >= 10) {
3996                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrintProvidor, r);
3997         }
3998
3999         push = ndr_push_init_ctx(r, NULL);
4000         if (push == NULL) {
4001                 talloc_free(r);
4002                 return false;
4003         }
4004
4005         ndr_err = call->ndr_push(push, NDR_OUT, r);
4006         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4007                 talloc_free(r);
4008                 return false;
4009         }
4010
4011         blob = ndr_push_blob(push);
4012         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4013                 talloc_free(r);
4014                 return false;
4015         }
4016
4017         talloc_free(r);
4018
4019         return true;
4020 }
4021
4022 static bool api_spoolss_EnumPrintProcDataTypes(pipes_struct *p)
4023 {
4024         const struct ndr_interface_call *call;
4025         struct ndr_pull *pull;
4026         struct ndr_push *push;
4027         enum ndr_err_code ndr_err;
4028         DATA_BLOB blob;
4029         struct spoolss_EnumPrintProcDataTypes *r;
4030
4031         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ENUMPRINTPROCDATATYPES];
4032
4033         r = talloc(talloc_tos(), struct spoolss_EnumPrintProcDataTypes);
4034         if (r == NULL) {
4035                 return false;
4036         }
4037
4038         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4039                 talloc_free(r);
4040                 return false;
4041         }
4042
4043         pull = ndr_pull_init_blob(&blob, r, NULL);
4044         if (pull == NULL) {
4045                 talloc_free(r);
4046                 return false;
4047         }
4048
4049         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4050         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4051         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4052                 talloc_free(r);
4053                 return false;
4054         }
4055
4056         if (DEBUGLEVEL >= 10) {
4057                 NDR_PRINT_IN_DEBUG(spoolss_EnumPrintProcDataTypes, r);
4058         }
4059
4060         ZERO_STRUCT(r->out);
4061         r->out.count = talloc_zero(r, uint32_t);
4062         if (r->out.count == NULL) {
4063                 talloc_free(r);
4064                 return false;
4065         }
4066
4067         r->out.info = talloc_zero(r, union spoolss_PrintProcDataTypesInfo *);
4068         if (r->out.info == NULL) {
4069                 talloc_free(r);
4070                 return false;
4071         }
4072
4073         r->out.needed = talloc_zero(r, uint32_t);
4074         if (r->out.needed == NULL) {
4075                 talloc_free(r);
4076                 return false;
4077         }
4078
4079         r->out.result = _spoolss_EnumPrintProcDataTypes(p, r);
4080
4081         if (p->rng_fault_state) {
4082                 talloc_free(r);
4083                 /* Return true here, srv_pipe_hnd.c will take care */
4084                 return true;
4085         }
4086
4087         if (DEBUGLEVEL >= 10) {
4088                 NDR_PRINT_OUT_DEBUG(spoolss_EnumPrintProcDataTypes, r);
4089         }
4090
4091         push = ndr_push_init_ctx(r, NULL);
4092         if (push == NULL) {
4093                 talloc_free(r);
4094                 return false;
4095         }
4096
4097         ndr_err = call->ndr_push(push, NDR_OUT, r);
4098         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4099                 talloc_free(r);
4100                 return false;
4101         }
4102
4103         blob = ndr_push_blob(push);
4104         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4105                 talloc_free(r);
4106                 return false;
4107         }
4108
4109         talloc_free(r);
4110
4111         return true;
4112 }
4113
4114 static bool api_spoolss_ResetPrinter(pipes_struct *p)
4115 {
4116         const struct ndr_interface_call *call;
4117         struct ndr_pull *pull;
4118         struct ndr_push *push;
4119         enum ndr_err_code ndr_err;
4120         DATA_BLOB blob;
4121         struct spoolss_ResetPrinter *r;
4122
4123         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_RESETPRINTER];
4124
4125         r = talloc(talloc_tos(), struct spoolss_ResetPrinter);
4126         if (r == NULL) {
4127                 return false;
4128         }
4129
4130         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4131                 talloc_free(r);
4132                 return false;
4133         }
4134
4135         pull = ndr_pull_init_blob(&blob, r, NULL);
4136         if (pull == NULL) {
4137                 talloc_free(r);
4138                 return false;
4139         }
4140
4141         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4142         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4143         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4144                 talloc_free(r);
4145                 return false;
4146         }
4147
4148         if (DEBUGLEVEL >= 10) {
4149                 NDR_PRINT_IN_DEBUG(spoolss_ResetPrinter, r);
4150         }
4151
4152         r->out.result = _spoolss_ResetPrinter(p, r);
4153
4154         if (p->rng_fault_state) {
4155                 talloc_free(r);
4156                 /* Return true here, srv_pipe_hnd.c will take care */
4157                 return true;
4158         }
4159
4160         if (DEBUGLEVEL >= 10) {
4161                 NDR_PRINT_OUT_DEBUG(spoolss_ResetPrinter, r);
4162         }
4163
4164         push = ndr_push_init_ctx(r, NULL);
4165         if (push == NULL) {
4166                 talloc_free(r);
4167                 return false;
4168         }
4169
4170         ndr_err = call->ndr_push(push, NDR_OUT, r);
4171         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4172                 talloc_free(r);
4173                 return false;
4174         }
4175
4176         blob = ndr_push_blob(push);
4177         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4178                 talloc_free(r);
4179                 return false;
4180         }
4181
4182         talloc_free(r);
4183
4184         return true;
4185 }
4186
4187 static bool api_spoolss_GetPrinterDriver2(pipes_struct *p)
4188 {
4189         const struct ndr_interface_call *call;
4190         struct ndr_pull *pull;
4191         struct ndr_push *push;
4192         enum ndr_err_code ndr_err;
4193         DATA_BLOB blob;
4194         struct spoolss_GetPrinterDriver2 *r;
4195
4196         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_GETPRINTERDRIVER2];
4197
4198         r = talloc(talloc_tos(), struct spoolss_GetPrinterDriver2);
4199         if (r == NULL) {
4200                 return false;
4201         }
4202
4203         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4204                 talloc_free(r);
4205                 return false;
4206         }
4207
4208         pull = ndr_pull_init_blob(&blob, r, NULL);
4209         if (pull == NULL) {
4210                 talloc_free(r);
4211                 return false;
4212         }
4213
4214         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4215         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4216         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4217                 talloc_free(r);
4218                 return false;
4219         }
4220
4221         if (DEBUGLEVEL >= 10) {
4222                 NDR_PRINT_IN_DEBUG(spoolss_GetPrinterDriver2, r);
4223         }
4224
4225         ZERO_STRUCT(r->out);
4226         r->out.info = talloc_zero(r, union spoolss_DriverInfo);
4227         if (r->out.info == NULL) {
4228                 talloc_free(r);
4229                 return false;
4230         }
4231
4232         r->out.needed = talloc_zero(r, uint32_t);
4233         if (r->out.needed == NULL) {
4234                 talloc_free(r);
4235                 return false;
4236         }
4237
4238         r->out.server_major_version = talloc_zero(r, uint32_t);
4239         if (r->out.server_major_version == NULL) {
4240                 talloc_free(r);
4241                 return false;
4242         }
4243
4244         r->out.server_minor_version = talloc_zero(r, uint32_t);
4245         if (r->out.server_minor_version == NULL) {
4246                 talloc_free(r);
4247                 return false;
4248         }
4249
4250         r->out.result = _spoolss_GetPrinterDriver2(p, r);
4251
4252         if (p->rng_fault_state) {
4253                 talloc_free(r);
4254                 /* Return true here, srv_pipe_hnd.c will take care */
4255                 return true;
4256         }
4257
4258         if (DEBUGLEVEL >= 10) {
4259                 NDR_PRINT_OUT_DEBUG(spoolss_GetPrinterDriver2, r);
4260         }
4261
4262         push = ndr_push_init_ctx(r, NULL);
4263         if (push == NULL) {
4264                 talloc_free(r);
4265                 return false;
4266         }
4267
4268         ndr_err = call->ndr_push(push, NDR_OUT, r);
4269         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4270                 talloc_free(r);
4271                 return false;
4272         }
4273
4274         blob = ndr_push_blob(push);
4275         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4276                 talloc_free(r);
4277                 return false;
4278         }
4279
4280         talloc_free(r);
4281
4282         return true;
4283 }
4284
4285 static bool api_spoolss_FindFirstPrinterChangeNotification(pipes_struct *p)
4286 {
4287         const struct ndr_interface_call *call;
4288         struct ndr_pull *pull;
4289         struct ndr_push *push;
4290         enum ndr_err_code ndr_err;
4291         DATA_BLOB blob;
4292         struct spoolss_FindFirstPrinterChangeNotification *r;
4293
4294         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_FINDFIRSTPRINTERCHANGENOTIFICATION];
4295
4296         r = talloc(talloc_tos(), struct spoolss_FindFirstPrinterChangeNotification);
4297         if (r == NULL) {
4298                 return false;
4299         }
4300
4301         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4302                 talloc_free(r);
4303                 return false;
4304         }
4305
4306         pull = ndr_pull_init_blob(&blob, r, NULL);
4307         if (pull == NULL) {
4308                 talloc_free(r);
4309                 return false;
4310         }
4311
4312         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4313         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4314         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4315                 talloc_free(r);
4316                 return false;
4317         }
4318
4319         if (DEBUGLEVEL >= 10) {
4320                 NDR_PRINT_IN_DEBUG(spoolss_FindFirstPrinterChangeNotification, r);
4321         }
4322
4323         r->out.result = _spoolss_FindFirstPrinterChangeNotification(p, r);
4324
4325         if (p->rng_fault_state) {
4326                 talloc_free(r);
4327                 /* Return true here, srv_pipe_hnd.c will take care */
4328                 return true;
4329         }
4330
4331         if (DEBUGLEVEL >= 10) {
4332                 NDR_PRINT_OUT_DEBUG(spoolss_FindFirstPrinterChangeNotification, r);
4333         }
4334
4335         push = ndr_push_init_ctx(r, NULL);
4336         if (push == NULL) {
4337                 talloc_free(r);
4338                 return false;
4339         }
4340
4341         ndr_err = call->ndr_push(push, NDR_OUT, r);
4342         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4343                 talloc_free(r);
4344                 return false;
4345         }
4346
4347         blob = ndr_push_blob(push);
4348         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4349                 talloc_free(r);
4350                 return false;
4351         }
4352
4353         talloc_free(r);
4354
4355         return true;
4356 }
4357
4358 static bool api_spoolss_FindNextPrinterChangeNotification(pipes_struct *p)
4359 {
4360         const struct ndr_interface_call *call;
4361         struct ndr_pull *pull;
4362         struct ndr_push *push;
4363         enum ndr_err_code ndr_err;
4364         DATA_BLOB blob;
4365         struct spoolss_FindNextPrinterChangeNotification *r;
4366
4367         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_FINDNEXTPRINTERCHANGENOTIFICATION];
4368
4369         r = talloc(talloc_tos(), struct spoolss_FindNextPrinterChangeNotification);
4370         if (r == NULL) {
4371                 return false;
4372         }
4373
4374         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4375                 talloc_free(r);
4376                 return false;
4377         }
4378
4379         pull = ndr_pull_init_blob(&blob, r, NULL);
4380         if (pull == NULL) {
4381                 talloc_free(r);
4382                 return false;
4383         }
4384
4385         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4386         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4387         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4388                 talloc_free(r);
4389                 return false;
4390         }
4391
4392         if (DEBUGLEVEL >= 10) {
4393                 NDR_PRINT_IN_DEBUG(spoolss_FindNextPrinterChangeNotification, r);
4394         }
4395
4396         r->out.result = _spoolss_FindNextPrinterChangeNotification(p, r);
4397
4398         if (p->rng_fault_state) {
4399                 talloc_free(r);
4400                 /* Return true here, srv_pipe_hnd.c will take care */
4401                 return true;
4402         }
4403
4404         if (DEBUGLEVEL >= 10) {
4405                 NDR_PRINT_OUT_DEBUG(spoolss_FindNextPrinterChangeNotification, r);
4406         }
4407
4408         push = ndr_push_init_ctx(r, NULL);
4409         if (push == NULL) {
4410                 talloc_free(r);
4411                 return false;
4412         }
4413
4414         ndr_err = call->ndr_push(push, NDR_OUT, r);
4415         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4416                 talloc_free(r);
4417                 return false;
4418         }
4419
4420         blob = ndr_push_blob(push);
4421         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4422                 talloc_free(r);
4423                 return false;
4424         }
4425
4426         talloc_free(r);
4427
4428         return true;
4429 }
4430
4431 static bool api_spoolss_FindClosePrinterNotify(pipes_struct *p)
4432 {
4433         const struct ndr_interface_call *call;
4434         struct ndr_pull *pull;
4435         struct ndr_push *push;
4436         enum ndr_err_code ndr_err;
4437         DATA_BLOB blob;
4438         struct spoolss_FindClosePrinterNotify *r;
4439
4440         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_FINDCLOSEPRINTERNOTIFY];
4441
4442         r = talloc(talloc_tos(), struct spoolss_FindClosePrinterNotify);
4443         if (r == NULL) {
4444                 return false;
4445         }
4446
4447         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4448                 talloc_free(r);
4449                 return false;
4450         }
4451
4452         pull = ndr_pull_init_blob(&blob, r, NULL);
4453         if (pull == NULL) {
4454                 talloc_free(r);
4455                 return false;
4456         }
4457
4458         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4459         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4460         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4461                 talloc_free(r);
4462                 return false;
4463         }
4464
4465         if (DEBUGLEVEL >= 10) {
4466                 NDR_PRINT_IN_DEBUG(spoolss_FindClosePrinterNotify, r);
4467         }
4468
4469         r->out.result = _spoolss_FindClosePrinterNotify(p, r);
4470
4471         if (p->rng_fault_state) {
4472                 talloc_free(r);
4473                 /* Return true here, srv_pipe_hnd.c will take care */
4474                 return true;
4475         }
4476
4477         if (DEBUGLEVEL >= 10) {
4478                 NDR_PRINT_OUT_DEBUG(spoolss_FindClosePrinterNotify, r);
4479         }
4480
4481         push = ndr_push_init_ctx(r, NULL);
4482         if (push == NULL) {
4483                 talloc_free(r);
4484                 return false;
4485         }
4486
4487         ndr_err = call->ndr_push(push, NDR_OUT, r);
4488         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4489                 talloc_free(r);
4490                 return false;
4491         }
4492
4493         blob = ndr_push_blob(push);
4494         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4495                 talloc_free(r);
4496                 return false;
4497         }
4498
4499         talloc_free(r);
4500
4501         return true;
4502 }
4503
4504 static bool api_spoolss_RouterFindFirstPrinterChangeNotificationOld(pipes_struct *p)
4505 {
4506         const struct ndr_interface_call *call;
4507         struct ndr_pull *pull;
4508         struct ndr_push *push;
4509         enum ndr_err_code ndr_err;
4510         DATA_BLOB blob;
4511         struct spoolss_RouterFindFirstPrinterChangeNotificationOld *r;
4512
4513         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ROUTERFINDFIRSTPRINTERCHANGENOTIFICATIONOLD];
4514
4515         r = talloc(talloc_tos(), struct spoolss_RouterFindFirstPrinterChangeNotificationOld);
4516         if (r == NULL) {
4517                 return false;
4518         }
4519
4520         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4521                 talloc_free(r);
4522                 return false;
4523         }
4524
4525         pull = ndr_pull_init_blob(&blob, r, NULL);
4526         if (pull == NULL) {
4527                 talloc_free(r);
4528                 return false;
4529         }
4530
4531         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4532         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4533         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4534                 talloc_free(r);
4535                 return false;
4536         }
4537
4538         if (DEBUGLEVEL >= 10) {
4539                 NDR_PRINT_IN_DEBUG(spoolss_RouterFindFirstPrinterChangeNotificationOld, r);
4540         }
4541
4542         r->out.result = _spoolss_RouterFindFirstPrinterChangeNotificationOld(p, r);
4543
4544         if (p->rng_fault_state) {
4545                 talloc_free(r);
4546                 /* Return true here, srv_pipe_hnd.c will take care */
4547                 return true;
4548         }
4549
4550         if (DEBUGLEVEL >= 10) {
4551                 NDR_PRINT_OUT_DEBUG(spoolss_RouterFindFirstPrinterChangeNotificationOld, r);
4552         }
4553
4554         push = ndr_push_init_ctx(r, NULL);
4555         if (push == NULL) {
4556                 talloc_free(r);
4557                 return false;
4558         }
4559
4560         ndr_err = call->ndr_push(push, NDR_OUT, r);
4561         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4562                 talloc_free(r);
4563                 return false;
4564         }
4565
4566         blob = ndr_push_blob(push);
4567         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4568                 talloc_free(r);
4569                 return false;
4570         }
4571
4572         talloc_free(r);
4573
4574         return true;
4575 }
4576
4577 static bool api_spoolss_ReplyOpenPrinter(pipes_struct *p)
4578 {
4579         const struct ndr_interface_call *call;
4580         struct ndr_pull *pull;
4581         struct ndr_push *push;
4582         enum ndr_err_code ndr_err;
4583         DATA_BLOB blob;
4584         struct spoolss_ReplyOpenPrinter *r;
4585
4586         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_REPLYOPENPRINTER];
4587
4588         r = talloc(talloc_tos(), struct spoolss_ReplyOpenPrinter);
4589         if (r == NULL) {
4590                 return false;
4591         }
4592
4593         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4594                 talloc_free(r);
4595                 return false;
4596         }
4597
4598         pull = ndr_pull_init_blob(&blob, r, NULL);
4599         if (pull == NULL) {
4600                 talloc_free(r);
4601                 return false;
4602         }
4603
4604         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4605         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4606         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4607                 talloc_free(r);
4608                 return false;
4609         }
4610
4611         if (DEBUGLEVEL >= 10) {
4612                 NDR_PRINT_IN_DEBUG(spoolss_ReplyOpenPrinter, r);
4613         }
4614
4615         ZERO_STRUCT(r->out);
4616         r->out.handle = talloc_zero(r, struct policy_handle);
4617         if (r->out.handle == NULL) {
4618                 talloc_free(r);
4619                 return false;
4620         }
4621
4622         r->out.result = _spoolss_ReplyOpenPrinter(p, r);
4623
4624         if (p->rng_fault_state) {
4625                 talloc_free(r);
4626                 /* Return true here, srv_pipe_hnd.c will take care */
4627                 return true;
4628         }
4629
4630         if (DEBUGLEVEL >= 10) {
4631                 NDR_PRINT_OUT_DEBUG(spoolss_ReplyOpenPrinter, r);
4632         }
4633
4634         push = ndr_push_init_ctx(r, NULL);
4635         if (push == NULL) {
4636                 talloc_free(r);
4637                 return false;
4638         }
4639
4640         ndr_err = call->ndr_push(push, NDR_OUT, r);
4641         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4642                 talloc_free(r);
4643                 return false;
4644         }
4645
4646         blob = ndr_push_blob(push);
4647         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4648                 talloc_free(r);
4649                 return false;
4650         }
4651
4652         talloc_free(r);
4653
4654         return true;
4655 }
4656
4657 static bool api_spoolss_RouterReplyPrinter(pipes_struct *p)
4658 {
4659         const struct ndr_interface_call *call;
4660         struct ndr_pull *pull;
4661         struct ndr_push *push;
4662         enum ndr_err_code ndr_err;
4663         DATA_BLOB blob;
4664         struct spoolss_RouterReplyPrinter *r;
4665
4666         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ROUTERREPLYPRINTER];
4667
4668         r = talloc(talloc_tos(), struct spoolss_RouterReplyPrinter);
4669         if (r == NULL) {
4670                 return false;
4671         }
4672
4673         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4674                 talloc_free(r);
4675                 return false;
4676         }
4677
4678         pull = ndr_pull_init_blob(&blob, r, NULL);
4679         if (pull == NULL) {
4680                 talloc_free(r);
4681                 return false;
4682         }
4683
4684         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4685         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4686         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4687                 talloc_free(r);
4688                 return false;
4689         }
4690
4691         if (DEBUGLEVEL >= 10) {
4692                 NDR_PRINT_IN_DEBUG(spoolss_RouterReplyPrinter, r);
4693         }
4694
4695         r->out.result = _spoolss_RouterReplyPrinter(p, r);
4696
4697         if (p->rng_fault_state) {
4698                 talloc_free(r);
4699                 /* Return true here, srv_pipe_hnd.c will take care */
4700                 return true;
4701         }
4702
4703         if (DEBUGLEVEL >= 10) {
4704                 NDR_PRINT_OUT_DEBUG(spoolss_RouterReplyPrinter, r);
4705         }
4706
4707         push = ndr_push_init_ctx(r, NULL);
4708         if (push == NULL) {
4709                 talloc_free(r);
4710                 return false;
4711         }
4712
4713         ndr_err = call->ndr_push(push, NDR_OUT, r);
4714         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4715                 talloc_free(r);
4716                 return false;
4717         }
4718
4719         blob = ndr_push_blob(push);
4720         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4721                 talloc_free(r);
4722                 return false;
4723         }
4724
4725         talloc_free(r);
4726
4727         return true;
4728 }
4729
4730 static bool api_spoolss_ReplyClosePrinter(pipes_struct *p)
4731 {
4732         const struct ndr_interface_call *call;
4733         struct ndr_pull *pull;
4734         struct ndr_push *push;
4735         enum ndr_err_code ndr_err;
4736         DATA_BLOB blob;
4737         struct spoolss_ReplyClosePrinter *r;
4738
4739         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_REPLYCLOSEPRINTER];
4740
4741         r = talloc(talloc_tos(), struct spoolss_ReplyClosePrinter);
4742         if (r == NULL) {
4743                 return false;
4744         }
4745
4746         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4747                 talloc_free(r);
4748                 return false;
4749         }
4750
4751         pull = ndr_pull_init_blob(&blob, r, NULL);
4752         if (pull == NULL) {
4753                 talloc_free(r);
4754                 return false;
4755         }
4756
4757         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4758         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4759         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4760                 talloc_free(r);
4761                 return false;
4762         }
4763
4764         if (DEBUGLEVEL >= 10) {
4765                 NDR_PRINT_IN_DEBUG(spoolss_ReplyClosePrinter, r);
4766         }
4767
4768         ZERO_STRUCT(r->out);
4769         r->out.handle = r->in.handle;
4770         r->out.result = _spoolss_ReplyClosePrinter(p, r);
4771
4772         if (p->rng_fault_state) {
4773                 talloc_free(r);
4774                 /* Return true here, srv_pipe_hnd.c will take care */
4775                 return true;
4776         }
4777
4778         if (DEBUGLEVEL >= 10) {
4779                 NDR_PRINT_OUT_DEBUG(spoolss_ReplyClosePrinter, r);
4780         }
4781
4782         push = ndr_push_init_ctx(r, NULL);
4783         if (push == NULL) {
4784                 talloc_free(r);
4785                 return false;
4786         }
4787
4788         ndr_err = call->ndr_push(push, NDR_OUT, r);
4789         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4790                 talloc_free(r);
4791                 return false;
4792         }
4793
4794         blob = ndr_push_blob(push);
4795         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4796                 talloc_free(r);
4797                 return false;
4798         }
4799
4800         talloc_free(r);
4801
4802         return true;
4803 }
4804
4805 static bool api_spoolss_AddPortEx(pipes_struct *p)
4806 {
4807         const struct ndr_interface_call *call;
4808         struct ndr_pull *pull;
4809         struct ndr_push *push;
4810         enum ndr_err_code ndr_err;
4811         DATA_BLOB blob;
4812         struct spoolss_AddPortEx *r;
4813
4814         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ADDPORTEX];
4815
4816         r = talloc(talloc_tos(), struct spoolss_AddPortEx);
4817         if (r == NULL) {
4818                 return false;
4819         }
4820
4821         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4822                 talloc_free(r);
4823                 return false;
4824         }
4825
4826         pull = ndr_pull_init_blob(&blob, r, NULL);
4827         if (pull == NULL) {
4828                 talloc_free(r);
4829                 return false;
4830         }
4831
4832         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4833         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4834         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4835                 talloc_free(r);
4836                 return false;
4837         }
4838
4839         if (DEBUGLEVEL >= 10) {
4840                 NDR_PRINT_IN_DEBUG(spoolss_AddPortEx, r);
4841         }
4842
4843         r->out.result = _spoolss_AddPortEx(p, r);
4844
4845         if (p->rng_fault_state) {
4846                 talloc_free(r);
4847                 /* Return true here, srv_pipe_hnd.c will take care */
4848                 return true;
4849         }
4850
4851         if (DEBUGLEVEL >= 10) {
4852                 NDR_PRINT_OUT_DEBUG(spoolss_AddPortEx, r);
4853         }
4854
4855         push = ndr_push_init_ctx(r, NULL);
4856         if (push == NULL) {
4857                 talloc_free(r);
4858                 return false;
4859         }
4860
4861         ndr_err = call->ndr_push(push, NDR_OUT, r);
4862         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4863                 talloc_free(r);
4864                 return false;
4865         }
4866
4867         blob = ndr_push_blob(push);
4868         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4869                 talloc_free(r);
4870                 return false;
4871         }
4872
4873         talloc_free(r);
4874
4875         return true;
4876 }
4877
4878 static bool api_spoolss_RouterFindFirstPrinterChangeNotification(pipes_struct *p)
4879 {
4880         const struct ndr_interface_call *call;
4881         struct ndr_pull *pull;
4882         struct ndr_push *push;
4883         enum ndr_err_code ndr_err;
4884         DATA_BLOB blob;
4885         struct spoolss_RouterFindFirstPrinterChangeNotification *r;
4886
4887         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ROUTERFINDFIRSTPRINTERCHANGENOTIFICATION];
4888
4889         r = talloc(talloc_tos(), struct spoolss_RouterFindFirstPrinterChangeNotification);
4890         if (r == NULL) {
4891                 return false;
4892         }
4893
4894         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4895                 talloc_free(r);
4896                 return false;
4897         }
4898
4899         pull = ndr_pull_init_blob(&blob, r, NULL);
4900         if (pull == NULL) {
4901                 talloc_free(r);
4902                 return false;
4903         }
4904
4905         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4906         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4907         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4908                 talloc_free(r);
4909                 return false;
4910         }
4911
4912         if (DEBUGLEVEL >= 10) {
4913                 NDR_PRINT_IN_DEBUG(spoolss_RouterFindFirstPrinterChangeNotification, r);
4914         }
4915
4916         r->out.result = _spoolss_RouterFindFirstPrinterChangeNotification(p, r);
4917
4918         if (p->rng_fault_state) {
4919                 talloc_free(r);
4920                 /* Return true here, srv_pipe_hnd.c will take care */
4921                 return true;
4922         }
4923
4924         if (DEBUGLEVEL >= 10) {
4925                 NDR_PRINT_OUT_DEBUG(spoolss_RouterFindFirstPrinterChangeNotification, r);
4926         }
4927
4928         push = ndr_push_init_ctx(r, NULL);
4929         if (push == NULL) {
4930                 talloc_free(r);
4931                 return false;
4932         }
4933
4934         ndr_err = call->ndr_push(push, NDR_OUT, r);
4935         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4936                 talloc_free(r);
4937                 return false;
4938         }
4939
4940         blob = ndr_push_blob(push);
4941         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
4942                 talloc_free(r);
4943                 return false;
4944         }
4945
4946         talloc_free(r);
4947
4948         return true;
4949 }
4950
4951 static bool api_spoolss_SpoolerInit(pipes_struct *p)
4952 {
4953         const struct ndr_interface_call *call;
4954         struct ndr_pull *pull;
4955         struct ndr_push *push;
4956         enum ndr_err_code ndr_err;
4957         DATA_BLOB blob;
4958         struct spoolss_SpoolerInit *r;
4959
4960         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_SPOOLERINIT];
4961
4962         r = talloc(talloc_tos(), struct spoolss_SpoolerInit);
4963         if (r == NULL) {
4964                 return false;
4965         }
4966
4967         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
4968                 talloc_free(r);
4969                 return false;
4970         }
4971
4972         pull = ndr_pull_init_blob(&blob, r, NULL);
4973         if (pull == NULL) {
4974                 talloc_free(r);
4975                 return false;
4976         }
4977
4978         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
4979         ndr_err = call->ndr_pull(pull, NDR_IN, r);
4980         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
4981                 talloc_free(r);
4982                 return false;
4983         }
4984
4985         if (DEBUGLEVEL >= 10) {
4986                 NDR_PRINT_IN_DEBUG(spoolss_SpoolerInit, r);
4987         }
4988
4989         r->out.result = _spoolss_SpoolerInit(p, r);
4990
4991         if (p->rng_fault_state) {
4992                 talloc_free(r);
4993                 /* Return true here, srv_pipe_hnd.c will take care */
4994                 return true;
4995         }
4996
4997         if (DEBUGLEVEL >= 10) {
4998                 NDR_PRINT_OUT_DEBUG(spoolss_SpoolerInit, r);
4999         }
5000
5001         push = ndr_push_init_ctx(r, NULL);
5002         if (push == NULL) {
5003                 talloc_free(r);
5004                 return false;
5005         }
5006
5007         ndr_err = call->ndr_push(push, NDR_OUT, r);
5008         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5009                 talloc_free(r);
5010                 return false;
5011         }
5012
5013         blob = ndr_push_blob(push);
5014         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5015                 talloc_free(r);
5016                 return false;
5017         }
5018
5019         talloc_free(r);
5020
5021         return true;
5022 }
5023
5024 static bool api_spoolss_ResetPrinterEx(pipes_struct *p)
5025 {
5026         const struct ndr_interface_call *call;
5027         struct ndr_pull *pull;
5028         struct ndr_push *push;
5029         enum ndr_err_code ndr_err;
5030         DATA_BLOB blob;
5031         struct spoolss_ResetPrinterEx *r;
5032
5033         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_RESETPRINTEREX];
5034
5035         r = talloc(talloc_tos(), struct spoolss_ResetPrinterEx);
5036         if (r == NULL) {
5037                 return false;
5038         }
5039
5040         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5041                 talloc_free(r);
5042                 return false;
5043         }
5044
5045         pull = ndr_pull_init_blob(&blob, r, NULL);
5046         if (pull == NULL) {
5047                 talloc_free(r);
5048                 return false;
5049         }
5050
5051         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5052         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5053         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5054                 talloc_free(r);
5055                 return false;
5056         }
5057
5058         if (DEBUGLEVEL >= 10) {
5059                 NDR_PRINT_IN_DEBUG(spoolss_ResetPrinterEx, r);
5060         }
5061
5062         r->out.result = _spoolss_ResetPrinterEx(p, r);
5063
5064         if (p->rng_fault_state) {
5065                 talloc_free(r);
5066                 /* Return true here, srv_pipe_hnd.c will take care */
5067                 return true;
5068         }
5069
5070         if (DEBUGLEVEL >= 10) {
5071                 NDR_PRINT_OUT_DEBUG(spoolss_ResetPrinterEx, r);
5072         }
5073
5074         push = ndr_push_init_ctx(r, NULL);
5075         if (push == NULL) {
5076                 talloc_free(r);
5077                 return false;
5078         }
5079
5080         ndr_err = call->ndr_push(push, NDR_OUT, r);
5081         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5082                 talloc_free(r);
5083                 return false;
5084         }
5085
5086         blob = ndr_push_blob(push);
5087         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5088                 talloc_free(r);
5089                 return false;
5090         }
5091
5092         talloc_free(r);
5093
5094         return true;
5095 }
5096
5097 static bool api_spoolss_RemoteFindFirstPrinterChangeNotifyEx(pipes_struct *p)
5098 {
5099         const struct ndr_interface_call *call;
5100         struct ndr_pull *pull;
5101         struct ndr_push *push;
5102         enum ndr_err_code ndr_err;
5103         DATA_BLOB blob;
5104         struct spoolss_RemoteFindFirstPrinterChangeNotifyEx *r;
5105
5106         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_REMOTEFINDFIRSTPRINTERCHANGENOTIFYEX];
5107
5108         r = talloc(talloc_tos(), struct spoolss_RemoteFindFirstPrinterChangeNotifyEx);
5109         if (r == NULL) {
5110                 return false;
5111         }
5112
5113         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5114                 talloc_free(r);
5115                 return false;
5116         }
5117
5118         pull = ndr_pull_init_blob(&blob, r, NULL);
5119         if (pull == NULL) {
5120                 talloc_free(r);
5121                 return false;
5122         }
5123
5124         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5125         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5126         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5127                 talloc_free(r);
5128                 return false;
5129         }
5130
5131         if (DEBUGLEVEL >= 10) {
5132                 NDR_PRINT_IN_DEBUG(spoolss_RemoteFindFirstPrinterChangeNotifyEx, r);
5133         }
5134
5135         r->out.result = _spoolss_RemoteFindFirstPrinterChangeNotifyEx(p, r);
5136
5137         if (p->rng_fault_state) {
5138                 talloc_free(r);
5139                 /* Return true here, srv_pipe_hnd.c will take care */
5140                 return true;
5141         }
5142
5143         if (DEBUGLEVEL >= 10) {
5144                 NDR_PRINT_OUT_DEBUG(spoolss_RemoteFindFirstPrinterChangeNotifyEx, r);
5145         }
5146
5147         push = ndr_push_init_ctx(r, NULL);
5148         if (push == NULL) {
5149                 talloc_free(r);
5150                 return false;
5151         }
5152
5153         ndr_err = call->ndr_push(push, NDR_OUT, r);
5154         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5155                 talloc_free(r);
5156                 return false;
5157         }
5158
5159         blob = ndr_push_blob(push);
5160         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5161                 talloc_free(r);
5162                 return false;
5163         }
5164
5165         talloc_free(r);
5166
5167         return true;
5168 }
5169
5170 static bool api_spoolss_RouterReplyPrinterEx(pipes_struct *p)
5171 {
5172         const struct ndr_interface_call *call;
5173         struct ndr_pull *pull;
5174         struct ndr_push *push;
5175         enum ndr_err_code ndr_err;
5176         DATA_BLOB blob;
5177         struct spoolss_RouterReplyPrinterEx *r;
5178
5179         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ROUTERREPLYPRINTEREX];
5180
5181         r = talloc(talloc_tos(), struct spoolss_RouterReplyPrinterEx);
5182         if (r == NULL) {
5183                 return false;
5184         }
5185
5186         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5187                 talloc_free(r);
5188                 return false;
5189         }
5190
5191         pull = ndr_pull_init_blob(&blob, r, NULL);
5192         if (pull == NULL) {
5193                 talloc_free(r);
5194                 return false;
5195         }
5196
5197         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5198         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5199         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5200                 talloc_free(r);
5201                 return false;
5202         }
5203
5204         if (DEBUGLEVEL >= 10) {
5205                 NDR_PRINT_IN_DEBUG(spoolss_RouterReplyPrinterEx, r);
5206         }
5207
5208         ZERO_STRUCT(r->out);
5209         r->out.reply_result = talloc_zero(r, uint32_t);
5210         if (r->out.reply_result == NULL) {
5211                 talloc_free(r);
5212                 return false;
5213         }
5214
5215         r->out.result = _spoolss_RouterReplyPrinterEx(p, r);
5216
5217         if (p->rng_fault_state) {
5218                 talloc_free(r);
5219                 /* Return true here, srv_pipe_hnd.c will take care */
5220                 return true;
5221         }
5222
5223         if (DEBUGLEVEL >= 10) {
5224                 NDR_PRINT_OUT_DEBUG(spoolss_RouterReplyPrinterEx, r);
5225         }
5226
5227         push = ndr_push_init_ctx(r, NULL);
5228         if (push == NULL) {
5229                 talloc_free(r);
5230                 return false;
5231         }
5232
5233         ndr_err = call->ndr_push(push, NDR_OUT, r);
5234         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5235                 talloc_free(r);
5236                 return false;
5237         }
5238
5239         blob = ndr_push_blob(push);
5240         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5241                 talloc_free(r);
5242                 return false;
5243         }
5244
5245         talloc_free(r);
5246
5247         return true;
5248 }
5249
5250 static bool api_spoolss_RouterRefreshPrinterChangeNotify(pipes_struct *p)
5251 {
5252         const struct ndr_interface_call *call;
5253         struct ndr_pull *pull;
5254         struct ndr_push *push;
5255         enum ndr_err_code ndr_err;
5256         DATA_BLOB blob;
5257         struct spoolss_RouterRefreshPrinterChangeNotify *r;
5258
5259         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ROUTERREFRESHPRINTERCHANGENOTIFY];
5260
5261         r = talloc(talloc_tos(), struct spoolss_RouterRefreshPrinterChangeNotify);
5262         if (r == NULL) {
5263                 return false;
5264         }
5265
5266         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5267                 talloc_free(r);
5268                 return false;
5269         }
5270
5271         pull = ndr_pull_init_blob(&blob, r, NULL);
5272         if (pull == NULL) {
5273                 talloc_free(r);
5274                 return false;
5275         }
5276
5277         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5278         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5279         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5280                 talloc_free(r);
5281                 return false;
5282         }
5283
5284         if (DEBUGLEVEL >= 10) {
5285                 NDR_PRINT_IN_DEBUG(spoolss_RouterRefreshPrinterChangeNotify, r);
5286         }
5287
5288         ZERO_STRUCT(r->out);
5289         r->out.info = talloc_zero(r, struct spoolss_NotifyInfo *);
5290         if (r->out.info == NULL) {
5291                 talloc_free(r);
5292                 return false;
5293         }
5294
5295         r->out.result = _spoolss_RouterRefreshPrinterChangeNotify(p, r);
5296
5297         if (p->rng_fault_state) {
5298                 talloc_free(r);
5299                 /* Return true here, srv_pipe_hnd.c will take care */
5300                 return true;
5301         }
5302
5303         if (DEBUGLEVEL >= 10) {
5304                 NDR_PRINT_OUT_DEBUG(spoolss_RouterRefreshPrinterChangeNotify, r);
5305         }
5306
5307         push = ndr_push_init_ctx(r, NULL);
5308         if (push == NULL) {
5309                 talloc_free(r);
5310                 return false;
5311         }
5312
5313         ndr_err = call->ndr_push(push, NDR_OUT, r);
5314         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5315                 talloc_free(r);
5316                 return false;
5317         }
5318
5319         blob = ndr_push_blob(push);
5320         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5321                 talloc_free(r);
5322                 return false;
5323         }
5324
5325         talloc_free(r);
5326
5327         return true;
5328 }
5329
5330 static bool api_spoolss_44(pipes_struct *p)
5331 {
5332         const struct ndr_interface_call *call;
5333         struct ndr_pull *pull;
5334         struct ndr_push *push;
5335         enum ndr_err_code ndr_err;
5336         DATA_BLOB blob;
5337         struct spoolss_44 *r;
5338
5339         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_44];
5340
5341         r = talloc(talloc_tos(), struct spoolss_44);
5342         if (r == NULL) {
5343                 return false;
5344         }
5345
5346         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5347                 talloc_free(r);
5348                 return false;
5349         }
5350
5351         pull = ndr_pull_init_blob(&blob, r, NULL);
5352         if (pull == NULL) {
5353                 talloc_free(r);
5354                 return false;
5355         }
5356
5357         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5358         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5359         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5360                 talloc_free(r);
5361                 return false;
5362         }
5363
5364         if (DEBUGLEVEL >= 10) {
5365                 NDR_PRINT_IN_DEBUG(spoolss_44, r);
5366         }
5367
5368         r->out.result = _spoolss_44(p, r);
5369
5370         if (p->rng_fault_state) {
5371                 talloc_free(r);
5372                 /* Return true here, srv_pipe_hnd.c will take care */
5373                 return true;
5374         }
5375
5376         if (DEBUGLEVEL >= 10) {
5377                 NDR_PRINT_OUT_DEBUG(spoolss_44, r);
5378         }
5379
5380         push = ndr_push_init_ctx(r, NULL);
5381         if (push == NULL) {
5382                 talloc_free(r);
5383                 return false;
5384         }
5385
5386         ndr_err = call->ndr_push(push, NDR_OUT, r);
5387         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5388                 talloc_free(r);
5389                 return false;
5390         }
5391
5392         blob = ndr_push_blob(push);
5393         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5394                 talloc_free(r);
5395                 return false;
5396         }
5397
5398         talloc_free(r);
5399
5400         return true;
5401 }
5402
5403 static bool api_spoolss_OpenPrinterEx(pipes_struct *p)
5404 {
5405         const struct ndr_interface_call *call;
5406         struct ndr_pull *pull;
5407         struct ndr_push *push;
5408         enum ndr_err_code ndr_err;
5409         DATA_BLOB blob;
5410         struct spoolss_OpenPrinterEx *r;
5411
5412         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_OPENPRINTEREX];
5413
5414         r = talloc(talloc_tos(), struct spoolss_OpenPrinterEx);
5415         if (r == NULL) {
5416                 return false;
5417         }
5418
5419         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5420                 talloc_free(r);
5421                 return false;
5422         }
5423
5424         pull = ndr_pull_init_blob(&blob, r, NULL);
5425         if (pull == NULL) {
5426                 talloc_free(r);
5427                 return false;
5428         }
5429
5430         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5431         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5432         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5433                 talloc_free(r);
5434                 return false;
5435         }
5436
5437         if (DEBUGLEVEL >= 10) {
5438                 NDR_PRINT_IN_DEBUG(spoolss_OpenPrinterEx, r);
5439         }
5440
5441         ZERO_STRUCT(r->out);
5442         r->out.handle = talloc_zero(r, struct policy_handle);
5443         if (r->out.handle == NULL) {
5444                 talloc_free(r);
5445                 return false;
5446         }
5447
5448         r->out.result = _spoolss_OpenPrinterEx(p, r);
5449
5450         if (p->rng_fault_state) {
5451                 talloc_free(r);
5452                 /* Return true here, srv_pipe_hnd.c will take care */
5453                 return true;
5454         }
5455
5456         if (DEBUGLEVEL >= 10) {
5457                 NDR_PRINT_OUT_DEBUG(spoolss_OpenPrinterEx, r);
5458         }
5459
5460         push = ndr_push_init_ctx(r, NULL);
5461         if (push == NULL) {
5462                 talloc_free(r);
5463                 return false;
5464         }
5465
5466         ndr_err = call->ndr_push(push, NDR_OUT, r);
5467         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5468                 talloc_free(r);
5469                 return false;
5470         }
5471
5472         blob = ndr_push_blob(push);
5473         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5474                 talloc_free(r);
5475                 return false;
5476         }
5477
5478         talloc_free(r);
5479
5480         return true;
5481 }
5482
5483 static bool api_spoolss_AddPrinterEx(pipes_struct *p)
5484 {
5485         const struct ndr_interface_call *call;
5486         struct ndr_pull *pull;
5487         struct ndr_push *push;
5488         enum ndr_err_code ndr_err;
5489         DATA_BLOB blob;
5490         struct spoolss_AddPrinterEx *r;
5491
5492         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ADDPRINTEREX];
5493
5494         r = talloc(talloc_tos(), struct spoolss_AddPrinterEx);
5495         if (r == NULL) {
5496                 return false;
5497         }
5498
5499         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5500                 talloc_free(r);
5501                 return false;
5502         }
5503
5504         pull = ndr_pull_init_blob(&blob, r, NULL);
5505         if (pull == NULL) {
5506                 talloc_free(r);
5507                 return false;
5508         }
5509
5510         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5511         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5512         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5513                 talloc_free(r);
5514                 return false;
5515         }
5516
5517         if (DEBUGLEVEL >= 10) {
5518                 NDR_PRINT_IN_DEBUG(spoolss_AddPrinterEx, r);
5519         }
5520
5521         ZERO_STRUCT(r->out);
5522         r->out.handle = talloc_zero(r, struct policy_handle);
5523         if (r->out.handle == NULL) {
5524                 talloc_free(r);
5525                 return false;
5526         }
5527
5528         r->out.result = _spoolss_AddPrinterEx(p, r);
5529
5530         if (p->rng_fault_state) {
5531                 talloc_free(r);
5532                 /* Return true here, srv_pipe_hnd.c will take care */
5533                 return true;
5534         }
5535
5536         if (DEBUGLEVEL >= 10) {
5537                 NDR_PRINT_OUT_DEBUG(spoolss_AddPrinterEx, r);
5538         }
5539
5540         push = ndr_push_init_ctx(r, NULL);
5541         if (push == NULL) {
5542                 talloc_free(r);
5543                 return false;
5544         }
5545
5546         ndr_err = call->ndr_push(push, NDR_OUT, r);
5547         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5548                 talloc_free(r);
5549                 return false;
5550         }
5551
5552         blob = ndr_push_blob(push);
5553         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5554                 talloc_free(r);
5555                 return false;
5556         }
5557
5558         talloc_free(r);
5559
5560         return true;
5561 }
5562
5563 static bool api_spoolss_47(pipes_struct *p)
5564 {
5565         const struct ndr_interface_call *call;
5566         struct ndr_pull *pull;
5567         struct ndr_push *push;
5568         enum ndr_err_code ndr_err;
5569         DATA_BLOB blob;
5570         struct spoolss_47 *r;
5571
5572         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_47];
5573
5574         r = talloc(talloc_tos(), struct spoolss_47);
5575         if (r == NULL) {
5576                 return false;
5577         }
5578
5579         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5580                 talloc_free(r);
5581                 return false;
5582         }
5583
5584         pull = ndr_pull_init_blob(&blob, r, NULL);
5585         if (pull == NULL) {
5586                 talloc_free(r);
5587                 return false;
5588         }
5589
5590         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5591         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5592         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5593                 talloc_free(r);
5594                 return false;
5595         }
5596
5597         if (DEBUGLEVEL >= 10) {
5598                 NDR_PRINT_IN_DEBUG(spoolss_47, r);
5599         }
5600
5601         r->out.result = _spoolss_47(p, r);
5602
5603         if (p->rng_fault_state) {
5604                 talloc_free(r);
5605                 /* Return true here, srv_pipe_hnd.c will take care */
5606                 return true;
5607         }
5608
5609         if (DEBUGLEVEL >= 10) {
5610                 NDR_PRINT_OUT_DEBUG(spoolss_47, r);
5611         }
5612
5613         push = ndr_push_init_ctx(r, NULL);
5614         if (push == NULL) {
5615                 talloc_free(r);
5616                 return false;
5617         }
5618
5619         ndr_err = call->ndr_push(push, NDR_OUT, r);
5620         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5621                 talloc_free(r);
5622                 return false;
5623         }
5624
5625         blob = ndr_push_blob(push);
5626         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5627                 talloc_free(r);
5628                 return false;
5629         }
5630
5631         talloc_free(r);
5632
5633         return true;
5634 }
5635
5636 static bool api_spoolss_EnumPrinterData(pipes_struct *p)
5637 {
5638         const struct ndr_interface_call *call;
5639         struct ndr_pull *pull;
5640         struct ndr_push *push;
5641         enum ndr_err_code ndr_err;
5642         DATA_BLOB blob;
5643         struct spoolss_EnumPrinterData *r;
5644
5645         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ENUMPRINTERDATA];
5646
5647         r = talloc(talloc_tos(), struct spoolss_EnumPrinterData);
5648         if (r == NULL) {
5649                 return false;
5650         }
5651
5652         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5653                 talloc_free(r);
5654                 return false;
5655         }
5656
5657         pull = ndr_pull_init_blob(&blob, r, NULL);
5658         if (pull == NULL) {
5659                 talloc_free(r);
5660                 return false;
5661         }
5662
5663         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5664         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5665         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5666                 talloc_free(r);
5667                 return false;
5668         }
5669
5670         if (DEBUGLEVEL >= 10) {
5671                 NDR_PRINT_IN_DEBUG(spoolss_EnumPrinterData, r);
5672         }
5673
5674         ZERO_STRUCT(r->out);
5675         r->out.value_name = talloc_zero_array(r, const char, r->in.value_offered / 2);
5676         if (r->out.value_name == NULL) {
5677                 talloc_free(r);
5678                 return false;
5679         }
5680
5681         r->out.value_needed = talloc_zero(r, uint32_t);
5682         if (r->out.value_needed == NULL) {
5683                 talloc_free(r);
5684                 return false;
5685         }
5686
5687         r->out.type = talloc_zero(r, enum winreg_Type);
5688         if (r->out.type == NULL) {
5689                 talloc_free(r);
5690                 return false;
5691         }
5692
5693         r->out.data = talloc_zero_array(r, uint8_t, r->in.data_offered);
5694         if (r->out.data == NULL) {
5695                 talloc_free(r);
5696                 return false;
5697         }
5698
5699         r->out.data_needed = talloc_zero(r, uint32_t);
5700         if (r->out.data_needed == NULL) {
5701                 talloc_free(r);
5702                 return false;
5703         }
5704
5705         r->out.result = _spoolss_EnumPrinterData(p, r);
5706
5707         if (p->rng_fault_state) {
5708                 talloc_free(r);
5709                 /* Return true here, srv_pipe_hnd.c will take care */
5710                 return true;
5711         }
5712
5713         if (DEBUGLEVEL >= 10) {
5714                 NDR_PRINT_OUT_DEBUG(spoolss_EnumPrinterData, r);
5715         }
5716
5717         push = ndr_push_init_ctx(r, NULL);
5718         if (push == NULL) {
5719                 talloc_free(r);
5720                 return false;
5721         }
5722
5723         ndr_err = call->ndr_push(push, NDR_OUT, r);
5724         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5725                 talloc_free(r);
5726                 return false;
5727         }
5728
5729         blob = ndr_push_blob(push);
5730         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5731                 talloc_free(r);
5732                 return false;
5733         }
5734
5735         talloc_free(r);
5736
5737         return true;
5738 }
5739
5740 static bool api_spoolss_DeletePrinterData(pipes_struct *p)
5741 {
5742         const struct ndr_interface_call *call;
5743         struct ndr_pull *pull;
5744         struct ndr_push *push;
5745         enum ndr_err_code ndr_err;
5746         DATA_BLOB blob;
5747         struct spoolss_DeletePrinterData *r;
5748
5749         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEPRINTERDATA];
5750
5751         r = talloc(talloc_tos(), struct spoolss_DeletePrinterData);
5752         if (r == NULL) {
5753                 return false;
5754         }
5755
5756         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5757                 talloc_free(r);
5758                 return false;
5759         }
5760
5761         pull = ndr_pull_init_blob(&blob, r, NULL);
5762         if (pull == NULL) {
5763                 talloc_free(r);
5764                 return false;
5765         }
5766
5767         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5768         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5769         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5770                 talloc_free(r);
5771                 return false;
5772         }
5773
5774         if (DEBUGLEVEL >= 10) {
5775                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrinterData, r);
5776         }
5777
5778         r->out.result = _spoolss_DeletePrinterData(p, r);
5779
5780         if (p->rng_fault_state) {
5781                 talloc_free(r);
5782                 /* Return true here, srv_pipe_hnd.c will take care */
5783                 return true;
5784         }
5785
5786         if (DEBUGLEVEL >= 10) {
5787                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrinterData, r);
5788         }
5789
5790         push = ndr_push_init_ctx(r, NULL);
5791         if (push == NULL) {
5792                 talloc_free(r);
5793                 return false;
5794         }
5795
5796         ndr_err = call->ndr_push(push, NDR_OUT, r);
5797         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5798                 talloc_free(r);
5799                 return false;
5800         }
5801
5802         blob = ndr_push_blob(push);
5803         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5804                 talloc_free(r);
5805                 return false;
5806         }
5807
5808         talloc_free(r);
5809
5810         return true;
5811 }
5812
5813 static bool api_spoolss_4a(pipes_struct *p)
5814 {
5815         const struct ndr_interface_call *call;
5816         struct ndr_pull *pull;
5817         struct ndr_push *push;
5818         enum ndr_err_code ndr_err;
5819         DATA_BLOB blob;
5820         struct spoolss_4a *r;
5821
5822         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_4A];
5823
5824         r = talloc(talloc_tos(), struct spoolss_4a);
5825         if (r == NULL) {
5826                 return false;
5827         }
5828
5829         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5830                 talloc_free(r);
5831                 return false;
5832         }
5833
5834         pull = ndr_pull_init_blob(&blob, r, NULL);
5835         if (pull == NULL) {
5836                 talloc_free(r);
5837                 return false;
5838         }
5839
5840         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5841         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5842         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5843                 talloc_free(r);
5844                 return false;
5845         }
5846
5847         if (DEBUGLEVEL >= 10) {
5848                 NDR_PRINT_IN_DEBUG(spoolss_4a, r);
5849         }
5850
5851         r->out.result = _spoolss_4a(p, r);
5852
5853         if (p->rng_fault_state) {
5854                 talloc_free(r);
5855                 /* Return true here, srv_pipe_hnd.c will take care */
5856                 return true;
5857         }
5858
5859         if (DEBUGLEVEL >= 10) {
5860                 NDR_PRINT_OUT_DEBUG(spoolss_4a, r);
5861         }
5862
5863         push = ndr_push_init_ctx(r, NULL);
5864         if (push == NULL) {
5865                 talloc_free(r);
5866                 return false;
5867         }
5868
5869         ndr_err = call->ndr_push(push, NDR_OUT, r);
5870         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5871                 talloc_free(r);
5872                 return false;
5873         }
5874
5875         blob = ndr_push_blob(push);
5876         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5877                 talloc_free(r);
5878                 return false;
5879         }
5880
5881         talloc_free(r);
5882
5883         return true;
5884 }
5885
5886 static bool api_spoolss_4b(pipes_struct *p)
5887 {
5888         const struct ndr_interface_call *call;
5889         struct ndr_pull *pull;
5890         struct ndr_push *push;
5891         enum ndr_err_code ndr_err;
5892         DATA_BLOB blob;
5893         struct spoolss_4b *r;
5894
5895         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_4B];
5896
5897         r = talloc(talloc_tos(), struct spoolss_4b);
5898         if (r == NULL) {
5899                 return false;
5900         }
5901
5902         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5903                 talloc_free(r);
5904                 return false;
5905         }
5906
5907         pull = ndr_pull_init_blob(&blob, r, NULL);
5908         if (pull == NULL) {
5909                 talloc_free(r);
5910                 return false;
5911         }
5912
5913         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5914         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5915         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5916                 talloc_free(r);
5917                 return false;
5918         }
5919
5920         if (DEBUGLEVEL >= 10) {
5921                 NDR_PRINT_IN_DEBUG(spoolss_4b, r);
5922         }
5923
5924         r->out.result = _spoolss_4b(p, r);
5925
5926         if (p->rng_fault_state) {
5927                 talloc_free(r);
5928                 /* Return true here, srv_pipe_hnd.c will take care */
5929                 return true;
5930         }
5931
5932         if (DEBUGLEVEL >= 10) {
5933                 NDR_PRINT_OUT_DEBUG(spoolss_4b, r);
5934         }
5935
5936         push = ndr_push_init_ctx(r, NULL);
5937         if (push == NULL) {
5938                 talloc_free(r);
5939                 return false;
5940         }
5941
5942         ndr_err = call->ndr_push(push, NDR_OUT, r);
5943         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5944                 talloc_free(r);
5945                 return false;
5946         }
5947
5948         blob = ndr_push_blob(push);
5949         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
5950                 talloc_free(r);
5951                 return false;
5952         }
5953
5954         talloc_free(r);
5955
5956         return true;
5957 }
5958
5959 static bool api_spoolss_4c(pipes_struct *p)
5960 {
5961         const struct ndr_interface_call *call;
5962         struct ndr_pull *pull;
5963         struct ndr_push *push;
5964         enum ndr_err_code ndr_err;
5965         DATA_BLOB blob;
5966         struct spoolss_4c *r;
5967
5968         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_4C];
5969
5970         r = talloc(talloc_tos(), struct spoolss_4c);
5971         if (r == NULL) {
5972                 return false;
5973         }
5974
5975         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
5976                 talloc_free(r);
5977                 return false;
5978         }
5979
5980         pull = ndr_pull_init_blob(&blob, r, NULL);
5981         if (pull == NULL) {
5982                 talloc_free(r);
5983                 return false;
5984         }
5985
5986         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
5987         ndr_err = call->ndr_pull(pull, NDR_IN, r);
5988         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
5989                 talloc_free(r);
5990                 return false;
5991         }
5992
5993         if (DEBUGLEVEL >= 10) {
5994                 NDR_PRINT_IN_DEBUG(spoolss_4c, r);
5995         }
5996
5997         r->out.result = _spoolss_4c(p, r);
5998
5999         if (p->rng_fault_state) {
6000                 talloc_free(r);
6001                 /* Return true here, srv_pipe_hnd.c will take care */
6002                 return true;
6003         }
6004
6005         if (DEBUGLEVEL >= 10) {
6006                 NDR_PRINT_OUT_DEBUG(spoolss_4c, r);
6007         }
6008
6009         push = ndr_push_init_ctx(r, NULL);
6010         if (push == NULL) {
6011                 talloc_free(r);
6012                 return false;
6013         }
6014
6015         ndr_err = call->ndr_push(push, NDR_OUT, r);
6016         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6017                 talloc_free(r);
6018                 return false;
6019         }
6020
6021         blob = ndr_push_blob(push);
6022         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6023                 talloc_free(r);
6024                 return false;
6025         }
6026
6027         talloc_free(r);
6028
6029         return true;
6030 }
6031
6032 static bool api_spoolss_SetPrinterDataEx(pipes_struct *p)
6033 {
6034         const struct ndr_interface_call *call;
6035         struct ndr_pull *pull;
6036         struct ndr_push *push;
6037         enum ndr_err_code ndr_err;
6038         DATA_BLOB blob;
6039         struct spoolss_SetPrinterDataEx *r;
6040
6041         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_SETPRINTERDATAEX];
6042
6043         r = talloc(talloc_tos(), struct spoolss_SetPrinterDataEx);
6044         if (r == NULL) {
6045                 return false;
6046         }
6047
6048         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6049                 talloc_free(r);
6050                 return false;
6051         }
6052
6053         pull = ndr_pull_init_blob(&blob, r, NULL);
6054         if (pull == NULL) {
6055                 talloc_free(r);
6056                 return false;
6057         }
6058
6059         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6060         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6061         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6062                 talloc_free(r);
6063                 return false;
6064         }
6065
6066         if (DEBUGLEVEL >= 10) {
6067                 NDR_PRINT_IN_DEBUG(spoolss_SetPrinterDataEx, r);
6068         }
6069
6070         r->out.result = _spoolss_SetPrinterDataEx(p, r);
6071
6072         if (p->rng_fault_state) {
6073                 talloc_free(r);
6074                 /* Return true here, srv_pipe_hnd.c will take care */
6075                 return true;
6076         }
6077
6078         if (DEBUGLEVEL >= 10) {
6079                 NDR_PRINT_OUT_DEBUG(spoolss_SetPrinterDataEx, r);
6080         }
6081
6082         push = ndr_push_init_ctx(r, NULL);
6083         if (push == NULL) {
6084                 talloc_free(r);
6085                 return false;
6086         }
6087
6088         ndr_err = call->ndr_push(push, NDR_OUT, r);
6089         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6090                 talloc_free(r);
6091                 return false;
6092         }
6093
6094         blob = ndr_push_blob(push);
6095         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6096                 talloc_free(r);
6097                 return false;
6098         }
6099
6100         talloc_free(r);
6101
6102         return true;
6103 }
6104
6105 static bool api_spoolss_GetPrinterDataEx(pipes_struct *p)
6106 {
6107         const struct ndr_interface_call *call;
6108         struct ndr_pull *pull;
6109         struct ndr_push *push;
6110         enum ndr_err_code ndr_err;
6111         DATA_BLOB blob;
6112         struct spoolss_GetPrinterDataEx *r;
6113
6114         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_GETPRINTERDATAEX];
6115
6116         r = talloc(talloc_tos(), struct spoolss_GetPrinterDataEx);
6117         if (r == NULL) {
6118                 return false;
6119         }
6120
6121         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6122                 talloc_free(r);
6123                 return false;
6124         }
6125
6126         pull = ndr_pull_init_blob(&blob, r, NULL);
6127         if (pull == NULL) {
6128                 talloc_free(r);
6129                 return false;
6130         }
6131
6132         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6133         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6134         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6135                 talloc_free(r);
6136                 return false;
6137         }
6138
6139         if (DEBUGLEVEL >= 10) {
6140                 NDR_PRINT_IN_DEBUG(spoolss_GetPrinterDataEx, r);
6141         }
6142
6143         ZERO_STRUCT(r->out);
6144         r->out.type = talloc_zero(r, enum winreg_Type);
6145         if (r->out.type == NULL) {
6146                 talloc_free(r);
6147                 return false;
6148         }
6149
6150         r->out.buffer = talloc_zero_array(r, uint8_t, r->in.offered);
6151         if (r->out.buffer == NULL) {
6152                 talloc_free(r);
6153                 return false;
6154         }
6155
6156         r->out.needed = talloc_zero(r, uint32_t);
6157         if (r->out.needed == NULL) {
6158                 talloc_free(r);
6159                 return false;
6160         }
6161
6162         r->out.result = _spoolss_GetPrinterDataEx(p, r);
6163
6164         if (p->rng_fault_state) {
6165                 talloc_free(r);
6166                 /* Return true here, srv_pipe_hnd.c will take care */
6167                 return true;
6168         }
6169
6170         if (DEBUGLEVEL >= 10) {
6171                 NDR_PRINT_OUT_DEBUG(spoolss_GetPrinterDataEx, r);
6172         }
6173
6174         push = ndr_push_init_ctx(r, NULL);
6175         if (push == NULL) {
6176                 talloc_free(r);
6177                 return false;
6178         }
6179
6180         ndr_err = call->ndr_push(push, NDR_OUT, r);
6181         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6182                 talloc_free(r);
6183                 return false;
6184         }
6185
6186         blob = ndr_push_blob(push);
6187         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6188                 talloc_free(r);
6189                 return false;
6190         }
6191
6192         talloc_free(r);
6193
6194         return true;
6195 }
6196
6197 static bool api_spoolss_EnumPrinterDataEx(pipes_struct *p)
6198 {
6199         const struct ndr_interface_call *call;
6200         struct ndr_pull *pull;
6201         struct ndr_push *push;
6202         enum ndr_err_code ndr_err;
6203         DATA_BLOB blob;
6204         struct spoolss_EnumPrinterDataEx *r;
6205
6206         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ENUMPRINTERDATAEX];
6207
6208         r = talloc(talloc_tos(), struct spoolss_EnumPrinterDataEx);
6209         if (r == NULL) {
6210                 return false;
6211         }
6212
6213         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6214                 talloc_free(r);
6215                 return false;
6216         }
6217
6218         pull = ndr_pull_init_blob(&blob, r, NULL);
6219         if (pull == NULL) {
6220                 talloc_free(r);
6221                 return false;
6222         }
6223
6224         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6225         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6226         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6227                 talloc_free(r);
6228                 return false;
6229         }
6230
6231         if (DEBUGLEVEL >= 10) {
6232                 NDR_PRINT_IN_DEBUG(spoolss_EnumPrinterDataEx, r);
6233         }
6234
6235         ZERO_STRUCT(r->out);
6236         r->out.count = talloc_zero(r, uint32_t);
6237         if (r->out.count == NULL) {
6238                 talloc_free(r);
6239                 return false;
6240         }
6241
6242         r->out.info = talloc_zero(r, struct spoolss_PrinterEnumValues *);
6243         if (r->out.info == NULL) {
6244                 talloc_free(r);
6245                 return false;
6246         }
6247
6248         r->out.needed = talloc_zero(r, uint32_t);
6249         if (r->out.needed == NULL) {
6250                 talloc_free(r);
6251                 return false;
6252         }
6253
6254         r->out.result = _spoolss_EnumPrinterDataEx(p, r);
6255
6256         if (p->rng_fault_state) {
6257                 talloc_free(r);
6258                 /* Return true here, srv_pipe_hnd.c will take care */
6259                 return true;
6260         }
6261
6262         if (DEBUGLEVEL >= 10) {
6263                 NDR_PRINT_OUT_DEBUG(spoolss_EnumPrinterDataEx, r);
6264         }
6265
6266         push = ndr_push_init_ctx(r, NULL);
6267         if (push == NULL) {
6268                 talloc_free(r);
6269                 return false;
6270         }
6271
6272         ndr_err = call->ndr_push(push, NDR_OUT, r);
6273         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6274                 talloc_free(r);
6275                 return false;
6276         }
6277
6278         blob = ndr_push_blob(push);
6279         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6280                 talloc_free(r);
6281                 return false;
6282         }
6283
6284         talloc_free(r);
6285
6286         return true;
6287 }
6288
6289 static bool api_spoolss_EnumPrinterKey(pipes_struct *p)
6290 {
6291         const struct ndr_interface_call *call;
6292         struct ndr_pull *pull;
6293         struct ndr_push *push;
6294         enum ndr_err_code ndr_err;
6295         DATA_BLOB blob;
6296         struct spoolss_EnumPrinterKey *r;
6297
6298         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ENUMPRINTERKEY];
6299
6300         r = talloc(talloc_tos(), struct spoolss_EnumPrinterKey);
6301         if (r == NULL) {
6302                 return false;
6303         }
6304
6305         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6306                 talloc_free(r);
6307                 return false;
6308         }
6309
6310         pull = ndr_pull_init_blob(&blob, r, NULL);
6311         if (pull == NULL) {
6312                 talloc_free(r);
6313                 return false;
6314         }
6315
6316         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6317         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6318         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6319                 talloc_free(r);
6320                 return false;
6321         }
6322
6323         if (DEBUGLEVEL >= 10) {
6324                 NDR_PRINT_IN_DEBUG(spoolss_EnumPrinterKey, r);
6325         }
6326
6327         ZERO_STRUCT(r->out);
6328         r->out.key_buffer = talloc_zero(r, const char **);
6329         if (r->out.key_buffer == NULL) {
6330                 talloc_free(r);
6331                 return false;
6332         }
6333
6334         r->out.needed = talloc_zero(r, uint32_t);
6335         if (r->out.needed == NULL) {
6336                 talloc_free(r);
6337                 return false;
6338         }
6339
6340         r->out.result = _spoolss_EnumPrinterKey(p, r);
6341
6342         if (p->rng_fault_state) {
6343                 talloc_free(r);
6344                 /* Return true here, srv_pipe_hnd.c will take care */
6345                 return true;
6346         }
6347
6348         if (DEBUGLEVEL >= 10) {
6349                 NDR_PRINT_OUT_DEBUG(spoolss_EnumPrinterKey, r);
6350         }
6351
6352         push = ndr_push_init_ctx(r, NULL);
6353         if (push == NULL) {
6354                 talloc_free(r);
6355                 return false;
6356         }
6357
6358         ndr_err = call->ndr_push(push, NDR_OUT, r);
6359         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6360                 talloc_free(r);
6361                 return false;
6362         }
6363
6364         blob = ndr_push_blob(push);
6365         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6366                 talloc_free(r);
6367                 return false;
6368         }
6369
6370         talloc_free(r);
6371
6372         return true;
6373 }
6374
6375 static bool api_spoolss_DeletePrinterDataEx(pipes_struct *p)
6376 {
6377         const struct ndr_interface_call *call;
6378         struct ndr_pull *pull;
6379         struct ndr_push *push;
6380         enum ndr_err_code ndr_err;
6381         DATA_BLOB blob;
6382         struct spoolss_DeletePrinterDataEx *r;
6383
6384         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEPRINTERDATAEX];
6385
6386         r = talloc(talloc_tos(), struct spoolss_DeletePrinterDataEx);
6387         if (r == NULL) {
6388                 return false;
6389         }
6390
6391         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6392                 talloc_free(r);
6393                 return false;
6394         }
6395
6396         pull = ndr_pull_init_blob(&blob, r, NULL);
6397         if (pull == NULL) {
6398                 talloc_free(r);
6399                 return false;
6400         }
6401
6402         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6403         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6404         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6405                 talloc_free(r);
6406                 return false;
6407         }
6408
6409         if (DEBUGLEVEL >= 10) {
6410                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrinterDataEx, r);
6411         }
6412
6413         r->out.result = _spoolss_DeletePrinterDataEx(p, r);
6414
6415         if (p->rng_fault_state) {
6416                 talloc_free(r);
6417                 /* Return true here, srv_pipe_hnd.c will take care */
6418                 return true;
6419         }
6420
6421         if (DEBUGLEVEL >= 10) {
6422                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrinterDataEx, r);
6423         }
6424
6425         push = ndr_push_init_ctx(r, NULL);
6426         if (push == NULL) {
6427                 talloc_free(r);
6428                 return false;
6429         }
6430
6431         ndr_err = call->ndr_push(push, NDR_OUT, r);
6432         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6433                 talloc_free(r);
6434                 return false;
6435         }
6436
6437         blob = ndr_push_blob(push);
6438         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6439                 talloc_free(r);
6440                 return false;
6441         }
6442
6443         talloc_free(r);
6444
6445         return true;
6446 }
6447
6448 static bool api_spoolss_DeletePrinterKey(pipes_struct *p)
6449 {
6450         const struct ndr_interface_call *call;
6451         struct ndr_pull *pull;
6452         struct ndr_push *push;
6453         enum ndr_err_code ndr_err;
6454         DATA_BLOB blob;
6455         struct spoolss_DeletePrinterKey *r;
6456
6457         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEPRINTERKEY];
6458
6459         r = talloc(talloc_tos(), struct spoolss_DeletePrinterKey);
6460         if (r == NULL) {
6461                 return false;
6462         }
6463
6464         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6465                 talloc_free(r);
6466                 return false;
6467         }
6468
6469         pull = ndr_pull_init_blob(&blob, r, NULL);
6470         if (pull == NULL) {
6471                 talloc_free(r);
6472                 return false;
6473         }
6474
6475         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6476         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6477         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6478                 talloc_free(r);
6479                 return false;
6480         }
6481
6482         if (DEBUGLEVEL >= 10) {
6483                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrinterKey, r);
6484         }
6485
6486         r->out.result = _spoolss_DeletePrinterKey(p, r);
6487
6488         if (p->rng_fault_state) {
6489                 talloc_free(r);
6490                 /* Return true here, srv_pipe_hnd.c will take care */
6491                 return true;
6492         }
6493
6494         if (DEBUGLEVEL >= 10) {
6495                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrinterKey, r);
6496         }
6497
6498         push = ndr_push_init_ctx(r, NULL);
6499         if (push == NULL) {
6500                 talloc_free(r);
6501                 return false;
6502         }
6503
6504         ndr_err = call->ndr_push(push, NDR_OUT, r);
6505         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6506                 talloc_free(r);
6507                 return false;
6508         }
6509
6510         blob = ndr_push_blob(push);
6511         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6512                 talloc_free(r);
6513                 return false;
6514         }
6515
6516         talloc_free(r);
6517
6518         return true;
6519 }
6520
6521 static bool api_spoolss_53(pipes_struct *p)
6522 {
6523         const struct ndr_interface_call *call;
6524         struct ndr_pull *pull;
6525         struct ndr_push *push;
6526         enum ndr_err_code ndr_err;
6527         DATA_BLOB blob;
6528         struct spoolss_53 *r;
6529
6530         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_53];
6531
6532         r = talloc(talloc_tos(), struct spoolss_53);
6533         if (r == NULL) {
6534                 return false;
6535         }
6536
6537         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6538                 talloc_free(r);
6539                 return false;
6540         }
6541
6542         pull = ndr_pull_init_blob(&blob, r, NULL);
6543         if (pull == NULL) {
6544                 talloc_free(r);
6545                 return false;
6546         }
6547
6548         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6549         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6550         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6551                 talloc_free(r);
6552                 return false;
6553         }
6554
6555         if (DEBUGLEVEL >= 10) {
6556                 NDR_PRINT_IN_DEBUG(spoolss_53, r);
6557         }
6558
6559         r->out.result = _spoolss_53(p, r);
6560
6561         if (p->rng_fault_state) {
6562                 talloc_free(r);
6563                 /* Return true here, srv_pipe_hnd.c will take care */
6564                 return true;
6565         }
6566
6567         if (DEBUGLEVEL >= 10) {
6568                 NDR_PRINT_OUT_DEBUG(spoolss_53, r);
6569         }
6570
6571         push = ndr_push_init_ctx(r, NULL);
6572         if (push == NULL) {
6573                 talloc_free(r);
6574                 return false;
6575         }
6576
6577         ndr_err = call->ndr_push(push, NDR_OUT, r);
6578         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6579                 talloc_free(r);
6580                 return false;
6581         }
6582
6583         blob = ndr_push_blob(push);
6584         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6585                 talloc_free(r);
6586                 return false;
6587         }
6588
6589         talloc_free(r);
6590
6591         return true;
6592 }
6593
6594 static bool api_spoolss_DeletePrinterDriverEx(pipes_struct *p)
6595 {
6596         const struct ndr_interface_call *call;
6597         struct ndr_pull *pull;
6598         struct ndr_push *push;
6599         enum ndr_err_code ndr_err;
6600         DATA_BLOB blob;
6601         struct spoolss_DeletePrinterDriverEx *r;
6602
6603         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_DELETEPRINTERDRIVEREX];
6604
6605         r = talloc(talloc_tos(), struct spoolss_DeletePrinterDriverEx);
6606         if (r == NULL) {
6607                 return false;
6608         }
6609
6610         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6611                 talloc_free(r);
6612                 return false;
6613         }
6614
6615         pull = ndr_pull_init_blob(&blob, r, NULL);
6616         if (pull == NULL) {
6617                 talloc_free(r);
6618                 return false;
6619         }
6620
6621         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6622         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6623         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6624                 talloc_free(r);
6625                 return false;
6626         }
6627
6628         if (DEBUGLEVEL >= 10) {
6629                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrinterDriverEx, r);
6630         }
6631
6632         r->out.result = _spoolss_DeletePrinterDriverEx(p, r);
6633
6634         if (p->rng_fault_state) {
6635                 talloc_free(r);
6636                 /* Return true here, srv_pipe_hnd.c will take care */
6637                 return true;
6638         }
6639
6640         if (DEBUGLEVEL >= 10) {
6641                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrinterDriverEx, r);
6642         }
6643
6644         push = ndr_push_init_ctx(r, NULL);
6645         if (push == NULL) {
6646                 talloc_free(r);
6647                 return false;
6648         }
6649
6650         ndr_err = call->ndr_push(push, NDR_OUT, r);
6651         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6652                 talloc_free(r);
6653                 return false;
6654         }
6655
6656         blob = ndr_push_blob(push);
6657         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6658                 talloc_free(r);
6659                 return false;
6660         }
6661
6662         talloc_free(r);
6663
6664         return true;
6665 }
6666
6667 static bool api_spoolss_55(pipes_struct *p)
6668 {
6669         const struct ndr_interface_call *call;
6670         struct ndr_pull *pull;
6671         struct ndr_push *push;
6672         enum ndr_err_code ndr_err;
6673         DATA_BLOB blob;
6674         struct spoolss_55 *r;
6675
6676         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_55];
6677
6678         r = talloc(talloc_tos(), struct spoolss_55);
6679         if (r == NULL) {
6680                 return false;
6681         }
6682
6683         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6684                 talloc_free(r);
6685                 return false;
6686         }
6687
6688         pull = ndr_pull_init_blob(&blob, r, NULL);
6689         if (pull == NULL) {
6690                 talloc_free(r);
6691                 return false;
6692         }
6693
6694         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6695         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6696         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6697                 talloc_free(r);
6698                 return false;
6699         }
6700
6701         if (DEBUGLEVEL >= 10) {
6702                 NDR_PRINT_IN_DEBUG(spoolss_55, r);
6703         }
6704
6705         r->out.result = _spoolss_55(p, r);
6706
6707         if (p->rng_fault_state) {
6708                 talloc_free(r);
6709                 /* Return true here, srv_pipe_hnd.c will take care */
6710                 return true;
6711         }
6712
6713         if (DEBUGLEVEL >= 10) {
6714                 NDR_PRINT_OUT_DEBUG(spoolss_55, r);
6715         }
6716
6717         push = ndr_push_init_ctx(r, NULL);
6718         if (push == NULL) {
6719                 talloc_free(r);
6720                 return false;
6721         }
6722
6723         ndr_err = call->ndr_push(push, NDR_OUT, r);
6724         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6725                 talloc_free(r);
6726                 return false;
6727         }
6728
6729         blob = ndr_push_blob(push);
6730         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6731                 talloc_free(r);
6732                 return false;
6733         }
6734
6735         talloc_free(r);
6736
6737         return true;
6738 }
6739
6740 static bool api_spoolss_56(pipes_struct *p)
6741 {
6742         const struct ndr_interface_call *call;
6743         struct ndr_pull *pull;
6744         struct ndr_push *push;
6745         enum ndr_err_code ndr_err;
6746         DATA_BLOB blob;
6747         struct spoolss_56 *r;
6748
6749         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_56];
6750
6751         r = talloc(talloc_tos(), struct spoolss_56);
6752         if (r == NULL) {
6753                 return false;
6754         }
6755
6756         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6757                 talloc_free(r);
6758                 return false;
6759         }
6760
6761         pull = ndr_pull_init_blob(&blob, r, NULL);
6762         if (pull == NULL) {
6763                 talloc_free(r);
6764                 return false;
6765         }
6766
6767         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6768         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6769         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6770                 talloc_free(r);
6771                 return false;
6772         }
6773
6774         if (DEBUGLEVEL >= 10) {
6775                 NDR_PRINT_IN_DEBUG(spoolss_56, r);
6776         }
6777
6778         r->out.result = _spoolss_56(p, r);
6779
6780         if (p->rng_fault_state) {
6781                 talloc_free(r);
6782                 /* Return true here, srv_pipe_hnd.c will take care */
6783                 return true;
6784         }
6785
6786         if (DEBUGLEVEL >= 10) {
6787                 NDR_PRINT_OUT_DEBUG(spoolss_56, r);
6788         }
6789
6790         push = ndr_push_init_ctx(r, NULL);
6791         if (push == NULL) {
6792                 talloc_free(r);
6793                 return false;
6794         }
6795
6796         ndr_err = call->ndr_push(push, NDR_OUT, r);
6797         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6798                 talloc_free(r);
6799                 return false;
6800         }
6801
6802         blob = ndr_push_blob(push);
6803         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6804                 talloc_free(r);
6805                 return false;
6806         }
6807
6808         talloc_free(r);
6809
6810         return true;
6811 }
6812
6813 static bool api_spoolss_57(pipes_struct *p)
6814 {
6815         const struct ndr_interface_call *call;
6816         struct ndr_pull *pull;
6817         struct ndr_push *push;
6818         enum ndr_err_code ndr_err;
6819         DATA_BLOB blob;
6820         struct spoolss_57 *r;
6821
6822         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_57];
6823
6824         r = talloc(talloc_tos(), struct spoolss_57);
6825         if (r == NULL) {
6826                 return false;
6827         }
6828
6829         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6830                 talloc_free(r);
6831                 return false;
6832         }
6833
6834         pull = ndr_pull_init_blob(&blob, r, NULL);
6835         if (pull == NULL) {
6836                 talloc_free(r);
6837                 return false;
6838         }
6839
6840         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6841         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6842         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6843                 talloc_free(r);
6844                 return false;
6845         }
6846
6847         if (DEBUGLEVEL >= 10) {
6848                 NDR_PRINT_IN_DEBUG(spoolss_57, r);
6849         }
6850
6851         r->out.result = _spoolss_57(p, r);
6852
6853         if (p->rng_fault_state) {
6854                 talloc_free(r);
6855                 /* Return true here, srv_pipe_hnd.c will take care */
6856                 return true;
6857         }
6858
6859         if (DEBUGLEVEL >= 10) {
6860                 NDR_PRINT_OUT_DEBUG(spoolss_57, r);
6861         }
6862
6863         push = ndr_push_init_ctx(r, NULL);
6864         if (push == NULL) {
6865                 talloc_free(r);
6866                 return false;
6867         }
6868
6869         ndr_err = call->ndr_push(push, NDR_OUT, r);
6870         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6871                 talloc_free(r);
6872                 return false;
6873         }
6874
6875         blob = ndr_push_blob(push);
6876         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6877                 talloc_free(r);
6878                 return false;
6879         }
6880
6881         talloc_free(r);
6882
6883         return true;
6884 }
6885
6886 static bool api_spoolss_XcvData(pipes_struct *p)
6887 {
6888         const struct ndr_interface_call *call;
6889         struct ndr_pull *pull;
6890         struct ndr_push *push;
6891         enum ndr_err_code ndr_err;
6892         DATA_BLOB blob;
6893         struct spoolss_XcvData *r;
6894
6895         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_XCVDATA];
6896
6897         r = talloc(talloc_tos(), struct spoolss_XcvData);
6898         if (r == NULL) {
6899                 return false;
6900         }
6901
6902         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6903                 talloc_free(r);
6904                 return false;
6905         }
6906
6907         pull = ndr_pull_init_blob(&blob, r, NULL);
6908         if (pull == NULL) {
6909                 talloc_free(r);
6910                 return false;
6911         }
6912
6913         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
6914         ndr_err = call->ndr_pull(pull, NDR_IN, r);
6915         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6916                 talloc_free(r);
6917                 return false;
6918         }
6919
6920         if (DEBUGLEVEL >= 10) {
6921                 NDR_PRINT_IN_DEBUG(spoolss_XcvData, r);
6922         }
6923
6924         ZERO_STRUCT(r->out);
6925         r->out.status_code = r->in.status_code;
6926         r->out.out_data = talloc_zero_array(r, uint8_t, r->in.out_data_size);
6927         if (r->out.out_data == NULL) {
6928                 talloc_free(r);
6929                 return false;
6930         }
6931
6932         r->out.needed = talloc_zero(r, uint32_t);
6933         if (r->out.needed == NULL) {
6934                 talloc_free(r);
6935                 return false;
6936         }
6937
6938         r->out.result = _spoolss_XcvData(p, r);
6939
6940         if (p->rng_fault_state) {
6941                 talloc_free(r);
6942                 /* Return true here, srv_pipe_hnd.c will take care */
6943                 return true;
6944         }
6945
6946         if (DEBUGLEVEL >= 10) {
6947                 NDR_PRINT_OUT_DEBUG(spoolss_XcvData, r);
6948         }
6949
6950         push = ndr_push_init_ctx(r, NULL);
6951         if (push == NULL) {
6952                 talloc_free(r);
6953                 return false;
6954         }
6955
6956         ndr_err = call->ndr_push(push, NDR_OUT, r);
6957         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
6958                 talloc_free(r);
6959                 return false;
6960         }
6961
6962         blob = ndr_push_blob(push);
6963         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
6964                 talloc_free(r);
6965                 return false;
6966         }
6967
6968         talloc_free(r);
6969
6970         return true;
6971 }
6972
6973 static bool api_spoolss_AddPrinterDriverEx(pipes_struct *p)
6974 {
6975         const struct ndr_interface_call *call;
6976         struct ndr_pull *pull;
6977         struct ndr_push *push;
6978         enum ndr_err_code ndr_err;
6979         DATA_BLOB blob;
6980         struct spoolss_AddPrinterDriverEx *r;
6981
6982         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_ADDPRINTERDRIVEREX];
6983
6984         r = talloc(talloc_tos(), struct spoolss_AddPrinterDriverEx);
6985         if (r == NULL) {
6986                 return false;
6987         }
6988
6989         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
6990                 talloc_free(r);
6991                 return false;
6992         }
6993
6994         pull = ndr_pull_init_blob(&blob, r, NULL);
6995         if (pull == NULL) {
6996                 talloc_free(r);
6997                 return false;
6998         }
6999
7000         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
7001         ndr_err = call->ndr_pull(pull, NDR_IN, r);
7002         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7003                 talloc_free(r);
7004                 return false;
7005         }
7006
7007         if (DEBUGLEVEL >= 10) {
7008                 NDR_PRINT_IN_DEBUG(spoolss_AddPrinterDriverEx, r);
7009         }
7010
7011         r->out.result = _spoolss_AddPrinterDriverEx(p, r);
7012
7013         if (p->rng_fault_state) {
7014                 talloc_free(r);
7015                 /* Return true here, srv_pipe_hnd.c will take care */
7016                 return true;
7017         }
7018
7019         if (DEBUGLEVEL >= 10) {
7020                 NDR_PRINT_OUT_DEBUG(spoolss_AddPrinterDriverEx, r);
7021         }
7022
7023         push = ndr_push_init_ctx(r, NULL);
7024         if (push == NULL) {
7025                 talloc_free(r);
7026                 return false;
7027         }
7028
7029         ndr_err = call->ndr_push(push, NDR_OUT, r);
7030         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7031                 talloc_free(r);
7032                 return false;
7033         }
7034
7035         blob = ndr_push_blob(push);
7036         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
7037                 talloc_free(r);
7038                 return false;
7039         }
7040
7041         talloc_free(r);
7042
7043         return true;
7044 }
7045
7046 static bool api_spoolss_5a(pipes_struct *p)
7047 {
7048         const struct ndr_interface_call *call;
7049         struct ndr_pull *pull;
7050         struct ndr_push *push;
7051         enum ndr_err_code ndr_err;
7052         DATA_BLOB blob;
7053         struct spoolss_5a *r;
7054
7055         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_5A];
7056
7057         r = talloc(talloc_tos(), struct spoolss_5a);
7058         if (r == NULL) {
7059                 return false;
7060         }
7061
7062         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
7063                 talloc_free(r);
7064                 return false;
7065         }
7066
7067         pull = ndr_pull_init_blob(&blob, r, NULL);
7068         if (pull == NULL) {
7069                 talloc_free(r);
7070                 return false;
7071         }
7072
7073         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
7074         ndr_err = call->ndr_pull(pull, NDR_IN, r);
7075         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7076                 talloc_free(r);
7077                 return false;
7078         }
7079
7080         if (DEBUGLEVEL >= 10) {
7081                 NDR_PRINT_IN_DEBUG(spoolss_5a, r);
7082         }
7083
7084         r->out.result = _spoolss_5a(p, r);
7085
7086         if (p->rng_fault_state) {
7087                 talloc_free(r);
7088                 /* Return true here, srv_pipe_hnd.c will take care */
7089                 return true;
7090         }
7091
7092         if (DEBUGLEVEL >= 10) {
7093                 NDR_PRINT_OUT_DEBUG(spoolss_5a, r);
7094         }
7095
7096         push = ndr_push_init_ctx(r, NULL);
7097         if (push == NULL) {
7098                 talloc_free(r);
7099                 return false;
7100         }
7101
7102         ndr_err = call->ndr_push(push, NDR_OUT, r);
7103         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7104                 talloc_free(r);
7105                 return false;
7106         }
7107
7108         blob = ndr_push_blob(push);
7109         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
7110                 talloc_free(r);
7111                 return false;
7112         }
7113
7114         talloc_free(r);
7115
7116         return true;
7117 }
7118
7119 static bool api_spoolss_5b(pipes_struct *p)
7120 {
7121         const struct ndr_interface_call *call;
7122         struct ndr_pull *pull;
7123         struct ndr_push *push;
7124         enum ndr_err_code ndr_err;
7125         DATA_BLOB blob;
7126         struct spoolss_5b *r;
7127
7128         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_5B];
7129
7130         r = talloc(talloc_tos(), struct spoolss_5b);
7131         if (r == NULL) {
7132                 return false;
7133         }
7134
7135         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
7136                 talloc_free(r);
7137                 return false;
7138         }
7139
7140         pull = ndr_pull_init_blob(&blob, r, NULL);
7141         if (pull == NULL) {
7142                 talloc_free(r);
7143                 return false;
7144         }
7145
7146         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
7147         ndr_err = call->ndr_pull(pull, NDR_IN, r);
7148         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7149                 talloc_free(r);
7150                 return false;
7151         }
7152
7153         if (DEBUGLEVEL >= 10) {
7154                 NDR_PRINT_IN_DEBUG(spoolss_5b, r);
7155         }
7156
7157         r->out.result = _spoolss_5b(p, r);
7158
7159         if (p->rng_fault_state) {
7160                 talloc_free(r);
7161                 /* Return true here, srv_pipe_hnd.c will take care */
7162                 return true;
7163         }
7164
7165         if (DEBUGLEVEL >= 10) {
7166                 NDR_PRINT_OUT_DEBUG(spoolss_5b, r);
7167         }
7168
7169         push = ndr_push_init_ctx(r, NULL);
7170         if (push == NULL) {
7171                 talloc_free(r);
7172                 return false;
7173         }
7174
7175         ndr_err = call->ndr_push(push, NDR_OUT, r);
7176         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7177                 talloc_free(r);
7178                 return false;
7179         }
7180
7181         blob = ndr_push_blob(push);
7182         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
7183                 talloc_free(r);
7184                 return false;
7185         }
7186
7187         talloc_free(r);
7188
7189         return true;
7190 }
7191
7192 static bool api_spoolss_5c(pipes_struct *p)
7193 {
7194         const struct ndr_interface_call *call;
7195         struct ndr_pull *pull;
7196         struct ndr_push *push;
7197         enum ndr_err_code ndr_err;
7198         DATA_BLOB blob;
7199         struct spoolss_5c *r;
7200
7201         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_5C];
7202
7203         r = talloc(talloc_tos(), struct spoolss_5c);
7204         if (r == NULL) {
7205                 return false;
7206         }
7207
7208         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
7209                 talloc_free(r);
7210                 return false;
7211         }
7212
7213         pull = ndr_pull_init_blob(&blob, r, NULL);
7214         if (pull == NULL) {
7215                 talloc_free(r);
7216                 return false;
7217         }
7218
7219         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
7220         ndr_err = call->ndr_pull(pull, NDR_IN, r);
7221         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7222                 talloc_free(r);
7223                 return false;
7224         }
7225
7226         if (DEBUGLEVEL >= 10) {
7227                 NDR_PRINT_IN_DEBUG(spoolss_5c, r);
7228         }
7229
7230         r->out.result = _spoolss_5c(p, r);
7231
7232         if (p->rng_fault_state) {
7233                 talloc_free(r);
7234                 /* Return true here, srv_pipe_hnd.c will take care */
7235                 return true;
7236         }
7237
7238         if (DEBUGLEVEL >= 10) {
7239                 NDR_PRINT_OUT_DEBUG(spoolss_5c, r);
7240         }
7241
7242         push = ndr_push_init_ctx(r, NULL);
7243         if (push == NULL) {
7244                 talloc_free(r);
7245                 return false;
7246         }
7247
7248         ndr_err = call->ndr_push(push, NDR_OUT, r);
7249         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7250                 talloc_free(r);
7251                 return false;
7252         }
7253
7254         blob = ndr_push_blob(push);
7255         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
7256                 talloc_free(r);
7257                 return false;
7258         }
7259
7260         talloc_free(r);
7261
7262         return true;
7263 }
7264
7265 static bool api_spoolss_5d(pipes_struct *p)
7266 {
7267         const struct ndr_interface_call *call;
7268         struct ndr_pull *pull;
7269         struct ndr_push *push;
7270         enum ndr_err_code ndr_err;
7271         DATA_BLOB blob;
7272         struct spoolss_5d *r;
7273
7274         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_5D];
7275
7276         r = talloc(talloc_tos(), struct spoolss_5d);
7277         if (r == NULL) {
7278                 return false;
7279         }
7280
7281         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
7282                 talloc_free(r);
7283                 return false;
7284         }
7285
7286         pull = ndr_pull_init_blob(&blob, r, NULL);
7287         if (pull == NULL) {
7288                 talloc_free(r);
7289                 return false;
7290         }
7291
7292         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
7293         ndr_err = call->ndr_pull(pull, NDR_IN, r);
7294         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7295                 talloc_free(r);
7296                 return false;
7297         }
7298
7299         if (DEBUGLEVEL >= 10) {
7300                 NDR_PRINT_IN_DEBUG(spoolss_5d, r);
7301         }
7302
7303         r->out.result = _spoolss_5d(p, r);
7304
7305         if (p->rng_fault_state) {
7306                 talloc_free(r);
7307                 /* Return true here, srv_pipe_hnd.c will take care */
7308                 return true;
7309         }
7310
7311         if (DEBUGLEVEL >= 10) {
7312                 NDR_PRINT_OUT_DEBUG(spoolss_5d, r);
7313         }
7314
7315         push = ndr_push_init_ctx(r, NULL);
7316         if (push == NULL) {
7317                 talloc_free(r);
7318                 return false;
7319         }
7320
7321         ndr_err = call->ndr_push(push, NDR_OUT, r);
7322         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7323                 talloc_free(r);
7324                 return false;
7325         }
7326
7327         blob = ndr_push_blob(push);
7328         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
7329                 talloc_free(r);
7330                 return false;
7331         }
7332
7333         talloc_free(r);
7334
7335         return true;
7336 }
7337
7338 static bool api_spoolss_5e(pipes_struct *p)
7339 {
7340         const struct ndr_interface_call *call;
7341         struct ndr_pull *pull;
7342         struct ndr_push *push;
7343         enum ndr_err_code ndr_err;
7344         DATA_BLOB blob;
7345         struct spoolss_5e *r;
7346
7347         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_5E];
7348
7349         r = talloc(talloc_tos(), struct spoolss_5e);
7350         if (r == NULL) {
7351                 return false;
7352         }
7353
7354         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
7355                 talloc_free(r);
7356                 return false;
7357         }
7358
7359         pull = ndr_pull_init_blob(&blob, r, NULL);
7360         if (pull == NULL) {
7361                 talloc_free(r);
7362                 return false;
7363         }
7364
7365         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
7366         ndr_err = call->ndr_pull(pull, NDR_IN, r);
7367         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7368                 talloc_free(r);
7369                 return false;
7370         }
7371
7372         if (DEBUGLEVEL >= 10) {
7373                 NDR_PRINT_IN_DEBUG(spoolss_5e, r);
7374         }
7375
7376         r->out.result = _spoolss_5e(p, r);
7377
7378         if (p->rng_fault_state) {
7379                 talloc_free(r);
7380                 /* Return true here, srv_pipe_hnd.c will take care */
7381                 return true;
7382         }
7383
7384         if (DEBUGLEVEL >= 10) {
7385                 NDR_PRINT_OUT_DEBUG(spoolss_5e, r);
7386         }
7387
7388         push = ndr_push_init_ctx(r, NULL);
7389         if (push == NULL) {
7390                 talloc_free(r);
7391                 return false;
7392         }
7393
7394         ndr_err = call->ndr_push(push, NDR_OUT, r);
7395         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7396                 talloc_free(r);
7397                 return false;
7398         }
7399
7400         blob = ndr_push_blob(push);
7401         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
7402                 talloc_free(r);
7403                 return false;
7404         }
7405
7406         talloc_free(r);
7407
7408         return true;
7409 }
7410
7411 static bool api_spoolss_5f(pipes_struct *p)
7412 {
7413         const struct ndr_interface_call *call;
7414         struct ndr_pull *pull;
7415         struct ndr_push *push;
7416         enum ndr_err_code ndr_err;
7417         DATA_BLOB blob;
7418         struct spoolss_5f *r;
7419
7420         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_5F];
7421
7422         r = talloc(talloc_tos(), struct spoolss_5f);
7423         if (r == NULL) {
7424                 return false;
7425         }
7426
7427         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
7428                 talloc_free(r);
7429                 return false;
7430         }
7431
7432         pull = ndr_pull_init_blob(&blob, r, NULL);
7433         if (pull == NULL) {
7434                 talloc_free(r);
7435                 return false;
7436         }
7437
7438         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
7439         ndr_err = call->ndr_pull(pull, NDR_IN, r);
7440         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7441                 talloc_free(r);
7442                 return false;
7443         }
7444
7445         if (DEBUGLEVEL >= 10) {
7446                 NDR_PRINT_IN_DEBUG(spoolss_5f, r);
7447         }
7448
7449         r->out.result = _spoolss_5f(p, r);
7450
7451         if (p->rng_fault_state) {
7452                 talloc_free(r);
7453                 /* Return true here, srv_pipe_hnd.c will take care */
7454                 return true;
7455         }
7456
7457         if (DEBUGLEVEL >= 10) {
7458                 NDR_PRINT_OUT_DEBUG(spoolss_5f, r);
7459         }
7460
7461         push = ndr_push_init_ctx(r, NULL);
7462         if (push == NULL) {
7463                 talloc_free(r);
7464                 return false;
7465         }
7466
7467         ndr_err = call->ndr_push(push, NDR_OUT, r);
7468         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7469                 talloc_free(r);
7470                 return false;
7471         }
7472
7473         blob = ndr_push_blob(push);
7474         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
7475                 talloc_free(r);
7476                 return false;
7477         }
7478
7479         talloc_free(r);
7480
7481         return true;
7482 }
7483
7484 static bool api_spoolss_60(pipes_struct *p)
7485 {
7486         const struct ndr_interface_call *call;
7487         struct ndr_pull *pull;
7488         struct ndr_push *push;
7489         enum ndr_err_code ndr_err;
7490         DATA_BLOB blob;
7491         struct spoolss_60 *r;
7492
7493         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_60];
7494
7495         r = talloc(talloc_tos(), struct spoolss_60);
7496         if (r == NULL) {
7497                 return false;
7498         }
7499
7500         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
7501                 talloc_free(r);
7502                 return false;
7503         }
7504
7505         pull = ndr_pull_init_blob(&blob, r, NULL);
7506         if (pull == NULL) {
7507                 talloc_free(r);
7508                 return false;
7509         }
7510
7511         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
7512         ndr_err = call->ndr_pull(pull, NDR_IN, r);
7513         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7514                 talloc_free(r);
7515                 return false;
7516         }
7517
7518         if (DEBUGLEVEL >= 10) {
7519                 NDR_PRINT_IN_DEBUG(spoolss_60, r);
7520         }
7521
7522         r->out.result = _spoolss_60(p, r);
7523
7524         if (p->rng_fault_state) {
7525                 talloc_free(r);
7526                 /* Return true here, srv_pipe_hnd.c will take care */
7527                 return true;
7528         }
7529
7530         if (DEBUGLEVEL >= 10) {
7531                 NDR_PRINT_OUT_DEBUG(spoolss_60, r);
7532         }
7533
7534         push = ndr_push_init_ctx(r, NULL);
7535         if (push == NULL) {
7536                 talloc_free(r);
7537                 return false;
7538         }
7539
7540         ndr_err = call->ndr_push(push, NDR_OUT, r);
7541         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7542                 talloc_free(r);
7543                 return false;
7544         }
7545
7546         blob = ndr_push_blob(push);
7547         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
7548                 talloc_free(r);
7549                 return false;
7550         }
7551
7552         talloc_free(r);
7553
7554         return true;
7555 }
7556
7557 static bool api_spoolss_61(pipes_struct *p)
7558 {
7559         const struct ndr_interface_call *call;
7560         struct ndr_pull *pull;
7561         struct ndr_push *push;
7562         enum ndr_err_code ndr_err;
7563         DATA_BLOB blob;
7564         struct spoolss_61 *r;
7565
7566         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_61];
7567
7568         r = talloc(talloc_tos(), struct spoolss_61);
7569         if (r == NULL) {
7570                 return false;
7571         }
7572
7573         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
7574                 talloc_free(r);
7575                 return false;
7576         }
7577
7578         pull = ndr_pull_init_blob(&blob, r, NULL);
7579         if (pull == NULL) {
7580                 talloc_free(r);
7581                 return false;
7582         }
7583
7584         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
7585         ndr_err = call->ndr_pull(pull, NDR_IN, r);
7586         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7587                 talloc_free(r);
7588                 return false;
7589         }
7590
7591         if (DEBUGLEVEL >= 10) {
7592                 NDR_PRINT_IN_DEBUG(spoolss_61, r);
7593         }
7594
7595         r->out.result = _spoolss_61(p, r);
7596
7597         if (p->rng_fault_state) {
7598                 talloc_free(r);
7599                 /* Return true here, srv_pipe_hnd.c will take care */
7600                 return true;
7601         }
7602
7603         if (DEBUGLEVEL >= 10) {
7604                 NDR_PRINT_OUT_DEBUG(spoolss_61, r);
7605         }
7606
7607         push = ndr_push_init_ctx(r, NULL);
7608         if (push == NULL) {
7609                 talloc_free(r);
7610                 return false;
7611         }
7612
7613         ndr_err = call->ndr_push(push, NDR_OUT, r);
7614         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7615                 talloc_free(r);
7616                 return false;
7617         }
7618
7619         blob = ndr_push_blob(push);
7620         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
7621                 talloc_free(r);
7622                 return false;
7623         }
7624
7625         talloc_free(r);
7626
7627         return true;
7628 }
7629
7630 static bool api_spoolss_62(pipes_struct *p)
7631 {
7632         const struct ndr_interface_call *call;
7633         struct ndr_pull *pull;
7634         struct ndr_push *push;
7635         enum ndr_err_code ndr_err;
7636         DATA_BLOB blob;
7637         struct spoolss_62 *r;
7638
7639         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_62];
7640
7641         r = talloc(talloc_tos(), struct spoolss_62);
7642         if (r == NULL) {
7643                 return false;
7644         }
7645
7646         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
7647                 talloc_free(r);
7648                 return false;
7649         }
7650
7651         pull = ndr_pull_init_blob(&blob, r, NULL);
7652         if (pull == NULL) {
7653                 talloc_free(r);
7654                 return false;
7655         }
7656
7657         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
7658         ndr_err = call->ndr_pull(pull, NDR_IN, r);
7659         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7660                 talloc_free(r);
7661                 return false;
7662         }
7663
7664         if (DEBUGLEVEL >= 10) {
7665                 NDR_PRINT_IN_DEBUG(spoolss_62, r);
7666         }
7667
7668         r->out.result = _spoolss_62(p, r);
7669
7670         if (p->rng_fault_state) {
7671                 talloc_free(r);
7672                 /* Return true here, srv_pipe_hnd.c will take care */
7673                 return true;
7674         }
7675
7676         if (DEBUGLEVEL >= 10) {
7677                 NDR_PRINT_OUT_DEBUG(spoolss_62, r);
7678         }
7679
7680         push = ndr_push_init_ctx(r, NULL);
7681         if (push == NULL) {
7682                 talloc_free(r);
7683                 return false;
7684         }
7685
7686         ndr_err = call->ndr_push(push, NDR_OUT, r);
7687         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7688                 talloc_free(r);
7689                 return false;
7690         }
7691
7692         blob = ndr_push_blob(push);
7693         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
7694                 talloc_free(r);
7695                 return false;
7696         }
7697
7698         talloc_free(r);
7699
7700         return true;
7701 }
7702
7703 static bool api_spoolss_63(pipes_struct *p)
7704 {
7705         const struct ndr_interface_call *call;
7706         struct ndr_pull *pull;
7707         struct ndr_push *push;
7708         enum ndr_err_code ndr_err;
7709         DATA_BLOB blob;
7710         struct spoolss_63 *r;
7711
7712         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_63];
7713
7714         r = talloc(talloc_tos(), struct spoolss_63);
7715         if (r == NULL) {
7716                 return false;
7717         }
7718
7719         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
7720                 talloc_free(r);
7721                 return false;
7722         }
7723
7724         pull = ndr_pull_init_blob(&blob, r, NULL);
7725         if (pull == NULL) {
7726                 talloc_free(r);
7727                 return false;
7728         }
7729
7730         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
7731         ndr_err = call->ndr_pull(pull, NDR_IN, r);
7732         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7733                 talloc_free(r);
7734                 return false;
7735         }
7736
7737         if (DEBUGLEVEL >= 10) {
7738                 NDR_PRINT_IN_DEBUG(spoolss_63, r);
7739         }
7740
7741         r->out.result = _spoolss_63(p, r);
7742
7743         if (p->rng_fault_state) {
7744                 talloc_free(r);
7745                 /* Return true here, srv_pipe_hnd.c will take care */
7746                 return true;
7747         }
7748
7749         if (DEBUGLEVEL >= 10) {
7750                 NDR_PRINT_OUT_DEBUG(spoolss_63, r);
7751         }
7752
7753         push = ndr_push_init_ctx(r, NULL);
7754         if (push == NULL) {
7755                 talloc_free(r);
7756                 return false;
7757         }
7758
7759         ndr_err = call->ndr_push(push, NDR_OUT, r);
7760         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7761                 talloc_free(r);
7762                 return false;
7763         }
7764
7765         blob = ndr_push_blob(push);
7766         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
7767                 talloc_free(r);
7768                 return false;
7769         }
7770
7771         talloc_free(r);
7772
7773         return true;
7774 }
7775
7776 static bool api_spoolss_64(pipes_struct *p)
7777 {
7778         const struct ndr_interface_call *call;
7779         struct ndr_pull *pull;
7780         struct ndr_push *push;
7781         enum ndr_err_code ndr_err;
7782         DATA_BLOB blob;
7783         struct spoolss_64 *r;
7784
7785         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_64];
7786
7787         r = talloc(talloc_tos(), struct spoolss_64);
7788         if (r == NULL) {
7789                 return false;
7790         }
7791
7792         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
7793                 talloc_free(r);
7794                 return false;
7795         }
7796
7797         pull = ndr_pull_init_blob(&blob, r, NULL);
7798         if (pull == NULL) {
7799                 talloc_free(r);
7800                 return false;
7801         }
7802
7803         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
7804         ndr_err = call->ndr_pull(pull, NDR_IN, r);
7805         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7806                 talloc_free(r);
7807                 return false;
7808         }
7809
7810         if (DEBUGLEVEL >= 10) {
7811                 NDR_PRINT_IN_DEBUG(spoolss_64, r);
7812         }
7813
7814         r->out.result = _spoolss_64(p, r);
7815
7816         if (p->rng_fault_state) {
7817                 talloc_free(r);
7818                 /* Return true here, srv_pipe_hnd.c will take care */
7819                 return true;
7820         }
7821
7822         if (DEBUGLEVEL >= 10) {
7823                 NDR_PRINT_OUT_DEBUG(spoolss_64, r);
7824         }
7825
7826         push = ndr_push_init_ctx(r, NULL);
7827         if (push == NULL) {
7828                 talloc_free(r);
7829                 return false;
7830         }
7831
7832         ndr_err = call->ndr_push(push, NDR_OUT, r);
7833         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7834                 talloc_free(r);
7835                 return false;
7836         }
7837
7838         blob = ndr_push_blob(push);
7839         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
7840                 talloc_free(r);
7841                 return false;
7842         }
7843
7844         talloc_free(r);
7845
7846         return true;
7847 }
7848
7849 static bool api_spoolss_65(pipes_struct *p)
7850 {
7851         const struct ndr_interface_call *call;
7852         struct ndr_pull *pull;
7853         struct ndr_push *push;
7854         enum ndr_err_code ndr_err;
7855         DATA_BLOB blob;
7856         struct spoolss_65 *r;
7857
7858         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_65];
7859
7860         r = talloc(talloc_tos(), struct spoolss_65);
7861         if (r == NULL) {
7862                 return false;
7863         }
7864
7865         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
7866                 talloc_free(r);
7867                 return false;
7868         }
7869
7870         pull = ndr_pull_init_blob(&blob, r, NULL);
7871         if (pull == NULL) {
7872                 talloc_free(r);
7873                 return false;
7874         }
7875
7876         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
7877         ndr_err = call->ndr_pull(pull, NDR_IN, r);
7878         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7879                 talloc_free(r);
7880                 return false;
7881         }
7882
7883         if (DEBUGLEVEL >= 10) {
7884                 NDR_PRINT_IN_DEBUG(spoolss_65, r);
7885         }
7886
7887         r->out.result = _spoolss_65(p, r);
7888
7889         if (p->rng_fault_state) {
7890                 talloc_free(r);
7891                 /* Return true here, srv_pipe_hnd.c will take care */
7892                 return true;
7893         }
7894
7895         if (DEBUGLEVEL >= 10) {
7896                 NDR_PRINT_OUT_DEBUG(spoolss_65, r);
7897         }
7898
7899         push = ndr_push_init_ctx(r, NULL);
7900         if (push == NULL) {
7901                 talloc_free(r);
7902                 return false;
7903         }
7904
7905         ndr_err = call->ndr_push(push, NDR_OUT, r);
7906         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7907                 talloc_free(r);
7908                 return false;
7909         }
7910
7911         blob = ndr_push_blob(push);
7912         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
7913                 talloc_free(r);
7914                 return false;
7915         }
7916
7917         talloc_free(r);
7918
7919         return true;
7920 }
7921
7922 static bool api_spoolss_GetCorePrinterDrivers(pipes_struct *p)
7923 {
7924         const struct ndr_interface_call *call;
7925         struct ndr_pull *pull;
7926         struct ndr_push *push;
7927         enum ndr_err_code ndr_err;
7928         DATA_BLOB blob;
7929         struct spoolss_GetCorePrinterDrivers *r;
7930
7931         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_GETCOREPRINTERDRIVERS];
7932
7933         r = talloc(talloc_tos(), struct spoolss_GetCorePrinterDrivers);
7934         if (r == NULL) {
7935                 return false;
7936         }
7937
7938         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
7939                 talloc_free(r);
7940                 return false;
7941         }
7942
7943         pull = ndr_pull_init_blob(&blob, r, NULL);
7944         if (pull == NULL) {
7945                 talloc_free(r);
7946                 return false;
7947         }
7948
7949         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
7950         ndr_err = call->ndr_pull(pull, NDR_IN, r);
7951         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7952                 talloc_free(r);
7953                 return false;
7954         }
7955
7956         if (DEBUGLEVEL >= 10) {
7957                 NDR_PRINT_IN_DEBUG(spoolss_GetCorePrinterDrivers, r);
7958         }
7959
7960         ZERO_STRUCT(r->out);
7961         r->out.core_printer_drivers = talloc_zero_array(r, struct spoolss_CorePrinterDriver, r->in.core_printer_driver_count);
7962         if (r->out.core_printer_drivers == NULL) {
7963                 talloc_free(r);
7964                 return false;
7965         }
7966
7967         r->out.result = _spoolss_GetCorePrinterDrivers(p, r);
7968
7969         if (p->rng_fault_state) {
7970                 talloc_free(r);
7971                 /* Return true here, srv_pipe_hnd.c will take care */
7972                 return true;
7973         }
7974
7975         if (DEBUGLEVEL >= 10) {
7976                 NDR_PRINT_OUT_DEBUG(spoolss_GetCorePrinterDrivers, r);
7977         }
7978
7979         push = ndr_push_init_ctx(r, NULL);
7980         if (push == NULL) {
7981                 talloc_free(r);
7982                 return false;
7983         }
7984
7985         ndr_err = call->ndr_push(push, NDR_OUT, r);
7986         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
7987                 talloc_free(r);
7988                 return false;
7989         }
7990
7991         blob = ndr_push_blob(push);
7992         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
7993                 talloc_free(r);
7994                 return false;
7995         }
7996
7997         talloc_free(r);
7998
7999         return true;
8000 }
8001
8002 static bool api_spoolss_67(pipes_struct *p)
8003 {
8004         const struct ndr_interface_call *call;
8005         struct ndr_pull *pull;
8006         struct ndr_push *push;
8007         enum ndr_err_code ndr_err;
8008         DATA_BLOB blob;
8009         struct spoolss_67 *r;
8010
8011         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_67];
8012
8013         r = talloc(talloc_tos(), struct spoolss_67);
8014         if (r == NULL) {
8015                 return false;
8016         }
8017
8018         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
8019                 talloc_free(r);
8020                 return false;
8021         }
8022
8023         pull = ndr_pull_init_blob(&blob, r, NULL);
8024         if (pull == NULL) {
8025                 talloc_free(r);
8026                 return false;
8027         }
8028
8029         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
8030         ndr_err = call->ndr_pull(pull, NDR_IN, r);
8031         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
8032                 talloc_free(r);
8033                 return false;
8034         }
8035
8036         if (DEBUGLEVEL >= 10) {
8037                 NDR_PRINT_IN_DEBUG(spoolss_67, r);
8038         }
8039
8040         r->out.result = _spoolss_67(p, r);
8041
8042         if (p->rng_fault_state) {
8043                 talloc_free(r);
8044                 /* Return true here, srv_pipe_hnd.c will take care */
8045                 return true;
8046         }
8047
8048         if (DEBUGLEVEL >= 10) {
8049                 NDR_PRINT_OUT_DEBUG(spoolss_67, r);
8050         }
8051
8052         push = ndr_push_init_ctx(r, NULL);
8053         if (push == NULL) {
8054                 talloc_free(r);
8055                 return false;
8056         }
8057
8058         ndr_err = call->ndr_push(push, NDR_OUT, r);
8059         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
8060                 talloc_free(r);
8061                 return false;
8062         }
8063
8064         blob = ndr_push_blob(push);
8065         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
8066                 talloc_free(r);
8067                 return false;
8068         }
8069
8070         talloc_free(r);
8071
8072         return true;
8073 }
8074
8075 static bool api_spoolss_GetPrinterDriverPackagePath(pipes_struct *p)
8076 {
8077         const struct ndr_interface_call *call;
8078         struct ndr_pull *pull;
8079         struct ndr_push *push;
8080         enum ndr_err_code ndr_err;
8081         DATA_BLOB blob;
8082         struct spoolss_GetPrinterDriverPackagePath *r;
8083
8084         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_GETPRINTERDRIVERPACKAGEPATH];
8085
8086         r = talloc(talloc_tos(), struct spoolss_GetPrinterDriverPackagePath);
8087         if (r == NULL) {
8088                 return false;
8089         }
8090
8091         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
8092                 talloc_free(r);
8093                 return false;
8094         }
8095
8096         pull = ndr_pull_init_blob(&blob, r, NULL);
8097         if (pull == NULL) {
8098                 talloc_free(r);
8099                 return false;
8100         }
8101
8102         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
8103         ndr_err = call->ndr_pull(pull, NDR_IN, r);
8104         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
8105                 talloc_free(r);
8106                 return false;
8107         }
8108
8109         if (DEBUGLEVEL >= 10) {
8110                 NDR_PRINT_IN_DEBUG(spoolss_GetPrinterDriverPackagePath, r);
8111         }
8112
8113         ZERO_STRUCT(r->out);
8114         r->out.driver_package_cab = r->in.driver_package_cab;
8115         r->out.required = talloc_zero(r, uint32_t);
8116         if (r->out.required == NULL) {
8117                 talloc_free(r);
8118                 return false;
8119         }
8120
8121         r->out.result = _spoolss_GetPrinterDriverPackagePath(p, r);
8122
8123         if (p->rng_fault_state) {
8124                 talloc_free(r);
8125                 /* Return true here, srv_pipe_hnd.c will take care */
8126                 return true;
8127         }
8128
8129         if (DEBUGLEVEL >= 10) {
8130                 NDR_PRINT_OUT_DEBUG(spoolss_GetPrinterDriverPackagePath, r);
8131         }
8132
8133         push = ndr_push_init_ctx(r, NULL);
8134         if (push == NULL) {
8135                 talloc_free(r);
8136                 return false;
8137         }
8138
8139         ndr_err = call->ndr_push(push, NDR_OUT, r);
8140         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
8141                 talloc_free(r);
8142                 return false;
8143         }
8144
8145         blob = ndr_push_blob(push);
8146         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
8147                 talloc_free(r);
8148                 return false;
8149         }
8150
8151         talloc_free(r);
8152
8153         return true;
8154 }
8155
8156 static bool api_spoolss_69(pipes_struct *p)
8157 {
8158         const struct ndr_interface_call *call;
8159         struct ndr_pull *pull;
8160         struct ndr_push *push;
8161         enum ndr_err_code ndr_err;
8162         DATA_BLOB blob;
8163         struct spoolss_69 *r;
8164
8165         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_69];
8166
8167         r = talloc(talloc_tos(), struct spoolss_69);
8168         if (r == NULL) {
8169                 return false;
8170         }
8171
8172         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
8173                 talloc_free(r);
8174                 return false;
8175         }
8176
8177         pull = ndr_pull_init_blob(&blob, r, NULL);
8178         if (pull == NULL) {
8179                 talloc_free(r);
8180                 return false;
8181         }
8182
8183         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
8184         ndr_err = call->ndr_pull(pull, NDR_IN, r);
8185         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
8186                 talloc_free(r);
8187                 return false;
8188         }
8189
8190         if (DEBUGLEVEL >= 10) {
8191                 NDR_PRINT_IN_DEBUG(spoolss_69, r);
8192         }
8193
8194         r->out.result = _spoolss_69(p, r);
8195
8196         if (p->rng_fault_state) {
8197                 talloc_free(r);
8198                 /* Return true here, srv_pipe_hnd.c will take care */
8199                 return true;
8200         }
8201
8202         if (DEBUGLEVEL >= 10) {
8203                 NDR_PRINT_OUT_DEBUG(spoolss_69, r);
8204         }
8205
8206         push = ndr_push_init_ctx(r, NULL);
8207         if (push == NULL) {
8208                 talloc_free(r);
8209                 return false;
8210         }
8211
8212         ndr_err = call->ndr_push(push, NDR_OUT, r);
8213         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
8214                 talloc_free(r);
8215                 return false;
8216         }
8217
8218         blob = ndr_push_blob(push);
8219         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
8220                 talloc_free(r);
8221                 return false;
8222         }
8223
8224         talloc_free(r);
8225
8226         return true;
8227 }
8228
8229 static bool api_spoolss_6a(pipes_struct *p)
8230 {
8231         const struct ndr_interface_call *call;
8232         struct ndr_pull *pull;
8233         struct ndr_push *push;
8234         enum ndr_err_code ndr_err;
8235         DATA_BLOB blob;
8236         struct spoolss_6a *r;
8237
8238         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_6A];
8239
8240         r = talloc(talloc_tos(), struct spoolss_6a);
8241         if (r == NULL) {
8242                 return false;
8243         }
8244
8245         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
8246                 talloc_free(r);
8247                 return false;
8248         }
8249
8250         pull = ndr_pull_init_blob(&blob, r, NULL);
8251         if (pull == NULL) {
8252                 talloc_free(r);
8253                 return false;
8254         }
8255
8256         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
8257         ndr_err = call->ndr_pull(pull, NDR_IN, r);
8258         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
8259                 talloc_free(r);
8260                 return false;
8261         }
8262
8263         if (DEBUGLEVEL >= 10) {
8264                 NDR_PRINT_IN_DEBUG(spoolss_6a, r);
8265         }
8266
8267         r->out.result = _spoolss_6a(p, r);
8268
8269         if (p->rng_fault_state) {
8270                 talloc_free(r);
8271                 /* Return true here, srv_pipe_hnd.c will take care */
8272                 return true;
8273         }
8274
8275         if (DEBUGLEVEL >= 10) {
8276                 NDR_PRINT_OUT_DEBUG(spoolss_6a, r);
8277         }
8278
8279         push = ndr_push_init_ctx(r, NULL);
8280         if (push == NULL) {
8281                 talloc_free(r);
8282                 return false;
8283         }
8284
8285         ndr_err = call->ndr_push(push, NDR_OUT, r);
8286         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
8287                 talloc_free(r);
8288                 return false;
8289         }
8290
8291         blob = ndr_push_blob(push);
8292         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
8293                 talloc_free(r);
8294                 return false;
8295         }
8296
8297         talloc_free(r);
8298
8299         return true;
8300 }
8301
8302 static bool api_spoolss_6b(pipes_struct *p)
8303 {
8304         const struct ndr_interface_call *call;
8305         struct ndr_pull *pull;
8306         struct ndr_push *push;
8307         enum ndr_err_code ndr_err;
8308         DATA_BLOB blob;
8309         struct spoolss_6b *r;
8310
8311         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_6B];
8312
8313         r = talloc(talloc_tos(), struct spoolss_6b);
8314         if (r == NULL) {
8315                 return false;
8316         }
8317
8318         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
8319                 talloc_free(r);
8320                 return false;
8321         }
8322
8323         pull = ndr_pull_init_blob(&blob, r, NULL);
8324         if (pull == NULL) {
8325                 talloc_free(r);
8326                 return false;
8327         }
8328
8329         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
8330         ndr_err = call->ndr_pull(pull, NDR_IN, r);
8331         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
8332                 talloc_free(r);
8333                 return false;
8334         }
8335
8336         if (DEBUGLEVEL >= 10) {
8337                 NDR_PRINT_IN_DEBUG(spoolss_6b, r);
8338         }
8339
8340         r->out.result = _spoolss_6b(p, r);
8341
8342         if (p->rng_fault_state) {
8343                 talloc_free(r);
8344                 /* Return true here, srv_pipe_hnd.c will take care */
8345                 return true;
8346         }
8347
8348         if (DEBUGLEVEL >= 10) {
8349                 NDR_PRINT_OUT_DEBUG(spoolss_6b, r);
8350         }
8351
8352         push = ndr_push_init_ctx(r, NULL);
8353         if (push == NULL) {
8354                 talloc_free(r);
8355                 return false;
8356         }
8357
8358         ndr_err = call->ndr_push(push, NDR_OUT, r);
8359         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
8360                 talloc_free(r);
8361                 return false;
8362         }
8363
8364         blob = ndr_push_blob(push);
8365         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
8366                 talloc_free(r);
8367                 return false;
8368         }
8369
8370         talloc_free(r);
8371
8372         return true;
8373 }
8374
8375 static bool api_spoolss_6c(pipes_struct *p)
8376 {
8377         const struct ndr_interface_call *call;
8378         struct ndr_pull *pull;
8379         struct ndr_push *push;
8380         enum ndr_err_code ndr_err;
8381         DATA_BLOB blob;
8382         struct spoolss_6c *r;
8383
8384         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_6C];
8385
8386         r = talloc(talloc_tos(), struct spoolss_6c);
8387         if (r == NULL) {
8388                 return false;
8389         }
8390
8391         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
8392                 talloc_free(r);
8393                 return false;
8394         }
8395
8396         pull = ndr_pull_init_blob(&blob, r, NULL);
8397         if (pull == NULL) {
8398                 talloc_free(r);
8399                 return false;
8400         }
8401
8402         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
8403         ndr_err = call->ndr_pull(pull, NDR_IN, r);
8404         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
8405                 talloc_free(r);
8406                 return false;
8407         }
8408
8409         if (DEBUGLEVEL >= 10) {
8410                 NDR_PRINT_IN_DEBUG(spoolss_6c, r);
8411         }
8412
8413         r->out.result = _spoolss_6c(p, r);
8414
8415         if (p->rng_fault_state) {
8416                 talloc_free(r);
8417                 /* Return true here, srv_pipe_hnd.c will take care */
8418                 return true;
8419         }
8420
8421         if (DEBUGLEVEL >= 10) {
8422                 NDR_PRINT_OUT_DEBUG(spoolss_6c, r);
8423         }
8424
8425         push = ndr_push_init_ctx(r, NULL);
8426         if (push == NULL) {
8427                 talloc_free(r);
8428                 return false;
8429         }
8430
8431         ndr_err = call->ndr_push(push, NDR_OUT, r);
8432         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
8433                 talloc_free(r);
8434                 return false;
8435         }
8436
8437         blob = ndr_push_blob(push);
8438         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
8439                 talloc_free(r);
8440                 return false;
8441         }
8442
8443         talloc_free(r);
8444
8445         return true;
8446 }
8447
8448 static bool api_spoolss_6d(pipes_struct *p)
8449 {
8450         const struct ndr_interface_call *call;
8451         struct ndr_pull *pull;
8452         struct ndr_push *push;
8453         enum ndr_err_code ndr_err;
8454         DATA_BLOB blob;
8455         struct spoolss_6d *r;
8456
8457         call = &ndr_table_spoolss.calls[NDR_SPOOLSS_6D];
8458
8459         r = talloc(talloc_tos(), struct spoolss_6d);
8460         if (r == NULL) {
8461                 return false;
8462         }
8463
8464         if (!prs_data_blob(&p->in_data.data, &blob, r)) {
8465                 talloc_free(r);
8466                 return false;
8467         }
8468
8469         pull = ndr_pull_init_blob(&blob, r, NULL);
8470         if (pull == NULL) {
8471                 talloc_free(r);
8472                 return false;
8473         }
8474
8475         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
8476         ndr_err = call->ndr_pull(pull, NDR_IN, r);
8477         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
8478                 talloc_free(r);
8479                 return false;
8480         }
8481
8482         if (DEBUGLEVEL >= 10) {
8483                 NDR_PRINT_IN_DEBUG(spoolss_6d, r);
8484         }
8485
8486         r->out.result = _spoolss_6d(p, r);
8487
8488         if (p->rng_fault_state) {
8489                 talloc_free(r);
8490                 /* Return true here, srv_pipe_hnd.c will take care */
8491                 return true;
8492         }
8493
8494         if (DEBUGLEVEL >= 10) {
8495                 NDR_PRINT_OUT_DEBUG(spoolss_6d, r);
8496         }
8497
8498         push = ndr_push_init_ctx(r, NULL);
8499         if (push == NULL) {
8500                 talloc_free(r);
8501                 return false;
8502         }
8503
8504         ndr_err = call->ndr_push(push, NDR_OUT, r);
8505         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
8506                 talloc_free(r);
8507                 return false;
8508         }
8509
8510         blob = ndr_push_blob(push);
8511         if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
8512                 talloc_free(r);
8513                 return false;
8514         }
8515
8516         talloc_free(r);
8517
8518         return true;
8519 }
8520
8521
8522 /* Tables */
8523 static struct api_struct api_spoolss_cmds[] = 
8524 {
8525         {"SPOOLSS_ENUMPRINTERS", NDR_SPOOLSS_ENUMPRINTERS, api_spoolss_EnumPrinters},
8526         {"SPOOLSS_OPENPRINTER", NDR_SPOOLSS_OPENPRINTER, api_spoolss_OpenPrinter},
8527         {"SPOOLSS_SETJOB", NDR_SPOOLSS_SETJOB, api_spoolss_SetJob},
8528         {"SPOOLSS_GETJOB", NDR_SPOOLSS_GETJOB, api_spoolss_GetJob},
8529         {"SPOOLSS_ENUMJOBS", NDR_SPOOLSS_ENUMJOBS, api_spoolss_EnumJobs},
8530         {"SPOOLSS_ADDPRINTER", NDR_SPOOLSS_ADDPRINTER, api_spoolss_AddPrinter},
8531         {"SPOOLSS_DELETEPRINTER", NDR_SPOOLSS_DELETEPRINTER, api_spoolss_DeletePrinter},
8532         {"SPOOLSS_SETPRINTER", NDR_SPOOLSS_SETPRINTER, api_spoolss_SetPrinter},
8533         {"SPOOLSS_GETPRINTER", NDR_SPOOLSS_GETPRINTER, api_spoolss_GetPrinter},
8534         {"SPOOLSS_ADDPRINTERDRIVER", NDR_SPOOLSS_ADDPRINTERDRIVER, api_spoolss_AddPrinterDriver},
8535         {"SPOOLSS_ENUMPRINTERDRIVERS", NDR_SPOOLSS_ENUMPRINTERDRIVERS, api_spoolss_EnumPrinterDrivers},
8536         {"SPOOLSS_GETPRINTERDRIVER", NDR_SPOOLSS_GETPRINTERDRIVER, api_spoolss_GetPrinterDriver},
8537         {"SPOOLSS_GETPRINTERDRIVERDIRECTORY", NDR_SPOOLSS_GETPRINTERDRIVERDIRECTORY, api_spoolss_GetPrinterDriverDirectory},
8538         {"SPOOLSS_DELETEPRINTERDRIVER", NDR_SPOOLSS_DELETEPRINTERDRIVER, api_spoolss_DeletePrinterDriver},
8539         {"SPOOLSS_ADDPRINTPROCESSOR", NDR_SPOOLSS_ADDPRINTPROCESSOR, api_spoolss_AddPrintProcessor},
8540         {"SPOOLSS_ENUMPRINTPROCESSORS", NDR_SPOOLSS_ENUMPRINTPROCESSORS, api_spoolss_EnumPrintProcessors},
8541         {"SPOOLSS_GETPRINTPROCESSORDIRECTORY", NDR_SPOOLSS_GETPRINTPROCESSORDIRECTORY, api_spoolss_GetPrintProcessorDirectory},
8542         {"SPOOLSS_STARTDOCPRINTER", NDR_SPOOLSS_STARTDOCPRINTER, api_spoolss_StartDocPrinter},
8543         {"SPOOLSS_STARTPAGEPRINTER", NDR_SPOOLSS_STARTPAGEPRINTER, api_spoolss_StartPagePrinter},
8544         {"SPOOLSS_WRITEPRINTER", NDR_SPOOLSS_WRITEPRINTER, api_spoolss_WritePrinter},
8545         {"SPOOLSS_ENDPAGEPRINTER", NDR_SPOOLSS_ENDPAGEPRINTER, api_spoolss_EndPagePrinter},
8546         {"SPOOLSS_ABORTPRINTER", NDR_SPOOLSS_ABORTPRINTER, api_spoolss_AbortPrinter},
8547         {"SPOOLSS_READPRINTER", NDR_SPOOLSS_READPRINTER, api_spoolss_ReadPrinter},
8548         {"SPOOLSS_ENDDOCPRINTER", NDR_SPOOLSS_ENDDOCPRINTER, api_spoolss_EndDocPrinter},
8549         {"SPOOLSS_ADDJOB", NDR_SPOOLSS_ADDJOB, api_spoolss_AddJob},
8550         {"SPOOLSS_SCHEDULEJOB", NDR_SPOOLSS_SCHEDULEJOB, api_spoolss_ScheduleJob},
8551         {"SPOOLSS_GETPRINTERDATA", NDR_SPOOLSS_GETPRINTERDATA, api_spoolss_GetPrinterData},
8552         {"SPOOLSS_SETPRINTERDATA", NDR_SPOOLSS_SETPRINTERDATA, api_spoolss_SetPrinterData},
8553         {"SPOOLSS_WAITFORPRINTERCHANGE", NDR_SPOOLSS_WAITFORPRINTERCHANGE, api_spoolss_WaitForPrinterChange},
8554         {"SPOOLSS_CLOSEPRINTER", NDR_SPOOLSS_CLOSEPRINTER, api_spoolss_ClosePrinter},
8555         {"SPOOLSS_ADDFORM", NDR_SPOOLSS_ADDFORM, api_spoolss_AddForm},
8556         {"SPOOLSS_DELETEFORM", NDR_SPOOLSS_DELETEFORM, api_spoolss_DeleteForm},
8557         {"SPOOLSS_GETFORM", NDR_SPOOLSS_GETFORM, api_spoolss_GetForm},
8558         {"SPOOLSS_SETFORM", NDR_SPOOLSS_SETFORM, api_spoolss_SetForm},
8559         {"SPOOLSS_ENUMFORMS", NDR_SPOOLSS_ENUMFORMS, api_spoolss_EnumForms},
8560         {"SPOOLSS_ENUMPORTS", NDR_SPOOLSS_ENUMPORTS, api_spoolss_EnumPorts},
8561         {"SPOOLSS_ENUMMONITORS", NDR_SPOOLSS_ENUMMONITORS, api_spoolss_EnumMonitors},
8562         {"SPOOLSS_ADDPORT", NDR_SPOOLSS_ADDPORT, api_spoolss_AddPort},
8563         {"SPOOLSS_CONFIGUREPORT", NDR_SPOOLSS_CONFIGUREPORT, api_spoolss_ConfigurePort},
8564         {"SPOOLSS_DELETEPORT", NDR_SPOOLSS_DELETEPORT, api_spoolss_DeletePort},
8565         {"SPOOLSS_CREATEPRINTERIC", NDR_SPOOLSS_CREATEPRINTERIC, api_spoolss_CreatePrinterIC},
8566         {"SPOOLSS_PLAYGDISCRIPTONPRINTERIC", NDR_SPOOLSS_PLAYGDISCRIPTONPRINTERIC, api_spoolss_PlayGDIScriptOnPrinterIC},
8567         {"SPOOLSS_DELETEPRINTERIC", NDR_SPOOLSS_DELETEPRINTERIC, api_spoolss_DeletePrinterIC},
8568         {"SPOOLSS_ADDPRINTERCONNECTION", NDR_SPOOLSS_ADDPRINTERCONNECTION, api_spoolss_AddPrinterConnection},
8569         {"SPOOLSS_DELETEPRINTERCONNECTION", NDR_SPOOLSS_DELETEPRINTERCONNECTION, api_spoolss_DeletePrinterConnection},
8570         {"SPOOLSS_PRINTERMESSAGEBOX", NDR_SPOOLSS_PRINTERMESSAGEBOX, api_spoolss_PrinterMessageBox},
8571         {"SPOOLSS_ADDMONITOR", NDR_SPOOLSS_ADDMONITOR, api_spoolss_AddMonitor},
8572         {"SPOOLSS_DELETEMONITOR", NDR_SPOOLSS_DELETEMONITOR, api_spoolss_DeleteMonitor},
8573         {"SPOOLSS_DELETEPRINTPROCESSOR", NDR_SPOOLSS_DELETEPRINTPROCESSOR, api_spoolss_DeletePrintProcessor},
8574         {"SPOOLSS_ADDPRINTPROVIDOR", NDR_SPOOLSS_ADDPRINTPROVIDOR, api_spoolss_AddPrintProvidor},
8575         {"SPOOLSS_DELETEPRINTPROVIDOR", NDR_SPOOLSS_DELETEPRINTPROVIDOR, api_spoolss_DeletePrintProvidor},
8576         {"SPOOLSS_ENUMPRINTPROCDATATYPES", NDR_SPOOLSS_ENUMPRINTPROCDATATYPES, api_spoolss_EnumPrintProcDataTypes},
8577         {"SPOOLSS_RESETPRINTER", NDR_SPOOLSS_RESETPRINTER, api_spoolss_ResetPrinter},
8578         {"SPOOLSS_GETPRINTERDRIVER2", NDR_SPOOLSS_GETPRINTERDRIVER2, api_spoolss_GetPrinterDriver2},
8579         {"SPOOLSS_FINDFIRSTPRINTERCHANGENOTIFICATION", NDR_SPOOLSS_FINDFIRSTPRINTERCHANGENOTIFICATION, api_spoolss_FindFirstPrinterChangeNotification},
8580         {"SPOOLSS_FINDNEXTPRINTERCHANGENOTIFICATION", NDR_SPOOLSS_FINDNEXTPRINTERCHANGENOTIFICATION, api_spoolss_FindNextPrinterChangeNotification},
8581         {"SPOOLSS_FINDCLOSEPRINTERNOTIFY", NDR_SPOOLSS_FINDCLOSEPRINTERNOTIFY, api_spoolss_FindClosePrinterNotify},
8582         {"SPOOLSS_ROUTERFINDFIRSTPRINTERCHANGENOTIFICATIONOLD", NDR_SPOOLSS_ROUTERFINDFIRSTPRINTERCHANGENOTIFICATIONOLD, api_spoolss_RouterFindFirstPrinterChangeNotificationOld},
8583         {"SPOOLSS_REPLYOPENPRINTER", NDR_SPOOLSS_REPLYOPENPRINTER, api_spoolss_ReplyOpenPrinter},
8584         {"SPOOLSS_ROUTERREPLYPRINTER", NDR_SPOOLSS_ROUTERREPLYPRINTER, api_spoolss_RouterReplyPrinter},
8585         {"SPOOLSS_REPLYCLOSEPRINTER", NDR_SPOOLSS_REPLYCLOSEPRINTER, api_spoolss_ReplyClosePrinter},
8586         {"SPOOLSS_ADDPORTEX", NDR_SPOOLSS_ADDPORTEX, api_spoolss_AddPortEx},
8587         {"SPOOLSS_ROUTERFINDFIRSTPRINTERCHANGENOTIFICATION", NDR_SPOOLSS_ROUTERFINDFIRSTPRINTERCHANGENOTIFICATION, api_spoolss_RouterFindFirstPrinterChangeNotification},
8588         {"SPOOLSS_SPOOLERINIT", NDR_SPOOLSS_SPOOLERINIT, api_spoolss_SpoolerInit},
8589         {"SPOOLSS_RESETPRINTEREX", NDR_SPOOLSS_RESETPRINTEREX, api_spoolss_ResetPrinterEx},
8590         {"SPOOLSS_REMOTEFINDFIRSTPRINTERCHANGENOTIFYEX", NDR_SPOOLSS_REMOTEFINDFIRSTPRINTERCHANGENOTIFYEX, api_spoolss_RemoteFindFirstPrinterChangeNotifyEx},
8591         {"SPOOLSS_ROUTERREPLYPRINTEREX", NDR_SPOOLSS_ROUTERREPLYPRINTEREX, api_spoolss_RouterReplyPrinterEx},
8592         {"SPOOLSS_ROUTERREFRESHPRINTERCHANGENOTIFY", NDR_SPOOLSS_ROUTERREFRESHPRINTERCHANGENOTIFY, api_spoolss_RouterRefreshPrinterChangeNotify},
8593         {"SPOOLSS_44", NDR_SPOOLSS_44, api_spoolss_44},
8594         {"SPOOLSS_OPENPRINTEREX", NDR_SPOOLSS_OPENPRINTEREX, api_spoolss_OpenPrinterEx},
8595         {"SPOOLSS_ADDPRINTEREX", NDR_SPOOLSS_ADDPRINTEREX, api_spoolss_AddPrinterEx},
8596         {"SPOOLSS_47", NDR_SPOOLSS_47, api_spoolss_47},
8597         {"SPOOLSS_ENUMPRINTERDATA", NDR_SPOOLSS_ENUMPRINTERDATA, api_spoolss_EnumPrinterData},
8598         {"SPOOLSS_DELETEPRINTERDATA", NDR_SPOOLSS_DELETEPRINTERDATA, api_spoolss_DeletePrinterData},
8599         {"SPOOLSS_4A", NDR_SPOOLSS_4A, api_spoolss_4a},
8600         {"SPOOLSS_4B", NDR_SPOOLSS_4B, api_spoolss_4b},
8601         {"SPOOLSS_4C", NDR_SPOOLSS_4C, api_spoolss_4c},
8602         {"SPOOLSS_SETPRINTERDATAEX", NDR_SPOOLSS_SETPRINTERDATAEX, api_spoolss_SetPrinterDataEx},
8603         {"SPOOLSS_GETPRINTERDATAEX", NDR_SPOOLSS_GETPRINTERDATAEX, api_spoolss_GetPrinterDataEx},
8604         {"SPOOLSS_ENUMPRINTERDATAEX", NDR_SPOOLSS_ENUMPRINTERDATAEX, api_spoolss_EnumPrinterDataEx},
8605         {"SPOOLSS_ENUMPRINTERKEY", NDR_SPOOLSS_ENUMPRINTERKEY, api_spoolss_EnumPrinterKey},
8606         {"SPOOLSS_DELETEPRINTERDATAEX", NDR_SPOOLSS_DELETEPRINTERDATAEX, api_spoolss_DeletePrinterDataEx},
8607         {"SPOOLSS_DELETEPRINTERKEY", NDR_SPOOLSS_DELETEPRINTERKEY, api_spoolss_DeletePrinterKey},
8608         {"SPOOLSS_53", NDR_SPOOLSS_53, api_spoolss_53},
8609         {"SPOOLSS_DELETEPRINTERDRIVEREX", NDR_SPOOLSS_DELETEPRINTERDRIVEREX, api_spoolss_DeletePrinterDriverEx},
8610         {"SPOOLSS_55", NDR_SPOOLSS_55, api_spoolss_55},
8611         {"SPOOLSS_56", NDR_SPOOLSS_56, api_spoolss_56},
8612         {"SPOOLSS_57", NDR_SPOOLSS_57, api_spoolss_57},
8613         {"SPOOLSS_XCVDATA", NDR_SPOOLSS_XCVDATA, api_spoolss_XcvData},
8614         {"SPOOLSS_ADDPRINTERDRIVEREX", NDR_SPOOLSS_ADDPRINTERDRIVEREX, api_spoolss_AddPrinterDriverEx},
8615         {"SPOOLSS_5A", NDR_SPOOLSS_5A, api_spoolss_5a},
8616         {"SPOOLSS_5B", NDR_SPOOLSS_5B, api_spoolss_5b},
8617         {"SPOOLSS_5C", NDR_SPOOLSS_5C, api_spoolss_5c},
8618         {"SPOOLSS_5D", NDR_SPOOLSS_5D, api_spoolss_5d},
8619         {"SPOOLSS_5E", NDR_SPOOLSS_5E, api_spoolss_5e},
8620         {"SPOOLSS_5F", NDR_SPOOLSS_5F, api_spoolss_5f},
8621         {"SPOOLSS_60", NDR_SPOOLSS_60, api_spoolss_60},
8622         {"SPOOLSS_61", NDR_SPOOLSS_61, api_spoolss_61},
8623         {"SPOOLSS_62", NDR_SPOOLSS_62, api_spoolss_62},
8624         {"SPOOLSS_63", NDR_SPOOLSS_63, api_spoolss_63},
8625         {"SPOOLSS_64", NDR_SPOOLSS_64, api_spoolss_64},
8626         {"SPOOLSS_65", NDR_SPOOLSS_65, api_spoolss_65},
8627         {"SPOOLSS_GETCOREPRINTERDRIVERS", NDR_SPOOLSS_GETCOREPRINTERDRIVERS, api_spoolss_GetCorePrinterDrivers},
8628         {"SPOOLSS_67", NDR_SPOOLSS_67, api_spoolss_67},
8629         {"SPOOLSS_GETPRINTERDRIVERPACKAGEPATH", NDR_SPOOLSS_GETPRINTERDRIVERPACKAGEPATH, api_spoolss_GetPrinterDriverPackagePath},
8630         {"SPOOLSS_69", NDR_SPOOLSS_69, api_spoolss_69},
8631         {"SPOOLSS_6A", NDR_SPOOLSS_6A, api_spoolss_6a},
8632         {"SPOOLSS_6B", NDR_SPOOLSS_6B, api_spoolss_6b},
8633         {"SPOOLSS_6C", NDR_SPOOLSS_6C, api_spoolss_6c},
8634         {"SPOOLSS_6D", NDR_SPOOLSS_6D, api_spoolss_6d},
8635 };
8636
8637 void spoolss_get_pipe_fns(struct api_struct **fns, int *n_fns)
8638 {
8639         *fns = api_spoolss_cmds;
8640         *n_fns = sizeof(api_spoolss_cmds) / sizeof(struct api_struct);
8641 }
8642
8643 NTSTATUS rpc_spoolss_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *_r)
8644 {
8645         if (cli->pipes_struct == NULL) {
8646                 return NT_STATUS_INVALID_PARAMETER;
8647         }
8648
8649         switch (opnum)
8650         {
8651                 case NDR_SPOOLSS_ENUMPRINTERS: {
8652                         struct spoolss_EnumPrinters *r = (struct spoolss_EnumPrinters *)_r;
8653                         ZERO_STRUCT(r->out);
8654                         r->out.count = talloc_zero(mem_ctx, uint32_t);
8655                         if (r->out.count == NULL) {
8656                         return NT_STATUS_NO_MEMORY;
8657                         }
8658
8659                         r->out.info = talloc_zero(mem_ctx, union spoolss_PrinterInfo *);
8660                         if (r->out.info == NULL) {
8661                         return NT_STATUS_NO_MEMORY;
8662                         }
8663
8664                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
8665                         if (r->out.needed == NULL) {
8666                         return NT_STATUS_NO_MEMORY;
8667                         }
8668
8669                         r->out.result = _spoolss_EnumPrinters(cli->pipes_struct, r);
8670                         return NT_STATUS_OK;
8671                 }
8672
8673                 case NDR_SPOOLSS_OPENPRINTER: {
8674                         struct spoolss_OpenPrinter *r = (struct spoolss_OpenPrinter *)_r;
8675                         ZERO_STRUCT(r->out);
8676                         r->out.handle = talloc_zero(mem_ctx, struct policy_handle);
8677                         if (r->out.handle == NULL) {
8678                         return NT_STATUS_NO_MEMORY;
8679                         }
8680
8681                         r->out.result = _spoolss_OpenPrinter(cli->pipes_struct, r);
8682                         return NT_STATUS_OK;
8683                 }
8684
8685                 case NDR_SPOOLSS_SETJOB: {
8686                         struct spoolss_SetJob *r = (struct spoolss_SetJob *)_r;
8687                         r->out.result = _spoolss_SetJob(cli->pipes_struct, r);
8688                         return NT_STATUS_OK;
8689                 }
8690
8691                 case NDR_SPOOLSS_GETJOB: {
8692                         struct spoolss_GetJob *r = (struct spoolss_GetJob *)_r;
8693                         ZERO_STRUCT(r->out);
8694                         r->out.info = talloc_zero(mem_ctx, union spoolss_JobInfo);
8695                         if (r->out.info == NULL) {
8696                         return NT_STATUS_NO_MEMORY;
8697                         }
8698
8699                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
8700                         if (r->out.needed == NULL) {
8701                         return NT_STATUS_NO_MEMORY;
8702                         }
8703
8704                         r->out.result = _spoolss_GetJob(cli->pipes_struct, r);
8705                         return NT_STATUS_OK;
8706                 }
8707
8708                 case NDR_SPOOLSS_ENUMJOBS: {
8709                         struct spoolss_EnumJobs *r = (struct spoolss_EnumJobs *)_r;
8710                         ZERO_STRUCT(r->out);
8711                         r->out.count = talloc_zero(mem_ctx, uint32_t);
8712                         if (r->out.count == NULL) {
8713                         return NT_STATUS_NO_MEMORY;
8714                         }
8715
8716                         r->out.info = talloc_zero(mem_ctx, union spoolss_JobInfo *);
8717                         if (r->out.info == NULL) {
8718                         return NT_STATUS_NO_MEMORY;
8719                         }
8720
8721                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
8722                         if (r->out.needed == NULL) {
8723                         return NT_STATUS_NO_MEMORY;
8724                         }
8725
8726                         r->out.result = _spoolss_EnumJobs(cli->pipes_struct, r);
8727                         return NT_STATUS_OK;
8728                 }
8729
8730                 case NDR_SPOOLSS_ADDPRINTER: {
8731                         struct spoolss_AddPrinter *r = (struct spoolss_AddPrinter *)_r;
8732                         ZERO_STRUCT(r->out);
8733                         r->out.handle = talloc_zero(mem_ctx, struct policy_handle);
8734                         if (r->out.handle == NULL) {
8735                         return NT_STATUS_NO_MEMORY;
8736                         }
8737
8738                         r->out.result = _spoolss_AddPrinter(cli->pipes_struct, r);
8739                         return NT_STATUS_OK;
8740                 }
8741
8742                 case NDR_SPOOLSS_DELETEPRINTER: {
8743                         struct spoolss_DeletePrinter *r = (struct spoolss_DeletePrinter *)_r;
8744                         r->out.result = _spoolss_DeletePrinter(cli->pipes_struct, r);
8745                         return NT_STATUS_OK;
8746                 }
8747
8748                 case NDR_SPOOLSS_SETPRINTER: {
8749                         struct spoolss_SetPrinter *r = (struct spoolss_SetPrinter *)_r;
8750                         r->out.result = _spoolss_SetPrinter(cli->pipes_struct, r);
8751                         return NT_STATUS_OK;
8752                 }
8753
8754                 case NDR_SPOOLSS_GETPRINTER: {
8755                         struct spoolss_GetPrinter *r = (struct spoolss_GetPrinter *)_r;
8756                         ZERO_STRUCT(r->out);
8757                         r->out.info = talloc_zero(mem_ctx, union spoolss_PrinterInfo);
8758                         if (r->out.info == NULL) {
8759                         return NT_STATUS_NO_MEMORY;
8760                         }
8761
8762                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
8763                         if (r->out.needed == NULL) {
8764                         return NT_STATUS_NO_MEMORY;
8765                         }
8766
8767                         r->out.result = _spoolss_GetPrinter(cli->pipes_struct, r);
8768                         return NT_STATUS_OK;
8769                 }
8770
8771                 case NDR_SPOOLSS_ADDPRINTERDRIVER: {
8772                         struct spoolss_AddPrinterDriver *r = (struct spoolss_AddPrinterDriver *)_r;
8773                         r->out.result = _spoolss_AddPrinterDriver(cli->pipes_struct, r);
8774                         return NT_STATUS_OK;
8775                 }
8776
8777                 case NDR_SPOOLSS_ENUMPRINTERDRIVERS: {
8778                         struct spoolss_EnumPrinterDrivers *r = (struct spoolss_EnumPrinterDrivers *)_r;
8779                         ZERO_STRUCT(r->out);
8780                         r->out.count = talloc_zero(mem_ctx, uint32_t);
8781                         if (r->out.count == NULL) {
8782                         return NT_STATUS_NO_MEMORY;
8783                         }
8784
8785                         r->out.info = talloc_zero(mem_ctx, union spoolss_DriverInfo *);
8786                         if (r->out.info == NULL) {
8787                         return NT_STATUS_NO_MEMORY;
8788                         }
8789
8790                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
8791                         if (r->out.needed == NULL) {
8792                         return NT_STATUS_NO_MEMORY;
8793                         }
8794
8795                         r->out.result = _spoolss_EnumPrinterDrivers(cli->pipes_struct, r);
8796                         return NT_STATUS_OK;
8797                 }
8798
8799                 case NDR_SPOOLSS_GETPRINTERDRIVER: {
8800                         struct spoolss_GetPrinterDriver *r = (struct spoolss_GetPrinterDriver *)_r;
8801                         ZERO_STRUCT(r->out);
8802                         r->out.info = talloc_zero(mem_ctx, union spoolss_DriverInfo);
8803                         if (r->out.info == NULL) {
8804                         return NT_STATUS_NO_MEMORY;
8805                         }
8806
8807                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
8808                         if (r->out.needed == NULL) {
8809                         return NT_STATUS_NO_MEMORY;
8810                         }
8811
8812                         r->out.result = _spoolss_GetPrinterDriver(cli->pipes_struct, r);
8813                         return NT_STATUS_OK;
8814                 }
8815
8816                 case NDR_SPOOLSS_GETPRINTERDRIVERDIRECTORY: {
8817                         struct spoolss_GetPrinterDriverDirectory *r = (struct spoolss_GetPrinterDriverDirectory *)_r;
8818                         ZERO_STRUCT(r->out);
8819                         r->out.info = talloc_zero(mem_ctx, union spoolss_DriverDirectoryInfo);
8820                         if (r->out.info == NULL) {
8821                         return NT_STATUS_NO_MEMORY;
8822                         }
8823
8824                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
8825                         if (r->out.needed == NULL) {
8826                         return NT_STATUS_NO_MEMORY;
8827                         }
8828
8829                         r->out.result = _spoolss_GetPrinterDriverDirectory(cli->pipes_struct, r);
8830                         return NT_STATUS_OK;
8831                 }
8832
8833                 case NDR_SPOOLSS_DELETEPRINTERDRIVER: {
8834                         struct spoolss_DeletePrinterDriver *r = (struct spoolss_DeletePrinterDriver *)_r;
8835                         r->out.result = _spoolss_DeletePrinterDriver(cli->pipes_struct, r);
8836                         return NT_STATUS_OK;
8837                 }
8838
8839                 case NDR_SPOOLSS_ADDPRINTPROCESSOR: {
8840                         struct spoolss_AddPrintProcessor *r = (struct spoolss_AddPrintProcessor *)_r;
8841                         r->out.result = _spoolss_AddPrintProcessor(cli->pipes_struct, r);
8842                         return NT_STATUS_OK;
8843                 }
8844
8845                 case NDR_SPOOLSS_ENUMPRINTPROCESSORS: {
8846                         struct spoolss_EnumPrintProcessors *r = (struct spoolss_EnumPrintProcessors *)_r;
8847                         ZERO_STRUCT(r->out);
8848                         r->out.count = talloc_zero(mem_ctx, uint32_t);
8849                         if (r->out.count == NULL) {
8850                         return NT_STATUS_NO_MEMORY;
8851                         }
8852
8853                         r->out.info = talloc_zero(mem_ctx, union spoolss_PrintProcessorInfo *);
8854                         if (r->out.info == NULL) {
8855                         return NT_STATUS_NO_MEMORY;
8856                         }
8857
8858                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
8859                         if (r->out.needed == NULL) {
8860                         return NT_STATUS_NO_MEMORY;
8861                         }
8862
8863                         r->out.result = _spoolss_EnumPrintProcessors(cli->pipes_struct, r);
8864                         return NT_STATUS_OK;
8865                 }
8866
8867                 case NDR_SPOOLSS_GETPRINTPROCESSORDIRECTORY: {
8868                         struct spoolss_GetPrintProcessorDirectory *r = (struct spoolss_GetPrintProcessorDirectory *)_r;
8869                         ZERO_STRUCT(r->out);
8870                         r->out.info = talloc_zero(mem_ctx, union spoolss_PrintProcessorDirectoryInfo);
8871                         if (r->out.info == NULL) {
8872                         return NT_STATUS_NO_MEMORY;
8873                         }
8874
8875                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
8876                         if (r->out.needed == NULL) {
8877                         return NT_STATUS_NO_MEMORY;
8878                         }
8879
8880                         r->out.result = _spoolss_GetPrintProcessorDirectory(cli->pipes_struct, r);
8881                         return NT_STATUS_OK;
8882                 }
8883
8884                 case NDR_SPOOLSS_STARTDOCPRINTER: {
8885                         struct spoolss_StartDocPrinter *r = (struct spoolss_StartDocPrinter *)_r;
8886                         ZERO_STRUCT(r->out);
8887                         r->out.job_id = talloc_zero(mem_ctx, uint32_t);
8888                         if (r->out.job_id == NULL) {
8889                         return NT_STATUS_NO_MEMORY;
8890                         }
8891
8892                         r->out.result = _spoolss_StartDocPrinter(cli->pipes_struct, r);
8893                         return NT_STATUS_OK;
8894                 }
8895
8896                 case NDR_SPOOLSS_STARTPAGEPRINTER: {
8897                         struct spoolss_StartPagePrinter *r = (struct spoolss_StartPagePrinter *)_r;
8898                         r->out.result = _spoolss_StartPagePrinter(cli->pipes_struct, r);
8899                         return NT_STATUS_OK;
8900                 }
8901
8902                 case NDR_SPOOLSS_WRITEPRINTER: {
8903                         struct spoolss_WritePrinter *r = (struct spoolss_WritePrinter *)_r;
8904                         ZERO_STRUCT(r->out);
8905                         r->out.num_written = talloc_zero(mem_ctx, uint32_t);
8906                         if (r->out.num_written == NULL) {
8907                         return NT_STATUS_NO_MEMORY;
8908                         }
8909
8910                         r->out.result = _spoolss_WritePrinter(cli->pipes_struct, r);
8911                         return NT_STATUS_OK;
8912                 }
8913
8914                 case NDR_SPOOLSS_ENDPAGEPRINTER: {
8915                         struct spoolss_EndPagePrinter *r = (struct spoolss_EndPagePrinter *)_r;
8916                         r->out.result = _spoolss_EndPagePrinter(cli->pipes_struct, r);
8917                         return NT_STATUS_OK;
8918                 }
8919
8920                 case NDR_SPOOLSS_ABORTPRINTER: {
8921                         struct spoolss_AbortPrinter *r = (struct spoolss_AbortPrinter *)_r;
8922                         r->out.result = _spoolss_AbortPrinter(cli->pipes_struct, r);
8923                         return NT_STATUS_OK;
8924                 }
8925
8926                 case NDR_SPOOLSS_READPRINTER: {
8927                         struct spoolss_ReadPrinter *r = (struct spoolss_ReadPrinter *)_r;
8928                         ZERO_STRUCT(r->out);
8929                         r->out.data = talloc_zero_array(mem_ctx, uint8_t, r->in.data_size);
8930                         if (r->out.data == NULL) {
8931                         return NT_STATUS_NO_MEMORY;
8932                         }
8933
8934                         r->out._data_size = talloc_zero(mem_ctx, uint32_t);
8935                         if (r->out._data_size == NULL) {
8936                         return NT_STATUS_NO_MEMORY;
8937                         }
8938
8939                         r->out.result = _spoolss_ReadPrinter(cli->pipes_struct, r);
8940                         return NT_STATUS_OK;
8941                 }
8942
8943                 case NDR_SPOOLSS_ENDDOCPRINTER: {
8944                         struct spoolss_EndDocPrinter *r = (struct spoolss_EndDocPrinter *)_r;
8945                         r->out.result = _spoolss_EndDocPrinter(cli->pipes_struct, r);
8946                         return NT_STATUS_OK;
8947                 }
8948
8949                 case NDR_SPOOLSS_ADDJOB: {
8950                         struct spoolss_AddJob *r = (struct spoolss_AddJob *)_r;
8951                         ZERO_STRUCT(r->out);
8952                         r->out.buffer = r->in.buffer;
8953                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
8954                         if (r->out.needed == NULL) {
8955                         return NT_STATUS_NO_MEMORY;
8956                         }
8957
8958                         r->out.result = _spoolss_AddJob(cli->pipes_struct, r);
8959                         return NT_STATUS_OK;
8960                 }
8961
8962                 case NDR_SPOOLSS_SCHEDULEJOB: {
8963                         struct spoolss_ScheduleJob *r = (struct spoolss_ScheduleJob *)_r;
8964                         r->out.result = _spoolss_ScheduleJob(cli->pipes_struct, r);
8965                         return NT_STATUS_OK;
8966                 }
8967
8968                 case NDR_SPOOLSS_GETPRINTERDATA: {
8969                         struct spoolss_GetPrinterData *r = (struct spoolss_GetPrinterData *)_r;
8970                         ZERO_STRUCT(r->out);
8971                         r->out.type = talloc_zero(mem_ctx, enum winreg_Type);
8972                         if (r->out.type == NULL) {
8973                         return NT_STATUS_NO_MEMORY;
8974                         }
8975
8976                         r->out.data = talloc_zero(mem_ctx, union spoolss_PrinterData);
8977                         if (r->out.data == NULL) {
8978                         return NT_STATUS_NO_MEMORY;
8979                         }
8980
8981                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
8982                         if (r->out.needed == NULL) {
8983                         return NT_STATUS_NO_MEMORY;
8984                         }
8985
8986                         r->out.result = _spoolss_GetPrinterData(cli->pipes_struct, r);
8987                         return NT_STATUS_OK;
8988                 }
8989
8990                 case NDR_SPOOLSS_SETPRINTERDATA: {
8991                         struct spoolss_SetPrinterData *r = (struct spoolss_SetPrinterData *)_r;
8992                         r->out.result = _spoolss_SetPrinterData(cli->pipes_struct, r);
8993                         return NT_STATUS_OK;
8994                 }
8995
8996                 case NDR_SPOOLSS_WAITFORPRINTERCHANGE: {
8997                         struct spoolss_WaitForPrinterChange *r = (struct spoolss_WaitForPrinterChange *)_r;
8998                         r->out.result = _spoolss_WaitForPrinterChange(cli->pipes_struct, r);
8999                         return NT_STATUS_OK;
9000                 }
9001
9002                 case NDR_SPOOLSS_CLOSEPRINTER: {
9003                         struct spoolss_ClosePrinter *r = (struct spoolss_ClosePrinter *)_r;
9004                         ZERO_STRUCT(r->out);
9005                         r->out.handle = r->in.handle;
9006                         r->out.result = _spoolss_ClosePrinter(cli->pipes_struct, r);
9007                         return NT_STATUS_OK;
9008                 }
9009
9010                 case NDR_SPOOLSS_ADDFORM: {
9011                         struct spoolss_AddForm *r = (struct spoolss_AddForm *)_r;
9012                         r->out.result = _spoolss_AddForm(cli->pipes_struct, r);
9013                         return NT_STATUS_OK;
9014                 }
9015
9016                 case NDR_SPOOLSS_DELETEFORM: {
9017                         struct spoolss_DeleteForm *r = (struct spoolss_DeleteForm *)_r;
9018                         r->out.result = _spoolss_DeleteForm(cli->pipes_struct, r);
9019                         return NT_STATUS_OK;
9020                 }
9021
9022                 case NDR_SPOOLSS_GETFORM: {
9023                         struct spoolss_GetForm *r = (struct spoolss_GetForm *)_r;
9024                         ZERO_STRUCT(r->out);
9025                         r->out.info = talloc_zero(mem_ctx, union spoolss_FormInfo);
9026                         if (r->out.info == NULL) {
9027                         return NT_STATUS_NO_MEMORY;
9028                         }
9029
9030                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
9031                         if (r->out.needed == NULL) {
9032                         return NT_STATUS_NO_MEMORY;
9033                         }
9034
9035                         r->out.result = _spoolss_GetForm(cli->pipes_struct, r);
9036                         return NT_STATUS_OK;
9037                 }
9038
9039                 case NDR_SPOOLSS_SETFORM: {
9040                         struct spoolss_SetForm *r = (struct spoolss_SetForm *)_r;
9041                         r->out.result = _spoolss_SetForm(cli->pipes_struct, r);
9042                         return NT_STATUS_OK;
9043                 }
9044
9045                 case NDR_SPOOLSS_ENUMFORMS: {
9046                         struct spoolss_EnumForms *r = (struct spoolss_EnumForms *)_r;
9047                         ZERO_STRUCT(r->out);
9048                         r->out.count = talloc_zero(mem_ctx, uint32_t);
9049                         if (r->out.count == NULL) {
9050                         return NT_STATUS_NO_MEMORY;
9051                         }
9052
9053                         r->out.info = talloc_zero(mem_ctx, union spoolss_FormInfo *);
9054                         if (r->out.info == NULL) {
9055                         return NT_STATUS_NO_MEMORY;
9056                         }
9057
9058                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
9059                         if (r->out.needed == NULL) {
9060                         return NT_STATUS_NO_MEMORY;
9061                         }
9062
9063                         r->out.result = _spoolss_EnumForms(cli->pipes_struct, r);
9064                         return NT_STATUS_OK;
9065                 }
9066
9067                 case NDR_SPOOLSS_ENUMPORTS: {
9068                         struct spoolss_EnumPorts *r = (struct spoolss_EnumPorts *)_r;
9069                         ZERO_STRUCT(r->out);
9070                         r->out.count = talloc_zero(mem_ctx, uint32_t);
9071                         if (r->out.count == NULL) {
9072                         return NT_STATUS_NO_MEMORY;
9073                         }
9074
9075                         r->out.info = talloc_zero(mem_ctx, union spoolss_PortInfo *);
9076                         if (r->out.info == NULL) {
9077                         return NT_STATUS_NO_MEMORY;
9078                         }
9079
9080                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
9081                         if (r->out.needed == NULL) {
9082                         return NT_STATUS_NO_MEMORY;
9083                         }
9084
9085                         r->out.result = _spoolss_EnumPorts(cli->pipes_struct, r);
9086                         return NT_STATUS_OK;
9087                 }
9088
9089                 case NDR_SPOOLSS_ENUMMONITORS: {
9090                         struct spoolss_EnumMonitors *r = (struct spoolss_EnumMonitors *)_r;
9091                         ZERO_STRUCT(r->out);
9092                         r->out.count = talloc_zero(mem_ctx, uint32_t);
9093                         if (r->out.count == NULL) {
9094                         return NT_STATUS_NO_MEMORY;
9095                         }
9096
9097                         r->out.info = talloc_zero(mem_ctx, union spoolss_MonitorInfo *);
9098                         if (r->out.info == NULL) {
9099                         return NT_STATUS_NO_MEMORY;
9100                         }
9101
9102                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
9103                         if (r->out.needed == NULL) {
9104                         return NT_STATUS_NO_MEMORY;
9105                         }
9106
9107                         r->out.result = _spoolss_EnumMonitors(cli->pipes_struct, r);
9108                         return NT_STATUS_OK;
9109                 }
9110
9111                 case NDR_SPOOLSS_ADDPORT: {
9112                         struct spoolss_AddPort *r = (struct spoolss_AddPort *)_r;
9113                         r->out.result = _spoolss_AddPort(cli->pipes_struct, r);
9114                         return NT_STATUS_OK;
9115                 }
9116
9117                 case NDR_SPOOLSS_CONFIGUREPORT: {
9118                         struct spoolss_ConfigurePort *r = (struct spoolss_ConfigurePort *)_r;
9119                         r->out.result = _spoolss_ConfigurePort(cli->pipes_struct, r);
9120                         return NT_STATUS_OK;
9121                 }
9122
9123                 case NDR_SPOOLSS_DELETEPORT: {
9124                         struct spoolss_DeletePort *r = (struct spoolss_DeletePort *)_r;
9125                         r->out.result = _spoolss_DeletePort(cli->pipes_struct, r);
9126                         return NT_STATUS_OK;
9127                 }
9128
9129                 case NDR_SPOOLSS_CREATEPRINTERIC: {
9130                         struct spoolss_CreatePrinterIC *r = (struct spoolss_CreatePrinterIC *)_r;
9131                         ZERO_STRUCT(r->out);
9132                         r->out.gdi_handle = talloc_zero(mem_ctx, struct policy_handle);
9133                         if (r->out.gdi_handle == NULL) {
9134                         return NT_STATUS_NO_MEMORY;
9135                         }
9136
9137                         r->out.result = _spoolss_CreatePrinterIC(cli->pipes_struct, r);
9138                         return NT_STATUS_OK;
9139                 }
9140
9141                 case NDR_SPOOLSS_PLAYGDISCRIPTONPRINTERIC: {
9142                         struct spoolss_PlayGDIScriptOnPrinterIC *r = (struct spoolss_PlayGDIScriptOnPrinterIC *)_r;
9143                         r->out.result = _spoolss_PlayGDIScriptOnPrinterIC(cli->pipes_struct, r);
9144                         return NT_STATUS_OK;
9145                 }
9146
9147                 case NDR_SPOOLSS_DELETEPRINTERIC: {
9148                         struct spoolss_DeletePrinterIC *r = (struct spoolss_DeletePrinterIC *)_r;
9149                         ZERO_STRUCT(r->out);
9150                         r->out.gdi_handle = r->in.gdi_handle;
9151                         r->out.result = _spoolss_DeletePrinterIC(cli->pipes_struct, r);
9152                         return NT_STATUS_OK;
9153                 }
9154
9155                 case NDR_SPOOLSS_ADDPRINTERCONNECTION: {
9156                         struct spoolss_AddPrinterConnection *r = (struct spoolss_AddPrinterConnection *)_r;
9157                         r->out.result = _spoolss_AddPrinterConnection(cli->pipes_struct, r);
9158                         return NT_STATUS_OK;
9159                 }
9160
9161                 case NDR_SPOOLSS_DELETEPRINTERCONNECTION: {
9162                         struct spoolss_DeletePrinterConnection *r = (struct spoolss_DeletePrinterConnection *)_r;
9163                         r->out.result = _spoolss_DeletePrinterConnection(cli->pipes_struct, r);
9164                         return NT_STATUS_OK;
9165                 }
9166
9167                 case NDR_SPOOLSS_PRINTERMESSAGEBOX: {
9168                         struct spoolss_PrinterMessageBox *r = (struct spoolss_PrinterMessageBox *)_r;
9169                         r->out.result = _spoolss_PrinterMessageBox(cli->pipes_struct, r);
9170                         return NT_STATUS_OK;
9171                 }
9172
9173                 case NDR_SPOOLSS_ADDMONITOR: {
9174                         struct spoolss_AddMonitor *r = (struct spoolss_AddMonitor *)_r;
9175                         r->out.result = _spoolss_AddMonitor(cli->pipes_struct, r);
9176                         return NT_STATUS_OK;
9177                 }
9178
9179                 case NDR_SPOOLSS_DELETEMONITOR: {
9180                         struct spoolss_DeleteMonitor *r = (struct spoolss_DeleteMonitor *)_r;
9181                         r->out.result = _spoolss_DeleteMonitor(cli->pipes_struct, r);
9182                         return NT_STATUS_OK;
9183                 }
9184
9185                 case NDR_SPOOLSS_DELETEPRINTPROCESSOR: {
9186                         struct spoolss_DeletePrintProcessor *r = (struct spoolss_DeletePrintProcessor *)_r;
9187                         r->out.result = _spoolss_DeletePrintProcessor(cli->pipes_struct, r);
9188                         return NT_STATUS_OK;
9189                 }
9190
9191                 case NDR_SPOOLSS_ADDPRINTPROVIDOR: {
9192                         struct spoolss_AddPrintProvidor *r = (struct spoolss_AddPrintProvidor *)_r;
9193                         r->out.result = _spoolss_AddPrintProvidor(cli->pipes_struct, r);
9194                         return NT_STATUS_OK;
9195                 }
9196
9197                 case NDR_SPOOLSS_DELETEPRINTPROVIDOR: {
9198                         struct spoolss_DeletePrintProvidor *r = (struct spoolss_DeletePrintProvidor *)_r;
9199                         r->out.result = _spoolss_DeletePrintProvidor(cli->pipes_struct, r);
9200                         return NT_STATUS_OK;
9201                 }
9202
9203                 case NDR_SPOOLSS_ENUMPRINTPROCDATATYPES: {
9204                         struct spoolss_EnumPrintProcDataTypes *r = (struct spoolss_EnumPrintProcDataTypes *)_r;
9205                         ZERO_STRUCT(r->out);
9206                         r->out.count = talloc_zero(mem_ctx, uint32_t);
9207                         if (r->out.count == NULL) {
9208                         return NT_STATUS_NO_MEMORY;
9209                         }
9210
9211                         r->out.info = talloc_zero(mem_ctx, union spoolss_PrintProcDataTypesInfo *);
9212                         if (r->out.info == NULL) {
9213                         return NT_STATUS_NO_MEMORY;
9214                         }
9215
9216                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
9217                         if (r->out.needed == NULL) {
9218                         return NT_STATUS_NO_MEMORY;
9219                         }
9220
9221                         r->out.result = _spoolss_EnumPrintProcDataTypes(cli->pipes_struct, r);
9222                         return NT_STATUS_OK;
9223                 }
9224
9225                 case NDR_SPOOLSS_RESETPRINTER: {
9226                         struct spoolss_ResetPrinter *r = (struct spoolss_ResetPrinter *)_r;
9227                         r->out.result = _spoolss_ResetPrinter(cli->pipes_struct, r);
9228                         return NT_STATUS_OK;
9229                 }
9230
9231                 case NDR_SPOOLSS_GETPRINTERDRIVER2: {
9232                         struct spoolss_GetPrinterDriver2 *r = (struct spoolss_GetPrinterDriver2 *)_r;
9233                         ZERO_STRUCT(r->out);
9234                         r->out.info = talloc_zero(mem_ctx, union spoolss_DriverInfo);
9235                         if (r->out.info == NULL) {
9236                         return NT_STATUS_NO_MEMORY;
9237                         }
9238
9239                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
9240                         if (r->out.needed == NULL) {
9241                         return NT_STATUS_NO_MEMORY;
9242                         }
9243
9244                         r->out.server_major_version = talloc_zero(mem_ctx, uint32_t);
9245                         if (r->out.server_major_version == NULL) {
9246                         return NT_STATUS_NO_MEMORY;
9247                         }
9248
9249                         r->out.server_minor_version = talloc_zero(mem_ctx, uint32_t);
9250                         if (r->out.server_minor_version == NULL) {
9251                         return NT_STATUS_NO_MEMORY;
9252                         }
9253
9254                         r->out.result = _spoolss_GetPrinterDriver2(cli->pipes_struct, r);
9255                         return NT_STATUS_OK;
9256                 }
9257
9258                 case NDR_SPOOLSS_FINDFIRSTPRINTERCHANGENOTIFICATION: {
9259                         struct spoolss_FindFirstPrinterChangeNotification *r = (struct spoolss_FindFirstPrinterChangeNotification *)_r;
9260                         r->out.result = _spoolss_FindFirstPrinterChangeNotification(cli->pipes_struct, r);
9261                         return NT_STATUS_OK;
9262                 }
9263
9264                 case NDR_SPOOLSS_FINDNEXTPRINTERCHANGENOTIFICATION: {
9265                         struct spoolss_FindNextPrinterChangeNotification *r = (struct spoolss_FindNextPrinterChangeNotification *)_r;
9266                         r->out.result = _spoolss_FindNextPrinterChangeNotification(cli->pipes_struct, r);
9267                         return NT_STATUS_OK;
9268                 }
9269
9270                 case NDR_SPOOLSS_FINDCLOSEPRINTERNOTIFY: {
9271                         struct spoolss_FindClosePrinterNotify *r = (struct spoolss_FindClosePrinterNotify *)_r;
9272                         r->out.result = _spoolss_FindClosePrinterNotify(cli->pipes_struct, r);
9273                         return NT_STATUS_OK;
9274                 }
9275
9276                 case NDR_SPOOLSS_ROUTERFINDFIRSTPRINTERCHANGENOTIFICATIONOLD: {
9277                         struct spoolss_RouterFindFirstPrinterChangeNotificationOld *r = (struct spoolss_RouterFindFirstPrinterChangeNotificationOld *)_r;
9278                         r->out.result = _spoolss_RouterFindFirstPrinterChangeNotificationOld(cli->pipes_struct, r);
9279                         return NT_STATUS_OK;
9280                 }
9281
9282                 case NDR_SPOOLSS_REPLYOPENPRINTER: {
9283                         struct spoolss_ReplyOpenPrinter *r = (struct spoolss_ReplyOpenPrinter *)_r;
9284                         ZERO_STRUCT(r->out);
9285                         r->out.handle = talloc_zero(mem_ctx, struct policy_handle);
9286                         if (r->out.handle == NULL) {
9287                         return NT_STATUS_NO_MEMORY;
9288                         }
9289
9290                         r->out.result = _spoolss_ReplyOpenPrinter(cli->pipes_struct, r);
9291                         return NT_STATUS_OK;
9292                 }
9293
9294                 case NDR_SPOOLSS_ROUTERREPLYPRINTER: {
9295                         struct spoolss_RouterReplyPrinter *r = (struct spoolss_RouterReplyPrinter *)_r;
9296                         r->out.result = _spoolss_RouterReplyPrinter(cli->pipes_struct, r);
9297                         return NT_STATUS_OK;
9298                 }
9299
9300                 case NDR_SPOOLSS_REPLYCLOSEPRINTER: {
9301                         struct spoolss_ReplyClosePrinter *r = (struct spoolss_ReplyClosePrinter *)_r;
9302                         ZERO_STRUCT(r->out);
9303                         r->out.handle = r->in.handle;
9304                         r->out.result = _spoolss_ReplyClosePrinter(cli->pipes_struct, r);
9305                         return NT_STATUS_OK;
9306                 }
9307
9308                 case NDR_SPOOLSS_ADDPORTEX: {
9309                         struct spoolss_AddPortEx *r = (struct spoolss_AddPortEx *)_r;
9310                         r->out.result = _spoolss_AddPortEx(cli->pipes_struct, r);
9311                         return NT_STATUS_OK;
9312                 }
9313
9314                 case NDR_SPOOLSS_ROUTERFINDFIRSTPRINTERCHANGENOTIFICATION: {
9315                         struct spoolss_RouterFindFirstPrinterChangeNotification *r = (struct spoolss_RouterFindFirstPrinterChangeNotification *)_r;
9316                         r->out.result = _spoolss_RouterFindFirstPrinterChangeNotification(cli->pipes_struct, r);
9317                         return NT_STATUS_OK;
9318                 }
9319
9320                 case NDR_SPOOLSS_SPOOLERINIT: {
9321                         struct spoolss_SpoolerInit *r = (struct spoolss_SpoolerInit *)_r;
9322                         r->out.result = _spoolss_SpoolerInit(cli->pipes_struct, r);
9323                         return NT_STATUS_OK;
9324                 }
9325
9326                 case NDR_SPOOLSS_RESETPRINTEREX: {
9327                         struct spoolss_ResetPrinterEx *r = (struct spoolss_ResetPrinterEx *)_r;
9328                         r->out.result = _spoolss_ResetPrinterEx(cli->pipes_struct, r);
9329                         return NT_STATUS_OK;
9330                 }
9331
9332                 case NDR_SPOOLSS_REMOTEFINDFIRSTPRINTERCHANGENOTIFYEX: {
9333                         struct spoolss_RemoteFindFirstPrinterChangeNotifyEx *r = (struct spoolss_RemoteFindFirstPrinterChangeNotifyEx *)_r;
9334                         r->out.result = _spoolss_RemoteFindFirstPrinterChangeNotifyEx(cli->pipes_struct, r);
9335                         return NT_STATUS_OK;
9336                 }
9337
9338                 case NDR_SPOOLSS_ROUTERREPLYPRINTEREX: {
9339                         struct spoolss_RouterReplyPrinterEx *r = (struct spoolss_RouterReplyPrinterEx *)_r;
9340                         ZERO_STRUCT(r->out);
9341                         r->out.reply_result = talloc_zero(mem_ctx, uint32_t);
9342                         if (r->out.reply_result == NULL) {
9343                         return NT_STATUS_NO_MEMORY;
9344                         }
9345
9346                         r->out.result = _spoolss_RouterReplyPrinterEx(cli->pipes_struct, r);
9347                         return NT_STATUS_OK;
9348                 }
9349
9350                 case NDR_SPOOLSS_ROUTERREFRESHPRINTERCHANGENOTIFY: {
9351                         struct spoolss_RouterRefreshPrinterChangeNotify *r = (struct spoolss_RouterRefreshPrinterChangeNotify *)_r;
9352                         ZERO_STRUCT(r->out);
9353                         r->out.info = talloc_zero(mem_ctx, struct spoolss_NotifyInfo *);
9354                         if (r->out.info == NULL) {
9355                         return NT_STATUS_NO_MEMORY;
9356                         }
9357
9358                         r->out.result = _spoolss_RouterRefreshPrinterChangeNotify(cli->pipes_struct, r);
9359                         return NT_STATUS_OK;
9360                 }
9361
9362                 case NDR_SPOOLSS_44: {
9363                         struct spoolss_44 *r = (struct spoolss_44 *)_r;
9364                         r->out.result = _spoolss_44(cli->pipes_struct, r);
9365                         return NT_STATUS_OK;
9366                 }
9367
9368                 case NDR_SPOOLSS_OPENPRINTEREX: {
9369                         struct spoolss_OpenPrinterEx *r = (struct spoolss_OpenPrinterEx *)_r;
9370                         ZERO_STRUCT(r->out);
9371                         r->out.handle = talloc_zero(mem_ctx, struct policy_handle);
9372                         if (r->out.handle == NULL) {
9373                         return NT_STATUS_NO_MEMORY;
9374                         }
9375
9376                         r->out.result = _spoolss_OpenPrinterEx(cli->pipes_struct, r);
9377                         return NT_STATUS_OK;
9378                 }
9379
9380                 case NDR_SPOOLSS_ADDPRINTEREX: {
9381                         struct spoolss_AddPrinterEx *r = (struct spoolss_AddPrinterEx *)_r;
9382                         ZERO_STRUCT(r->out);
9383                         r->out.handle = talloc_zero(mem_ctx, struct policy_handle);
9384                         if (r->out.handle == NULL) {
9385                         return NT_STATUS_NO_MEMORY;
9386                         }
9387
9388                         r->out.result = _spoolss_AddPrinterEx(cli->pipes_struct, r);
9389                         return NT_STATUS_OK;
9390                 }
9391
9392                 case NDR_SPOOLSS_47: {
9393                         struct spoolss_47 *r = (struct spoolss_47 *)_r;
9394                         r->out.result = _spoolss_47(cli->pipes_struct, r);
9395                         return NT_STATUS_OK;
9396                 }
9397
9398                 case NDR_SPOOLSS_ENUMPRINTERDATA: {
9399                         struct spoolss_EnumPrinterData *r = (struct spoolss_EnumPrinterData *)_r;
9400                         ZERO_STRUCT(r->out);
9401                         r->out.value_name = talloc_zero_array(mem_ctx, const char, r->in.value_offered / 2);
9402                         if (r->out.value_name == NULL) {
9403                         return NT_STATUS_NO_MEMORY;
9404                         }
9405
9406                         r->out.value_needed = talloc_zero(mem_ctx, uint32_t);
9407                         if (r->out.value_needed == NULL) {
9408                         return NT_STATUS_NO_MEMORY;
9409                         }
9410
9411                         r->out.type = talloc_zero(mem_ctx, enum winreg_Type);
9412                         if (r->out.type == NULL) {
9413                         return NT_STATUS_NO_MEMORY;
9414                         }
9415
9416                         r->out.data = talloc_zero_array(mem_ctx, uint8_t, r->in.data_offered);
9417                         if (r->out.data == NULL) {
9418                         return NT_STATUS_NO_MEMORY;
9419                         }
9420
9421                         r->out.data_needed = talloc_zero(mem_ctx, uint32_t);
9422                         if (r->out.data_needed == NULL) {
9423                         return NT_STATUS_NO_MEMORY;
9424                         }
9425
9426                         r->out.result = _spoolss_EnumPrinterData(cli->pipes_struct, r);
9427                         return NT_STATUS_OK;
9428                 }
9429
9430                 case NDR_SPOOLSS_DELETEPRINTERDATA: {
9431                         struct spoolss_DeletePrinterData *r = (struct spoolss_DeletePrinterData *)_r;
9432                         r->out.result = _spoolss_DeletePrinterData(cli->pipes_struct, r);
9433                         return NT_STATUS_OK;
9434                 }
9435
9436                 case NDR_SPOOLSS_4A: {
9437                         struct spoolss_4a *r = (struct spoolss_4a *)_r;
9438                         r->out.result = _spoolss_4a(cli->pipes_struct, r);
9439                         return NT_STATUS_OK;
9440                 }
9441
9442                 case NDR_SPOOLSS_4B: {
9443                         struct spoolss_4b *r = (struct spoolss_4b *)_r;
9444                         r->out.result = _spoolss_4b(cli->pipes_struct, r);
9445                         return NT_STATUS_OK;
9446                 }
9447
9448                 case NDR_SPOOLSS_4C: {
9449                         struct spoolss_4c *r = (struct spoolss_4c *)_r;
9450                         r->out.result = _spoolss_4c(cli->pipes_struct, r);
9451                         return NT_STATUS_OK;
9452                 }
9453
9454                 case NDR_SPOOLSS_SETPRINTERDATAEX: {
9455                         struct spoolss_SetPrinterDataEx *r = (struct spoolss_SetPrinterDataEx *)_r;
9456                         r->out.result = _spoolss_SetPrinterDataEx(cli->pipes_struct, r);
9457                         return NT_STATUS_OK;
9458                 }
9459
9460                 case NDR_SPOOLSS_GETPRINTERDATAEX: {
9461                         struct spoolss_GetPrinterDataEx *r = (struct spoolss_GetPrinterDataEx *)_r;
9462                         ZERO_STRUCT(r->out);
9463                         r->out.type = talloc_zero(mem_ctx, enum winreg_Type);
9464                         if (r->out.type == NULL) {
9465                         return NT_STATUS_NO_MEMORY;
9466                         }
9467
9468                         r->out.buffer = talloc_zero_array(mem_ctx, uint8_t, r->in.offered);
9469                         if (r->out.buffer == NULL) {
9470                         return NT_STATUS_NO_MEMORY;
9471                         }
9472
9473                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
9474                         if (r->out.needed == NULL) {
9475                         return NT_STATUS_NO_MEMORY;
9476                         }
9477
9478                         r->out.result = _spoolss_GetPrinterDataEx(cli->pipes_struct, r);
9479                         return NT_STATUS_OK;
9480                 }
9481
9482                 case NDR_SPOOLSS_ENUMPRINTERDATAEX: {
9483                         struct spoolss_EnumPrinterDataEx *r = (struct spoolss_EnumPrinterDataEx *)_r;
9484                         ZERO_STRUCT(r->out);
9485                         r->out.count = talloc_zero(mem_ctx, uint32_t);
9486                         if (r->out.count == NULL) {
9487                         return NT_STATUS_NO_MEMORY;
9488                         }
9489
9490                         r->out.info = talloc_zero(mem_ctx, struct spoolss_PrinterEnumValues *);
9491                         if (r->out.info == NULL) {
9492                         return NT_STATUS_NO_MEMORY;
9493                         }
9494
9495                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
9496                         if (r->out.needed == NULL) {
9497                         return NT_STATUS_NO_MEMORY;
9498                         }
9499
9500                         r->out.result = _spoolss_EnumPrinterDataEx(cli->pipes_struct, r);
9501                         return NT_STATUS_OK;
9502                 }
9503
9504                 case NDR_SPOOLSS_ENUMPRINTERKEY: {
9505                         struct spoolss_EnumPrinterKey *r = (struct spoolss_EnumPrinterKey *)_r;
9506                         ZERO_STRUCT(r->out);
9507                         r->out.key_buffer = talloc_zero(mem_ctx, const char **);
9508                         if (r->out.key_buffer == NULL) {
9509                         return NT_STATUS_NO_MEMORY;
9510                         }
9511
9512                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
9513                         if (r->out.needed == NULL) {
9514                         return NT_STATUS_NO_MEMORY;
9515                         }
9516
9517                         r->out.result = _spoolss_EnumPrinterKey(cli->pipes_struct, r);
9518                         return NT_STATUS_OK;
9519                 }
9520
9521                 case NDR_SPOOLSS_DELETEPRINTERDATAEX: {
9522                         struct spoolss_DeletePrinterDataEx *r = (struct spoolss_DeletePrinterDataEx *)_r;
9523                         r->out.result = _spoolss_DeletePrinterDataEx(cli->pipes_struct, r);
9524                         return NT_STATUS_OK;
9525                 }
9526
9527                 case NDR_SPOOLSS_DELETEPRINTERKEY: {
9528                         struct spoolss_DeletePrinterKey *r = (struct spoolss_DeletePrinterKey *)_r;
9529                         r->out.result = _spoolss_DeletePrinterKey(cli->pipes_struct, r);
9530                         return NT_STATUS_OK;
9531                 }
9532
9533                 case NDR_SPOOLSS_53: {
9534                         struct spoolss_53 *r = (struct spoolss_53 *)_r;
9535                         r->out.result = _spoolss_53(cli->pipes_struct, r);
9536                         return NT_STATUS_OK;
9537                 }
9538
9539                 case NDR_SPOOLSS_DELETEPRINTERDRIVEREX: {
9540                         struct spoolss_DeletePrinterDriverEx *r = (struct spoolss_DeletePrinterDriverEx *)_r;
9541                         r->out.result = _spoolss_DeletePrinterDriverEx(cli->pipes_struct, r);
9542                         return NT_STATUS_OK;
9543                 }
9544
9545                 case NDR_SPOOLSS_55: {
9546                         struct spoolss_55 *r = (struct spoolss_55 *)_r;
9547                         r->out.result = _spoolss_55(cli->pipes_struct, r);
9548                         return NT_STATUS_OK;
9549                 }
9550
9551                 case NDR_SPOOLSS_56: {
9552                         struct spoolss_56 *r = (struct spoolss_56 *)_r;
9553                         r->out.result = _spoolss_56(cli->pipes_struct, r);
9554                         return NT_STATUS_OK;
9555                 }
9556
9557                 case NDR_SPOOLSS_57: {
9558                         struct spoolss_57 *r = (struct spoolss_57 *)_r;
9559                         r->out.result = _spoolss_57(cli->pipes_struct, r);
9560                         return NT_STATUS_OK;
9561                 }
9562
9563                 case NDR_SPOOLSS_XCVDATA: {
9564                         struct spoolss_XcvData *r = (struct spoolss_XcvData *)_r;
9565                         ZERO_STRUCT(r->out);
9566                         r->out.status_code = r->in.status_code;
9567                         r->out.out_data = talloc_zero_array(mem_ctx, uint8_t, r->in.out_data_size);
9568                         if (r->out.out_data == NULL) {
9569                         return NT_STATUS_NO_MEMORY;
9570                         }
9571
9572                         r->out.needed = talloc_zero(mem_ctx, uint32_t);
9573                         if (r->out.needed == NULL) {
9574                         return NT_STATUS_NO_MEMORY;
9575                         }
9576
9577                         r->out.result = _spoolss_XcvData(cli->pipes_struct, r);
9578                         return NT_STATUS_OK;
9579                 }
9580
9581                 case NDR_SPOOLSS_ADDPRINTERDRIVEREX: {
9582                         struct spoolss_AddPrinterDriverEx *r = (struct spoolss_AddPrinterDriverEx *)_r;
9583                         r->out.result = _spoolss_AddPrinterDriverEx(cli->pipes_struct, r);
9584                         return NT_STATUS_OK;
9585                 }
9586
9587                 case NDR_SPOOLSS_5A: {
9588                         struct spoolss_5a *r = (struct spoolss_5a *)_r;
9589                         r->out.result = _spoolss_5a(cli->pipes_struct, r);
9590                         return NT_STATUS_OK;
9591                 }
9592
9593                 case NDR_SPOOLSS_5B: {
9594                         struct spoolss_5b *r = (struct spoolss_5b *)_r;
9595                         r->out.result = _spoolss_5b(cli->pipes_struct, r);
9596                         return NT_STATUS_OK;
9597                 }
9598
9599                 case NDR_SPOOLSS_5C: {
9600                         struct spoolss_5c *r = (struct spoolss_5c *)_r;
9601                         r->out.result = _spoolss_5c(cli->pipes_struct, r);
9602                         return NT_STATUS_OK;
9603                 }
9604
9605                 case NDR_SPOOLSS_5D: {
9606                         struct spoolss_5d *r = (struct spoolss_5d *)_r;
9607                         r->out.result = _spoolss_5d(cli->pipes_struct, r);
9608                         return NT_STATUS_OK;
9609                 }
9610
9611                 case NDR_SPOOLSS_5E: {
9612                         struct spoolss_5e *r = (struct spoolss_5e *)_r;
9613                         r->out.result = _spoolss_5e(cli->pipes_struct, r);
9614                         return NT_STATUS_OK;
9615                 }
9616
9617                 case NDR_SPOOLSS_5F: {
9618                         struct spoolss_5f *r = (struct spoolss_5f *)_r;
9619                         r->out.result = _spoolss_5f(cli->pipes_struct, r);
9620                         return NT_STATUS_OK;
9621                 }
9622
9623                 case NDR_SPOOLSS_60: {
9624                         struct spoolss_60 *r = (struct spoolss_60 *)_r;
9625                         r->out.result = _spoolss_60(cli->pipes_struct, r);
9626                         return NT_STATUS_OK;
9627                 }
9628
9629                 case NDR_SPOOLSS_61: {
9630                         struct spoolss_61 *r = (struct spoolss_61 *)_r;
9631                         r->out.result = _spoolss_61(cli->pipes_struct, r);
9632                         return NT_STATUS_OK;
9633                 }
9634
9635                 case NDR_SPOOLSS_62: {
9636                         struct spoolss_62 *r = (struct spoolss_62 *)_r;
9637                         r->out.result = _spoolss_62(cli->pipes_struct, r);
9638                         return NT_STATUS_OK;
9639                 }
9640
9641                 case NDR_SPOOLSS_63: {
9642                         struct spoolss_63 *r = (struct spoolss_63 *)_r;
9643                         r->out.result = _spoolss_63(cli->pipes_struct, r);
9644                         return NT_STATUS_OK;
9645                 }
9646
9647                 case NDR_SPOOLSS_64: {
9648                         struct spoolss_64 *r = (struct spoolss_64 *)_r;
9649                         r->out.result = _spoolss_64(cli->pipes_struct, r);
9650                         return NT_STATUS_OK;
9651                 }
9652
9653                 case NDR_SPOOLSS_65: {
9654                         struct spoolss_65 *r = (struct spoolss_65 *)_r;
9655                         r->out.result = _spoolss_65(cli->pipes_struct, r);
9656                         return NT_STATUS_OK;
9657                 }
9658
9659                 case NDR_SPOOLSS_GETCOREPRINTERDRIVERS: {
9660                         struct spoolss_GetCorePrinterDrivers *r = (struct spoolss_GetCorePrinterDrivers *)_r;
9661                         ZERO_STRUCT(r->out);
9662                         r->out.core_printer_drivers = talloc_zero_array(mem_ctx, struct spoolss_CorePrinterDriver, r->in.core_printer_driver_count);
9663                         if (r->out.core_printer_drivers == NULL) {
9664                         return NT_STATUS_NO_MEMORY;
9665                         }
9666
9667                         r->out.result = _spoolss_GetCorePrinterDrivers(cli->pipes_struct, r);
9668                         return NT_STATUS_OK;
9669                 }
9670
9671                 case NDR_SPOOLSS_67: {
9672                         struct spoolss_67 *r = (struct spoolss_67 *)_r;
9673                         r->out.result = _spoolss_67(cli->pipes_struct, r);
9674                         return NT_STATUS_OK;
9675                 }
9676
9677                 case NDR_SPOOLSS_GETPRINTERDRIVERPACKAGEPATH: {
9678                         struct spoolss_GetPrinterDriverPackagePath *r = (struct spoolss_GetPrinterDriverPackagePath *)_r;
9679                         ZERO_STRUCT(r->out);
9680                         r->out.driver_package_cab = r->in.driver_package_cab;
9681                         r->out.required = talloc_zero(mem_ctx, uint32_t);
9682                         if (r->out.required == NULL) {
9683                         return NT_STATUS_NO_MEMORY;
9684                         }
9685
9686                         r->out.result = _spoolss_GetPrinterDriverPackagePath(cli->pipes_struct, r);
9687                         return NT_STATUS_OK;
9688                 }
9689
9690                 case NDR_SPOOLSS_69: {
9691                         struct spoolss_69 *r = (struct spoolss_69 *)_r;
9692                         r->out.result = _spoolss_69(cli->pipes_struct, r);
9693                         return NT_STATUS_OK;
9694                 }
9695
9696                 case NDR_SPOOLSS_6A: {
9697                         struct spoolss_6a *r = (struct spoolss_6a *)_r;
9698                         r->out.result = _spoolss_6a(cli->pipes_struct, r);
9699                         return NT_STATUS_OK;
9700                 }
9701
9702                 case NDR_SPOOLSS_6B: {
9703                         struct spoolss_6b *r = (struct spoolss_6b *)_r;
9704                         r->out.result = _spoolss_6b(cli->pipes_struct, r);
9705                         return NT_STATUS_OK;
9706                 }
9707
9708                 case NDR_SPOOLSS_6C: {
9709                         struct spoolss_6c *r = (struct spoolss_6c *)_r;
9710                         r->out.result = _spoolss_6c(cli->pipes_struct, r);
9711                         return NT_STATUS_OK;
9712                 }
9713
9714                 case NDR_SPOOLSS_6D: {
9715                         struct spoolss_6d *r = (struct spoolss_6d *)_r;
9716                         r->out.result = _spoolss_6d(cli->pipes_struct, r);
9717                         return NT_STATUS_OK;
9718                 }
9719
9720                 default:
9721                         return NT_STATUS_NOT_IMPLEMENTED;
9722         }
9723 }
9724
9725 NTSTATUS rpc_spoolss_init(void)
9726 {
9727         return rpc_srv_register(SMB_RPC_INTERFACE_VERSION, "spoolss", "spoolss", &ndr_table_spoolss, api_spoolss_cmds, sizeof(api_spoolss_cmds) / sizeof(struct api_struct));
9728 }