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