21a7236c31229d5df366e8b52adbced67d2be00c
[metze/samba/wip.git] / librpc / gen_ndr / cli_spoolss.c
1 /*
2  * Unix SMB/CIFS implementation.
3  * client auto-generated by pidl. DO NOT MODIFY!
4  */
5
6 #include "includes.h"
7 #include "../librpc/gen_ndr/cli_spoolss.h"
8
9 struct rpccli_spoolss_EnumPrinters_state {
10         struct spoolss_EnumPrinters orig;
11         struct spoolss_EnumPrinters tmp;
12         TALLOC_CTX *out_mem_ctx;
13         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
14 };
15
16 static void rpccli_spoolss_EnumPrinters_done(struct tevent_req *subreq);
17
18 struct tevent_req *rpccli_spoolss_EnumPrinters_send(TALLOC_CTX *mem_ctx,
19                                                     struct tevent_context *ev,
20                                                     struct rpc_pipe_client *cli,
21                                                     uint32_t _flags /* [in]  */,
22                                                     const char *_server /* [in] [unique,charset(UTF16)] */,
23                                                     uint32_t _level /* [in]  */,
24                                                     DATA_BLOB *_buffer /* [in] [unique] */,
25                                                     uint32_t _offered /* [in]  */,
26                                                     uint32_t *_count /* [out] [ref] */,
27                                                     union spoolss_PrinterInfo **_info /* [out] [ref,switch_is(level),size_is(,*count)] */,
28                                                     uint32_t *_needed /* [out] [ref] */)
29 {
30         struct tevent_req *req;
31         struct rpccli_spoolss_EnumPrinters_state *state;
32         struct tevent_req *subreq;
33
34         req = tevent_req_create(mem_ctx, &state,
35                                 struct rpccli_spoolss_EnumPrinters_state);
36         if (req == NULL) {
37                 return NULL;
38         }
39         state->out_mem_ctx = NULL;
40         state->dispatch_recv = cli->dispatch_recv;
41
42         /* In parameters */
43         state->orig.in.flags = _flags;
44         state->orig.in.server = _server;
45         state->orig.in.level = _level;
46         state->orig.in.buffer = _buffer;
47         state->orig.in.offered = _offered;
48
49         /* Out parameters */
50         state->orig.out.count = _count;
51         state->orig.out.info = _info;
52         state->orig.out.needed = _needed;
53
54         /* Result */
55         ZERO_STRUCT(state->orig.out.result);
56
57         if (DEBUGLEVEL >= 10) {
58                 NDR_PRINT_IN_DEBUG(spoolss_EnumPrinters, &state->orig);
59         }
60
61         state->out_mem_ctx = talloc_named_const(state, 0,
62                              "rpccli_spoolss_EnumPrinters_out_memory");
63         if (tevent_req_nomem(state->out_mem_ctx, req)) {
64                 return tevent_req_post(req, ev);
65         }
66
67         /* make a temporary copy, that we pass to the dispatch function */
68         state->tmp = state->orig;
69
70         subreq = cli->dispatch_send(state, ev, cli,
71                                     &ndr_table_spoolss,
72                                     NDR_SPOOLSS_ENUMPRINTERS,
73                                     &state->tmp);
74         if (tevent_req_nomem(subreq, req)) {
75                 return tevent_req_post(req, ev);
76         }
77         tevent_req_set_callback(subreq, rpccli_spoolss_EnumPrinters_done, req);
78         return req;
79 }
80
81 static void rpccli_spoolss_EnumPrinters_done(struct tevent_req *subreq)
82 {
83         struct tevent_req *req = tevent_req_callback_data(
84                 subreq, struct tevent_req);
85         struct rpccli_spoolss_EnumPrinters_state *state = tevent_req_data(
86                 req, struct rpccli_spoolss_EnumPrinters_state);
87         NTSTATUS status;
88         TALLOC_CTX *mem_ctx;
89
90         if (state->out_mem_ctx) {
91                 mem_ctx = state->out_mem_ctx;
92         } else {
93                 mem_ctx = state;
94         }
95
96         status = state->dispatch_recv(subreq, mem_ctx);
97         TALLOC_FREE(subreq);
98         if (!NT_STATUS_IS_OK(status)) {
99                 tevent_req_nterror(req, status);
100                 return;
101         }
102
103         /* Copy out parameters */
104         *state->orig.out.count = *state->tmp.out.count;
105         *state->orig.out.info = *state->tmp.out.info;
106         *state->orig.out.needed = *state->tmp.out.needed;
107
108         /* Copy result */
109         state->orig.out.result = state->tmp.out.result;
110
111         /* Reset temporary structure */
112         ZERO_STRUCT(state->tmp);
113
114         if (DEBUGLEVEL >= 10) {
115                 NDR_PRINT_OUT_DEBUG(spoolss_EnumPrinters, &state->orig);
116         }
117
118         tevent_req_done(req);
119 }
120
121 NTSTATUS rpccli_spoolss_EnumPrinters_recv(struct tevent_req *req,
122                                           TALLOC_CTX *mem_ctx,
123                                           WERROR *result)
124 {
125         struct rpccli_spoolss_EnumPrinters_state *state = tevent_req_data(
126                 req, struct rpccli_spoolss_EnumPrinters_state);
127         NTSTATUS status;
128
129         if (tevent_req_is_nterror(req, &status)) {
130                 tevent_req_received(req);
131                 return status;
132         }
133
134         /* Steal possbile out parameters to the callers context */
135         talloc_steal(mem_ctx, state->out_mem_ctx);
136
137         /* Return result */
138         *result = state->orig.out.result;
139
140         tevent_req_received(req);
141         return NT_STATUS_OK;
142 }
143
144 NTSTATUS rpccli_spoolss_EnumPrinters(struct rpc_pipe_client *cli,
145                                      TALLOC_CTX *mem_ctx,
146                                      uint32_t flags /* [in]  */,
147                                      const char *server /* [in] [unique,charset(UTF16)] */,
148                                      uint32_t level /* [in]  */,
149                                      DATA_BLOB *buffer /* [in] [unique] */,
150                                      uint32_t offered /* [in]  */,
151                                      uint32_t *count /* [out] [ref] */,
152                                      union spoolss_PrinterInfo **info /* [out] [ref,switch_is(level),size_is(,*count)] */,
153                                      uint32_t *needed /* [out] [ref] */,
154                                      WERROR *werror)
155 {
156         struct spoolss_EnumPrinters r;
157         NTSTATUS status;
158
159         /* In parameters */
160         r.in.flags = flags;
161         r.in.server = server;
162         r.in.level = level;
163         r.in.buffer = buffer;
164         r.in.offered = offered;
165
166         if (DEBUGLEVEL >= 10) {
167                 NDR_PRINT_IN_DEBUG(spoolss_EnumPrinters, &r);
168         }
169
170         status = cli->dispatch(cli,
171                                 mem_ctx,
172                                 &ndr_table_spoolss,
173                                 NDR_SPOOLSS_ENUMPRINTERS,
174                                 &r);
175
176         if (!NT_STATUS_IS_OK(status)) {
177                 return status;
178         }
179
180         if (DEBUGLEVEL >= 10) {
181                 NDR_PRINT_OUT_DEBUG(spoolss_EnumPrinters, &r);
182         }
183
184         if (NT_STATUS_IS_ERR(status)) {
185                 return status;
186         }
187
188         /* Return variables */
189         *count = *r.out.count;
190         *info = *r.out.info;
191         *needed = *r.out.needed;
192
193         /* Return result */
194         if (werror) {
195                 *werror = r.out.result;
196         }
197
198         return werror_to_ntstatus(r.out.result);
199 }
200
201 struct rpccli_spoolss_OpenPrinter_state {
202         struct spoolss_OpenPrinter orig;
203         struct spoolss_OpenPrinter tmp;
204         TALLOC_CTX *out_mem_ctx;
205         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
206 };
207
208 static void rpccli_spoolss_OpenPrinter_done(struct tevent_req *subreq);
209
210 struct tevent_req *rpccli_spoolss_OpenPrinter_send(TALLOC_CTX *mem_ctx,
211                                                    struct tevent_context *ev,
212                                                    struct rpc_pipe_client *cli,
213                                                    const char *_printername /* [in] [unique,charset(UTF16)] */,
214                                                    const char *_datatype /* [in] [unique,charset(UTF16)] */,
215                                                    struct spoolss_DevmodeContainer _devmode_ctr /* [in]  */,
216                                                    uint32_t _access_mask /* [in]  */,
217                                                    struct policy_handle *_handle /* [out] [ref] */)
218 {
219         struct tevent_req *req;
220         struct rpccli_spoolss_OpenPrinter_state *state;
221         struct tevent_req *subreq;
222
223         req = tevent_req_create(mem_ctx, &state,
224                                 struct rpccli_spoolss_OpenPrinter_state);
225         if (req == NULL) {
226                 return NULL;
227         }
228         state->out_mem_ctx = NULL;
229         state->dispatch_recv = cli->dispatch_recv;
230
231         /* In parameters */
232         state->orig.in.printername = _printername;
233         state->orig.in.datatype = _datatype;
234         state->orig.in.devmode_ctr = _devmode_ctr;
235         state->orig.in.access_mask = _access_mask;
236
237         /* Out parameters */
238         state->orig.out.handle = _handle;
239
240         /* Result */
241         ZERO_STRUCT(state->orig.out.result);
242
243         if (DEBUGLEVEL >= 10) {
244                 NDR_PRINT_IN_DEBUG(spoolss_OpenPrinter, &state->orig);
245         }
246
247         state->out_mem_ctx = talloc_named_const(state, 0,
248                              "rpccli_spoolss_OpenPrinter_out_memory");
249         if (tevent_req_nomem(state->out_mem_ctx, req)) {
250                 return tevent_req_post(req, ev);
251         }
252
253         /* make a temporary copy, that we pass to the dispatch function */
254         state->tmp = state->orig;
255
256         subreq = cli->dispatch_send(state, ev, cli,
257                                     &ndr_table_spoolss,
258                                     NDR_SPOOLSS_OPENPRINTER,
259                                     &state->tmp);
260         if (tevent_req_nomem(subreq, req)) {
261                 return tevent_req_post(req, ev);
262         }
263         tevent_req_set_callback(subreq, rpccli_spoolss_OpenPrinter_done, req);
264         return req;
265 }
266
267 static void rpccli_spoolss_OpenPrinter_done(struct tevent_req *subreq)
268 {
269         struct tevent_req *req = tevent_req_callback_data(
270                 subreq, struct tevent_req);
271         struct rpccli_spoolss_OpenPrinter_state *state = tevent_req_data(
272                 req, struct rpccli_spoolss_OpenPrinter_state);
273         NTSTATUS status;
274         TALLOC_CTX *mem_ctx;
275
276         if (state->out_mem_ctx) {
277                 mem_ctx = state->out_mem_ctx;
278         } else {
279                 mem_ctx = state;
280         }
281
282         status = state->dispatch_recv(subreq, mem_ctx);
283         TALLOC_FREE(subreq);
284         if (!NT_STATUS_IS_OK(status)) {
285                 tevent_req_nterror(req, status);
286                 return;
287         }
288
289         /* Copy out parameters */
290         *state->orig.out.handle = *state->tmp.out.handle;
291
292         /* Copy result */
293         state->orig.out.result = state->tmp.out.result;
294
295         /* Reset temporary structure */
296         ZERO_STRUCT(state->tmp);
297
298         if (DEBUGLEVEL >= 10) {
299                 NDR_PRINT_OUT_DEBUG(spoolss_OpenPrinter, &state->orig);
300         }
301
302         tevent_req_done(req);
303 }
304
305 NTSTATUS rpccli_spoolss_OpenPrinter_recv(struct tevent_req *req,
306                                          TALLOC_CTX *mem_ctx,
307                                          WERROR *result)
308 {
309         struct rpccli_spoolss_OpenPrinter_state *state = tevent_req_data(
310                 req, struct rpccli_spoolss_OpenPrinter_state);
311         NTSTATUS status;
312
313         if (tevent_req_is_nterror(req, &status)) {
314                 tevent_req_received(req);
315                 return status;
316         }
317
318         /* Steal possbile out parameters to the callers context */
319         talloc_steal(mem_ctx, state->out_mem_ctx);
320
321         /* Return result */
322         *result = state->orig.out.result;
323
324         tevent_req_received(req);
325         return NT_STATUS_OK;
326 }
327
328 NTSTATUS rpccli_spoolss_OpenPrinter(struct rpc_pipe_client *cli,
329                                     TALLOC_CTX *mem_ctx,
330                                     const char *printername /* [in] [unique,charset(UTF16)] */,
331                                     const char *datatype /* [in] [unique,charset(UTF16)] */,
332                                     struct spoolss_DevmodeContainer devmode_ctr /* [in]  */,
333                                     uint32_t access_mask /* [in]  */,
334                                     struct policy_handle *handle /* [out] [ref] */,
335                                     WERROR *werror)
336 {
337         struct spoolss_OpenPrinter r;
338         NTSTATUS status;
339
340         /* In parameters */
341         r.in.printername = printername;
342         r.in.datatype = datatype;
343         r.in.devmode_ctr = devmode_ctr;
344         r.in.access_mask = access_mask;
345
346         if (DEBUGLEVEL >= 10) {
347                 NDR_PRINT_IN_DEBUG(spoolss_OpenPrinter, &r);
348         }
349
350         status = cli->dispatch(cli,
351                                 mem_ctx,
352                                 &ndr_table_spoolss,
353                                 NDR_SPOOLSS_OPENPRINTER,
354                                 &r);
355
356         if (!NT_STATUS_IS_OK(status)) {
357                 return status;
358         }
359
360         if (DEBUGLEVEL >= 10) {
361                 NDR_PRINT_OUT_DEBUG(spoolss_OpenPrinter, &r);
362         }
363
364         if (NT_STATUS_IS_ERR(status)) {
365                 return status;
366         }
367
368         /* Return variables */
369         *handle = *r.out.handle;
370
371         /* Return result */
372         if (werror) {
373                 *werror = r.out.result;
374         }
375
376         return werror_to_ntstatus(r.out.result);
377 }
378
379 struct rpccli_spoolss_SetJob_state {
380         struct spoolss_SetJob orig;
381         struct spoolss_SetJob tmp;
382         TALLOC_CTX *out_mem_ctx;
383         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
384 };
385
386 static void rpccli_spoolss_SetJob_done(struct tevent_req *subreq);
387
388 struct tevent_req *rpccli_spoolss_SetJob_send(TALLOC_CTX *mem_ctx,
389                                               struct tevent_context *ev,
390                                               struct rpc_pipe_client *cli,
391                                               struct policy_handle *_handle /* [in] [ref] */,
392                                               uint32_t _job_id /* [in]  */,
393                                               struct spoolss_JobInfoContainer *_ctr /* [in] [unique] */,
394                                               enum spoolss_JobControl _command /* [in]  */)
395 {
396         struct tevent_req *req;
397         struct rpccli_spoolss_SetJob_state *state;
398         struct tevent_req *subreq;
399
400         req = tevent_req_create(mem_ctx, &state,
401                                 struct rpccli_spoolss_SetJob_state);
402         if (req == NULL) {
403                 return NULL;
404         }
405         state->out_mem_ctx = NULL;
406         state->dispatch_recv = cli->dispatch_recv;
407
408         /* In parameters */
409         state->orig.in.handle = _handle;
410         state->orig.in.job_id = _job_id;
411         state->orig.in.ctr = _ctr;
412         state->orig.in.command = _command;
413
414         /* Out parameters */
415
416         /* Result */
417         ZERO_STRUCT(state->orig.out.result);
418
419         if (DEBUGLEVEL >= 10) {
420                 NDR_PRINT_IN_DEBUG(spoolss_SetJob, &state->orig);
421         }
422
423         /* make a temporary copy, that we pass to the dispatch function */
424         state->tmp = state->orig;
425
426         subreq = cli->dispatch_send(state, ev, cli,
427                                     &ndr_table_spoolss,
428                                     NDR_SPOOLSS_SETJOB,
429                                     &state->tmp);
430         if (tevent_req_nomem(subreq, req)) {
431                 return tevent_req_post(req, ev);
432         }
433         tevent_req_set_callback(subreq, rpccli_spoolss_SetJob_done, req);
434         return req;
435 }
436
437 static void rpccli_spoolss_SetJob_done(struct tevent_req *subreq)
438 {
439         struct tevent_req *req = tevent_req_callback_data(
440                 subreq, struct tevent_req);
441         struct rpccli_spoolss_SetJob_state *state = tevent_req_data(
442                 req, struct rpccli_spoolss_SetJob_state);
443         NTSTATUS status;
444         TALLOC_CTX *mem_ctx;
445
446         if (state->out_mem_ctx) {
447                 mem_ctx = state->out_mem_ctx;
448         } else {
449                 mem_ctx = state;
450         }
451
452         status = state->dispatch_recv(subreq, mem_ctx);
453         TALLOC_FREE(subreq);
454         if (!NT_STATUS_IS_OK(status)) {
455                 tevent_req_nterror(req, status);
456                 return;
457         }
458
459         /* Copy out parameters */
460
461         /* Copy result */
462         state->orig.out.result = state->tmp.out.result;
463
464         /* Reset temporary structure */
465         ZERO_STRUCT(state->tmp);
466
467         if (DEBUGLEVEL >= 10) {
468                 NDR_PRINT_OUT_DEBUG(spoolss_SetJob, &state->orig);
469         }
470
471         tevent_req_done(req);
472 }
473
474 NTSTATUS rpccli_spoolss_SetJob_recv(struct tevent_req *req,
475                                     TALLOC_CTX *mem_ctx,
476                                     WERROR *result)
477 {
478         struct rpccli_spoolss_SetJob_state *state = tevent_req_data(
479                 req, struct rpccli_spoolss_SetJob_state);
480         NTSTATUS status;
481
482         if (tevent_req_is_nterror(req, &status)) {
483                 tevent_req_received(req);
484                 return status;
485         }
486
487         /* Steal possbile out parameters to the callers context */
488         talloc_steal(mem_ctx, state->out_mem_ctx);
489
490         /* Return result */
491         *result = state->orig.out.result;
492
493         tevent_req_received(req);
494         return NT_STATUS_OK;
495 }
496
497 NTSTATUS rpccli_spoolss_SetJob(struct rpc_pipe_client *cli,
498                                TALLOC_CTX *mem_ctx,
499                                struct policy_handle *handle /* [in] [ref] */,
500                                uint32_t job_id /* [in]  */,
501                                struct spoolss_JobInfoContainer *ctr /* [in] [unique] */,
502                                enum spoolss_JobControl command /* [in]  */,
503                                WERROR *werror)
504 {
505         struct spoolss_SetJob r;
506         NTSTATUS status;
507
508         /* In parameters */
509         r.in.handle = handle;
510         r.in.job_id = job_id;
511         r.in.ctr = ctr;
512         r.in.command = command;
513
514         if (DEBUGLEVEL >= 10) {
515                 NDR_PRINT_IN_DEBUG(spoolss_SetJob, &r);
516         }
517
518         status = cli->dispatch(cli,
519                                 mem_ctx,
520                                 &ndr_table_spoolss,
521                                 NDR_SPOOLSS_SETJOB,
522                                 &r);
523
524         if (!NT_STATUS_IS_OK(status)) {
525                 return status;
526         }
527
528         if (DEBUGLEVEL >= 10) {
529                 NDR_PRINT_OUT_DEBUG(spoolss_SetJob, &r);
530         }
531
532         if (NT_STATUS_IS_ERR(status)) {
533                 return status;
534         }
535
536         /* Return variables */
537
538         /* Return result */
539         if (werror) {
540                 *werror = r.out.result;
541         }
542
543         return werror_to_ntstatus(r.out.result);
544 }
545
546 struct rpccli_spoolss_GetJob_state {
547         struct spoolss_GetJob orig;
548         struct spoolss_GetJob tmp;
549         TALLOC_CTX *out_mem_ctx;
550         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
551 };
552
553 static void rpccli_spoolss_GetJob_done(struct tevent_req *subreq);
554
555 struct tevent_req *rpccli_spoolss_GetJob_send(TALLOC_CTX *mem_ctx,
556                                               struct tevent_context *ev,
557                                               struct rpc_pipe_client *cli,
558                                               struct policy_handle *_handle /* [in] [ref] */,
559                                               uint32_t _job_id /* [in]  */,
560                                               uint32_t _level /* [in]  */,
561                                               DATA_BLOB *_buffer /* [in] [unique] */,
562                                               uint32_t _offered /* [in]  */,
563                                               union spoolss_JobInfo *_info /* [out] [unique,subcontext_size(offered),subcontext(4),switch_is(level)] */,
564                                               uint32_t *_needed /* [out] [ref] */)
565 {
566         struct tevent_req *req;
567         struct rpccli_spoolss_GetJob_state *state;
568         struct tevent_req *subreq;
569
570         req = tevent_req_create(mem_ctx, &state,
571                                 struct rpccli_spoolss_GetJob_state);
572         if (req == NULL) {
573                 return NULL;
574         }
575         state->out_mem_ctx = NULL;
576         state->dispatch_recv = cli->dispatch_recv;
577
578         /* In parameters */
579         state->orig.in.handle = _handle;
580         state->orig.in.job_id = _job_id;
581         state->orig.in.level = _level;
582         state->orig.in.buffer = _buffer;
583         state->orig.in.offered = _offered;
584
585         /* Out parameters */
586         state->orig.out.info = _info;
587         state->orig.out.needed = _needed;
588
589         /* Result */
590         ZERO_STRUCT(state->orig.out.result);
591
592         if (DEBUGLEVEL >= 10) {
593                 NDR_PRINT_IN_DEBUG(spoolss_GetJob, &state->orig);
594         }
595
596         state->out_mem_ctx = talloc_named_const(state, 0,
597                              "rpccli_spoolss_GetJob_out_memory");
598         if (tevent_req_nomem(state->out_mem_ctx, req)) {
599                 return tevent_req_post(req, ev);
600         }
601
602         /* make a temporary copy, that we pass to the dispatch function */
603         state->tmp = state->orig;
604
605         subreq = cli->dispatch_send(state, ev, cli,
606                                     &ndr_table_spoolss,
607                                     NDR_SPOOLSS_GETJOB,
608                                     &state->tmp);
609         if (tevent_req_nomem(subreq, req)) {
610                 return tevent_req_post(req, ev);
611         }
612         tevent_req_set_callback(subreq, rpccli_spoolss_GetJob_done, req);
613         return req;
614 }
615
616 static void rpccli_spoolss_GetJob_done(struct tevent_req *subreq)
617 {
618         struct tevent_req *req = tevent_req_callback_data(
619                 subreq, struct tevent_req);
620         struct rpccli_spoolss_GetJob_state *state = tevent_req_data(
621                 req, struct rpccli_spoolss_GetJob_state);
622         NTSTATUS status;
623         TALLOC_CTX *mem_ctx;
624
625         if (state->out_mem_ctx) {
626                 mem_ctx = state->out_mem_ctx;
627         } else {
628                 mem_ctx = state;
629         }
630
631         status = state->dispatch_recv(subreq, mem_ctx);
632         TALLOC_FREE(subreq);
633         if (!NT_STATUS_IS_OK(status)) {
634                 tevent_req_nterror(req, status);
635                 return;
636         }
637
638         /* Copy out parameters */
639         if (state->orig.out.info && state->tmp.out.info) {
640                 *state->orig.out.info = *state->tmp.out.info;
641         }
642         *state->orig.out.needed = *state->tmp.out.needed;
643
644         /* Copy result */
645         state->orig.out.result = state->tmp.out.result;
646
647         /* Reset temporary structure */
648         ZERO_STRUCT(state->tmp);
649
650         if (DEBUGLEVEL >= 10) {
651                 NDR_PRINT_OUT_DEBUG(spoolss_GetJob, &state->orig);
652         }
653
654         tevent_req_done(req);
655 }
656
657 NTSTATUS rpccli_spoolss_GetJob_recv(struct tevent_req *req,
658                                     TALLOC_CTX *mem_ctx,
659                                     WERROR *result)
660 {
661         struct rpccli_spoolss_GetJob_state *state = tevent_req_data(
662                 req, struct rpccli_spoolss_GetJob_state);
663         NTSTATUS status;
664
665         if (tevent_req_is_nterror(req, &status)) {
666                 tevent_req_received(req);
667                 return status;
668         }
669
670         /* Steal possbile out parameters to the callers context */
671         talloc_steal(mem_ctx, state->out_mem_ctx);
672
673         /* Return result */
674         *result = state->orig.out.result;
675
676         tevent_req_received(req);
677         return NT_STATUS_OK;
678 }
679
680 NTSTATUS rpccli_spoolss_GetJob(struct rpc_pipe_client *cli,
681                                TALLOC_CTX *mem_ctx,
682                                struct policy_handle *handle /* [in] [ref] */,
683                                uint32_t job_id /* [in]  */,
684                                uint32_t level /* [in]  */,
685                                DATA_BLOB *buffer /* [in] [unique] */,
686                                uint32_t offered /* [in]  */,
687                                union spoolss_JobInfo *info /* [out] [unique,subcontext_size(offered),subcontext(4),switch_is(level)] */,
688                                uint32_t *needed /* [out] [ref] */,
689                                WERROR *werror)
690 {
691         struct spoolss_GetJob r;
692         NTSTATUS status;
693
694         /* In parameters */
695         r.in.handle = handle;
696         r.in.job_id = job_id;
697         r.in.level = level;
698         r.in.buffer = buffer;
699         r.in.offered = offered;
700
701         if (DEBUGLEVEL >= 10) {
702                 NDR_PRINT_IN_DEBUG(spoolss_GetJob, &r);
703         }
704
705         status = cli->dispatch(cli,
706                                 mem_ctx,
707                                 &ndr_table_spoolss,
708                                 NDR_SPOOLSS_GETJOB,
709                                 &r);
710
711         if (!NT_STATUS_IS_OK(status)) {
712                 return status;
713         }
714
715         if (DEBUGLEVEL >= 10) {
716                 NDR_PRINT_OUT_DEBUG(spoolss_GetJob, &r);
717         }
718
719         if (NT_STATUS_IS_ERR(status)) {
720                 return status;
721         }
722
723         /* Return variables */
724         if (info && r.out.info) {
725                 *info = *r.out.info;
726         }
727         *needed = *r.out.needed;
728
729         /* Return result */
730         if (werror) {
731                 *werror = r.out.result;
732         }
733
734         return werror_to_ntstatus(r.out.result);
735 }
736
737 struct rpccli_spoolss_EnumJobs_state {
738         struct spoolss_EnumJobs orig;
739         struct spoolss_EnumJobs tmp;
740         TALLOC_CTX *out_mem_ctx;
741         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
742 };
743
744 static void rpccli_spoolss_EnumJobs_done(struct tevent_req *subreq);
745
746 struct tevent_req *rpccli_spoolss_EnumJobs_send(TALLOC_CTX *mem_ctx,
747                                                 struct tevent_context *ev,
748                                                 struct rpc_pipe_client *cli,
749                                                 struct policy_handle *_handle /* [in] [ref] */,
750                                                 uint32_t _firstjob /* [in]  */,
751                                                 uint32_t _numjobs /* [in]  */,
752                                                 uint32_t _level /* [in]  */,
753                                                 DATA_BLOB *_buffer /* [in] [unique] */,
754                                                 uint32_t _offered /* [in]  */,
755                                                 uint32_t *_count /* [out] [ref] */,
756                                                 union spoolss_JobInfo **_info /* [out] [ref,switch_is(level),size_is(,*count)] */,
757                                                 uint32_t *_needed /* [out] [ref] */)
758 {
759         struct tevent_req *req;
760         struct rpccli_spoolss_EnumJobs_state *state;
761         struct tevent_req *subreq;
762
763         req = tevent_req_create(mem_ctx, &state,
764                                 struct rpccli_spoolss_EnumJobs_state);
765         if (req == NULL) {
766                 return NULL;
767         }
768         state->out_mem_ctx = NULL;
769         state->dispatch_recv = cli->dispatch_recv;
770
771         /* In parameters */
772         state->orig.in.handle = _handle;
773         state->orig.in.firstjob = _firstjob;
774         state->orig.in.numjobs = _numjobs;
775         state->orig.in.level = _level;
776         state->orig.in.buffer = _buffer;
777         state->orig.in.offered = _offered;
778
779         /* Out parameters */
780         state->orig.out.count = _count;
781         state->orig.out.info = _info;
782         state->orig.out.needed = _needed;
783
784         /* Result */
785         ZERO_STRUCT(state->orig.out.result);
786
787         if (DEBUGLEVEL >= 10) {
788                 NDR_PRINT_IN_DEBUG(spoolss_EnumJobs, &state->orig);
789         }
790
791         state->out_mem_ctx = talloc_named_const(state, 0,
792                              "rpccli_spoolss_EnumJobs_out_memory");
793         if (tevent_req_nomem(state->out_mem_ctx, req)) {
794                 return tevent_req_post(req, ev);
795         }
796
797         /* make a temporary copy, that we pass to the dispatch function */
798         state->tmp = state->orig;
799
800         subreq = cli->dispatch_send(state, ev, cli,
801                                     &ndr_table_spoolss,
802                                     NDR_SPOOLSS_ENUMJOBS,
803                                     &state->tmp);
804         if (tevent_req_nomem(subreq, req)) {
805                 return tevent_req_post(req, ev);
806         }
807         tevent_req_set_callback(subreq, rpccli_spoolss_EnumJobs_done, req);
808         return req;
809 }
810
811 static void rpccli_spoolss_EnumJobs_done(struct tevent_req *subreq)
812 {
813         struct tevent_req *req = tevent_req_callback_data(
814                 subreq, struct tevent_req);
815         struct rpccli_spoolss_EnumJobs_state *state = tevent_req_data(
816                 req, struct rpccli_spoolss_EnumJobs_state);
817         NTSTATUS status;
818         TALLOC_CTX *mem_ctx;
819
820         if (state->out_mem_ctx) {
821                 mem_ctx = state->out_mem_ctx;
822         } else {
823                 mem_ctx = state;
824         }
825
826         status = state->dispatch_recv(subreq, mem_ctx);
827         TALLOC_FREE(subreq);
828         if (!NT_STATUS_IS_OK(status)) {
829                 tevent_req_nterror(req, status);
830                 return;
831         }
832
833         /* Copy out parameters */
834         *state->orig.out.count = *state->tmp.out.count;
835         *state->orig.out.info = *state->tmp.out.info;
836         *state->orig.out.needed = *state->tmp.out.needed;
837
838         /* Copy result */
839         state->orig.out.result = state->tmp.out.result;
840
841         /* Reset temporary structure */
842         ZERO_STRUCT(state->tmp);
843
844         if (DEBUGLEVEL >= 10) {
845                 NDR_PRINT_OUT_DEBUG(spoolss_EnumJobs, &state->orig);
846         }
847
848         tevent_req_done(req);
849 }
850
851 NTSTATUS rpccli_spoolss_EnumJobs_recv(struct tevent_req *req,
852                                       TALLOC_CTX *mem_ctx,
853                                       WERROR *result)
854 {
855         struct rpccli_spoolss_EnumJobs_state *state = tevent_req_data(
856                 req, struct rpccli_spoolss_EnumJobs_state);
857         NTSTATUS status;
858
859         if (tevent_req_is_nterror(req, &status)) {
860                 tevent_req_received(req);
861                 return status;
862         }
863
864         /* Steal possbile out parameters to the callers context */
865         talloc_steal(mem_ctx, state->out_mem_ctx);
866
867         /* Return result */
868         *result = state->orig.out.result;
869
870         tevent_req_received(req);
871         return NT_STATUS_OK;
872 }
873
874 NTSTATUS rpccli_spoolss_EnumJobs(struct rpc_pipe_client *cli,
875                                  TALLOC_CTX *mem_ctx,
876                                  struct policy_handle *handle /* [in] [ref] */,
877                                  uint32_t firstjob /* [in]  */,
878                                  uint32_t numjobs /* [in]  */,
879                                  uint32_t level /* [in]  */,
880                                  DATA_BLOB *buffer /* [in] [unique] */,
881                                  uint32_t offered /* [in]  */,
882                                  uint32_t *count /* [out] [ref] */,
883                                  union spoolss_JobInfo **info /* [out] [ref,switch_is(level),size_is(,*count)] */,
884                                  uint32_t *needed /* [out] [ref] */,
885                                  WERROR *werror)
886 {
887         struct spoolss_EnumJobs r;
888         NTSTATUS status;
889
890         /* In parameters */
891         r.in.handle = handle;
892         r.in.firstjob = firstjob;
893         r.in.numjobs = numjobs;
894         r.in.level = level;
895         r.in.buffer = buffer;
896         r.in.offered = offered;
897
898         if (DEBUGLEVEL >= 10) {
899                 NDR_PRINT_IN_DEBUG(spoolss_EnumJobs, &r);
900         }
901
902         status = cli->dispatch(cli,
903                                 mem_ctx,
904                                 &ndr_table_spoolss,
905                                 NDR_SPOOLSS_ENUMJOBS,
906                                 &r);
907
908         if (!NT_STATUS_IS_OK(status)) {
909                 return status;
910         }
911
912         if (DEBUGLEVEL >= 10) {
913                 NDR_PRINT_OUT_DEBUG(spoolss_EnumJobs, &r);
914         }
915
916         if (NT_STATUS_IS_ERR(status)) {
917                 return status;
918         }
919
920         /* Return variables */
921         *count = *r.out.count;
922         *info = *r.out.info;
923         *needed = *r.out.needed;
924
925         /* Return result */
926         if (werror) {
927                 *werror = r.out.result;
928         }
929
930         return werror_to_ntstatus(r.out.result);
931 }
932
933 struct rpccli_spoolss_AddPrinter_state {
934         struct spoolss_AddPrinter orig;
935         struct spoolss_AddPrinter tmp;
936         TALLOC_CTX *out_mem_ctx;
937         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
938 };
939
940 static void rpccli_spoolss_AddPrinter_done(struct tevent_req *subreq);
941
942 struct tevent_req *rpccli_spoolss_AddPrinter_send(TALLOC_CTX *mem_ctx,
943                                                   struct tevent_context *ev,
944                                                   struct rpc_pipe_client *cli,
945                                                   const char *_server /* [in] [unique,charset(UTF16)] */,
946                                                   struct spoolss_SetPrinterInfoCtr *_info_ctr /* [in] [ref] */,
947                                                   struct spoolss_DevmodeContainer *_devmode_ctr /* [in] [ref] */,
948                                                   struct sec_desc_buf *_secdesc_ctr /* [in] [ref] */,
949                                                   struct policy_handle *_handle /* [out] [ref] */)
950 {
951         struct tevent_req *req;
952         struct rpccli_spoolss_AddPrinter_state *state;
953         struct tevent_req *subreq;
954
955         req = tevent_req_create(mem_ctx, &state,
956                                 struct rpccli_spoolss_AddPrinter_state);
957         if (req == NULL) {
958                 return NULL;
959         }
960         state->out_mem_ctx = NULL;
961         state->dispatch_recv = cli->dispatch_recv;
962
963         /* In parameters */
964         state->orig.in.server = _server;
965         state->orig.in.info_ctr = _info_ctr;
966         state->orig.in.devmode_ctr = _devmode_ctr;
967         state->orig.in.secdesc_ctr = _secdesc_ctr;
968
969         /* Out parameters */
970         state->orig.out.handle = _handle;
971
972         /* Result */
973         ZERO_STRUCT(state->orig.out.result);
974
975         if (DEBUGLEVEL >= 10) {
976                 NDR_PRINT_IN_DEBUG(spoolss_AddPrinter, &state->orig);
977         }
978
979         state->out_mem_ctx = talloc_named_const(state, 0,
980                              "rpccli_spoolss_AddPrinter_out_memory");
981         if (tevent_req_nomem(state->out_mem_ctx, req)) {
982                 return tevent_req_post(req, ev);
983         }
984
985         /* make a temporary copy, that we pass to the dispatch function */
986         state->tmp = state->orig;
987
988         subreq = cli->dispatch_send(state, ev, cli,
989                                     &ndr_table_spoolss,
990                                     NDR_SPOOLSS_ADDPRINTER,
991                                     &state->tmp);
992         if (tevent_req_nomem(subreq, req)) {
993                 return tevent_req_post(req, ev);
994         }
995         tevent_req_set_callback(subreq, rpccli_spoolss_AddPrinter_done, req);
996         return req;
997 }
998
999 static void rpccli_spoolss_AddPrinter_done(struct tevent_req *subreq)
1000 {
1001         struct tevent_req *req = tevent_req_callback_data(
1002                 subreq, struct tevent_req);
1003         struct rpccli_spoolss_AddPrinter_state *state = tevent_req_data(
1004                 req, struct rpccli_spoolss_AddPrinter_state);
1005         NTSTATUS status;
1006         TALLOC_CTX *mem_ctx;
1007
1008         if (state->out_mem_ctx) {
1009                 mem_ctx = state->out_mem_ctx;
1010         } else {
1011                 mem_ctx = state;
1012         }
1013
1014         status = state->dispatch_recv(subreq, mem_ctx);
1015         TALLOC_FREE(subreq);
1016         if (!NT_STATUS_IS_OK(status)) {
1017                 tevent_req_nterror(req, status);
1018                 return;
1019         }
1020
1021         /* Copy out parameters */
1022         *state->orig.out.handle = *state->tmp.out.handle;
1023
1024         /* Copy result */
1025         state->orig.out.result = state->tmp.out.result;
1026
1027         /* Reset temporary structure */
1028         ZERO_STRUCT(state->tmp);
1029
1030         if (DEBUGLEVEL >= 10) {
1031                 NDR_PRINT_OUT_DEBUG(spoolss_AddPrinter, &state->orig);
1032         }
1033
1034         tevent_req_done(req);
1035 }
1036
1037 NTSTATUS rpccli_spoolss_AddPrinter_recv(struct tevent_req *req,
1038                                         TALLOC_CTX *mem_ctx,
1039                                         WERROR *result)
1040 {
1041         struct rpccli_spoolss_AddPrinter_state *state = tevent_req_data(
1042                 req, struct rpccli_spoolss_AddPrinter_state);
1043         NTSTATUS status;
1044
1045         if (tevent_req_is_nterror(req, &status)) {
1046                 tevent_req_received(req);
1047                 return status;
1048         }
1049
1050         /* Steal possbile out parameters to the callers context */
1051         talloc_steal(mem_ctx, state->out_mem_ctx);
1052
1053         /* Return result */
1054         *result = state->orig.out.result;
1055
1056         tevent_req_received(req);
1057         return NT_STATUS_OK;
1058 }
1059
1060 NTSTATUS rpccli_spoolss_AddPrinter(struct rpc_pipe_client *cli,
1061                                    TALLOC_CTX *mem_ctx,
1062                                    const char *server /* [in] [unique,charset(UTF16)] */,
1063                                    struct spoolss_SetPrinterInfoCtr *info_ctr /* [in] [ref] */,
1064                                    struct spoolss_DevmodeContainer *devmode_ctr /* [in] [ref] */,
1065                                    struct sec_desc_buf *secdesc_ctr /* [in] [ref] */,
1066                                    struct policy_handle *handle /* [out] [ref] */,
1067                                    WERROR *werror)
1068 {
1069         struct spoolss_AddPrinter r;
1070         NTSTATUS status;
1071
1072         /* In parameters */
1073         r.in.server = server;
1074         r.in.info_ctr = info_ctr;
1075         r.in.devmode_ctr = devmode_ctr;
1076         r.in.secdesc_ctr = secdesc_ctr;
1077
1078         if (DEBUGLEVEL >= 10) {
1079                 NDR_PRINT_IN_DEBUG(spoolss_AddPrinter, &r);
1080         }
1081
1082         status = cli->dispatch(cli,
1083                                 mem_ctx,
1084                                 &ndr_table_spoolss,
1085                                 NDR_SPOOLSS_ADDPRINTER,
1086                                 &r);
1087
1088         if (!NT_STATUS_IS_OK(status)) {
1089                 return status;
1090         }
1091
1092         if (DEBUGLEVEL >= 10) {
1093                 NDR_PRINT_OUT_DEBUG(spoolss_AddPrinter, &r);
1094         }
1095
1096         if (NT_STATUS_IS_ERR(status)) {
1097                 return status;
1098         }
1099
1100         /* Return variables */
1101         *handle = *r.out.handle;
1102
1103         /* Return result */
1104         if (werror) {
1105                 *werror = r.out.result;
1106         }
1107
1108         return werror_to_ntstatus(r.out.result);
1109 }
1110
1111 struct rpccli_spoolss_DeletePrinter_state {
1112         struct spoolss_DeletePrinter orig;
1113         struct spoolss_DeletePrinter tmp;
1114         TALLOC_CTX *out_mem_ctx;
1115         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1116 };
1117
1118 static void rpccli_spoolss_DeletePrinter_done(struct tevent_req *subreq);
1119
1120 struct tevent_req *rpccli_spoolss_DeletePrinter_send(TALLOC_CTX *mem_ctx,
1121                                                      struct tevent_context *ev,
1122                                                      struct rpc_pipe_client *cli,
1123                                                      struct policy_handle *_handle /* [in] [ref] */)
1124 {
1125         struct tevent_req *req;
1126         struct rpccli_spoolss_DeletePrinter_state *state;
1127         struct tevent_req *subreq;
1128
1129         req = tevent_req_create(mem_ctx, &state,
1130                                 struct rpccli_spoolss_DeletePrinter_state);
1131         if (req == NULL) {
1132                 return NULL;
1133         }
1134         state->out_mem_ctx = NULL;
1135         state->dispatch_recv = cli->dispatch_recv;
1136
1137         /* In parameters */
1138         state->orig.in.handle = _handle;
1139
1140         /* Out parameters */
1141
1142         /* Result */
1143         ZERO_STRUCT(state->orig.out.result);
1144
1145         if (DEBUGLEVEL >= 10) {
1146                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrinter, &state->orig);
1147         }
1148
1149         /* make a temporary copy, that we pass to the dispatch function */
1150         state->tmp = state->orig;
1151
1152         subreq = cli->dispatch_send(state, ev, cli,
1153                                     &ndr_table_spoolss,
1154                                     NDR_SPOOLSS_DELETEPRINTER,
1155                                     &state->tmp);
1156         if (tevent_req_nomem(subreq, req)) {
1157                 return tevent_req_post(req, ev);
1158         }
1159         tevent_req_set_callback(subreq, rpccli_spoolss_DeletePrinter_done, req);
1160         return req;
1161 }
1162
1163 static void rpccli_spoolss_DeletePrinter_done(struct tevent_req *subreq)
1164 {
1165         struct tevent_req *req = tevent_req_callback_data(
1166                 subreq, struct tevent_req);
1167         struct rpccli_spoolss_DeletePrinter_state *state = tevent_req_data(
1168                 req, struct rpccli_spoolss_DeletePrinter_state);
1169         NTSTATUS status;
1170         TALLOC_CTX *mem_ctx;
1171
1172         if (state->out_mem_ctx) {
1173                 mem_ctx = state->out_mem_ctx;
1174         } else {
1175                 mem_ctx = state;
1176         }
1177
1178         status = state->dispatch_recv(subreq, mem_ctx);
1179         TALLOC_FREE(subreq);
1180         if (!NT_STATUS_IS_OK(status)) {
1181                 tevent_req_nterror(req, status);
1182                 return;
1183         }
1184
1185         /* Copy out parameters */
1186
1187         /* Copy result */
1188         state->orig.out.result = state->tmp.out.result;
1189
1190         /* Reset temporary structure */
1191         ZERO_STRUCT(state->tmp);
1192
1193         if (DEBUGLEVEL >= 10) {
1194                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrinter, &state->orig);
1195         }
1196
1197         tevent_req_done(req);
1198 }
1199
1200 NTSTATUS rpccli_spoolss_DeletePrinter_recv(struct tevent_req *req,
1201                                            TALLOC_CTX *mem_ctx,
1202                                            WERROR *result)
1203 {
1204         struct rpccli_spoolss_DeletePrinter_state *state = tevent_req_data(
1205                 req, struct rpccli_spoolss_DeletePrinter_state);
1206         NTSTATUS status;
1207
1208         if (tevent_req_is_nterror(req, &status)) {
1209                 tevent_req_received(req);
1210                 return status;
1211         }
1212
1213         /* Steal possbile out parameters to the callers context */
1214         talloc_steal(mem_ctx, state->out_mem_ctx);
1215
1216         /* Return result */
1217         *result = state->orig.out.result;
1218
1219         tevent_req_received(req);
1220         return NT_STATUS_OK;
1221 }
1222
1223 NTSTATUS rpccli_spoolss_DeletePrinter(struct rpc_pipe_client *cli,
1224                                       TALLOC_CTX *mem_ctx,
1225                                       struct policy_handle *handle /* [in] [ref] */,
1226                                       WERROR *werror)
1227 {
1228         struct spoolss_DeletePrinter r;
1229         NTSTATUS status;
1230
1231         /* In parameters */
1232         r.in.handle = handle;
1233
1234         if (DEBUGLEVEL >= 10) {
1235                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrinter, &r);
1236         }
1237
1238         status = cli->dispatch(cli,
1239                                 mem_ctx,
1240                                 &ndr_table_spoolss,
1241                                 NDR_SPOOLSS_DELETEPRINTER,
1242                                 &r);
1243
1244         if (!NT_STATUS_IS_OK(status)) {
1245                 return status;
1246         }
1247
1248         if (DEBUGLEVEL >= 10) {
1249                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrinter, &r);
1250         }
1251
1252         if (NT_STATUS_IS_ERR(status)) {
1253                 return status;
1254         }
1255
1256         /* Return variables */
1257
1258         /* Return result */
1259         if (werror) {
1260                 *werror = r.out.result;
1261         }
1262
1263         return werror_to_ntstatus(r.out.result);
1264 }
1265
1266 struct rpccli_spoolss_SetPrinter_state {
1267         struct spoolss_SetPrinter orig;
1268         struct spoolss_SetPrinter tmp;
1269         TALLOC_CTX *out_mem_ctx;
1270         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1271 };
1272
1273 static void rpccli_spoolss_SetPrinter_done(struct tevent_req *subreq);
1274
1275 struct tevent_req *rpccli_spoolss_SetPrinter_send(TALLOC_CTX *mem_ctx,
1276                                                   struct tevent_context *ev,
1277                                                   struct rpc_pipe_client *cli,
1278                                                   struct policy_handle *_handle /* [in] [ref] */,
1279                                                   struct spoolss_SetPrinterInfoCtr *_info_ctr /* [in] [ref] */,
1280                                                   struct spoolss_DevmodeContainer *_devmode_ctr /* [in] [ref] */,
1281                                                   struct sec_desc_buf *_secdesc_ctr /* [in] [ref] */,
1282                                                   enum spoolss_PrinterControl _command /* [in]  */)
1283 {
1284         struct tevent_req *req;
1285         struct rpccli_spoolss_SetPrinter_state *state;
1286         struct tevent_req *subreq;
1287
1288         req = tevent_req_create(mem_ctx, &state,
1289                                 struct rpccli_spoolss_SetPrinter_state);
1290         if (req == NULL) {
1291                 return NULL;
1292         }
1293         state->out_mem_ctx = NULL;
1294         state->dispatch_recv = cli->dispatch_recv;
1295
1296         /* In parameters */
1297         state->orig.in.handle = _handle;
1298         state->orig.in.info_ctr = _info_ctr;
1299         state->orig.in.devmode_ctr = _devmode_ctr;
1300         state->orig.in.secdesc_ctr = _secdesc_ctr;
1301         state->orig.in.command = _command;
1302
1303         /* Out parameters */
1304
1305         /* Result */
1306         ZERO_STRUCT(state->orig.out.result);
1307
1308         if (DEBUGLEVEL >= 10) {
1309                 NDR_PRINT_IN_DEBUG(spoolss_SetPrinter, &state->orig);
1310         }
1311
1312         /* make a temporary copy, that we pass to the dispatch function */
1313         state->tmp = state->orig;
1314
1315         subreq = cli->dispatch_send(state, ev, cli,
1316                                     &ndr_table_spoolss,
1317                                     NDR_SPOOLSS_SETPRINTER,
1318                                     &state->tmp);
1319         if (tevent_req_nomem(subreq, req)) {
1320                 return tevent_req_post(req, ev);
1321         }
1322         tevent_req_set_callback(subreq, rpccli_spoolss_SetPrinter_done, req);
1323         return req;
1324 }
1325
1326 static void rpccli_spoolss_SetPrinter_done(struct tevent_req *subreq)
1327 {
1328         struct tevent_req *req = tevent_req_callback_data(
1329                 subreq, struct tevent_req);
1330         struct rpccli_spoolss_SetPrinter_state *state = tevent_req_data(
1331                 req, struct rpccli_spoolss_SetPrinter_state);
1332         NTSTATUS status;
1333         TALLOC_CTX *mem_ctx;
1334
1335         if (state->out_mem_ctx) {
1336                 mem_ctx = state->out_mem_ctx;
1337         } else {
1338                 mem_ctx = state;
1339         }
1340
1341         status = state->dispatch_recv(subreq, mem_ctx);
1342         TALLOC_FREE(subreq);
1343         if (!NT_STATUS_IS_OK(status)) {
1344                 tevent_req_nterror(req, status);
1345                 return;
1346         }
1347
1348         /* Copy out parameters */
1349
1350         /* Copy result */
1351         state->orig.out.result = state->tmp.out.result;
1352
1353         /* Reset temporary structure */
1354         ZERO_STRUCT(state->tmp);
1355
1356         if (DEBUGLEVEL >= 10) {
1357                 NDR_PRINT_OUT_DEBUG(spoolss_SetPrinter, &state->orig);
1358         }
1359
1360         tevent_req_done(req);
1361 }
1362
1363 NTSTATUS rpccli_spoolss_SetPrinter_recv(struct tevent_req *req,
1364                                         TALLOC_CTX *mem_ctx,
1365                                         WERROR *result)
1366 {
1367         struct rpccli_spoolss_SetPrinter_state *state = tevent_req_data(
1368                 req, struct rpccli_spoolss_SetPrinter_state);
1369         NTSTATUS status;
1370
1371         if (tevent_req_is_nterror(req, &status)) {
1372                 tevent_req_received(req);
1373                 return status;
1374         }
1375
1376         /* Steal possbile out parameters to the callers context */
1377         talloc_steal(mem_ctx, state->out_mem_ctx);
1378
1379         /* Return result */
1380         *result = state->orig.out.result;
1381
1382         tevent_req_received(req);
1383         return NT_STATUS_OK;
1384 }
1385
1386 NTSTATUS rpccli_spoolss_SetPrinter(struct rpc_pipe_client *cli,
1387                                    TALLOC_CTX *mem_ctx,
1388                                    struct policy_handle *handle /* [in] [ref] */,
1389                                    struct spoolss_SetPrinterInfoCtr *info_ctr /* [in] [ref] */,
1390                                    struct spoolss_DevmodeContainer *devmode_ctr /* [in] [ref] */,
1391                                    struct sec_desc_buf *secdesc_ctr /* [in] [ref] */,
1392                                    enum spoolss_PrinterControl command /* [in]  */,
1393                                    WERROR *werror)
1394 {
1395         struct spoolss_SetPrinter r;
1396         NTSTATUS status;
1397
1398         /* In parameters */
1399         r.in.handle = handle;
1400         r.in.info_ctr = info_ctr;
1401         r.in.devmode_ctr = devmode_ctr;
1402         r.in.secdesc_ctr = secdesc_ctr;
1403         r.in.command = command;
1404
1405         if (DEBUGLEVEL >= 10) {
1406                 NDR_PRINT_IN_DEBUG(spoolss_SetPrinter, &r);
1407         }
1408
1409         status = cli->dispatch(cli,
1410                                 mem_ctx,
1411                                 &ndr_table_spoolss,
1412                                 NDR_SPOOLSS_SETPRINTER,
1413                                 &r);
1414
1415         if (!NT_STATUS_IS_OK(status)) {
1416                 return status;
1417         }
1418
1419         if (DEBUGLEVEL >= 10) {
1420                 NDR_PRINT_OUT_DEBUG(spoolss_SetPrinter, &r);
1421         }
1422
1423         if (NT_STATUS_IS_ERR(status)) {
1424                 return status;
1425         }
1426
1427         /* Return variables */
1428
1429         /* Return result */
1430         if (werror) {
1431                 *werror = r.out.result;
1432         }
1433
1434         return werror_to_ntstatus(r.out.result);
1435 }
1436
1437 struct rpccli_spoolss_GetPrinter_state {
1438         struct spoolss_GetPrinter orig;
1439         struct spoolss_GetPrinter tmp;
1440         TALLOC_CTX *out_mem_ctx;
1441         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1442 };
1443
1444 static void rpccli_spoolss_GetPrinter_done(struct tevent_req *subreq);
1445
1446 struct tevent_req *rpccli_spoolss_GetPrinter_send(TALLOC_CTX *mem_ctx,
1447                                                   struct tevent_context *ev,
1448                                                   struct rpc_pipe_client *cli,
1449                                                   struct policy_handle *_handle /* [in] [ref] */,
1450                                                   uint32_t _level /* [in]  */,
1451                                                   DATA_BLOB *_buffer /* [in] [unique] */,
1452                                                   uint32_t _offered /* [in]  */,
1453                                                   union spoolss_PrinterInfo *_info /* [out] [unique,subcontext_size(offered),subcontext(4),switch_is(level)] */,
1454                                                   uint32_t *_needed /* [out] [ref] */)
1455 {
1456         struct tevent_req *req;
1457         struct rpccli_spoolss_GetPrinter_state *state;
1458         struct tevent_req *subreq;
1459
1460         req = tevent_req_create(mem_ctx, &state,
1461                                 struct rpccli_spoolss_GetPrinter_state);
1462         if (req == NULL) {
1463                 return NULL;
1464         }
1465         state->out_mem_ctx = NULL;
1466         state->dispatch_recv = cli->dispatch_recv;
1467
1468         /* In parameters */
1469         state->orig.in.handle = _handle;
1470         state->orig.in.level = _level;
1471         state->orig.in.buffer = _buffer;
1472         state->orig.in.offered = _offered;
1473
1474         /* Out parameters */
1475         state->orig.out.info = _info;
1476         state->orig.out.needed = _needed;
1477
1478         /* Result */
1479         ZERO_STRUCT(state->orig.out.result);
1480
1481         if (DEBUGLEVEL >= 10) {
1482                 NDR_PRINT_IN_DEBUG(spoolss_GetPrinter, &state->orig);
1483         }
1484
1485         state->out_mem_ctx = talloc_named_const(state, 0,
1486                              "rpccli_spoolss_GetPrinter_out_memory");
1487         if (tevent_req_nomem(state->out_mem_ctx, req)) {
1488                 return tevent_req_post(req, ev);
1489         }
1490
1491         /* make a temporary copy, that we pass to the dispatch function */
1492         state->tmp = state->orig;
1493
1494         subreq = cli->dispatch_send(state, ev, cli,
1495                                     &ndr_table_spoolss,
1496                                     NDR_SPOOLSS_GETPRINTER,
1497                                     &state->tmp);
1498         if (tevent_req_nomem(subreq, req)) {
1499                 return tevent_req_post(req, ev);
1500         }
1501         tevent_req_set_callback(subreq, rpccli_spoolss_GetPrinter_done, req);
1502         return req;
1503 }
1504
1505 static void rpccli_spoolss_GetPrinter_done(struct tevent_req *subreq)
1506 {
1507         struct tevent_req *req = tevent_req_callback_data(
1508                 subreq, struct tevent_req);
1509         struct rpccli_spoolss_GetPrinter_state *state = tevent_req_data(
1510                 req, struct rpccli_spoolss_GetPrinter_state);
1511         NTSTATUS status;
1512         TALLOC_CTX *mem_ctx;
1513
1514         if (state->out_mem_ctx) {
1515                 mem_ctx = state->out_mem_ctx;
1516         } else {
1517                 mem_ctx = state;
1518         }
1519
1520         status = state->dispatch_recv(subreq, mem_ctx);
1521         TALLOC_FREE(subreq);
1522         if (!NT_STATUS_IS_OK(status)) {
1523                 tevent_req_nterror(req, status);
1524                 return;
1525         }
1526
1527         /* Copy out parameters */
1528         if (state->orig.out.info && state->tmp.out.info) {
1529                 *state->orig.out.info = *state->tmp.out.info;
1530         }
1531         *state->orig.out.needed = *state->tmp.out.needed;
1532
1533         /* Copy result */
1534         state->orig.out.result = state->tmp.out.result;
1535
1536         /* Reset temporary structure */
1537         ZERO_STRUCT(state->tmp);
1538
1539         if (DEBUGLEVEL >= 10) {
1540                 NDR_PRINT_OUT_DEBUG(spoolss_GetPrinter, &state->orig);
1541         }
1542
1543         tevent_req_done(req);
1544 }
1545
1546 NTSTATUS rpccli_spoolss_GetPrinter_recv(struct tevent_req *req,
1547                                         TALLOC_CTX *mem_ctx,
1548                                         WERROR *result)
1549 {
1550         struct rpccli_spoolss_GetPrinter_state *state = tevent_req_data(
1551                 req, struct rpccli_spoolss_GetPrinter_state);
1552         NTSTATUS status;
1553
1554         if (tevent_req_is_nterror(req, &status)) {
1555                 tevent_req_received(req);
1556                 return status;
1557         }
1558
1559         /* Steal possbile out parameters to the callers context */
1560         talloc_steal(mem_ctx, state->out_mem_ctx);
1561
1562         /* Return result */
1563         *result = state->orig.out.result;
1564
1565         tevent_req_received(req);
1566         return NT_STATUS_OK;
1567 }
1568
1569 NTSTATUS rpccli_spoolss_GetPrinter(struct rpc_pipe_client *cli,
1570                                    TALLOC_CTX *mem_ctx,
1571                                    struct policy_handle *handle /* [in] [ref] */,
1572                                    uint32_t level /* [in]  */,
1573                                    DATA_BLOB *buffer /* [in] [unique] */,
1574                                    uint32_t offered /* [in]  */,
1575                                    union spoolss_PrinterInfo *info /* [out] [unique,subcontext_size(offered),subcontext(4),switch_is(level)] */,
1576                                    uint32_t *needed /* [out] [ref] */,
1577                                    WERROR *werror)
1578 {
1579         struct spoolss_GetPrinter r;
1580         NTSTATUS status;
1581
1582         /* In parameters */
1583         r.in.handle = handle;
1584         r.in.level = level;
1585         r.in.buffer = buffer;
1586         r.in.offered = offered;
1587
1588         if (DEBUGLEVEL >= 10) {
1589                 NDR_PRINT_IN_DEBUG(spoolss_GetPrinter, &r);
1590         }
1591
1592         status = cli->dispatch(cli,
1593                                 mem_ctx,
1594                                 &ndr_table_spoolss,
1595                                 NDR_SPOOLSS_GETPRINTER,
1596                                 &r);
1597
1598         if (!NT_STATUS_IS_OK(status)) {
1599                 return status;
1600         }
1601
1602         if (DEBUGLEVEL >= 10) {
1603                 NDR_PRINT_OUT_DEBUG(spoolss_GetPrinter, &r);
1604         }
1605
1606         if (NT_STATUS_IS_ERR(status)) {
1607                 return status;
1608         }
1609
1610         /* Return variables */
1611         if (info && r.out.info) {
1612                 *info = *r.out.info;
1613         }
1614         *needed = *r.out.needed;
1615
1616         /* Return result */
1617         if (werror) {
1618                 *werror = r.out.result;
1619         }
1620
1621         return werror_to_ntstatus(r.out.result);
1622 }
1623
1624 struct rpccli_spoolss_AddPrinterDriver_state {
1625         struct spoolss_AddPrinterDriver orig;
1626         struct spoolss_AddPrinterDriver tmp;
1627         TALLOC_CTX *out_mem_ctx;
1628         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1629 };
1630
1631 static void rpccli_spoolss_AddPrinterDriver_done(struct tevent_req *subreq);
1632
1633 struct tevent_req *rpccli_spoolss_AddPrinterDriver_send(TALLOC_CTX *mem_ctx,
1634                                                         struct tevent_context *ev,
1635                                                         struct rpc_pipe_client *cli,
1636                                                         const char *_servername /* [in] [unique,charset(UTF16)] */,
1637                                                         struct spoolss_AddDriverInfoCtr *_info_ctr /* [in] [ref] */)
1638 {
1639         struct tevent_req *req;
1640         struct rpccli_spoolss_AddPrinterDriver_state *state;
1641         struct tevent_req *subreq;
1642
1643         req = tevent_req_create(mem_ctx, &state,
1644                                 struct rpccli_spoolss_AddPrinterDriver_state);
1645         if (req == NULL) {
1646                 return NULL;
1647         }
1648         state->out_mem_ctx = NULL;
1649         state->dispatch_recv = cli->dispatch_recv;
1650
1651         /* In parameters */
1652         state->orig.in.servername = _servername;
1653         state->orig.in.info_ctr = _info_ctr;
1654
1655         /* Out parameters */
1656
1657         /* Result */
1658         ZERO_STRUCT(state->orig.out.result);
1659
1660         if (DEBUGLEVEL >= 10) {
1661                 NDR_PRINT_IN_DEBUG(spoolss_AddPrinterDriver, &state->orig);
1662         }
1663
1664         /* make a temporary copy, that we pass to the dispatch function */
1665         state->tmp = state->orig;
1666
1667         subreq = cli->dispatch_send(state, ev, cli,
1668                                     &ndr_table_spoolss,
1669                                     NDR_SPOOLSS_ADDPRINTERDRIVER,
1670                                     &state->tmp);
1671         if (tevent_req_nomem(subreq, req)) {
1672                 return tevent_req_post(req, ev);
1673         }
1674         tevent_req_set_callback(subreq, rpccli_spoolss_AddPrinterDriver_done, req);
1675         return req;
1676 }
1677
1678 static void rpccli_spoolss_AddPrinterDriver_done(struct tevent_req *subreq)
1679 {
1680         struct tevent_req *req = tevent_req_callback_data(
1681                 subreq, struct tevent_req);
1682         struct rpccli_spoolss_AddPrinterDriver_state *state = tevent_req_data(
1683                 req, struct rpccli_spoolss_AddPrinterDriver_state);
1684         NTSTATUS status;
1685         TALLOC_CTX *mem_ctx;
1686
1687         if (state->out_mem_ctx) {
1688                 mem_ctx = state->out_mem_ctx;
1689         } else {
1690                 mem_ctx = state;
1691         }
1692
1693         status = state->dispatch_recv(subreq, mem_ctx);
1694         TALLOC_FREE(subreq);
1695         if (!NT_STATUS_IS_OK(status)) {
1696                 tevent_req_nterror(req, status);
1697                 return;
1698         }
1699
1700         /* Copy out parameters */
1701
1702         /* Copy result */
1703         state->orig.out.result = state->tmp.out.result;
1704
1705         /* Reset temporary structure */
1706         ZERO_STRUCT(state->tmp);
1707
1708         if (DEBUGLEVEL >= 10) {
1709                 NDR_PRINT_OUT_DEBUG(spoolss_AddPrinterDriver, &state->orig);
1710         }
1711
1712         tevent_req_done(req);
1713 }
1714
1715 NTSTATUS rpccli_spoolss_AddPrinterDriver_recv(struct tevent_req *req,
1716                                               TALLOC_CTX *mem_ctx,
1717                                               WERROR *result)
1718 {
1719         struct rpccli_spoolss_AddPrinterDriver_state *state = tevent_req_data(
1720                 req, struct rpccli_spoolss_AddPrinterDriver_state);
1721         NTSTATUS status;
1722
1723         if (tevent_req_is_nterror(req, &status)) {
1724                 tevent_req_received(req);
1725                 return status;
1726         }
1727
1728         /* Steal possbile out parameters to the callers context */
1729         talloc_steal(mem_ctx, state->out_mem_ctx);
1730
1731         /* Return result */
1732         *result = state->orig.out.result;
1733
1734         tevent_req_received(req);
1735         return NT_STATUS_OK;
1736 }
1737
1738 NTSTATUS rpccli_spoolss_AddPrinterDriver(struct rpc_pipe_client *cli,
1739                                          TALLOC_CTX *mem_ctx,
1740                                          const char *servername /* [in] [unique,charset(UTF16)] */,
1741                                          struct spoolss_AddDriverInfoCtr *info_ctr /* [in] [ref] */,
1742                                          WERROR *werror)
1743 {
1744         struct spoolss_AddPrinterDriver r;
1745         NTSTATUS status;
1746
1747         /* In parameters */
1748         r.in.servername = servername;
1749         r.in.info_ctr = info_ctr;
1750
1751         if (DEBUGLEVEL >= 10) {
1752                 NDR_PRINT_IN_DEBUG(spoolss_AddPrinterDriver, &r);
1753         }
1754
1755         status = cli->dispatch(cli,
1756                                 mem_ctx,
1757                                 &ndr_table_spoolss,
1758                                 NDR_SPOOLSS_ADDPRINTERDRIVER,
1759                                 &r);
1760
1761         if (!NT_STATUS_IS_OK(status)) {
1762                 return status;
1763         }
1764
1765         if (DEBUGLEVEL >= 10) {
1766                 NDR_PRINT_OUT_DEBUG(spoolss_AddPrinterDriver, &r);
1767         }
1768
1769         if (NT_STATUS_IS_ERR(status)) {
1770                 return status;
1771         }
1772
1773         /* Return variables */
1774
1775         /* Return result */
1776         if (werror) {
1777                 *werror = r.out.result;
1778         }
1779
1780         return werror_to_ntstatus(r.out.result);
1781 }
1782
1783 struct rpccli_spoolss_EnumPrinterDrivers_state {
1784         struct spoolss_EnumPrinterDrivers orig;
1785         struct spoolss_EnumPrinterDrivers tmp;
1786         TALLOC_CTX *out_mem_ctx;
1787         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1788 };
1789
1790 static void rpccli_spoolss_EnumPrinterDrivers_done(struct tevent_req *subreq);
1791
1792 struct tevent_req *rpccli_spoolss_EnumPrinterDrivers_send(TALLOC_CTX *mem_ctx,
1793                                                           struct tevent_context *ev,
1794                                                           struct rpc_pipe_client *cli,
1795                                                           const char *_server /* [in] [unique,charset(UTF16)] */,
1796                                                           const char *_environment /* [in] [unique,charset(UTF16)] */,
1797                                                           uint32_t _level /* [in]  */,
1798                                                           DATA_BLOB *_buffer /* [in] [unique] */,
1799                                                           uint32_t _offered /* [in]  */,
1800                                                           uint32_t *_count /* [out] [ref] */,
1801                                                           union spoolss_DriverInfo **_info /* [out] [ref,switch_is(level),size_is(,*count)] */,
1802                                                           uint32_t *_needed /* [out] [ref] */)
1803 {
1804         struct tevent_req *req;
1805         struct rpccli_spoolss_EnumPrinterDrivers_state *state;
1806         struct tevent_req *subreq;
1807
1808         req = tevent_req_create(mem_ctx, &state,
1809                                 struct rpccli_spoolss_EnumPrinterDrivers_state);
1810         if (req == NULL) {
1811                 return NULL;
1812         }
1813         state->out_mem_ctx = NULL;
1814         state->dispatch_recv = cli->dispatch_recv;
1815
1816         /* In parameters */
1817         state->orig.in.server = _server;
1818         state->orig.in.environment = _environment;
1819         state->orig.in.level = _level;
1820         state->orig.in.buffer = _buffer;
1821         state->orig.in.offered = _offered;
1822
1823         /* Out parameters */
1824         state->orig.out.count = _count;
1825         state->orig.out.info = _info;
1826         state->orig.out.needed = _needed;
1827
1828         /* Result */
1829         ZERO_STRUCT(state->orig.out.result);
1830
1831         if (DEBUGLEVEL >= 10) {
1832                 NDR_PRINT_IN_DEBUG(spoolss_EnumPrinterDrivers, &state->orig);
1833         }
1834
1835         state->out_mem_ctx = talloc_named_const(state, 0,
1836                              "rpccli_spoolss_EnumPrinterDrivers_out_memory");
1837         if (tevent_req_nomem(state->out_mem_ctx, req)) {
1838                 return tevent_req_post(req, ev);
1839         }
1840
1841         /* make a temporary copy, that we pass to the dispatch function */
1842         state->tmp = state->orig;
1843
1844         subreq = cli->dispatch_send(state, ev, cli,
1845                                     &ndr_table_spoolss,
1846                                     NDR_SPOOLSS_ENUMPRINTERDRIVERS,
1847                                     &state->tmp);
1848         if (tevent_req_nomem(subreq, req)) {
1849                 return tevent_req_post(req, ev);
1850         }
1851         tevent_req_set_callback(subreq, rpccli_spoolss_EnumPrinterDrivers_done, req);
1852         return req;
1853 }
1854
1855 static void rpccli_spoolss_EnumPrinterDrivers_done(struct tevent_req *subreq)
1856 {
1857         struct tevent_req *req = tevent_req_callback_data(
1858                 subreq, struct tevent_req);
1859         struct rpccli_spoolss_EnumPrinterDrivers_state *state = tevent_req_data(
1860                 req, struct rpccli_spoolss_EnumPrinterDrivers_state);
1861         NTSTATUS status;
1862         TALLOC_CTX *mem_ctx;
1863
1864         if (state->out_mem_ctx) {
1865                 mem_ctx = state->out_mem_ctx;
1866         } else {
1867                 mem_ctx = state;
1868         }
1869
1870         status = state->dispatch_recv(subreq, mem_ctx);
1871         TALLOC_FREE(subreq);
1872         if (!NT_STATUS_IS_OK(status)) {
1873                 tevent_req_nterror(req, status);
1874                 return;
1875         }
1876
1877         /* Copy out parameters */
1878         *state->orig.out.count = *state->tmp.out.count;
1879         *state->orig.out.info = *state->tmp.out.info;
1880         *state->orig.out.needed = *state->tmp.out.needed;
1881
1882         /* Copy result */
1883         state->orig.out.result = state->tmp.out.result;
1884
1885         /* Reset temporary structure */
1886         ZERO_STRUCT(state->tmp);
1887
1888         if (DEBUGLEVEL >= 10) {
1889                 NDR_PRINT_OUT_DEBUG(spoolss_EnumPrinterDrivers, &state->orig);
1890         }
1891
1892         tevent_req_done(req);
1893 }
1894
1895 NTSTATUS rpccli_spoolss_EnumPrinterDrivers_recv(struct tevent_req *req,
1896                                                 TALLOC_CTX *mem_ctx,
1897                                                 WERROR *result)
1898 {
1899         struct rpccli_spoolss_EnumPrinterDrivers_state *state = tevent_req_data(
1900                 req, struct rpccli_spoolss_EnumPrinterDrivers_state);
1901         NTSTATUS status;
1902
1903         if (tevent_req_is_nterror(req, &status)) {
1904                 tevent_req_received(req);
1905                 return status;
1906         }
1907
1908         /* Steal possbile out parameters to the callers context */
1909         talloc_steal(mem_ctx, state->out_mem_ctx);
1910
1911         /* Return result */
1912         *result = state->orig.out.result;
1913
1914         tevent_req_received(req);
1915         return NT_STATUS_OK;
1916 }
1917
1918 NTSTATUS rpccli_spoolss_EnumPrinterDrivers(struct rpc_pipe_client *cli,
1919                                            TALLOC_CTX *mem_ctx,
1920                                            const char *server /* [in] [unique,charset(UTF16)] */,
1921                                            const char *environment /* [in] [unique,charset(UTF16)] */,
1922                                            uint32_t level /* [in]  */,
1923                                            DATA_BLOB *buffer /* [in] [unique] */,
1924                                            uint32_t offered /* [in]  */,
1925                                            uint32_t *count /* [out] [ref] */,
1926                                            union spoolss_DriverInfo **info /* [out] [ref,switch_is(level),size_is(,*count)] */,
1927                                            uint32_t *needed /* [out] [ref] */,
1928                                            WERROR *werror)
1929 {
1930         struct spoolss_EnumPrinterDrivers r;
1931         NTSTATUS status;
1932
1933         /* In parameters */
1934         r.in.server = server;
1935         r.in.environment = environment;
1936         r.in.level = level;
1937         r.in.buffer = buffer;
1938         r.in.offered = offered;
1939
1940         if (DEBUGLEVEL >= 10) {
1941                 NDR_PRINT_IN_DEBUG(spoolss_EnumPrinterDrivers, &r);
1942         }
1943
1944         status = cli->dispatch(cli,
1945                                 mem_ctx,
1946                                 &ndr_table_spoolss,
1947                                 NDR_SPOOLSS_ENUMPRINTERDRIVERS,
1948                                 &r);
1949
1950         if (!NT_STATUS_IS_OK(status)) {
1951                 return status;
1952         }
1953
1954         if (DEBUGLEVEL >= 10) {
1955                 NDR_PRINT_OUT_DEBUG(spoolss_EnumPrinterDrivers, &r);
1956         }
1957
1958         if (NT_STATUS_IS_ERR(status)) {
1959                 return status;
1960         }
1961
1962         /* Return variables */
1963         *count = *r.out.count;
1964         *info = *r.out.info;
1965         *needed = *r.out.needed;
1966
1967         /* Return result */
1968         if (werror) {
1969                 *werror = r.out.result;
1970         }
1971
1972         return werror_to_ntstatus(r.out.result);
1973 }
1974
1975 struct rpccli_spoolss_GetPrinterDriver_state {
1976         struct spoolss_GetPrinterDriver orig;
1977         struct spoolss_GetPrinterDriver tmp;
1978         TALLOC_CTX *out_mem_ctx;
1979         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1980 };
1981
1982 static void rpccli_spoolss_GetPrinterDriver_done(struct tevent_req *subreq);
1983
1984 struct tevent_req *rpccli_spoolss_GetPrinterDriver_send(TALLOC_CTX *mem_ctx,
1985                                                         struct tevent_context *ev,
1986                                                         struct rpc_pipe_client *cli,
1987                                                         struct policy_handle *_handle /* [in] [ref] */,
1988                                                         const char *_architecture /* [in] [unique,charset(UTF16)] */,
1989                                                         uint32_t _level /* [in]  */,
1990                                                         DATA_BLOB *_buffer /* [in] [unique] */,
1991                                                         uint32_t _offered /* [in]  */,
1992                                                         union spoolss_DriverInfo *_info /* [out] [unique,subcontext_size(offered),subcontext(4),switch_is(level)] */,
1993                                                         uint32_t *_needed /* [out] [ref] */)
1994 {
1995         struct tevent_req *req;
1996         struct rpccli_spoolss_GetPrinterDriver_state *state;
1997         struct tevent_req *subreq;
1998
1999         req = tevent_req_create(mem_ctx, &state,
2000                                 struct rpccli_spoolss_GetPrinterDriver_state);
2001         if (req == NULL) {
2002                 return NULL;
2003         }
2004         state->out_mem_ctx = NULL;
2005         state->dispatch_recv = cli->dispatch_recv;
2006
2007         /* In parameters */
2008         state->orig.in.handle = _handle;
2009         state->orig.in.architecture = _architecture;
2010         state->orig.in.level = _level;
2011         state->orig.in.buffer = _buffer;
2012         state->orig.in.offered = _offered;
2013
2014         /* Out parameters */
2015         state->orig.out.info = _info;
2016         state->orig.out.needed = _needed;
2017
2018         /* Result */
2019         ZERO_STRUCT(state->orig.out.result);
2020
2021         if (DEBUGLEVEL >= 10) {
2022                 NDR_PRINT_IN_DEBUG(spoolss_GetPrinterDriver, &state->orig);
2023         }
2024
2025         state->out_mem_ctx = talloc_named_const(state, 0,
2026                              "rpccli_spoolss_GetPrinterDriver_out_memory");
2027         if (tevent_req_nomem(state->out_mem_ctx, req)) {
2028                 return tevent_req_post(req, ev);
2029         }
2030
2031         /* make a temporary copy, that we pass to the dispatch function */
2032         state->tmp = state->orig;
2033
2034         subreq = cli->dispatch_send(state, ev, cli,
2035                                     &ndr_table_spoolss,
2036                                     NDR_SPOOLSS_GETPRINTERDRIVER,
2037                                     &state->tmp);
2038         if (tevent_req_nomem(subreq, req)) {
2039                 return tevent_req_post(req, ev);
2040         }
2041         tevent_req_set_callback(subreq, rpccli_spoolss_GetPrinterDriver_done, req);
2042         return req;
2043 }
2044
2045 static void rpccli_spoolss_GetPrinterDriver_done(struct tevent_req *subreq)
2046 {
2047         struct tevent_req *req = tevent_req_callback_data(
2048                 subreq, struct tevent_req);
2049         struct rpccli_spoolss_GetPrinterDriver_state *state = tevent_req_data(
2050                 req, struct rpccli_spoolss_GetPrinterDriver_state);
2051         NTSTATUS status;
2052         TALLOC_CTX *mem_ctx;
2053
2054         if (state->out_mem_ctx) {
2055                 mem_ctx = state->out_mem_ctx;
2056         } else {
2057                 mem_ctx = state;
2058         }
2059
2060         status = state->dispatch_recv(subreq, mem_ctx);
2061         TALLOC_FREE(subreq);
2062         if (!NT_STATUS_IS_OK(status)) {
2063                 tevent_req_nterror(req, status);
2064                 return;
2065         }
2066
2067         /* Copy out parameters */
2068         if (state->orig.out.info && state->tmp.out.info) {
2069                 *state->orig.out.info = *state->tmp.out.info;
2070         }
2071         *state->orig.out.needed = *state->tmp.out.needed;
2072
2073         /* Copy result */
2074         state->orig.out.result = state->tmp.out.result;
2075
2076         /* Reset temporary structure */
2077         ZERO_STRUCT(state->tmp);
2078
2079         if (DEBUGLEVEL >= 10) {
2080                 NDR_PRINT_OUT_DEBUG(spoolss_GetPrinterDriver, &state->orig);
2081         }
2082
2083         tevent_req_done(req);
2084 }
2085
2086 NTSTATUS rpccli_spoolss_GetPrinterDriver_recv(struct tevent_req *req,
2087                                               TALLOC_CTX *mem_ctx,
2088                                               WERROR *result)
2089 {
2090         struct rpccli_spoolss_GetPrinterDriver_state *state = tevent_req_data(
2091                 req, struct rpccli_spoolss_GetPrinterDriver_state);
2092         NTSTATUS status;
2093
2094         if (tevent_req_is_nterror(req, &status)) {
2095                 tevent_req_received(req);
2096                 return status;
2097         }
2098
2099         /* Steal possbile out parameters to the callers context */
2100         talloc_steal(mem_ctx, state->out_mem_ctx);
2101
2102         /* Return result */
2103         *result = state->orig.out.result;
2104
2105         tevent_req_received(req);
2106         return NT_STATUS_OK;
2107 }
2108
2109 NTSTATUS rpccli_spoolss_GetPrinterDriver(struct rpc_pipe_client *cli,
2110                                          TALLOC_CTX *mem_ctx,
2111                                          struct policy_handle *handle /* [in] [ref] */,
2112                                          const char *architecture /* [in] [unique,charset(UTF16)] */,
2113                                          uint32_t level /* [in]  */,
2114                                          DATA_BLOB *buffer /* [in] [unique] */,
2115                                          uint32_t offered /* [in]  */,
2116                                          union spoolss_DriverInfo *info /* [out] [unique,subcontext_size(offered),subcontext(4),switch_is(level)] */,
2117                                          uint32_t *needed /* [out] [ref] */,
2118                                          WERROR *werror)
2119 {
2120         struct spoolss_GetPrinterDriver r;
2121         NTSTATUS status;
2122
2123         /* In parameters */
2124         r.in.handle = handle;
2125         r.in.architecture = architecture;
2126         r.in.level = level;
2127         r.in.buffer = buffer;
2128         r.in.offered = offered;
2129
2130         if (DEBUGLEVEL >= 10) {
2131                 NDR_PRINT_IN_DEBUG(spoolss_GetPrinterDriver, &r);
2132         }
2133
2134         status = cli->dispatch(cli,
2135                                 mem_ctx,
2136                                 &ndr_table_spoolss,
2137                                 NDR_SPOOLSS_GETPRINTERDRIVER,
2138                                 &r);
2139
2140         if (!NT_STATUS_IS_OK(status)) {
2141                 return status;
2142         }
2143
2144         if (DEBUGLEVEL >= 10) {
2145                 NDR_PRINT_OUT_DEBUG(spoolss_GetPrinterDriver, &r);
2146         }
2147
2148         if (NT_STATUS_IS_ERR(status)) {
2149                 return status;
2150         }
2151
2152         /* Return variables */
2153         if (info && r.out.info) {
2154                 *info = *r.out.info;
2155         }
2156         *needed = *r.out.needed;
2157
2158         /* Return result */
2159         if (werror) {
2160                 *werror = r.out.result;
2161         }
2162
2163         return werror_to_ntstatus(r.out.result);
2164 }
2165
2166 struct rpccli_spoolss_GetPrinterDriverDirectory_state {
2167         struct spoolss_GetPrinterDriverDirectory orig;
2168         struct spoolss_GetPrinterDriverDirectory tmp;
2169         TALLOC_CTX *out_mem_ctx;
2170         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2171 };
2172
2173 static void rpccli_spoolss_GetPrinterDriverDirectory_done(struct tevent_req *subreq);
2174
2175 struct tevent_req *rpccli_spoolss_GetPrinterDriverDirectory_send(TALLOC_CTX *mem_ctx,
2176                                                                  struct tevent_context *ev,
2177                                                                  struct rpc_pipe_client *cli,
2178                                                                  const char *_server /* [in] [unique,charset(UTF16)] */,
2179                                                                  const char *_environment /* [in] [unique,charset(UTF16)] */,
2180                                                                  uint32_t _level /* [in]  */,
2181                                                                  DATA_BLOB *_buffer /* [in] [unique] */,
2182                                                                  uint32_t _offered /* [in]  */,
2183                                                                  union spoolss_DriverDirectoryInfo *_info /* [out] [unique,subcontext_size(offered),subcontext(4),switch_is(level)] */,
2184                                                                  uint32_t *_needed /* [out] [ref] */)
2185 {
2186         struct tevent_req *req;
2187         struct rpccli_spoolss_GetPrinterDriverDirectory_state *state;
2188         struct tevent_req *subreq;
2189
2190         req = tevent_req_create(mem_ctx, &state,
2191                                 struct rpccli_spoolss_GetPrinterDriverDirectory_state);
2192         if (req == NULL) {
2193                 return NULL;
2194         }
2195         state->out_mem_ctx = NULL;
2196         state->dispatch_recv = cli->dispatch_recv;
2197
2198         /* In parameters */
2199         state->orig.in.server = _server;
2200         state->orig.in.environment = _environment;
2201         state->orig.in.level = _level;
2202         state->orig.in.buffer = _buffer;
2203         state->orig.in.offered = _offered;
2204
2205         /* Out parameters */
2206         state->orig.out.info = _info;
2207         state->orig.out.needed = _needed;
2208
2209         /* Result */
2210         ZERO_STRUCT(state->orig.out.result);
2211
2212         if (DEBUGLEVEL >= 10) {
2213                 NDR_PRINT_IN_DEBUG(spoolss_GetPrinterDriverDirectory, &state->orig);
2214         }
2215
2216         state->out_mem_ctx = talloc_named_const(state, 0,
2217                              "rpccli_spoolss_GetPrinterDriverDirectory_out_memory");
2218         if (tevent_req_nomem(state->out_mem_ctx, req)) {
2219                 return tevent_req_post(req, ev);
2220         }
2221
2222         /* make a temporary copy, that we pass to the dispatch function */
2223         state->tmp = state->orig;
2224
2225         subreq = cli->dispatch_send(state, ev, cli,
2226                                     &ndr_table_spoolss,
2227                                     NDR_SPOOLSS_GETPRINTERDRIVERDIRECTORY,
2228                                     &state->tmp);
2229         if (tevent_req_nomem(subreq, req)) {
2230                 return tevent_req_post(req, ev);
2231         }
2232         tevent_req_set_callback(subreq, rpccli_spoolss_GetPrinterDriverDirectory_done, req);
2233         return req;
2234 }
2235
2236 static void rpccli_spoolss_GetPrinterDriverDirectory_done(struct tevent_req *subreq)
2237 {
2238         struct tevent_req *req = tevent_req_callback_data(
2239                 subreq, struct tevent_req);
2240         struct rpccli_spoolss_GetPrinterDriverDirectory_state *state = tevent_req_data(
2241                 req, struct rpccli_spoolss_GetPrinterDriverDirectory_state);
2242         NTSTATUS status;
2243         TALLOC_CTX *mem_ctx;
2244
2245         if (state->out_mem_ctx) {
2246                 mem_ctx = state->out_mem_ctx;
2247         } else {
2248                 mem_ctx = state;
2249         }
2250
2251         status = state->dispatch_recv(subreq, mem_ctx);
2252         TALLOC_FREE(subreq);
2253         if (!NT_STATUS_IS_OK(status)) {
2254                 tevent_req_nterror(req, status);
2255                 return;
2256         }
2257
2258         /* Copy out parameters */
2259         if (state->orig.out.info && state->tmp.out.info) {
2260                 *state->orig.out.info = *state->tmp.out.info;
2261         }
2262         *state->orig.out.needed = *state->tmp.out.needed;
2263
2264         /* Copy result */
2265         state->orig.out.result = state->tmp.out.result;
2266
2267         /* Reset temporary structure */
2268         ZERO_STRUCT(state->tmp);
2269
2270         if (DEBUGLEVEL >= 10) {
2271                 NDR_PRINT_OUT_DEBUG(spoolss_GetPrinterDriverDirectory, &state->orig);
2272         }
2273
2274         tevent_req_done(req);
2275 }
2276
2277 NTSTATUS rpccli_spoolss_GetPrinterDriverDirectory_recv(struct tevent_req *req,
2278                                                        TALLOC_CTX *mem_ctx,
2279                                                        WERROR *result)
2280 {
2281         struct rpccli_spoolss_GetPrinterDriverDirectory_state *state = tevent_req_data(
2282                 req, struct rpccli_spoolss_GetPrinterDriverDirectory_state);
2283         NTSTATUS status;
2284
2285         if (tevent_req_is_nterror(req, &status)) {
2286                 tevent_req_received(req);
2287                 return status;
2288         }
2289
2290         /* Steal possbile out parameters to the callers context */
2291         talloc_steal(mem_ctx, state->out_mem_ctx);
2292
2293         /* Return result */
2294         *result = state->orig.out.result;
2295
2296         tevent_req_received(req);
2297         return NT_STATUS_OK;
2298 }
2299
2300 NTSTATUS rpccli_spoolss_GetPrinterDriverDirectory(struct rpc_pipe_client *cli,
2301                                                   TALLOC_CTX *mem_ctx,
2302                                                   const char *server /* [in] [unique,charset(UTF16)] */,
2303                                                   const char *environment /* [in] [unique,charset(UTF16)] */,
2304                                                   uint32_t level /* [in]  */,
2305                                                   DATA_BLOB *buffer /* [in] [unique] */,
2306                                                   uint32_t offered /* [in]  */,
2307                                                   union spoolss_DriverDirectoryInfo *info /* [out] [unique,subcontext_size(offered),subcontext(4),switch_is(level)] */,
2308                                                   uint32_t *needed /* [out] [ref] */,
2309                                                   WERROR *werror)
2310 {
2311         struct spoolss_GetPrinterDriverDirectory r;
2312         NTSTATUS status;
2313
2314         /* In parameters */
2315         r.in.server = server;
2316         r.in.environment = environment;
2317         r.in.level = level;
2318         r.in.buffer = buffer;
2319         r.in.offered = offered;
2320
2321         if (DEBUGLEVEL >= 10) {
2322                 NDR_PRINT_IN_DEBUG(spoolss_GetPrinterDriverDirectory, &r);
2323         }
2324
2325         status = cli->dispatch(cli,
2326                                 mem_ctx,
2327                                 &ndr_table_spoolss,
2328                                 NDR_SPOOLSS_GETPRINTERDRIVERDIRECTORY,
2329                                 &r);
2330
2331         if (!NT_STATUS_IS_OK(status)) {
2332                 return status;
2333         }
2334
2335         if (DEBUGLEVEL >= 10) {
2336                 NDR_PRINT_OUT_DEBUG(spoolss_GetPrinterDriverDirectory, &r);
2337         }
2338
2339         if (NT_STATUS_IS_ERR(status)) {
2340                 return status;
2341         }
2342
2343         /* Return variables */
2344         if (info && r.out.info) {
2345                 *info = *r.out.info;
2346         }
2347         *needed = *r.out.needed;
2348
2349         /* Return result */
2350         if (werror) {
2351                 *werror = r.out.result;
2352         }
2353
2354         return werror_to_ntstatus(r.out.result);
2355 }
2356
2357 struct rpccli_spoolss_DeletePrinterDriver_state {
2358         struct spoolss_DeletePrinterDriver orig;
2359         struct spoolss_DeletePrinterDriver tmp;
2360         TALLOC_CTX *out_mem_ctx;
2361         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2362 };
2363
2364 static void rpccli_spoolss_DeletePrinterDriver_done(struct tevent_req *subreq);
2365
2366 struct tevent_req *rpccli_spoolss_DeletePrinterDriver_send(TALLOC_CTX *mem_ctx,
2367                                                            struct tevent_context *ev,
2368                                                            struct rpc_pipe_client *cli,
2369                                                            const char *_server /* [in] [unique,charset(UTF16)] */,
2370                                                            const char *_architecture /* [in] [charset(UTF16)] */,
2371                                                            const char *_driver /* [in] [charset(UTF16)] */)
2372 {
2373         struct tevent_req *req;
2374         struct rpccli_spoolss_DeletePrinterDriver_state *state;
2375         struct tevent_req *subreq;
2376
2377         req = tevent_req_create(mem_ctx, &state,
2378                                 struct rpccli_spoolss_DeletePrinterDriver_state);
2379         if (req == NULL) {
2380                 return NULL;
2381         }
2382         state->out_mem_ctx = NULL;
2383         state->dispatch_recv = cli->dispatch_recv;
2384
2385         /* In parameters */
2386         state->orig.in.server = _server;
2387         state->orig.in.architecture = _architecture;
2388         state->orig.in.driver = _driver;
2389
2390         /* Out parameters */
2391
2392         /* Result */
2393         ZERO_STRUCT(state->orig.out.result);
2394
2395         if (DEBUGLEVEL >= 10) {
2396                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrinterDriver, &state->orig);
2397         }
2398
2399         /* make a temporary copy, that we pass to the dispatch function */
2400         state->tmp = state->orig;
2401
2402         subreq = cli->dispatch_send(state, ev, cli,
2403                                     &ndr_table_spoolss,
2404                                     NDR_SPOOLSS_DELETEPRINTERDRIVER,
2405                                     &state->tmp);
2406         if (tevent_req_nomem(subreq, req)) {
2407                 return tevent_req_post(req, ev);
2408         }
2409         tevent_req_set_callback(subreq, rpccli_spoolss_DeletePrinterDriver_done, req);
2410         return req;
2411 }
2412
2413 static void rpccli_spoolss_DeletePrinterDriver_done(struct tevent_req *subreq)
2414 {
2415         struct tevent_req *req = tevent_req_callback_data(
2416                 subreq, struct tevent_req);
2417         struct rpccli_spoolss_DeletePrinterDriver_state *state = tevent_req_data(
2418                 req, struct rpccli_spoolss_DeletePrinterDriver_state);
2419         NTSTATUS status;
2420         TALLOC_CTX *mem_ctx;
2421
2422         if (state->out_mem_ctx) {
2423                 mem_ctx = state->out_mem_ctx;
2424         } else {
2425                 mem_ctx = state;
2426         }
2427
2428         status = state->dispatch_recv(subreq, mem_ctx);
2429         TALLOC_FREE(subreq);
2430         if (!NT_STATUS_IS_OK(status)) {
2431                 tevent_req_nterror(req, status);
2432                 return;
2433         }
2434
2435         /* Copy out parameters */
2436
2437         /* Copy result */
2438         state->orig.out.result = state->tmp.out.result;
2439
2440         /* Reset temporary structure */
2441         ZERO_STRUCT(state->tmp);
2442
2443         if (DEBUGLEVEL >= 10) {
2444                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrinterDriver, &state->orig);
2445         }
2446
2447         tevent_req_done(req);
2448 }
2449
2450 NTSTATUS rpccli_spoolss_DeletePrinterDriver_recv(struct tevent_req *req,
2451                                                  TALLOC_CTX *mem_ctx,
2452                                                  WERROR *result)
2453 {
2454         struct rpccli_spoolss_DeletePrinterDriver_state *state = tevent_req_data(
2455                 req, struct rpccli_spoolss_DeletePrinterDriver_state);
2456         NTSTATUS status;
2457
2458         if (tevent_req_is_nterror(req, &status)) {
2459                 tevent_req_received(req);
2460                 return status;
2461         }
2462
2463         /* Steal possbile out parameters to the callers context */
2464         talloc_steal(mem_ctx, state->out_mem_ctx);
2465
2466         /* Return result */
2467         *result = state->orig.out.result;
2468
2469         tevent_req_received(req);
2470         return NT_STATUS_OK;
2471 }
2472
2473 NTSTATUS rpccli_spoolss_DeletePrinterDriver(struct rpc_pipe_client *cli,
2474                                             TALLOC_CTX *mem_ctx,
2475                                             const char *server /* [in] [unique,charset(UTF16)] */,
2476                                             const char *architecture /* [in] [charset(UTF16)] */,
2477                                             const char *driver /* [in] [charset(UTF16)] */,
2478                                             WERROR *werror)
2479 {
2480         struct spoolss_DeletePrinterDriver r;
2481         NTSTATUS status;
2482
2483         /* In parameters */
2484         r.in.server = server;
2485         r.in.architecture = architecture;
2486         r.in.driver = driver;
2487
2488         if (DEBUGLEVEL >= 10) {
2489                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrinterDriver, &r);
2490         }
2491
2492         status = cli->dispatch(cli,
2493                                 mem_ctx,
2494                                 &ndr_table_spoolss,
2495                                 NDR_SPOOLSS_DELETEPRINTERDRIVER,
2496                                 &r);
2497
2498         if (!NT_STATUS_IS_OK(status)) {
2499                 return status;
2500         }
2501
2502         if (DEBUGLEVEL >= 10) {
2503                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrinterDriver, &r);
2504         }
2505
2506         if (NT_STATUS_IS_ERR(status)) {
2507                 return status;
2508         }
2509
2510         /* Return variables */
2511
2512         /* Return result */
2513         if (werror) {
2514                 *werror = r.out.result;
2515         }
2516
2517         return werror_to_ntstatus(r.out.result);
2518 }
2519
2520 struct rpccli_spoolss_AddPrintProcessor_state {
2521         struct spoolss_AddPrintProcessor orig;
2522         struct spoolss_AddPrintProcessor tmp;
2523         TALLOC_CTX *out_mem_ctx;
2524         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2525 };
2526
2527 static void rpccli_spoolss_AddPrintProcessor_done(struct tevent_req *subreq);
2528
2529 struct tevent_req *rpccli_spoolss_AddPrintProcessor_send(TALLOC_CTX *mem_ctx,
2530                                                          struct tevent_context *ev,
2531                                                          struct rpc_pipe_client *cli,
2532                                                          const char *_server /* [in] [unique,charset(UTF16)] */,
2533                                                          const char *_architecture /* [in] [charset(UTF16)] */,
2534                                                          const char *_path_name /* [in] [charset(UTF16)] */,
2535                                                          const char *_print_processor_name /* [in] [charset(UTF16)] */)
2536 {
2537         struct tevent_req *req;
2538         struct rpccli_spoolss_AddPrintProcessor_state *state;
2539         struct tevent_req *subreq;
2540
2541         req = tevent_req_create(mem_ctx, &state,
2542                                 struct rpccli_spoolss_AddPrintProcessor_state);
2543         if (req == NULL) {
2544                 return NULL;
2545         }
2546         state->out_mem_ctx = NULL;
2547         state->dispatch_recv = cli->dispatch_recv;
2548
2549         /* In parameters */
2550         state->orig.in.server = _server;
2551         state->orig.in.architecture = _architecture;
2552         state->orig.in.path_name = _path_name;
2553         state->orig.in.print_processor_name = _print_processor_name;
2554
2555         /* Out parameters */
2556
2557         /* Result */
2558         ZERO_STRUCT(state->orig.out.result);
2559
2560         if (DEBUGLEVEL >= 10) {
2561                 NDR_PRINT_IN_DEBUG(spoolss_AddPrintProcessor, &state->orig);
2562         }
2563
2564         /* make a temporary copy, that we pass to the dispatch function */
2565         state->tmp = state->orig;
2566
2567         subreq = cli->dispatch_send(state, ev, cli,
2568                                     &ndr_table_spoolss,
2569                                     NDR_SPOOLSS_ADDPRINTPROCESSOR,
2570                                     &state->tmp);
2571         if (tevent_req_nomem(subreq, req)) {
2572                 return tevent_req_post(req, ev);
2573         }
2574         tevent_req_set_callback(subreq, rpccli_spoolss_AddPrintProcessor_done, req);
2575         return req;
2576 }
2577
2578 static void rpccli_spoolss_AddPrintProcessor_done(struct tevent_req *subreq)
2579 {
2580         struct tevent_req *req = tevent_req_callback_data(
2581                 subreq, struct tevent_req);
2582         struct rpccli_spoolss_AddPrintProcessor_state *state = tevent_req_data(
2583                 req, struct rpccli_spoolss_AddPrintProcessor_state);
2584         NTSTATUS status;
2585         TALLOC_CTX *mem_ctx;
2586
2587         if (state->out_mem_ctx) {
2588                 mem_ctx = state->out_mem_ctx;
2589         } else {
2590                 mem_ctx = state;
2591         }
2592
2593         status = state->dispatch_recv(subreq, mem_ctx);
2594         TALLOC_FREE(subreq);
2595         if (!NT_STATUS_IS_OK(status)) {
2596                 tevent_req_nterror(req, status);
2597                 return;
2598         }
2599
2600         /* Copy out parameters */
2601
2602         /* Copy result */
2603         state->orig.out.result = state->tmp.out.result;
2604
2605         /* Reset temporary structure */
2606         ZERO_STRUCT(state->tmp);
2607
2608         if (DEBUGLEVEL >= 10) {
2609                 NDR_PRINT_OUT_DEBUG(spoolss_AddPrintProcessor, &state->orig);
2610         }
2611
2612         tevent_req_done(req);
2613 }
2614
2615 NTSTATUS rpccli_spoolss_AddPrintProcessor_recv(struct tevent_req *req,
2616                                                TALLOC_CTX *mem_ctx,
2617                                                WERROR *result)
2618 {
2619         struct rpccli_spoolss_AddPrintProcessor_state *state = tevent_req_data(
2620                 req, struct rpccli_spoolss_AddPrintProcessor_state);
2621         NTSTATUS status;
2622
2623         if (tevent_req_is_nterror(req, &status)) {
2624                 tevent_req_received(req);
2625                 return status;
2626         }
2627
2628         /* Steal possbile out parameters to the callers context */
2629         talloc_steal(mem_ctx, state->out_mem_ctx);
2630
2631         /* Return result */
2632         *result = state->orig.out.result;
2633
2634         tevent_req_received(req);
2635         return NT_STATUS_OK;
2636 }
2637
2638 NTSTATUS rpccli_spoolss_AddPrintProcessor(struct rpc_pipe_client *cli,
2639                                           TALLOC_CTX *mem_ctx,
2640                                           const char *server /* [in] [unique,charset(UTF16)] */,
2641                                           const char *architecture /* [in] [charset(UTF16)] */,
2642                                           const char *path_name /* [in] [charset(UTF16)] */,
2643                                           const char *print_processor_name /* [in] [charset(UTF16)] */,
2644                                           WERROR *werror)
2645 {
2646         struct spoolss_AddPrintProcessor r;
2647         NTSTATUS status;
2648
2649         /* In parameters */
2650         r.in.server = server;
2651         r.in.architecture = architecture;
2652         r.in.path_name = path_name;
2653         r.in.print_processor_name = print_processor_name;
2654
2655         if (DEBUGLEVEL >= 10) {
2656                 NDR_PRINT_IN_DEBUG(spoolss_AddPrintProcessor, &r);
2657         }
2658
2659         status = cli->dispatch(cli,
2660                                 mem_ctx,
2661                                 &ndr_table_spoolss,
2662                                 NDR_SPOOLSS_ADDPRINTPROCESSOR,
2663                                 &r);
2664
2665         if (!NT_STATUS_IS_OK(status)) {
2666                 return status;
2667         }
2668
2669         if (DEBUGLEVEL >= 10) {
2670                 NDR_PRINT_OUT_DEBUG(spoolss_AddPrintProcessor, &r);
2671         }
2672
2673         if (NT_STATUS_IS_ERR(status)) {
2674                 return status;
2675         }
2676
2677         /* Return variables */
2678
2679         /* Return result */
2680         if (werror) {
2681                 *werror = r.out.result;
2682         }
2683
2684         return werror_to_ntstatus(r.out.result);
2685 }
2686
2687 struct rpccli_spoolss_EnumPrintProcessors_state {
2688         struct spoolss_EnumPrintProcessors orig;
2689         struct spoolss_EnumPrintProcessors tmp;
2690         TALLOC_CTX *out_mem_ctx;
2691         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2692 };
2693
2694 static void rpccli_spoolss_EnumPrintProcessors_done(struct tevent_req *subreq);
2695
2696 struct tevent_req *rpccli_spoolss_EnumPrintProcessors_send(TALLOC_CTX *mem_ctx,
2697                                                            struct tevent_context *ev,
2698                                                            struct rpc_pipe_client *cli,
2699                                                            const char *_servername /* [in] [unique,charset(UTF16)] */,
2700                                                            const char *_environment /* [in] [unique,charset(UTF16)] */,
2701                                                            uint32_t _level /* [in]  */,
2702                                                            DATA_BLOB *_buffer /* [in] [unique] */,
2703                                                            uint32_t _offered /* [in]  */,
2704                                                            uint32_t *_count /* [out] [ref] */,
2705                                                            union spoolss_PrintProcessorInfo **_info /* [out] [ref,switch_is(level),size_is(,*count)] */,
2706                                                            uint32_t *_needed /* [out] [ref] */)
2707 {
2708         struct tevent_req *req;
2709         struct rpccli_spoolss_EnumPrintProcessors_state *state;
2710         struct tevent_req *subreq;
2711
2712         req = tevent_req_create(mem_ctx, &state,
2713                                 struct rpccli_spoolss_EnumPrintProcessors_state);
2714         if (req == NULL) {
2715                 return NULL;
2716         }
2717         state->out_mem_ctx = NULL;
2718         state->dispatch_recv = cli->dispatch_recv;
2719
2720         /* In parameters */
2721         state->orig.in.servername = _servername;
2722         state->orig.in.environment = _environment;
2723         state->orig.in.level = _level;
2724         state->orig.in.buffer = _buffer;
2725         state->orig.in.offered = _offered;
2726
2727         /* Out parameters */
2728         state->orig.out.count = _count;
2729         state->orig.out.info = _info;
2730         state->orig.out.needed = _needed;
2731
2732         /* Result */
2733         ZERO_STRUCT(state->orig.out.result);
2734
2735         if (DEBUGLEVEL >= 10) {
2736                 NDR_PRINT_IN_DEBUG(spoolss_EnumPrintProcessors, &state->orig);
2737         }
2738
2739         state->out_mem_ctx = talloc_named_const(state, 0,
2740                              "rpccli_spoolss_EnumPrintProcessors_out_memory");
2741         if (tevent_req_nomem(state->out_mem_ctx, req)) {
2742                 return tevent_req_post(req, ev);
2743         }
2744
2745         /* make a temporary copy, that we pass to the dispatch function */
2746         state->tmp = state->orig;
2747
2748         subreq = cli->dispatch_send(state, ev, cli,
2749                                     &ndr_table_spoolss,
2750                                     NDR_SPOOLSS_ENUMPRINTPROCESSORS,
2751                                     &state->tmp);
2752         if (tevent_req_nomem(subreq, req)) {
2753                 return tevent_req_post(req, ev);
2754         }
2755         tevent_req_set_callback(subreq, rpccli_spoolss_EnumPrintProcessors_done, req);
2756         return req;
2757 }
2758
2759 static void rpccli_spoolss_EnumPrintProcessors_done(struct tevent_req *subreq)
2760 {
2761         struct tevent_req *req = tevent_req_callback_data(
2762                 subreq, struct tevent_req);
2763         struct rpccli_spoolss_EnumPrintProcessors_state *state = tevent_req_data(
2764                 req, struct rpccli_spoolss_EnumPrintProcessors_state);
2765         NTSTATUS status;
2766         TALLOC_CTX *mem_ctx;
2767
2768         if (state->out_mem_ctx) {
2769                 mem_ctx = state->out_mem_ctx;
2770         } else {
2771                 mem_ctx = state;
2772         }
2773
2774         status = state->dispatch_recv(subreq, mem_ctx);
2775         TALLOC_FREE(subreq);
2776         if (!NT_STATUS_IS_OK(status)) {
2777                 tevent_req_nterror(req, status);
2778                 return;
2779         }
2780
2781         /* Copy out parameters */
2782         *state->orig.out.count = *state->tmp.out.count;
2783         *state->orig.out.info = *state->tmp.out.info;
2784         *state->orig.out.needed = *state->tmp.out.needed;
2785
2786         /* Copy result */
2787         state->orig.out.result = state->tmp.out.result;
2788
2789         /* Reset temporary structure */
2790         ZERO_STRUCT(state->tmp);
2791
2792         if (DEBUGLEVEL >= 10) {
2793                 NDR_PRINT_OUT_DEBUG(spoolss_EnumPrintProcessors, &state->orig);
2794         }
2795
2796         tevent_req_done(req);
2797 }
2798
2799 NTSTATUS rpccli_spoolss_EnumPrintProcessors_recv(struct tevent_req *req,
2800                                                  TALLOC_CTX *mem_ctx,
2801                                                  WERROR *result)
2802 {
2803         struct rpccli_spoolss_EnumPrintProcessors_state *state = tevent_req_data(
2804                 req, struct rpccli_spoolss_EnumPrintProcessors_state);
2805         NTSTATUS status;
2806
2807         if (tevent_req_is_nterror(req, &status)) {
2808                 tevent_req_received(req);
2809                 return status;
2810         }
2811
2812         /* Steal possbile out parameters to the callers context */
2813         talloc_steal(mem_ctx, state->out_mem_ctx);
2814
2815         /* Return result */
2816         *result = state->orig.out.result;
2817
2818         tevent_req_received(req);
2819         return NT_STATUS_OK;
2820 }
2821
2822 NTSTATUS rpccli_spoolss_EnumPrintProcessors(struct rpc_pipe_client *cli,
2823                                             TALLOC_CTX *mem_ctx,
2824                                             const char *servername /* [in] [unique,charset(UTF16)] */,
2825                                             const char *environment /* [in] [unique,charset(UTF16)] */,
2826                                             uint32_t level /* [in]  */,
2827                                             DATA_BLOB *buffer /* [in] [unique] */,
2828                                             uint32_t offered /* [in]  */,
2829                                             uint32_t *count /* [out] [ref] */,
2830                                             union spoolss_PrintProcessorInfo **info /* [out] [ref,switch_is(level),size_is(,*count)] */,
2831                                             uint32_t *needed /* [out] [ref] */,
2832                                             WERROR *werror)
2833 {
2834         struct spoolss_EnumPrintProcessors r;
2835         NTSTATUS status;
2836
2837         /* In parameters */
2838         r.in.servername = servername;
2839         r.in.environment = environment;
2840         r.in.level = level;
2841         r.in.buffer = buffer;
2842         r.in.offered = offered;
2843
2844         if (DEBUGLEVEL >= 10) {
2845                 NDR_PRINT_IN_DEBUG(spoolss_EnumPrintProcessors, &r);
2846         }
2847
2848         status = cli->dispatch(cli,
2849                                 mem_ctx,
2850                                 &ndr_table_spoolss,
2851                                 NDR_SPOOLSS_ENUMPRINTPROCESSORS,
2852                                 &r);
2853
2854         if (!NT_STATUS_IS_OK(status)) {
2855                 return status;
2856         }
2857
2858         if (DEBUGLEVEL >= 10) {
2859                 NDR_PRINT_OUT_DEBUG(spoolss_EnumPrintProcessors, &r);
2860         }
2861
2862         if (NT_STATUS_IS_ERR(status)) {
2863                 return status;
2864         }
2865
2866         /* Return variables */
2867         *count = *r.out.count;
2868         *info = *r.out.info;
2869         *needed = *r.out.needed;
2870
2871         /* Return result */
2872         if (werror) {
2873                 *werror = r.out.result;
2874         }
2875
2876         return werror_to_ntstatus(r.out.result);
2877 }
2878
2879 struct rpccli_spoolss_GetPrintProcessorDirectory_state {
2880         struct spoolss_GetPrintProcessorDirectory orig;
2881         struct spoolss_GetPrintProcessorDirectory tmp;
2882         TALLOC_CTX *out_mem_ctx;
2883         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2884 };
2885
2886 static void rpccli_spoolss_GetPrintProcessorDirectory_done(struct tevent_req *subreq);
2887
2888 struct tevent_req *rpccli_spoolss_GetPrintProcessorDirectory_send(TALLOC_CTX *mem_ctx,
2889                                                                   struct tevent_context *ev,
2890                                                                   struct rpc_pipe_client *cli,
2891                                                                   const char *_server /* [in] [unique,charset(UTF16)] */,
2892                                                                   const char *_environment /* [in] [unique,charset(UTF16)] */,
2893                                                                   uint32_t _level /* [in]  */,
2894                                                                   DATA_BLOB *_buffer /* [in] [unique] */,
2895                                                                   uint32_t _offered /* [in]  */,
2896                                                                   union spoolss_PrintProcessorDirectoryInfo *_info /* [out] [unique,subcontext_size(offered),subcontext(4),switch_is(level)] */,
2897                                                                   uint32_t *_needed /* [out] [ref] */)
2898 {
2899         struct tevent_req *req;
2900         struct rpccli_spoolss_GetPrintProcessorDirectory_state *state;
2901         struct tevent_req *subreq;
2902
2903         req = tevent_req_create(mem_ctx, &state,
2904                                 struct rpccli_spoolss_GetPrintProcessorDirectory_state);
2905         if (req == NULL) {
2906                 return NULL;
2907         }
2908         state->out_mem_ctx = NULL;
2909         state->dispatch_recv = cli->dispatch_recv;
2910
2911         /* In parameters */
2912         state->orig.in.server = _server;
2913         state->orig.in.environment = _environment;
2914         state->orig.in.level = _level;
2915         state->orig.in.buffer = _buffer;
2916         state->orig.in.offered = _offered;
2917
2918         /* Out parameters */
2919         state->orig.out.info = _info;
2920         state->orig.out.needed = _needed;
2921
2922         /* Result */
2923         ZERO_STRUCT(state->orig.out.result);
2924
2925         if (DEBUGLEVEL >= 10) {
2926                 NDR_PRINT_IN_DEBUG(spoolss_GetPrintProcessorDirectory, &state->orig);
2927         }
2928
2929         state->out_mem_ctx = talloc_named_const(state, 0,
2930                              "rpccli_spoolss_GetPrintProcessorDirectory_out_memory");
2931         if (tevent_req_nomem(state->out_mem_ctx, req)) {
2932                 return tevent_req_post(req, ev);
2933         }
2934
2935         /* make a temporary copy, that we pass to the dispatch function */
2936         state->tmp = state->orig;
2937
2938         subreq = cli->dispatch_send(state, ev, cli,
2939                                     &ndr_table_spoolss,
2940                                     NDR_SPOOLSS_GETPRINTPROCESSORDIRECTORY,
2941                                     &state->tmp);
2942         if (tevent_req_nomem(subreq, req)) {
2943                 return tevent_req_post(req, ev);
2944         }
2945         tevent_req_set_callback(subreq, rpccli_spoolss_GetPrintProcessorDirectory_done, req);
2946         return req;
2947 }
2948
2949 static void rpccli_spoolss_GetPrintProcessorDirectory_done(struct tevent_req *subreq)
2950 {
2951         struct tevent_req *req = tevent_req_callback_data(
2952                 subreq, struct tevent_req);
2953         struct rpccli_spoolss_GetPrintProcessorDirectory_state *state = tevent_req_data(
2954                 req, struct rpccli_spoolss_GetPrintProcessorDirectory_state);
2955         NTSTATUS status;
2956         TALLOC_CTX *mem_ctx;
2957
2958         if (state->out_mem_ctx) {
2959                 mem_ctx = state->out_mem_ctx;
2960         } else {
2961                 mem_ctx = state;
2962         }
2963
2964         status = state->dispatch_recv(subreq, mem_ctx);
2965         TALLOC_FREE(subreq);
2966         if (!NT_STATUS_IS_OK(status)) {
2967                 tevent_req_nterror(req, status);
2968                 return;
2969         }
2970
2971         /* Copy out parameters */
2972         if (state->orig.out.info && state->tmp.out.info) {
2973                 *state->orig.out.info = *state->tmp.out.info;
2974         }
2975         *state->orig.out.needed = *state->tmp.out.needed;
2976
2977         /* Copy result */
2978         state->orig.out.result = state->tmp.out.result;
2979
2980         /* Reset temporary structure */
2981         ZERO_STRUCT(state->tmp);
2982
2983         if (DEBUGLEVEL >= 10) {
2984                 NDR_PRINT_OUT_DEBUG(spoolss_GetPrintProcessorDirectory, &state->orig);
2985         }
2986
2987         tevent_req_done(req);
2988 }
2989
2990 NTSTATUS rpccli_spoolss_GetPrintProcessorDirectory_recv(struct tevent_req *req,
2991                                                         TALLOC_CTX *mem_ctx,
2992                                                         WERROR *result)
2993 {
2994         struct rpccli_spoolss_GetPrintProcessorDirectory_state *state = tevent_req_data(
2995                 req, struct rpccli_spoolss_GetPrintProcessorDirectory_state);
2996         NTSTATUS status;
2997
2998         if (tevent_req_is_nterror(req, &status)) {
2999                 tevent_req_received(req);
3000                 return status;
3001         }
3002
3003         /* Steal possbile out parameters to the callers context */
3004         talloc_steal(mem_ctx, state->out_mem_ctx);
3005
3006         /* Return result */
3007         *result = state->orig.out.result;
3008
3009         tevent_req_received(req);
3010         return NT_STATUS_OK;
3011 }
3012
3013 NTSTATUS rpccli_spoolss_GetPrintProcessorDirectory(struct rpc_pipe_client *cli,
3014                                                    TALLOC_CTX *mem_ctx,
3015                                                    const char *server /* [in] [unique,charset(UTF16)] */,
3016                                                    const char *environment /* [in] [unique,charset(UTF16)] */,
3017                                                    uint32_t level /* [in]  */,
3018                                                    DATA_BLOB *buffer /* [in] [unique] */,
3019                                                    uint32_t offered /* [in]  */,
3020                                                    union spoolss_PrintProcessorDirectoryInfo *info /* [out] [unique,subcontext_size(offered),subcontext(4),switch_is(level)] */,
3021                                                    uint32_t *needed /* [out] [ref] */,
3022                                                    WERROR *werror)
3023 {
3024         struct spoolss_GetPrintProcessorDirectory r;
3025         NTSTATUS status;
3026
3027         /* In parameters */
3028         r.in.server = server;
3029         r.in.environment = environment;
3030         r.in.level = level;
3031         r.in.buffer = buffer;
3032         r.in.offered = offered;
3033
3034         if (DEBUGLEVEL >= 10) {
3035                 NDR_PRINT_IN_DEBUG(spoolss_GetPrintProcessorDirectory, &r);
3036         }
3037
3038         status = cli->dispatch(cli,
3039                                 mem_ctx,
3040                                 &ndr_table_spoolss,
3041                                 NDR_SPOOLSS_GETPRINTPROCESSORDIRECTORY,
3042                                 &r);
3043
3044         if (!NT_STATUS_IS_OK(status)) {
3045                 return status;
3046         }
3047
3048         if (DEBUGLEVEL >= 10) {
3049                 NDR_PRINT_OUT_DEBUG(spoolss_GetPrintProcessorDirectory, &r);
3050         }
3051
3052         if (NT_STATUS_IS_ERR(status)) {
3053                 return status;
3054         }
3055
3056         /* Return variables */
3057         if (info && r.out.info) {
3058                 *info = *r.out.info;
3059         }
3060         *needed = *r.out.needed;
3061
3062         /* Return result */
3063         if (werror) {
3064                 *werror = r.out.result;
3065         }
3066
3067         return werror_to_ntstatus(r.out.result);
3068 }
3069
3070 struct rpccli_spoolss_StartDocPrinter_state {
3071         struct spoolss_StartDocPrinter orig;
3072         struct spoolss_StartDocPrinter tmp;
3073         TALLOC_CTX *out_mem_ctx;
3074         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
3075 };
3076
3077 static void rpccli_spoolss_StartDocPrinter_done(struct tevent_req *subreq);
3078
3079 struct tevent_req *rpccli_spoolss_StartDocPrinter_send(TALLOC_CTX *mem_ctx,
3080                                                        struct tevent_context *ev,
3081                                                        struct rpc_pipe_client *cli,
3082                                                        struct policy_handle *_handle /* [in] [ref] */,
3083                                                        uint32_t _level /* [in]  */,
3084                                                        union spoolss_DocumentInfo _info /* [in] [switch_is(level)] */,
3085                                                        uint32_t *_job_id /* [out] [ref] */)
3086 {
3087         struct tevent_req *req;
3088         struct rpccli_spoolss_StartDocPrinter_state *state;
3089         struct tevent_req *subreq;
3090
3091         req = tevent_req_create(mem_ctx, &state,
3092                                 struct rpccli_spoolss_StartDocPrinter_state);
3093         if (req == NULL) {
3094                 return NULL;
3095         }
3096         state->out_mem_ctx = NULL;
3097         state->dispatch_recv = cli->dispatch_recv;
3098
3099         /* In parameters */
3100         state->orig.in.handle = _handle;
3101         state->orig.in.level = _level;
3102         state->orig.in.info = _info;
3103
3104         /* Out parameters */
3105         state->orig.out.job_id = _job_id;
3106
3107         /* Result */
3108         ZERO_STRUCT(state->orig.out.result);
3109
3110         if (DEBUGLEVEL >= 10) {
3111                 NDR_PRINT_IN_DEBUG(spoolss_StartDocPrinter, &state->orig);
3112         }
3113
3114         state->out_mem_ctx = talloc_named_const(state, 0,
3115                              "rpccli_spoolss_StartDocPrinter_out_memory");
3116         if (tevent_req_nomem(state->out_mem_ctx, req)) {
3117                 return tevent_req_post(req, ev);
3118         }
3119
3120         /* make a temporary copy, that we pass to the dispatch function */
3121         state->tmp = state->orig;
3122
3123         subreq = cli->dispatch_send(state, ev, cli,
3124                                     &ndr_table_spoolss,
3125                                     NDR_SPOOLSS_STARTDOCPRINTER,
3126                                     &state->tmp);
3127         if (tevent_req_nomem(subreq, req)) {
3128                 return tevent_req_post(req, ev);
3129         }
3130         tevent_req_set_callback(subreq, rpccli_spoolss_StartDocPrinter_done, req);
3131         return req;
3132 }
3133
3134 static void rpccli_spoolss_StartDocPrinter_done(struct tevent_req *subreq)
3135 {
3136         struct tevent_req *req = tevent_req_callback_data(
3137                 subreq, struct tevent_req);
3138         struct rpccli_spoolss_StartDocPrinter_state *state = tevent_req_data(
3139                 req, struct rpccli_spoolss_StartDocPrinter_state);
3140         NTSTATUS status;
3141         TALLOC_CTX *mem_ctx;
3142
3143         if (state->out_mem_ctx) {
3144                 mem_ctx = state->out_mem_ctx;
3145         } else {
3146                 mem_ctx = state;
3147         }
3148
3149         status = state->dispatch_recv(subreq, mem_ctx);
3150         TALLOC_FREE(subreq);
3151         if (!NT_STATUS_IS_OK(status)) {
3152                 tevent_req_nterror(req, status);
3153                 return;
3154         }
3155
3156         /* Copy out parameters */
3157         *state->orig.out.job_id = *state->tmp.out.job_id;
3158
3159         /* Copy result */
3160         state->orig.out.result = state->tmp.out.result;
3161
3162         /* Reset temporary structure */
3163         ZERO_STRUCT(state->tmp);
3164
3165         if (DEBUGLEVEL >= 10) {
3166                 NDR_PRINT_OUT_DEBUG(spoolss_StartDocPrinter, &state->orig);
3167         }
3168
3169         tevent_req_done(req);
3170 }
3171
3172 NTSTATUS rpccli_spoolss_StartDocPrinter_recv(struct tevent_req *req,
3173                                              TALLOC_CTX *mem_ctx,
3174                                              WERROR *result)
3175 {
3176         struct rpccli_spoolss_StartDocPrinter_state *state = tevent_req_data(
3177                 req, struct rpccli_spoolss_StartDocPrinter_state);
3178         NTSTATUS status;
3179
3180         if (tevent_req_is_nterror(req, &status)) {
3181                 tevent_req_received(req);
3182                 return status;
3183         }
3184
3185         /* Steal possbile out parameters to the callers context */
3186         talloc_steal(mem_ctx, state->out_mem_ctx);
3187
3188         /* Return result */
3189         *result = state->orig.out.result;
3190
3191         tevent_req_received(req);
3192         return NT_STATUS_OK;
3193 }
3194
3195 NTSTATUS rpccli_spoolss_StartDocPrinter(struct rpc_pipe_client *cli,
3196                                         TALLOC_CTX *mem_ctx,
3197                                         struct policy_handle *handle /* [in] [ref] */,
3198                                         uint32_t level /* [in]  */,
3199                                         union spoolss_DocumentInfo info /* [in] [switch_is(level)] */,
3200                                         uint32_t *job_id /* [out] [ref] */,
3201                                         WERROR *werror)
3202 {
3203         struct spoolss_StartDocPrinter r;
3204         NTSTATUS status;
3205
3206         /* In parameters */
3207         r.in.handle = handle;
3208         r.in.level = level;
3209         r.in.info = info;
3210
3211         if (DEBUGLEVEL >= 10) {
3212                 NDR_PRINT_IN_DEBUG(spoolss_StartDocPrinter, &r);
3213         }
3214
3215         status = cli->dispatch(cli,
3216                                 mem_ctx,
3217                                 &ndr_table_spoolss,
3218                                 NDR_SPOOLSS_STARTDOCPRINTER,
3219                                 &r);
3220
3221         if (!NT_STATUS_IS_OK(status)) {
3222                 return status;
3223         }
3224
3225         if (DEBUGLEVEL >= 10) {
3226                 NDR_PRINT_OUT_DEBUG(spoolss_StartDocPrinter, &r);
3227         }
3228
3229         if (NT_STATUS_IS_ERR(status)) {
3230                 return status;
3231         }
3232
3233         /* Return variables */
3234         *job_id = *r.out.job_id;
3235
3236         /* Return result */
3237         if (werror) {
3238                 *werror = r.out.result;
3239         }
3240
3241         return werror_to_ntstatus(r.out.result);
3242 }
3243
3244 struct rpccli_spoolss_StartPagePrinter_state {
3245         struct spoolss_StartPagePrinter orig;
3246         struct spoolss_StartPagePrinter tmp;
3247         TALLOC_CTX *out_mem_ctx;
3248         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
3249 };
3250
3251 static void rpccli_spoolss_StartPagePrinter_done(struct tevent_req *subreq);
3252
3253 struct tevent_req *rpccli_spoolss_StartPagePrinter_send(TALLOC_CTX *mem_ctx,
3254                                                         struct tevent_context *ev,
3255                                                         struct rpc_pipe_client *cli,
3256                                                         struct policy_handle *_handle /* [in] [ref] */)
3257 {
3258         struct tevent_req *req;
3259         struct rpccli_spoolss_StartPagePrinter_state *state;
3260         struct tevent_req *subreq;
3261
3262         req = tevent_req_create(mem_ctx, &state,
3263                                 struct rpccli_spoolss_StartPagePrinter_state);
3264         if (req == NULL) {
3265                 return NULL;
3266         }
3267         state->out_mem_ctx = NULL;
3268         state->dispatch_recv = cli->dispatch_recv;
3269
3270         /* In parameters */
3271         state->orig.in.handle = _handle;
3272
3273         /* Out parameters */
3274
3275         /* Result */
3276         ZERO_STRUCT(state->orig.out.result);
3277
3278         if (DEBUGLEVEL >= 10) {
3279                 NDR_PRINT_IN_DEBUG(spoolss_StartPagePrinter, &state->orig);
3280         }
3281
3282         /* make a temporary copy, that we pass to the dispatch function */
3283         state->tmp = state->orig;
3284
3285         subreq = cli->dispatch_send(state, ev, cli,
3286                                     &ndr_table_spoolss,
3287                                     NDR_SPOOLSS_STARTPAGEPRINTER,
3288                                     &state->tmp);
3289         if (tevent_req_nomem(subreq, req)) {
3290                 return tevent_req_post(req, ev);
3291         }
3292         tevent_req_set_callback(subreq, rpccli_spoolss_StartPagePrinter_done, req);
3293         return req;
3294 }
3295
3296 static void rpccli_spoolss_StartPagePrinter_done(struct tevent_req *subreq)
3297 {
3298         struct tevent_req *req = tevent_req_callback_data(
3299                 subreq, struct tevent_req);
3300         struct rpccli_spoolss_StartPagePrinter_state *state = tevent_req_data(
3301                 req, struct rpccli_spoolss_StartPagePrinter_state);
3302         NTSTATUS status;
3303         TALLOC_CTX *mem_ctx;
3304
3305         if (state->out_mem_ctx) {
3306                 mem_ctx = state->out_mem_ctx;
3307         } else {
3308                 mem_ctx = state;
3309         }
3310
3311         status = state->dispatch_recv(subreq, mem_ctx);
3312         TALLOC_FREE(subreq);
3313         if (!NT_STATUS_IS_OK(status)) {
3314                 tevent_req_nterror(req, status);
3315                 return;
3316         }
3317
3318         /* Copy out parameters */
3319
3320         /* Copy result */
3321         state->orig.out.result = state->tmp.out.result;
3322
3323         /* Reset temporary structure */
3324         ZERO_STRUCT(state->tmp);
3325
3326         if (DEBUGLEVEL >= 10) {
3327                 NDR_PRINT_OUT_DEBUG(spoolss_StartPagePrinter, &state->orig);
3328         }
3329
3330         tevent_req_done(req);
3331 }
3332
3333 NTSTATUS rpccli_spoolss_StartPagePrinter_recv(struct tevent_req *req,
3334                                               TALLOC_CTX *mem_ctx,
3335                                               WERROR *result)
3336 {
3337         struct rpccli_spoolss_StartPagePrinter_state *state = tevent_req_data(
3338                 req, struct rpccli_spoolss_StartPagePrinter_state);
3339         NTSTATUS status;
3340
3341         if (tevent_req_is_nterror(req, &status)) {
3342                 tevent_req_received(req);
3343                 return status;
3344         }
3345
3346         /* Steal possbile out parameters to the callers context */
3347         talloc_steal(mem_ctx, state->out_mem_ctx);
3348
3349         /* Return result */
3350         *result = state->orig.out.result;
3351
3352         tevent_req_received(req);
3353         return NT_STATUS_OK;
3354 }
3355
3356 NTSTATUS rpccli_spoolss_StartPagePrinter(struct rpc_pipe_client *cli,
3357                                          TALLOC_CTX *mem_ctx,
3358                                          struct policy_handle *handle /* [in] [ref] */,
3359                                          WERROR *werror)
3360 {
3361         struct spoolss_StartPagePrinter r;
3362         NTSTATUS status;
3363
3364         /* In parameters */
3365         r.in.handle = handle;
3366
3367         if (DEBUGLEVEL >= 10) {
3368                 NDR_PRINT_IN_DEBUG(spoolss_StartPagePrinter, &r);
3369         }
3370
3371         status = cli->dispatch(cli,
3372                                 mem_ctx,
3373                                 &ndr_table_spoolss,
3374                                 NDR_SPOOLSS_STARTPAGEPRINTER,
3375                                 &r);
3376
3377         if (!NT_STATUS_IS_OK(status)) {
3378                 return status;
3379         }
3380
3381         if (DEBUGLEVEL >= 10) {
3382                 NDR_PRINT_OUT_DEBUG(spoolss_StartPagePrinter, &r);
3383         }
3384
3385         if (NT_STATUS_IS_ERR(status)) {
3386                 return status;
3387         }
3388
3389         /* Return variables */
3390
3391         /* Return result */
3392         if (werror) {
3393                 *werror = r.out.result;
3394         }
3395
3396         return werror_to_ntstatus(r.out.result);
3397 }
3398
3399 struct rpccli_spoolss_WritePrinter_state {
3400         struct spoolss_WritePrinter orig;
3401         struct spoolss_WritePrinter tmp;
3402         TALLOC_CTX *out_mem_ctx;
3403         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
3404 };
3405
3406 static void rpccli_spoolss_WritePrinter_done(struct tevent_req *subreq);
3407
3408 struct tevent_req *rpccli_spoolss_WritePrinter_send(TALLOC_CTX *mem_ctx,
3409                                                     struct tevent_context *ev,
3410                                                     struct rpc_pipe_client *cli,
3411                                                     struct policy_handle *_handle /* [in] [ref] */,
3412                                                     DATA_BLOB _data /* [in]  */,
3413                                                     uint32_t __data_size /* [in] [value(r->in.data.length)] */,
3414                                                     uint32_t *_num_written /* [out] [ref] */)
3415 {
3416         struct tevent_req *req;
3417         struct rpccli_spoolss_WritePrinter_state *state;
3418         struct tevent_req *subreq;
3419
3420         req = tevent_req_create(mem_ctx, &state,
3421                                 struct rpccli_spoolss_WritePrinter_state);
3422         if (req == NULL) {
3423                 return NULL;
3424         }
3425         state->out_mem_ctx = NULL;
3426         state->dispatch_recv = cli->dispatch_recv;
3427
3428         /* In parameters */
3429         state->orig.in.handle = _handle;
3430         state->orig.in.data = _data;
3431         state->orig.in._data_size = __data_size;
3432
3433         /* Out parameters */
3434         state->orig.out.num_written = _num_written;
3435
3436         /* Result */
3437         ZERO_STRUCT(state->orig.out.result);
3438
3439         if (DEBUGLEVEL >= 10) {
3440                 NDR_PRINT_IN_DEBUG(spoolss_WritePrinter, &state->orig);
3441         }
3442
3443         state->out_mem_ctx = talloc_named_const(state, 0,
3444                              "rpccli_spoolss_WritePrinter_out_memory");
3445         if (tevent_req_nomem(state->out_mem_ctx, req)) {
3446                 return tevent_req_post(req, ev);
3447         }
3448
3449         /* make a temporary copy, that we pass to the dispatch function */
3450         state->tmp = state->orig;
3451
3452         subreq = cli->dispatch_send(state, ev, cli,
3453                                     &ndr_table_spoolss,
3454                                     NDR_SPOOLSS_WRITEPRINTER,
3455                                     &state->tmp);
3456         if (tevent_req_nomem(subreq, req)) {
3457                 return tevent_req_post(req, ev);
3458         }
3459         tevent_req_set_callback(subreq, rpccli_spoolss_WritePrinter_done, req);
3460         return req;
3461 }
3462
3463 static void rpccli_spoolss_WritePrinter_done(struct tevent_req *subreq)
3464 {
3465         struct tevent_req *req = tevent_req_callback_data(
3466                 subreq, struct tevent_req);
3467         struct rpccli_spoolss_WritePrinter_state *state = tevent_req_data(
3468                 req, struct rpccli_spoolss_WritePrinter_state);
3469         NTSTATUS status;
3470         TALLOC_CTX *mem_ctx;
3471
3472         if (state->out_mem_ctx) {
3473                 mem_ctx = state->out_mem_ctx;
3474         } else {
3475                 mem_ctx = state;
3476         }
3477
3478         status = state->dispatch_recv(subreq, mem_ctx);
3479         TALLOC_FREE(subreq);
3480         if (!NT_STATUS_IS_OK(status)) {
3481                 tevent_req_nterror(req, status);
3482                 return;
3483         }
3484
3485         /* Copy out parameters */
3486         *state->orig.out.num_written = *state->tmp.out.num_written;
3487
3488         /* Copy result */
3489         state->orig.out.result = state->tmp.out.result;
3490
3491         /* Reset temporary structure */
3492         ZERO_STRUCT(state->tmp);
3493
3494         if (DEBUGLEVEL >= 10) {
3495                 NDR_PRINT_OUT_DEBUG(spoolss_WritePrinter, &state->orig);
3496         }
3497
3498         tevent_req_done(req);
3499 }
3500
3501 NTSTATUS rpccli_spoolss_WritePrinter_recv(struct tevent_req *req,
3502                                           TALLOC_CTX *mem_ctx,
3503                                           WERROR *result)
3504 {
3505         struct rpccli_spoolss_WritePrinter_state *state = tevent_req_data(
3506                 req, struct rpccli_spoolss_WritePrinter_state);
3507         NTSTATUS status;
3508
3509         if (tevent_req_is_nterror(req, &status)) {
3510                 tevent_req_received(req);
3511                 return status;
3512         }
3513
3514         /* Steal possbile out parameters to the callers context */
3515         talloc_steal(mem_ctx, state->out_mem_ctx);
3516
3517         /* Return result */
3518         *result = state->orig.out.result;
3519
3520         tevent_req_received(req);
3521         return NT_STATUS_OK;
3522 }
3523
3524 NTSTATUS rpccli_spoolss_WritePrinter(struct rpc_pipe_client *cli,
3525                                      TALLOC_CTX *mem_ctx,
3526                                      struct policy_handle *handle /* [in] [ref] */,
3527                                      DATA_BLOB data /* [in]  */,
3528                                      uint32_t _data_size /* [in] [value(r->in.data.length)] */,
3529                                      uint32_t *num_written /* [out] [ref] */,
3530                                      WERROR *werror)
3531 {
3532         struct spoolss_WritePrinter r;
3533         NTSTATUS status;
3534
3535         /* In parameters */
3536         r.in.handle = handle;
3537         r.in.data = data;
3538         r.in._data_size = _data_size;
3539
3540         if (DEBUGLEVEL >= 10) {
3541                 NDR_PRINT_IN_DEBUG(spoolss_WritePrinter, &r);
3542         }
3543
3544         status = cli->dispatch(cli,
3545                                 mem_ctx,
3546                                 &ndr_table_spoolss,
3547                                 NDR_SPOOLSS_WRITEPRINTER,
3548                                 &r);
3549
3550         if (!NT_STATUS_IS_OK(status)) {
3551                 return status;
3552         }
3553
3554         if (DEBUGLEVEL >= 10) {
3555                 NDR_PRINT_OUT_DEBUG(spoolss_WritePrinter, &r);
3556         }
3557
3558         if (NT_STATUS_IS_ERR(status)) {
3559                 return status;
3560         }
3561
3562         /* Return variables */
3563         *num_written = *r.out.num_written;
3564
3565         /* Return result */
3566         if (werror) {
3567                 *werror = r.out.result;
3568         }
3569
3570         return werror_to_ntstatus(r.out.result);
3571 }
3572
3573 struct rpccli_spoolss_EndPagePrinter_state {
3574         struct spoolss_EndPagePrinter orig;
3575         struct spoolss_EndPagePrinter tmp;
3576         TALLOC_CTX *out_mem_ctx;
3577         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
3578 };
3579
3580 static void rpccli_spoolss_EndPagePrinter_done(struct tevent_req *subreq);
3581
3582 struct tevent_req *rpccli_spoolss_EndPagePrinter_send(TALLOC_CTX *mem_ctx,
3583                                                       struct tevent_context *ev,
3584                                                       struct rpc_pipe_client *cli,
3585                                                       struct policy_handle *_handle /* [in] [ref] */)
3586 {
3587         struct tevent_req *req;
3588         struct rpccli_spoolss_EndPagePrinter_state *state;
3589         struct tevent_req *subreq;
3590
3591         req = tevent_req_create(mem_ctx, &state,
3592                                 struct rpccli_spoolss_EndPagePrinter_state);
3593         if (req == NULL) {
3594                 return NULL;
3595         }
3596         state->out_mem_ctx = NULL;
3597         state->dispatch_recv = cli->dispatch_recv;
3598
3599         /* In parameters */
3600         state->orig.in.handle = _handle;
3601
3602         /* Out parameters */
3603
3604         /* Result */
3605         ZERO_STRUCT(state->orig.out.result);
3606
3607         if (DEBUGLEVEL >= 10) {
3608                 NDR_PRINT_IN_DEBUG(spoolss_EndPagePrinter, &state->orig);
3609         }
3610
3611         /* make a temporary copy, that we pass to the dispatch function */
3612         state->tmp = state->orig;
3613
3614         subreq = cli->dispatch_send(state, ev, cli,
3615                                     &ndr_table_spoolss,
3616                                     NDR_SPOOLSS_ENDPAGEPRINTER,
3617                                     &state->tmp);
3618         if (tevent_req_nomem(subreq, req)) {
3619                 return tevent_req_post(req, ev);
3620         }
3621         tevent_req_set_callback(subreq, rpccli_spoolss_EndPagePrinter_done, req);
3622         return req;
3623 }
3624
3625 static void rpccli_spoolss_EndPagePrinter_done(struct tevent_req *subreq)
3626 {
3627         struct tevent_req *req = tevent_req_callback_data(
3628                 subreq, struct tevent_req);
3629         struct rpccli_spoolss_EndPagePrinter_state *state = tevent_req_data(
3630                 req, struct rpccli_spoolss_EndPagePrinter_state);
3631         NTSTATUS status;
3632         TALLOC_CTX *mem_ctx;
3633
3634         if (state->out_mem_ctx) {
3635                 mem_ctx = state->out_mem_ctx;
3636         } else {
3637                 mem_ctx = state;
3638         }
3639
3640         status = state->dispatch_recv(subreq, mem_ctx);
3641         TALLOC_FREE(subreq);
3642         if (!NT_STATUS_IS_OK(status)) {
3643                 tevent_req_nterror(req, status);
3644                 return;
3645         }
3646
3647         /* Copy out parameters */
3648
3649         /* Copy result */
3650         state->orig.out.result = state->tmp.out.result;
3651
3652         /* Reset temporary structure */
3653         ZERO_STRUCT(state->tmp);
3654
3655         if (DEBUGLEVEL >= 10) {
3656                 NDR_PRINT_OUT_DEBUG(spoolss_EndPagePrinter, &state->orig);
3657         }
3658
3659         tevent_req_done(req);
3660 }
3661
3662 NTSTATUS rpccli_spoolss_EndPagePrinter_recv(struct tevent_req *req,
3663                                             TALLOC_CTX *mem_ctx,
3664                                             WERROR *result)
3665 {
3666         struct rpccli_spoolss_EndPagePrinter_state *state = tevent_req_data(
3667                 req, struct rpccli_spoolss_EndPagePrinter_state);
3668         NTSTATUS status;
3669
3670         if (tevent_req_is_nterror(req, &status)) {
3671                 tevent_req_received(req);
3672                 return status;
3673         }
3674
3675         /* Steal possbile out parameters to the callers context */
3676         talloc_steal(mem_ctx, state->out_mem_ctx);
3677
3678         /* Return result */
3679         *result = state->orig.out.result;
3680
3681         tevent_req_received(req);
3682         return NT_STATUS_OK;
3683 }
3684
3685 NTSTATUS rpccli_spoolss_EndPagePrinter(struct rpc_pipe_client *cli,
3686                                        TALLOC_CTX *mem_ctx,
3687                                        struct policy_handle *handle /* [in] [ref] */,
3688                                        WERROR *werror)
3689 {
3690         struct spoolss_EndPagePrinter r;
3691         NTSTATUS status;
3692
3693         /* In parameters */
3694         r.in.handle = handle;
3695
3696         if (DEBUGLEVEL >= 10) {
3697                 NDR_PRINT_IN_DEBUG(spoolss_EndPagePrinter, &r);
3698         }
3699
3700         status = cli->dispatch(cli,
3701                                 mem_ctx,
3702                                 &ndr_table_spoolss,
3703                                 NDR_SPOOLSS_ENDPAGEPRINTER,
3704                                 &r);
3705
3706         if (!NT_STATUS_IS_OK(status)) {
3707                 return status;
3708         }
3709
3710         if (DEBUGLEVEL >= 10) {
3711                 NDR_PRINT_OUT_DEBUG(spoolss_EndPagePrinter, &r);
3712         }
3713
3714         if (NT_STATUS_IS_ERR(status)) {
3715                 return status;
3716         }
3717
3718         /* Return variables */
3719
3720         /* Return result */
3721         if (werror) {
3722                 *werror = r.out.result;
3723         }
3724
3725         return werror_to_ntstatus(r.out.result);
3726 }
3727
3728 struct rpccli_spoolss_AbortPrinter_state {
3729         struct spoolss_AbortPrinter orig;
3730         struct spoolss_AbortPrinter tmp;
3731         TALLOC_CTX *out_mem_ctx;
3732         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
3733 };
3734
3735 static void rpccli_spoolss_AbortPrinter_done(struct tevent_req *subreq);
3736
3737 struct tevent_req *rpccli_spoolss_AbortPrinter_send(TALLOC_CTX *mem_ctx,
3738                                                     struct tevent_context *ev,
3739                                                     struct rpc_pipe_client *cli,
3740                                                     struct policy_handle *_handle /* [in] [ref] */)
3741 {
3742         struct tevent_req *req;
3743         struct rpccli_spoolss_AbortPrinter_state *state;
3744         struct tevent_req *subreq;
3745
3746         req = tevent_req_create(mem_ctx, &state,
3747                                 struct rpccli_spoolss_AbortPrinter_state);
3748         if (req == NULL) {
3749                 return NULL;
3750         }
3751         state->out_mem_ctx = NULL;
3752         state->dispatch_recv = cli->dispatch_recv;
3753
3754         /* In parameters */
3755         state->orig.in.handle = _handle;
3756
3757         /* Out parameters */
3758
3759         /* Result */
3760         ZERO_STRUCT(state->orig.out.result);
3761
3762         if (DEBUGLEVEL >= 10) {
3763                 NDR_PRINT_IN_DEBUG(spoolss_AbortPrinter, &state->orig);
3764         }
3765
3766         /* make a temporary copy, that we pass to the dispatch function */
3767         state->tmp = state->orig;
3768
3769         subreq = cli->dispatch_send(state, ev, cli,
3770                                     &ndr_table_spoolss,
3771                                     NDR_SPOOLSS_ABORTPRINTER,
3772                                     &state->tmp);
3773         if (tevent_req_nomem(subreq, req)) {
3774                 return tevent_req_post(req, ev);
3775         }
3776         tevent_req_set_callback(subreq, rpccli_spoolss_AbortPrinter_done, req);
3777         return req;
3778 }
3779
3780 static void rpccli_spoolss_AbortPrinter_done(struct tevent_req *subreq)
3781 {
3782         struct tevent_req *req = tevent_req_callback_data(
3783                 subreq, struct tevent_req);
3784         struct rpccli_spoolss_AbortPrinter_state *state = tevent_req_data(
3785                 req, struct rpccli_spoolss_AbortPrinter_state);
3786         NTSTATUS status;
3787         TALLOC_CTX *mem_ctx;
3788
3789         if (state->out_mem_ctx) {
3790                 mem_ctx = state->out_mem_ctx;
3791         } else {
3792                 mem_ctx = state;
3793         }
3794
3795         status = state->dispatch_recv(subreq, mem_ctx);
3796         TALLOC_FREE(subreq);
3797         if (!NT_STATUS_IS_OK(status)) {
3798                 tevent_req_nterror(req, status);
3799                 return;
3800         }
3801
3802         /* Copy out parameters */
3803
3804         /* Copy result */
3805         state->orig.out.result = state->tmp.out.result;
3806
3807         /* Reset temporary structure */
3808         ZERO_STRUCT(state->tmp);
3809
3810         if (DEBUGLEVEL >= 10) {
3811                 NDR_PRINT_OUT_DEBUG(spoolss_AbortPrinter, &state->orig);
3812         }
3813
3814         tevent_req_done(req);
3815 }
3816
3817 NTSTATUS rpccli_spoolss_AbortPrinter_recv(struct tevent_req *req,
3818                                           TALLOC_CTX *mem_ctx,
3819                                           WERROR *result)
3820 {
3821         struct rpccli_spoolss_AbortPrinter_state *state = tevent_req_data(
3822                 req, struct rpccli_spoolss_AbortPrinter_state);
3823         NTSTATUS status;
3824
3825         if (tevent_req_is_nterror(req, &status)) {
3826                 tevent_req_received(req);
3827                 return status;
3828         }
3829
3830         /* Steal possbile out parameters to the callers context */
3831         talloc_steal(mem_ctx, state->out_mem_ctx);
3832
3833         /* Return result */
3834         *result = state->orig.out.result;
3835
3836         tevent_req_received(req);
3837         return NT_STATUS_OK;
3838 }
3839
3840 NTSTATUS rpccli_spoolss_AbortPrinter(struct rpc_pipe_client *cli,
3841                                      TALLOC_CTX *mem_ctx,
3842                                      struct policy_handle *handle /* [in] [ref] */,
3843                                      WERROR *werror)
3844 {
3845         struct spoolss_AbortPrinter r;
3846         NTSTATUS status;
3847
3848         /* In parameters */
3849         r.in.handle = handle;
3850
3851         if (DEBUGLEVEL >= 10) {
3852                 NDR_PRINT_IN_DEBUG(spoolss_AbortPrinter, &r);
3853         }
3854
3855         status = cli->dispatch(cli,
3856                                 mem_ctx,
3857                                 &ndr_table_spoolss,
3858                                 NDR_SPOOLSS_ABORTPRINTER,
3859                                 &r);
3860
3861         if (!NT_STATUS_IS_OK(status)) {
3862                 return status;
3863         }
3864
3865         if (DEBUGLEVEL >= 10) {
3866                 NDR_PRINT_OUT_DEBUG(spoolss_AbortPrinter, &r);
3867         }
3868
3869         if (NT_STATUS_IS_ERR(status)) {
3870                 return status;
3871         }
3872
3873         /* Return variables */
3874
3875         /* Return result */
3876         if (werror) {
3877                 *werror = r.out.result;
3878         }
3879
3880         return werror_to_ntstatus(r.out.result);
3881 }
3882
3883 struct rpccli_spoolss_ReadPrinter_state {
3884         struct spoolss_ReadPrinter orig;
3885         struct spoolss_ReadPrinter tmp;
3886         TALLOC_CTX *out_mem_ctx;
3887         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
3888 };
3889
3890 static void rpccli_spoolss_ReadPrinter_done(struct tevent_req *subreq);
3891
3892 struct tevent_req *rpccli_spoolss_ReadPrinter_send(TALLOC_CTX *mem_ctx,
3893                                                    struct tevent_context *ev,
3894                                                    struct rpc_pipe_client *cli,
3895                                                    struct policy_handle *_handle /* [in] [ref] */,
3896                                                    uint8_t *_data /* [out] [ref,size_is(data_size)] */,
3897                                                    uint32_t _data_size /* [in]  */,
3898                                                    uint32_t *__data_size /* [out] [ref] */)
3899 {
3900         struct tevent_req *req;
3901         struct rpccli_spoolss_ReadPrinter_state *state;
3902         struct tevent_req *subreq;
3903
3904         req = tevent_req_create(mem_ctx, &state,
3905                                 struct rpccli_spoolss_ReadPrinter_state);
3906         if (req == NULL) {
3907                 return NULL;
3908         }
3909         state->out_mem_ctx = NULL;
3910         state->dispatch_recv = cli->dispatch_recv;
3911
3912         /* In parameters */
3913         state->orig.in.handle = _handle;
3914         state->orig.in.data_size = _data_size;
3915
3916         /* Out parameters */
3917         state->orig.out.data = _data;
3918         state->orig.out._data_size = __data_size;
3919
3920         /* Result */
3921         ZERO_STRUCT(state->orig.out.result);
3922
3923         if (DEBUGLEVEL >= 10) {
3924                 NDR_PRINT_IN_DEBUG(spoolss_ReadPrinter, &state->orig);
3925         }
3926
3927         state->out_mem_ctx = talloc_named_const(state, 0,
3928                              "rpccli_spoolss_ReadPrinter_out_memory");
3929         if (tevent_req_nomem(state->out_mem_ctx, req)) {
3930                 return tevent_req_post(req, ev);
3931         }
3932
3933         /* make a temporary copy, that we pass to the dispatch function */
3934         state->tmp = state->orig;
3935
3936         subreq = cli->dispatch_send(state, ev, cli,
3937                                     &ndr_table_spoolss,
3938                                     NDR_SPOOLSS_READPRINTER,
3939                                     &state->tmp);
3940         if (tevent_req_nomem(subreq, req)) {
3941                 return tevent_req_post(req, ev);
3942         }
3943         tevent_req_set_callback(subreq, rpccli_spoolss_ReadPrinter_done, req);
3944         return req;
3945 }
3946
3947 static void rpccli_spoolss_ReadPrinter_done(struct tevent_req *subreq)
3948 {
3949         struct tevent_req *req = tevent_req_callback_data(
3950                 subreq, struct tevent_req);
3951         struct rpccli_spoolss_ReadPrinter_state *state = tevent_req_data(
3952                 req, struct rpccli_spoolss_ReadPrinter_state);
3953         NTSTATUS status;
3954         TALLOC_CTX *mem_ctx;
3955
3956         if (state->out_mem_ctx) {
3957                 mem_ctx = state->out_mem_ctx;
3958         } else {
3959                 mem_ctx = state;
3960         }
3961
3962         status = state->dispatch_recv(subreq, mem_ctx);
3963         TALLOC_FREE(subreq);
3964         if (!NT_STATUS_IS_OK(status)) {
3965                 tevent_req_nterror(req, status);
3966                 return;
3967         }
3968
3969         /* Copy out parameters */
3970         memcpy(state->orig.out.data, state->tmp.out.data, state->tmp.in.data_size * sizeof(*state->orig.out.data));
3971         *state->orig.out._data_size = *state->tmp.out._data_size;
3972
3973         /* Copy result */
3974         state->orig.out.result = state->tmp.out.result;
3975
3976         /* Reset temporary structure */
3977         ZERO_STRUCT(state->tmp);
3978
3979         if (DEBUGLEVEL >= 10) {
3980                 NDR_PRINT_OUT_DEBUG(spoolss_ReadPrinter, &state->orig);
3981         }
3982
3983         tevent_req_done(req);
3984 }
3985
3986 NTSTATUS rpccli_spoolss_ReadPrinter_recv(struct tevent_req *req,
3987                                          TALLOC_CTX *mem_ctx,
3988                                          WERROR *result)
3989 {
3990         struct rpccli_spoolss_ReadPrinter_state *state = tevent_req_data(
3991                 req, struct rpccli_spoolss_ReadPrinter_state);
3992         NTSTATUS status;
3993
3994         if (tevent_req_is_nterror(req, &status)) {
3995                 tevent_req_received(req);
3996                 return status;
3997         }
3998
3999         /* Steal possbile out parameters to the callers context */
4000         talloc_steal(mem_ctx, state->out_mem_ctx);
4001
4002         /* Return result */
4003         *result = state->orig.out.result;
4004
4005         tevent_req_received(req);
4006         return NT_STATUS_OK;
4007 }
4008
4009 NTSTATUS rpccli_spoolss_ReadPrinter(struct rpc_pipe_client *cli,
4010                                     TALLOC_CTX *mem_ctx,
4011                                     struct policy_handle *handle /* [in] [ref] */,
4012                                     uint8_t *data /* [out] [ref,size_is(data_size)] */,
4013                                     uint32_t data_size /* [in]  */,
4014                                     uint32_t *_data_size /* [out] [ref] */,
4015                                     WERROR *werror)
4016 {
4017         struct spoolss_ReadPrinter r;
4018         NTSTATUS status;
4019
4020         /* In parameters */
4021         r.in.handle = handle;
4022         r.in.data_size = data_size;
4023
4024         if (DEBUGLEVEL >= 10) {
4025                 NDR_PRINT_IN_DEBUG(spoolss_ReadPrinter, &r);
4026         }
4027
4028         status = cli->dispatch(cli,
4029                                 mem_ctx,
4030                                 &ndr_table_spoolss,
4031                                 NDR_SPOOLSS_READPRINTER,
4032                                 &r);
4033
4034         if (!NT_STATUS_IS_OK(status)) {
4035                 return status;
4036         }
4037
4038         if (DEBUGLEVEL >= 10) {
4039                 NDR_PRINT_OUT_DEBUG(spoolss_ReadPrinter, &r);
4040         }
4041
4042         if (NT_STATUS_IS_ERR(status)) {
4043                 return status;
4044         }
4045
4046         /* Return variables */
4047         memcpy(data, r.out.data, r.in.data_size * sizeof(*data));
4048         *_data_size = *r.out._data_size;
4049
4050         /* Return result */
4051         if (werror) {
4052                 *werror = r.out.result;
4053         }
4054
4055         return werror_to_ntstatus(r.out.result);
4056 }
4057
4058 struct rpccli_spoolss_EndDocPrinter_state {
4059         struct spoolss_EndDocPrinter orig;
4060         struct spoolss_EndDocPrinter tmp;
4061         TALLOC_CTX *out_mem_ctx;
4062         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
4063 };
4064
4065 static void rpccli_spoolss_EndDocPrinter_done(struct tevent_req *subreq);
4066
4067 struct tevent_req *rpccli_spoolss_EndDocPrinter_send(TALLOC_CTX *mem_ctx,
4068                                                      struct tevent_context *ev,
4069                                                      struct rpc_pipe_client *cli,
4070                                                      struct policy_handle *_handle /* [in] [ref] */)
4071 {
4072         struct tevent_req *req;
4073         struct rpccli_spoolss_EndDocPrinter_state *state;
4074         struct tevent_req *subreq;
4075
4076         req = tevent_req_create(mem_ctx, &state,
4077                                 struct rpccli_spoolss_EndDocPrinter_state);
4078         if (req == NULL) {
4079                 return NULL;
4080         }
4081         state->out_mem_ctx = NULL;
4082         state->dispatch_recv = cli->dispatch_recv;
4083
4084         /* In parameters */
4085         state->orig.in.handle = _handle;
4086
4087         /* Out parameters */
4088
4089         /* Result */
4090         ZERO_STRUCT(state->orig.out.result);
4091
4092         if (DEBUGLEVEL >= 10) {
4093                 NDR_PRINT_IN_DEBUG(spoolss_EndDocPrinter, &state->orig);
4094         }
4095
4096         /* make a temporary copy, that we pass to the dispatch function */
4097         state->tmp = state->orig;
4098
4099         subreq = cli->dispatch_send(state, ev, cli,
4100                                     &ndr_table_spoolss,
4101                                     NDR_SPOOLSS_ENDDOCPRINTER,
4102                                     &state->tmp);
4103         if (tevent_req_nomem(subreq, req)) {
4104                 return tevent_req_post(req, ev);
4105         }
4106         tevent_req_set_callback(subreq, rpccli_spoolss_EndDocPrinter_done, req);
4107         return req;
4108 }
4109
4110 static void rpccli_spoolss_EndDocPrinter_done(struct tevent_req *subreq)
4111 {
4112         struct tevent_req *req = tevent_req_callback_data(
4113                 subreq, struct tevent_req);
4114         struct rpccli_spoolss_EndDocPrinter_state *state = tevent_req_data(
4115                 req, struct rpccli_spoolss_EndDocPrinter_state);
4116         NTSTATUS status;
4117         TALLOC_CTX *mem_ctx;
4118
4119         if (state->out_mem_ctx) {
4120                 mem_ctx = state->out_mem_ctx;
4121         } else {
4122                 mem_ctx = state;
4123         }
4124
4125         status = state->dispatch_recv(subreq, mem_ctx);
4126         TALLOC_FREE(subreq);
4127         if (!NT_STATUS_IS_OK(status)) {
4128                 tevent_req_nterror(req, status);
4129                 return;
4130         }
4131
4132         /* Copy out parameters */
4133
4134         /* Copy result */
4135         state->orig.out.result = state->tmp.out.result;
4136
4137         /* Reset temporary structure */
4138         ZERO_STRUCT(state->tmp);
4139
4140         if (DEBUGLEVEL >= 10) {
4141                 NDR_PRINT_OUT_DEBUG(spoolss_EndDocPrinter, &state->orig);
4142         }
4143
4144         tevent_req_done(req);
4145 }
4146
4147 NTSTATUS rpccli_spoolss_EndDocPrinter_recv(struct tevent_req *req,
4148                                            TALLOC_CTX *mem_ctx,
4149                                            WERROR *result)
4150 {
4151         struct rpccli_spoolss_EndDocPrinter_state *state = tevent_req_data(
4152                 req, struct rpccli_spoolss_EndDocPrinter_state);
4153         NTSTATUS status;
4154
4155         if (tevent_req_is_nterror(req, &status)) {
4156                 tevent_req_received(req);
4157                 return status;
4158         }
4159
4160         /* Steal possbile out parameters to the callers context */
4161         talloc_steal(mem_ctx, state->out_mem_ctx);
4162
4163         /* Return result */
4164         *result = state->orig.out.result;
4165
4166         tevent_req_received(req);
4167         return NT_STATUS_OK;
4168 }
4169
4170 NTSTATUS rpccli_spoolss_EndDocPrinter(struct rpc_pipe_client *cli,
4171                                       TALLOC_CTX *mem_ctx,
4172                                       struct policy_handle *handle /* [in] [ref] */,
4173                                       WERROR *werror)
4174 {
4175         struct spoolss_EndDocPrinter r;
4176         NTSTATUS status;
4177
4178         /* In parameters */
4179         r.in.handle = handle;
4180
4181         if (DEBUGLEVEL >= 10) {
4182                 NDR_PRINT_IN_DEBUG(spoolss_EndDocPrinter, &r);
4183         }
4184
4185         status = cli->dispatch(cli,
4186                                 mem_ctx,
4187                                 &ndr_table_spoolss,
4188                                 NDR_SPOOLSS_ENDDOCPRINTER,
4189                                 &r);
4190
4191         if (!NT_STATUS_IS_OK(status)) {
4192                 return status;
4193         }
4194
4195         if (DEBUGLEVEL >= 10) {
4196                 NDR_PRINT_OUT_DEBUG(spoolss_EndDocPrinter, &r);
4197         }
4198
4199         if (NT_STATUS_IS_ERR(status)) {
4200                 return status;
4201         }
4202
4203         /* Return variables */
4204
4205         /* Return result */
4206         if (werror) {
4207                 *werror = r.out.result;
4208         }
4209
4210         return werror_to_ntstatus(r.out.result);
4211 }
4212
4213 struct rpccli_spoolss_AddJob_state {
4214         struct spoolss_AddJob orig;
4215         struct spoolss_AddJob tmp;
4216         TALLOC_CTX *out_mem_ctx;
4217         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
4218 };
4219
4220 static void rpccli_spoolss_AddJob_done(struct tevent_req *subreq);
4221
4222 struct tevent_req *rpccli_spoolss_AddJob_send(TALLOC_CTX *mem_ctx,
4223                                               struct tevent_context *ev,
4224                                               struct rpc_pipe_client *cli,
4225                                               struct policy_handle *_handle /* [in] [ref] */,
4226                                               uint32_t _level /* [in]  */,
4227                                               uint8_t *_buffer /* [in,out] [unique,size_is(offered)] */,
4228                                               uint32_t _offered /* [in]  */,
4229                                               uint32_t *_needed /* [out] [ref] */)
4230 {
4231         struct tevent_req *req;
4232         struct rpccli_spoolss_AddJob_state *state;
4233         struct tevent_req *subreq;
4234
4235         req = tevent_req_create(mem_ctx, &state,
4236                                 struct rpccli_spoolss_AddJob_state);
4237         if (req == NULL) {
4238                 return NULL;
4239         }
4240         state->out_mem_ctx = NULL;
4241         state->dispatch_recv = cli->dispatch_recv;
4242
4243         /* In parameters */
4244         state->orig.in.handle = _handle;
4245         state->orig.in.level = _level;
4246         state->orig.in.buffer = _buffer;
4247         state->orig.in.offered = _offered;
4248
4249         /* Out parameters */
4250         state->orig.out.buffer = _buffer;
4251         state->orig.out.needed = _needed;
4252
4253         /* Result */
4254         ZERO_STRUCT(state->orig.out.result);
4255
4256         if (DEBUGLEVEL >= 10) {
4257                 NDR_PRINT_IN_DEBUG(spoolss_AddJob, &state->orig);
4258         }
4259
4260         state->out_mem_ctx = talloc_named_const(state, 0,
4261                              "rpccli_spoolss_AddJob_out_memory");
4262         if (tevent_req_nomem(state->out_mem_ctx, req)) {
4263                 return tevent_req_post(req, ev);
4264         }
4265
4266         /* make a temporary copy, that we pass to the dispatch function */
4267         state->tmp = state->orig;
4268
4269         subreq = cli->dispatch_send(state, ev, cli,
4270                                     &ndr_table_spoolss,
4271                                     NDR_SPOOLSS_ADDJOB,
4272                                     &state->tmp);
4273         if (tevent_req_nomem(subreq, req)) {
4274                 return tevent_req_post(req, ev);
4275         }
4276         tevent_req_set_callback(subreq, rpccli_spoolss_AddJob_done, req);
4277         return req;
4278 }
4279
4280 static void rpccli_spoolss_AddJob_done(struct tevent_req *subreq)
4281 {
4282         struct tevent_req *req = tevent_req_callback_data(
4283                 subreq, struct tevent_req);
4284         struct rpccli_spoolss_AddJob_state *state = tevent_req_data(
4285                 req, struct rpccli_spoolss_AddJob_state);
4286         NTSTATUS status;
4287         TALLOC_CTX *mem_ctx;
4288
4289         if (state->out_mem_ctx) {
4290                 mem_ctx = state->out_mem_ctx;
4291         } else {
4292                 mem_ctx = state;
4293         }
4294
4295         status = state->dispatch_recv(subreq, mem_ctx);
4296         TALLOC_FREE(subreq);
4297         if (!NT_STATUS_IS_OK(status)) {
4298                 tevent_req_nterror(req, status);
4299                 return;
4300         }
4301
4302         /* Copy out parameters */
4303         if (state->orig.out.buffer && state->tmp.out.buffer) {
4304                 memcpy(state->orig.out.buffer, state->tmp.out.buffer, state->tmp.in.offered * sizeof(*state->orig.out.buffer));
4305         }
4306         *state->orig.out.needed = *state->tmp.out.needed;
4307
4308         /* Copy result */
4309         state->orig.out.result = state->tmp.out.result;
4310
4311         /* Reset temporary structure */
4312         ZERO_STRUCT(state->tmp);
4313
4314         if (DEBUGLEVEL >= 10) {
4315                 NDR_PRINT_OUT_DEBUG(spoolss_AddJob, &state->orig);
4316         }
4317
4318         tevent_req_done(req);
4319 }
4320
4321 NTSTATUS rpccli_spoolss_AddJob_recv(struct tevent_req *req,
4322                                     TALLOC_CTX *mem_ctx,
4323                                     WERROR *result)
4324 {
4325         struct rpccli_spoolss_AddJob_state *state = tevent_req_data(
4326                 req, struct rpccli_spoolss_AddJob_state);
4327         NTSTATUS status;
4328
4329         if (tevent_req_is_nterror(req, &status)) {
4330                 tevent_req_received(req);
4331                 return status;
4332         }
4333
4334         /* Steal possbile out parameters to the callers context */
4335         talloc_steal(mem_ctx, state->out_mem_ctx);
4336
4337         /* Return result */
4338         *result = state->orig.out.result;
4339
4340         tevent_req_received(req);
4341         return NT_STATUS_OK;
4342 }
4343
4344 NTSTATUS rpccli_spoolss_AddJob(struct rpc_pipe_client *cli,
4345                                TALLOC_CTX *mem_ctx,
4346                                struct policy_handle *handle /* [in] [ref] */,
4347                                uint32_t level /* [in]  */,
4348                                uint8_t *buffer /* [in,out] [unique,size_is(offered)] */,
4349                                uint32_t offered /* [in]  */,
4350                                uint32_t *needed /* [out] [ref] */,
4351                                WERROR *werror)
4352 {
4353         struct spoolss_AddJob r;
4354         NTSTATUS status;
4355
4356         /* In parameters */
4357         r.in.handle = handle;
4358         r.in.level = level;
4359         r.in.buffer = buffer;
4360         r.in.offered = offered;
4361
4362         if (DEBUGLEVEL >= 10) {
4363                 NDR_PRINT_IN_DEBUG(spoolss_AddJob, &r);
4364         }
4365
4366         status = cli->dispatch(cli,
4367                                 mem_ctx,
4368                                 &ndr_table_spoolss,
4369                                 NDR_SPOOLSS_ADDJOB,
4370                                 &r);
4371
4372         if (!NT_STATUS_IS_OK(status)) {
4373                 return status;
4374         }
4375
4376         if (DEBUGLEVEL >= 10) {
4377                 NDR_PRINT_OUT_DEBUG(spoolss_AddJob, &r);
4378         }
4379
4380         if (NT_STATUS_IS_ERR(status)) {
4381                 return status;
4382         }
4383
4384         /* Return variables */
4385         if (buffer && r.out.buffer) {
4386                 memcpy(buffer, r.out.buffer, r.in.offered * sizeof(*buffer));
4387         }
4388         *needed = *r.out.needed;
4389
4390         /* Return result */
4391         if (werror) {
4392                 *werror = r.out.result;
4393         }
4394
4395         return werror_to_ntstatus(r.out.result);
4396 }
4397
4398 struct rpccli_spoolss_ScheduleJob_state {
4399         struct spoolss_ScheduleJob orig;
4400         struct spoolss_ScheduleJob tmp;
4401         TALLOC_CTX *out_mem_ctx;
4402         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
4403 };
4404
4405 static void rpccli_spoolss_ScheduleJob_done(struct tevent_req *subreq);
4406
4407 struct tevent_req *rpccli_spoolss_ScheduleJob_send(TALLOC_CTX *mem_ctx,
4408                                                    struct tevent_context *ev,
4409                                                    struct rpc_pipe_client *cli,
4410                                                    struct policy_handle *_handle /* [in] [ref] */,
4411                                                    uint32_t _jobid /* [in]  */)
4412 {
4413         struct tevent_req *req;
4414         struct rpccli_spoolss_ScheduleJob_state *state;
4415         struct tevent_req *subreq;
4416
4417         req = tevent_req_create(mem_ctx, &state,
4418                                 struct rpccli_spoolss_ScheduleJob_state);
4419         if (req == NULL) {
4420                 return NULL;
4421         }
4422         state->out_mem_ctx = NULL;
4423         state->dispatch_recv = cli->dispatch_recv;
4424
4425         /* In parameters */
4426         state->orig.in.handle = _handle;
4427         state->orig.in.jobid = _jobid;
4428
4429         /* Out parameters */
4430
4431         /* Result */
4432         ZERO_STRUCT(state->orig.out.result);
4433
4434         if (DEBUGLEVEL >= 10) {
4435                 NDR_PRINT_IN_DEBUG(spoolss_ScheduleJob, &state->orig);
4436         }
4437
4438         /* make a temporary copy, that we pass to the dispatch function */
4439         state->tmp = state->orig;
4440
4441         subreq = cli->dispatch_send(state, ev, cli,
4442                                     &ndr_table_spoolss,
4443                                     NDR_SPOOLSS_SCHEDULEJOB,
4444                                     &state->tmp);
4445         if (tevent_req_nomem(subreq, req)) {
4446                 return tevent_req_post(req, ev);
4447         }
4448         tevent_req_set_callback(subreq, rpccli_spoolss_ScheduleJob_done, req);
4449         return req;
4450 }
4451
4452 static void rpccli_spoolss_ScheduleJob_done(struct tevent_req *subreq)
4453 {
4454         struct tevent_req *req = tevent_req_callback_data(
4455                 subreq, struct tevent_req);
4456         struct rpccli_spoolss_ScheduleJob_state *state = tevent_req_data(
4457                 req, struct rpccli_spoolss_ScheduleJob_state);
4458         NTSTATUS status;
4459         TALLOC_CTX *mem_ctx;
4460
4461         if (state->out_mem_ctx) {
4462                 mem_ctx = state->out_mem_ctx;
4463         } else {
4464                 mem_ctx = state;
4465         }
4466
4467         status = state->dispatch_recv(subreq, mem_ctx);
4468         TALLOC_FREE(subreq);
4469         if (!NT_STATUS_IS_OK(status)) {
4470                 tevent_req_nterror(req, status);
4471                 return;
4472         }
4473
4474         /* Copy out parameters */
4475
4476         /* Copy result */
4477         state->orig.out.result = state->tmp.out.result;
4478
4479         /* Reset temporary structure */
4480         ZERO_STRUCT(state->tmp);
4481
4482         if (DEBUGLEVEL >= 10) {
4483                 NDR_PRINT_OUT_DEBUG(spoolss_ScheduleJob, &state->orig);
4484         }
4485
4486         tevent_req_done(req);
4487 }
4488
4489 NTSTATUS rpccli_spoolss_ScheduleJob_recv(struct tevent_req *req,
4490                                          TALLOC_CTX *mem_ctx,
4491                                          WERROR *result)
4492 {
4493         struct rpccli_spoolss_ScheduleJob_state *state = tevent_req_data(
4494                 req, struct rpccli_spoolss_ScheduleJob_state);
4495         NTSTATUS status;
4496
4497         if (tevent_req_is_nterror(req, &status)) {
4498                 tevent_req_received(req);
4499                 return status;
4500         }
4501
4502         /* Steal possbile out parameters to the callers context */
4503         talloc_steal(mem_ctx, state->out_mem_ctx);
4504
4505         /* Return result */
4506         *result = state->orig.out.result;
4507
4508         tevent_req_received(req);
4509         return NT_STATUS_OK;
4510 }
4511
4512 NTSTATUS rpccli_spoolss_ScheduleJob(struct rpc_pipe_client *cli,
4513                                     TALLOC_CTX *mem_ctx,
4514                                     struct policy_handle *handle /* [in] [ref] */,
4515                                     uint32_t jobid /* [in]  */,
4516                                     WERROR *werror)
4517 {
4518         struct spoolss_ScheduleJob r;
4519         NTSTATUS status;
4520
4521         /* In parameters */
4522         r.in.handle = handle;
4523         r.in.jobid = jobid;
4524
4525         if (DEBUGLEVEL >= 10) {
4526                 NDR_PRINT_IN_DEBUG(spoolss_ScheduleJob, &r);
4527         }
4528
4529         status = cli->dispatch(cli,
4530                                 mem_ctx,
4531                                 &ndr_table_spoolss,
4532                                 NDR_SPOOLSS_SCHEDULEJOB,
4533                                 &r);
4534
4535         if (!NT_STATUS_IS_OK(status)) {
4536                 return status;
4537         }
4538
4539         if (DEBUGLEVEL >= 10) {
4540                 NDR_PRINT_OUT_DEBUG(spoolss_ScheduleJob, &r);
4541         }
4542
4543         if (NT_STATUS_IS_ERR(status)) {
4544                 return status;
4545         }
4546
4547         /* Return variables */
4548
4549         /* Return result */
4550         if (werror) {
4551                 *werror = r.out.result;
4552         }
4553
4554         return werror_to_ntstatus(r.out.result);
4555 }
4556
4557 struct rpccli_spoolss_GetPrinterData_state {
4558         struct spoolss_GetPrinterData orig;
4559         struct spoolss_GetPrinterData tmp;
4560         TALLOC_CTX *out_mem_ctx;
4561         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
4562 };
4563
4564 static void rpccli_spoolss_GetPrinterData_done(struct tevent_req *subreq);
4565
4566 struct tevent_req *rpccli_spoolss_GetPrinterData_send(TALLOC_CTX *mem_ctx,
4567                                                       struct tevent_context *ev,
4568                                                       struct rpc_pipe_client *cli,
4569                                                       struct policy_handle *_handle /* [in] [ref] */,
4570                                                       const char *_value_name /* [in] [charset(UTF16)] */,
4571                                                       uint32_t _offered /* [in]  */,
4572                                                       enum winreg_Type *_type /* [out] [ref] */,
4573                                                       union spoolss_PrinterData *_data /* [out] [subcontext_size(offered),ref,subcontext(4),switch_is(*type)] */,
4574                                                       uint32_t *_needed /* [out] [ref] */)
4575 {
4576         struct tevent_req *req;
4577         struct rpccli_spoolss_GetPrinterData_state *state;
4578         struct tevent_req *subreq;
4579
4580         req = tevent_req_create(mem_ctx, &state,
4581                                 struct rpccli_spoolss_GetPrinterData_state);
4582         if (req == NULL) {
4583                 return NULL;
4584         }
4585         state->out_mem_ctx = NULL;
4586         state->dispatch_recv = cli->dispatch_recv;
4587
4588         /* In parameters */
4589         state->orig.in.handle = _handle;
4590         state->orig.in.value_name = _value_name;
4591         state->orig.in.offered = _offered;
4592
4593         /* Out parameters */
4594         state->orig.out.type = _type;
4595         state->orig.out.data = _data;
4596         state->orig.out.needed = _needed;
4597
4598         /* Result */
4599         ZERO_STRUCT(state->orig.out.result);
4600
4601         if (DEBUGLEVEL >= 10) {
4602                 NDR_PRINT_IN_DEBUG(spoolss_GetPrinterData, &state->orig);
4603         }
4604
4605         state->out_mem_ctx = talloc_named_const(state, 0,
4606                              "rpccli_spoolss_GetPrinterData_out_memory");
4607         if (tevent_req_nomem(state->out_mem_ctx, req)) {
4608                 return tevent_req_post(req, ev);
4609         }
4610
4611         /* make a temporary copy, that we pass to the dispatch function */
4612         state->tmp = state->orig;
4613
4614         subreq = cli->dispatch_send(state, ev, cli,
4615                                     &ndr_table_spoolss,
4616                                     NDR_SPOOLSS_GETPRINTERDATA,
4617                                     &state->tmp);
4618         if (tevent_req_nomem(subreq, req)) {
4619                 return tevent_req_post(req, ev);
4620         }
4621         tevent_req_set_callback(subreq, rpccli_spoolss_GetPrinterData_done, req);
4622         return req;
4623 }
4624
4625 static void rpccli_spoolss_GetPrinterData_done(struct tevent_req *subreq)
4626 {
4627         struct tevent_req *req = tevent_req_callback_data(
4628                 subreq, struct tevent_req);
4629         struct rpccli_spoolss_GetPrinterData_state *state = tevent_req_data(
4630                 req, struct rpccli_spoolss_GetPrinterData_state);
4631         NTSTATUS status;
4632         TALLOC_CTX *mem_ctx;
4633
4634         if (state->out_mem_ctx) {
4635                 mem_ctx = state->out_mem_ctx;
4636         } else {
4637                 mem_ctx = state;
4638         }
4639
4640         status = state->dispatch_recv(subreq, mem_ctx);
4641         TALLOC_FREE(subreq);
4642         if (!NT_STATUS_IS_OK(status)) {
4643                 tevent_req_nterror(req, status);
4644                 return;
4645         }
4646
4647         /* Copy out parameters */
4648         *state->orig.out.type = *state->tmp.out.type;
4649         *state->orig.out.data = *state->tmp.out.data;
4650         *state->orig.out.needed = *state->tmp.out.needed;
4651
4652         /* Copy result */
4653         state->orig.out.result = state->tmp.out.result;
4654
4655         /* Reset temporary structure */
4656         ZERO_STRUCT(state->tmp);
4657
4658         if (DEBUGLEVEL >= 10) {
4659                 NDR_PRINT_OUT_DEBUG(spoolss_GetPrinterData, &state->orig);
4660         }
4661
4662         tevent_req_done(req);
4663 }
4664
4665 NTSTATUS rpccli_spoolss_GetPrinterData_recv(struct tevent_req *req,
4666                                             TALLOC_CTX *mem_ctx,
4667                                             WERROR *result)
4668 {
4669         struct rpccli_spoolss_GetPrinterData_state *state = tevent_req_data(
4670                 req, struct rpccli_spoolss_GetPrinterData_state);
4671         NTSTATUS status;
4672
4673         if (tevent_req_is_nterror(req, &status)) {
4674                 tevent_req_received(req);
4675                 return status;
4676         }
4677
4678         /* Steal possbile out parameters to the callers context */
4679         talloc_steal(mem_ctx, state->out_mem_ctx);
4680
4681         /* Return result */
4682         *result = state->orig.out.result;
4683
4684         tevent_req_received(req);
4685         return NT_STATUS_OK;
4686 }
4687
4688 NTSTATUS rpccli_spoolss_GetPrinterData(struct rpc_pipe_client *cli,
4689                                        TALLOC_CTX *mem_ctx,
4690                                        struct policy_handle *handle /* [in] [ref] */,
4691                                        const char *value_name /* [in] [charset(UTF16)] */,
4692                                        uint32_t offered /* [in]  */,
4693                                        enum winreg_Type *type /* [out] [ref] */,
4694                                        union spoolss_PrinterData *data /* [out] [subcontext_size(offered),ref,subcontext(4),switch_is(*type)] */,
4695                                        uint32_t *needed /* [out] [ref] */,
4696                                        WERROR *werror)
4697 {
4698         struct spoolss_GetPrinterData r;
4699         NTSTATUS status;
4700
4701         /* In parameters */
4702         r.in.handle = handle;
4703         r.in.value_name = value_name;
4704         r.in.offered = offered;
4705
4706         if (DEBUGLEVEL >= 10) {
4707                 NDR_PRINT_IN_DEBUG(spoolss_GetPrinterData, &r);
4708         }
4709
4710         status = cli->dispatch(cli,
4711                                 mem_ctx,
4712                                 &ndr_table_spoolss,
4713                                 NDR_SPOOLSS_GETPRINTERDATA,
4714                                 &r);
4715
4716         if (!NT_STATUS_IS_OK(status)) {
4717                 return status;
4718         }
4719
4720         if (DEBUGLEVEL >= 10) {
4721                 NDR_PRINT_OUT_DEBUG(spoolss_GetPrinterData, &r);
4722         }
4723
4724         if (NT_STATUS_IS_ERR(status)) {
4725                 return status;
4726         }
4727
4728         /* Return variables */
4729         *type = *r.out.type;
4730         *data = *r.out.data;
4731         *needed = *r.out.needed;
4732
4733         /* Return result */
4734         if (werror) {
4735                 *werror = r.out.result;
4736         }
4737
4738         return werror_to_ntstatus(r.out.result);
4739 }
4740
4741 struct rpccli_spoolss_SetPrinterData_state {
4742         struct spoolss_SetPrinterData orig;
4743         struct spoolss_SetPrinterData tmp;
4744         TALLOC_CTX *out_mem_ctx;
4745         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
4746 };
4747
4748 static void rpccli_spoolss_SetPrinterData_done(struct tevent_req *subreq);
4749
4750 struct tevent_req *rpccli_spoolss_SetPrinterData_send(TALLOC_CTX *mem_ctx,
4751                                                       struct tevent_context *ev,
4752                                                       struct rpc_pipe_client *cli,
4753                                                       struct policy_handle *_handle /* [in] [ref] */,
4754                                                       const char *_value_name /* [in] [charset(UTF16)] */,
4755                                                       enum winreg_Type _type /* [in]  */,
4756                                                       union spoolss_PrinterData _data /* [in] [subcontext(4),switch_is(type)] */,
4757                                                       uint32_t __offered /* [in] [value(ndr_size_spoolss_PrinterData(&data,type,ndr->iconv_convenience,flags))] */)
4758 {
4759         struct tevent_req *req;
4760         struct rpccli_spoolss_SetPrinterData_state *state;
4761         struct tevent_req *subreq;
4762
4763         req = tevent_req_create(mem_ctx, &state,
4764                                 struct rpccli_spoolss_SetPrinterData_state);
4765         if (req == NULL) {
4766                 return NULL;
4767         }
4768         state->out_mem_ctx = NULL;
4769         state->dispatch_recv = cli->dispatch_recv;
4770
4771         /* In parameters */
4772         state->orig.in.handle = _handle;
4773         state->orig.in.value_name = _value_name;
4774         state->orig.in.type = _type;
4775         state->orig.in.data = _data;
4776         state->orig.in._offered = __offered;
4777
4778         /* Out parameters */
4779
4780         /* Result */
4781         ZERO_STRUCT(state->orig.out.result);
4782
4783         if (DEBUGLEVEL >= 10) {
4784                 NDR_PRINT_IN_DEBUG(spoolss_SetPrinterData, &state->orig);
4785         }
4786
4787         /* make a temporary copy, that we pass to the dispatch function */
4788         state->tmp = state->orig;
4789
4790         subreq = cli->dispatch_send(state, ev, cli,
4791                                     &ndr_table_spoolss,
4792                                     NDR_SPOOLSS_SETPRINTERDATA,
4793                                     &state->tmp);
4794         if (tevent_req_nomem(subreq, req)) {
4795                 return tevent_req_post(req, ev);
4796         }
4797         tevent_req_set_callback(subreq, rpccli_spoolss_SetPrinterData_done, req);
4798         return req;
4799 }
4800
4801 static void rpccli_spoolss_SetPrinterData_done(struct tevent_req *subreq)
4802 {
4803         struct tevent_req *req = tevent_req_callback_data(
4804                 subreq, struct tevent_req);
4805         struct rpccli_spoolss_SetPrinterData_state *state = tevent_req_data(
4806                 req, struct rpccli_spoolss_SetPrinterData_state);
4807         NTSTATUS status;
4808         TALLOC_CTX *mem_ctx;
4809
4810         if (state->out_mem_ctx) {
4811                 mem_ctx = state->out_mem_ctx;
4812         } else {
4813                 mem_ctx = state;
4814         }
4815
4816         status = state->dispatch_recv(subreq, mem_ctx);
4817         TALLOC_FREE(subreq);
4818         if (!NT_STATUS_IS_OK(status)) {
4819                 tevent_req_nterror(req, status);
4820                 return;
4821         }
4822
4823         /* Copy out parameters */
4824
4825         /* Copy result */
4826         state->orig.out.result = state->tmp.out.result;
4827
4828         /* Reset temporary structure */
4829         ZERO_STRUCT(state->tmp);
4830
4831         if (DEBUGLEVEL >= 10) {
4832                 NDR_PRINT_OUT_DEBUG(spoolss_SetPrinterData, &state->orig);
4833         }
4834
4835         tevent_req_done(req);
4836 }
4837
4838 NTSTATUS rpccli_spoolss_SetPrinterData_recv(struct tevent_req *req,
4839                                             TALLOC_CTX *mem_ctx,
4840                                             WERROR *result)
4841 {
4842         struct rpccli_spoolss_SetPrinterData_state *state = tevent_req_data(
4843                 req, struct rpccli_spoolss_SetPrinterData_state);
4844         NTSTATUS status;
4845
4846         if (tevent_req_is_nterror(req, &status)) {
4847                 tevent_req_received(req);
4848                 return status;
4849         }
4850
4851         /* Steal possbile out parameters to the callers context */
4852         talloc_steal(mem_ctx, state->out_mem_ctx);
4853
4854         /* Return result */
4855         *result = state->orig.out.result;
4856
4857         tevent_req_received(req);
4858         return NT_STATUS_OK;
4859 }
4860
4861 NTSTATUS rpccli_spoolss_SetPrinterData(struct rpc_pipe_client *cli,
4862                                        TALLOC_CTX *mem_ctx,
4863                                        struct policy_handle *handle /* [in] [ref] */,
4864                                        const char *value_name /* [in] [charset(UTF16)] */,
4865                                        enum winreg_Type type /* [in]  */,
4866                                        union spoolss_PrinterData data /* [in] [subcontext(4),switch_is(type)] */,
4867                                        uint32_t _offered /* [in] [value(ndr_size_spoolss_PrinterData(&data,type,ndr->iconv_convenience,flags))] */,
4868                                        WERROR *werror)
4869 {
4870         struct spoolss_SetPrinterData r;
4871         NTSTATUS status;
4872
4873         /* In parameters */
4874         r.in.handle = handle;
4875         r.in.value_name = value_name;
4876         r.in.type = type;
4877         r.in.data = data;
4878         r.in._offered = _offered;
4879
4880         if (DEBUGLEVEL >= 10) {
4881                 NDR_PRINT_IN_DEBUG(spoolss_SetPrinterData, &r);
4882         }
4883
4884         status = cli->dispatch(cli,
4885                                 mem_ctx,
4886                                 &ndr_table_spoolss,
4887                                 NDR_SPOOLSS_SETPRINTERDATA,
4888                                 &r);
4889
4890         if (!NT_STATUS_IS_OK(status)) {
4891                 return status;
4892         }
4893
4894         if (DEBUGLEVEL >= 10) {
4895                 NDR_PRINT_OUT_DEBUG(spoolss_SetPrinterData, &r);
4896         }
4897
4898         if (NT_STATUS_IS_ERR(status)) {
4899                 return status;
4900         }
4901
4902         /* Return variables */
4903
4904         /* Return result */
4905         if (werror) {
4906                 *werror = r.out.result;
4907         }
4908
4909         return werror_to_ntstatus(r.out.result);
4910 }
4911
4912 struct rpccli_spoolss_WaitForPrinterChange_state {
4913         struct spoolss_WaitForPrinterChange orig;
4914         struct spoolss_WaitForPrinterChange tmp;
4915         TALLOC_CTX *out_mem_ctx;
4916         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
4917 };
4918
4919 static void rpccli_spoolss_WaitForPrinterChange_done(struct tevent_req *subreq);
4920
4921 struct tevent_req *rpccli_spoolss_WaitForPrinterChange_send(TALLOC_CTX *mem_ctx,
4922                                                             struct tevent_context *ev,
4923                                                             struct rpc_pipe_client *cli)
4924 {
4925         struct tevent_req *req;
4926         struct rpccli_spoolss_WaitForPrinterChange_state *state;
4927         struct tevent_req *subreq;
4928
4929         req = tevent_req_create(mem_ctx, &state,
4930                                 struct rpccli_spoolss_WaitForPrinterChange_state);
4931         if (req == NULL) {
4932                 return NULL;
4933         }
4934         state->out_mem_ctx = NULL;
4935         state->dispatch_recv = cli->dispatch_recv;
4936
4937         /* In parameters */
4938
4939         /* Out parameters */
4940
4941         /* Result */
4942         ZERO_STRUCT(state->orig.out.result);
4943
4944         if (DEBUGLEVEL >= 10) {
4945                 NDR_PRINT_IN_DEBUG(spoolss_WaitForPrinterChange, &state->orig);
4946         }
4947
4948         /* make a temporary copy, that we pass to the dispatch function */
4949         state->tmp = state->orig;
4950
4951         subreq = cli->dispatch_send(state, ev, cli,
4952                                     &ndr_table_spoolss,
4953                                     NDR_SPOOLSS_WAITFORPRINTERCHANGE,
4954                                     &state->tmp);
4955         if (tevent_req_nomem(subreq, req)) {
4956                 return tevent_req_post(req, ev);
4957         }
4958         tevent_req_set_callback(subreq, rpccli_spoolss_WaitForPrinterChange_done, req);
4959         return req;
4960 }
4961
4962 static void rpccli_spoolss_WaitForPrinterChange_done(struct tevent_req *subreq)
4963 {
4964         struct tevent_req *req = tevent_req_callback_data(
4965                 subreq, struct tevent_req);
4966         struct rpccli_spoolss_WaitForPrinterChange_state *state = tevent_req_data(
4967                 req, struct rpccli_spoolss_WaitForPrinterChange_state);
4968         NTSTATUS status;
4969         TALLOC_CTX *mem_ctx;
4970
4971         if (state->out_mem_ctx) {
4972                 mem_ctx = state->out_mem_ctx;
4973         } else {
4974                 mem_ctx = state;
4975         }
4976
4977         status = state->dispatch_recv(subreq, mem_ctx);
4978         TALLOC_FREE(subreq);
4979         if (!NT_STATUS_IS_OK(status)) {
4980                 tevent_req_nterror(req, status);
4981                 return;
4982         }
4983
4984         /* Copy out parameters */
4985
4986         /* Copy result */
4987         state->orig.out.result = state->tmp.out.result;
4988
4989         /* Reset temporary structure */
4990         ZERO_STRUCT(state->tmp);
4991
4992         if (DEBUGLEVEL >= 10) {
4993                 NDR_PRINT_OUT_DEBUG(spoolss_WaitForPrinterChange, &state->orig);
4994         }
4995
4996         tevent_req_done(req);
4997 }
4998
4999 NTSTATUS rpccli_spoolss_WaitForPrinterChange_recv(struct tevent_req *req,
5000                                                   TALLOC_CTX *mem_ctx,
5001                                                   WERROR *result)
5002 {
5003         struct rpccli_spoolss_WaitForPrinterChange_state *state = tevent_req_data(
5004                 req, struct rpccli_spoolss_WaitForPrinterChange_state);
5005         NTSTATUS status;
5006
5007         if (tevent_req_is_nterror(req, &status)) {
5008                 tevent_req_received(req);
5009                 return status;
5010         }
5011
5012         /* Steal possbile out parameters to the callers context */
5013         talloc_steal(mem_ctx, state->out_mem_ctx);
5014
5015         /* Return result */
5016         *result = state->orig.out.result;
5017
5018         tevent_req_received(req);
5019         return NT_STATUS_OK;
5020 }
5021
5022 NTSTATUS rpccli_spoolss_WaitForPrinterChange(struct rpc_pipe_client *cli,
5023                                              TALLOC_CTX *mem_ctx,
5024                                              WERROR *werror)
5025 {
5026         struct spoolss_WaitForPrinterChange r;
5027         NTSTATUS status;
5028
5029         /* In parameters */
5030
5031         if (DEBUGLEVEL >= 10) {
5032                 NDR_PRINT_IN_DEBUG(spoolss_WaitForPrinterChange, &r);
5033         }
5034
5035         status = cli->dispatch(cli,
5036                                 mem_ctx,
5037                                 &ndr_table_spoolss,
5038                                 NDR_SPOOLSS_WAITFORPRINTERCHANGE,
5039                                 &r);
5040
5041         if (!NT_STATUS_IS_OK(status)) {
5042                 return status;
5043         }
5044
5045         if (DEBUGLEVEL >= 10) {
5046                 NDR_PRINT_OUT_DEBUG(spoolss_WaitForPrinterChange, &r);
5047         }
5048
5049         if (NT_STATUS_IS_ERR(status)) {
5050                 return status;
5051         }
5052
5053         /* Return variables */
5054
5055         /* Return result */
5056         if (werror) {
5057                 *werror = r.out.result;
5058         }
5059
5060         return werror_to_ntstatus(r.out.result);
5061 }
5062
5063 struct rpccli_spoolss_ClosePrinter_state {
5064         struct spoolss_ClosePrinter orig;
5065         struct spoolss_ClosePrinter tmp;
5066         TALLOC_CTX *out_mem_ctx;
5067         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
5068 };
5069
5070 static void rpccli_spoolss_ClosePrinter_done(struct tevent_req *subreq);
5071
5072 struct tevent_req *rpccli_spoolss_ClosePrinter_send(TALLOC_CTX *mem_ctx,
5073                                                     struct tevent_context *ev,
5074                                                     struct rpc_pipe_client *cli,
5075                                                     struct policy_handle *_handle /* [in,out] [ref] */)
5076 {
5077         struct tevent_req *req;
5078         struct rpccli_spoolss_ClosePrinter_state *state;
5079         struct tevent_req *subreq;
5080
5081         req = tevent_req_create(mem_ctx, &state,
5082                                 struct rpccli_spoolss_ClosePrinter_state);
5083         if (req == NULL) {
5084                 return NULL;
5085         }
5086         state->out_mem_ctx = NULL;
5087         state->dispatch_recv = cli->dispatch_recv;
5088
5089         /* In parameters */
5090         state->orig.in.handle = _handle;
5091
5092         /* Out parameters */
5093         state->orig.out.handle = _handle;
5094
5095         /* Result */
5096         ZERO_STRUCT(state->orig.out.result);
5097
5098         if (DEBUGLEVEL >= 10) {
5099                 NDR_PRINT_IN_DEBUG(spoolss_ClosePrinter, &state->orig);
5100         }
5101
5102         state->out_mem_ctx = talloc_named_const(state, 0,
5103                              "rpccli_spoolss_ClosePrinter_out_memory");
5104         if (tevent_req_nomem(state->out_mem_ctx, req)) {
5105                 return tevent_req_post(req, ev);
5106         }
5107
5108         /* make a temporary copy, that we pass to the dispatch function */
5109         state->tmp = state->orig;
5110
5111         subreq = cli->dispatch_send(state, ev, cli,
5112                                     &ndr_table_spoolss,
5113                                     NDR_SPOOLSS_CLOSEPRINTER,
5114                                     &state->tmp);
5115         if (tevent_req_nomem(subreq, req)) {
5116                 return tevent_req_post(req, ev);
5117         }
5118         tevent_req_set_callback(subreq, rpccli_spoolss_ClosePrinter_done, req);
5119         return req;
5120 }
5121
5122 static void rpccli_spoolss_ClosePrinter_done(struct tevent_req *subreq)
5123 {
5124         struct tevent_req *req = tevent_req_callback_data(
5125                 subreq, struct tevent_req);
5126         struct rpccli_spoolss_ClosePrinter_state *state = tevent_req_data(
5127                 req, struct rpccli_spoolss_ClosePrinter_state);
5128         NTSTATUS status;
5129         TALLOC_CTX *mem_ctx;
5130
5131         if (state->out_mem_ctx) {
5132                 mem_ctx = state->out_mem_ctx;
5133         } else {
5134                 mem_ctx = state;
5135         }
5136
5137         status = state->dispatch_recv(subreq, mem_ctx);
5138         TALLOC_FREE(subreq);
5139         if (!NT_STATUS_IS_OK(status)) {
5140                 tevent_req_nterror(req, status);
5141                 return;
5142         }
5143
5144         /* Copy out parameters */
5145         *state->orig.out.handle = *state->tmp.out.handle;
5146
5147         /* Copy result */
5148         state->orig.out.result = state->tmp.out.result;
5149
5150         /* Reset temporary structure */
5151         ZERO_STRUCT(state->tmp);
5152
5153         if (DEBUGLEVEL >= 10) {
5154                 NDR_PRINT_OUT_DEBUG(spoolss_ClosePrinter, &state->orig);
5155         }
5156
5157         tevent_req_done(req);
5158 }
5159
5160 NTSTATUS rpccli_spoolss_ClosePrinter_recv(struct tevent_req *req,
5161                                           TALLOC_CTX *mem_ctx,
5162                                           WERROR *result)
5163 {
5164         struct rpccli_spoolss_ClosePrinter_state *state = tevent_req_data(
5165                 req, struct rpccli_spoolss_ClosePrinter_state);
5166         NTSTATUS status;
5167
5168         if (tevent_req_is_nterror(req, &status)) {
5169                 tevent_req_received(req);
5170                 return status;
5171         }
5172
5173         /* Steal possbile out parameters to the callers context */
5174         talloc_steal(mem_ctx, state->out_mem_ctx);
5175
5176         /* Return result */
5177         *result = state->orig.out.result;
5178
5179         tevent_req_received(req);
5180         return NT_STATUS_OK;
5181 }
5182
5183 NTSTATUS rpccli_spoolss_ClosePrinter(struct rpc_pipe_client *cli,
5184                                      TALLOC_CTX *mem_ctx,
5185                                      struct policy_handle *handle /* [in,out] [ref] */,
5186                                      WERROR *werror)
5187 {
5188         struct spoolss_ClosePrinter r;
5189         NTSTATUS status;
5190
5191         /* In parameters */
5192         r.in.handle = handle;
5193
5194         if (DEBUGLEVEL >= 10) {
5195                 NDR_PRINT_IN_DEBUG(spoolss_ClosePrinter, &r);
5196         }
5197
5198         status = cli->dispatch(cli,
5199                                 mem_ctx,
5200                                 &ndr_table_spoolss,
5201                                 NDR_SPOOLSS_CLOSEPRINTER,
5202                                 &r);
5203
5204         if (!NT_STATUS_IS_OK(status)) {
5205                 return status;
5206         }
5207
5208         if (DEBUGLEVEL >= 10) {
5209                 NDR_PRINT_OUT_DEBUG(spoolss_ClosePrinter, &r);
5210         }
5211
5212         if (NT_STATUS_IS_ERR(status)) {
5213                 return status;
5214         }
5215
5216         /* Return variables */
5217         *handle = *r.out.handle;
5218
5219         /* Return result */
5220         if (werror) {
5221                 *werror = r.out.result;
5222         }
5223
5224         return werror_to_ntstatus(r.out.result);
5225 }
5226
5227 struct rpccli_spoolss_AddForm_state {
5228         struct spoolss_AddForm orig;
5229         struct spoolss_AddForm tmp;
5230         TALLOC_CTX *out_mem_ctx;
5231         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
5232 };
5233
5234 static void rpccli_spoolss_AddForm_done(struct tevent_req *subreq);
5235
5236 struct tevent_req *rpccli_spoolss_AddForm_send(TALLOC_CTX *mem_ctx,
5237                                                struct tevent_context *ev,
5238                                                struct rpc_pipe_client *cli,
5239                                                struct policy_handle *_handle /* [in] [ref] */,
5240                                                uint32_t _level /* [in]  */,
5241                                                union spoolss_AddFormInfo _info /* [in] [switch_is(level)] */)
5242 {
5243         struct tevent_req *req;
5244         struct rpccli_spoolss_AddForm_state *state;
5245         struct tevent_req *subreq;
5246
5247         req = tevent_req_create(mem_ctx, &state,
5248                                 struct rpccli_spoolss_AddForm_state);
5249         if (req == NULL) {
5250                 return NULL;
5251         }
5252         state->out_mem_ctx = NULL;
5253         state->dispatch_recv = cli->dispatch_recv;
5254
5255         /* In parameters */
5256         state->orig.in.handle = _handle;
5257         state->orig.in.level = _level;
5258         state->orig.in.info = _info;
5259
5260         /* Out parameters */
5261
5262         /* Result */
5263         ZERO_STRUCT(state->orig.out.result);
5264
5265         if (DEBUGLEVEL >= 10) {
5266                 NDR_PRINT_IN_DEBUG(spoolss_AddForm, &state->orig);
5267         }
5268
5269         /* make a temporary copy, that we pass to the dispatch function */
5270         state->tmp = state->orig;
5271
5272         subreq = cli->dispatch_send(state, ev, cli,
5273                                     &ndr_table_spoolss,
5274                                     NDR_SPOOLSS_ADDFORM,
5275                                     &state->tmp);
5276         if (tevent_req_nomem(subreq, req)) {
5277                 return tevent_req_post(req, ev);
5278         }
5279         tevent_req_set_callback(subreq, rpccli_spoolss_AddForm_done, req);
5280         return req;
5281 }
5282
5283 static void rpccli_spoolss_AddForm_done(struct tevent_req *subreq)
5284 {
5285         struct tevent_req *req = tevent_req_callback_data(
5286                 subreq, struct tevent_req);
5287         struct rpccli_spoolss_AddForm_state *state = tevent_req_data(
5288                 req, struct rpccli_spoolss_AddForm_state);
5289         NTSTATUS status;
5290         TALLOC_CTX *mem_ctx;
5291
5292         if (state->out_mem_ctx) {
5293                 mem_ctx = state->out_mem_ctx;
5294         } else {
5295                 mem_ctx = state;
5296         }
5297
5298         status = state->dispatch_recv(subreq, mem_ctx);
5299         TALLOC_FREE(subreq);
5300         if (!NT_STATUS_IS_OK(status)) {
5301                 tevent_req_nterror(req, status);
5302                 return;
5303         }
5304
5305         /* Copy out parameters */
5306
5307         /* Copy result */
5308         state->orig.out.result = state->tmp.out.result;
5309
5310         /* Reset temporary structure */
5311         ZERO_STRUCT(state->tmp);
5312
5313         if (DEBUGLEVEL >= 10) {
5314                 NDR_PRINT_OUT_DEBUG(spoolss_AddForm, &state->orig);
5315         }
5316
5317         tevent_req_done(req);
5318 }
5319
5320 NTSTATUS rpccli_spoolss_AddForm_recv(struct tevent_req *req,
5321                                      TALLOC_CTX *mem_ctx,
5322                                      WERROR *result)
5323 {
5324         struct rpccli_spoolss_AddForm_state *state = tevent_req_data(
5325                 req, struct rpccli_spoolss_AddForm_state);
5326         NTSTATUS status;
5327
5328         if (tevent_req_is_nterror(req, &status)) {
5329                 tevent_req_received(req);
5330                 return status;
5331         }
5332
5333         /* Steal possbile out parameters to the callers context */
5334         talloc_steal(mem_ctx, state->out_mem_ctx);
5335
5336         /* Return result */
5337         *result = state->orig.out.result;
5338
5339         tevent_req_received(req);
5340         return NT_STATUS_OK;
5341 }
5342
5343 NTSTATUS rpccli_spoolss_AddForm(struct rpc_pipe_client *cli,
5344                                 TALLOC_CTX *mem_ctx,
5345                                 struct policy_handle *handle /* [in] [ref] */,
5346                                 uint32_t level /* [in]  */,
5347                                 union spoolss_AddFormInfo info /* [in] [switch_is(level)] */,
5348                                 WERROR *werror)
5349 {
5350         struct spoolss_AddForm r;
5351         NTSTATUS status;
5352
5353         /* In parameters */
5354         r.in.handle = handle;
5355         r.in.level = level;
5356         r.in.info = info;
5357
5358         if (DEBUGLEVEL >= 10) {
5359                 NDR_PRINT_IN_DEBUG(spoolss_AddForm, &r);
5360         }
5361
5362         status = cli->dispatch(cli,
5363                                 mem_ctx,
5364                                 &ndr_table_spoolss,
5365                                 NDR_SPOOLSS_ADDFORM,
5366                                 &r);
5367
5368         if (!NT_STATUS_IS_OK(status)) {
5369                 return status;
5370         }
5371
5372         if (DEBUGLEVEL >= 10) {
5373                 NDR_PRINT_OUT_DEBUG(spoolss_AddForm, &r);
5374         }
5375
5376         if (NT_STATUS_IS_ERR(status)) {
5377                 return status;
5378         }
5379
5380         /* Return variables */
5381
5382         /* Return result */
5383         if (werror) {
5384                 *werror = r.out.result;
5385         }
5386
5387         return werror_to_ntstatus(r.out.result);
5388 }
5389
5390 struct rpccli_spoolss_DeleteForm_state {
5391         struct spoolss_DeleteForm orig;
5392         struct spoolss_DeleteForm tmp;
5393         TALLOC_CTX *out_mem_ctx;
5394         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
5395 };
5396
5397 static void rpccli_spoolss_DeleteForm_done(struct tevent_req *subreq);
5398
5399 struct tevent_req *rpccli_spoolss_DeleteForm_send(TALLOC_CTX *mem_ctx,
5400                                                   struct tevent_context *ev,
5401                                                   struct rpc_pipe_client *cli,
5402                                                   struct policy_handle *_handle /* [in] [ref] */,
5403                                                   const char *_form_name /* [in] [charset(UTF16)] */)
5404 {
5405         struct tevent_req *req;
5406         struct rpccli_spoolss_DeleteForm_state *state;
5407         struct tevent_req *subreq;
5408
5409         req = tevent_req_create(mem_ctx, &state,
5410                                 struct rpccli_spoolss_DeleteForm_state);
5411         if (req == NULL) {
5412                 return NULL;
5413         }
5414         state->out_mem_ctx = NULL;
5415         state->dispatch_recv = cli->dispatch_recv;
5416
5417         /* In parameters */
5418         state->orig.in.handle = _handle;
5419         state->orig.in.form_name = _form_name;
5420
5421         /* Out parameters */
5422
5423         /* Result */
5424         ZERO_STRUCT(state->orig.out.result);
5425
5426         if (DEBUGLEVEL >= 10) {
5427                 NDR_PRINT_IN_DEBUG(spoolss_DeleteForm, &state->orig);
5428         }
5429
5430         /* make a temporary copy, that we pass to the dispatch function */
5431         state->tmp = state->orig;
5432
5433         subreq = cli->dispatch_send(state, ev, cli,
5434                                     &ndr_table_spoolss,
5435                                     NDR_SPOOLSS_DELETEFORM,
5436                                     &state->tmp);
5437         if (tevent_req_nomem(subreq, req)) {
5438                 return tevent_req_post(req, ev);
5439         }
5440         tevent_req_set_callback(subreq, rpccli_spoolss_DeleteForm_done, req);
5441         return req;
5442 }
5443
5444 static void rpccli_spoolss_DeleteForm_done(struct tevent_req *subreq)
5445 {
5446         struct tevent_req *req = tevent_req_callback_data(
5447                 subreq, struct tevent_req);
5448         struct rpccli_spoolss_DeleteForm_state *state = tevent_req_data(
5449                 req, struct rpccli_spoolss_DeleteForm_state);
5450         NTSTATUS status;
5451         TALLOC_CTX *mem_ctx;
5452
5453         if (state->out_mem_ctx) {
5454                 mem_ctx = state->out_mem_ctx;
5455         } else {
5456                 mem_ctx = state;
5457         }
5458
5459         status = state->dispatch_recv(subreq, mem_ctx);
5460         TALLOC_FREE(subreq);
5461         if (!NT_STATUS_IS_OK(status)) {
5462                 tevent_req_nterror(req, status);
5463                 return;
5464         }
5465
5466         /* Copy out parameters */
5467
5468         /* Copy result */
5469         state->orig.out.result = state->tmp.out.result;
5470
5471         /* Reset temporary structure */
5472         ZERO_STRUCT(state->tmp);
5473
5474         if (DEBUGLEVEL >= 10) {
5475                 NDR_PRINT_OUT_DEBUG(spoolss_DeleteForm, &state->orig);
5476         }
5477
5478         tevent_req_done(req);
5479 }
5480
5481 NTSTATUS rpccli_spoolss_DeleteForm_recv(struct tevent_req *req,
5482                                         TALLOC_CTX *mem_ctx,
5483                                         WERROR *result)
5484 {
5485         struct rpccli_spoolss_DeleteForm_state *state = tevent_req_data(
5486                 req, struct rpccli_spoolss_DeleteForm_state);
5487         NTSTATUS status;
5488
5489         if (tevent_req_is_nterror(req, &status)) {
5490                 tevent_req_received(req);
5491                 return status;
5492         }
5493
5494         /* Steal possbile out parameters to the callers context */
5495         talloc_steal(mem_ctx, state->out_mem_ctx);
5496
5497         /* Return result */
5498         *result = state->orig.out.result;
5499
5500         tevent_req_received(req);
5501         return NT_STATUS_OK;
5502 }
5503
5504 NTSTATUS rpccli_spoolss_DeleteForm(struct rpc_pipe_client *cli,
5505                                    TALLOC_CTX *mem_ctx,
5506                                    struct policy_handle *handle /* [in] [ref] */,
5507                                    const char *form_name /* [in] [charset(UTF16)] */,
5508                                    WERROR *werror)
5509 {
5510         struct spoolss_DeleteForm r;
5511         NTSTATUS status;
5512
5513         /* In parameters */
5514         r.in.handle = handle;
5515         r.in.form_name = form_name;
5516
5517         if (DEBUGLEVEL >= 10) {
5518                 NDR_PRINT_IN_DEBUG(spoolss_DeleteForm, &r);
5519         }
5520
5521         status = cli->dispatch(cli,
5522                                 mem_ctx,
5523                                 &ndr_table_spoolss,
5524                                 NDR_SPOOLSS_DELETEFORM,
5525                                 &r);
5526
5527         if (!NT_STATUS_IS_OK(status)) {
5528                 return status;
5529         }
5530
5531         if (DEBUGLEVEL >= 10) {
5532                 NDR_PRINT_OUT_DEBUG(spoolss_DeleteForm, &r);
5533         }
5534
5535         if (NT_STATUS_IS_ERR(status)) {
5536                 return status;
5537         }
5538
5539         /* Return variables */
5540
5541         /* Return result */
5542         if (werror) {
5543                 *werror = r.out.result;
5544         }
5545
5546         return werror_to_ntstatus(r.out.result);
5547 }
5548
5549 struct rpccli_spoolss_GetForm_state {
5550         struct spoolss_GetForm orig;
5551         struct spoolss_GetForm tmp;
5552         TALLOC_CTX *out_mem_ctx;
5553         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
5554 };
5555
5556 static void rpccli_spoolss_GetForm_done(struct tevent_req *subreq);
5557
5558 struct tevent_req *rpccli_spoolss_GetForm_send(TALLOC_CTX *mem_ctx,
5559                                                struct tevent_context *ev,
5560                                                struct rpc_pipe_client *cli,
5561                                                struct policy_handle *_handle /* [in] [ref] */,
5562                                                const char *_form_name /* [in] [charset(UTF16)] */,
5563                                                uint32_t _level /* [in]  */,
5564                                                DATA_BLOB *_buffer /* [in] [unique] */,
5565                                                uint32_t _offered /* [in]  */,
5566                                                union spoolss_FormInfo *_info /* [out] [unique,subcontext_size(offered),subcontext(4),switch_is(level)] */,
5567                                                uint32_t *_needed /* [out] [ref] */)
5568 {
5569         struct tevent_req *req;
5570         struct rpccli_spoolss_GetForm_state *state;
5571         struct tevent_req *subreq;
5572
5573         req = tevent_req_create(mem_ctx, &state,
5574                                 struct rpccli_spoolss_GetForm_state);
5575         if (req == NULL) {
5576                 return NULL;
5577         }
5578         state->out_mem_ctx = NULL;
5579         state->dispatch_recv = cli->dispatch_recv;
5580
5581         /* In parameters */
5582         state->orig.in.handle = _handle;
5583         state->orig.in.form_name = _form_name;
5584         state->orig.in.level = _level;
5585         state->orig.in.buffer = _buffer;
5586         state->orig.in.offered = _offered;
5587
5588         /* Out parameters */
5589         state->orig.out.info = _info;
5590         state->orig.out.needed = _needed;
5591
5592         /* Result */
5593         ZERO_STRUCT(state->orig.out.result);
5594
5595         if (DEBUGLEVEL >= 10) {
5596                 NDR_PRINT_IN_DEBUG(spoolss_GetForm, &state->orig);
5597         }
5598
5599         state->out_mem_ctx = talloc_named_const(state, 0,
5600                              "rpccli_spoolss_GetForm_out_memory");
5601         if (tevent_req_nomem(state->out_mem_ctx, req)) {
5602                 return tevent_req_post(req, ev);
5603         }
5604
5605         /* make a temporary copy, that we pass to the dispatch function */
5606         state->tmp = state->orig;
5607
5608         subreq = cli->dispatch_send(state, ev, cli,
5609                                     &ndr_table_spoolss,
5610                                     NDR_SPOOLSS_GETFORM,
5611                                     &state->tmp);
5612         if (tevent_req_nomem(subreq, req)) {
5613                 return tevent_req_post(req, ev);
5614         }
5615         tevent_req_set_callback(subreq, rpccli_spoolss_GetForm_done, req);
5616         return req;
5617 }
5618
5619 static void rpccli_spoolss_GetForm_done(struct tevent_req *subreq)
5620 {
5621         struct tevent_req *req = tevent_req_callback_data(
5622                 subreq, struct tevent_req);
5623         struct rpccli_spoolss_GetForm_state *state = tevent_req_data(
5624                 req, struct rpccli_spoolss_GetForm_state);
5625         NTSTATUS status;
5626         TALLOC_CTX *mem_ctx;
5627
5628         if (state->out_mem_ctx) {
5629                 mem_ctx = state->out_mem_ctx;
5630         } else {
5631                 mem_ctx = state;
5632         }
5633
5634         status = state->dispatch_recv(subreq, mem_ctx);
5635         TALLOC_FREE(subreq);
5636         if (!NT_STATUS_IS_OK(status)) {
5637                 tevent_req_nterror(req, status);
5638                 return;
5639         }
5640
5641         /* Copy out parameters */
5642         if (state->orig.out.info && state->tmp.out.info) {
5643                 *state->orig.out.info = *state->tmp.out.info;
5644         }
5645         *state->orig.out.needed = *state->tmp.out.needed;
5646
5647         /* Copy result */
5648         state->orig.out.result = state->tmp.out.result;
5649
5650         /* Reset temporary structure */
5651         ZERO_STRUCT(state->tmp);
5652
5653         if (DEBUGLEVEL >= 10) {
5654                 NDR_PRINT_OUT_DEBUG(spoolss_GetForm, &state->orig);
5655         }
5656
5657         tevent_req_done(req);
5658 }
5659
5660 NTSTATUS rpccli_spoolss_GetForm_recv(struct tevent_req *req,
5661                                      TALLOC_CTX *mem_ctx,
5662                                      WERROR *result)
5663 {
5664         struct rpccli_spoolss_GetForm_state *state = tevent_req_data(
5665                 req, struct rpccli_spoolss_GetForm_state);
5666         NTSTATUS status;
5667
5668         if (tevent_req_is_nterror(req, &status)) {
5669                 tevent_req_received(req);
5670                 return status;
5671         }
5672
5673         /* Steal possbile out parameters to the callers context */
5674         talloc_steal(mem_ctx, state->out_mem_ctx);
5675
5676         /* Return result */
5677         *result = state->orig.out.result;
5678
5679         tevent_req_received(req);
5680         return NT_STATUS_OK;
5681 }
5682
5683 NTSTATUS rpccli_spoolss_GetForm(struct rpc_pipe_client *cli,
5684                                 TALLOC_CTX *mem_ctx,
5685                                 struct policy_handle *handle /* [in] [ref] */,
5686                                 const char *form_name /* [in] [charset(UTF16)] */,
5687                                 uint32_t level /* [in]  */,
5688                                 DATA_BLOB *buffer /* [in] [unique] */,
5689                                 uint32_t offered /* [in]  */,
5690                                 union spoolss_FormInfo *info /* [out] [unique,subcontext_size(offered),subcontext(4),switch_is(level)] */,
5691                                 uint32_t *needed /* [out] [ref] */,
5692                                 WERROR *werror)
5693 {
5694         struct spoolss_GetForm r;
5695         NTSTATUS status;
5696
5697         /* In parameters */
5698         r.in.handle = handle;
5699         r.in.form_name = form_name;
5700         r.in.level = level;
5701         r.in.buffer = buffer;
5702         r.in.offered = offered;
5703
5704         if (DEBUGLEVEL >= 10) {
5705                 NDR_PRINT_IN_DEBUG(spoolss_GetForm, &r);
5706         }
5707
5708         status = cli->dispatch(cli,
5709                                 mem_ctx,
5710                                 &ndr_table_spoolss,
5711                                 NDR_SPOOLSS_GETFORM,
5712                                 &r);
5713
5714         if (!NT_STATUS_IS_OK(status)) {
5715                 return status;
5716         }
5717
5718         if (DEBUGLEVEL >= 10) {
5719                 NDR_PRINT_OUT_DEBUG(spoolss_GetForm, &r);
5720         }
5721
5722         if (NT_STATUS_IS_ERR(status)) {
5723                 return status;
5724         }
5725
5726         /* Return variables */
5727         if (info && r.out.info) {
5728                 *info = *r.out.info;
5729         }
5730         *needed = *r.out.needed;
5731
5732         /* Return result */
5733         if (werror) {
5734                 *werror = r.out.result;
5735         }
5736
5737         return werror_to_ntstatus(r.out.result);
5738 }
5739
5740 struct rpccli_spoolss_SetForm_state {
5741         struct spoolss_SetForm orig;
5742         struct spoolss_SetForm tmp;
5743         TALLOC_CTX *out_mem_ctx;
5744         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
5745 };
5746
5747 static void rpccli_spoolss_SetForm_done(struct tevent_req *subreq);
5748
5749 struct tevent_req *rpccli_spoolss_SetForm_send(TALLOC_CTX *mem_ctx,
5750                                                struct tevent_context *ev,
5751                                                struct rpc_pipe_client *cli,
5752                                                struct policy_handle *_handle /* [in] [ref] */,
5753                                                const char *_form_name /* [in] [charset(UTF16)] */,
5754                                                uint32_t _level /* [in]  */,
5755                                                union spoolss_AddFormInfo _info /* [in] [switch_is(level)] */)
5756 {
5757         struct tevent_req *req;
5758         struct rpccli_spoolss_SetForm_state *state;
5759         struct tevent_req *subreq;
5760
5761         req = tevent_req_create(mem_ctx, &state,
5762                                 struct rpccli_spoolss_SetForm_state);
5763         if (req == NULL) {
5764                 return NULL;
5765         }
5766         state->out_mem_ctx = NULL;
5767         state->dispatch_recv = cli->dispatch_recv;
5768
5769         /* In parameters */
5770         state->orig.in.handle = _handle;
5771         state->orig.in.form_name = _form_name;
5772         state->orig.in.level = _level;
5773         state->orig.in.info = _info;
5774
5775         /* Out parameters */
5776
5777         /* Result */
5778         ZERO_STRUCT(state->orig.out.result);
5779
5780         if (DEBUGLEVEL >= 10) {
5781                 NDR_PRINT_IN_DEBUG(spoolss_SetForm, &state->orig);
5782         }
5783
5784         /* make a temporary copy, that we pass to the dispatch function */
5785         state->tmp = state->orig;
5786
5787         subreq = cli->dispatch_send(state, ev, cli,
5788                                     &ndr_table_spoolss,
5789                                     NDR_SPOOLSS_SETFORM,
5790                                     &state->tmp);
5791         if (tevent_req_nomem(subreq, req)) {
5792                 return tevent_req_post(req, ev);
5793         }
5794         tevent_req_set_callback(subreq, rpccli_spoolss_SetForm_done, req);
5795         return req;
5796 }
5797
5798 static void rpccli_spoolss_SetForm_done(struct tevent_req *subreq)
5799 {
5800         struct tevent_req *req = tevent_req_callback_data(
5801                 subreq, struct tevent_req);
5802         struct rpccli_spoolss_SetForm_state *state = tevent_req_data(
5803                 req, struct rpccli_spoolss_SetForm_state);
5804         NTSTATUS status;
5805         TALLOC_CTX *mem_ctx;
5806
5807         if (state->out_mem_ctx) {
5808                 mem_ctx = state->out_mem_ctx;
5809         } else {
5810                 mem_ctx = state;
5811         }
5812
5813         status = state->dispatch_recv(subreq, mem_ctx);
5814         TALLOC_FREE(subreq);
5815         if (!NT_STATUS_IS_OK(status)) {
5816                 tevent_req_nterror(req, status);
5817                 return;
5818         }
5819
5820         /* Copy out parameters */
5821
5822         /* Copy result */
5823         state->orig.out.result = state->tmp.out.result;
5824
5825         /* Reset temporary structure */
5826         ZERO_STRUCT(state->tmp);
5827
5828         if (DEBUGLEVEL >= 10) {
5829                 NDR_PRINT_OUT_DEBUG(spoolss_SetForm, &state->orig);
5830         }
5831
5832         tevent_req_done(req);
5833 }
5834
5835 NTSTATUS rpccli_spoolss_SetForm_recv(struct tevent_req *req,
5836                                      TALLOC_CTX *mem_ctx,
5837                                      WERROR *result)
5838 {
5839         struct rpccli_spoolss_SetForm_state *state = tevent_req_data(
5840                 req, struct rpccli_spoolss_SetForm_state);
5841         NTSTATUS status;
5842
5843         if (tevent_req_is_nterror(req, &status)) {
5844                 tevent_req_received(req);
5845                 return status;
5846         }
5847
5848         /* Steal possbile out parameters to the callers context */
5849         talloc_steal(mem_ctx, state->out_mem_ctx);
5850
5851         /* Return result */
5852         *result = state->orig.out.result;
5853
5854         tevent_req_received(req);
5855         return NT_STATUS_OK;
5856 }
5857
5858 NTSTATUS rpccli_spoolss_SetForm(struct rpc_pipe_client *cli,
5859                                 TALLOC_CTX *mem_ctx,
5860                                 struct policy_handle *handle /* [in] [ref] */,
5861                                 const char *form_name /* [in] [charset(UTF16)] */,
5862                                 uint32_t level /* [in]  */,
5863                                 union spoolss_AddFormInfo info /* [in] [switch_is(level)] */,
5864                                 WERROR *werror)
5865 {
5866         struct spoolss_SetForm r;
5867         NTSTATUS status;
5868
5869         /* In parameters */
5870         r.in.handle = handle;
5871         r.in.form_name = form_name;
5872         r.in.level = level;
5873         r.in.info = info;
5874
5875         if (DEBUGLEVEL >= 10) {
5876                 NDR_PRINT_IN_DEBUG(spoolss_SetForm, &r);
5877         }
5878
5879         status = cli->dispatch(cli,
5880                                 mem_ctx,
5881                                 &ndr_table_spoolss,
5882                                 NDR_SPOOLSS_SETFORM,
5883                                 &r);
5884
5885         if (!NT_STATUS_IS_OK(status)) {
5886                 return status;
5887         }
5888
5889         if (DEBUGLEVEL >= 10) {
5890                 NDR_PRINT_OUT_DEBUG(spoolss_SetForm, &r);
5891         }
5892
5893         if (NT_STATUS_IS_ERR(status)) {
5894                 return status;
5895         }
5896
5897         /* Return variables */
5898
5899         /* Return result */
5900         if (werror) {
5901                 *werror = r.out.result;
5902         }
5903
5904         return werror_to_ntstatus(r.out.result);
5905 }
5906
5907 struct rpccli_spoolss_EnumForms_state {
5908         struct spoolss_EnumForms orig;
5909         struct spoolss_EnumForms tmp;
5910         TALLOC_CTX *out_mem_ctx;
5911         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
5912 };
5913
5914 static void rpccli_spoolss_EnumForms_done(struct tevent_req *subreq);
5915
5916 struct tevent_req *rpccli_spoolss_EnumForms_send(TALLOC_CTX *mem_ctx,
5917                                                  struct tevent_context *ev,
5918                                                  struct rpc_pipe_client *cli,
5919                                                  struct policy_handle *_handle /* [in] [ref] */,
5920                                                  uint32_t _level /* [in]  */,
5921                                                  DATA_BLOB *_buffer /* [in] [unique] */,
5922                                                  uint32_t _offered /* [in]  */,
5923                                                  uint32_t *_count /* [out] [ref] */,
5924                                                  union spoolss_FormInfo **_info /* [out] [ref,switch_is(level),size_is(,*count)] */,
5925                                                  uint32_t *_needed /* [out] [ref] */)
5926 {
5927         struct tevent_req *req;
5928         struct rpccli_spoolss_EnumForms_state *state;
5929         struct tevent_req *subreq;
5930
5931         req = tevent_req_create(mem_ctx, &state,
5932                                 struct rpccli_spoolss_EnumForms_state);
5933         if (req == NULL) {
5934                 return NULL;
5935         }
5936         state->out_mem_ctx = NULL;
5937         state->dispatch_recv = cli->dispatch_recv;
5938
5939         /* In parameters */
5940         state->orig.in.handle = _handle;
5941         state->orig.in.level = _level;
5942         state->orig.in.buffer = _buffer;
5943         state->orig.in.offered = _offered;
5944
5945         /* Out parameters */
5946         state->orig.out.count = _count;
5947         state->orig.out.info = _info;
5948         state->orig.out.needed = _needed;
5949
5950         /* Result */
5951         ZERO_STRUCT(state->orig.out.result);
5952
5953         if (DEBUGLEVEL >= 10) {
5954                 NDR_PRINT_IN_DEBUG(spoolss_EnumForms, &state->orig);
5955         }
5956
5957         state->out_mem_ctx = talloc_named_const(state, 0,
5958                              "rpccli_spoolss_EnumForms_out_memory");
5959         if (tevent_req_nomem(state->out_mem_ctx, req)) {
5960                 return tevent_req_post(req, ev);
5961         }
5962
5963         /* make a temporary copy, that we pass to the dispatch function */
5964         state->tmp = state->orig;
5965
5966         subreq = cli->dispatch_send(state, ev, cli,
5967                                     &ndr_table_spoolss,
5968                                     NDR_SPOOLSS_ENUMFORMS,
5969                                     &state->tmp);
5970         if (tevent_req_nomem(subreq, req)) {
5971                 return tevent_req_post(req, ev);
5972         }
5973         tevent_req_set_callback(subreq, rpccli_spoolss_EnumForms_done, req);
5974         return req;
5975 }
5976
5977 static void rpccli_spoolss_EnumForms_done(struct tevent_req *subreq)
5978 {
5979         struct tevent_req *req = tevent_req_callback_data(
5980                 subreq, struct tevent_req);
5981         struct rpccli_spoolss_EnumForms_state *state = tevent_req_data(
5982                 req, struct rpccli_spoolss_EnumForms_state);
5983         NTSTATUS status;
5984         TALLOC_CTX *mem_ctx;
5985
5986         if (state->out_mem_ctx) {
5987                 mem_ctx = state->out_mem_ctx;
5988         } else {
5989                 mem_ctx = state;
5990         }
5991
5992         status = state->dispatch_recv(subreq, mem_ctx);
5993         TALLOC_FREE(subreq);
5994         if (!NT_STATUS_IS_OK(status)) {
5995                 tevent_req_nterror(req, status);
5996                 return;
5997         }
5998
5999         /* Copy out parameters */
6000         *state->orig.out.count = *state->tmp.out.count;
6001         *state->orig.out.info = *state->tmp.out.info;
6002         *state->orig.out.needed = *state->tmp.out.needed;
6003
6004         /* Copy result */
6005         state->orig.out.result = state->tmp.out.result;
6006
6007         /* Reset temporary structure */
6008         ZERO_STRUCT(state->tmp);
6009
6010         if (DEBUGLEVEL >= 10) {
6011                 NDR_PRINT_OUT_DEBUG(spoolss_EnumForms, &state->orig);
6012         }
6013
6014         tevent_req_done(req);
6015 }
6016
6017 NTSTATUS rpccli_spoolss_EnumForms_recv(struct tevent_req *req,
6018                                        TALLOC_CTX *mem_ctx,
6019                                        WERROR *result)
6020 {
6021         struct rpccli_spoolss_EnumForms_state *state = tevent_req_data(
6022                 req, struct rpccli_spoolss_EnumForms_state);
6023         NTSTATUS status;
6024
6025         if (tevent_req_is_nterror(req, &status)) {
6026                 tevent_req_received(req);
6027                 return status;
6028         }
6029
6030         /* Steal possbile out parameters to the callers context */
6031         talloc_steal(mem_ctx, state->out_mem_ctx);
6032
6033         /* Return result */
6034         *result = state->orig.out.result;
6035
6036         tevent_req_received(req);
6037         return NT_STATUS_OK;
6038 }
6039
6040 NTSTATUS rpccli_spoolss_EnumForms(struct rpc_pipe_client *cli,
6041                                   TALLOC_CTX *mem_ctx,
6042                                   struct policy_handle *handle /* [in] [ref] */,
6043                                   uint32_t level /* [in]  */,
6044                                   DATA_BLOB *buffer /* [in] [unique] */,
6045                                   uint32_t offered /* [in]  */,
6046                                   uint32_t *count /* [out] [ref] */,
6047                                   union spoolss_FormInfo **info /* [out] [ref,switch_is(level),size_is(,*count)] */,
6048                                   uint32_t *needed /* [out] [ref] */,
6049                                   WERROR *werror)
6050 {
6051         struct spoolss_EnumForms r;
6052         NTSTATUS status;
6053
6054         /* In parameters */
6055         r.in.handle = handle;
6056         r.in.level = level;
6057         r.in.buffer = buffer;
6058         r.in.offered = offered;
6059
6060         if (DEBUGLEVEL >= 10) {
6061                 NDR_PRINT_IN_DEBUG(spoolss_EnumForms, &r);
6062         }
6063
6064         status = cli->dispatch(cli,
6065                                 mem_ctx,
6066                                 &ndr_table_spoolss,
6067                                 NDR_SPOOLSS_ENUMFORMS,
6068                                 &r);
6069
6070         if (!NT_STATUS_IS_OK(status)) {
6071                 return status;
6072         }
6073
6074         if (DEBUGLEVEL >= 10) {
6075                 NDR_PRINT_OUT_DEBUG(spoolss_EnumForms, &r);
6076         }
6077
6078         if (NT_STATUS_IS_ERR(status)) {
6079                 return status;
6080         }
6081
6082         /* Return variables */
6083         *count = *r.out.count;
6084         *info = *r.out.info;
6085         *needed = *r.out.needed;
6086
6087         /* Return result */
6088         if (werror) {
6089                 *werror = r.out.result;
6090         }
6091
6092         return werror_to_ntstatus(r.out.result);
6093 }
6094
6095 struct rpccli_spoolss_EnumPorts_state {
6096         struct spoolss_EnumPorts orig;
6097         struct spoolss_EnumPorts tmp;
6098         TALLOC_CTX *out_mem_ctx;
6099         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
6100 };
6101
6102 static void rpccli_spoolss_EnumPorts_done(struct tevent_req *subreq);
6103
6104 struct tevent_req *rpccli_spoolss_EnumPorts_send(TALLOC_CTX *mem_ctx,
6105                                                  struct tevent_context *ev,
6106                                                  struct rpc_pipe_client *cli,
6107                                                  const char *_servername /* [in] [unique,charset(UTF16)] */,
6108                                                  uint32_t _level /* [in]  */,
6109                                                  DATA_BLOB *_buffer /* [in] [unique] */,
6110                                                  uint32_t _offered /* [in]  */,
6111                                                  uint32_t *_count /* [out] [ref] */,
6112                                                  union spoolss_PortInfo **_info /* [out] [ref,switch_is(level),size_is(,*count)] */,
6113                                                  uint32_t *_needed /* [out] [ref] */)
6114 {
6115         struct tevent_req *req;
6116         struct rpccli_spoolss_EnumPorts_state *state;
6117         struct tevent_req *subreq;
6118
6119         req = tevent_req_create(mem_ctx, &state,
6120                                 struct rpccli_spoolss_EnumPorts_state);
6121         if (req == NULL) {
6122                 return NULL;
6123         }
6124         state->out_mem_ctx = NULL;
6125         state->dispatch_recv = cli->dispatch_recv;
6126
6127         /* In parameters */
6128         state->orig.in.servername = _servername;
6129         state->orig.in.level = _level;
6130         state->orig.in.buffer = _buffer;
6131         state->orig.in.offered = _offered;
6132
6133         /* Out parameters */
6134         state->orig.out.count = _count;
6135         state->orig.out.info = _info;
6136         state->orig.out.needed = _needed;
6137
6138         /* Result */
6139         ZERO_STRUCT(state->orig.out.result);
6140
6141         if (DEBUGLEVEL >= 10) {
6142                 NDR_PRINT_IN_DEBUG(spoolss_EnumPorts, &state->orig);
6143         }
6144
6145         state->out_mem_ctx = talloc_named_const(state, 0,
6146                              "rpccli_spoolss_EnumPorts_out_memory");
6147         if (tevent_req_nomem(state->out_mem_ctx, req)) {
6148                 return tevent_req_post(req, ev);
6149         }
6150
6151         /* make a temporary copy, that we pass to the dispatch function */
6152         state->tmp = state->orig;
6153
6154         subreq = cli->dispatch_send(state, ev, cli,
6155                                     &ndr_table_spoolss,
6156                                     NDR_SPOOLSS_ENUMPORTS,
6157                                     &state->tmp);
6158         if (tevent_req_nomem(subreq, req)) {
6159                 return tevent_req_post(req, ev);
6160         }
6161         tevent_req_set_callback(subreq, rpccli_spoolss_EnumPorts_done, req);
6162         return req;
6163 }
6164
6165 static void rpccli_spoolss_EnumPorts_done(struct tevent_req *subreq)
6166 {
6167         struct tevent_req *req = tevent_req_callback_data(
6168                 subreq, struct tevent_req);
6169         struct rpccli_spoolss_EnumPorts_state *state = tevent_req_data(
6170                 req, struct rpccli_spoolss_EnumPorts_state);
6171         NTSTATUS status;
6172         TALLOC_CTX *mem_ctx;
6173
6174         if (state->out_mem_ctx) {
6175                 mem_ctx = state->out_mem_ctx;
6176         } else {
6177                 mem_ctx = state;
6178         }
6179
6180         status = state->dispatch_recv(subreq, mem_ctx);
6181         TALLOC_FREE(subreq);
6182         if (!NT_STATUS_IS_OK(status)) {
6183                 tevent_req_nterror(req, status);
6184                 return;
6185         }
6186
6187         /* Copy out parameters */
6188         *state->orig.out.count = *state->tmp.out.count;
6189         *state->orig.out.info = *state->tmp.out.info;
6190         *state->orig.out.needed = *state->tmp.out.needed;
6191
6192         /* Copy result */
6193         state->orig.out.result = state->tmp.out.result;
6194
6195         /* Reset temporary structure */
6196         ZERO_STRUCT(state->tmp);
6197
6198         if (DEBUGLEVEL >= 10) {
6199                 NDR_PRINT_OUT_DEBUG(spoolss_EnumPorts, &state->orig);
6200         }
6201
6202         tevent_req_done(req);
6203 }
6204
6205 NTSTATUS rpccli_spoolss_EnumPorts_recv(struct tevent_req *req,
6206                                        TALLOC_CTX *mem_ctx,
6207                                        WERROR *result)
6208 {
6209         struct rpccli_spoolss_EnumPorts_state *state = tevent_req_data(
6210                 req, struct rpccli_spoolss_EnumPorts_state);
6211         NTSTATUS status;
6212
6213         if (tevent_req_is_nterror(req, &status)) {
6214                 tevent_req_received(req);
6215                 return status;
6216         }
6217
6218         /* Steal possbile out parameters to the callers context */
6219         talloc_steal(mem_ctx, state->out_mem_ctx);
6220
6221         /* Return result */
6222         *result = state->orig.out.result;
6223
6224         tevent_req_received(req);
6225         return NT_STATUS_OK;
6226 }
6227
6228 NTSTATUS rpccli_spoolss_EnumPorts(struct rpc_pipe_client *cli,
6229                                   TALLOC_CTX *mem_ctx,
6230                                   const char *servername /* [in] [unique,charset(UTF16)] */,
6231                                   uint32_t level /* [in]  */,
6232                                   DATA_BLOB *buffer /* [in] [unique] */,
6233                                   uint32_t offered /* [in]  */,
6234                                   uint32_t *count /* [out] [ref] */,
6235                                   union spoolss_PortInfo **info /* [out] [ref,switch_is(level),size_is(,*count)] */,
6236                                   uint32_t *needed /* [out] [ref] */,
6237                                   WERROR *werror)
6238 {
6239         struct spoolss_EnumPorts r;
6240         NTSTATUS status;
6241
6242         /* In parameters */
6243         r.in.servername = servername;
6244         r.in.level = level;
6245         r.in.buffer = buffer;
6246         r.in.offered = offered;
6247
6248         if (DEBUGLEVEL >= 10) {
6249                 NDR_PRINT_IN_DEBUG(spoolss_EnumPorts, &r);
6250         }
6251
6252         status = cli->dispatch(cli,
6253                                 mem_ctx,
6254                                 &ndr_table_spoolss,
6255                                 NDR_SPOOLSS_ENUMPORTS,
6256                                 &r);
6257
6258         if (!NT_STATUS_IS_OK(status)) {
6259                 return status;
6260         }
6261
6262         if (DEBUGLEVEL >= 10) {
6263                 NDR_PRINT_OUT_DEBUG(spoolss_EnumPorts, &r);
6264         }
6265
6266         if (NT_STATUS_IS_ERR(status)) {
6267                 return status;
6268         }
6269
6270         /* Return variables */
6271         *count = *r.out.count;
6272         *info = *r.out.info;
6273         *needed = *r.out.needed;
6274
6275         /* Return result */
6276         if (werror) {
6277                 *werror = r.out.result;
6278         }
6279
6280         return werror_to_ntstatus(r.out.result);
6281 }
6282
6283 struct rpccli_spoolss_EnumMonitors_state {
6284         struct spoolss_EnumMonitors orig;
6285         struct spoolss_EnumMonitors tmp;
6286         TALLOC_CTX *out_mem_ctx;
6287         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
6288 };
6289
6290 static void rpccli_spoolss_EnumMonitors_done(struct tevent_req *subreq);
6291
6292 struct tevent_req *rpccli_spoolss_EnumMonitors_send(TALLOC_CTX *mem_ctx,
6293                                                     struct tevent_context *ev,
6294                                                     struct rpc_pipe_client *cli,
6295                                                     const char *_servername /* [in] [unique,charset(UTF16)] */,
6296                                                     uint32_t _level /* [in]  */,
6297                                                     DATA_BLOB *_buffer /* [in] [unique] */,
6298                                                     uint32_t _offered /* [in]  */,
6299                                                     uint32_t *_count /* [out] [ref] */,
6300                                                     union spoolss_MonitorInfo **_info /* [out] [ref,switch_is(level),size_is(,*count)] */,
6301                                                     uint32_t *_needed /* [out] [ref] */)
6302 {
6303         struct tevent_req *req;
6304         struct rpccli_spoolss_EnumMonitors_state *state;
6305         struct tevent_req *subreq;
6306
6307         req = tevent_req_create(mem_ctx, &state,
6308                                 struct rpccli_spoolss_EnumMonitors_state);
6309         if (req == NULL) {
6310                 return NULL;
6311         }
6312         state->out_mem_ctx = NULL;
6313         state->dispatch_recv = cli->dispatch_recv;
6314
6315         /* In parameters */
6316         state->orig.in.servername = _servername;
6317         state->orig.in.level = _level;
6318         state->orig.in.buffer = _buffer;
6319         state->orig.in.offered = _offered;
6320
6321         /* Out parameters */
6322         state->orig.out.count = _count;
6323         state->orig.out.info = _info;
6324         state->orig.out.needed = _needed;
6325
6326         /* Result */
6327         ZERO_STRUCT(state->orig.out.result);
6328
6329         if (DEBUGLEVEL >= 10) {
6330                 NDR_PRINT_IN_DEBUG(spoolss_EnumMonitors, &state->orig);
6331         }
6332
6333         state->out_mem_ctx = talloc_named_const(state, 0,
6334                              "rpccli_spoolss_EnumMonitors_out_memory");
6335         if (tevent_req_nomem(state->out_mem_ctx, req)) {
6336                 return tevent_req_post(req, ev);
6337         }
6338
6339         /* make a temporary copy, that we pass to the dispatch function */
6340         state->tmp = state->orig;
6341
6342         subreq = cli->dispatch_send(state, ev, cli,
6343                                     &ndr_table_spoolss,
6344                                     NDR_SPOOLSS_ENUMMONITORS,
6345                                     &state->tmp);
6346         if (tevent_req_nomem(subreq, req)) {
6347                 return tevent_req_post(req, ev);
6348         }
6349         tevent_req_set_callback(subreq, rpccli_spoolss_EnumMonitors_done, req);
6350         return req;
6351 }
6352
6353 static void rpccli_spoolss_EnumMonitors_done(struct tevent_req *subreq)
6354 {
6355         struct tevent_req *req = tevent_req_callback_data(
6356                 subreq, struct tevent_req);
6357         struct rpccli_spoolss_EnumMonitors_state *state = tevent_req_data(
6358                 req, struct rpccli_spoolss_EnumMonitors_state);
6359         NTSTATUS status;
6360         TALLOC_CTX *mem_ctx;
6361
6362         if (state->out_mem_ctx) {
6363                 mem_ctx = state->out_mem_ctx;
6364         } else {
6365                 mem_ctx = state;
6366         }
6367
6368         status = state->dispatch_recv(subreq, mem_ctx);
6369         TALLOC_FREE(subreq);
6370         if (!NT_STATUS_IS_OK(status)) {
6371                 tevent_req_nterror(req, status);
6372                 return;
6373         }
6374
6375         /* Copy out parameters */
6376         *state->orig.out.count = *state->tmp.out.count;
6377         *state->orig.out.info = *state->tmp.out.info;
6378         *state->orig.out.needed = *state->tmp.out.needed;
6379
6380         /* Copy result */
6381         state->orig.out.result = state->tmp.out.result;
6382
6383         /* Reset temporary structure */
6384         ZERO_STRUCT(state->tmp);
6385
6386         if (DEBUGLEVEL >= 10) {
6387                 NDR_PRINT_OUT_DEBUG(spoolss_EnumMonitors, &state->orig);
6388         }
6389
6390         tevent_req_done(req);
6391 }
6392
6393 NTSTATUS rpccli_spoolss_EnumMonitors_recv(struct tevent_req *req,
6394                                           TALLOC_CTX *mem_ctx,
6395                                           WERROR *result)
6396 {
6397         struct rpccli_spoolss_EnumMonitors_state *state = tevent_req_data(
6398                 req, struct rpccli_spoolss_EnumMonitors_state);
6399         NTSTATUS status;
6400
6401         if (tevent_req_is_nterror(req, &status)) {
6402                 tevent_req_received(req);
6403                 return status;
6404         }
6405
6406         /* Steal possbile out parameters to the callers context */
6407         talloc_steal(mem_ctx, state->out_mem_ctx);
6408
6409         /* Return result */
6410         *result = state->orig.out.result;
6411
6412         tevent_req_received(req);
6413         return NT_STATUS_OK;
6414 }
6415
6416 NTSTATUS rpccli_spoolss_EnumMonitors(struct rpc_pipe_client *cli,
6417                                      TALLOC_CTX *mem_ctx,
6418                                      const char *servername /* [in] [unique,charset(UTF16)] */,
6419                                      uint32_t level /* [in]  */,
6420                                      DATA_BLOB *buffer /* [in] [unique] */,
6421                                      uint32_t offered /* [in]  */,
6422                                      uint32_t *count /* [out] [ref] */,
6423                                      union spoolss_MonitorInfo **info /* [out] [ref,switch_is(level),size_is(,*count)] */,
6424                                      uint32_t *needed /* [out] [ref] */,
6425                                      WERROR *werror)
6426 {
6427         struct spoolss_EnumMonitors r;
6428         NTSTATUS status;
6429
6430         /* In parameters */
6431         r.in.servername = servername;
6432         r.in.level = level;
6433         r.in.buffer = buffer;
6434         r.in.offered = offered;
6435
6436         if (DEBUGLEVEL >= 10) {
6437                 NDR_PRINT_IN_DEBUG(spoolss_EnumMonitors, &r);
6438         }
6439
6440         status = cli->dispatch(cli,
6441                                 mem_ctx,
6442                                 &ndr_table_spoolss,
6443                                 NDR_SPOOLSS_ENUMMONITORS,
6444                                 &r);
6445
6446         if (!NT_STATUS_IS_OK(status)) {
6447                 return status;
6448         }
6449
6450         if (DEBUGLEVEL >= 10) {
6451                 NDR_PRINT_OUT_DEBUG(spoolss_EnumMonitors, &r);
6452         }
6453
6454         if (NT_STATUS_IS_ERR(status)) {
6455                 return status;
6456         }
6457
6458         /* Return variables */
6459         *count = *r.out.count;
6460         *info = *r.out.info;
6461         *needed = *r.out.needed;
6462
6463         /* Return result */
6464         if (werror) {
6465                 *werror = r.out.result;
6466         }
6467
6468         return werror_to_ntstatus(r.out.result);
6469 }
6470
6471 struct rpccli_spoolss_AddPort_state {
6472         struct spoolss_AddPort orig;
6473         struct spoolss_AddPort tmp;
6474         TALLOC_CTX *out_mem_ctx;
6475         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
6476 };
6477
6478 static void rpccli_spoolss_AddPort_done(struct tevent_req *subreq);
6479
6480 struct tevent_req *rpccli_spoolss_AddPort_send(TALLOC_CTX *mem_ctx,
6481                                                struct tevent_context *ev,
6482                                                struct rpc_pipe_client *cli,
6483                                                const char *_server_name /* [in] [unique,charset(UTF16)] */,
6484                                                uint32_t _unknown /* [in]  */,
6485                                                const char *_monitor_name /* [in] [charset(UTF16)] */)
6486 {
6487         struct tevent_req *req;
6488         struct rpccli_spoolss_AddPort_state *state;
6489         struct tevent_req *subreq;
6490
6491         req = tevent_req_create(mem_ctx, &state,
6492                                 struct rpccli_spoolss_AddPort_state);
6493         if (req == NULL) {
6494                 return NULL;
6495         }
6496         state->out_mem_ctx = NULL;
6497         state->dispatch_recv = cli->dispatch_recv;
6498
6499         /* In parameters */
6500         state->orig.in.server_name = _server_name;
6501         state->orig.in.unknown = _unknown;
6502         state->orig.in.monitor_name = _monitor_name;
6503
6504         /* Out parameters */
6505
6506         /* Result */
6507         ZERO_STRUCT(state->orig.out.result);
6508
6509         if (DEBUGLEVEL >= 10) {
6510                 NDR_PRINT_IN_DEBUG(spoolss_AddPort, &state->orig);
6511         }
6512
6513         /* make a temporary copy, that we pass to the dispatch function */
6514         state->tmp = state->orig;
6515
6516         subreq = cli->dispatch_send(state, ev, cli,
6517                                     &ndr_table_spoolss,
6518                                     NDR_SPOOLSS_ADDPORT,
6519                                     &state->tmp);
6520         if (tevent_req_nomem(subreq, req)) {
6521                 return tevent_req_post(req, ev);
6522         }
6523         tevent_req_set_callback(subreq, rpccli_spoolss_AddPort_done, req);
6524         return req;
6525 }
6526
6527 static void rpccli_spoolss_AddPort_done(struct tevent_req *subreq)
6528 {
6529         struct tevent_req *req = tevent_req_callback_data(
6530                 subreq, struct tevent_req);
6531         struct rpccli_spoolss_AddPort_state *state = tevent_req_data(
6532                 req, struct rpccli_spoolss_AddPort_state);
6533         NTSTATUS status;
6534         TALLOC_CTX *mem_ctx;
6535
6536         if (state->out_mem_ctx) {
6537                 mem_ctx = state->out_mem_ctx;
6538         } else {
6539                 mem_ctx = state;
6540         }
6541
6542         status = state->dispatch_recv(subreq, mem_ctx);
6543         TALLOC_FREE(subreq);
6544         if (!NT_STATUS_IS_OK(status)) {
6545                 tevent_req_nterror(req, status);
6546                 return;
6547         }
6548
6549         /* Copy out parameters */
6550
6551         /* Copy result */
6552         state->orig.out.result = state->tmp.out.result;
6553
6554         /* Reset temporary structure */
6555         ZERO_STRUCT(state->tmp);
6556
6557         if (DEBUGLEVEL >= 10) {
6558                 NDR_PRINT_OUT_DEBUG(spoolss_AddPort, &state->orig);
6559         }
6560
6561         tevent_req_done(req);
6562 }
6563
6564 NTSTATUS rpccli_spoolss_AddPort_recv(struct tevent_req *req,
6565                                      TALLOC_CTX *mem_ctx,
6566                                      WERROR *result)
6567 {
6568         struct rpccli_spoolss_AddPort_state *state = tevent_req_data(
6569                 req, struct rpccli_spoolss_AddPort_state);
6570         NTSTATUS status;
6571
6572         if (tevent_req_is_nterror(req, &status)) {
6573                 tevent_req_received(req);
6574                 return status;
6575         }
6576
6577         /* Steal possbile out parameters to the callers context */
6578         talloc_steal(mem_ctx, state->out_mem_ctx);
6579
6580         /* Return result */
6581         *result = state->orig.out.result;
6582
6583         tevent_req_received(req);
6584         return NT_STATUS_OK;
6585 }
6586
6587 NTSTATUS rpccli_spoolss_AddPort(struct rpc_pipe_client *cli,
6588                                 TALLOC_CTX *mem_ctx,
6589                                 const char *server_name /* [in] [unique,charset(UTF16)] */,
6590                                 uint32_t unknown /* [in]  */,
6591                                 const char *monitor_name /* [in] [charset(UTF16)] */,
6592                                 WERROR *werror)
6593 {
6594         struct spoolss_AddPort r;
6595         NTSTATUS status;
6596
6597         /* In parameters */
6598         r.in.server_name = server_name;
6599         r.in.unknown = unknown;
6600         r.in.monitor_name = monitor_name;
6601
6602         if (DEBUGLEVEL >= 10) {
6603                 NDR_PRINT_IN_DEBUG(spoolss_AddPort, &r);
6604         }
6605
6606         status = cli->dispatch(cli,
6607                                 mem_ctx,
6608                                 &ndr_table_spoolss,
6609                                 NDR_SPOOLSS_ADDPORT,
6610                                 &r);
6611
6612         if (!NT_STATUS_IS_OK(status)) {
6613                 return status;
6614         }
6615
6616         if (DEBUGLEVEL >= 10) {
6617                 NDR_PRINT_OUT_DEBUG(spoolss_AddPort, &r);
6618         }
6619
6620         if (NT_STATUS_IS_ERR(status)) {
6621                 return status;
6622         }
6623
6624         /* Return variables */
6625
6626         /* Return result */
6627         if (werror) {
6628                 *werror = r.out.result;
6629         }
6630
6631         return werror_to_ntstatus(r.out.result);
6632 }
6633
6634 struct rpccli_spoolss_ConfigurePort_state {
6635         struct spoolss_ConfigurePort orig;
6636         struct spoolss_ConfigurePort tmp;
6637         TALLOC_CTX *out_mem_ctx;
6638         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
6639 };
6640
6641 static void rpccli_spoolss_ConfigurePort_done(struct tevent_req *subreq);
6642
6643 struct tevent_req *rpccli_spoolss_ConfigurePort_send(TALLOC_CTX *mem_ctx,
6644                                                      struct tevent_context *ev,
6645                                                      struct rpc_pipe_client *cli)
6646 {
6647         struct tevent_req *req;
6648         struct rpccli_spoolss_ConfigurePort_state *state;
6649         struct tevent_req *subreq;
6650
6651         req = tevent_req_create(mem_ctx, &state,
6652                                 struct rpccli_spoolss_ConfigurePort_state);
6653         if (req == NULL) {
6654                 return NULL;
6655         }
6656         state->out_mem_ctx = NULL;
6657         state->dispatch_recv = cli->dispatch_recv;
6658
6659         /* In parameters */
6660
6661         /* Out parameters */
6662
6663         /* Result */
6664         ZERO_STRUCT(state->orig.out.result);
6665
6666         if (DEBUGLEVEL >= 10) {
6667                 NDR_PRINT_IN_DEBUG(spoolss_ConfigurePort, &state->orig);
6668         }
6669
6670         /* make a temporary copy, that we pass to the dispatch function */
6671         state->tmp = state->orig;
6672
6673         subreq = cli->dispatch_send(state, ev, cli,
6674                                     &ndr_table_spoolss,
6675                                     NDR_SPOOLSS_CONFIGUREPORT,
6676                                     &state->tmp);
6677         if (tevent_req_nomem(subreq, req)) {
6678                 return tevent_req_post(req, ev);
6679         }
6680         tevent_req_set_callback(subreq, rpccli_spoolss_ConfigurePort_done, req);
6681         return req;
6682 }
6683
6684 static void rpccli_spoolss_ConfigurePort_done(struct tevent_req *subreq)
6685 {
6686         struct tevent_req *req = tevent_req_callback_data(
6687                 subreq, struct tevent_req);
6688         struct rpccli_spoolss_ConfigurePort_state *state = tevent_req_data(
6689                 req, struct rpccli_spoolss_ConfigurePort_state);
6690         NTSTATUS status;
6691         TALLOC_CTX *mem_ctx;
6692
6693         if (state->out_mem_ctx) {
6694                 mem_ctx = state->out_mem_ctx;
6695         } else {
6696                 mem_ctx = state;
6697         }
6698
6699         status = state->dispatch_recv(subreq, mem_ctx);
6700         TALLOC_FREE(subreq);
6701         if (!NT_STATUS_IS_OK(status)) {
6702                 tevent_req_nterror(req, status);
6703                 return;
6704         }
6705
6706         /* Copy out parameters */
6707
6708         /* Copy result */
6709         state->orig.out.result = state->tmp.out.result;
6710
6711         /* Reset temporary structure */
6712         ZERO_STRUCT(state->tmp);
6713
6714         if (DEBUGLEVEL >= 10) {
6715                 NDR_PRINT_OUT_DEBUG(spoolss_ConfigurePort, &state->orig);
6716         }
6717
6718         tevent_req_done(req);
6719 }
6720
6721 NTSTATUS rpccli_spoolss_ConfigurePort_recv(struct tevent_req *req,
6722                                            TALLOC_CTX *mem_ctx,
6723                                            WERROR *result)
6724 {
6725         struct rpccli_spoolss_ConfigurePort_state *state = tevent_req_data(
6726                 req, struct rpccli_spoolss_ConfigurePort_state);
6727         NTSTATUS status;
6728
6729         if (tevent_req_is_nterror(req, &status)) {
6730                 tevent_req_received(req);
6731                 return status;
6732         }
6733
6734         /* Steal possbile out parameters to the callers context */
6735         talloc_steal(mem_ctx, state->out_mem_ctx);
6736
6737         /* Return result */
6738         *result = state->orig.out.result;
6739
6740         tevent_req_received(req);
6741         return NT_STATUS_OK;
6742 }
6743
6744 NTSTATUS rpccli_spoolss_ConfigurePort(struct rpc_pipe_client *cli,
6745                                       TALLOC_CTX *mem_ctx,
6746                                       WERROR *werror)
6747 {
6748         struct spoolss_ConfigurePort r;
6749         NTSTATUS status;
6750
6751         /* In parameters */
6752
6753         if (DEBUGLEVEL >= 10) {
6754                 NDR_PRINT_IN_DEBUG(spoolss_ConfigurePort, &r);
6755         }
6756
6757         status = cli->dispatch(cli,
6758                                 mem_ctx,
6759                                 &ndr_table_spoolss,
6760                                 NDR_SPOOLSS_CONFIGUREPORT,
6761                                 &r);
6762
6763         if (!NT_STATUS_IS_OK(status)) {
6764                 return status;
6765         }
6766
6767         if (DEBUGLEVEL >= 10) {
6768                 NDR_PRINT_OUT_DEBUG(spoolss_ConfigurePort, &r);
6769         }
6770
6771         if (NT_STATUS_IS_ERR(status)) {
6772                 return status;
6773         }
6774
6775         /* Return variables */
6776
6777         /* Return result */
6778         if (werror) {
6779                 *werror = r.out.result;
6780         }
6781
6782         return werror_to_ntstatus(r.out.result);
6783 }
6784
6785 struct rpccli_spoolss_DeletePort_state {
6786         struct spoolss_DeletePort orig;
6787         struct spoolss_DeletePort tmp;
6788         TALLOC_CTX *out_mem_ctx;
6789         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
6790 };
6791
6792 static void rpccli_spoolss_DeletePort_done(struct tevent_req *subreq);
6793
6794 struct tevent_req *rpccli_spoolss_DeletePort_send(TALLOC_CTX *mem_ctx,
6795                                                   struct tevent_context *ev,
6796                                                   struct rpc_pipe_client *cli)
6797 {
6798         struct tevent_req *req;
6799         struct rpccli_spoolss_DeletePort_state *state;
6800         struct tevent_req *subreq;
6801
6802         req = tevent_req_create(mem_ctx, &state,
6803                                 struct rpccli_spoolss_DeletePort_state);
6804         if (req == NULL) {
6805                 return NULL;
6806         }
6807         state->out_mem_ctx = NULL;
6808         state->dispatch_recv = cli->dispatch_recv;
6809
6810         /* In parameters */
6811
6812         /* Out parameters */
6813
6814         /* Result */
6815         ZERO_STRUCT(state->orig.out.result);
6816
6817         if (DEBUGLEVEL >= 10) {
6818                 NDR_PRINT_IN_DEBUG(spoolss_DeletePort, &state->orig);
6819         }
6820
6821         /* make a temporary copy, that we pass to the dispatch function */
6822         state->tmp = state->orig;
6823
6824         subreq = cli->dispatch_send(state, ev, cli,
6825                                     &ndr_table_spoolss,
6826                                     NDR_SPOOLSS_DELETEPORT,
6827                                     &state->tmp);
6828         if (tevent_req_nomem(subreq, req)) {
6829                 return tevent_req_post(req, ev);
6830         }
6831         tevent_req_set_callback(subreq, rpccli_spoolss_DeletePort_done, req);
6832         return req;
6833 }
6834
6835 static void rpccli_spoolss_DeletePort_done(struct tevent_req *subreq)
6836 {
6837         struct tevent_req *req = tevent_req_callback_data(
6838                 subreq, struct tevent_req);
6839         struct rpccli_spoolss_DeletePort_state *state = tevent_req_data(
6840                 req, struct rpccli_spoolss_DeletePort_state);
6841         NTSTATUS status;
6842         TALLOC_CTX *mem_ctx;
6843
6844         if (state->out_mem_ctx) {
6845                 mem_ctx = state->out_mem_ctx;
6846         } else {
6847                 mem_ctx = state;
6848         }
6849
6850         status = state->dispatch_recv(subreq, mem_ctx);
6851         TALLOC_FREE(subreq);
6852         if (!NT_STATUS_IS_OK(status)) {
6853                 tevent_req_nterror(req, status);
6854                 return;
6855         }
6856
6857         /* Copy out parameters */
6858
6859         /* Copy result */
6860         state->orig.out.result = state->tmp.out.result;
6861
6862         /* Reset temporary structure */
6863         ZERO_STRUCT(state->tmp);
6864
6865         if (DEBUGLEVEL >= 10) {
6866                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePort, &state->orig);
6867         }
6868
6869         tevent_req_done(req);
6870 }
6871
6872 NTSTATUS rpccli_spoolss_DeletePort_recv(struct tevent_req *req,
6873                                         TALLOC_CTX *mem_ctx,
6874                                         WERROR *result)
6875 {
6876         struct rpccli_spoolss_DeletePort_state *state = tevent_req_data(
6877                 req, struct rpccli_spoolss_DeletePort_state);
6878         NTSTATUS status;
6879
6880         if (tevent_req_is_nterror(req, &status)) {
6881                 tevent_req_received(req);
6882                 return status;
6883         }
6884
6885         /* Steal possbile out parameters to the callers context */
6886         talloc_steal(mem_ctx, state->out_mem_ctx);
6887
6888         /* Return result */
6889         *result = state->orig.out.result;
6890
6891         tevent_req_received(req);
6892         return NT_STATUS_OK;
6893 }
6894
6895 NTSTATUS rpccli_spoolss_DeletePort(struct rpc_pipe_client *cli,
6896                                    TALLOC_CTX *mem_ctx,
6897                                    WERROR *werror)
6898 {
6899         struct spoolss_DeletePort r;
6900         NTSTATUS status;
6901
6902         /* In parameters */
6903
6904         if (DEBUGLEVEL >= 10) {
6905                 NDR_PRINT_IN_DEBUG(spoolss_DeletePort, &r);
6906         }
6907
6908         status = cli->dispatch(cli,
6909                                 mem_ctx,
6910                                 &ndr_table_spoolss,
6911                                 NDR_SPOOLSS_DELETEPORT,
6912                                 &r);
6913
6914         if (!NT_STATUS_IS_OK(status)) {
6915                 return status;
6916         }
6917
6918         if (DEBUGLEVEL >= 10) {
6919                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePort, &r);
6920         }
6921
6922         if (NT_STATUS_IS_ERR(status)) {
6923                 return status;
6924         }
6925
6926         /* Return variables */
6927
6928         /* Return result */
6929         if (werror) {
6930                 *werror = r.out.result;
6931         }
6932
6933         return werror_to_ntstatus(r.out.result);
6934 }
6935
6936 struct rpccli_spoolss_CreatePrinterIC_state {
6937         struct spoolss_CreatePrinterIC orig;
6938         struct spoolss_CreatePrinterIC tmp;
6939         TALLOC_CTX *out_mem_ctx;
6940         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
6941 };
6942
6943 static void rpccli_spoolss_CreatePrinterIC_done(struct tevent_req *subreq);
6944
6945 struct tevent_req *rpccli_spoolss_CreatePrinterIC_send(TALLOC_CTX *mem_ctx,
6946                                                        struct tevent_context *ev,
6947                                                        struct rpc_pipe_client *cli,
6948                                                        struct policy_handle *_handle /* [in] [ref] */,
6949                                                        struct policy_handle *_gdi_handle /* [out] [ref] */,
6950                                                        struct spoolss_DevmodeContainer *_devmode_ctr /* [in] [ref] */)
6951 {
6952         struct tevent_req *req;
6953         struct rpccli_spoolss_CreatePrinterIC_state *state;
6954         struct tevent_req *subreq;
6955
6956         req = tevent_req_create(mem_ctx, &state,
6957                                 struct rpccli_spoolss_CreatePrinterIC_state);
6958         if (req == NULL) {
6959                 return NULL;
6960         }
6961         state->out_mem_ctx = NULL;
6962         state->dispatch_recv = cli->dispatch_recv;
6963
6964         /* In parameters */
6965         state->orig.in.handle = _handle;
6966         state->orig.in.devmode_ctr = _devmode_ctr;
6967
6968         /* Out parameters */
6969         state->orig.out.gdi_handle = _gdi_handle;
6970
6971         /* Result */
6972         ZERO_STRUCT(state->orig.out.result);
6973
6974         if (DEBUGLEVEL >= 10) {
6975                 NDR_PRINT_IN_DEBUG(spoolss_CreatePrinterIC, &state->orig);
6976         }
6977
6978         state->out_mem_ctx = talloc_named_const(state, 0,
6979                              "rpccli_spoolss_CreatePrinterIC_out_memory");
6980         if (tevent_req_nomem(state->out_mem_ctx, req)) {
6981                 return tevent_req_post(req, ev);
6982         }
6983
6984         /* make a temporary copy, that we pass to the dispatch function */
6985         state->tmp = state->orig;
6986
6987         subreq = cli->dispatch_send(state, ev, cli,
6988                                     &ndr_table_spoolss,
6989                                     NDR_SPOOLSS_CREATEPRINTERIC,
6990                                     &state->tmp);
6991         if (tevent_req_nomem(subreq, req)) {
6992                 return tevent_req_post(req, ev);
6993         }
6994         tevent_req_set_callback(subreq, rpccli_spoolss_CreatePrinterIC_done, req);
6995         return req;
6996 }
6997
6998 static void rpccli_spoolss_CreatePrinterIC_done(struct tevent_req *subreq)
6999 {
7000         struct tevent_req *req = tevent_req_callback_data(
7001                 subreq, struct tevent_req);
7002         struct rpccli_spoolss_CreatePrinterIC_state *state = tevent_req_data(
7003                 req, struct rpccli_spoolss_CreatePrinterIC_state);
7004         NTSTATUS status;
7005         TALLOC_CTX *mem_ctx;
7006
7007         if (state->out_mem_ctx) {
7008                 mem_ctx = state->out_mem_ctx;
7009         } else {
7010                 mem_ctx = state;
7011         }
7012
7013         status = state->dispatch_recv(subreq, mem_ctx);
7014         TALLOC_FREE(subreq);
7015         if (!NT_STATUS_IS_OK(status)) {
7016                 tevent_req_nterror(req, status);
7017                 return;
7018         }
7019
7020         /* Copy out parameters */
7021         *state->orig.out.gdi_handle = *state->tmp.out.gdi_handle;
7022
7023         /* Copy result */
7024         state->orig.out.result = state->tmp.out.result;
7025
7026         /* Reset temporary structure */
7027         ZERO_STRUCT(state->tmp);
7028
7029         if (DEBUGLEVEL >= 10) {
7030                 NDR_PRINT_OUT_DEBUG(spoolss_CreatePrinterIC, &state->orig);
7031         }
7032
7033         tevent_req_done(req);
7034 }
7035
7036 NTSTATUS rpccli_spoolss_CreatePrinterIC_recv(struct tevent_req *req,
7037                                              TALLOC_CTX *mem_ctx,
7038                                              WERROR *result)
7039 {
7040         struct rpccli_spoolss_CreatePrinterIC_state *state = tevent_req_data(
7041                 req, struct rpccli_spoolss_CreatePrinterIC_state);
7042         NTSTATUS status;
7043
7044         if (tevent_req_is_nterror(req, &status)) {
7045                 tevent_req_received(req);
7046                 return status;
7047         }
7048
7049         /* Steal possbile out parameters to the callers context */
7050         talloc_steal(mem_ctx, state->out_mem_ctx);
7051
7052         /* Return result */
7053         *result = state->orig.out.result;
7054
7055         tevent_req_received(req);
7056         return NT_STATUS_OK;
7057 }
7058
7059 NTSTATUS rpccli_spoolss_CreatePrinterIC(struct rpc_pipe_client *cli,
7060                                         TALLOC_CTX *mem_ctx,
7061                                         struct policy_handle *handle /* [in] [ref] */,
7062                                         struct policy_handle *gdi_handle /* [out] [ref] */,
7063                                         struct spoolss_DevmodeContainer *devmode_ctr /* [in] [ref] */,
7064                                         WERROR *werror)
7065 {
7066         struct spoolss_CreatePrinterIC r;
7067         NTSTATUS status;
7068
7069         /* In parameters */
7070         r.in.handle = handle;
7071         r.in.devmode_ctr = devmode_ctr;
7072
7073         if (DEBUGLEVEL >= 10) {
7074                 NDR_PRINT_IN_DEBUG(spoolss_CreatePrinterIC, &r);
7075         }
7076
7077         status = cli->dispatch(cli,
7078                                 mem_ctx,
7079                                 &ndr_table_spoolss,
7080                                 NDR_SPOOLSS_CREATEPRINTERIC,
7081                                 &r);
7082
7083         if (!NT_STATUS_IS_OK(status)) {
7084                 return status;
7085         }
7086
7087         if (DEBUGLEVEL >= 10) {
7088                 NDR_PRINT_OUT_DEBUG(spoolss_CreatePrinterIC, &r);
7089         }
7090
7091         if (NT_STATUS_IS_ERR(status)) {
7092                 return status;
7093         }
7094
7095         /* Return variables */
7096         *gdi_handle = *r.out.gdi_handle;
7097
7098         /* Return result */
7099         if (werror) {
7100                 *werror = r.out.result;
7101         }
7102
7103         return werror_to_ntstatus(r.out.result);
7104 }
7105
7106 struct rpccli_spoolss_PlayGDIScriptOnPrinterIC_state {
7107         struct spoolss_PlayGDIScriptOnPrinterIC orig;
7108         struct spoolss_PlayGDIScriptOnPrinterIC tmp;
7109         TALLOC_CTX *out_mem_ctx;
7110         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
7111 };
7112
7113 static void rpccli_spoolss_PlayGDIScriptOnPrinterIC_done(struct tevent_req *subreq);
7114
7115 struct tevent_req *rpccli_spoolss_PlayGDIScriptOnPrinterIC_send(TALLOC_CTX *mem_ctx,
7116                                                                 struct tevent_context *ev,
7117                                                                 struct rpc_pipe_client *cli)
7118 {
7119         struct tevent_req *req;
7120         struct rpccli_spoolss_PlayGDIScriptOnPrinterIC_state *state;
7121         struct tevent_req *subreq;
7122
7123         req = tevent_req_create(mem_ctx, &state,
7124                                 struct rpccli_spoolss_PlayGDIScriptOnPrinterIC_state);
7125         if (req == NULL) {
7126                 return NULL;
7127         }
7128         state->out_mem_ctx = NULL;
7129         state->dispatch_recv = cli->dispatch_recv;
7130
7131         /* In parameters */
7132
7133         /* Out parameters */
7134
7135         /* Result */
7136         ZERO_STRUCT(state->orig.out.result);
7137
7138         if (DEBUGLEVEL >= 10) {
7139                 NDR_PRINT_IN_DEBUG(spoolss_PlayGDIScriptOnPrinterIC, &state->orig);
7140         }
7141
7142         /* make a temporary copy, that we pass to the dispatch function */
7143         state->tmp = state->orig;
7144
7145         subreq = cli->dispatch_send(state, ev, cli,
7146                                     &ndr_table_spoolss,
7147                                     NDR_SPOOLSS_PLAYGDISCRIPTONPRINTERIC,
7148                                     &state->tmp);
7149         if (tevent_req_nomem(subreq, req)) {
7150                 return tevent_req_post(req, ev);
7151         }
7152         tevent_req_set_callback(subreq, rpccli_spoolss_PlayGDIScriptOnPrinterIC_done, req);
7153         return req;
7154 }
7155
7156 static void rpccli_spoolss_PlayGDIScriptOnPrinterIC_done(struct tevent_req *subreq)
7157 {
7158         struct tevent_req *req = tevent_req_callback_data(
7159                 subreq, struct tevent_req);
7160         struct rpccli_spoolss_PlayGDIScriptOnPrinterIC_state *state = tevent_req_data(
7161                 req, struct rpccli_spoolss_PlayGDIScriptOnPrinterIC_state);
7162         NTSTATUS status;
7163         TALLOC_CTX *mem_ctx;
7164
7165         if (state->out_mem_ctx) {
7166                 mem_ctx = state->out_mem_ctx;
7167         } else {
7168                 mem_ctx = state;
7169         }
7170
7171         status = state->dispatch_recv(subreq, mem_ctx);
7172         TALLOC_FREE(subreq);
7173         if (!NT_STATUS_IS_OK(status)) {
7174                 tevent_req_nterror(req, status);
7175                 return;
7176         }
7177
7178         /* Copy out parameters */
7179
7180         /* Copy result */
7181         state->orig.out.result = state->tmp.out.result;
7182
7183         /* Reset temporary structure */
7184         ZERO_STRUCT(state->tmp);
7185
7186         if (DEBUGLEVEL >= 10) {
7187                 NDR_PRINT_OUT_DEBUG(spoolss_PlayGDIScriptOnPrinterIC, &state->orig);
7188         }
7189
7190         tevent_req_done(req);
7191 }
7192
7193 NTSTATUS rpccli_spoolss_PlayGDIScriptOnPrinterIC_recv(struct tevent_req *req,
7194                                                       TALLOC_CTX *mem_ctx,
7195                                                       WERROR *result)
7196 {
7197         struct rpccli_spoolss_PlayGDIScriptOnPrinterIC_state *state = tevent_req_data(
7198                 req, struct rpccli_spoolss_PlayGDIScriptOnPrinterIC_state);
7199         NTSTATUS status;
7200
7201         if (tevent_req_is_nterror(req, &status)) {
7202                 tevent_req_received(req);
7203                 return status;
7204         }
7205
7206         /* Steal possbile out parameters to the callers context */
7207         talloc_steal(mem_ctx, state->out_mem_ctx);
7208
7209         /* Return result */
7210         *result = state->orig.out.result;
7211
7212         tevent_req_received(req);
7213         return NT_STATUS_OK;
7214 }
7215
7216 NTSTATUS rpccli_spoolss_PlayGDIScriptOnPrinterIC(struct rpc_pipe_client *cli,
7217                                                  TALLOC_CTX *mem_ctx,
7218                                                  WERROR *werror)
7219 {
7220         struct spoolss_PlayGDIScriptOnPrinterIC r;
7221         NTSTATUS status;
7222
7223         /* In parameters */
7224
7225         if (DEBUGLEVEL >= 10) {
7226                 NDR_PRINT_IN_DEBUG(spoolss_PlayGDIScriptOnPrinterIC, &r);
7227         }
7228
7229         status = cli->dispatch(cli,
7230                                 mem_ctx,
7231                                 &ndr_table_spoolss,
7232                                 NDR_SPOOLSS_PLAYGDISCRIPTONPRINTERIC,
7233                                 &r);
7234
7235         if (!NT_STATUS_IS_OK(status)) {
7236                 return status;
7237         }
7238
7239         if (DEBUGLEVEL >= 10) {
7240                 NDR_PRINT_OUT_DEBUG(spoolss_PlayGDIScriptOnPrinterIC, &r);
7241         }
7242
7243         if (NT_STATUS_IS_ERR(status)) {
7244                 return status;
7245         }
7246
7247         /* Return variables */
7248
7249         /* Return result */
7250         if (werror) {
7251                 *werror = r.out.result;
7252         }
7253
7254         return werror_to_ntstatus(r.out.result);
7255 }
7256
7257 struct rpccli_spoolss_DeletePrinterIC_state {
7258         struct spoolss_DeletePrinterIC orig;
7259         struct spoolss_DeletePrinterIC tmp;
7260         TALLOC_CTX *out_mem_ctx;
7261         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
7262 };
7263
7264 static void rpccli_spoolss_DeletePrinterIC_done(struct tevent_req *subreq);
7265
7266 struct tevent_req *rpccli_spoolss_DeletePrinterIC_send(TALLOC_CTX *mem_ctx,
7267                                                        struct tevent_context *ev,
7268                                                        struct rpc_pipe_client *cli,
7269                                                        struct policy_handle *_gdi_handle /* [in,out] [ref] */)
7270 {
7271         struct tevent_req *req;
7272         struct rpccli_spoolss_DeletePrinterIC_state *state;
7273         struct tevent_req *subreq;
7274
7275         req = tevent_req_create(mem_ctx, &state,
7276                                 struct rpccli_spoolss_DeletePrinterIC_state);
7277         if (req == NULL) {
7278                 return NULL;
7279         }
7280         state->out_mem_ctx = NULL;
7281         state->dispatch_recv = cli->dispatch_recv;
7282
7283         /* In parameters */
7284         state->orig.in.gdi_handle = _gdi_handle;
7285
7286         /* Out parameters */
7287         state->orig.out.gdi_handle = _gdi_handle;
7288
7289         /* Result */
7290         ZERO_STRUCT(state->orig.out.result);
7291
7292         if (DEBUGLEVEL >= 10) {
7293                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrinterIC, &state->orig);
7294         }
7295
7296         state->out_mem_ctx = talloc_named_const(state, 0,
7297                              "rpccli_spoolss_DeletePrinterIC_out_memory");
7298         if (tevent_req_nomem(state->out_mem_ctx, req)) {
7299                 return tevent_req_post(req, ev);
7300         }
7301
7302         /* make a temporary copy, that we pass to the dispatch function */
7303         state->tmp = state->orig;
7304
7305         subreq = cli->dispatch_send(state, ev, cli,
7306                                     &ndr_table_spoolss,
7307                                     NDR_SPOOLSS_DELETEPRINTERIC,
7308                                     &state->tmp);
7309         if (tevent_req_nomem(subreq, req)) {
7310                 return tevent_req_post(req, ev);
7311         }
7312         tevent_req_set_callback(subreq, rpccli_spoolss_DeletePrinterIC_done, req);
7313         return req;
7314 }
7315
7316 static void rpccli_spoolss_DeletePrinterIC_done(struct tevent_req *subreq)
7317 {
7318         struct tevent_req *req = tevent_req_callback_data(
7319                 subreq, struct tevent_req);
7320         struct rpccli_spoolss_DeletePrinterIC_state *state = tevent_req_data(
7321                 req, struct rpccli_spoolss_DeletePrinterIC_state);
7322         NTSTATUS status;
7323         TALLOC_CTX *mem_ctx;
7324
7325         if (state->out_mem_ctx) {
7326                 mem_ctx = state->out_mem_ctx;
7327         } else {
7328                 mem_ctx = state;
7329         }
7330
7331         status = state->dispatch_recv(subreq, mem_ctx);
7332         TALLOC_FREE(subreq);
7333         if (!NT_STATUS_IS_OK(status)) {
7334                 tevent_req_nterror(req, status);
7335                 return;
7336         }
7337
7338         /* Copy out parameters */
7339         *state->orig.out.gdi_handle = *state->tmp.out.gdi_handle;
7340
7341         /* Copy result */
7342         state->orig.out.result = state->tmp.out.result;
7343
7344         /* Reset temporary structure */
7345         ZERO_STRUCT(state->tmp);
7346
7347         if (DEBUGLEVEL >= 10) {
7348                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrinterIC, &state->orig);
7349         }
7350
7351         tevent_req_done(req);
7352 }
7353
7354 NTSTATUS rpccli_spoolss_DeletePrinterIC_recv(struct tevent_req *req,
7355                                              TALLOC_CTX *mem_ctx,
7356                                              WERROR *result)
7357 {
7358         struct rpccli_spoolss_DeletePrinterIC_state *state = tevent_req_data(
7359                 req, struct rpccli_spoolss_DeletePrinterIC_state);
7360         NTSTATUS status;
7361
7362         if (tevent_req_is_nterror(req, &status)) {
7363                 tevent_req_received(req);
7364                 return status;
7365         }
7366
7367         /* Steal possbile out parameters to the callers context */
7368         talloc_steal(mem_ctx, state->out_mem_ctx);
7369
7370         /* Return result */
7371         *result = state->orig.out.result;
7372
7373         tevent_req_received(req);
7374         return NT_STATUS_OK;
7375 }
7376
7377 NTSTATUS rpccli_spoolss_DeletePrinterIC(struct rpc_pipe_client *cli,
7378                                         TALLOC_CTX *mem_ctx,
7379                                         struct policy_handle *gdi_handle /* [in,out] [ref] */,
7380                                         WERROR *werror)
7381 {
7382         struct spoolss_DeletePrinterIC r;
7383         NTSTATUS status;
7384
7385         /* In parameters */
7386         r.in.gdi_handle = gdi_handle;
7387
7388         if (DEBUGLEVEL >= 10) {
7389                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrinterIC, &r);
7390         }
7391
7392         status = cli->dispatch(cli,
7393                                 mem_ctx,
7394                                 &ndr_table_spoolss,
7395                                 NDR_SPOOLSS_DELETEPRINTERIC,
7396                                 &r);
7397
7398         if (!NT_STATUS_IS_OK(status)) {
7399                 return status;
7400         }
7401
7402         if (DEBUGLEVEL >= 10) {
7403                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrinterIC, &r);
7404         }
7405
7406         if (NT_STATUS_IS_ERR(status)) {
7407                 return status;
7408         }
7409
7410         /* Return variables */
7411         *gdi_handle = *r.out.gdi_handle;
7412
7413         /* Return result */
7414         if (werror) {
7415                 *werror = r.out.result;
7416         }
7417
7418         return werror_to_ntstatus(r.out.result);
7419 }
7420
7421 struct rpccli_spoolss_AddPrinterConnection_state {
7422         struct spoolss_AddPrinterConnection orig;
7423         struct spoolss_AddPrinterConnection tmp;
7424         TALLOC_CTX *out_mem_ctx;
7425         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
7426 };
7427
7428 static void rpccli_spoolss_AddPrinterConnection_done(struct tevent_req *subreq);
7429
7430 struct tevent_req *rpccli_spoolss_AddPrinterConnection_send(TALLOC_CTX *mem_ctx,
7431                                                             struct tevent_context *ev,
7432                                                             struct rpc_pipe_client *cli)
7433 {
7434         struct tevent_req *req;
7435         struct rpccli_spoolss_AddPrinterConnection_state *state;
7436         struct tevent_req *subreq;
7437
7438         req = tevent_req_create(mem_ctx, &state,
7439                                 struct rpccli_spoolss_AddPrinterConnection_state);
7440         if (req == NULL) {
7441                 return NULL;
7442         }
7443         state->out_mem_ctx = NULL;
7444         state->dispatch_recv = cli->dispatch_recv;
7445
7446         /* In parameters */
7447
7448         /* Out parameters */
7449
7450         /* Result */
7451         ZERO_STRUCT(state->orig.out.result);
7452
7453         if (DEBUGLEVEL >= 10) {
7454                 NDR_PRINT_IN_DEBUG(spoolss_AddPrinterConnection, &state->orig);
7455         }
7456
7457         /* make a temporary copy, that we pass to the dispatch function */
7458         state->tmp = state->orig;
7459
7460         subreq = cli->dispatch_send(state, ev, cli,
7461                                     &ndr_table_spoolss,
7462                                     NDR_SPOOLSS_ADDPRINTERCONNECTION,
7463                                     &state->tmp);
7464         if (tevent_req_nomem(subreq, req)) {
7465                 return tevent_req_post(req, ev);
7466         }
7467         tevent_req_set_callback(subreq, rpccli_spoolss_AddPrinterConnection_done, req);
7468         return req;
7469 }
7470
7471 static void rpccli_spoolss_AddPrinterConnection_done(struct tevent_req *subreq)
7472 {
7473         struct tevent_req *req = tevent_req_callback_data(
7474                 subreq, struct tevent_req);
7475         struct rpccli_spoolss_AddPrinterConnection_state *state = tevent_req_data(
7476                 req, struct rpccli_spoolss_AddPrinterConnection_state);
7477         NTSTATUS status;
7478         TALLOC_CTX *mem_ctx;
7479
7480         if (state->out_mem_ctx) {
7481                 mem_ctx = state->out_mem_ctx;
7482         } else {
7483                 mem_ctx = state;
7484         }
7485
7486         status = state->dispatch_recv(subreq, mem_ctx);
7487         TALLOC_FREE(subreq);
7488         if (!NT_STATUS_IS_OK(status)) {
7489                 tevent_req_nterror(req, status);
7490                 return;
7491         }
7492
7493         /* Copy out parameters */
7494
7495         /* Copy result */
7496         state->orig.out.result = state->tmp.out.result;
7497
7498         /* Reset temporary structure */
7499         ZERO_STRUCT(state->tmp);
7500
7501         if (DEBUGLEVEL >= 10) {
7502                 NDR_PRINT_OUT_DEBUG(spoolss_AddPrinterConnection, &state->orig);
7503         }
7504
7505         tevent_req_done(req);
7506 }
7507
7508 NTSTATUS rpccli_spoolss_AddPrinterConnection_recv(struct tevent_req *req,
7509                                                   TALLOC_CTX *mem_ctx,
7510                                                   WERROR *result)
7511 {
7512         struct rpccli_spoolss_AddPrinterConnection_state *state = tevent_req_data(
7513                 req, struct rpccli_spoolss_AddPrinterConnection_state);
7514         NTSTATUS status;
7515
7516         if (tevent_req_is_nterror(req, &status)) {
7517                 tevent_req_received(req);
7518                 return status;
7519         }
7520
7521         /* Steal possbile out parameters to the callers context */
7522         talloc_steal(mem_ctx, state->out_mem_ctx);
7523
7524         /* Return result */
7525         *result = state->orig.out.result;
7526
7527         tevent_req_received(req);
7528         return NT_STATUS_OK;
7529 }
7530
7531 NTSTATUS rpccli_spoolss_AddPrinterConnection(struct rpc_pipe_client *cli,
7532                                              TALLOC_CTX *mem_ctx,
7533                                              WERROR *werror)
7534 {
7535         struct spoolss_AddPrinterConnection r;
7536         NTSTATUS status;
7537
7538         /* In parameters */
7539
7540         if (DEBUGLEVEL >= 10) {
7541                 NDR_PRINT_IN_DEBUG(spoolss_AddPrinterConnection, &r);
7542         }
7543
7544         status = cli->dispatch(cli,
7545                                 mem_ctx,
7546                                 &ndr_table_spoolss,
7547                                 NDR_SPOOLSS_ADDPRINTERCONNECTION,
7548                                 &r);
7549
7550         if (!NT_STATUS_IS_OK(status)) {
7551                 return status;
7552         }
7553
7554         if (DEBUGLEVEL >= 10) {
7555                 NDR_PRINT_OUT_DEBUG(spoolss_AddPrinterConnection, &r);
7556         }
7557
7558         if (NT_STATUS_IS_ERR(status)) {
7559                 return status;
7560         }
7561
7562         /* Return variables */
7563
7564         /* Return result */
7565         if (werror) {
7566                 *werror = r.out.result;
7567         }
7568
7569         return werror_to_ntstatus(r.out.result);
7570 }
7571
7572 struct rpccli_spoolss_DeletePrinterConnection_state {
7573         struct spoolss_DeletePrinterConnection orig;
7574         struct spoolss_DeletePrinterConnection tmp;
7575         TALLOC_CTX *out_mem_ctx;
7576         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
7577 };
7578
7579 static void rpccli_spoolss_DeletePrinterConnection_done(struct tevent_req *subreq);
7580
7581 struct tevent_req *rpccli_spoolss_DeletePrinterConnection_send(TALLOC_CTX *mem_ctx,
7582                                                                struct tevent_context *ev,
7583                                                                struct rpc_pipe_client *cli)
7584 {
7585         struct tevent_req *req;
7586         struct rpccli_spoolss_DeletePrinterConnection_state *state;
7587         struct tevent_req *subreq;
7588
7589         req = tevent_req_create(mem_ctx, &state,
7590                                 struct rpccli_spoolss_DeletePrinterConnection_state);
7591         if (req == NULL) {
7592                 return NULL;
7593         }
7594         state->out_mem_ctx = NULL;
7595         state->dispatch_recv = cli->dispatch_recv;
7596
7597         /* In parameters */
7598
7599         /* Out parameters */
7600
7601         /* Result */
7602         ZERO_STRUCT(state->orig.out.result);
7603
7604         if (DEBUGLEVEL >= 10) {
7605                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrinterConnection, &state->orig);
7606         }
7607
7608         /* make a temporary copy, that we pass to the dispatch function */
7609         state->tmp = state->orig;
7610
7611         subreq = cli->dispatch_send(state, ev, cli,
7612                                     &ndr_table_spoolss,
7613                                     NDR_SPOOLSS_DELETEPRINTERCONNECTION,
7614                                     &state->tmp);
7615         if (tevent_req_nomem(subreq, req)) {
7616                 return tevent_req_post(req, ev);
7617         }
7618         tevent_req_set_callback(subreq, rpccli_spoolss_DeletePrinterConnection_done, req);
7619         return req;
7620 }
7621
7622 static void rpccli_spoolss_DeletePrinterConnection_done(struct tevent_req *subreq)
7623 {
7624         struct tevent_req *req = tevent_req_callback_data(
7625                 subreq, struct tevent_req);
7626         struct rpccli_spoolss_DeletePrinterConnection_state *state = tevent_req_data(
7627                 req, struct rpccli_spoolss_DeletePrinterConnection_state);
7628         NTSTATUS status;
7629         TALLOC_CTX *mem_ctx;
7630
7631         if (state->out_mem_ctx) {
7632                 mem_ctx = state->out_mem_ctx;
7633         } else {
7634                 mem_ctx = state;
7635         }
7636
7637         status = state->dispatch_recv(subreq, mem_ctx);
7638         TALLOC_FREE(subreq);
7639         if (!NT_STATUS_IS_OK(status)) {
7640                 tevent_req_nterror(req, status);
7641                 return;
7642         }
7643
7644         /* Copy out parameters */
7645
7646         /* Copy result */
7647         state->orig.out.result = state->tmp.out.result;
7648
7649         /* Reset temporary structure */
7650         ZERO_STRUCT(state->tmp);
7651
7652         if (DEBUGLEVEL >= 10) {
7653                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrinterConnection, &state->orig);
7654         }
7655
7656         tevent_req_done(req);
7657 }
7658
7659 NTSTATUS rpccli_spoolss_DeletePrinterConnection_recv(struct tevent_req *req,
7660                                                      TALLOC_CTX *mem_ctx,
7661                                                      WERROR *result)
7662 {
7663         struct rpccli_spoolss_DeletePrinterConnection_state *state = tevent_req_data(
7664                 req, struct rpccli_spoolss_DeletePrinterConnection_state);
7665         NTSTATUS status;
7666
7667         if (tevent_req_is_nterror(req, &status)) {
7668                 tevent_req_received(req);
7669                 return status;
7670         }
7671
7672         /* Steal possbile out parameters to the callers context */
7673         talloc_steal(mem_ctx, state->out_mem_ctx);
7674
7675         /* Return result */
7676         *result = state->orig.out.result;
7677
7678         tevent_req_received(req);
7679         return NT_STATUS_OK;
7680 }
7681
7682 NTSTATUS rpccli_spoolss_DeletePrinterConnection(struct rpc_pipe_client *cli,
7683                                                 TALLOC_CTX *mem_ctx,
7684                                                 WERROR *werror)
7685 {
7686         struct spoolss_DeletePrinterConnection r;
7687         NTSTATUS status;
7688
7689         /* In parameters */
7690
7691         if (DEBUGLEVEL >= 10) {
7692                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrinterConnection, &r);
7693         }
7694
7695         status = cli->dispatch(cli,
7696                                 mem_ctx,
7697                                 &ndr_table_spoolss,
7698                                 NDR_SPOOLSS_DELETEPRINTERCONNECTION,
7699                                 &r);
7700
7701         if (!NT_STATUS_IS_OK(status)) {
7702                 return status;
7703         }
7704
7705         if (DEBUGLEVEL >= 10) {
7706                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrinterConnection, &r);
7707         }
7708
7709         if (NT_STATUS_IS_ERR(status)) {
7710                 return status;
7711         }
7712
7713         /* Return variables */
7714
7715         /* Return result */
7716         if (werror) {
7717                 *werror = r.out.result;
7718         }
7719
7720         return werror_to_ntstatus(r.out.result);
7721 }
7722
7723 struct rpccli_spoolss_PrinterMessageBox_state {
7724         struct spoolss_PrinterMessageBox orig;
7725         struct spoolss_PrinterMessageBox tmp;
7726         TALLOC_CTX *out_mem_ctx;
7727         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
7728 };
7729
7730 static void rpccli_spoolss_PrinterMessageBox_done(struct tevent_req *subreq);
7731
7732 struct tevent_req *rpccli_spoolss_PrinterMessageBox_send(TALLOC_CTX *mem_ctx,
7733                                                          struct tevent_context *ev,
7734                                                          struct rpc_pipe_client *cli)
7735 {
7736         struct tevent_req *req;
7737         struct rpccli_spoolss_PrinterMessageBox_state *state;
7738         struct tevent_req *subreq;
7739
7740         req = tevent_req_create(mem_ctx, &state,
7741                                 struct rpccli_spoolss_PrinterMessageBox_state);
7742         if (req == NULL) {
7743                 return NULL;
7744         }
7745         state->out_mem_ctx = NULL;
7746         state->dispatch_recv = cli->dispatch_recv;
7747
7748         /* In parameters */
7749
7750         /* Out parameters */
7751
7752         /* Result */
7753         ZERO_STRUCT(state->orig.out.result);
7754
7755         if (DEBUGLEVEL >= 10) {
7756                 NDR_PRINT_IN_DEBUG(spoolss_PrinterMessageBox, &state->orig);
7757         }
7758
7759         /* make a temporary copy, that we pass to the dispatch function */
7760         state->tmp = state->orig;
7761
7762         subreq = cli->dispatch_send(state, ev, cli,
7763                                     &ndr_table_spoolss,
7764                                     NDR_SPOOLSS_PRINTERMESSAGEBOX,
7765                                     &state->tmp);
7766         if (tevent_req_nomem(subreq, req)) {
7767                 return tevent_req_post(req, ev);
7768         }
7769         tevent_req_set_callback(subreq, rpccli_spoolss_PrinterMessageBox_done, req);
7770         return req;
7771 }
7772
7773 static void rpccli_spoolss_PrinterMessageBox_done(struct tevent_req *subreq)
7774 {
7775         struct tevent_req *req = tevent_req_callback_data(
7776                 subreq, struct tevent_req);
7777         struct rpccli_spoolss_PrinterMessageBox_state *state = tevent_req_data(
7778                 req, struct rpccli_spoolss_PrinterMessageBox_state);
7779         NTSTATUS status;
7780         TALLOC_CTX *mem_ctx;
7781
7782         if (state->out_mem_ctx) {
7783                 mem_ctx = state->out_mem_ctx;
7784         } else {
7785                 mem_ctx = state;
7786         }
7787
7788         status = state->dispatch_recv(subreq, mem_ctx);
7789         TALLOC_FREE(subreq);
7790         if (!NT_STATUS_IS_OK(status)) {
7791                 tevent_req_nterror(req, status);
7792                 return;
7793         }
7794
7795         /* Copy out parameters */
7796
7797         /* Copy result */
7798         state->orig.out.result = state->tmp.out.result;
7799
7800         /* Reset temporary structure */
7801         ZERO_STRUCT(state->tmp);
7802
7803         if (DEBUGLEVEL >= 10) {
7804                 NDR_PRINT_OUT_DEBUG(spoolss_PrinterMessageBox, &state->orig);
7805         }
7806
7807         tevent_req_done(req);
7808 }
7809
7810 NTSTATUS rpccli_spoolss_PrinterMessageBox_recv(struct tevent_req *req,
7811                                                TALLOC_CTX *mem_ctx,
7812                                                WERROR *result)
7813 {
7814         struct rpccli_spoolss_PrinterMessageBox_state *state = tevent_req_data(
7815                 req, struct rpccli_spoolss_PrinterMessageBox_state);
7816         NTSTATUS status;
7817
7818         if (tevent_req_is_nterror(req, &status)) {
7819                 tevent_req_received(req);
7820                 return status;
7821         }
7822
7823         /* Steal possbile out parameters to the callers context */
7824         talloc_steal(mem_ctx, state->out_mem_ctx);
7825
7826         /* Return result */
7827         *result = state->orig.out.result;
7828
7829         tevent_req_received(req);
7830         return NT_STATUS_OK;
7831 }
7832
7833 NTSTATUS rpccli_spoolss_PrinterMessageBox(struct rpc_pipe_client *cli,
7834                                           TALLOC_CTX *mem_ctx,
7835                                           WERROR *werror)
7836 {
7837         struct spoolss_PrinterMessageBox r;
7838         NTSTATUS status;
7839
7840         /* In parameters */
7841
7842         if (DEBUGLEVEL >= 10) {
7843                 NDR_PRINT_IN_DEBUG(spoolss_PrinterMessageBox, &r);
7844         }
7845
7846         status = cli->dispatch(cli,
7847                                 mem_ctx,
7848                                 &ndr_table_spoolss,
7849                                 NDR_SPOOLSS_PRINTERMESSAGEBOX,
7850                                 &r);
7851
7852         if (!NT_STATUS_IS_OK(status)) {
7853                 return status;
7854         }
7855
7856         if (DEBUGLEVEL >= 10) {
7857                 NDR_PRINT_OUT_DEBUG(spoolss_PrinterMessageBox, &r);
7858         }
7859
7860         if (NT_STATUS_IS_ERR(status)) {
7861                 return status;
7862         }
7863
7864         /* Return variables */
7865
7866         /* Return result */
7867         if (werror) {
7868                 *werror = r.out.result;
7869         }
7870
7871         return werror_to_ntstatus(r.out.result);
7872 }
7873
7874 struct rpccli_spoolss_AddMonitor_state {
7875         struct spoolss_AddMonitor orig;
7876         struct spoolss_AddMonitor tmp;
7877         TALLOC_CTX *out_mem_ctx;
7878         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
7879 };
7880
7881 static void rpccli_spoolss_AddMonitor_done(struct tevent_req *subreq);
7882
7883 struct tevent_req *rpccli_spoolss_AddMonitor_send(TALLOC_CTX *mem_ctx,
7884                                                   struct tevent_context *ev,
7885                                                   struct rpc_pipe_client *cli)
7886 {
7887         struct tevent_req *req;
7888         struct rpccli_spoolss_AddMonitor_state *state;
7889         struct tevent_req *subreq;
7890
7891         req = tevent_req_create(mem_ctx, &state,
7892                                 struct rpccli_spoolss_AddMonitor_state);
7893         if (req == NULL) {
7894                 return NULL;
7895         }
7896         state->out_mem_ctx = NULL;
7897         state->dispatch_recv = cli->dispatch_recv;
7898
7899         /* In parameters */
7900
7901         /* Out parameters */
7902
7903         /* Result */
7904         ZERO_STRUCT(state->orig.out.result);
7905
7906         if (DEBUGLEVEL >= 10) {
7907                 NDR_PRINT_IN_DEBUG(spoolss_AddMonitor, &state->orig);
7908         }
7909
7910         /* make a temporary copy, that we pass to the dispatch function */
7911         state->tmp = state->orig;
7912
7913         subreq = cli->dispatch_send(state, ev, cli,
7914                                     &ndr_table_spoolss,
7915                                     NDR_SPOOLSS_ADDMONITOR,
7916                                     &state->tmp);
7917         if (tevent_req_nomem(subreq, req)) {
7918                 return tevent_req_post(req, ev);
7919         }
7920         tevent_req_set_callback(subreq, rpccli_spoolss_AddMonitor_done, req);
7921         return req;
7922 }
7923
7924 static void rpccli_spoolss_AddMonitor_done(struct tevent_req *subreq)
7925 {
7926         struct tevent_req *req = tevent_req_callback_data(
7927                 subreq, struct tevent_req);
7928         struct rpccli_spoolss_AddMonitor_state *state = tevent_req_data(
7929                 req, struct rpccli_spoolss_AddMonitor_state);
7930         NTSTATUS status;
7931         TALLOC_CTX *mem_ctx;
7932
7933         if (state->out_mem_ctx) {
7934                 mem_ctx = state->out_mem_ctx;
7935         } else {
7936                 mem_ctx = state;
7937         }
7938
7939         status = state->dispatch_recv(subreq, mem_ctx);
7940         TALLOC_FREE(subreq);
7941         if (!NT_STATUS_IS_OK(status)) {
7942                 tevent_req_nterror(req, status);
7943                 return;
7944         }
7945
7946         /* Copy out parameters */
7947
7948         /* Copy result */
7949         state->orig.out.result = state->tmp.out.result;
7950
7951         /* Reset temporary structure */
7952         ZERO_STRUCT(state->tmp);
7953
7954         if (DEBUGLEVEL >= 10) {
7955                 NDR_PRINT_OUT_DEBUG(spoolss_AddMonitor, &state->orig);
7956         }
7957
7958         tevent_req_done(req);
7959 }
7960
7961 NTSTATUS rpccli_spoolss_AddMonitor_recv(struct tevent_req *req,
7962                                         TALLOC_CTX *mem_ctx,
7963                                         WERROR *result)
7964 {
7965         struct rpccli_spoolss_AddMonitor_state *state = tevent_req_data(
7966                 req, struct rpccli_spoolss_AddMonitor_state);
7967         NTSTATUS status;
7968
7969         if (tevent_req_is_nterror(req, &status)) {
7970                 tevent_req_received(req);
7971                 return status;
7972         }
7973
7974         /* Steal possbile out parameters to the callers context */
7975         talloc_steal(mem_ctx, state->out_mem_ctx);
7976
7977         /* Return result */
7978         *result = state->orig.out.result;
7979
7980         tevent_req_received(req);
7981         return NT_STATUS_OK;
7982 }
7983
7984 NTSTATUS rpccli_spoolss_AddMonitor(struct rpc_pipe_client *cli,
7985                                    TALLOC_CTX *mem_ctx,
7986                                    WERROR *werror)
7987 {
7988         struct spoolss_AddMonitor r;
7989         NTSTATUS status;
7990
7991         /* In parameters */
7992
7993         if (DEBUGLEVEL >= 10) {
7994                 NDR_PRINT_IN_DEBUG(spoolss_AddMonitor, &r);
7995         }
7996
7997         status = cli->dispatch(cli,
7998                                 mem_ctx,
7999                                 &ndr_table_spoolss,
8000                                 NDR_SPOOLSS_ADDMONITOR,
8001                                 &r);
8002
8003         if (!NT_STATUS_IS_OK(status)) {
8004                 return status;
8005         }
8006
8007         if (DEBUGLEVEL >= 10) {
8008                 NDR_PRINT_OUT_DEBUG(spoolss_AddMonitor, &r);
8009         }
8010
8011         if (NT_STATUS_IS_ERR(status)) {
8012                 return status;
8013         }
8014
8015         /* Return variables */
8016
8017         /* Return result */
8018         if (werror) {
8019                 *werror = r.out.result;
8020         }
8021
8022         return werror_to_ntstatus(r.out.result);
8023 }
8024
8025 struct rpccli_spoolss_DeleteMonitor_state {
8026         struct spoolss_DeleteMonitor orig;
8027         struct spoolss_DeleteMonitor tmp;
8028         TALLOC_CTX *out_mem_ctx;
8029         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
8030 };
8031
8032 static void rpccli_spoolss_DeleteMonitor_done(struct tevent_req *subreq);
8033
8034 struct tevent_req *rpccli_spoolss_DeleteMonitor_send(TALLOC_CTX *mem_ctx,
8035                                                      struct tevent_context *ev,
8036                                                      struct rpc_pipe_client *cli)
8037 {
8038         struct tevent_req *req;
8039         struct rpccli_spoolss_DeleteMonitor_state *state;
8040         struct tevent_req *subreq;
8041
8042         req = tevent_req_create(mem_ctx, &state,
8043                                 struct rpccli_spoolss_DeleteMonitor_state);
8044         if (req == NULL) {
8045                 return NULL;
8046         }
8047         state->out_mem_ctx = NULL;
8048         state->dispatch_recv = cli->dispatch_recv;
8049
8050         /* In parameters */
8051
8052         /* Out parameters */
8053
8054         /* Result */
8055         ZERO_STRUCT(state->orig.out.result);
8056
8057         if (DEBUGLEVEL >= 10) {
8058                 NDR_PRINT_IN_DEBUG(spoolss_DeleteMonitor, &state->orig);
8059         }
8060
8061         /* make a temporary copy, that we pass to the dispatch function */
8062         state->tmp = state->orig;
8063
8064         subreq = cli->dispatch_send(state, ev, cli,
8065                                     &ndr_table_spoolss,
8066                                     NDR_SPOOLSS_DELETEMONITOR,
8067                                     &state->tmp);
8068         if (tevent_req_nomem(subreq, req)) {
8069                 return tevent_req_post(req, ev);
8070         }
8071         tevent_req_set_callback(subreq, rpccli_spoolss_DeleteMonitor_done, req);
8072         return req;
8073 }
8074
8075 static void rpccli_spoolss_DeleteMonitor_done(struct tevent_req *subreq)
8076 {
8077         struct tevent_req *req = tevent_req_callback_data(
8078                 subreq, struct tevent_req);
8079         struct rpccli_spoolss_DeleteMonitor_state *state = tevent_req_data(
8080                 req, struct rpccli_spoolss_DeleteMonitor_state);
8081         NTSTATUS status;
8082         TALLOC_CTX *mem_ctx;
8083
8084         if (state->out_mem_ctx) {
8085                 mem_ctx = state->out_mem_ctx;
8086         } else {
8087                 mem_ctx = state;
8088         }
8089
8090         status = state->dispatch_recv(subreq, mem_ctx);
8091         TALLOC_FREE(subreq);
8092         if (!NT_STATUS_IS_OK(status)) {
8093                 tevent_req_nterror(req, status);
8094                 return;
8095         }
8096
8097         /* Copy out parameters */
8098
8099         /* Copy result */
8100         state->orig.out.result = state->tmp.out.result;
8101
8102         /* Reset temporary structure */
8103         ZERO_STRUCT(state->tmp);
8104
8105         if (DEBUGLEVEL >= 10) {
8106                 NDR_PRINT_OUT_DEBUG(spoolss_DeleteMonitor, &state->orig);
8107         }
8108
8109         tevent_req_done(req);
8110 }
8111
8112 NTSTATUS rpccli_spoolss_DeleteMonitor_recv(struct tevent_req *req,
8113                                            TALLOC_CTX *mem_ctx,
8114                                            WERROR *result)
8115 {
8116         struct rpccli_spoolss_DeleteMonitor_state *state = tevent_req_data(
8117                 req, struct rpccli_spoolss_DeleteMonitor_state);
8118         NTSTATUS status;
8119
8120         if (tevent_req_is_nterror(req, &status)) {
8121                 tevent_req_received(req);
8122                 return status;
8123         }
8124
8125         /* Steal possbile out parameters to the callers context */
8126         talloc_steal(mem_ctx, state->out_mem_ctx);
8127
8128         /* Return result */
8129         *result = state->orig.out.result;
8130
8131         tevent_req_received(req);
8132         return NT_STATUS_OK;
8133 }
8134
8135 NTSTATUS rpccli_spoolss_DeleteMonitor(struct rpc_pipe_client *cli,
8136                                       TALLOC_CTX *mem_ctx,
8137                                       WERROR *werror)
8138 {
8139         struct spoolss_DeleteMonitor r;
8140         NTSTATUS status;
8141
8142         /* In parameters */
8143
8144         if (DEBUGLEVEL >= 10) {
8145                 NDR_PRINT_IN_DEBUG(spoolss_DeleteMonitor, &r);
8146         }
8147
8148         status = cli->dispatch(cli,
8149                                 mem_ctx,
8150                                 &ndr_table_spoolss,
8151                                 NDR_SPOOLSS_DELETEMONITOR,
8152                                 &r);
8153
8154         if (!NT_STATUS_IS_OK(status)) {
8155                 return status;
8156         }
8157
8158         if (DEBUGLEVEL >= 10) {
8159                 NDR_PRINT_OUT_DEBUG(spoolss_DeleteMonitor, &r);
8160         }
8161
8162         if (NT_STATUS_IS_ERR(status)) {
8163                 return status;
8164         }
8165
8166         /* Return variables */
8167
8168         /* Return result */
8169         if (werror) {
8170                 *werror = r.out.result;
8171         }
8172
8173         return werror_to_ntstatus(r.out.result);
8174 }
8175
8176 struct rpccli_spoolss_DeletePrintProcessor_state {
8177         struct spoolss_DeletePrintProcessor orig;
8178         struct spoolss_DeletePrintProcessor tmp;
8179         TALLOC_CTX *out_mem_ctx;
8180         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
8181 };
8182
8183 static void rpccli_spoolss_DeletePrintProcessor_done(struct tevent_req *subreq);
8184
8185 struct tevent_req *rpccli_spoolss_DeletePrintProcessor_send(TALLOC_CTX *mem_ctx,
8186                                                             struct tevent_context *ev,
8187                                                             struct rpc_pipe_client *cli)
8188 {
8189         struct tevent_req *req;
8190         struct rpccli_spoolss_DeletePrintProcessor_state *state;
8191         struct tevent_req *subreq;
8192
8193         req = tevent_req_create(mem_ctx, &state,
8194                                 struct rpccli_spoolss_DeletePrintProcessor_state);
8195         if (req == NULL) {
8196                 return NULL;
8197         }
8198         state->out_mem_ctx = NULL;
8199         state->dispatch_recv = cli->dispatch_recv;
8200
8201         /* In parameters */
8202
8203         /* Out parameters */
8204
8205         /* Result */
8206         ZERO_STRUCT(state->orig.out.result);
8207
8208         if (DEBUGLEVEL >= 10) {
8209                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrintProcessor, &state->orig);
8210         }
8211
8212         /* make a temporary copy, that we pass to the dispatch function */
8213         state->tmp = state->orig;
8214
8215         subreq = cli->dispatch_send(state, ev, cli,
8216                                     &ndr_table_spoolss,
8217                                     NDR_SPOOLSS_DELETEPRINTPROCESSOR,
8218                                     &state->tmp);
8219         if (tevent_req_nomem(subreq, req)) {
8220                 return tevent_req_post(req, ev);
8221         }
8222         tevent_req_set_callback(subreq, rpccli_spoolss_DeletePrintProcessor_done, req);
8223         return req;
8224 }
8225
8226 static void rpccli_spoolss_DeletePrintProcessor_done(struct tevent_req *subreq)
8227 {
8228         struct tevent_req *req = tevent_req_callback_data(
8229                 subreq, struct tevent_req);
8230         struct rpccli_spoolss_DeletePrintProcessor_state *state = tevent_req_data(
8231                 req, struct rpccli_spoolss_DeletePrintProcessor_state);
8232         NTSTATUS status;
8233         TALLOC_CTX *mem_ctx;
8234
8235         if (state->out_mem_ctx) {
8236                 mem_ctx = state->out_mem_ctx;
8237         } else {
8238                 mem_ctx = state;
8239         }
8240
8241         status = state->dispatch_recv(subreq, mem_ctx);
8242         TALLOC_FREE(subreq);
8243         if (!NT_STATUS_IS_OK(status)) {
8244                 tevent_req_nterror(req, status);
8245                 return;
8246         }
8247
8248         /* Copy out parameters */
8249
8250         /* Copy result */
8251         state->orig.out.result = state->tmp.out.result;
8252
8253         /* Reset temporary structure */
8254         ZERO_STRUCT(state->tmp);
8255
8256         if (DEBUGLEVEL >= 10) {
8257                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrintProcessor, &state->orig);
8258         }
8259
8260         tevent_req_done(req);
8261 }
8262
8263 NTSTATUS rpccli_spoolss_DeletePrintProcessor_recv(struct tevent_req *req,
8264                                                   TALLOC_CTX *mem_ctx,
8265                                                   WERROR *result)
8266 {
8267         struct rpccli_spoolss_DeletePrintProcessor_state *state = tevent_req_data(
8268                 req, struct rpccli_spoolss_DeletePrintProcessor_state);
8269         NTSTATUS status;
8270
8271         if (tevent_req_is_nterror(req, &status)) {
8272                 tevent_req_received(req);
8273                 return status;
8274         }
8275
8276         /* Steal possbile out parameters to the callers context */
8277         talloc_steal(mem_ctx, state->out_mem_ctx);
8278
8279         /* Return result */
8280         *result = state->orig.out.result;
8281
8282         tevent_req_received(req);
8283         return NT_STATUS_OK;
8284 }
8285
8286 NTSTATUS rpccli_spoolss_DeletePrintProcessor(struct rpc_pipe_client *cli,
8287                                              TALLOC_CTX *mem_ctx,
8288                                              WERROR *werror)
8289 {
8290         struct spoolss_DeletePrintProcessor r;
8291         NTSTATUS status;
8292
8293         /* In parameters */
8294
8295         if (DEBUGLEVEL >= 10) {
8296                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrintProcessor, &r);
8297         }
8298
8299         status = cli->dispatch(cli,
8300                                 mem_ctx,
8301                                 &ndr_table_spoolss,
8302                                 NDR_SPOOLSS_DELETEPRINTPROCESSOR,
8303                                 &r);
8304
8305         if (!NT_STATUS_IS_OK(status)) {
8306                 return status;
8307         }
8308
8309         if (DEBUGLEVEL >= 10) {
8310                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrintProcessor, &r);
8311         }
8312
8313         if (NT_STATUS_IS_ERR(status)) {
8314                 return status;
8315         }
8316
8317         /* Return variables */
8318
8319         /* Return result */
8320         if (werror) {
8321                 *werror = r.out.result;
8322         }
8323
8324         return werror_to_ntstatus(r.out.result);
8325 }
8326
8327 struct rpccli_spoolss_AddPrintProvidor_state {
8328         struct spoolss_AddPrintProvidor orig;
8329         struct spoolss_AddPrintProvidor tmp;
8330         TALLOC_CTX *out_mem_ctx;
8331         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
8332 };
8333
8334 static void rpccli_spoolss_AddPrintProvidor_done(struct tevent_req *subreq);
8335
8336 struct tevent_req *rpccli_spoolss_AddPrintProvidor_send(TALLOC_CTX *mem_ctx,
8337                                                         struct tevent_context *ev,
8338                                                         struct rpc_pipe_client *cli)
8339 {
8340         struct tevent_req *req;
8341         struct rpccli_spoolss_AddPrintProvidor_state *state;
8342         struct tevent_req *subreq;
8343
8344         req = tevent_req_create(mem_ctx, &state,
8345                                 struct rpccli_spoolss_AddPrintProvidor_state);
8346         if (req == NULL) {
8347                 return NULL;
8348         }
8349         state->out_mem_ctx = NULL;
8350         state->dispatch_recv = cli->dispatch_recv;
8351
8352         /* In parameters */
8353
8354         /* Out parameters */
8355
8356         /* Result */
8357         ZERO_STRUCT(state->orig.out.result);
8358
8359         if (DEBUGLEVEL >= 10) {
8360                 NDR_PRINT_IN_DEBUG(spoolss_AddPrintProvidor, &state->orig);
8361         }
8362
8363         /* make a temporary copy, that we pass to the dispatch function */
8364         state->tmp = state->orig;
8365
8366         subreq = cli->dispatch_send(state, ev, cli,
8367                                     &ndr_table_spoolss,
8368                                     NDR_SPOOLSS_ADDPRINTPROVIDOR,
8369                                     &state->tmp);
8370         if (tevent_req_nomem(subreq, req)) {
8371                 return tevent_req_post(req, ev);
8372         }
8373         tevent_req_set_callback(subreq, rpccli_spoolss_AddPrintProvidor_done, req);
8374         return req;
8375 }
8376
8377 static void rpccli_spoolss_AddPrintProvidor_done(struct tevent_req *subreq)
8378 {
8379         struct tevent_req *req = tevent_req_callback_data(
8380                 subreq, struct tevent_req);
8381         struct rpccli_spoolss_AddPrintProvidor_state *state = tevent_req_data(
8382                 req, struct rpccli_spoolss_AddPrintProvidor_state);
8383         NTSTATUS status;
8384         TALLOC_CTX *mem_ctx;
8385
8386         if (state->out_mem_ctx) {
8387                 mem_ctx = state->out_mem_ctx;
8388         } else {
8389                 mem_ctx = state;
8390         }
8391
8392         status = state->dispatch_recv(subreq, mem_ctx);
8393         TALLOC_FREE(subreq);
8394         if (!NT_STATUS_IS_OK(status)) {
8395                 tevent_req_nterror(req, status);
8396                 return;
8397         }
8398
8399         /* Copy out parameters */
8400
8401         /* Copy result */
8402         state->orig.out.result = state->tmp.out.result;
8403
8404         /* Reset temporary structure */
8405         ZERO_STRUCT(state->tmp);
8406
8407         if (DEBUGLEVEL >= 10) {
8408                 NDR_PRINT_OUT_DEBUG(spoolss_AddPrintProvidor, &state->orig);
8409         }
8410
8411         tevent_req_done(req);
8412 }
8413
8414 NTSTATUS rpccli_spoolss_AddPrintProvidor_recv(struct tevent_req *req,
8415                                               TALLOC_CTX *mem_ctx,
8416                                               WERROR *result)
8417 {
8418         struct rpccli_spoolss_AddPrintProvidor_state *state = tevent_req_data(
8419                 req, struct rpccli_spoolss_AddPrintProvidor_state);
8420         NTSTATUS status;
8421
8422         if (tevent_req_is_nterror(req, &status)) {
8423                 tevent_req_received(req);
8424                 return status;
8425         }
8426
8427         /* Steal possbile out parameters to the callers context */
8428         talloc_steal(mem_ctx, state->out_mem_ctx);
8429
8430         /* Return result */
8431         *result = state->orig.out.result;
8432
8433         tevent_req_received(req);
8434         return NT_STATUS_OK;
8435 }
8436
8437 NTSTATUS rpccli_spoolss_AddPrintProvidor(struct rpc_pipe_client *cli,
8438                                          TALLOC_CTX *mem_ctx,
8439                                          WERROR *werror)
8440 {
8441         struct spoolss_AddPrintProvidor r;
8442         NTSTATUS status;
8443
8444         /* In parameters */
8445
8446         if (DEBUGLEVEL >= 10) {
8447                 NDR_PRINT_IN_DEBUG(spoolss_AddPrintProvidor, &r);
8448         }
8449
8450         status = cli->dispatch(cli,
8451                                 mem_ctx,
8452                                 &ndr_table_spoolss,
8453                                 NDR_SPOOLSS_ADDPRINTPROVIDOR,
8454                                 &r);
8455
8456         if (!NT_STATUS_IS_OK(status)) {
8457                 return status;
8458         }
8459
8460         if (DEBUGLEVEL >= 10) {
8461                 NDR_PRINT_OUT_DEBUG(spoolss_AddPrintProvidor, &r);
8462         }
8463
8464         if (NT_STATUS_IS_ERR(status)) {
8465                 return status;
8466         }
8467
8468         /* Return variables */
8469
8470         /* Return result */
8471         if (werror) {
8472                 *werror = r.out.result;
8473         }
8474
8475         return werror_to_ntstatus(r.out.result);
8476 }
8477
8478 struct rpccli_spoolss_DeletePrintProvidor_state {
8479         struct spoolss_DeletePrintProvidor orig;
8480         struct spoolss_DeletePrintProvidor tmp;
8481         TALLOC_CTX *out_mem_ctx;
8482         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
8483 };
8484
8485 static void rpccli_spoolss_DeletePrintProvidor_done(struct tevent_req *subreq);
8486
8487 struct tevent_req *rpccli_spoolss_DeletePrintProvidor_send(TALLOC_CTX *mem_ctx,
8488                                                            struct tevent_context *ev,
8489                                                            struct rpc_pipe_client *cli)
8490 {
8491         struct tevent_req *req;
8492         struct rpccli_spoolss_DeletePrintProvidor_state *state;
8493         struct tevent_req *subreq;
8494
8495         req = tevent_req_create(mem_ctx, &state,
8496                                 struct rpccli_spoolss_DeletePrintProvidor_state);
8497         if (req == NULL) {
8498                 return NULL;
8499         }
8500         state->out_mem_ctx = NULL;
8501         state->dispatch_recv = cli->dispatch_recv;
8502
8503         /* In parameters */
8504
8505         /* Out parameters */
8506
8507         /* Result */
8508         ZERO_STRUCT(state->orig.out.result);
8509
8510         if (DEBUGLEVEL >= 10) {
8511                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrintProvidor, &state->orig);
8512         }
8513
8514         /* make a temporary copy, that we pass to the dispatch function */
8515         state->tmp = state->orig;
8516
8517         subreq = cli->dispatch_send(state, ev, cli,
8518                                     &ndr_table_spoolss,
8519                                     NDR_SPOOLSS_DELETEPRINTPROVIDOR,
8520                                     &state->tmp);
8521         if (tevent_req_nomem(subreq, req)) {
8522                 return tevent_req_post(req, ev);
8523         }
8524         tevent_req_set_callback(subreq, rpccli_spoolss_DeletePrintProvidor_done, req);
8525         return req;
8526 }
8527
8528 static void rpccli_spoolss_DeletePrintProvidor_done(struct tevent_req *subreq)
8529 {
8530         struct tevent_req *req = tevent_req_callback_data(
8531                 subreq, struct tevent_req);
8532         struct rpccli_spoolss_DeletePrintProvidor_state *state = tevent_req_data(
8533                 req, struct rpccli_spoolss_DeletePrintProvidor_state);
8534         NTSTATUS status;
8535         TALLOC_CTX *mem_ctx;
8536
8537         if (state->out_mem_ctx) {
8538                 mem_ctx = state->out_mem_ctx;
8539         } else {
8540                 mem_ctx = state;
8541         }
8542
8543         status = state->dispatch_recv(subreq, mem_ctx);
8544         TALLOC_FREE(subreq);
8545         if (!NT_STATUS_IS_OK(status)) {
8546                 tevent_req_nterror(req, status);
8547                 return;
8548         }
8549
8550         /* Copy out parameters */
8551
8552         /* Copy result */
8553         state->orig.out.result = state->tmp.out.result;
8554
8555         /* Reset temporary structure */
8556         ZERO_STRUCT(state->tmp);
8557
8558         if (DEBUGLEVEL >= 10) {
8559                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrintProvidor, &state->orig);
8560         }
8561
8562         tevent_req_done(req);
8563 }
8564
8565 NTSTATUS rpccli_spoolss_DeletePrintProvidor_recv(struct tevent_req *req,
8566                                                  TALLOC_CTX *mem_ctx,
8567                                                  WERROR *result)
8568 {
8569         struct rpccli_spoolss_DeletePrintProvidor_state *state = tevent_req_data(
8570                 req, struct rpccli_spoolss_DeletePrintProvidor_state);
8571         NTSTATUS status;
8572
8573         if (tevent_req_is_nterror(req, &status)) {
8574                 tevent_req_received(req);
8575                 return status;
8576         }
8577
8578         /* Steal possbile out parameters to the callers context */
8579         talloc_steal(mem_ctx, state->out_mem_ctx);
8580
8581         /* Return result */
8582         *result = state->orig.out.result;
8583
8584         tevent_req_received(req);
8585         return NT_STATUS_OK;
8586 }
8587
8588 NTSTATUS rpccli_spoolss_DeletePrintProvidor(struct rpc_pipe_client *cli,
8589                                             TALLOC_CTX *mem_ctx,
8590                                             WERROR *werror)
8591 {
8592         struct spoolss_DeletePrintProvidor r;
8593         NTSTATUS status;
8594
8595         /* In parameters */
8596
8597         if (DEBUGLEVEL >= 10) {
8598                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrintProvidor, &r);
8599         }
8600
8601         status = cli->dispatch(cli,
8602                                 mem_ctx,
8603                                 &ndr_table_spoolss,
8604                                 NDR_SPOOLSS_DELETEPRINTPROVIDOR,
8605                                 &r);
8606
8607         if (!NT_STATUS_IS_OK(status)) {
8608                 return status;
8609         }
8610
8611         if (DEBUGLEVEL >= 10) {
8612                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrintProvidor, &r);
8613         }
8614
8615         if (NT_STATUS_IS_ERR(status)) {
8616                 return status;
8617         }
8618
8619         /* Return variables */
8620
8621         /* Return result */
8622         if (werror) {
8623                 *werror = r.out.result;
8624         }
8625
8626         return werror_to_ntstatus(r.out.result);
8627 }
8628
8629 struct rpccli_spoolss_EnumPrintProcDataTypes_state {
8630         struct spoolss_EnumPrintProcDataTypes orig;
8631         struct spoolss_EnumPrintProcDataTypes tmp;
8632         TALLOC_CTX *out_mem_ctx;
8633         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
8634 };
8635
8636 static void rpccli_spoolss_EnumPrintProcDataTypes_done(struct tevent_req *subreq);
8637
8638 struct tevent_req *rpccli_spoolss_EnumPrintProcDataTypes_send(TALLOC_CTX *mem_ctx,
8639                                                               struct tevent_context *ev,
8640                                                               struct rpc_pipe_client *cli,
8641                                                               const char *_servername /* [in] [unique,charset(UTF16)] */,
8642                                                               const char *_print_processor_name /* [in] [unique,charset(UTF16)] */,
8643                                                               uint32_t _level /* [in]  */,
8644                                                               DATA_BLOB *_buffer /* [in] [unique] */,
8645                                                               uint32_t _offered /* [in]  */,
8646                                                               uint32_t *_count /* [out] [ref] */,
8647                                                               union spoolss_PrintProcDataTypesInfo **_info /* [out] [ref,switch_is(level),size_is(,*count)] */,
8648                                                               uint32_t *_needed /* [out] [ref] */)
8649 {
8650         struct tevent_req *req;
8651         struct rpccli_spoolss_EnumPrintProcDataTypes_state *state;
8652         struct tevent_req *subreq;
8653
8654         req = tevent_req_create(mem_ctx, &state,
8655                                 struct rpccli_spoolss_EnumPrintProcDataTypes_state);
8656         if (req == NULL) {
8657                 return NULL;
8658         }
8659         state->out_mem_ctx = NULL;
8660         state->dispatch_recv = cli->dispatch_recv;
8661
8662         /* In parameters */
8663         state->orig.in.servername = _servername;
8664         state->orig.in.print_processor_name = _print_processor_name;
8665         state->orig.in.level = _level;
8666         state->orig.in.buffer = _buffer;
8667         state->orig.in.offered = _offered;
8668
8669         /* Out parameters */
8670         state->orig.out.count = _count;
8671         state->orig.out.info = _info;
8672         state->orig.out.needed = _needed;
8673
8674         /* Result */
8675         ZERO_STRUCT(state->orig.out.result);
8676
8677         if (DEBUGLEVEL >= 10) {
8678                 NDR_PRINT_IN_DEBUG(spoolss_EnumPrintProcDataTypes, &state->orig);
8679         }
8680
8681         state->out_mem_ctx = talloc_named_const(state, 0,
8682                              "rpccli_spoolss_EnumPrintProcDataTypes_out_memory");
8683         if (tevent_req_nomem(state->out_mem_ctx, req)) {
8684                 return tevent_req_post(req, ev);
8685         }
8686
8687         /* make a temporary copy, that we pass to the dispatch function */
8688         state->tmp = state->orig;
8689
8690         subreq = cli->dispatch_send(state, ev, cli,
8691                                     &ndr_table_spoolss,
8692                                     NDR_SPOOLSS_ENUMPRINTPROCDATATYPES,
8693                                     &state->tmp);
8694         if (tevent_req_nomem(subreq, req)) {
8695                 return tevent_req_post(req, ev);
8696         }
8697         tevent_req_set_callback(subreq, rpccli_spoolss_EnumPrintProcDataTypes_done, req);
8698         return req;
8699 }
8700
8701 static void rpccli_spoolss_EnumPrintProcDataTypes_done(struct tevent_req *subreq)
8702 {
8703         struct tevent_req *req = tevent_req_callback_data(
8704                 subreq, struct tevent_req);
8705         struct rpccli_spoolss_EnumPrintProcDataTypes_state *state = tevent_req_data(
8706                 req, struct rpccli_spoolss_EnumPrintProcDataTypes_state);
8707         NTSTATUS status;
8708         TALLOC_CTX *mem_ctx;
8709
8710         if (state->out_mem_ctx) {
8711                 mem_ctx = state->out_mem_ctx;
8712         } else {
8713                 mem_ctx = state;
8714         }
8715
8716         status = state->dispatch_recv(subreq, mem_ctx);
8717         TALLOC_FREE(subreq);
8718         if (!NT_STATUS_IS_OK(status)) {
8719                 tevent_req_nterror(req, status);
8720                 return;
8721         }
8722
8723         /* Copy out parameters */
8724         *state->orig.out.count = *state->tmp.out.count;
8725         *state->orig.out.info = *state->tmp.out.info;
8726         *state->orig.out.needed = *state->tmp.out.needed;
8727
8728         /* Copy result */
8729         state->orig.out.result = state->tmp.out.result;
8730
8731         /* Reset temporary structure */
8732         ZERO_STRUCT(state->tmp);
8733
8734         if (DEBUGLEVEL >= 10) {
8735                 NDR_PRINT_OUT_DEBUG(spoolss_EnumPrintProcDataTypes, &state->orig);
8736         }
8737
8738         tevent_req_done(req);
8739 }
8740
8741 NTSTATUS rpccli_spoolss_EnumPrintProcDataTypes_recv(struct tevent_req *req,
8742                                                     TALLOC_CTX *mem_ctx,
8743                                                     WERROR *result)
8744 {
8745         struct rpccli_spoolss_EnumPrintProcDataTypes_state *state = tevent_req_data(
8746                 req, struct rpccli_spoolss_EnumPrintProcDataTypes_state);
8747         NTSTATUS status;
8748
8749         if (tevent_req_is_nterror(req, &status)) {
8750                 tevent_req_received(req);
8751                 return status;
8752         }
8753
8754         /* Steal possbile out parameters to the callers context */
8755         talloc_steal(mem_ctx, state->out_mem_ctx);
8756
8757         /* Return result */
8758         *result = state->orig.out.result;
8759
8760         tevent_req_received(req);
8761         return NT_STATUS_OK;
8762 }
8763
8764 NTSTATUS rpccli_spoolss_EnumPrintProcDataTypes(struct rpc_pipe_client *cli,
8765                                                TALLOC_CTX *mem_ctx,
8766                                                const char *servername /* [in] [unique,charset(UTF16)] */,
8767                                                const char *print_processor_name /* [in] [unique,charset(UTF16)] */,
8768                                                uint32_t level /* [in]  */,
8769                                                DATA_BLOB *buffer /* [in] [unique] */,
8770                                                uint32_t offered /* [in]  */,
8771                                                uint32_t *count /* [out] [ref] */,
8772                                                union spoolss_PrintProcDataTypesInfo **info /* [out] [ref,switch_is(level),size_is(,*count)] */,
8773                                                uint32_t *needed /* [out] [ref] */,
8774                                                WERROR *werror)
8775 {
8776         struct spoolss_EnumPrintProcDataTypes r;
8777         NTSTATUS status;
8778
8779         /* In parameters */
8780         r.in.servername = servername;
8781         r.in.print_processor_name = print_processor_name;
8782         r.in.level = level;
8783         r.in.buffer = buffer;
8784         r.in.offered = offered;
8785
8786         if (DEBUGLEVEL >= 10) {
8787                 NDR_PRINT_IN_DEBUG(spoolss_EnumPrintProcDataTypes, &r);
8788         }
8789
8790         status = cli->dispatch(cli,
8791                                 mem_ctx,
8792                                 &ndr_table_spoolss,
8793                                 NDR_SPOOLSS_ENUMPRINTPROCDATATYPES,
8794                                 &r);
8795
8796         if (!NT_STATUS_IS_OK(status)) {
8797                 return status;
8798         }
8799
8800         if (DEBUGLEVEL >= 10) {
8801                 NDR_PRINT_OUT_DEBUG(spoolss_EnumPrintProcDataTypes, &r);
8802         }
8803
8804         if (NT_STATUS_IS_ERR(status)) {
8805                 return status;
8806         }
8807
8808         /* Return variables */
8809         *count = *r.out.count;
8810         *info = *r.out.info;
8811         *needed = *r.out.needed;
8812
8813         /* Return result */
8814         if (werror) {
8815                 *werror = r.out.result;
8816         }
8817
8818         return werror_to_ntstatus(r.out.result);
8819 }
8820
8821 struct rpccli_spoolss_ResetPrinter_state {
8822         struct spoolss_ResetPrinter orig;
8823         struct spoolss_ResetPrinter tmp;
8824         TALLOC_CTX *out_mem_ctx;
8825         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
8826 };
8827
8828 static void rpccli_spoolss_ResetPrinter_done(struct tevent_req *subreq);
8829
8830 struct tevent_req *rpccli_spoolss_ResetPrinter_send(TALLOC_CTX *mem_ctx,
8831                                                     struct tevent_context *ev,
8832                                                     struct rpc_pipe_client *cli,
8833                                                     struct policy_handle *_handle /* [in] [ref] */,
8834                                                     const char *_data_type /* [in] [unique,charset(UTF16)] */,
8835                                                     struct spoolss_DevmodeContainer *_devmode_ctr /* [in] [ref] */)
8836 {
8837         struct tevent_req *req;
8838         struct rpccli_spoolss_ResetPrinter_state *state;
8839         struct tevent_req *subreq;
8840
8841         req = tevent_req_create(mem_ctx, &state,
8842                                 struct rpccli_spoolss_ResetPrinter_state);
8843         if (req == NULL) {
8844                 return NULL;
8845         }
8846         state->out_mem_ctx = NULL;
8847         state->dispatch_recv = cli->dispatch_recv;
8848
8849         /* In parameters */
8850         state->orig.in.handle = _handle;
8851         state->orig.in.data_type = _data_type;
8852         state->orig.in.devmode_ctr = _devmode_ctr;
8853
8854         /* Out parameters */
8855
8856         /* Result */
8857         ZERO_STRUCT(state->orig.out.result);
8858
8859         if (DEBUGLEVEL >= 10) {
8860                 NDR_PRINT_IN_DEBUG(spoolss_ResetPrinter, &state->orig);
8861         }
8862
8863         /* make a temporary copy, that we pass to the dispatch function */
8864         state->tmp = state->orig;
8865
8866         subreq = cli->dispatch_send(state, ev, cli,
8867                                     &ndr_table_spoolss,
8868                                     NDR_SPOOLSS_RESETPRINTER,
8869                                     &state->tmp);
8870         if (tevent_req_nomem(subreq, req)) {
8871                 return tevent_req_post(req, ev);
8872         }
8873         tevent_req_set_callback(subreq, rpccli_spoolss_ResetPrinter_done, req);
8874         return req;
8875 }
8876
8877 static void rpccli_spoolss_ResetPrinter_done(struct tevent_req *subreq)
8878 {
8879         struct tevent_req *req = tevent_req_callback_data(
8880                 subreq, struct tevent_req);
8881         struct rpccli_spoolss_ResetPrinter_state *state = tevent_req_data(
8882                 req, struct rpccli_spoolss_ResetPrinter_state);
8883         NTSTATUS status;
8884         TALLOC_CTX *mem_ctx;
8885
8886         if (state->out_mem_ctx) {
8887                 mem_ctx = state->out_mem_ctx;
8888         } else {
8889                 mem_ctx = state;
8890         }
8891
8892         status = state->dispatch_recv(subreq, mem_ctx);
8893         TALLOC_FREE(subreq);
8894         if (!NT_STATUS_IS_OK(status)) {
8895                 tevent_req_nterror(req, status);
8896                 return;
8897         }
8898
8899         /* Copy out parameters */
8900
8901         /* Copy result */
8902         state->orig.out.result = state->tmp.out.result;
8903
8904         /* Reset temporary structure */
8905         ZERO_STRUCT(state->tmp);
8906
8907         if (DEBUGLEVEL >= 10) {
8908                 NDR_PRINT_OUT_DEBUG(spoolss_ResetPrinter, &state->orig);
8909         }
8910
8911         tevent_req_done(req);
8912 }
8913
8914 NTSTATUS rpccli_spoolss_ResetPrinter_recv(struct tevent_req *req,
8915                                           TALLOC_CTX *mem_ctx,
8916                                           WERROR *result)
8917 {
8918         struct rpccli_spoolss_ResetPrinter_state *state = tevent_req_data(
8919                 req, struct rpccli_spoolss_ResetPrinter_state);
8920         NTSTATUS status;
8921
8922         if (tevent_req_is_nterror(req, &status)) {
8923                 tevent_req_received(req);
8924                 return status;
8925         }
8926
8927         /* Steal possbile out parameters to the callers context */
8928         talloc_steal(mem_ctx, state->out_mem_ctx);
8929
8930         /* Return result */
8931         *result = state->orig.out.result;
8932
8933         tevent_req_received(req);
8934         return NT_STATUS_OK;
8935 }
8936
8937 NTSTATUS rpccli_spoolss_ResetPrinter(struct rpc_pipe_client *cli,
8938                                      TALLOC_CTX *mem_ctx,
8939                                      struct policy_handle *handle /* [in] [ref] */,
8940                                      const char *data_type /* [in] [unique,charset(UTF16)] */,
8941                                      struct spoolss_DevmodeContainer *devmode_ctr /* [in] [ref] */,
8942                                      WERROR *werror)
8943 {
8944         struct spoolss_ResetPrinter r;
8945         NTSTATUS status;
8946
8947         /* In parameters */
8948         r.in.handle = handle;
8949         r.in.data_type = data_type;
8950         r.in.devmode_ctr = devmode_ctr;
8951
8952         if (DEBUGLEVEL >= 10) {
8953                 NDR_PRINT_IN_DEBUG(spoolss_ResetPrinter, &r);
8954         }
8955
8956         status = cli->dispatch(cli,
8957                                 mem_ctx,
8958                                 &ndr_table_spoolss,
8959                                 NDR_SPOOLSS_RESETPRINTER,
8960                                 &r);
8961
8962         if (!NT_STATUS_IS_OK(status)) {
8963                 return status;
8964         }
8965
8966         if (DEBUGLEVEL >= 10) {
8967                 NDR_PRINT_OUT_DEBUG(spoolss_ResetPrinter, &r);
8968         }
8969
8970         if (NT_STATUS_IS_ERR(status)) {
8971                 return status;
8972         }
8973
8974         /* Return variables */
8975
8976         /* Return result */
8977         if (werror) {
8978                 *werror = r.out.result;
8979         }
8980
8981         return werror_to_ntstatus(r.out.result);
8982 }
8983
8984 struct rpccli_spoolss_GetPrinterDriver2_state {
8985         struct spoolss_GetPrinterDriver2 orig;
8986         struct spoolss_GetPrinterDriver2 tmp;
8987         TALLOC_CTX *out_mem_ctx;
8988         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
8989 };
8990
8991 static void rpccli_spoolss_GetPrinterDriver2_done(struct tevent_req *subreq);
8992
8993 struct tevent_req *rpccli_spoolss_GetPrinterDriver2_send(TALLOC_CTX *mem_ctx,
8994                                                          struct tevent_context *ev,
8995                                                          struct rpc_pipe_client *cli,
8996                                                          struct policy_handle *_handle /* [in] [ref] */,
8997                                                          const char *_architecture /* [in] [unique,charset(UTF16)] */,
8998                                                          uint32_t _level /* [in]  */,
8999                                                          DATA_BLOB *_buffer /* [in] [unique] */,
9000                                                          uint32_t _offered /* [in]  */,
9001                                                          uint32_t _client_major_version /* [in]  */,
9002                                                          uint32_t _client_minor_version /* [in]  */,
9003                                                          union spoolss_DriverInfo *_info /* [out] [unique,subcontext_size(offered),subcontext(4),switch_is(level)] */,
9004                                                          uint32_t *_needed /* [out] [ref] */,
9005                                                          uint32_t *_server_major_version /* [out] [ref] */,
9006                                                          uint32_t *_server_minor_version /* [out] [ref] */)
9007 {
9008         struct tevent_req *req;
9009         struct rpccli_spoolss_GetPrinterDriver2_state *state;
9010         struct tevent_req *subreq;
9011
9012         req = tevent_req_create(mem_ctx, &state,
9013                                 struct rpccli_spoolss_GetPrinterDriver2_state);
9014         if (req == NULL) {
9015                 return NULL;
9016         }
9017         state->out_mem_ctx = NULL;
9018         state->dispatch_recv = cli->dispatch_recv;
9019
9020         /* In parameters */
9021         state->orig.in.handle = _handle;
9022         state->orig.in.architecture = _architecture;
9023         state->orig.in.level = _level;
9024         state->orig.in.buffer = _buffer;
9025         state->orig.in.offered = _offered;
9026         state->orig.in.client_major_version = _client_major_version;
9027         state->orig.in.client_minor_version = _client_minor_version;
9028
9029         /* Out parameters */
9030         state->orig.out.info = _info;
9031         state->orig.out.needed = _needed;
9032         state->orig.out.server_major_version = _server_major_version;
9033         state->orig.out.server_minor_version = _server_minor_version;
9034
9035         /* Result */
9036         ZERO_STRUCT(state->orig.out.result);
9037
9038         if (DEBUGLEVEL >= 10) {
9039                 NDR_PRINT_IN_DEBUG(spoolss_GetPrinterDriver2, &state->orig);
9040         }
9041
9042         state->out_mem_ctx = talloc_named_const(state, 0,
9043                              "rpccli_spoolss_GetPrinterDriver2_out_memory");
9044         if (tevent_req_nomem(state->out_mem_ctx, req)) {
9045                 return tevent_req_post(req, ev);
9046         }
9047
9048         /* make a temporary copy, that we pass to the dispatch function */
9049         state->tmp = state->orig;
9050
9051         subreq = cli->dispatch_send(state, ev, cli,
9052                                     &ndr_table_spoolss,
9053                                     NDR_SPOOLSS_GETPRINTERDRIVER2,
9054                                     &state->tmp);
9055         if (tevent_req_nomem(subreq, req)) {
9056                 return tevent_req_post(req, ev);
9057         }
9058         tevent_req_set_callback(subreq, rpccli_spoolss_GetPrinterDriver2_done, req);
9059         return req;
9060 }
9061
9062 static void rpccli_spoolss_GetPrinterDriver2_done(struct tevent_req *subreq)
9063 {
9064         struct tevent_req *req = tevent_req_callback_data(
9065                 subreq, struct tevent_req);
9066         struct rpccli_spoolss_GetPrinterDriver2_state *state = tevent_req_data(
9067                 req, struct rpccli_spoolss_GetPrinterDriver2_state);
9068         NTSTATUS status;
9069         TALLOC_CTX *mem_ctx;
9070
9071         if (state->out_mem_ctx) {
9072                 mem_ctx = state->out_mem_ctx;
9073         } else {
9074                 mem_ctx = state;
9075         }
9076
9077         status = state->dispatch_recv(subreq, mem_ctx);
9078         TALLOC_FREE(subreq);
9079         if (!NT_STATUS_IS_OK(status)) {
9080                 tevent_req_nterror(req, status);
9081                 return;
9082         }
9083
9084         /* Copy out parameters */
9085         if (state->orig.out.info && state->tmp.out.info) {
9086                 *state->orig.out.info = *state->tmp.out.info;
9087         }
9088         *state->orig.out.needed = *state->tmp.out.needed;
9089         *state->orig.out.server_major_version = *state->tmp.out.server_major_version;
9090         *state->orig.out.server_minor_version = *state->tmp.out.server_minor_version;
9091
9092         /* Copy result */
9093         state->orig.out.result = state->tmp.out.result;
9094
9095         /* Reset temporary structure */
9096         ZERO_STRUCT(state->tmp);
9097
9098         if (DEBUGLEVEL >= 10) {
9099                 NDR_PRINT_OUT_DEBUG(spoolss_GetPrinterDriver2, &state->orig);
9100         }
9101
9102         tevent_req_done(req);
9103 }
9104
9105 NTSTATUS rpccli_spoolss_GetPrinterDriver2_recv(struct tevent_req *req,
9106                                                TALLOC_CTX *mem_ctx,
9107                                                WERROR *result)
9108 {
9109         struct rpccli_spoolss_GetPrinterDriver2_state *state = tevent_req_data(
9110                 req, struct rpccli_spoolss_GetPrinterDriver2_state);
9111         NTSTATUS status;
9112
9113         if (tevent_req_is_nterror(req, &status)) {
9114                 tevent_req_received(req);
9115                 return status;
9116         }
9117
9118         /* Steal possbile out parameters to the callers context */
9119         talloc_steal(mem_ctx, state->out_mem_ctx);
9120
9121         /* Return result */
9122         *result = state->orig.out.result;
9123
9124         tevent_req_received(req);
9125         return NT_STATUS_OK;
9126 }
9127
9128 NTSTATUS rpccli_spoolss_GetPrinterDriver2(struct rpc_pipe_client *cli,
9129                                           TALLOC_CTX *mem_ctx,
9130                                           struct policy_handle *handle /* [in] [ref] */,
9131                                           const char *architecture /* [in] [unique,charset(UTF16)] */,
9132                                           uint32_t level /* [in]  */,
9133                                           DATA_BLOB *buffer /* [in] [unique] */,
9134                                           uint32_t offered /* [in]  */,
9135                                           uint32_t client_major_version /* [in]  */,
9136                                           uint32_t client_minor_version /* [in]  */,
9137                                           union spoolss_DriverInfo *info /* [out] [unique,subcontext_size(offered),subcontext(4),switch_is(level)] */,
9138                                           uint32_t *needed /* [out] [ref] */,
9139                                           uint32_t *server_major_version /* [out] [ref] */,
9140                                           uint32_t *server_minor_version /* [out] [ref] */,
9141                                           WERROR *werror)
9142 {
9143         struct spoolss_GetPrinterDriver2 r;
9144         NTSTATUS status;
9145
9146         /* In parameters */
9147         r.in.handle = handle;
9148         r.in.architecture = architecture;
9149         r.in.level = level;
9150         r.in.buffer = buffer;
9151         r.in.offered = offered;
9152         r.in.client_major_version = client_major_version;
9153         r.in.client_minor_version = client_minor_version;
9154
9155         if (DEBUGLEVEL >= 10) {
9156                 NDR_PRINT_IN_DEBUG(spoolss_GetPrinterDriver2, &r);
9157         }
9158
9159         status = cli->dispatch(cli,
9160                                 mem_ctx,
9161                                 &ndr_table_spoolss,
9162                                 NDR_SPOOLSS_GETPRINTERDRIVER2,
9163                                 &r);
9164
9165         if (!NT_STATUS_IS_OK(status)) {
9166                 return status;
9167         }
9168
9169         if (DEBUGLEVEL >= 10) {
9170                 NDR_PRINT_OUT_DEBUG(spoolss_GetPrinterDriver2, &r);
9171         }
9172
9173         if (NT_STATUS_IS_ERR(status)) {
9174                 return status;
9175         }
9176
9177         /* Return variables */
9178         if (info && r.out.info) {
9179                 *info = *r.out.info;
9180         }
9181         *needed = *r.out.needed;
9182         *server_major_version = *r.out.server_major_version;
9183         *server_minor_version = *r.out.server_minor_version;
9184
9185         /* Return result */
9186         if (werror) {
9187                 *werror = r.out.result;
9188         }
9189
9190         return werror_to_ntstatus(r.out.result);
9191 }
9192
9193 struct rpccli_spoolss_FindFirstPrinterChangeNotification_state {
9194         struct spoolss_FindFirstPrinterChangeNotification orig;
9195         struct spoolss_FindFirstPrinterChangeNotification tmp;
9196         TALLOC_CTX *out_mem_ctx;
9197         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
9198 };
9199
9200 static void rpccli_spoolss_FindFirstPrinterChangeNotification_done(struct tevent_req *subreq);
9201
9202 struct tevent_req *rpccli_spoolss_FindFirstPrinterChangeNotification_send(TALLOC_CTX *mem_ctx,
9203                                                                           struct tevent_context *ev,
9204                                                                           struct rpc_pipe_client *cli)
9205 {
9206         struct tevent_req *req;
9207         struct rpccli_spoolss_FindFirstPrinterChangeNotification_state *state;
9208         struct tevent_req *subreq;
9209
9210         req = tevent_req_create(mem_ctx, &state,
9211                                 struct rpccli_spoolss_FindFirstPrinterChangeNotification_state);
9212         if (req == NULL) {
9213                 return NULL;
9214         }
9215         state->out_mem_ctx = NULL;
9216         state->dispatch_recv = cli->dispatch_recv;
9217
9218         /* In parameters */
9219
9220         /* Out parameters */
9221
9222         /* Result */
9223         ZERO_STRUCT(state->orig.out.result);
9224
9225         if (DEBUGLEVEL >= 10) {
9226                 NDR_PRINT_IN_DEBUG(spoolss_FindFirstPrinterChangeNotification, &state->orig);
9227         }
9228
9229         /* make a temporary copy, that we pass to the dispatch function */
9230         state->tmp = state->orig;
9231
9232         subreq = cli->dispatch_send(state, ev, cli,
9233                                     &ndr_table_spoolss,
9234                                     NDR_SPOOLSS_FINDFIRSTPRINTERCHANGENOTIFICATION,
9235                                     &state->tmp);
9236         if (tevent_req_nomem(subreq, req)) {
9237                 return tevent_req_post(req, ev);
9238         }
9239         tevent_req_set_callback(subreq, rpccli_spoolss_FindFirstPrinterChangeNotification_done, req);
9240         return req;
9241 }
9242
9243 static void rpccli_spoolss_FindFirstPrinterChangeNotification_done(struct tevent_req *subreq)
9244 {
9245         struct tevent_req *req = tevent_req_callback_data(
9246                 subreq, struct tevent_req);
9247         struct rpccli_spoolss_FindFirstPrinterChangeNotification_state *state = tevent_req_data(
9248                 req, struct rpccli_spoolss_FindFirstPrinterChangeNotification_state);
9249         NTSTATUS status;
9250         TALLOC_CTX *mem_ctx;
9251
9252         if (state->out_mem_ctx) {
9253                 mem_ctx = state->out_mem_ctx;
9254         } else {
9255                 mem_ctx = state;
9256         }
9257
9258         status = state->dispatch_recv(subreq, mem_ctx);
9259         TALLOC_FREE(subreq);
9260         if (!NT_STATUS_IS_OK(status)) {
9261                 tevent_req_nterror(req, status);
9262                 return;
9263         }
9264
9265         /* Copy out parameters */
9266
9267         /* Copy result */
9268         state->orig.out.result = state->tmp.out.result;
9269
9270         /* Reset temporary structure */
9271         ZERO_STRUCT(state->tmp);
9272
9273         if (DEBUGLEVEL >= 10) {
9274                 NDR_PRINT_OUT_DEBUG(spoolss_FindFirstPrinterChangeNotification, &state->orig);
9275         }
9276
9277         tevent_req_done(req);
9278 }
9279
9280 NTSTATUS rpccli_spoolss_FindFirstPrinterChangeNotification_recv(struct tevent_req *req,
9281                                                                 TALLOC_CTX *mem_ctx,
9282                                                                 WERROR *result)
9283 {
9284         struct rpccli_spoolss_FindFirstPrinterChangeNotification_state *state = tevent_req_data(
9285                 req, struct rpccli_spoolss_FindFirstPrinterChangeNotification_state);
9286         NTSTATUS status;
9287
9288         if (tevent_req_is_nterror(req, &status)) {
9289                 tevent_req_received(req);
9290                 return status;
9291         }
9292
9293         /* Steal possbile out parameters to the callers context */
9294         talloc_steal(mem_ctx, state->out_mem_ctx);
9295
9296         /* Return result */
9297         *result = state->orig.out.result;
9298
9299         tevent_req_received(req);
9300         return NT_STATUS_OK;
9301 }
9302
9303 NTSTATUS rpccli_spoolss_FindFirstPrinterChangeNotification(struct rpc_pipe_client *cli,
9304                                                            TALLOC_CTX *mem_ctx,
9305                                                            WERROR *werror)
9306 {
9307         struct spoolss_FindFirstPrinterChangeNotification r;
9308         NTSTATUS status;
9309
9310         /* In parameters */
9311
9312         if (DEBUGLEVEL >= 10) {
9313                 NDR_PRINT_IN_DEBUG(spoolss_FindFirstPrinterChangeNotification, &r);
9314         }
9315
9316         status = cli->dispatch(cli,
9317                                 mem_ctx,
9318                                 &ndr_table_spoolss,
9319                                 NDR_SPOOLSS_FINDFIRSTPRINTERCHANGENOTIFICATION,
9320                                 &r);
9321
9322         if (!NT_STATUS_IS_OK(status)) {
9323                 return status;
9324         }
9325
9326         if (DEBUGLEVEL >= 10) {
9327                 NDR_PRINT_OUT_DEBUG(spoolss_FindFirstPrinterChangeNotification, &r);
9328         }
9329
9330         if (NT_STATUS_IS_ERR(status)) {
9331                 return status;
9332         }
9333
9334         /* Return variables */
9335
9336         /* Return result */
9337         if (werror) {
9338                 *werror = r.out.result;
9339         }
9340
9341         return werror_to_ntstatus(r.out.result);
9342 }
9343
9344 struct rpccli_spoolss_FindNextPrinterChangeNotification_state {
9345         struct spoolss_FindNextPrinterChangeNotification orig;
9346         struct spoolss_FindNextPrinterChangeNotification tmp;
9347         TALLOC_CTX *out_mem_ctx;
9348         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
9349 };
9350
9351 static void rpccli_spoolss_FindNextPrinterChangeNotification_done(struct tevent_req *subreq);
9352
9353 struct tevent_req *rpccli_spoolss_FindNextPrinterChangeNotification_send(TALLOC_CTX *mem_ctx,
9354                                                                          struct tevent_context *ev,
9355                                                                          struct rpc_pipe_client *cli)
9356 {
9357         struct tevent_req *req;
9358         struct rpccli_spoolss_FindNextPrinterChangeNotification_state *state;
9359         struct tevent_req *subreq;
9360
9361         req = tevent_req_create(mem_ctx, &state,
9362                                 struct rpccli_spoolss_FindNextPrinterChangeNotification_state);
9363         if (req == NULL) {
9364                 return NULL;
9365         }
9366         state->out_mem_ctx = NULL;
9367         state->dispatch_recv = cli->dispatch_recv;
9368
9369         /* In parameters */
9370
9371         /* Out parameters */
9372
9373         /* Result */
9374         ZERO_STRUCT(state->orig.out.result);
9375
9376         if (DEBUGLEVEL >= 10) {
9377                 NDR_PRINT_IN_DEBUG(spoolss_FindNextPrinterChangeNotification, &state->orig);
9378         }
9379
9380         /* make a temporary copy, that we pass to the dispatch function */
9381         state->tmp = state->orig;
9382
9383         subreq = cli->dispatch_send(state, ev, cli,
9384                                     &ndr_table_spoolss,
9385                                     NDR_SPOOLSS_FINDNEXTPRINTERCHANGENOTIFICATION,
9386                                     &state->tmp);
9387         if (tevent_req_nomem(subreq, req)) {
9388                 return tevent_req_post(req, ev);
9389         }
9390         tevent_req_set_callback(subreq, rpccli_spoolss_FindNextPrinterChangeNotification_done, req);
9391         return req;
9392 }
9393
9394 static void rpccli_spoolss_FindNextPrinterChangeNotification_done(struct tevent_req *subreq)
9395 {
9396         struct tevent_req *req = tevent_req_callback_data(
9397                 subreq, struct tevent_req);
9398         struct rpccli_spoolss_FindNextPrinterChangeNotification_state *state = tevent_req_data(
9399                 req, struct rpccli_spoolss_FindNextPrinterChangeNotification_state);
9400         NTSTATUS status;
9401         TALLOC_CTX *mem_ctx;
9402
9403         if (state->out_mem_ctx) {
9404                 mem_ctx = state->out_mem_ctx;
9405         } else {
9406                 mem_ctx = state;
9407         }
9408
9409         status = state->dispatch_recv(subreq, mem_ctx);
9410         TALLOC_FREE(subreq);
9411         if (!NT_STATUS_IS_OK(status)) {
9412                 tevent_req_nterror(req, status);
9413                 return;
9414         }
9415
9416         /* Copy out parameters */
9417
9418         /* Copy result */
9419         state->orig.out.result = state->tmp.out.result;
9420
9421         /* Reset temporary structure */
9422         ZERO_STRUCT(state->tmp);
9423
9424         if (DEBUGLEVEL >= 10) {
9425                 NDR_PRINT_OUT_DEBUG(spoolss_FindNextPrinterChangeNotification, &state->orig);
9426         }
9427
9428         tevent_req_done(req);
9429 }
9430
9431 NTSTATUS rpccli_spoolss_FindNextPrinterChangeNotification_recv(struct tevent_req *req,
9432                                                                TALLOC_CTX *mem_ctx,
9433                                                                WERROR *result)
9434 {
9435         struct rpccli_spoolss_FindNextPrinterChangeNotification_state *state = tevent_req_data(
9436                 req, struct rpccli_spoolss_FindNextPrinterChangeNotification_state);
9437         NTSTATUS status;
9438
9439         if (tevent_req_is_nterror(req, &status)) {
9440                 tevent_req_received(req);
9441                 return status;
9442         }
9443
9444         /* Steal possbile out parameters to the callers context */
9445         talloc_steal(mem_ctx, state->out_mem_ctx);
9446
9447         /* Return result */
9448         *result = state->orig.out.result;
9449
9450         tevent_req_received(req);
9451         return NT_STATUS_OK;
9452 }
9453
9454 NTSTATUS rpccli_spoolss_FindNextPrinterChangeNotification(struct rpc_pipe_client *cli,
9455                                                           TALLOC_CTX *mem_ctx,
9456                                                           WERROR *werror)
9457 {
9458         struct spoolss_FindNextPrinterChangeNotification r;
9459         NTSTATUS status;
9460
9461         /* In parameters */
9462
9463         if (DEBUGLEVEL >= 10) {
9464                 NDR_PRINT_IN_DEBUG(spoolss_FindNextPrinterChangeNotification, &r);
9465         }
9466
9467         status = cli->dispatch(cli,
9468                                 mem_ctx,
9469                                 &ndr_table_spoolss,
9470                                 NDR_SPOOLSS_FINDNEXTPRINTERCHANGENOTIFICATION,
9471                                 &r);
9472
9473         if (!NT_STATUS_IS_OK(status)) {
9474                 return status;
9475         }
9476
9477         if (DEBUGLEVEL >= 10) {
9478                 NDR_PRINT_OUT_DEBUG(spoolss_FindNextPrinterChangeNotification, &r);
9479         }
9480
9481         if (NT_STATUS_IS_ERR(status)) {
9482                 return status;
9483         }
9484
9485         /* Return variables */
9486
9487         /* Return result */
9488         if (werror) {
9489                 *werror = r.out.result;
9490         }
9491
9492         return werror_to_ntstatus(r.out.result);
9493 }
9494
9495 struct rpccli_spoolss_FindClosePrinterNotify_state {
9496         struct spoolss_FindClosePrinterNotify orig;
9497         struct spoolss_FindClosePrinterNotify tmp;
9498         TALLOC_CTX *out_mem_ctx;
9499         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
9500 };
9501
9502 static void rpccli_spoolss_FindClosePrinterNotify_done(struct tevent_req *subreq);
9503
9504 struct tevent_req *rpccli_spoolss_FindClosePrinterNotify_send(TALLOC_CTX *mem_ctx,
9505                                                               struct tevent_context *ev,
9506                                                               struct rpc_pipe_client *cli,
9507                                                               struct policy_handle *_handle /* [in] [ref] */)
9508 {
9509         struct tevent_req *req;
9510         struct rpccli_spoolss_FindClosePrinterNotify_state *state;
9511         struct tevent_req *subreq;
9512
9513         req = tevent_req_create(mem_ctx, &state,
9514                                 struct rpccli_spoolss_FindClosePrinterNotify_state);
9515         if (req == NULL) {
9516                 return NULL;
9517         }
9518         state->out_mem_ctx = NULL;
9519         state->dispatch_recv = cli->dispatch_recv;
9520
9521         /* In parameters */
9522         state->orig.in.handle = _handle;
9523
9524         /* Out parameters */
9525
9526         /* Result */
9527         ZERO_STRUCT(state->orig.out.result);
9528
9529         if (DEBUGLEVEL >= 10) {
9530                 NDR_PRINT_IN_DEBUG(spoolss_FindClosePrinterNotify, &state->orig);
9531         }
9532
9533         /* make a temporary copy, that we pass to the dispatch function */
9534         state->tmp = state->orig;
9535
9536         subreq = cli->dispatch_send(state, ev, cli,
9537                                     &ndr_table_spoolss,
9538                                     NDR_SPOOLSS_FINDCLOSEPRINTERNOTIFY,
9539                                     &state->tmp);
9540         if (tevent_req_nomem(subreq, req)) {
9541                 return tevent_req_post(req, ev);
9542         }
9543         tevent_req_set_callback(subreq, rpccli_spoolss_FindClosePrinterNotify_done, req);
9544         return req;
9545 }
9546
9547 static void rpccli_spoolss_FindClosePrinterNotify_done(struct tevent_req *subreq)
9548 {
9549         struct tevent_req *req = tevent_req_callback_data(
9550                 subreq, struct tevent_req);
9551         struct rpccli_spoolss_FindClosePrinterNotify_state *state = tevent_req_data(
9552                 req, struct rpccli_spoolss_FindClosePrinterNotify_state);
9553         NTSTATUS status;
9554         TALLOC_CTX *mem_ctx;
9555
9556         if (state->out_mem_ctx) {
9557                 mem_ctx = state->out_mem_ctx;
9558         } else {
9559                 mem_ctx = state;
9560         }
9561
9562         status = state->dispatch_recv(subreq, mem_ctx);
9563         TALLOC_FREE(subreq);
9564         if (!NT_STATUS_IS_OK(status)) {
9565                 tevent_req_nterror(req, status);
9566                 return;
9567         }
9568
9569         /* Copy out parameters */
9570
9571         /* Copy result */
9572         state->orig.out.result = state->tmp.out.result;
9573
9574         /* Reset temporary structure */
9575         ZERO_STRUCT(state->tmp);
9576
9577         if (DEBUGLEVEL >= 10) {
9578                 NDR_PRINT_OUT_DEBUG(spoolss_FindClosePrinterNotify, &state->orig);
9579         }
9580
9581         tevent_req_done(req);
9582 }
9583
9584 NTSTATUS rpccli_spoolss_FindClosePrinterNotify_recv(struct tevent_req *req,
9585                                                     TALLOC_CTX *mem_ctx,
9586                                                     WERROR *result)
9587 {
9588         struct rpccli_spoolss_FindClosePrinterNotify_state *state = tevent_req_data(
9589                 req, struct rpccli_spoolss_FindClosePrinterNotify_state);
9590         NTSTATUS status;
9591
9592         if (tevent_req_is_nterror(req, &status)) {
9593                 tevent_req_received(req);
9594                 return status;
9595         }
9596
9597         /* Steal possbile out parameters to the callers context */
9598         talloc_steal(mem_ctx, state->out_mem_ctx);
9599
9600         /* Return result */
9601         *result = state->orig.out.result;
9602
9603         tevent_req_received(req);
9604         return NT_STATUS_OK;
9605 }
9606
9607 NTSTATUS rpccli_spoolss_FindClosePrinterNotify(struct rpc_pipe_client *cli,
9608                                                TALLOC_CTX *mem_ctx,
9609                                                struct policy_handle *handle /* [in] [ref] */,
9610                                                WERROR *werror)
9611 {
9612         struct spoolss_FindClosePrinterNotify r;
9613         NTSTATUS status;
9614
9615         /* In parameters */
9616         r.in.handle = handle;
9617
9618         if (DEBUGLEVEL >= 10) {
9619                 NDR_PRINT_IN_DEBUG(spoolss_FindClosePrinterNotify, &r);
9620         }
9621
9622         status = cli->dispatch(cli,
9623                                 mem_ctx,
9624                                 &ndr_table_spoolss,
9625                                 NDR_SPOOLSS_FINDCLOSEPRINTERNOTIFY,
9626                                 &r);
9627
9628         if (!NT_STATUS_IS_OK(status)) {
9629                 return status;
9630         }
9631
9632         if (DEBUGLEVEL >= 10) {
9633                 NDR_PRINT_OUT_DEBUG(spoolss_FindClosePrinterNotify, &r);
9634         }
9635
9636         if (NT_STATUS_IS_ERR(status)) {
9637                 return status;
9638         }
9639
9640         /* Return variables */
9641
9642         /* Return result */
9643         if (werror) {
9644                 *werror = r.out.result;
9645         }
9646
9647         return werror_to_ntstatus(r.out.result);
9648 }
9649
9650 struct rpccli_spoolss_RouterFindFirstPrinterChangeNotificationOld_state {
9651         struct spoolss_RouterFindFirstPrinterChangeNotificationOld orig;
9652         struct spoolss_RouterFindFirstPrinterChangeNotificationOld tmp;
9653         TALLOC_CTX *out_mem_ctx;
9654         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
9655 };
9656
9657 static void rpccli_spoolss_RouterFindFirstPrinterChangeNotificationOld_done(struct tevent_req *subreq);
9658
9659 struct tevent_req *rpccli_spoolss_RouterFindFirstPrinterChangeNotificationOld_send(TALLOC_CTX *mem_ctx,
9660                                                                                    struct tevent_context *ev,
9661                                                                                    struct rpc_pipe_client *cli)
9662 {
9663         struct tevent_req *req;
9664         struct rpccli_spoolss_RouterFindFirstPrinterChangeNotificationOld_state *state;
9665         struct tevent_req *subreq;
9666
9667         req = tevent_req_create(mem_ctx, &state,
9668                                 struct rpccli_spoolss_RouterFindFirstPrinterChangeNotificationOld_state);
9669         if (req == NULL) {
9670                 return NULL;
9671         }
9672         state->out_mem_ctx = NULL;
9673         state->dispatch_recv = cli->dispatch_recv;
9674
9675         /* In parameters */
9676
9677         /* Out parameters */
9678
9679         /* Result */
9680         ZERO_STRUCT(state->orig.out.result);
9681
9682         if (DEBUGLEVEL >= 10) {
9683                 NDR_PRINT_IN_DEBUG(spoolss_RouterFindFirstPrinterChangeNotificationOld, &state->orig);
9684         }
9685
9686         /* make a temporary copy, that we pass to the dispatch function */
9687         state->tmp = state->orig;
9688
9689         subreq = cli->dispatch_send(state, ev, cli,
9690                                     &ndr_table_spoolss,
9691                                     NDR_SPOOLSS_ROUTERFINDFIRSTPRINTERCHANGENOTIFICATIONOLD,
9692                                     &state->tmp);
9693         if (tevent_req_nomem(subreq, req)) {
9694                 return tevent_req_post(req, ev);
9695         }
9696         tevent_req_set_callback(subreq, rpccli_spoolss_RouterFindFirstPrinterChangeNotificationOld_done, req);
9697         return req;
9698 }
9699
9700 static void rpccli_spoolss_RouterFindFirstPrinterChangeNotificationOld_done(struct tevent_req *subreq)
9701 {
9702         struct tevent_req *req = tevent_req_callback_data(
9703                 subreq, struct tevent_req);
9704         struct rpccli_spoolss_RouterFindFirstPrinterChangeNotificationOld_state *state = tevent_req_data(
9705                 req, struct rpccli_spoolss_RouterFindFirstPrinterChangeNotificationOld_state);
9706         NTSTATUS status;
9707         TALLOC_CTX *mem_ctx;
9708
9709         if (state->out_mem_ctx) {
9710                 mem_ctx = state->out_mem_ctx;
9711         } else {
9712                 mem_ctx = state;
9713         }
9714
9715         status = state->dispatch_recv(subreq, mem_ctx);
9716         TALLOC_FREE(subreq);
9717         if (!NT_STATUS_IS_OK(status)) {
9718                 tevent_req_nterror(req, status);
9719                 return;
9720         }
9721
9722         /* Copy out parameters */
9723
9724         /* Copy result */
9725         state->orig.out.result = state->tmp.out.result;
9726
9727         /* Reset temporary structure */
9728         ZERO_STRUCT(state->tmp);
9729
9730         if (DEBUGLEVEL >= 10) {
9731                 NDR_PRINT_OUT_DEBUG(spoolss_RouterFindFirstPrinterChangeNotificationOld, &state->orig);
9732         }
9733
9734         tevent_req_done(req);
9735 }
9736
9737 NTSTATUS rpccli_spoolss_RouterFindFirstPrinterChangeNotificationOld_recv(struct tevent_req *req,
9738                                                                          TALLOC_CTX *mem_ctx,
9739                                                                          WERROR *result)
9740 {
9741         struct rpccli_spoolss_RouterFindFirstPrinterChangeNotificationOld_state *state = tevent_req_data(
9742                 req, struct rpccli_spoolss_RouterFindFirstPrinterChangeNotificationOld_state);
9743         NTSTATUS status;
9744
9745         if (tevent_req_is_nterror(req, &status)) {
9746                 tevent_req_received(req);
9747                 return status;
9748         }
9749
9750         /* Steal possbile out parameters to the callers context */
9751         talloc_steal(mem_ctx, state->out_mem_ctx);
9752
9753         /* Return result */
9754         *result = state->orig.out.result;
9755
9756         tevent_req_received(req);
9757         return NT_STATUS_OK;
9758 }
9759
9760 NTSTATUS rpccli_spoolss_RouterFindFirstPrinterChangeNotificationOld(struct rpc_pipe_client *cli,
9761                                                                     TALLOC_CTX *mem_ctx,
9762                                                                     WERROR *werror)
9763 {
9764         struct spoolss_RouterFindFirstPrinterChangeNotificationOld r;
9765         NTSTATUS status;
9766
9767         /* In parameters */
9768
9769         if (DEBUGLEVEL >= 10) {
9770                 NDR_PRINT_IN_DEBUG(spoolss_RouterFindFirstPrinterChangeNotificationOld, &r);
9771         }
9772
9773         status = cli->dispatch(cli,
9774                                 mem_ctx,
9775                                 &ndr_table_spoolss,
9776                                 NDR_SPOOLSS_ROUTERFINDFIRSTPRINTERCHANGENOTIFICATIONOLD,
9777                                 &r);
9778
9779         if (!NT_STATUS_IS_OK(status)) {
9780                 return status;
9781         }
9782
9783         if (DEBUGLEVEL >= 10) {
9784                 NDR_PRINT_OUT_DEBUG(spoolss_RouterFindFirstPrinterChangeNotificationOld, &r);
9785         }
9786
9787         if (NT_STATUS_IS_ERR(status)) {
9788                 return status;
9789         }
9790
9791         /* Return variables */
9792
9793         /* Return result */
9794         if (werror) {
9795                 *werror = r.out.result;
9796         }
9797
9798         return werror_to_ntstatus(r.out.result);
9799 }
9800
9801 struct rpccli_spoolss_ReplyOpenPrinter_state {
9802         struct spoolss_ReplyOpenPrinter orig;
9803         struct spoolss_ReplyOpenPrinter tmp;
9804         TALLOC_CTX *out_mem_ctx;
9805         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
9806 };
9807
9808 static void rpccli_spoolss_ReplyOpenPrinter_done(struct tevent_req *subreq);
9809
9810 struct tevent_req *rpccli_spoolss_ReplyOpenPrinter_send(TALLOC_CTX *mem_ctx,
9811                                                         struct tevent_context *ev,
9812                                                         struct rpc_pipe_client *cli,
9813                                                         const char *_server_name /* [in] [charset(UTF16)] */,
9814                                                         uint32_t _printer_local /* [in]  */,
9815                                                         enum winreg_Type _type /* [in]  */,
9816                                                         uint32_t _bufsize /* [in] [range(0,512)] */,
9817                                                         uint8_t *_buffer /* [in] [unique,size_is(bufsize)] */,
9818                                                         struct policy_handle *_handle /* [out] [ref] */)
9819 {
9820         struct tevent_req *req;
9821         struct rpccli_spoolss_ReplyOpenPrinter_state *state;
9822         struct tevent_req *subreq;
9823
9824         req = tevent_req_create(mem_ctx, &state,
9825                                 struct rpccli_spoolss_ReplyOpenPrinter_state);
9826         if (req == NULL) {
9827                 return NULL;
9828         }
9829         state->out_mem_ctx = NULL;
9830         state->dispatch_recv = cli->dispatch_recv;
9831
9832         /* In parameters */
9833         state->orig.in.server_name = _server_name;
9834         state->orig.in.printer_local = _printer_local;
9835         state->orig.in.type = _type;
9836         state->orig.in.bufsize = _bufsize;
9837         state->orig.in.buffer = _buffer;
9838
9839         /* Out parameters */
9840         state->orig.out.handle = _handle;
9841
9842         /* Result */
9843         ZERO_STRUCT(state->orig.out.result);
9844
9845         if (DEBUGLEVEL >= 10) {
9846                 NDR_PRINT_IN_DEBUG(spoolss_ReplyOpenPrinter, &state->orig);
9847         }
9848
9849         state->out_mem_ctx = talloc_named_const(state, 0,
9850                              "rpccli_spoolss_ReplyOpenPrinter_out_memory");
9851         if (tevent_req_nomem(state->out_mem_ctx, req)) {
9852                 return tevent_req_post(req, ev);
9853         }
9854
9855         /* make a temporary copy, that we pass to the dispatch function */
9856         state->tmp = state->orig;
9857
9858         subreq = cli->dispatch_send(state, ev, cli,
9859                                     &ndr_table_spoolss,
9860                                     NDR_SPOOLSS_REPLYOPENPRINTER,
9861                                     &state->tmp);
9862         if (tevent_req_nomem(subreq, req)) {
9863                 return tevent_req_post(req, ev);
9864         }
9865         tevent_req_set_callback(subreq, rpccli_spoolss_ReplyOpenPrinter_done, req);
9866         return req;
9867 }
9868
9869 static void rpccli_spoolss_ReplyOpenPrinter_done(struct tevent_req *subreq)
9870 {
9871         struct tevent_req *req = tevent_req_callback_data(
9872                 subreq, struct tevent_req);
9873         struct rpccli_spoolss_ReplyOpenPrinter_state *state = tevent_req_data(
9874                 req, struct rpccli_spoolss_ReplyOpenPrinter_state);
9875         NTSTATUS status;
9876         TALLOC_CTX *mem_ctx;
9877
9878         if (state->out_mem_ctx) {
9879                 mem_ctx = state->out_mem_ctx;
9880         } else {
9881                 mem_ctx = state;
9882         }
9883
9884         status = state->dispatch_recv(subreq, mem_ctx);
9885         TALLOC_FREE(subreq);
9886         if (!NT_STATUS_IS_OK(status)) {
9887                 tevent_req_nterror(req, status);
9888                 return;
9889         }
9890
9891         /* Copy out parameters */
9892         *state->orig.out.handle = *state->tmp.out.handle;
9893
9894         /* Copy result */
9895         state->orig.out.result = state->tmp.out.result;
9896
9897         /* Reset temporary structure */
9898         ZERO_STRUCT(state->tmp);
9899
9900         if (DEBUGLEVEL >= 10) {
9901                 NDR_PRINT_OUT_DEBUG(spoolss_ReplyOpenPrinter, &state->orig);
9902         }
9903
9904         tevent_req_done(req);
9905 }
9906
9907 NTSTATUS rpccli_spoolss_ReplyOpenPrinter_recv(struct tevent_req *req,
9908                                               TALLOC_CTX *mem_ctx,
9909                                               WERROR *result)
9910 {
9911         struct rpccli_spoolss_ReplyOpenPrinter_state *state = tevent_req_data(
9912                 req, struct rpccli_spoolss_ReplyOpenPrinter_state);
9913         NTSTATUS status;
9914
9915         if (tevent_req_is_nterror(req, &status)) {
9916                 tevent_req_received(req);
9917                 return status;
9918         }
9919
9920         /* Steal possbile out parameters to the callers context */
9921         talloc_steal(mem_ctx, state->out_mem_ctx);
9922
9923         /* Return result */
9924         *result = state->orig.out.result;
9925
9926         tevent_req_received(req);
9927         return NT_STATUS_OK;
9928 }
9929
9930 NTSTATUS rpccli_spoolss_ReplyOpenPrinter(struct rpc_pipe_client *cli,
9931                                          TALLOC_CTX *mem_ctx,
9932                                          const char *server_name /* [in] [charset(UTF16)] */,
9933                                          uint32_t printer_local /* [in]  */,
9934                                          enum winreg_Type type /* [in]  */,
9935                                          uint32_t bufsize /* [in] [range(0,512)] */,
9936                                          uint8_t *buffer /* [in] [unique,size_is(bufsize)] */,
9937                                          struct policy_handle *handle /* [out] [ref] */,
9938                                          WERROR *werror)
9939 {
9940         struct spoolss_ReplyOpenPrinter r;
9941         NTSTATUS status;
9942
9943         /* In parameters */
9944         r.in.server_name = server_name;
9945         r.in.printer_local = printer_local;
9946         r.in.type = type;
9947         r.in.bufsize = bufsize;
9948         r.in.buffer = buffer;
9949
9950         if (DEBUGLEVEL >= 10) {
9951                 NDR_PRINT_IN_DEBUG(spoolss_ReplyOpenPrinter, &r);
9952         }
9953
9954         status = cli->dispatch(cli,
9955                                 mem_ctx,
9956                                 &ndr_table_spoolss,
9957                                 NDR_SPOOLSS_REPLYOPENPRINTER,
9958                                 &r);
9959
9960         if (!NT_STATUS_IS_OK(status)) {
9961                 return status;
9962         }
9963
9964         if (DEBUGLEVEL >= 10) {
9965                 NDR_PRINT_OUT_DEBUG(spoolss_ReplyOpenPrinter, &r);
9966         }
9967
9968         if (NT_STATUS_IS_ERR(status)) {
9969                 return status;
9970         }
9971
9972         /* Return variables */
9973         *handle = *r.out.handle;
9974
9975         /* Return result */
9976         if (werror) {
9977                 *werror = r.out.result;
9978         }
9979
9980         return werror_to_ntstatus(r.out.result);
9981 }
9982
9983 struct rpccli_spoolss_RouterReplyPrinter_state {
9984         struct spoolss_RouterReplyPrinter orig;
9985         struct spoolss_RouterReplyPrinter tmp;
9986         TALLOC_CTX *out_mem_ctx;
9987         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
9988 };
9989
9990 static void rpccli_spoolss_RouterReplyPrinter_done(struct tevent_req *subreq);
9991
9992 struct tevent_req *rpccli_spoolss_RouterReplyPrinter_send(TALLOC_CTX *mem_ctx,
9993                                                           struct tevent_context *ev,
9994                                                           struct rpc_pipe_client *cli,
9995                                                           struct policy_handle *_handle /* [in] [ref] */,
9996                                                           uint32_t _flags /* [in]  */,
9997                                                           uint32_t _bufsize /* [in] [range(0,512)] */,
9998                                                           uint8_t *_buffer /* [in] [unique,size_is(bufsize)] */)
9999 {
10000         struct tevent_req *req;
10001         struct rpccli_spoolss_RouterReplyPrinter_state *state;
10002         struct tevent_req *subreq;
10003
10004         req = tevent_req_create(mem_ctx, &state,
10005                                 struct rpccli_spoolss_RouterReplyPrinter_state);
10006         if (req == NULL) {
10007                 return NULL;
10008         }
10009         state->out_mem_ctx = NULL;
10010         state->dispatch_recv = cli->dispatch_recv;
10011
10012         /* In parameters */
10013         state->orig.in.handle = _handle;
10014         state->orig.in.flags = _flags;
10015         state->orig.in.bufsize = _bufsize;
10016         state->orig.in.buffer = _buffer;
10017
10018         /* Out parameters */
10019
10020         /* Result */
10021         ZERO_STRUCT(state->orig.out.result);
10022
10023         if (DEBUGLEVEL >= 10) {
10024                 NDR_PRINT_IN_DEBUG(spoolss_RouterReplyPrinter, &state->orig);
10025         }
10026
10027         /* make a temporary copy, that we pass to the dispatch function */
10028         state->tmp = state->orig;
10029
10030         subreq = cli->dispatch_send(state, ev, cli,
10031                                     &ndr_table_spoolss,
10032                                     NDR_SPOOLSS_ROUTERREPLYPRINTER,
10033                                     &state->tmp);
10034         if (tevent_req_nomem(subreq, req)) {
10035                 return tevent_req_post(req, ev);
10036         }
10037         tevent_req_set_callback(subreq, rpccli_spoolss_RouterReplyPrinter_done, req);
10038         return req;
10039 }
10040
10041 static void rpccli_spoolss_RouterReplyPrinter_done(struct tevent_req *subreq)
10042 {
10043         struct tevent_req *req = tevent_req_callback_data(
10044                 subreq, struct tevent_req);
10045         struct rpccli_spoolss_RouterReplyPrinter_state *state = tevent_req_data(
10046                 req, struct rpccli_spoolss_RouterReplyPrinter_state);
10047         NTSTATUS status;
10048         TALLOC_CTX *mem_ctx;
10049
10050         if (state->out_mem_ctx) {
10051                 mem_ctx = state->out_mem_ctx;
10052         } else {
10053                 mem_ctx = state;
10054         }
10055
10056         status = state->dispatch_recv(subreq, mem_ctx);
10057         TALLOC_FREE(subreq);
10058         if (!NT_STATUS_IS_OK(status)) {
10059                 tevent_req_nterror(req, status);
10060                 return;
10061         }
10062
10063         /* Copy out parameters */
10064
10065         /* Copy result */
10066         state->orig.out.result = state->tmp.out.result;
10067
10068         /* Reset temporary structure */
10069         ZERO_STRUCT(state->tmp);
10070
10071         if (DEBUGLEVEL >= 10) {
10072                 NDR_PRINT_OUT_DEBUG(spoolss_RouterReplyPrinter, &state->orig);
10073         }
10074
10075         tevent_req_done(req);
10076 }
10077
10078 NTSTATUS rpccli_spoolss_RouterReplyPrinter_recv(struct tevent_req *req,
10079                                                 TALLOC_CTX *mem_ctx,
10080                                                 WERROR *result)
10081 {
10082         struct rpccli_spoolss_RouterReplyPrinter_state *state = tevent_req_data(
10083                 req, struct rpccli_spoolss_RouterReplyPrinter_state);
10084         NTSTATUS status;
10085
10086         if (tevent_req_is_nterror(req, &status)) {
10087                 tevent_req_received(req);
10088                 return status;
10089         }
10090
10091         /* Steal possbile out parameters to the callers context */
10092         talloc_steal(mem_ctx, state->out_mem_ctx);
10093
10094         /* Return result */
10095         *result = state->orig.out.result;
10096
10097         tevent_req_received(req);
10098         return NT_STATUS_OK;
10099 }
10100
10101 NTSTATUS rpccli_spoolss_RouterReplyPrinter(struct rpc_pipe_client *cli,
10102                                            TALLOC_CTX *mem_ctx,
10103                                            struct policy_handle *handle /* [in] [ref] */,
10104                                            uint32_t flags /* [in]  */,
10105                                            uint32_t bufsize /* [in] [range(0,512)] */,
10106                                            uint8_t *buffer /* [in] [unique,size_is(bufsize)] */,
10107                                            WERROR *werror)
10108 {
10109         struct spoolss_RouterReplyPrinter r;
10110         NTSTATUS status;
10111
10112         /* In parameters */
10113         r.in.handle = handle;
10114         r.in.flags = flags;
10115         r.in.bufsize = bufsize;
10116         r.in.buffer = buffer;
10117
10118         if (DEBUGLEVEL >= 10) {
10119                 NDR_PRINT_IN_DEBUG(spoolss_RouterReplyPrinter, &r);
10120         }
10121
10122         status = cli->dispatch(cli,
10123                                 mem_ctx,
10124                                 &ndr_table_spoolss,
10125                                 NDR_SPOOLSS_ROUTERREPLYPRINTER,
10126                                 &r);
10127
10128         if (!NT_STATUS_IS_OK(status)) {
10129                 return status;
10130         }
10131
10132         if (DEBUGLEVEL >= 10) {
10133                 NDR_PRINT_OUT_DEBUG(spoolss_RouterReplyPrinter, &r);
10134         }
10135
10136         if (NT_STATUS_IS_ERR(status)) {
10137                 return status;
10138         }
10139
10140         /* Return variables */
10141
10142         /* Return result */
10143         if (werror) {
10144                 *werror = r.out.result;
10145         }
10146
10147         return werror_to_ntstatus(r.out.result);
10148 }
10149
10150 struct rpccli_spoolss_ReplyClosePrinter_state {
10151         struct spoolss_ReplyClosePrinter orig;
10152         struct spoolss_ReplyClosePrinter tmp;
10153         TALLOC_CTX *out_mem_ctx;
10154         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
10155 };
10156
10157 static void rpccli_spoolss_ReplyClosePrinter_done(struct tevent_req *subreq);
10158
10159 struct tevent_req *rpccli_spoolss_ReplyClosePrinter_send(TALLOC_CTX *mem_ctx,
10160                                                          struct tevent_context *ev,
10161                                                          struct rpc_pipe_client *cli,
10162                                                          struct policy_handle *_handle /* [in,out] [ref] */)
10163 {
10164         struct tevent_req *req;
10165         struct rpccli_spoolss_ReplyClosePrinter_state *state;
10166         struct tevent_req *subreq;
10167
10168         req = tevent_req_create(mem_ctx, &state,
10169                                 struct rpccli_spoolss_ReplyClosePrinter_state);
10170         if (req == NULL) {
10171                 return NULL;
10172         }
10173         state->out_mem_ctx = NULL;
10174         state->dispatch_recv = cli->dispatch_recv;
10175
10176         /* In parameters */
10177         state->orig.in.handle = _handle;
10178
10179         /* Out parameters */
10180         state->orig.out.handle = _handle;
10181
10182         /* Result */
10183         ZERO_STRUCT(state->orig.out.result);
10184
10185         if (DEBUGLEVEL >= 10) {
10186                 NDR_PRINT_IN_DEBUG(spoolss_ReplyClosePrinter, &state->orig);
10187         }
10188
10189         state->out_mem_ctx = talloc_named_const(state, 0,
10190                              "rpccli_spoolss_ReplyClosePrinter_out_memory");
10191         if (tevent_req_nomem(state->out_mem_ctx, req)) {
10192                 return tevent_req_post(req, ev);
10193         }
10194
10195         /* make a temporary copy, that we pass to the dispatch function */
10196         state->tmp = state->orig;
10197
10198         subreq = cli->dispatch_send(state, ev, cli,
10199                                     &ndr_table_spoolss,
10200                                     NDR_SPOOLSS_REPLYCLOSEPRINTER,
10201                                     &state->tmp);
10202         if (tevent_req_nomem(subreq, req)) {
10203                 return tevent_req_post(req, ev);
10204         }
10205         tevent_req_set_callback(subreq, rpccli_spoolss_ReplyClosePrinter_done, req);
10206         return req;
10207 }
10208
10209 static void rpccli_spoolss_ReplyClosePrinter_done(struct tevent_req *subreq)
10210 {
10211         struct tevent_req *req = tevent_req_callback_data(
10212                 subreq, struct tevent_req);
10213         struct rpccli_spoolss_ReplyClosePrinter_state *state = tevent_req_data(
10214                 req, struct rpccli_spoolss_ReplyClosePrinter_state);
10215         NTSTATUS status;
10216         TALLOC_CTX *mem_ctx;
10217
10218         if (state->out_mem_ctx) {
10219                 mem_ctx = state->out_mem_ctx;
10220         } else {
10221                 mem_ctx = state;
10222         }
10223
10224         status = state->dispatch_recv(subreq, mem_ctx);
10225         TALLOC_FREE(subreq);
10226         if (!NT_STATUS_IS_OK(status)) {
10227                 tevent_req_nterror(req, status);
10228                 return;
10229         }
10230
10231         /* Copy out parameters */
10232         *state->orig.out.handle = *state->tmp.out.handle;
10233
10234         /* Copy result */
10235         state->orig.out.result = state->tmp.out.result;
10236
10237         /* Reset temporary structure */
10238         ZERO_STRUCT(state->tmp);
10239
10240         if (DEBUGLEVEL >= 10) {
10241                 NDR_PRINT_OUT_DEBUG(spoolss_ReplyClosePrinter, &state->orig);
10242         }
10243
10244         tevent_req_done(req);
10245 }
10246
10247 NTSTATUS rpccli_spoolss_ReplyClosePrinter_recv(struct tevent_req *req,
10248                                                TALLOC_CTX *mem_ctx,
10249                                                WERROR *result)
10250 {
10251         struct rpccli_spoolss_ReplyClosePrinter_state *state = tevent_req_data(
10252                 req, struct rpccli_spoolss_ReplyClosePrinter_state);
10253         NTSTATUS status;
10254
10255         if (tevent_req_is_nterror(req, &status)) {
10256                 tevent_req_received(req);
10257                 return status;
10258         }
10259
10260         /* Steal possbile out parameters to the callers context */
10261         talloc_steal(mem_ctx, state->out_mem_ctx);
10262
10263         /* Return result */
10264         *result = state->orig.out.result;
10265
10266         tevent_req_received(req);
10267         return NT_STATUS_OK;
10268 }
10269
10270 NTSTATUS rpccli_spoolss_ReplyClosePrinter(struct rpc_pipe_client *cli,
10271                                           TALLOC_CTX *mem_ctx,
10272                                           struct policy_handle *handle /* [in,out] [ref] */,
10273                                           WERROR *werror)
10274 {
10275         struct spoolss_ReplyClosePrinter r;
10276         NTSTATUS status;
10277
10278         /* In parameters */
10279         r.in.handle = handle;
10280
10281         if (DEBUGLEVEL >= 10) {
10282                 NDR_PRINT_IN_DEBUG(spoolss_ReplyClosePrinter, &r);
10283         }
10284
10285         status = cli->dispatch(cli,
10286                                 mem_ctx,
10287                                 &ndr_table_spoolss,
10288                                 NDR_SPOOLSS_REPLYCLOSEPRINTER,
10289                                 &r);
10290
10291         if (!NT_STATUS_IS_OK(status)) {
10292                 return status;
10293         }
10294
10295         if (DEBUGLEVEL >= 10) {
10296                 NDR_PRINT_OUT_DEBUG(spoolss_ReplyClosePrinter, &r);
10297         }
10298
10299         if (NT_STATUS_IS_ERR(status)) {
10300                 return status;
10301         }
10302
10303         /* Return variables */
10304         *handle = *r.out.handle;
10305
10306         /* Return result */
10307         if (werror) {
10308                 *werror = r.out.result;
10309         }
10310
10311         return werror_to_ntstatus(r.out.result);
10312 }
10313
10314 struct rpccli_spoolss_AddPortEx_state {
10315         struct spoolss_AddPortEx orig;
10316         struct spoolss_AddPortEx tmp;
10317         TALLOC_CTX *out_mem_ctx;
10318         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
10319 };
10320
10321 static void rpccli_spoolss_AddPortEx_done(struct tevent_req *subreq);
10322
10323 struct tevent_req *rpccli_spoolss_AddPortEx_send(TALLOC_CTX *mem_ctx,
10324                                                  struct tevent_context *ev,
10325                                                  struct rpc_pipe_client *cli)
10326 {
10327         struct tevent_req *req;
10328         struct rpccli_spoolss_AddPortEx_state *state;
10329         struct tevent_req *subreq;
10330
10331         req = tevent_req_create(mem_ctx, &state,
10332                                 struct rpccli_spoolss_AddPortEx_state);
10333         if (req == NULL) {
10334                 return NULL;
10335         }
10336         state->out_mem_ctx = NULL;
10337         state->dispatch_recv = cli->dispatch_recv;
10338
10339         /* In parameters */
10340
10341         /* Out parameters */
10342
10343         /* Result */
10344         ZERO_STRUCT(state->orig.out.result);
10345
10346         if (DEBUGLEVEL >= 10) {
10347                 NDR_PRINT_IN_DEBUG(spoolss_AddPortEx, &state->orig);
10348         }
10349
10350         /* make a temporary copy, that we pass to the dispatch function */
10351         state->tmp = state->orig;
10352
10353         subreq = cli->dispatch_send(state, ev, cli,
10354                                     &ndr_table_spoolss,
10355                                     NDR_SPOOLSS_ADDPORTEX,
10356                                     &state->tmp);
10357         if (tevent_req_nomem(subreq, req)) {
10358                 return tevent_req_post(req, ev);
10359         }
10360         tevent_req_set_callback(subreq, rpccli_spoolss_AddPortEx_done, req);
10361         return req;
10362 }
10363
10364 static void rpccli_spoolss_AddPortEx_done(struct tevent_req *subreq)
10365 {
10366         struct tevent_req *req = tevent_req_callback_data(
10367                 subreq, struct tevent_req);
10368         struct rpccli_spoolss_AddPortEx_state *state = tevent_req_data(
10369                 req, struct rpccli_spoolss_AddPortEx_state);
10370         NTSTATUS status;
10371         TALLOC_CTX *mem_ctx;
10372
10373         if (state->out_mem_ctx) {
10374                 mem_ctx = state->out_mem_ctx;
10375         } else {
10376                 mem_ctx = state;
10377         }
10378
10379         status = state->dispatch_recv(subreq, mem_ctx);
10380         TALLOC_FREE(subreq);
10381         if (!NT_STATUS_IS_OK(status)) {
10382                 tevent_req_nterror(req, status);
10383                 return;
10384         }
10385
10386         /* Copy out parameters */
10387
10388         /* Copy result */
10389         state->orig.out.result = state->tmp.out.result;
10390
10391         /* Reset temporary structure */
10392         ZERO_STRUCT(state->tmp);
10393
10394         if (DEBUGLEVEL >= 10) {
10395                 NDR_PRINT_OUT_DEBUG(spoolss_AddPortEx, &state->orig);
10396         }
10397
10398         tevent_req_done(req);
10399 }
10400
10401 NTSTATUS rpccli_spoolss_AddPortEx_recv(struct tevent_req *req,
10402                                        TALLOC_CTX *mem_ctx,
10403                                        WERROR *result)
10404 {
10405         struct rpccli_spoolss_AddPortEx_state *state = tevent_req_data(
10406                 req, struct rpccli_spoolss_AddPortEx_state);
10407         NTSTATUS status;
10408
10409         if (tevent_req_is_nterror(req, &status)) {
10410                 tevent_req_received(req);
10411                 return status;
10412         }
10413
10414         /* Steal possbile out parameters to the callers context */
10415         talloc_steal(mem_ctx, state->out_mem_ctx);
10416
10417         /* Return result */
10418         *result = state->orig.out.result;
10419
10420         tevent_req_received(req);
10421         return NT_STATUS_OK;
10422 }
10423
10424 NTSTATUS rpccli_spoolss_AddPortEx(struct rpc_pipe_client *cli,
10425                                   TALLOC_CTX *mem_ctx,
10426                                   WERROR *werror)
10427 {
10428         struct spoolss_AddPortEx r;
10429         NTSTATUS status;
10430
10431         /* In parameters */
10432
10433         if (DEBUGLEVEL >= 10) {
10434                 NDR_PRINT_IN_DEBUG(spoolss_AddPortEx, &r);
10435         }
10436
10437         status = cli->dispatch(cli,
10438                                 mem_ctx,
10439                                 &ndr_table_spoolss,
10440                                 NDR_SPOOLSS_ADDPORTEX,
10441                                 &r);
10442
10443         if (!NT_STATUS_IS_OK(status)) {
10444                 return status;
10445         }
10446
10447         if (DEBUGLEVEL >= 10) {
10448                 NDR_PRINT_OUT_DEBUG(spoolss_AddPortEx, &r);
10449         }
10450
10451         if (NT_STATUS_IS_ERR(status)) {
10452                 return status;
10453         }
10454
10455         /* Return variables */
10456
10457         /* Return result */
10458         if (werror) {
10459                 *werror = r.out.result;
10460         }
10461
10462         return werror_to_ntstatus(r.out.result);
10463 }
10464
10465 struct rpccli_spoolss_RouterFindFirstPrinterChangeNotification_state {
10466         struct spoolss_RouterFindFirstPrinterChangeNotification orig;
10467         struct spoolss_RouterFindFirstPrinterChangeNotification tmp;
10468         TALLOC_CTX *out_mem_ctx;
10469         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
10470 };
10471
10472 static void rpccli_spoolss_RouterFindFirstPrinterChangeNotification_done(struct tevent_req *subreq);
10473
10474 struct tevent_req *rpccli_spoolss_RouterFindFirstPrinterChangeNotification_send(TALLOC_CTX *mem_ctx,
10475                                                                                 struct tevent_context *ev,
10476                                                                                 struct rpc_pipe_client *cli)
10477 {
10478         struct tevent_req *req;
10479         struct rpccli_spoolss_RouterFindFirstPrinterChangeNotification_state *state;
10480         struct tevent_req *subreq;
10481
10482         req = tevent_req_create(mem_ctx, &state,
10483                                 struct rpccli_spoolss_RouterFindFirstPrinterChangeNotification_state);
10484         if (req == NULL) {
10485                 return NULL;
10486         }
10487         state->out_mem_ctx = NULL;
10488         state->dispatch_recv = cli->dispatch_recv;
10489
10490         /* In parameters */
10491
10492         /* Out parameters */
10493
10494         /* Result */
10495         ZERO_STRUCT(state->orig.out.result);
10496
10497         if (DEBUGLEVEL >= 10) {
10498                 NDR_PRINT_IN_DEBUG(spoolss_RouterFindFirstPrinterChangeNotification, &state->orig);
10499         }
10500
10501         /* make a temporary copy, that we pass to the dispatch function */
10502         state->tmp = state->orig;
10503
10504         subreq = cli->dispatch_send(state, ev, cli,
10505                                     &ndr_table_spoolss,
10506                                     NDR_SPOOLSS_ROUTERFINDFIRSTPRINTERCHANGENOTIFICATION,
10507                                     &state->tmp);
10508         if (tevent_req_nomem(subreq, req)) {
10509                 return tevent_req_post(req, ev);
10510         }
10511         tevent_req_set_callback(subreq, rpccli_spoolss_RouterFindFirstPrinterChangeNotification_done, req);
10512         return req;
10513 }
10514
10515 static void rpccli_spoolss_RouterFindFirstPrinterChangeNotification_done(struct tevent_req *subreq)
10516 {
10517         struct tevent_req *req = tevent_req_callback_data(
10518                 subreq, struct tevent_req);
10519         struct rpccli_spoolss_RouterFindFirstPrinterChangeNotification_state *state = tevent_req_data(
10520                 req, struct rpccli_spoolss_RouterFindFirstPrinterChangeNotification_state);
10521         NTSTATUS status;
10522         TALLOC_CTX *mem_ctx;
10523
10524         if (state->out_mem_ctx) {
10525                 mem_ctx = state->out_mem_ctx;
10526         } else {
10527                 mem_ctx = state;
10528         }
10529
10530         status = state->dispatch_recv(subreq, mem_ctx);
10531         TALLOC_FREE(subreq);
10532         if (!NT_STATUS_IS_OK(status)) {
10533                 tevent_req_nterror(req, status);
10534                 return;
10535         }
10536
10537         /* Copy out parameters */
10538
10539         /* Copy result */
10540         state->orig.out.result = state->tmp.out.result;
10541
10542         /* Reset temporary structure */
10543         ZERO_STRUCT(state->tmp);
10544
10545         if (DEBUGLEVEL >= 10) {
10546                 NDR_PRINT_OUT_DEBUG(spoolss_RouterFindFirstPrinterChangeNotification, &state->orig);
10547         }
10548
10549         tevent_req_done(req);
10550 }
10551
10552 NTSTATUS rpccli_spoolss_RouterFindFirstPrinterChangeNotification_recv(struct tevent_req *req,
10553                                                                       TALLOC_CTX *mem_ctx,
10554                                                                       WERROR *result)
10555 {
10556         struct rpccli_spoolss_RouterFindFirstPrinterChangeNotification_state *state = tevent_req_data(
10557                 req, struct rpccli_spoolss_RouterFindFirstPrinterChangeNotification_state);
10558         NTSTATUS status;
10559
10560         if (tevent_req_is_nterror(req, &status)) {
10561                 tevent_req_received(req);
10562                 return status;
10563         }
10564
10565         /* Steal possbile out parameters to the callers context */
10566         talloc_steal(mem_ctx, state->out_mem_ctx);
10567
10568         /* Return result */
10569         *result = state->orig.out.result;
10570
10571         tevent_req_received(req);
10572         return NT_STATUS_OK;
10573 }
10574
10575 NTSTATUS rpccli_spoolss_RouterFindFirstPrinterChangeNotification(struct rpc_pipe_client *cli,
10576                                                                  TALLOC_CTX *mem_ctx,
10577                                                                  WERROR *werror)
10578 {
10579         struct spoolss_RouterFindFirstPrinterChangeNotification r;
10580         NTSTATUS status;
10581
10582         /* In parameters */
10583
10584         if (DEBUGLEVEL >= 10) {
10585                 NDR_PRINT_IN_DEBUG(spoolss_RouterFindFirstPrinterChangeNotification, &r);
10586         }
10587
10588         status = cli->dispatch(cli,
10589                                 mem_ctx,
10590                                 &ndr_table_spoolss,
10591                                 NDR_SPOOLSS_ROUTERFINDFIRSTPRINTERCHANGENOTIFICATION,
10592                                 &r);
10593
10594         if (!NT_STATUS_IS_OK(status)) {
10595                 return status;
10596         }
10597
10598         if (DEBUGLEVEL >= 10) {
10599                 NDR_PRINT_OUT_DEBUG(spoolss_RouterFindFirstPrinterChangeNotification, &r);
10600         }
10601
10602         if (NT_STATUS_IS_ERR(status)) {
10603                 return status;
10604         }
10605
10606         /* Return variables */
10607
10608         /* Return result */
10609         if (werror) {
10610                 *werror = r.out.result;
10611         }
10612
10613         return werror_to_ntstatus(r.out.result);
10614 }
10615
10616 struct rpccli_spoolss_SpoolerInit_state {
10617         struct spoolss_SpoolerInit orig;
10618         struct spoolss_SpoolerInit tmp;
10619         TALLOC_CTX *out_mem_ctx;
10620         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
10621 };
10622
10623 static void rpccli_spoolss_SpoolerInit_done(struct tevent_req *subreq);
10624
10625 struct tevent_req *rpccli_spoolss_SpoolerInit_send(TALLOC_CTX *mem_ctx,
10626                                                    struct tevent_context *ev,
10627                                                    struct rpc_pipe_client *cli)
10628 {
10629         struct tevent_req *req;
10630         struct rpccli_spoolss_SpoolerInit_state *state;
10631         struct tevent_req *subreq;
10632
10633         req = tevent_req_create(mem_ctx, &state,
10634                                 struct rpccli_spoolss_SpoolerInit_state);
10635         if (req == NULL) {
10636                 return NULL;
10637         }
10638         state->out_mem_ctx = NULL;
10639         state->dispatch_recv = cli->dispatch_recv;
10640
10641         /* In parameters */
10642
10643         /* Out parameters */
10644
10645         /* Result */
10646         ZERO_STRUCT(state->orig.out.result);
10647
10648         if (DEBUGLEVEL >= 10) {
10649                 NDR_PRINT_IN_DEBUG(spoolss_SpoolerInit, &state->orig);
10650         }
10651
10652         /* make a temporary copy, that we pass to the dispatch function */
10653         state->tmp = state->orig;
10654
10655         subreq = cli->dispatch_send(state, ev, cli,
10656                                     &ndr_table_spoolss,
10657                                     NDR_SPOOLSS_SPOOLERINIT,
10658                                     &state->tmp);
10659         if (tevent_req_nomem(subreq, req)) {
10660                 return tevent_req_post(req, ev);
10661         }
10662         tevent_req_set_callback(subreq, rpccli_spoolss_SpoolerInit_done, req);
10663         return req;
10664 }
10665
10666 static void rpccli_spoolss_SpoolerInit_done(struct tevent_req *subreq)
10667 {
10668         struct tevent_req *req = tevent_req_callback_data(
10669                 subreq, struct tevent_req);
10670         struct rpccli_spoolss_SpoolerInit_state *state = tevent_req_data(
10671                 req, struct rpccli_spoolss_SpoolerInit_state);
10672         NTSTATUS status;
10673         TALLOC_CTX *mem_ctx;
10674
10675         if (state->out_mem_ctx) {
10676                 mem_ctx = state->out_mem_ctx;
10677         } else {
10678                 mem_ctx = state;
10679         }
10680
10681         status = state->dispatch_recv(subreq, mem_ctx);
10682         TALLOC_FREE(subreq);
10683         if (!NT_STATUS_IS_OK(status)) {
10684                 tevent_req_nterror(req, status);
10685                 return;
10686         }
10687
10688         /* Copy out parameters */
10689
10690         /* Copy result */
10691         state->orig.out.result = state->tmp.out.result;
10692
10693         /* Reset temporary structure */
10694         ZERO_STRUCT(state->tmp);
10695
10696         if (DEBUGLEVEL >= 10) {
10697                 NDR_PRINT_OUT_DEBUG(spoolss_SpoolerInit, &state->orig);
10698         }
10699
10700         tevent_req_done(req);
10701 }
10702
10703 NTSTATUS rpccli_spoolss_SpoolerInit_recv(struct tevent_req *req,
10704                                          TALLOC_CTX *mem_ctx,
10705                                          WERROR *result)
10706 {
10707         struct rpccli_spoolss_SpoolerInit_state *state = tevent_req_data(
10708                 req, struct rpccli_spoolss_SpoolerInit_state);
10709         NTSTATUS status;
10710
10711         if (tevent_req_is_nterror(req, &status)) {
10712                 tevent_req_received(req);
10713                 return status;
10714         }
10715
10716         /* Steal possbile out parameters to the callers context */
10717         talloc_steal(mem_ctx, state->out_mem_ctx);
10718
10719         /* Return result */
10720         *result = state->orig.out.result;
10721
10722         tevent_req_received(req);
10723         return NT_STATUS_OK;
10724 }
10725
10726 NTSTATUS rpccli_spoolss_SpoolerInit(struct rpc_pipe_client *cli,
10727                                     TALLOC_CTX *mem_ctx,
10728                                     WERROR *werror)
10729 {
10730         struct spoolss_SpoolerInit r;
10731         NTSTATUS status;
10732
10733         /* In parameters */
10734
10735         if (DEBUGLEVEL >= 10) {
10736                 NDR_PRINT_IN_DEBUG(spoolss_SpoolerInit, &r);
10737         }
10738
10739         status = cli->dispatch(cli,
10740                                 mem_ctx,
10741                                 &ndr_table_spoolss,
10742                                 NDR_SPOOLSS_SPOOLERINIT,
10743                                 &r);
10744
10745         if (!NT_STATUS_IS_OK(status)) {
10746                 return status;
10747         }
10748
10749         if (DEBUGLEVEL >= 10) {
10750                 NDR_PRINT_OUT_DEBUG(spoolss_SpoolerInit, &r);
10751         }
10752
10753         if (NT_STATUS_IS_ERR(status)) {
10754                 return status;
10755         }
10756
10757         /* Return variables */
10758
10759         /* Return result */
10760         if (werror) {
10761                 *werror = r.out.result;
10762         }
10763
10764         return werror_to_ntstatus(r.out.result);
10765 }
10766
10767 struct rpccli_spoolss_ResetPrinterEx_state {
10768         struct spoolss_ResetPrinterEx orig;
10769         struct spoolss_ResetPrinterEx tmp;
10770         TALLOC_CTX *out_mem_ctx;
10771         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
10772 };
10773
10774 static void rpccli_spoolss_ResetPrinterEx_done(struct tevent_req *subreq);
10775
10776 struct tevent_req *rpccli_spoolss_ResetPrinterEx_send(TALLOC_CTX *mem_ctx,
10777                                                       struct tevent_context *ev,
10778                                                       struct rpc_pipe_client *cli)
10779 {
10780         struct tevent_req *req;
10781         struct rpccli_spoolss_ResetPrinterEx_state *state;
10782         struct tevent_req *subreq;
10783
10784         req = tevent_req_create(mem_ctx, &state,
10785                                 struct rpccli_spoolss_ResetPrinterEx_state);
10786         if (req == NULL) {
10787                 return NULL;
10788         }
10789         state->out_mem_ctx = NULL;
10790         state->dispatch_recv = cli->dispatch_recv;
10791
10792         /* In parameters */
10793
10794         /* Out parameters */
10795
10796         /* Result */
10797         ZERO_STRUCT(state->orig.out.result);
10798
10799         if (DEBUGLEVEL >= 10) {
10800                 NDR_PRINT_IN_DEBUG(spoolss_ResetPrinterEx, &state->orig);
10801         }
10802
10803         /* make a temporary copy, that we pass to the dispatch function */
10804         state->tmp = state->orig;
10805
10806         subreq = cli->dispatch_send(state, ev, cli,
10807                                     &ndr_table_spoolss,
10808                                     NDR_SPOOLSS_RESETPRINTEREX,
10809                                     &state->tmp);
10810         if (tevent_req_nomem(subreq, req)) {
10811                 return tevent_req_post(req, ev);
10812         }
10813         tevent_req_set_callback(subreq, rpccli_spoolss_ResetPrinterEx_done, req);
10814         return req;
10815 }
10816
10817 static void rpccli_spoolss_ResetPrinterEx_done(struct tevent_req *subreq)
10818 {
10819         struct tevent_req *req = tevent_req_callback_data(
10820                 subreq, struct tevent_req);
10821         struct rpccli_spoolss_ResetPrinterEx_state *state = tevent_req_data(
10822                 req, struct rpccli_spoolss_ResetPrinterEx_state);
10823         NTSTATUS status;
10824         TALLOC_CTX *mem_ctx;
10825
10826         if (state->out_mem_ctx) {
10827                 mem_ctx = state->out_mem_ctx;
10828         } else {
10829                 mem_ctx = state;
10830         }
10831
10832         status = state->dispatch_recv(subreq, mem_ctx);
10833         TALLOC_FREE(subreq);
10834         if (!NT_STATUS_IS_OK(status)) {
10835                 tevent_req_nterror(req, status);
10836                 return;
10837         }
10838
10839         /* Copy out parameters */
10840
10841         /* Copy result */
10842         state->orig.out.result = state->tmp.out.result;
10843
10844         /* Reset temporary structure */
10845         ZERO_STRUCT(state->tmp);
10846
10847         if (DEBUGLEVEL >= 10) {
10848                 NDR_PRINT_OUT_DEBUG(spoolss_ResetPrinterEx, &state->orig);
10849         }
10850
10851         tevent_req_done(req);
10852 }
10853
10854 NTSTATUS rpccli_spoolss_ResetPrinterEx_recv(struct tevent_req *req,
10855                                             TALLOC_CTX *mem_ctx,
10856                                             WERROR *result)
10857 {
10858         struct rpccli_spoolss_ResetPrinterEx_state *state = tevent_req_data(
10859                 req, struct rpccli_spoolss_ResetPrinterEx_state);
10860         NTSTATUS status;
10861
10862         if (tevent_req_is_nterror(req, &status)) {
10863                 tevent_req_received(req);
10864                 return status;
10865         }
10866
10867         /* Steal possbile out parameters to the callers context */
10868         talloc_steal(mem_ctx, state->out_mem_ctx);
10869
10870         /* Return result */
10871         *result = state->orig.out.result;
10872
10873         tevent_req_received(req);
10874         return NT_STATUS_OK;
10875 }
10876
10877 NTSTATUS rpccli_spoolss_ResetPrinterEx(struct rpc_pipe_client *cli,
10878                                        TALLOC_CTX *mem_ctx,
10879                                        WERROR *werror)
10880 {
10881         struct spoolss_ResetPrinterEx r;
10882         NTSTATUS status;
10883
10884         /* In parameters */
10885
10886         if (DEBUGLEVEL >= 10) {
10887                 NDR_PRINT_IN_DEBUG(spoolss_ResetPrinterEx, &r);
10888         }
10889
10890         status = cli->dispatch(cli,
10891                                 mem_ctx,
10892                                 &ndr_table_spoolss,
10893                                 NDR_SPOOLSS_RESETPRINTEREX,
10894                                 &r);
10895
10896         if (!NT_STATUS_IS_OK(status)) {
10897                 return status;
10898         }
10899
10900         if (DEBUGLEVEL >= 10) {
10901                 NDR_PRINT_OUT_DEBUG(spoolss_ResetPrinterEx, &r);
10902         }
10903
10904         if (NT_STATUS_IS_ERR(status)) {
10905                 return status;
10906         }
10907
10908         /* Return variables */
10909
10910         /* Return result */
10911         if (werror) {
10912                 *werror = r.out.result;
10913         }
10914
10915         return werror_to_ntstatus(r.out.result);
10916 }
10917
10918 struct rpccli_spoolss_RemoteFindFirstPrinterChangeNotifyEx_state {
10919         struct spoolss_RemoteFindFirstPrinterChangeNotifyEx orig;
10920         struct spoolss_RemoteFindFirstPrinterChangeNotifyEx tmp;
10921         TALLOC_CTX *out_mem_ctx;
10922         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
10923 };
10924
10925 static void rpccli_spoolss_RemoteFindFirstPrinterChangeNotifyEx_done(struct tevent_req *subreq);
10926
10927 struct tevent_req *rpccli_spoolss_RemoteFindFirstPrinterChangeNotifyEx_send(TALLOC_CTX *mem_ctx,
10928                                                                             struct tevent_context *ev,
10929                                                                             struct rpc_pipe_client *cli,
10930                                                                             struct policy_handle *_handle /* [in] [ref] */,
10931                                                                             uint32_t _flags /* [in]  */,
10932                                                                             uint32_t _options /* [in]  */,
10933                                                                             const char *_local_machine /* [in] [unique,charset(UTF16)] */,
10934                                                                             uint32_t _printer_local /* [in]  */,
10935                                                                             struct spoolss_NotifyOption *_notify_options /* [in] [unique] */)
10936 {
10937         struct tevent_req *req;
10938         struct rpccli_spoolss_RemoteFindFirstPrinterChangeNotifyEx_state *state;
10939         struct tevent_req *subreq;
10940
10941         req = tevent_req_create(mem_ctx, &state,
10942                                 struct rpccli_spoolss_RemoteFindFirstPrinterChangeNotifyEx_state);
10943         if (req == NULL) {
10944                 return NULL;
10945         }
10946         state->out_mem_ctx = NULL;
10947         state->dispatch_recv = cli->dispatch_recv;
10948
10949         /* In parameters */
10950         state->orig.in.handle = _handle;
10951         state->orig.in.flags = _flags;
10952         state->orig.in.options = _options;
10953         state->orig.in.local_machine = _local_machine;
10954         state->orig.in.printer_local = _printer_local;
10955         state->orig.in.notify_options = _notify_options;
10956
10957         /* Out parameters */
10958
10959         /* Result */
10960         ZERO_STRUCT(state->orig.out.result);
10961
10962         if (DEBUGLEVEL >= 10) {
10963                 NDR_PRINT_IN_DEBUG(spoolss_RemoteFindFirstPrinterChangeNotifyEx, &state->orig);
10964         }
10965
10966         /* make a temporary copy, that we pass to the dispatch function */
10967         state->tmp = state->orig;
10968
10969         subreq = cli->dispatch_send(state, ev, cli,
10970                                     &ndr_table_spoolss,
10971                                     NDR_SPOOLSS_REMOTEFINDFIRSTPRINTERCHANGENOTIFYEX,
10972                                     &state->tmp);
10973         if (tevent_req_nomem(subreq, req)) {
10974                 return tevent_req_post(req, ev);
10975         }
10976         tevent_req_set_callback(subreq, rpccli_spoolss_RemoteFindFirstPrinterChangeNotifyEx_done, req);
10977         return req;
10978 }
10979
10980 static void rpccli_spoolss_RemoteFindFirstPrinterChangeNotifyEx_done(struct tevent_req *subreq)
10981 {
10982         struct tevent_req *req = tevent_req_callback_data(
10983                 subreq, struct tevent_req);
10984         struct rpccli_spoolss_RemoteFindFirstPrinterChangeNotifyEx_state *state = tevent_req_data(
10985                 req, struct rpccli_spoolss_RemoteFindFirstPrinterChangeNotifyEx_state);
10986         NTSTATUS status;
10987         TALLOC_CTX *mem_ctx;
10988
10989         if (state->out_mem_ctx) {
10990                 mem_ctx = state->out_mem_ctx;
10991         } else {
10992                 mem_ctx = state;
10993         }
10994
10995         status = state->dispatch_recv(subreq, mem_ctx);
10996         TALLOC_FREE(subreq);
10997         if (!NT_STATUS_IS_OK(status)) {
10998                 tevent_req_nterror(req, status);
10999                 return;
11000         }
11001
11002         /* Copy out parameters */
11003
11004         /* Copy result */
11005         state->orig.out.result = state->tmp.out.result;
11006
11007         /* Reset temporary structure */
11008         ZERO_STRUCT(state->tmp);
11009
11010         if (DEBUGLEVEL >= 10) {
11011                 NDR_PRINT_OUT_DEBUG(spoolss_RemoteFindFirstPrinterChangeNotifyEx, &state->orig);
11012         }
11013
11014         tevent_req_done(req);
11015 }
11016
11017 NTSTATUS rpccli_spoolss_RemoteFindFirstPrinterChangeNotifyEx_recv(struct tevent_req *req,
11018                                                                   TALLOC_CTX *mem_ctx,
11019                                                                   WERROR *result)
11020 {
11021         struct rpccli_spoolss_RemoteFindFirstPrinterChangeNotifyEx_state *state = tevent_req_data(
11022                 req, struct rpccli_spoolss_RemoteFindFirstPrinterChangeNotifyEx_state);
11023         NTSTATUS status;
11024
11025         if (tevent_req_is_nterror(req, &status)) {
11026                 tevent_req_received(req);
11027                 return status;
11028         }
11029
11030         /* Steal possbile out parameters to the callers context */
11031         talloc_steal(mem_ctx, state->out_mem_ctx);
11032
11033         /* Return result */
11034         *result = state->orig.out.result;
11035
11036         tevent_req_received(req);
11037         return NT_STATUS_OK;
11038 }
11039
11040 NTSTATUS rpccli_spoolss_RemoteFindFirstPrinterChangeNotifyEx(struct rpc_pipe_client *cli,
11041                                                              TALLOC_CTX *mem_ctx,
11042                                                              struct policy_handle *handle /* [in] [ref] */,
11043                                                              uint32_t flags /* [in]  */,
11044                                                              uint32_t options /* [in]  */,
11045                                                              const char *local_machine /* [in] [unique,charset(UTF16)] */,
11046                                                              uint32_t printer_local /* [in]  */,
11047                                                              struct spoolss_NotifyOption *notify_options /* [in] [unique] */,
11048                                                              WERROR *werror)
11049 {
11050         struct spoolss_RemoteFindFirstPrinterChangeNotifyEx r;
11051         NTSTATUS status;
11052
11053         /* In parameters */
11054         r.in.handle = handle;
11055         r.in.flags = flags;
11056         r.in.options = options;
11057         r.in.local_machine = local_machine;
11058         r.in.printer_local = printer_local;
11059         r.in.notify_options = notify_options;
11060
11061         if (DEBUGLEVEL >= 10) {
11062                 NDR_PRINT_IN_DEBUG(spoolss_RemoteFindFirstPrinterChangeNotifyEx, &r);
11063         }
11064
11065         status = cli->dispatch(cli,
11066                                 mem_ctx,
11067                                 &ndr_table_spoolss,
11068                                 NDR_SPOOLSS_REMOTEFINDFIRSTPRINTERCHANGENOTIFYEX,
11069                                 &r);
11070
11071         if (!NT_STATUS_IS_OK(status)) {
11072                 return status;
11073         }
11074
11075         if (DEBUGLEVEL >= 10) {
11076                 NDR_PRINT_OUT_DEBUG(spoolss_RemoteFindFirstPrinterChangeNotifyEx, &r);
11077         }
11078
11079         if (NT_STATUS_IS_ERR(status)) {
11080                 return status;
11081         }
11082
11083         /* Return variables */
11084
11085         /* Return result */
11086         if (werror) {
11087                 *werror = r.out.result;
11088         }
11089
11090         return werror_to_ntstatus(r.out.result);
11091 }
11092
11093 struct rpccli_spoolss_RouterReplyPrinterEx_state {
11094         struct spoolss_RouterReplyPrinterEx orig;
11095         struct spoolss_RouterReplyPrinterEx tmp;
11096         TALLOC_CTX *out_mem_ctx;
11097         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
11098 };
11099
11100 static void rpccli_spoolss_RouterReplyPrinterEx_done(struct tevent_req *subreq);
11101
11102 struct tevent_req *rpccli_spoolss_RouterReplyPrinterEx_send(TALLOC_CTX *mem_ctx,
11103                                                             struct tevent_context *ev,
11104                                                             struct rpc_pipe_client *cli,
11105                                                             struct policy_handle *_handle /* [in] [ref] */,
11106                                                             uint32_t _color /* [in]  */,
11107                                                             uint32_t _flags /* [in]  */,
11108                                                             uint32_t *_reply_result /* [out] [ref] */,
11109                                                             uint32_t _reply_type /* [in]  */,
11110                                                             union spoolss_ReplyPrinterInfo _info /* [in] [switch_is(reply_type)] */)
11111 {
11112         struct tevent_req *req;
11113         struct rpccli_spoolss_RouterReplyPrinterEx_state *state;
11114         struct tevent_req *subreq;
11115
11116         req = tevent_req_create(mem_ctx, &state,
11117                                 struct rpccli_spoolss_RouterReplyPrinterEx_state);
11118         if (req == NULL) {
11119                 return NULL;
11120         }
11121         state->out_mem_ctx = NULL;
11122         state->dispatch_recv = cli->dispatch_recv;
11123
11124         /* In parameters */
11125         state->orig.in.handle = _handle;
11126         state->orig.in.color = _color;
11127         state->orig.in.flags = _flags;
11128         state->orig.in.reply_type = _reply_type;
11129         state->orig.in.info = _info;
11130
11131         /* Out parameters */
11132         state->orig.out.reply_result = _reply_result;
11133
11134         /* Result */
11135         ZERO_STRUCT(state->orig.out.result);
11136
11137         if (DEBUGLEVEL >= 10) {
11138                 NDR_PRINT_IN_DEBUG(spoolss_RouterReplyPrinterEx, &state->orig);
11139         }
11140
11141         state->out_mem_ctx = talloc_named_const(state, 0,
11142                              "rpccli_spoolss_RouterReplyPrinterEx_out_memory");
11143         if (tevent_req_nomem(state->out_mem_ctx, req)) {
11144                 return tevent_req_post(req, ev);
11145         }
11146
11147         /* make a temporary copy, that we pass to the dispatch function */
11148         state->tmp = state->orig;
11149
11150         subreq = cli->dispatch_send(state, ev, cli,
11151                                     &ndr_table_spoolss,
11152                                     NDR_SPOOLSS_ROUTERREPLYPRINTEREX,
11153                                     &state->tmp);
11154         if (tevent_req_nomem(subreq, req)) {
11155                 return tevent_req_post(req, ev);
11156         }
11157         tevent_req_set_callback(subreq, rpccli_spoolss_RouterReplyPrinterEx_done, req);
11158         return req;
11159 }
11160
11161 static void rpccli_spoolss_RouterReplyPrinterEx_done(struct tevent_req *subreq)
11162 {
11163         struct tevent_req *req = tevent_req_callback_data(
11164                 subreq, struct tevent_req);
11165         struct rpccli_spoolss_RouterReplyPrinterEx_state *state = tevent_req_data(
11166                 req, struct rpccli_spoolss_RouterReplyPrinterEx_state);
11167         NTSTATUS status;
11168         TALLOC_CTX *mem_ctx;
11169
11170         if (state->out_mem_ctx) {
11171                 mem_ctx = state->out_mem_ctx;
11172         } else {
11173                 mem_ctx = state;
11174         }
11175
11176         status = state->dispatch_recv(subreq, mem_ctx);
11177         TALLOC_FREE(subreq);
11178         if (!NT_STATUS_IS_OK(status)) {
11179                 tevent_req_nterror(req, status);
11180                 return;
11181         }
11182
11183         /* Copy out parameters */
11184         *state->orig.out.reply_result = *state->tmp.out.reply_result;
11185
11186         /* Copy result */
11187         state->orig.out.result = state->tmp.out.result;
11188
11189         /* Reset temporary structure */
11190         ZERO_STRUCT(state->tmp);
11191
11192         if (DEBUGLEVEL >= 10) {
11193                 NDR_PRINT_OUT_DEBUG(spoolss_RouterReplyPrinterEx, &state->orig);
11194         }
11195
11196         tevent_req_done(req);
11197 }
11198
11199 NTSTATUS rpccli_spoolss_RouterReplyPrinterEx_recv(struct tevent_req *req,
11200                                                   TALLOC_CTX *mem_ctx,
11201                                                   WERROR *result)
11202 {
11203         struct rpccli_spoolss_RouterReplyPrinterEx_state *state = tevent_req_data(
11204                 req, struct rpccli_spoolss_RouterReplyPrinterEx_state);
11205         NTSTATUS status;
11206
11207         if (tevent_req_is_nterror(req, &status)) {
11208                 tevent_req_received(req);
11209                 return status;
11210         }
11211
11212         /* Steal possbile out parameters to the callers context */
11213         talloc_steal(mem_ctx, state->out_mem_ctx);
11214
11215         /* Return result */
11216         *result = state->orig.out.result;
11217
11218         tevent_req_received(req);
11219         return NT_STATUS_OK;
11220 }
11221
11222 NTSTATUS rpccli_spoolss_RouterReplyPrinterEx(struct rpc_pipe_client *cli,
11223                                              TALLOC_CTX *mem_ctx,
11224                                              struct policy_handle *handle /* [in] [ref] */,
11225                                              uint32_t color /* [in]  */,
11226                                              uint32_t flags /* [in]  */,
11227                                              uint32_t *reply_result /* [out] [ref] */,
11228                                              uint32_t reply_type /* [in]  */,
11229                                              union spoolss_ReplyPrinterInfo info /* [in] [switch_is(reply_type)] */,
11230                                              WERROR *werror)
11231 {
11232         struct spoolss_RouterReplyPrinterEx r;
11233         NTSTATUS status;
11234
11235         /* In parameters */
11236         r.in.handle = handle;
11237         r.in.color = color;
11238         r.in.flags = flags;
11239         r.in.reply_type = reply_type;
11240         r.in.info = info;
11241
11242         if (DEBUGLEVEL >= 10) {
11243                 NDR_PRINT_IN_DEBUG(spoolss_RouterReplyPrinterEx, &r);
11244         }
11245
11246         status = cli->dispatch(cli,
11247                                 mem_ctx,
11248                                 &ndr_table_spoolss,
11249                                 NDR_SPOOLSS_ROUTERREPLYPRINTEREX,
11250                                 &r);
11251
11252         if (!NT_STATUS_IS_OK(status)) {
11253                 return status;
11254         }
11255
11256         if (DEBUGLEVEL >= 10) {
11257                 NDR_PRINT_OUT_DEBUG(spoolss_RouterReplyPrinterEx, &r);
11258         }
11259
11260         if (NT_STATUS_IS_ERR(status)) {
11261                 return status;
11262         }
11263
11264         /* Return variables */
11265         *reply_result = *r.out.reply_result;
11266
11267         /* Return result */
11268         if (werror) {
11269                 *werror = r.out.result;
11270         }
11271
11272         return werror_to_ntstatus(r.out.result);
11273 }
11274
11275 struct rpccli_spoolss_RouterRefreshPrinterChangeNotify_state {
11276         struct spoolss_RouterRefreshPrinterChangeNotify orig;
11277         struct spoolss_RouterRefreshPrinterChangeNotify tmp;
11278         TALLOC_CTX *out_mem_ctx;
11279         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
11280 };
11281
11282 static void rpccli_spoolss_RouterRefreshPrinterChangeNotify_done(struct tevent_req *subreq);
11283
11284 struct tevent_req *rpccli_spoolss_RouterRefreshPrinterChangeNotify_send(TALLOC_CTX *mem_ctx,
11285                                                                         struct tevent_context *ev,
11286                                                                         struct rpc_pipe_client *cli,
11287                                                                         struct policy_handle *_handle /* [in] [ref] */,
11288                                                                         uint32_t _change_low /* [in]  */,
11289                                                                         struct spoolss_NotifyOption *_options /* [in] [unique] */,
11290                                                                         struct spoolss_NotifyInfo **_info /* [out] [ref] */)
11291 {
11292         struct tevent_req *req;
11293         struct rpccli_spoolss_RouterRefreshPrinterChangeNotify_state *state;
11294         struct tevent_req *subreq;
11295
11296         req = tevent_req_create(mem_ctx, &state,
11297                                 struct rpccli_spoolss_RouterRefreshPrinterChangeNotify_state);
11298         if (req == NULL) {
11299                 return NULL;
11300         }
11301         state->out_mem_ctx = NULL;
11302         state->dispatch_recv = cli->dispatch_recv;
11303
11304         /* In parameters */
11305         state->orig.in.handle = _handle;
11306         state->orig.in.change_low = _change_low;
11307         state->orig.in.options = _options;
11308
11309         /* Out parameters */
11310         state->orig.out.info = _info;
11311
11312         /* Result */
11313         ZERO_STRUCT(state->orig.out.result);
11314
11315         if (DEBUGLEVEL >= 10) {
11316                 NDR_PRINT_IN_DEBUG(spoolss_RouterRefreshPrinterChangeNotify, &state->orig);
11317         }
11318
11319         state->out_mem_ctx = talloc_named_const(state, 0,
11320                              "rpccli_spoolss_RouterRefreshPrinterChangeNotify_out_memory");
11321         if (tevent_req_nomem(state->out_mem_ctx, req)) {
11322                 return tevent_req_post(req, ev);
11323         }
11324
11325         /* make a temporary copy, that we pass to the dispatch function */
11326         state->tmp = state->orig;
11327
11328         subreq = cli->dispatch_send(state, ev, cli,
11329                                     &ndr_table_spoolss,
11330                                     NDR_SPOOLSS_ROUTERREFRESHPRINTERCHANGENOTIFY,
11331                                     &state->tmp);
11332         if (tevent_req_nomem(subreq, req)) {
11333                 return tevent_req_post(req, ev);
11334         }
11335         tevent_req_set_callback(subreq, rpccli_spoolss_RouterRefreshPrinterChangeNotify_done, req);
11336         return req;
11337 }
11338
11339 static void rpccli_spoolss_RouterRefreshPrinterChangeNotify_done(struct tevent_req *subreq)
11340 {
11341         struct tevent_req *req = tevent_req_callback_data(
11342                 subreq, struct tevent_req);
11343         struct rpccli_spoolss_RouterRefreshPrinterChangeNotify_state *state = tevent_req_data(
11344                 req, struct rpccli_spoolss_RouterRefreshPrinterChangeNotify_state);
11345         NTSTATUS status;
11346         TALLOC_CTX *mem_ctx;
11347
11348         if (state->out_mem_ctx) {
11349                 mem_ctx = state->out_mem_ctx;
11350         } else {
11351                 mem_ctx = state;
11352         }
11353
11354         status = state->dispatch_recv(subreq, mem_ctx);
11355         TALLOC_FREE(subreq);
11356         if (!NT_STATUS_IS_OK(status)) {
11357                 tevent_req_nterror(req, status);
11358                 return;
11359         }
11360
11361         /* Copy out parameters */
11362         *state->orig.out.info = *state->tmp.out.info;
11363
11364         /* Copy result */
11365         state->orig.out.result = state->tmp.out.result;
11366
11367         /* Reset temporary structure */
11368         ZERO_STRUCT(state->tmp);
11369
11370         if (DEBUGLEVEL >= 10) {
11371                 NDR_PRINT_OUT_DEBUG(spoolss_RouterRefreshPrinterChangeNotify, &state->orig);
11372         }
11373
11374         tevent_req_done(req);
11375 }
11376
11377 NTSTATUS rpccli_spoolss_RouterRefreshPrinterChangeNotify_recv(struct tevent_req *req,
11378                                                               TALLOC_CTX *mem_ctx,
11379                                                               WERROR *result)
11380 {
11381         struct rpccli_spoolss_RouterRefreshPrinterChangeNotify_state *state = tevent_req_data(
11382                 req, struct rpccli_spoolss_RouterRefreshPrinterChangeNotify_state);
11383         NTSTATUS status;
11384
11385         if (tevent_req_is_nterror(req, &status)) {
11386                 tevent_req_received(req);
11387                 return status;
11388         }
11389
11390         /* Steal possbile out parameters to the callers context */
11391         talloc_steal(mem_ctx, state->out_mem_ctx);
11392
11393         /* Return result */
11394         *result = state->orig.out.result;
11395
11396         tevent_req_received(req);
11397         return NT_STATUS_OK;
11398 }
11399
11400 NTSTATUS rpccli_spoolss_RouterRefreshPrinterChangeNotify(struct rpc_pipe_client *cli,
11401                                                          TALLOC_CTX *mem_ctx,
11402                                                          struct policy_handle *handle /* [in] [ref] */,
11403                                                          uint32_t change_low /* [in]  */,
11404                                                          struct spoolss_NotifyOption *options /* [in] [unique] */,
11405                                                          struct spoolss_NotifyInfo **info /* [out] [ref] */,
11406                                                          WERROR *werror)
11407 {
11408         struct spoolss_RouterRefreshPrinterChangeNotify r;
11409         NTSTATUS status;
11410
11411         /* In parameters */
11412         r.in.handle = handle;
11413         r.in.change_low = change_low;
11414         r.in.options = options;
11415
11416         if (DEBUGLEVEL >= 10) {
11417                 NDR_PRINT_IN_DEBUG(spoolss_RouterRefreshPrinterChangeNotify, &r);
11418         }
11419
11420         status = cli->dispatch(cli,
11421                                 mem_ctx,
11422                                 &ndr_table_spoolss,
11423                                 NDR_SPOOLSS_ROUTERREFRESHPRINTERCHANGENOTIFY,
11424                                 &r);
11425
11426         if (!NT_STATUS_IS_OK(status)) {
11427                 return status;
11428         }
11429
11430         if (DEBUGLEVEL >= 10) {
11431                 NDR_PRINT_OUT_DEBUG(spoolss_RouterRefreshPrinterChangeNotify, &r);
11432         }
11433
11434         if (NT_STATUS_IS_ERR(status)) {
11435                 return status;
11436         }
11437
11438         /* Return variables */
11439         *info = *r.out.info;
11440
11441         /* Return result */
11442         if (werror) {
11443                 *werror = r.out.result;
11444         }
11445
11446         return werror_to_ntstatus(r.out.result);
11447 }
11448
11449 struct rpccli_spoolss_44_state {
11450         struct spoolss_44 orig;
11451         struct spoolss_44 tmp;
11452         TALLOC_CTX *out_mem_ctx;
11453         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
11454 };
11455
11456 static void rpccli_spoolss_44_done(struct tevent_req *subreq);
11457
11458 struct tevent_req *rpccli_spoolss_44_send(TALLOC_CTX *mem_ctx,
11459                                           struct tevent_context *ev,
11460                                           struct rpc_pipe_client *cli)
11461 {
11462         struct tevent_req *req;
11463         struct rpccli_spoolss_44_state *state;
11464         struct tevent_req *subreq;
11465
11466         req = tevent_req_create(mem_ctx, &state,
11467                                 struct rpccli_spoolss_44_state);
11468         if (req == NULL) {
11469                 return NULL;
11470         }
11471         state->out_mem_ctx = NULL;
11472         state->dispatch_recv = cli->dispatch_recv;
11473
11474         /* In parameters */
11475
11476         /* Out parameters */
11477
11478         /* Result */
11479         ZERO_STRUCT(state->orig.out.result);
11480
11481         if (DEBUGLEVEL >= 10) {
11482                 NDR_PRINT_IN_DEBUG(spoolss_44, &state->orig);
11483         }
11484
11485         /* make a temporary copy, that we pass to the dispatch function */
11486         state->tmp = state->orig;
11487
11488         subreq = cli->dispatch_send(state, ev, cli,
11489                                     &ndr_table_spoolss,
11490                                     NDR_SPOOLSS_44,
11491                                     &state->tmp);
11492         if (tevent_req_nomem(subreq, req)) {
11493                 return tevent_req_post(req, ev);
11494         }
11495         tevent_req_set_callback(subreq, rpccli_spoolss_44_done, req);
11496         return req;
11497 }
11498
11499 static void rpccli_spoolss_44_done(struct tevent_req *subreq)
11500 {
11501         struct tevent_req *req = tevent_req_callback_data(
11502                 subreq, struct tevent_req);
11503         struct rpccli_spoolss_44_state *state = tevent_req_data(
11504                 req, struct rpccli_spoolss_44_state);
11505         NTSTATUS status;
11506         TALLOC_CTX *mem_ctx;
11507
11508         if (state->out_mem_ctx) {
11509                 mem_ctx = state->out_mem_ctx;
11510         } else {
11511                 mem_ctx = state;
11512         }
11513
11514         status = state->dispatch_recv(subreq, mem_ctx);
11515         TALLOC_FREE(subreq);
11516         if (!NT_STATUS_IS_OK(status)) {
11517                 tevent_req_nterror(req, status);
11518                 return;
11519         }
11520
11521         /* Copy out parameters */
11522
11523         /* Copy result */
11524         state->orig.out.result = state->tmp.out.result;
11525
11526         /* Reset temporary structure */
11527         ZERO_STRUCT(state->tmp);
11528
11529         if (DEBUGLEVEL >= 10) {
11530                 NDR_PRINT_OUT_DEBUG(spoolss_44, &state->orig);
11531         }
11532
11533         tevent_req_done(req);
11534 }
11535
11536 NTSTATUS rpccli_spoolss_44_recv(struct tevent_req *req,
11537                                 TALLOC_CTX *mem_ctx,
11538                                 WERROR *result)
11539 {
11540         struct rpccli_spoolss_44_state *state = tevent_req_data(
11541                 req, struct rpccli_spoolss_44_state);
11542         NTSTATUS status;
11543
11544         if (tevent_req_is_nterror(req, &status)) {
11545                 tevent_req_received(req);
11546                 return status;
11547         }
11548
11549         /* Steal possbile out parameters to the callers context */
11550         talloc_steal(mem_ctx, state->out_mem_ctx);
11551
11552         /* Return result */
11553         *result = state->orig.out.result;
11554
11555         tevent_req_received(req);
11556         return NT_STATUS_OK;
11557 }
11558
11559 NTSTATUS rpccli_spoolss_44(struct rpc_pipe_client *cli,
11560                            TALLOC_CTX *mem_ctx,
11561                            WERROR *werror)
11562 {
11563         struct spoolss_44 r;
11564         NTSTATUS status;
11565
11566         /* In parameters */
11567
11568         if (DEBUGLEVEL >= 10) {
11569                 NDR_PRINT_IN_DEBUG(spoolss_44, &r);
11570         }
11571
11572         status = cli->dispatch(cli,
11573                                 mem_ctx,
11574                                 &ndr_table_spoolss,
11575                                 NDR_SPOOLSS_44,
11576                                 &r);
11577
11578         if (!NT_STATUS_IS_OK(status)) {
11579                 return status;
11580         }
11581
11582         if (DEBUGLEVEL >= 10) {
11583                 NDR_PRINT_OUT_DEBUG(spoolss_44, &r);
11584         }
11585
11586         if (NT_STATUS_IS_ERR(status)) {
11587                 return status;
11588         }
11589
11590         /* Return variables */
11591
11592         /* Return result */
11593         if (werror) {
11594                 *werror = r.out.result;
11595         }
11596
11597         return werror_to_ntstatus(r.out.result);
11598 }
11599
11600 struct rpccli_spoolss_OpenPrinterEx_state {
11601         struct spoolss_OpenPrinterEx orig;
11602         struct spoolss_OpenPrinterEx tmp;
11603         TALLOC_CTX *out_mem_ctx;
11604         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
11605 };
11606
11607 static void rpccli_spoolss_OpenPrinterEx_done(struct tevent_req *subreq);
11608
11609 struct tevent_req *rpccli_spoolss_OpenPrinterEx_send(TALLOC_CTX *mem_ctx,
11610                                                      struct tevent_context *ev,
11611                                                      struct rpc_pipe_client *cli,
11612                                                      const char *_printername /* [in] [unique,charset(UTF16)] */,
11613                                                      const char *_datatype /* [in] [unique,charset(UTF16)] */,
11614                                                      struct spoolss_DevmodeContainer _devmode_ctr /* [in]  */,
11615                                                      uint32_t _access_mask /* [in]  */,
11616                                                      uint32_t _level /* [in]  */,
11617                                                      union spoolss_UserLevel _userlevel /* [in] [switch_is(level)] */,
11618                                                      struct policy_handle *_handle /* [out] [ref] */)
11619 {
11620         struct tevent_req *req;
11621         struct rpccli_spoolss_OpenPrinterEx_state *state;
11622         struct tevent_req *subreq;
11623
11624         req = tevent_req_create(mem_ctx, &state,
11625                                 struct rpccli_spoolss_OpenPrinterEx_state);
11626         if (req == NULL) {
11627                 return NULL;
11628         }
11629         state->out_mem_ctx = NULL;
11630         state->dispatch_recv = cli->dispatch_recv;
11631
11632         /* In parameters */
11633         state->orig.in.printername = _printername;
11634         state->orig.in.datatype = _datatype;
11635         state->orig.in.devmode_ctr = _devmode_ctr;
11636         state->orig.in.access_mask = _access_mask;
11637         state->orig.in.level = _level;
11638         state->orig.in.userlevel = _userlevel;
11639
11640         /* Out parameters */
11641         state->orig.out.handle = _handle;
11642
11643         /* Result */
11644         ZERO_STRUCT(state->orig.out.result);
11645
11646         if (DEBUGLEVEL >= 10) {
11647                 NDR_PRINT_IN_DEBUG(spoolss_OpenPrinterEx, &state->orig);
11648         }
11649
11650         state->out_mem_ctx = talloc_named_const(state, 0,
11651                              "rpccli_spoolss_OpenPrinterEx_out_memory");
11652         if (tevent_req_nomem(state->out_mem_ctx, req)) {
11653                 return tevent_req_post(req, ev);
11654         }
11655
11656         /* make a temporary copy, that we pass to the dispatch function */
11657         state->tmp = state->orig;
11658
11659         subreq = cli->dispatch_send(state, ev, cli,
11660                                     &ndr_table_spoolss,
11661                                     NDR_SPOOLSS_OPENPRINTEREX,
11662                                     &state->tmp);
11663         if (tevent_req_nomem(subreq, req)) {
11664                 return tevent_req_post(req, ev);
11665         }
11666         tevent_req_set_callback(subreq, rpccli_spoolss_OpenPrinterEx_done, req);
11667         return req;
11668 }
11669
11670 static void rpccli_spoolss_OpenPrinterEx_done(struct tevent_req *subreq)
11671 {
11672         struct tevent_req *req = tevent_req_callback_data(
11673                 subreq, struct tevent_req);
11674         struct rpccli_spoolss_OpenPrinterEx_state *state = tevent_req_data(
11675                 req, struct rpccli_spoolss_OpenPrinterEx_state);
11676         NTSTATUS status;
11677         TALLOC_CTX *mem_ctx;
11678
11679         if (state->out_mem_ctx) {
11680                 mem_ctx = state->out_mem_ctx;
11681         } else {
11682                 mem_ctx = state;
11683         }
11684
11685         status = state->dispatch_recv(subreq, mem_ctx);
11686         TALLOC_FREE(subreq);
11687         if (!NT_STATUS_IS_OK(status)) {
11688                 tevent_req_nterror(req, status);
11689                 return;
11690         }
11691
11692         /* Copy out parameters */
11693         *state->orig.out.handle = *state->tmp.out.handle;
11694
11695         /* Copy result */
11696         state->orig.out.result = state->tmp.out.result;
11697
11698         /* Reset temporary structure */
11699         ZERO_STRUCT(state->tmp);
11700
11701         if (DEBUGLEVEL >= 10) {
11702                 NDR_PRINT_OUT_DEBUG(spoolss_OpenPrinterEx, &state->orig);
11703         }
11704
11705         tevent_req_done(req);
11706 }
11707
11708 NTSTATUS rpccli_spoolss_OpenPrinterEx_recv(struct tevent_req *req,
11709                                            TALLOC_CTX *mem_ctx,
11710                                            WERROR *result)
11711 {
11712         struct rpccli_spoolss_OpenPrinterEx_state *state = tevent_req_data(
11713                 req, struct rpccli_spoolss_OpenPrinterEx_state);
11714         NTSTATUS status;
11715
11716         if (tevent_req_is_nterror(req, &status)) {
11717                 tevent_req_received(req);
11718                 return status;
11719         }
11720
11721         /* Steal possbile out parameters to the callers context */
11722         talloc_steal(mem_ctx, state->out_mem_ctx);
11723
11724         /* Return result */
11725         *result = state->orig.out.result;
11726
11727         tevent_req_received(req);
11728         return NT_STATUS_OK;
11729 }
11730
11731 NTSTATUS rpccli_spoolss_OpenPrinterEx(struct rpc_pipe_client *cli,
11732                                       TALLOC_CTX *mem_ctx,
11733                                       const char *printername /* [in] [unique,charset(UTF16)] */,
11734                                       const char *datatype /* [in] [unique,charset(UTF16)] */,
11735                                       struct spoolss_DevmodeContainer devmode_ctr /* [in]  */,
11736                                       uint32_t access_mask /* [in]  */,
11737                                       uint32_t level /* [in]  */,
11738                                       union spoolss_UserLevel userlevel /* [in] [switch_is(level)] */,
11739                                       struct policy_handle *handle /* [out] [ref] */,
11740                                       WERROR *werror)
11741 {
11742         struct spoolss_OpenPrinterEx r;
11743         NTSTATUS status;
11744
11745         /* In parameters */
11746         r.in.printername = printername;
11747         r.in.datatype = datatype;
11748         r.in.devmode_ctr = devmode_ctr;
11749         r.in.access_mask = access_mask;
11750         r.in.level = level;
11751         r.in.userlevel = userlevel;
11752
11753         if (DEBUGLEVEL >= 10) {
11754                 NDR_PRINT_IN_DEBUG(spoolss_OpenPrinterEx, &r);
11755         }
11756
11757         status = cli->dispatch(cli,
11758                                 mem_ctx,
11759                                 &ndr_table_spoolss,
11760                                 NDR_SPOOLSS_OPENPRINTEREX,
11761                                 &r);
11762
11763         if (!NT_STATUS_IS_OK(status)) {
11764                 return status;
11765         }
11766
11767         if (DEBUGLEVEL >= 10) {
11768                 NDR_PRINT_OUT_DEBUG(spoolss_OpenPrinterEx, &r);
11769         }
11770
11771         if (NT_STATUS_IS_ERR(status)) {
11772                 return status;
11773         }
11774
11775         /* Return variables */
11776         *handle = *r.out.handle;
11777
11778         /* Return result */
11779         if (werror) {
11780                 *werror = r.out.result;
11781         }
11782
11783         return werror_to_ntstatus(r.out.result);
11784 }
11785
11786 struct rpccli_spoolss_AddPrinterEx_state {
11787         struct spoolss_AddPrinterEx orig;
11788         struct spoolss_AddPrinterEx tmp;
11789         TALLOC_CTX *out_mem_ctx;
11790         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
11791 };
11792
11793 static void rpccli_spoolss_AddPrinterEx_done(struct tevent_req *subreq);
11794
11795 struct tevent_req *rpccli_spoolss_AddPrinterEx_send(TALLOC_CTX *mem_ctx,
11796                                                     struct tevent_context *ev,
11797                                                     struct rpc_pipe_client *cli,
11798                                                     const char *_server /* [in] [unique,charset(UTF16)] */,
11799                                                     struct spoolss_SetPrinterInfoCtr *_info_ctr /* [in] [ref] */,
11800                                                     struct spoolss_DevmodeContainer *_devmode_ctr /* [in] [ref] */,
11801                                                     struct sec_desc_buf *_secdesc_ctr /* [in] [ref] */,
11802                                                     struct spoolss_UserLevelCtr *_userlevel_ctr /* [in] [ref] */,
11803                                                     struct policy_handle *_handle /* [out] [ref] */)
11804 {
11805         struct tevent_req *req;
11806         struct rpccli_spoolss_AddPrinterEx_state *state;
11807         struct tevent_req *subreq;
11808
11809         req = tevent_req_create(mem_ctx, &state,
11810                                 struct rpccli_spoolss_AddPrinterEx_state);
11811         if (req == NULL) {
11812                 return NULL;
11813         }
11814         state->out_mem_ctx = NULL;
11815         state->dispatch_recv = cli->dispatch_recv;
11816
11817         /* In parameters */
11818         state->orig.in.server = _server;
11819         state->orig.in.info_ctr = _info_ctr;
11820         state->orig.in.devmode_ctr = _devmode_ctr;
11821         state->orig.in.secdesc_ctr = _secdesc_ctr;
11822         state->orig.in.userlevel_ctr = _userlevel_ctr;
11823
11824         /* Out parameters */
11825         state->orig.out.handle = _handle;
11826
11827         /* Result */
11828         ZERO_STRUCT(state->orig.out.result);
11829
11830         if (DEBUGLEVEL >= 10) {
11831                 NDR_PRINT_IN_DEBUG(spoolss_AddPrinterEx, &state->orig);
11832         }
11833
11834         state->out_mem_ctx = talloc_named_const(state, 0,
11835                              "rpccli_spoolss_AddPrinterEx_out_memory");
11836         if (tevent_req_nomem(state->out_mem_ctx, req)) {
11837                 return tevent_req_post(req, ev);
11838         }
11839
11840         /* make a temporary copy, that we pass to the dispatch function */
11841         state->tmp = state->orig;
11842
11843         subreq = cli->dispatch_send(state, ev, cli,
11844                                     &ndr_table_spoolss,
11845                                     NDR_SPOOLSS_ADDPRINTEREX,
11846                                     &state->tmp);
11847         if (tevent_req_nomem(subreq, req)) {
11848                 return tevent_req_post(req, ev);
11849         }
11850         tevent_req_set_callback(subreq, rpccli_spoolss_AddPrinterEx_done, req);
11851         return req;
11852 }
11853
11854 static void rpccli_spoolss_AddPrinterEx_done(struct tevent_req *subreq)
11855 {
11856         struct tevent_req *req = tevent_req_callback_data(
11857                 subreq, struct tevent_req);
11858         struct rpccli_spoolss_AddPrinterEx_state *state = tevent_req_data(
11859                 req, struct rpccli_spoolss_AddPrinterEx_state);
11860         NTSTATUS status;
11861         TALLOC_CTX *mem_ctx;
11862
11863         if (state->out_mem_ctx) {
11864                 mem_ctx = state->out_mem_ctx;
11865         } else {
11866                 mem_ctx = state;
11867         }
11868
11869         status = state->dispatch_recv(subreq, mem_ctx);
11870         TALLOC_FREE(subreq);
11871         if (!NT_STATUS_IS_OK(status)) {
11872                 tevent_req_nterror(req, status);
11873                 return;
11874         }
11875
11876         /* Copy out parameters */
11877         *state->orig.out.handle = *state->tmp.out.handle;
11878
11879         /* Copy result */
11880         state->orig.out.result = state->tmp.out.result;
11881
11882         /* Reset temporary structure */
11883         ZERO_STRUCT(state->tmp);
11884
11885         if (DEBUGLEVEL >= 10) {
11886                 NDR_PRINT_OUT_DEBUG(spoolss_AddPrinterEx, &state->orig);
11887         }
11888
11889         tevent_req_done(req);
11890 }
11891
11892 NTSTATUS rpccli_spoolss_AddPrinterEx_recv(struct tevent_req *req,
11893                                           TALLOC_CTX *mem_ctx,
11894                                           WERROR *result)
11895 {
11896         struct rpccli_spoolss_AddPrinterEx_state *state = tevent_req_data(
11897                 req, struct rpccli_spoolss_AddPrinterEx_state);
11898         NTSTATUS status;
11899
11900         if (tevent_req_is_nterror(req, &status)) {
11901                 tevent_req_received(req);
11902                 return status;
11903         }
11904
11905         /* Steal possbile out parameters to the callers context */
11906         talloc_steal(mem_ctx, state->out_mem_ctx);
11907
11908         /* Return result */
11909         *result = state->orig.out.result;
11910
11911         tevent_req_received(req);
11912         return NT_STATUS_OK;
11913 }
11914
11915 NTSTATUS rpccli_spoolss_AddPrinterEx(struct rpc_pipe_client *cli,
11916                                      TALLOC_CTX *mem_ctx,
11917                                      const char *server /* [in] [unique,charset(UTF16)] */,
11918                                      struct spoolss_SetPrinterInfoCtr *info_ctr /* [in] [ref] */,
11919                                      struct spoolss_DevmodeContainer *devmode_ctr /* [in] [ref] */,
11920                                      struct sec_desc_buf *secdesc_ctr /* [in] [ref] */,
11921                                      struct spoolss_UserLevelCtr *userlevel_ctr /* [in] [ref] */,
11922                                      struct policy_handle *handle /* [out] [ref] */,
11923                                      WERROR *werror)
11924 {
11925         struct spoolss_AddPrinterEx r;
11926         NTSTATUS status;
11927
11928         /* In parameters */
11929         r.in.server = server;
11930         r.in.info_ctr = info_ctr;
11931         r.in.devmode_ctr = devmode_ctr;
11932         r.in.secdesc_ctr = secdesc_ctr;
11933         r.in.userlevel_ctr = userlevel_ctr;
11934
11935         if (DEBUGLEVEL >= 10) {
11936                 NDR_PRINT_IN_DEBUG(spoolss_AddPrinterEx, &r);
11937         }
11938
11939         status = cli->dispatch(cli,
11940                                 mem_ctx,
11941                                 &ndr_table_spoolss,
11942                                 NDR_SPOOLSS_ADDPRINTEREX,
11943                                 &r);
11944
11945         if (!NT_STATUS_IS_OK(status)) {
11946                 return status;
11947         }
11948
11949         if (DEBUGLEVEL >= 10) {
11950                 NDR_PRINT_OUT_DEBUG(spoolss_AddPrinterEx, &r);
11951         }
11952
11953         if (NT_STATUS_IS_ERR(status)) {
11954                 return status;
11955         }
11956
11957         /* Return variables */
11958         *handle = *r.out.handle;
11959
11960         /* Return result */
11961         if (werror) {
11962                 *werror = r.out.result;
11963         }
11964
11965         return werror_to_ntstatus(r.out.result);
11966 }
11967
11968 struct rpccli_spoolss_47_state {
11969         struct spoolss_47 orig;
11970         struct spoolss_47 tmp;
11971         TALLOC_CTX *out_mem_ctx;
11972         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
11973 };
11974
11975 static void rpccli_spoolss_47_done(struct tevent_req *subreq);
11976
11977 struct tevent_req *rpccli_spoolss_47_send(TALLOC_CTX *mem_ctx,
11978                                           struct tevent_context *ev,
11979                                           struct rpc_pipe_client *cli)
11980 {
11981         struct tevent_req *req;
11982         struct rpccli_spoolss_47_state *state;
11983         struct tevent_req *subreq;
11984
11985         req = tevent_req_create(mem_ctx, &state,
11986                                 struct rpccli_spoolss_47_state);
11987         if (req == NULL) {
11988                 return NULL;
11989         }
11990         state->out_mem_ctx = NULL;
11991         state->dispatch_recv = cli->dispatch_recv;
11992
11993         /* In parameters */
11994
11995         /* Out parameters */
11996
11997         /* Result */
11998         ZERO_STRUCT(state->orig.out.result);
11999
12000         if (DEBUGLEVEL >= 10) {
12001                 NDR_PRINT_IN_DEBUG(spoolss_47, &state->orig);
12002         }
12003
12004         /* make a temporary copy, that we pass to the dispatch function */
12005         state->tmp = state->orig;
12006
12007         subreq = cli->dispatch_send(state, ev, cli,
12008                                     &ndr_table_spoolss,
12009                                     NDR_SPOOLSS_47,
12010                                     &state->tmp);
12011         if (tevent_req_nomem(subreq, req)) {
12012                 return tevent_req_post(req, ev);
12013         }
12014         tevent_req_set_callback(subreq, rpccli_spoolss_47_done, req);
12015         return req;
12016 }
12017
12018 static void rpccli_spoolss_47_done(struct tevent_req *subreq)
12019 {
12020         struct tevent_req *req = tevent_req_callback_data(
12021                 subreq, struct tevent_req);
12022         struct rpccli_spoolss_47_state *state = tevent_req_data(
12023                 req, struct rpccli_spoolss_47_state);
12024         NTSTATUS status;
12025         TALLOC_CTX *mem_ctx;
12026
12027         if (state->out_mem_ctx) {
12028                 mem_ctx = state->out_mem_ctx;
12029         } else {
12030                 mem_ctx = state;
12031         }
12032
12033         status = state->dispatch_recv(subreq, mem_ctx);
12034         TALLOC_FREE(subreq);
12035         if (!NT_STATUS_IS_OK(status)) {
12036                 tevent_req_nterror(req, status);
12037                 return;
12038         }
12039
12040         /* Copy out parameters */
12041
12042         /* Copy result */
12043         state->orig.out.result = state->tmp.out.result;
12044
12045         /* Reset temporary structure */
12046         ZERO_STRUCT(state->tmp);
12047
12048         if (DEBUGLEVEL >= 10) {
12049                 NDR_PRINT_OUT_DEBUG(spoolss_47, &state->orig);
12050         }
12051
12052         tevent_req_done(req);
12053 }
12054
12055 NTSTATUS rpccli_spoolss_47_recv(struct tevent_req *req,
12056                                 TALLOC_CTX *mem_ctx,
12057                                 WERROR *result)
12058 {
12059         struct rpccli_spoolss_47_state *state = tevent_req_data(
12060                 req, struct rpccli_spoolss_47_state);
12061         NTSTATUS status;
12062
12063         if (tevent_req_is_nterror(req, &status)) {
12064                 tevent_req_received(req);
12065                 return status;
12066         }
12067
12068         /* Steal possbile out parameters to the callers context */
12069         talloc_steal(mem_ctx, state->out_mem_ctx);
12070
12071         /* Return result */
12072         *result = state->orig.out.result;
12073
12074         tevent_req_received(req);
12075         return NT_STATUS_OK;
12076 }
12077
12078 NTSTATUS rpccli_spoolss_47(struct rpc_pipe_client *cli,
12079                            TALLOC_CTX *mem_ctx,
12080                            WERROR *werror)
12081 {
12082         struct spoolss_47 r;
12083         NTSTATUS status;
12084
12085         /* In parameters */
12086
12087         if (DEBUGLEVEL >= 10) {
12088                 NDR_PRINT_IN_DEBUG(spoolss_47, &r);
12089         }
12090
12091         status = cli->dispatch(cli,
12092                                 mem_ctx,
12093                                 &ndr_table_spoolss,
12094                                 NDR_SPOOLSS_47,
12095                                 &r);
12096
12097         if (!NT_STATUS_IS_OK(status)) {
12098                 return status;
12099         }
12100
12101         if (DEBUGLEVEL >= 10) {
12102                 NDR_PRINT_OUT_DEBUG(spoolss_47, &r);
12103         }
12104
12105         if (NT_STATUS_IS_ERR(status)) {
12106                 return status;
12107         }
12108
12109         /* Return variables */
12110
12111         /* Return result */
12112         if (werror) {
12113                 *werror = r.out.result;
12114         }
12115
12116         return werror_to_ntstatus(r.out.result);
12117 }
12118
12119 struct rpccli_spoolss_EnumPrinterData_state {
12120         struct spoolss_EnumPrinterData orig;
12121         struct spoolss_EnumPrinterData tmp;
12122         TALLOC_CTX *out_mem_ctx;
12123         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
12124 };
12125
12126 static void rpccli_spoolss_EnumPrinterData_done(struct tevent_req *subreq);
12127
12128 struct tevent_req *rpccli_spoolss_EnumPrinterData_send(TALLOC_CTX *mem_ctx,
12129                                                        struct tevent_context *ev,
12130                                                        struct rpc_pipe_client *cli,
12131                                                        struct policy_handle *_handle /* [in] [ref] */,
12132                                                        uint32_t _enum_index /* [in]  */,
12133                                                        const char *_value_name /* [out] [charset(UTF16),size_is(value_offered/2)] */,
12134                                                        uint32_t _value_offered /* [in]  */,
12135                                                        uint32_t *_value_needed /* [out] [ref] */,
12136                                                        enum winreg_Type *_type /* [out] [ref] */,
12137                                                        uint8_t *_data /* [out] [ref,flag(LIBNDR_PRINT_ARRAY_HEX),size_is(data_offered)] */,
12138                                                        uint32_t _data_offered /* [in]  */,
12139                                                        uint32_t *_data_needed /* [out] [ref] */)
12140 {
12141         struct tevent_req *req;
12142         struct rpccli_spoolss_EnumPrinterData_state *state;
12143         struct tevent_req *subreq;
12144
12145         req = tevent_req_create(mem_ctx, &state,
12146                                 struct rpccli_spoolss_EnumPrinterData_state);
12147         if (req == NULL) {
12148                 return NULL;
12149         }
12150         state->out_mem_ctx = NULL;
12151         state->dispatch_recv = cli->dispatch_recv;
12152
12153         /* In parameters */
12154         state->orig.in.handle = _handle;
12155         state->orig.in.enum_index = _enum_index;
12156         state->orig.in.value_offered = _value_offered;
12157         state->orig.in.data_offered = _data_offered;
12158
12159         /* Out parameters */
12160         state->orig.out.value_name = _value_name;
12161         state->orig.out.value_needed = _value_needed;
12162         state->orig.out.type = _type;
12163         state->orig.out.data = _data;
12164         state->orig.out.data_needed = _data_needed;
12165
12166         /* Result */
12167         ZERO_STRUCT(state->orig.out.result);
12168
12169         if (DEBUGLEVEL >= 10) {
12170                 NDR_PRINT_IN_DEBUG(spoolss_EnumPrinterData, &state->orig);
12171         }
12172
12173         state->out_mem_ctx = talloc_named_const(state, 0,
12174                              "rpccli_spoolss_EnumPrinterData_out_memory");
12175         if (tevent_req_nomem(state->out_mem_ctx, req)) {
12176                 return tevent_req_post(req, ev);
12177         }
12178
12179         /* make a temporary copy, that we pass to the dispatch function */
12180         state->tmp = state->orig;
12181
12182         subreq = cli->dispatch_send(state, ev, cli,
12183                                     &ndr_table_spoolss,
12184                                     NDR_SPOOLSS_ENUMPRINTERDATA,
12185                                     &state->tmp);
12186         if (tevent_req_nomem(subreq, req)) {
12187                 return tevent_req_post(req, ev);
12188         }
12189         tevent_req_set_callback(subreq, rpccli_spoolss_EnumPrinterData_done, req);
12190         return req;
12191 }
12192
12193 static void rpccli_spoolss_EnumPrinterData_done(struct tevent_req *subreq)
12194 {
12195         struct tevent_req *req = tevent_req_callback_data(
12196                 subreq, struct tevent_req);
12197         struct rpccli_spoolss_EnumPrinterData_state *state = tevent_req_data(
12198                 req, struct rpccli_spoolss_EnumPrinterData_state);
12199         NTSTATUS status;
12200         TALLOC_CTX *mem_ctx;
12201
12202         if (state->out_mem_ctx) {
12203                 mem_ctx = state->out_mem_ctx;
12204         } else {
12205                 mem_ctx = state;
12206         }
12207
12208         status = state->dispatch_recv(subreq, mem_ctx);
12209         TALLOC_FREE(subreq);
12210         if (!NT_STATUS_IS_OK(status)) {
12211                 tevent_req_nterror(req, status);
12212                 return;
12213         }
12214
12215         /* Copy out parameters */
12216         memcpy(CONST_DISCARD(char *, state->orig.out.value_name), state->tmp.out.value_name, state->tmp.in.value_offered / 2 * sizeof(*state->orig.out.value_name));
12217         *state->orig.out.value_needed = *state->tmp.out.value_needed;
12218         *state->orig.out.type = *state->tmp.out.type;
12219         memcpy(state->orig.out.data, state->tmp.out.data, state->tmp.in.data_offered * sizeof(*state->orig.out.data));
12220         *state->orig.out.data_needed = *state->tmp.out.data_needed;
12221
12222         /* Copy result */
12223         state->orig.out.result = state->tmp.out.result;
12224
12225         /* Reset temporary structure */
12226         ZERO_STRUCT(state->tmp);
12227
12228         if (DEBUGLEVEL >= 10) {
12229                 NDR_PRINT_OUT_DEBUG(spoolss_EnumPrinterData, &state->orig);
12230         }
12231
12232         tevent_req_done(req);
12233 }
12234
12235 NTSTATUS rpccli_spoolss_EnumPrinterData_recv(struct tevent_req *req,
12236                                              TALLOC_CTX *mem_ctx,
12237                                              WERROR *result)
12238 {
12239         struct rpccli_spoolss_EnumPrinterData_state *state = tevent_req_data(
12240                 req, struct rpccli_spoolss_EnumPrinterData_state);
12241         NTSTATUS status;
12242
12243         if (tevent_req_is_nterror(req, &status)) {
12244                 tevent_req_received(req);
12245                 return status;
12246         }
12247
12248         /* Steal possbile out parameters to the callers context */
12249         talloc_steal(mem_ctx, state->out_mem_ctx);
12250
12251         /* Return result */
12252         *result = state->orig.out.result;
12253
12254         tevent_req_received(req);
12255         return NT_STATUS_OK;
12256 }
12257
12258 NTSTATUS rpccli_spoolss_EnumPrinterData(struct rpc_pipe_client *cli,
12259                                         TALLOC_CTX *mem_ctx,
12260                                         struct policy_handle *handle /* [in] [ref] */,
12261                                         uint32_t enum_index /* [in]  */,
12262                                         const char *value_name /* [out] [charset(UTF16),size_is(value_offered/2)] */,
12263                                         uint32_t value_offered /* [in]  */,
12264                                         uint32_t *value_needed /* [out] [ref] */,
12265                                         enum winreg_Type *type /* [out] [ref] */,
12266                                         uint8_t *data /* [out] [ref,flag(LIBNDR_PRINT_ARRAY_HEX),size_is(data_offered)] */,
12267                                         uint32_t data_offered /* [in]  */,
12268                                         uint32_t *data_needed /* [out] [ref] */,
12269                                         WERROR *werror)
12270 {
12271         struct spoolss_EnumPrinterData r;
12272         NTSTATUS status;
12273
12274         /* In parameters */
12275         r.in.handle = handle;
12276         r.in.enum_index = enum_index;
12277         r.in.value_offered = value_offered;
12278         r.in.data_offered = data_offered;
12279
12280         if (DEBUGLEVEL >= 10) {
12281                 NDR_PRINT_IN_DEBUG(spoolss_EnumPrinterData, &r);
12282         }
12283
12284         status = cli->dispatch(cli,
12285                                 mem_ctx,
12286                                 &ndr_table_spoolss,
12287                                 NDR_SPOOLSS_ENUMPRINTERDATA,
12288                                 &r);
12289
12290         if (!NT_STATUS_IS_OK(status)) {
12291                 return status;
12292         }
12293
12294         if (DEBUGLEVEL >= 10) {
12295                 NDR_PRINT_OUT_DEBUG(spoolss_EnumPrinterData, &r);
12296         }
12297
12298         if (NT_STATUS_IS_ERR(status)) {
12299                 return status;
12300         }
12301
12302         /* Return variables */
12303         memcpy(CONST_DISCARD(char *, value_name), r.out.value_name, r.in.value_offered / 2 * sizeof(*value_name));
12304         *value_needed = *r.out.value_needed;
12305         *type = *r.out.type;
12306         memcpy(data, r.out.data, r.in.data_offered * sizeof(*data));
12307         *data_needed = *r.out.data_needed;
12308
12309         /* Return result */
12310         if (werror) {
12311                 *werror = r.out.result;
12312         }
12313
12314         return werror_to_ntstatus(r.out.result);
12315 }
12316
12317 struct rpccli_spoolss_DeletePrinterData_state {
12318         struct spoolss_DeletePrinterData orig;
12319         struct spoolss_DeletePrinterData tmp;
12320         TALLOC_CTX *out_mem_ctx;
12321         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
12322 };
12323
12324 static void rpccli_spoolss_DeletePrinterData_done(struct tevent_req *subreq);
12325
12326 struct tevent_req *rpccli_spoolss_DeletePrinterData_send(TALLOC_CTX *mem_ctx,
12327                                                          struct tevent_context *ev,
12328                                                          struct rpc_pipe_client *cli,
12329                                                          struct policy_handle *_handle /* [in] [ref] */,
12330                                                          const char *_value_name /* [in] [charset(UTF16)] */)
12331 {
12332         struct tevent_req *req;
12333         struct rpccli_spoolss_DeletePrinterData_state *state;
12334         struct tevent_req *subreq;
12335
12336         req = tevent_req_create(mem_ctx, &state,
12337                                 struct rpccli_spoolss_DeletePrinterData_state);
12338         if (req == NULL) {
12339                 return NULL;
12340         }
12341         state->out_mem_ctx = NULL;
12342         state->dispatch_recv = cli->dispatch_recv;
12343
12344         /* In parameters */
12345         state->orig.in.handle = _handle;
12346         state->orig.in.value_name = _value_name;
12347
12348         /* Out parameters */
12349
12350         /* Result */
12351         ZERO_STRUCT(state->orig.out.result);
12352
12353         if (DEBUGLEVEL >= 10) {
12354                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrinterData, &state->orig);
12355         }
12356
12357         /* make a temporary copy, that we pass to the dispatch function */
12358         state->tmp = state->orig;
12359
12360         subreq = cli->dispatch_send(state, ev, cli,
12361                                     &ndr_table_spoolss,
12362                                     NDR_SPOOLSS_DELETEPRINTERDATA,
12363                                     &state->tmp);
12364         if (tevent_req_nomem(subreq, req)) {
12365                 return tevent_req_post(req, ev);
12366         }
12367         tevent_req_set_callback(subreq, rpccli_spoolss_DeletePrinterData_done, req);
12368         return req;
12369 }
12370
12371 static void rpccli_spoolss_DeletePrinterData_done(struct tevent_req *subreq)
12372 {
12373         struct tevent_req *req = tevent_req_callback_data(
12374                 subreq, struct tevent_req);
12375         struct rpccli_spoolss_DeletePrinterData_state *state = tevent_req_data(
12376                 req, struct rpccli_spoolss_DeletePrinterData_state);
12377         NTSTATUS status;
12378         TALLOC_CTX *mem_ctx;
12379
12380         if (state->out_mem_ctx) {
12381                 mem_ctx = state->out_mem_ctx;
12382         } else {
12383                 mem_ctx = state;
12384         }
12385
12386         status = state->dispatch_recv(subreq, mem_ctx);
12387         TALLOC_FREE(subreq);
12388         if (!NT_STATUS_IS_OK(status)) {
12389                 tevent_req_nterror(req, status);
12390                 return;
12391         }
12392
12393         /* Copy out parameters */
12394
12395         /* Copy result */
12396         state->orig.out.result = state->tmp.out.result;
12397
12398         /* Reset temporary structure */
12399         ZERO_STRUCT(state->tmp);
12400
12401         if (DEBUGLEVEL >= 10) {
12402                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrinterData, &state->orig);
12403         }
12404
12405         tevent_req_done(req);
12406 }
12407
12408 NTSTATUS rpccli_spoolss_DeletePrinterData_recv(struct tevent_req *req,
12409                                                TALLOC_CTX *mem_ctx,
12410                                                WERROR *result)
12411 {
12412         struct rpccli_spoolss_DeletePrinterData_state *state = tevent_req_data(
12413                 req, struct rpccli_spoolss_DeletePrinterData_state);
12414         NTSTATUS status;
12415
12416         if (tevent_req_is_nterror(req, &status)) {
12417                 tevent_req_received(req);
12418                 return status;
12419         }
12420
12421         /* Steal possbile out parameters to the callers context */
12422         talloc_steal(mem_ctx, state->out_mem_ctx);
12423
12424         /* Return result */
12425         *result = state->orig.out.result;
12426
12427         tevent_req_received(req);
12428         return NT_STATUS_OK;
12429 }
12430
12431 NTSTATUS rpccli_spoolss_DeletePrinterData(struct rpc_pipe_client *cli,
12432                                           TALLOC_CTX *mem_ctx,
12433                                           struct policy_handle *handle /* [in] [ref] */,
12434                                           const char *value_name /* [in] [charset(UTF16)] */,
12435                                           WERROR *werror)
12436 {
12437         struct spoolss_DeletePrinterData r;
12438         NTSTATUS status;
12439
12440         /* In parameters */
12441         r.in.handle = handle;
12442         r.in.value_name = value_name;
12443
12444         if (DEBUGLEVEL >= 10) {
12445                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrinterData, &r);
12446         }
12447
12448         status = cli->dispatch(cli,
12449                                 mem_ctx,
12450                                 &ndr_table_spoolss,
12451                                 NDR_SPOOLSS_DELETEPRINTERDATA,
12452                                 &r);
12453
12454         if (!NT_STATUS_IS_OK(status)) {
12455                 return status;
12456         }
12457
12458         if (DEBUGLEVEL >= 10) {
12459                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrinterData, &r);
12460         }
12461
12462         if (NT_STATUS_IS_ERR(status)) {
12463                 return status;
12464         }
12465
12466         /* Return variables */
12467
12468         /* Return result */
12469         if (werror) {
12470                 *werror = r.out.result;
12471         }
12472
12473         return werror_to_ntstatus(r.out.result);
12474 }
12475
12476 struct rpccli_spoolss_4a_state {
12477         struct spoolss_4a orig;
12478         struct spoolss_4a tmp;
12479         TALLOC_CTX *out_mem_ctx;
12480         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
12481 };
12482
12483 static void rpccli_spoolss_4a_done(struct tevent_req *subreq);
12484
12485 struct tevent_req *rpccli_spoolss_4a_send(TALLOC_CTX *mem_ctx,
12486                                           struct tevent_context *ev,
12487                                           struct rpc_pipe_client *cli)
12488 {
12489         struct tevent_req *req;
12490         struct rpccli_spoolss_4a_state *state;
12491         struct tevent_req *subreq;
12492
12493         req = tevent_req_create(mem_ctx, &state,
12494                                 struct rpccli_spoolss_4a_state);
12495         if (req == NULL) {
12496                 return NULL;
12497         }
12498         state->out_mem_ctx = NULL;
12499         state->dispatch_recv = cli->dispatch_recv;
12500
12501         /* In parameters */
12502
12503         /* Out parameters */
12504
12505         /* Result */
12506         ZERO_STRUCT(state->orig.out.result);
12507
12508         if (DEBUGLEVEL >= 10) {
12509                 NDR_PRINT_IN_DEBUG(spoolss_4a, &state->orig);
12510         }
12511
12512         /* make a temporary copy, that we pass to the dispatch function */
12513         state->tmp = state->orig;
12514
12515         subreq = cli->dispatch_send(state, ev, cli,
12516                                     &ndr_table_spoolss,
12517                                     NDR_SPOOLSS_4A,
12518                                     &state->tmp);
12519         if (tevent_req_nomem(subreq, req)) {
12520                 return tevent_req_post(req, ev);
12521         }
12522         tevent_req_set_callback(subreq, rpccli_spoolss_4a_done, req);
12523         return req;
12524 }
12525
12526 static void rpccli_spoolss_4a_done(struct tevent_req *subreq)
12527 {
12528         struct tevent_req *req = tevent_req_callback_data(
12529                 subreq, struct tevent_req);
12530         struct rpccli_spoolss_4a_state *state = tevent_req_data(
12531                 req, struct rpccli_spoolss_4a_state);
12532         NTSTATUS status;
12533         TALLOC_CTX *mem_ctx;
12534
12535         if (state->out_mem_ctx) {
12536                 mem_ctx = state->out_mem_ctx;
12537         } else {
12538                 mem_ctx = state;
12539         }
12540
12541         status = state->dispatch_recv(subreq, mem_ctx);
12542         TALLOC_FREE(subreq);
12543         if (!NT_STATUS_IS_OK(status)) {
12544                 tevent_req_nterror(req, status);
12545                 return;
12546         }
12547
12548         /* Copy out parameters */
12549
12550         /* Copy result */
12551         state->orig.out.result = state->tmp.out.result;
12552
12553         /* Reset temporary structure */
12554         ZERO_STRUCT(state->tmp);
12555
12556         if (DEBUGLEVEL >= 10) {
12557                 NDR_PRINT_OUT_DEBUG(spoolss_4a, &state->orig);
12558         }
12559
12560         tevent_req_done(req);
12561 }
12562
12563 NTSTATUS rpccli_spoolss_4a_recv(struct tevent_req *req,
12564                                 TALLOC_CTX *mem_ctx,
12565                                 WERROR *result)
12566 {
12567         struct rpccli_spoolss_4a_state *state = tevent_req_data(
12568                 req, struct rpccli_spoolss_4a_state);
12569         NTSTATUS status;
12570
12571         if (tevent_req_is_nterror(req, &status)) {
12572                 tevent_req_received(req);
12573                 return status;
12574         }
12575
12576         /* Steal possbile out parameters to the callers context */
12577         talloc_steal(mem_ctx, state->out_mem_ctx);
12578
12579         /* Return result */
12580         *result = state->orig.out.result;
12581
12582         tevent_req_received(req);
12583         return NT_STATUS_OK;
12584 }
12585
12586 NTSTATUS rpccli_spoolss_4a(struct rpc_pipe_client *cli,
12587                            TALLOC_CTX *mem_ctx,
12588                            WERROR *werror)
12589 {
12590         struct spoolss_4a r;
12591         NTSTATUS status;
12592
12593         /* In parameters */
12594
12595         if (DEBUGLEVEL >= 10) {
12596                 NDR_PRINT_IN_DEBUG(spoolss_4a, &r);
12597         }
12598
12599         status = cli->dispatch(cli,
12600                                 mem_ctx,
12601                                 &ndr_table_spoolss,
12602                                 NDR_SPOOLSS_4A,
12603                                 &r);
12604
12605         if (!NT_STATUS_IS_OK(status)) {
12606                 return status;
12607         }
12608
12609         if (DEBUGLEVEL >= 10) {
12610                 NDR_PRINT_OUT_DEBUG(spoolss_4a, &r);
12611         }
12612
12613         if (NT_STATUS_IS_ERR(status)) {
12614                 return status;
12615         }
12616
12617         /* Return variables */
12618
12619         /* Return result */
12620         if (werror) {
12621                 *werror = r.out.result;
12622         }
12623
12624         return werror_to_ntstatus(r.out.result);
12625 }
12626
12627 struct rpccli_spoolss_4b_state {
12628         struct spoolss_4b orig;
12629         struct spoolss_4b tmp;
12630         TALLOC_CTX *out_mem_ctx;
12631         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
12632 };
12633
12634 static void rpccli_spoolss_4b_done(struct tevent_req *subreq);
12635
12636 struct tevent_req *rpccli_spoolss_4b_send(TALLOC_CTX *mem_ctx,
12637                                           struct tevent_context *ev,
12638                                           struct rpc_pipe_client *cli)
12639 {
12640         struct tevent_req *req;
12641         struct rpccli_spoolss_4b_state *state;
12642         struct tevent_req *subreq;
12643
12644         req = tevent_req_create(mem_ctx, &state,
12645                                 struct rpccli_spoolss_4b_state);
12646         if (req == NULL) {
12647                 return NULL;
12648         }
12649         state->out_mem_ctx = NULL;
12650         state->dispatch_recv = cli->dispatch_recv;
12651
12652         /* In parameters */
12653
12654         /* Out parameters */
12655
12656         /* Result */
12657         ZERO_STRUCT(state->orig.out.result);
12658
12659         if (DEBUGLEVEL >= 10) {
12660                 NDR_PRINT_IN_DEBUG(spoolss_4b, &state->orig);
12661         }
12662
12663         /* make a temporary copy, that we pass to the dispatch function */
12664         state->tmp = state->orig;
12665
12666         subreq = cli->dispatch_send(state, ev, cli,
12667                                     &ndr_table_spoolss,
12668                                     NDR_SPOOLSS_4B,
12669                                     &state->tmp);
12670         if (tevent_req_nomem(subreq, req)) {
12671                 return tevent_req_post(req, ev);
12672         }
12673         tevent_req_set_callback(subreq, rpccli_spoolss_4b_done, req);
12674         return req;
12675 }
12676
12677 static void rpccli_spoolss_4b_done(struct tevent_req *subreq)
12678 {
12679         struct tevent_req *req = tevent_req_callback_data(
12680                 subreq, struct tevent_req);
12681         struct rpccli_spoolss_4b_state *state = tevent_req_data(
12682                 req, struct rpccli_spoolss_4b_state);
12683         NTSTATUS status;
12684         TALLOC_CTX *mem_ctx;
12685
12686         if (state->out_mem_ctx) {
12687                 mem_ctx = state->out_mem_ctx;
12688         } else {
12689                 mem_ctx = state;
12690         }
12691
12692         status = state->dispatch_recv(subreq, mem_ctx);
12693         TALLOC_FREE(subreq);
12694         if (!NT_STATUS_IS_OK(status)) {
12695                 tevent_req_nterror(req, status);
12696                 return;
12697         }
12698
12699         /* Copy out parameters */
12700
12701         /* Copy result */
12702         state->orig.out.result = state->tmp.out.result;
12703
12704         /* Reset temporary structure */
12705         ZERO_STRUCT(state->tmp);
12706
12707         if (DEBUGLEVEL >= 10) {
12708                 NDR_PRINT_OUT_DEBUG(spoolss_4b, &state->orig);
12709         }
12710
12711         tevent_req_done(req);
12712 }
12713
12714 NTSTATUS rpccli_spoolss_4b_recv(struct tevent_req *req,
12715                                 TALLOC_CTX *mem_ctx,
12716                                 WERROR *result)
12717 {
12718         struct rpccli_spoolss_4b_state *state = tevent_req_data(
12719                 req, struct rpccli_spoolss_4b_state);
12720         NTSTATUS status;
12721
12722         if (tevent_req_is_nterror(req, &status)) {
12723                 tevent_req_received(req);
12724                 return status;
12725         }
12726
12727         /* Steal possbile out parameters to the callers context */
12728         talloc_steal(mem_ctx, state->out_mem_ctx);
12729
12730         /* Return result */
12731         *result = state->orig.out.result;
12732
12733         tevent_req_received(req);
12734         return NT_STATUS_OK;
12735 }
12736
12737 NTSTATUS rpccli_spoolss_4b(struct rpc_pipe_client *cli,
12738                            TALLOC_CTX *mem_ctx,
12739                            WERROR *werror)
12740 {
12741         struct spoolss_4b r;
12742         NTSTATUS status;
12743
12744         /* In parameters */
12745
12746         if (DEBUGLEVEL >= 10) {
12747                 NDR_PRINT_IN_DEBUG(spoolss_4b, &r);
12748         }
12749
12750         status = cli->dispatch(cli,
12751                                 mem_ctx,
12752                                 &ndr_table_spoolss,
12753                                 NDR_SPOOLSS_4B,
12754                                 &r);
12755
12756         if (!NT_STATUS_IS_OK(status)) {
12757                 return status;
12758         }
12759
12760         if (DEBUGLEVEL >= 10) {
12761                 NDR_PRINT_OUT_DEBUG(spoolss_4b, &r);
12762         }
12763
12764         if (NT_STATUS_IS_ERR(status)) {
12765                 return status;
12766         }
12767
12768         /* Return variables */
12769
12770         /* Return result */
12771         if (werror) {
12772                 *werror = r.out.result;
12773         }
12774
12775         return werror_to_ntstatus(r.out.result);
12776 }
12777
12778 struct rpccli_spoolss_4c_state {
12779         struct spoolss_4c orig;
12780         struct spoolss_4c tmp;
12781         TALLOC_CTX *out_mem_ctx;
12782         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
12783 };
12784
12785 static void rpccli_spoolss_4c_done(struct tevent_req *subreq);
12786
12787 struct tevent_req *rpccli_spoolss_4c_send(TALLOC_CTX *mem_ctx,
12788                                           struct tevent_context *ev,
12789                                           struct rpc_pipe_client *cli)
12790 {
12791         struct tevent_req *req;
12792         struct rpccli_spoolss_4c_state *state;
12793         struct tevent_req *subreq;
12794
12795         req = tevent_req_create(mem_ctx, &state,
12796                                 struct rpccli_spoolss_4c_state);
12797         if (req == NULL) {
12798                 return NULL;
12799         }
12800         state->out_mem_ctx = NULL;
12801         state->dispatch_recv = cli->dispatch_recv;
12802
12803         /* In parameters */
12804
12805         /* Out parameters */
12806
12807         /* Result */
12808         ZERO_STRUCT(state->orig.out.result);
12809
12810         if (DEBUGLEVEL >= 10) {
12811                 NDR_PRINT_IN_DEBUG(spoolss_4c, &state->orig);
12812         }
12813
12814         /* make a temporary copy, that we pass to the dispatch function */
12815         state->tmp = state->orig;
12816
12817         subreq = cli->dispatch_send(state, ev, cli,
12818                                     &ndr_table_spoolss,
12819                                     NDR_SPOOLSS_4C,
12820                                     &state->tmp);
12821         if (tevent_req_nomem(subreq, req)) {
12822                 return tevent_req_post(req, ev);
12823         }
12824         tevent_req_set_callback(subreq, rpccli_spoolss_4c_done, req);
12825         return req;
12826 }
12827
12828 static void rpccli_spoolss_4c_done(struct tevent_req *subreq)
12829 {
12830         struct tevent_req *req = tevent_req_callback_data(
12831                 subreq, struct tevent_req);
12832         struct rpccli_spoolss_4c_state *state = tevent_req_data(
12833                 req, struct rpccli_spoolss_4c_state);
12834         NTSTATUS status;
12835         TALLOC_CTX *mem_ctx;
12836
12837         if (state->out_mem_ctx) {
12838                 mem_ctx = state->out_mem_ctx;
12839         } else {
12840                 mem_ctx = state;
12841         }
12842
12843         status = state->dispatch_recv(subreq, mem_ctx);
12844         TALLOC_FREE(subreq);
12845         if (!NT_STATUS_IS_OK(status)) {
12846                 tevent_req_nterror(req, status);
12847                 return;
12848         }
12849
12850         /* Copy out parameters */
12851
12852         /* Copy result */
12853         state->orig.out.result = state->tmp.out.result;
12854
12855         /* Reset temporary structure */
12856         ZERO_STRUCT(state->tmp);
12857
12858         if (DEBUGLEVEL >= 10) {
12859                 NDR_PRINT_OUT_DEBUG(spoolss_4c, &state->orig);
12860         }
12861
12862         tevent_req_done(req);
12863 }
12864
12865 NTSTATUS rpccli_spoolss_4c_recv(struct tevent_req *req,
12866                                 TALLOC_CTX *mem_ctx,
12867                                 WERROR *result)
12868 {
12869         struct rpccli_spoolss_4c_state *state = tevent_req_data(
12870                 req, struct rpccli_spoolss_4c_state);
12871         NTSTATUS status;
12872
12873         if (tevent_req_is_nterror(req, &status)) {
12874                 tevent_req_received(req);
12875                 return status;
12876         }
12877
12878         /* Steal possbile out parameters to the callers context */
12879         talloc_steal(mem_ctx, state->out_mem_ctx);
12880
12881         /* Return result */
12882         *result = state->orig.out.result;
12883
12884         tevent_req_received(req);
12885         return NT_STATUS_OK;
12886 }
12887
12888 NTSTATUS rpccli_spoolss_4c(struct rpc_pipe_client *cli,
12889                            TALLOC_CTX *mem_ctx,
12890                            WERROR *werror)
12891 {
12892         struct spoolss_4c r;
12893         NTSTATUS status;
12894
12895         /* In parameters */
12896
12897         if (DEBUGLEVEL >= 10) {
12898                 NDR_PRINT_IN_DEBUG(spoolss_4c, &r);
12899         }
12900
12901         status = cli->dispatch(cli,
12902                                 mem_ctx,
12903                                 &ndr_table_spoolss,
12904                                 NDR_SPOOLSS_4C,
12905                                 &r);
12906
12907         if (!NT_STATUS_IS_OK(status)) {
12908                 return status;
12909         }
12910
12911         if (DEBUGLEVEL >= 10) {
12912                 NDR_PRINT_OUT_DEBUG(spoolss_4c, &r);
12913         }
12914
12915         if (NT_STATUS_IS_ERR(status)) {
12916                 return status;
12917         }
12918
12919         /* Return variables */
12920
12921         /* Return result */
12922         if (werror) {
12923                 *werror = r.out.result;
12924         }
12925
12926         return werror_to_ntstatus(r.out.result);
12927 }
12928
12929 struct rpccli_spoolss_SetPrinterDataEx_state {
12930         struct spoolss_SetPrinterDataEx orig;
12931         struct spoolss_SetPrinterDataEx tmp;
12932         TALLOC_CTX *out_mem_ctx;
12933         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
12934 };
12935
12936 static void rpccli_spoolss_SetPrinterDataEx_done(struct tevent_req *subreq);
12937
12938 struct tevent_req *rpccli_spoolss_SetPrinterDataEx_send(TALLOC_CTX *mem_ctx,
12939                                                         struct tevent_context *ev,
12940                                                         struct rpc_pipe_client *cli,
12941                                                         struct policy_handle *_handle /* [in] [ref] */,
12942                                                         const char *_key_name /* [in] [charset(UTF16)] */,
12943                                                         const char *_value_name /* [in] [charset(UTF16)] */,
12944                                                         enum winreg_Type _type /* [in]  */,
12945                                                         uint8_t *_buffer /* [in] [ref,size_is(offered)] */,
12946                                                         uint32_t _offered /* [in]  */)
12947 {
12948         struct tevent_req *req;
12949         struct rpccli_spoolss_SetPrinterDataEx_state *state;
12950         struct tevent_req *subreq;
12951
12952         req = tevent_req_create(mem_ctx, &state,
12953                                 struct rpccli_spoolss_SetPrinterDataEx_state);
12954         if (req == NULL) {
12955                 return NULL;
12956         }
12957         state->out_mem_ctx = NULL;
12958         state->dispatch_recv = cli->dispatch_recv;
12959
12960         /* In parameters */
12961         state->orig.in.handle = _handle;
12962         state->orig.in.key_name = _key_name;
12963         state->orig.in.value_name = _value_name;
12964         state->orig.in.type = _type;
12965         state->orig.in.buffer = _buffer;
12966         state->orig.in.offered = _offered;
12967
12968         /* Out parameters */
12969
12970         /* Result */
12971         ZERO_STRUCT(state->orig.out.result);
12972
12973         if (DEBUGLEVEL >= 10) {
12974                 NDR_PRINT_IN_DEBUG(spoolss_SetPrinterDataEx, &state->orig);
12975         }
12976
12977         /* make a temporary copy, that we pass to the dispatch function */
12978         state->tmp = state->orig;
12979
12980         subreq = cli->dispatch_send(state, ev, cli,
12981                                     &ndr_table_spoolss,
12982                                     NDR_SPOOLSS_SETPRINTERDATAEX,
12983                                     &state->tmp);
12984         if (tevent_req_nomem(subreq, req)) {
12985                 return tevent_req_post(req, ev);
12986         }
12987         tevent_req_set_callback(subreq, rpccli_spoolss_SetPrinterDataEx_done, req);
12988         return req;
12989 }
12990
12991 static void rpccli_spoolss_SetPrinterDataEx_done(struct tevent_req *subreq)
12992 {
12993         struct tevent_req *req = tevent_req_callback_data(
12994                 subreq, struct tevent_req);
12995         struct rpccli_spoolss_SetPrinterDataEx_state *state = tevent_req_data(
12996                 req, struct rpccli_spoolss_SetPrinterDataEx_state);
12997         NTSTATUS status;
12998         TALLOC_CTX *mem_ctx;
12999
13000         if (state->out_mem_ctx) {
13001                 mem_ctx = state->out_mem_ctx;
13002         } else {
13003                 mem_ctx = state;
13004         }
13005
13006         status = state->dispatch_recv(subreq, mem_ctx);
13007         TALLOC_FREE(subreq);
13008         if (!NT_STATUS_IS_OK(status)) {
13009                 tevent_req_nterror(req, status);
13010                 return;
13011         }
13012
13013         /* Copy out parameters */
13014
13015         /* Copy result */
13016         state->orig.out.result = state->tmp.out.result;
13017
13018         /* Reset temporary structure */
13019         ZERO_STRUCT(state->tmp);
13020
13021         if (DEBUGLEVEL >= 10) {
13022                 NDR_PRINT_OUT_DEBUG(spoolss_SetPrinterDataEx, &state->orig);
13023         }
13024
13025         tevent_req_done(req);
13026 }
13027
13028 NTSTATUS rpccli_spoolss_SetPrinterDataEx_recv(struct tevent_req *req,
13029                                               TALLOC_CTX *mem_ctx,
13030                                               WERROR *result)
13031 {
13032         struct rpccli_spoolss_SetPrinterDataEx_state *state = tevent_req_data(
13033                 req, struct rpccli_spoolss_SetPrinterDataEx_state);
13034         NTSTATUS status;
13035
13036         if (tevent_req_is_nterror(req, &status)) {
13037                 tevent_req_received(req);
13038                 return status;
13039         }
13040
13041         /* Steal possbile out parameters to the callers context */
13042         talloc_steal(mem_ctx, state->out_mem_ctx);
13043
13044         /* Return result */
13045         *result = state->orig.out.result;
13046
13047         tevent_req_received(req);
13048         return NT_STATUS_OK;
13049 }
13050
13051 NTSTATUS rpccli_spoolss_SetPrinterDataEx(struct rpc_pipe_client *cli,
13052                                          TALLOC_CTX *mem_ctx,
13053                                          struct policy_handle *handle /* [in] [ref] */,
13054                                          const char *key_name /* [in] [charset(UTF16)] */,
13055                                          const char *value_name /* [in] [charset(UTF16)] */,
13056                                          enum winreg_Type type /* [in]  */,
13057                                          uint8_t *buffer /* [in] [ref,size_is(offered)] */,
13058                                          uint32_t offered /* [in]  */,
13059                                          WERROR *werror)
13060 {
13061         struct spoolss_SetPrinterDataEx r;
13062         NTSTATUS status;
13063
13064         /* In parameters */
13065         r.in.handle = handle;
13066         r.in.key_name = key_name;
13067         r.in.value_name = value_name;
13068         r.in.type = type;
13069         r.in.buffer = buffer;
13070         r.in.offered = offered;
13071
13072         if (DEBUGLEVEL >= 10) {
13073                 NDR_PRINT_IN_DEBUG(spoolss_SetPrinterDataEx, &r);
13074         }
13075
13076         status = cli->dispatch(cli,
13077                                 mem_ctx,
13078                                 &ndr_table_spoolss,
13079                                 NDR_SPOOLSS_SETPRINTERDATAEX,
13080                                 &r);
13081
13082         if (!NT_STATUS_IS_OK(status)) {
13083                 return status;
13084         }
13085
13086         if (DEBUGLEVEL >= 10) {
13087                 NDR_PRINT_OUT_DEBUG(spoolss_SetPrinterDataEx, &r);
13088         }
13089
13090         if (NT_STATUS_IS_ERR(status)) {
13091                 return status;
13092         }
13093
13094         /* Return variables */
13095
13096         /* Return result */
13097         if (werror) {
13098                 *werror = r.out.result;
13099         }
13100
13101         return werror_to_ntstatus(r.out.result);
13102 }
13103
13104 struct rpccli_spoolss_GetPrinterDataEx_state {
13105         struct spoolss_GetPrinterDataEx orig;
13106         struct spoolss_GetPrinterDataEx tmp;
13107         TALLOC_CTX *out_mem_ctx;
13108         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
13109 };
13110
13111 static void rpccli_spoolss_GetPrinterDataEx_done(struct tevent_req *subreq);
13112
13113 struct tevent_req *rpccli_spoolss_GetPrinterDataEx_send(TALLOC_CTX *mem_ctx,
13114                                                         struct tevent_context *ev,
13115                                                         struct rpc_pipe_client *cli,
13116                                                         struct policy_handle *_handle /* [in] [ref] */,
13117                                                         const char *_key_name /* [in] [charset(UTF16)] */,
13118                                                         const char *_value_name /* [in] [charset(UTF16)] */,
13119                                                         enum winreg_Type *_type /* [out] [ref] */,
13120                                                         uint8_t *_buffer /* [out] [ref,size_is(offered)] */,
13121                                                         uint32_t _offered /* [in]  */,
13122                                                         uint32_t *_needed /* [out] [ref] */)
13123 {
13124         struct tevent_req *req;
13125         struct rpccli_spoolss_GetPrinterDataEx_state *state;
13126         struct tevent_req *subreq;
13127
13128         req = tevent_req_create(mem_ctx, &state,
13129                                 struct rpccli_spoolss_GetPrinterDataEx_state);
13130         if (req == NULL) {
13131                 return NULL;
13132         }
13133         state->out_mem_ctx = NULL;
13134         state->dispatch_recv = cli->dispatch_recv;
13135
13136         /* In parameters */
13137         state->orig.in.handle = _handle;
13138         state->orig.in.key_name = _key_name;
13139         state->orig.in.value_name = _value_name;
13140         state->orig.in.offered = _offered;
13141
13142         /* Out parameters */
13143         state->orig.out.type = _type;
13144         state->orig.out.buffer = _buffer;
13145         state->orig.out.needed = _needed;
13146
13147         /* Result */
13148         ZERO_STRUCT(state->orig.out.result);
13149
13150         if (DEBUGLEVEL >= 10) {
13151                 NDR_PRINT_IN_DEBUG(spoolss_GetPrinterDataEx, &state->orig);
13152         }
13153
13154         state->out_mem_ctx = talloc_named_const(state, 0,
13155                              "rpccli_spoolss_GetPrinterDataEx_out_memory");
13156         if (tevent_req_nomem(state->out_mem_ctx, req)) {
13157                 return tevent_req_post(req, ev);
13158         }
13159
13160         /* make a temporary copy, that we pass to the dispatch function */
13161         state->tmp = state->orig;
13162
13163         subreq = cli->dispatch_send(state, ev, cli,
13164                                     &ndr_table_spoolss,
13165                                     NDR_SPOOLSS_GETPRINTERDATAEX,
13166                                     &state->tmp);
13167         if (tevent_req_nomem(subreq, req)) {
13168                 return tevent_req_post(req, ev);
13169         }
13170         tevent_req_set_callback(subreq, rpccli_spoolss_GetPrinterDataEx_done, req);
13171         return req;
13172 }
13173
13174 static void rpccli_spoolss_GetPrinterDataEx_done(struct tevent_req *subreq)
13175 {
13176         struct tevent_req *req = tevent_req_callback_data(
13177                 subreq, struct tevent_req);
13178         struct rpccli_spoolss_GetPrinterDataEx_state *state = tevent_req_data(
13179                 req, struct rpccli_spoolss_GetPrinterDataEx_state);
13180         NTSTATUS status;
13181         TALLOC_CTX *mem_ctx;
13182
13183         if (state->out_mem_ctx) {
13184                 mem_ctx = state->out_mem_ctx;
13185         } else {
13186                 mem_ctx = state;
13187         }
13188
13189         status = state->dispatch_recv(subreq, mem_ctx);
13190         TALLOC_FREE(subreq);
13191         if (!NT_STATUS_IS_OK(status)) {
13192                 tevent_req_nterror(req, status);
13193                 return;
13194         }
13195
13196         /* Copy out parameters */
13197         *state->orig.out.type = *state->tmp.out.type;
13198         memcpy(state->orig.out.buffer, state->tmp.out.buffer, state->tmp.in.offered * sizeof(*state->orig.out.buffer));
13199         *state->orig.out.needed = *state->tmp.out.needed;
13200
13201         /* Copy result */
13202         state->orig.out.result = state->tmp.out.result;
13203
13204         /* Reset temporary structure */
13205         ZERO_STRUCT(state->tmp);
13206
13207         if (DEBUGLEVEL >= 10) {
13208                 NDR_PRINT_OUT_DEBUG(spoolss_GetPrinterDataEx, &state->orig);
13209         }
13210
13211         tevent_req_done(req);
13212 }
13213
13214 NTSTATUS rpccli_spoolss_GetPrinterDataEx_recv(struct tevent_req *req,
13215                                               TALLOC_CTX *mem_ctx,
13216                                               WERROR *result)
13217 {
13218         struct rpccli_spoolss_GetPrinterDataEx_state *state = tevent_req_data(
13219                 req, struct rpccli_spoolss_GetPrinterDataEx_state);
13220         NTSTATUS status;
13221
13222         if (tevent_req_is_nterror(req, &status)) {
13223                 tevent_req_received(req);
13224                 return status;
13225         }
13226
13227         /* Steal possbile out parameters to the callers context */
13228         talloc_steal(mem_ctx, state->out_mem_ctx);
13229
13230         /* Return result */
13231         *result = state->orig.out.result;
13232
13233         tevent_req_received(req);
13234         return NT_STATUS_OK;
13235 }
13236
13237 NTSTATUS rpccli_spoolss_GetPrinterDataEx(struct rpc_pipe_client *cli,
13238                                          TALLOC_CTX *mem_ctx,
13239                                          struct policy_handle *handle /* [in] [ref] */,
13240                                          const char *key_name /* [in] [charset(UTF16)] */,
13241                                          const char *value_name /* [in] [charset(UTF16)] */,
13242                                          enum winreg_Type *type /* [out] [ref] */,
13243                                          uint8_t *buffer /* [out] [ref,size_is(offered)] */,
13244                                          uint32_t offered /* [in]  */,
13245                                          uint32_t *needed /* [out] [ref] */,
13246                                          WERROR *werror)
13247 {
13248         struct spoolss_GetPrinterDataEx r;
13249         NTSTATUS status;
13250
13251         /* In parameters */
13252         r.in.handle = handle;
13253         r.in.key_name = key_name;
13254         r.in.value_name = value_name;
13255         r.in.offered = offered;
13256
13257         if (DEBUGLEVEL >= 10) {
13258                 NDR_PRINT_IN_DEBUG(spoolss_GetPrinterDataEx, &r);
13259         }
13260
13261         status = cli->dispatch(cli,
13262                                 mem_ctx,
13263                                 &ndr_table_spoolss,
13264                                 NDR_SPOOLSS_GETPRINTERDATAEX,
13265                                 &r);
13266
13267         if (!NT_STATUS_IS_OK(status)) {
13268                 return status;
13269         }
13270
13271         if (DEBUGLEVEL >= 10) {
13272                 NDR_PRINT_OUT_DEBUG(spoolss_GetPrinterDataEx, &r);
13273         }
13274
13275         if (NT_STATUS_IS_ERR(status)) {
13276                 return status;
13277         }
13278
13279         /* Return variables */
13280         *type = *r.out.type;
13281         memcpy(buffer, r.out.buffer, r.in.offered * sizeof(*buffer));
13282         *needed = *r.out.needed;
13283
13284         /* Return result */
13285         if (werror) {
13286                 *werror = r.out.result;
13287         }
13288
13289         return werror_to_ntstatus(r.out.result);
13290 }
13291
13292 struct rpccli_spoolss_EnumPrinterDataEx_state {
13293         struct spoolss_EnumPrinterDataEx orig;
13294         struct spoolss_EnumPrinterDataEx tmp;
13295         TALLOC_CTX *out_mem_ctx;
13296         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
13297 };
13298
13299 static void rpccli_spoolss_EnumPrinterDataEx_done(struct tevent_req *subreq);
13300
13301 struct tevent_req *rpccli_spoolss_EnumPrinterDataEx_send(TALLOC_CTX *mem_ctx,
13302                                                          struct tevent_context *ev,
13303                                                          struct rpc_pipe_client *cli,
13304                                                          struct policy_handle *_handle /* [in] [ref] */,
13305                                                          const char *_key_name /* [in] [charset(UTF16)] */,
13306                                                          uint32_t _offered /* [in]  */,
13307                                                          uint32_t *_count /* [out] [ref] */,
13308                                                          struct spoolss_PrinterEnumValues **_info /* [out] [ref,size_is(,*count)] */,
13309                                                          uint32_t *_needed /* [out] [ref] */)
13310 {
13311         struct tevent_req *req;
13312         struct rpccli_spoolss_EnumPrinterDataEx_state *state;
13313         struct tevent_req *subreq;
13314
13315         req = tevent_req_create(mem_ctx, &state,
13316                                 struct rpccli_spoolss_EnumPrinterDataEx_state);
13317         if (req == NULL) {
13318                 return NULL;
13319         }
13320         state->out_mem_ctx = NULL;
13321         state->dispatch_recv = cli->dispatch_recv;
13322
13323         /* In parameters */
13324         state->orig.in.handle = _handle;
13325         state->orig.in.key_name = _key_name;
13326         state->orig.in.offered = _offered;
13327
13328         /* Out parameters */
13329         state->orig.out.count = _count;
13330         state->orig.out.info = _info;
13331         state->orig.out.needed = _needed;
13332
13333         /* Result */
13334         ZERO_STRUCT(state->orig.out.result);
13335
13336         if (DEBUGLEVEL >= 10) {
13337                 NDR_PRINT_IN_DEBUG(spoolss_EnumPrinterDataEx, &state->orig);
13338         }
13339
13340         state->out_mem_ctx = talloc_named_const(state, 0,
13341                              "rpccli_spoolss_EnumPrinterDataEx_out_memory");
13342         if (tevent_req_nomem(state->out_mem_ctx, req)) {
13343                 return tevent_req_post(req, ev);
13344         }
13345
13346         /* make a temporary copy, that we pass to the dispatch function */
13347         state->tmp = state->orig;
13348
13349         subreq = cli->dispatch_send(state, ev, cli,
13350                                     &ndr_table_spoolss,
13351                                     NDR_SPOOLSS_ENUMPRINTERDATAEX,
13352                                     &state->tmp);
13353         if (tevent_req_nomem(subreq, req)) {
13354                 return tevent_req_post(req, ev);
13355         }
13356         tevent_req_set_callback(subreq, rpccli_spoolss_EnumPrinterDataEx_done, req);
13357         return req;
13358 }
13359
13360 static void rpccli_spoolss_EnumPrinterDataEx_done(struct tevent_req *subreq)
13361 {
13362         struct tevent_req *req = tevent_req_callback_data(
13363                 subreq, struct tevent_req);
13364         struct rpccli_spoolss_EnumPrinterDataEx_state *state = tevent_req_data(
13365                 req, struct rpccli_spoolss_EnumPrinterDataEx_state);
13366         NTSTATUS status;
13367         TALLOC_CTX *mem_ctx;
13368
13369         if (state->out_mem_ctx) {
13370                 mem_ctx = state->out_mem_ctx;
13371         } else {
13372                 mem_ctx = state;
13373         }
13374
13375         status = state->dispatch_recv(subreq, mem_ctx);
13376         TALLOC_FREE(subreq);
13377         if (!NT_STATUS_IS_OK(status)) {
13378                 tevent_req_nterror(req, status);
13379                 return;
13380         }
13381
13382         /* Copy out parameters */
13383         *state->orig.out.count = *state->tmp.out.count;
13384         *state->orig.out.info = *state->tmp.out.info;
13385         *state->orig.out.needed = *state->tmp.out.needed;
13386
13387         /* Copy result */
13388         state->orig.out.result = state->tmp.out.result;
13389
13390         /* Reset temporary structure */
13391         ZERO_STRUCT(state->tmp);
13392
13393         if (DEBUGLEVEL >= 10) {
13394                 NDR_PRINT_OUT_DEBUG(spoolss_EnumPrinterDataEx, &state->orig);
13395         }
13396
13397         tevent_req_done(req);
13398 }
13399
13400 NTSTATUS rpccli_spoolss_EnumPrinterDataEx_recv(struct tevent_req *req,
13401                                                TALLOC_CTX *mem_ctx,
13402                                                WERROR *result)
13403 {
13404         struct rpccli_spoolss_EnumPrinterDataEx_state *state = tevent_req_data(
13405                 req, struct rpccli_spoolss_EnumPrinterDataEx_state);
13406         NTSTATUS status;
13407
13408         if (tevent_req_is_nterror(req, &status)) {
13409                 tevent_req_received(req);
13410                 return status;
13411         }
13412
13413         /* Steal possbile out parameters to the callers context */
13414         talloc_steal(mem_ctx, state->out_mem_ctx);
13415
13416         /* Return result */
13417         *result = state->orig.out.result;
13418
13419         tevent_req_received(req);
13420         return NT_STATUS_OK;
13421 }
13422
13423 NTSTATUS rpccli_spoolss_EnumPrinterDataEx(struct rpc_pipe_client *cli,
13424                                           TALLOC_CTX *mem_ctx,
13425                                           struct policy_handle *handle /* [in] [ref] */,
13426                                           const char *key_name /* [in] [charset(UTF16)] */,
13427                                           uint32_t offered /* [in]  */,
13428                                           uint32_t *count /* [out] [ref] */,
13429                                           struct spoolss_PrinterEnumValues **info /* [out] [ref,size_is(,*count)] */,
13430                                           uint32_t *needed /* [out] [ref] */,
13431                                           WERROR *werror)
13432 {
13433         struct spoolss_EnumPrinterDataEx r;
13434         NTSTATUS status;
13435
13436         /* In parameters */
13437         r.in.handle = handle;
13438         r.in.key_name = key_name;
13439         r.in.offered = offered;
13440
13441         if (DEBUGLEVEL >= 10) {
13442                 NDR_PRINT_IN_DEBUG(spoolss_EnumPrinterDataEx, &r);
13443         }
13444
13445         status = cli->dispatch(cli,
13446                                 mem_ctx,
13447                                 &ndr_table_spoolss,
13448                                 NDR_SPOOLSS_ENUMPRINTERDATAEX,
13449                                 &r);
13450
13451         if (!NT_STATUS_IS_OK(status)) {
13452                 return status;
13453         }
13454
13455         if (DEBUGLEVEL >= 10) {
13456                 NDR_PRINT_OUT_DEBUG(spoolss_EnumPrinterDataEx, &r);
13457         }
13458
13459         if (NT_STATUS_IS_ERR(status)) {
13460                 return status;
13461         }
13462
13463         /* Return variables */
13464         *count = *r.out.count;
13465         *info = *r.out.info;
13466         *needed = *r.out.needed;
13467
13468         /* Return result */
13469         if (werror) {
13470                 *werror = r.out.result;
13471         }
13472
13473         return werror_to_ntstatus(r.out.result);
13474 }
13475
13476 struct rpccli_spoolss_EnumPrinterKey_state {
13477         struct spoolss_EnumPrinterKey orig;
13478         struct spoolss_EnumPrinterKey tmp;
13479         TALLOC_CTX *out_mem_ctx;
13480         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
13481 };
13482
13483 static void rpccli_spoolss_EnumPrinterKey_done(struct tevent_req *subreq);
13484
13485 struct tevent_req *rpccli_spoolss_EnumPrinterKey_send(TALLOC_CTX *mem_ctx,
13486                                                       struct tevent_context *ev,
13487                                                       struct rpc_pipe_client *cli,
13488                                                       struct policy_handle *_handle /* [in] [ref] */,
13489                                                       const char *_key_name /* [in] [charset(UTF16)] */,
13490                                                       const char ** *_key_buffer /* [out] [subcontext_size(offered),ref,subcontext(0),flag(LIBNDR_FLAG_STR_NULLTERM)] */,
13491                                                       uint32_t _offered /* [in]  */,
13492                                                       uint32_t *_needed /* [out] [ref] */)
13493 {
13494         struct tevent_req *req;
13495         struct rpccli_spoolss_EnumPrinterKey_state *state;
13496         struct tevent_req *subreq;
13497
13498         req = tevent_req_create(mem_ctx, &state,
13499                                 struct rpccli_spoolss_EnumPrinterKey_state);
13500         if (req == NULL) {
13501                 return NULL;
13502         }
13503         state->out_mem_ctx = NULL;
13504         state->dispatch_recv = cli->dispatch_recv;
13505
13506         /* In parameters */
13507         state->orig.in.handle = _handle;
13508         state->orig.in.key_name = _key_name;
13509         state->orig.in.offered = _offered;
13510
13511         /* Out parameters */
13512         state->orig.out.key_buffer = _key_buffer;
13513         state->orig.out.needed = _needed;
13514
13515         /* Result */
13516         ZERO_STRUCT(state->orig.out.result);
13517
13518         if (DEBUGLEVEL >= 10) {
13519                 NDR_PRINT_IN_DEBUG(spoolss_EnumPrinterKey, &state->orig);
13520         }
13521
13522         state->out_mem_ctx = talloc_named_const(state, 0,
13523                              "rpccli_spoolss_EnumPrinterKey_out_memory");
13524         if (tevent_req_nomem(state->out_mem_ctx, req)) {
13525                 return tevent_req_post(req, ev);
13526         }
13527
13528         /* make a temporary copy, that we pass to the dispatch function */
13529         state->tmp = state->orig;
13530
13531         subreq = cli->dispatch_send(state, ev, cli,
13532                                     &ndr_table_spoolss,
13533                                     NDR_SPOOLSS_ENUMPRINTERKEY,
13534                                     &state->tmp);
13535         if (tevent_req_nomem(subreq, req)) {
13536                 return tevent_req_post(req, ev);
13537         }
13538         tevent_req_set_callback(subreq, rpccli_spoolss_EnumPrinterKey_done, req);
13539         return req;
13540 }
13541
13542 static void rpccli_spoolss_EnumPrinterKey_done(struct tevent_req *subreq)
13543 {
13544         struct tevent_req *req = tevent_req_callback_data(
13545                 subreq, struct tevent_req);
13546         struct rpccli_spoolss_EnumPrinterKey_state *state = tevent_req_data(
13547                 req, struct rpccli_spoolss_EnumPrinterKey_state);
13548         NTSTATUS status;
13549         TALLOC_CTX *mem_ctx;
13550
13551         if (state->out_mem_ctx) {
13552                 mem_ctx = state->out_mem_ctx;
13553         } else {
13554                 mem_ctx = state;
13555         }
13556
13557         status = state->dispatch_recv(subreq, mem_ctx);
13558         TALLOC_FREE(subreq);
13559         if (!NT_STATUS_IS_OK(status)) {
13560                 tevent_req_nterror(req, status);
13561                 return;
13562         }
13563
13564         /* Copy out parameters */
13565         *state->orig.out.key_buffer = *state->tmp.out.key_buffer;
13566         *state->orig.out.needed = *state->tmp.out.needed;
13567
13568         /* Copy result */
13569         state->orig.out.result = state->tmp.out.result;
13570
13571         /* Reset temporary structure */
13572         ZERO_STRUCT(state->tmp);
13573
13574         if (DEBUGLEVEL >= 10) {
13575                 NDR_PRINT_OUT_DEBUG(spoolss_EnumPrinterKey, &state->orig);
13576         }
13577
13578         tevent_req_done(req);
13579 }
13580
13581 NTSTATUS rpccli_spoolss_EnumPrinterKey_recv(struct tevent_req *req,
13582                                             TALLOC_CTX *mem_ctx,
13583                                             WERROR *result)
13584 {
13585         struct rpccli_spoolss_EnumPrinterKey_state *state = tevent_req_data(
13586                 req, struct rpccli_spoolss_EnumPrinterKey_state);
13587         NTSTATUS status;
13588
13589         if (tevent_req_is_nterror(req, &status)) {
13590                 tevent_req_received(req);
13591                 return status;
13592         }
13593
13594         /* Steal possbile out parameters to the callers context */
13595         talloc_steal(mem_ctx, state->out_mem_ctx);
13596
13597         /* Return result */
13598         *result = state->orig.out.result;
13599
13600         tevent_req_received(req);
13601         return NT_STATUS_OK;
13602 }
13603
13604 NTSTATUS rpccli_spoolss_EnumPrinterKey(struct rpc_pipe_client *cli,
13605                                        TALLOC_CTX *mem_ctx,
13606                                        struct policy_handle *handle /* [in] [ref] */,
13607                                        const char *key_name /* [in] [charset(UTF16)] */,
13608                                        const char ** *key_buffer /* [out] [subcontext_size(offered),ref,subcontext(0),flag(LIBNDR_FLAG_STR_NULLTERM)] */,
13609                                        uint32_t offered /* [in]  */,
13610                                        uint32_t *needed /* [out] [ref] */,
13611                                        WERROR *werror)
13612 {
13613         struct spoolss_EnumPrinterKey r;
13614         NTSTATUS status;
13615
13616         /* In parameters */
13617         r.in.handle = handle;
13618         r.in.key_name = key_name;
13619         r.in.offered = offered;
13620
13621         if (DEBUGLEVEL >= 10) {
13622                 NDR_PRINT_IN_DEBUG(spoolss_EnumPrinterKey, &r);
13623         }
13624
13625         status = cli->dispatch(cli,
13626                                 mem_ctx,
13627                                 &ndr_table_spoolss,
13628                                 NDR_SPOOLSS_ENUMPRINTERKEY,
13629                                 &r);
13630
13631         if (!NT_STATUS_IS_OK(status)) {
13632                 return status;
13633         }
13634
13635         if (DEBUGLEVEL >= 10) {
13636                 NDR_PRINT_OUT_DEBUG(spoolss_EnumPrinterKey, &r);
13637         }
13638
13639         if (NT_STATUS_IS_ERR(status)) {
13640                 return status;
13641         }
13642
13643         /* Return variables */
13644         *key_buffer = *r.out.key_buffer;
13645         *needed = *r.out.needed;
13646
13647         /* Return result */
13648         if (werror) {
13649                 *werror = r.out.result;
13650         }
13651
13652         return werror_to_ntstatus(r.out.result);
13653 }
13654
13655 struct rpccli_spoolss_DeletePrinterDataEx_state {
13656         struct spoolss_DeletePrinterDataEx orig;
13657         struct spoolss_DeletePrinterDataEx tmp;
13658         TALLOC_CTX *out_mem_ctx;
13659         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
13660 };
13661
13662 static void rpccli_spoolss_DeletePrinterDataEx_done(struct tevent_req *subreq);
13663
13664 struct tevent_req *rpccli_spoolss_DeletePrinterDataEx_send(TALLOC_CTX *mem_ctx,
13665                                                            struct tevent_context *ev,
13666                                                            struct rpc_pipe_client *cli,
13667                                                            struct policy_handle *_handle /* [in] [ref] */,
13668                                                            const char *_key_name /* [in] [charset(UTF16)] */,
13669                                                            const char *_value_name /* [in] [charset(UTF16)] */)
13670 {
13671         struct tevent_req *req;
13672         struct rpccli_spoolss_DeletePrinterDataEx_state *state;
13673         struct tevent_req *subreq;
13674
13675         req = tevent_req_create(mem_ctx, &state,
13676                                 struct rpccli_spoolss_DeletePrinterDataEx_state);
13677         if (req == NULL) {
13678                 return NULL;
13679         }
13680         state->out_mem_ctx = NULL;
13681         state->dispatch_recv = cli->dispatch_recv;
13682
13683         /* In parameters */
13684         state->orig.in.handle = _handle;
13685         state->orig.in.key_name = _key_name;
13686         state->orig.in.value_name = _value_name;
13687
13688         /* Out parameters */
13689
13690         /* Result */
13691         ZERO_STRUCT(state->orig.out.result);
13692
13693         if (DEBUGLEVEL >= 10) {
13694                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrinterDataEx, &state->orig);
13695         }
13696
13697         /* make a temporary copy, that we pass to the dispatch function */
13698         state->tmp = state->orig;
13699
13700         subreq = cli->dispatch_send(state, ev, cli,
13701                                     &ndr_table_spoolss,
13702                                     NDR_SPOOLSS_DELETEPRINTERDATAEX,
13703                                     &state->tmp);
13704         if (tevent_req_nomem(subreq, req)) {
13705                 return tevent_req_post(req, ev);
13706         }
13707         tevent_req_set_callback(subreq, rpccli_spoolss_DeletePrinterDataEx_done, req);
13708         return req;
13709 }
13710
13711 static void rpccli_spoolss_DeletePrinterDataEx_done(struct tevent_req *subreq)
13712 {
13713         struct tevent_req *req = tevent_req_callback_data(
13714                 subreq, struct tevent_req);
13715         struct rpccli_spoolss_DeletePrinterDataEx_state *state = tevent_req_data(
13716                 req, struct rpccli_spoolss_DeletePrinterDataEx_state);
13717         NTSTATUS status;
13718         TALLOC_CTX *mem_ctx;
13719
13720         if (state->out_mem_ctx) {
13721                 mem_ctx = state->out_mem_ctx;
13722         } else {
13723                 mem_ctx = state;
13724         }
13725
13726         status = state->dispatch_recv(subreq, mem_ctx);
13727         TALLOC_FREE(subreq);
13728         if (!NT_STATUS_IS_OK(status)) {
13729                 tevent_req_nterror(req, status);
13730                 return;
13731         }
13732
13733         /* Copy out parameters */
13734
13735         /* Copy result */
13736         state->orig.out.result = state->tmp.out.result;
13737
13738         /* Reset temporary structure */
13739         ZERO_STRUCT(state->tmp);
13740
13741         if (DEBUGLEVEL >= 10) {
13742                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrinterDataEx, &state->orig);
13743         }
13744
13745         tevent_req_done(req);
13746 }
13747
13748 NTSTATUS rpccli_spoolss_DeletePrinterDataEx_recv(struct tevent_req *req,
13749                                                  TALLOC_CTX *mem_ctx,
13750                                                  WERROR *result)
13751 {
13752         struct rpccli_spoolss_DeletePrinterDataEx_state *state = tevent_req_data(
13753                 req, struct rpccli_spoolss_DeletePrinterDataEx_state);
13754         NTSTATUS status;
13755
13756         if (tevent_req_is_nterror(req, &status)) {
13757                 tevent_req_received(req);
13758                 return status;
13759         }
13760
13761         /* Steal possbile out parameters to the callers context */
13762         talloc_steal(mem_ctx, state->out_mem_ctx);
13763
13764         /* Return result */
13765         *result = state->orig.out.result;
13766
13767         tevent_req_received(req);
13768         return NT_STATUS_OK;
13769 }
13770
13771 NTSTATUS rpccli_spoolss_DeletePrinterDataEx(struct rpc_pipe_client *cli,
13772                                             TALLOC_CTX *mem_ctx,
13773                                             struct policy_handle *handle /* [in] [ref] */,
13774                                             const char *key_name /* [in] [charset(UTF16)] */,
13775                                             const char *value_name /* [in] [charset(UTF16)] */,
13776                                             WERROR *werror)
13777 {
13778         struct spoolss_DeletePrinterDataEx r;
13779         NTSTATUS status;
13780
13781         /* In parameters */
13782         r.in.handle = handle;
13783         r.in.key_name = key_name;
13784         r.in.value_name = value_name;
13785
13786         if (DEBUGLEVEL >= 10) {
13787                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrinterDataEx, &r);
13788         }
13789
13790         status = cli->dispatch(cli,
13791                                 mem_ctx,
13792                                 &ndr_table_spoolss,
13793                                 NDR_SPOOLSS_DELETEPRINTERDATAEX,
13794                                 &r);
13795
13796         if (!NT_STATUS_IS_OK(status)) {
13797                 return status;
13798         }
13799
13800         if (DEBUGLEVEL >= 10) {
13801                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrinterDataEx, &r);
13802         }
13803
13804         if (NT_STATUS_IS_ERR(status)) {
13805                 return status;
13806         }
13807
13808         /* Return variables */
13809
13810         /* Return result */
13811         if (werror) {
13812                 *werror = r.out.result;
13813         }
13814
13815         return werror_to_ntstatus(r.out.result);
13816 }
13817
13818 struct rpccli_spoolss_DeletePrinterKey_state {
13819         struct spoolss_DeletePrinterKey orig;
13820         struct spoolss_DeletePrinterKey tmp;
13821         TALLOC_CTX *out_mem_ctx;
13822         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
13823 };
13824
13825 static void rpccli_spoolss_DeletePrinterKey_done(struct tevent_req *subreq);
13826
13827 struct tevent_req *rpccli_spoolss_DeletePrinterKey_send(TALLOC_CTX *mem_ctx,
13828                                                         struct tevent_context *ev,
13829                                                         struct rpc_pipe_client *cli,
13830                                                         struct policy_handle *_handle /* [in] [ref] */,
13831                                                         const char *_key_name /* [in] [charset(UTF16)] */)
13832 {
13833         struct tevent_req *req;
13834         struct rpccli_spoolss_DeletePrinterKey_state *state;
13835         struct tevent_req *subreq;
13836
13837         req = tevent_req_create(mem_ctx, &state,
13838                                 struct rpccli_spoolss_DeletePrinterKey_state);
13839         if (req == NULL) {
13840                 return NULL;
13841         }
13842         state->out_mem_ctx = NULL;
13843         state->dispatch_recv = cli->dispatch_recv;
13844
13845         /* In parameters */
13846         state->orig.in.handle = _handle;
13847         state->orig.in.key_name = _key_name;
13848
13849         /* Out parameters */
13850
13851         /* Result */
13852         ZERO_STRUCT(state->orig.out.result);
13853
13854         if (DEBUGLEVEL >= 10) {
13855                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrinterKey, &state->orig);
13856         }
13857
13858         /* make a temporary copy, that we pass to the dispatch function */
13859         state->tmp = state->orig;
13860
13861         subreq = cli->dispatch_send(state, ev, cli,
13862                                     &ndr_table_spoolss,
13863                                     NDR_SPOOLSS_DELETEPRINTERKEY,
13864                                     &state->tmp);
13865         if (tevent_req_nomem(subreq, req)) {
13866                 return tevent_req_post(req, ev);
13867         }
13868         tevent_req_set_callback(subreq, rpccli_spoolss_DeletePrinterKey_done, req);
13869         return req;
13870 }
13871
13872 static void rpccli_spoolss_DeletePrinterKey_done(struct tevent_req *subreq)
13873 {
13874         struct tevent_req *req = tevent_req_callback_data(
13875                 subreq, struct tevent_req);
13876         struct rpccli_spoolss_DeletePrinterKey_state *state = tevent_req_data(
13877                 req, struct rpccli_spoolss_DeletePrinterKey_state);
13878         NTSTATUS status;
13879         TALLOC_CTX *mem_ctx;
13880
13881         if (state->out_mem_ctx) {
13882                 mem_ctx = state->out_mem_ctx;
13883         } else {
13884                 mem_ctx = state;
13885         }
13886
13887         status = state->dispatch_recv(subreq, mem_ctx);
13888         TALLOC_FREE(subreq);
13889         if (!NT_STATUS_IS_OK(status)) {
13890                 tevent_req_nterror(req, status);
13891                 return;
13892         }
13893
13894         /* Copy out parameters */
13895
13896         /* Copy result */
13897         state->orig.out.result = state->tmp.out.result;
13898
13899         /* Reset temporary structure */
13900         ZERO_STRUCT(state->tmp);
13901
13902         if (DEBUGLEVEL >= 10) {
13903                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrinterKey, &state->orig);
13904         }
13905
13906         tevent_req_done(req);
13907 }
13908
13909 NTSTATUS rpccli_spoolss_DeletePrinterKey_recv(struct tevent_req *req,
13910                                               TALLOC_CTX *mem_ctx,
13911                                               WERROR *result)
13912 {
13913         struct rpccli_spoolss_DeletePrinterKey_state *state = tevent_req_data(
13914                 req, struct rpccli_spoolss_DeletePrinterKey_state);
13915         NTSTATUS status;
13916
13917         if (tevent_req_is_nterror(req, &status)) {
13918                 tevent_req_received(req);
13919                 return status;
13920         }
13921
13922         /* Steal possbile out parameters to the callers context */
13923         talloc_steal(mem_ctx, state->out_mem_ctx);
13924
13925         /* Return result */
13926         *result = state->orig.out.result;
13927
13928         tevent_req_received(req);
13929         return NT_STATUS_OK;
13930 }
13931
13932 NTSTATUS rpccli_spoolss_DeletePrinterKey(struct rpc_pipe_client *cli,
13933                                          TALLOC_CTX *mem_ctx,
13934                                          struct policy_handle *handle /* [in] [ref] */,
13935                                          const char *key_name /* [in] [charset(UTF16)] */,
13936                                          WERROR *werror)
13937 {
13938         struct spoolss_DeletePrinterKey r;
13939         NTSTATUS status;
13940
13941         /* In parameters */
13942         r.in.handle = handle;
13943         r.in.key_name = key_name;
13944
13945         if (DEBUGLEVEL >= 10) {
13946                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrinterKey, &r);
13947         }
13948
13949         status = cli->dispatch(cli,
13950                                 mem_ctx,
13951                                 &ndr_table_spoolss,
13952                                 NDR_SPOOLSS_DELETEPRINTERKEY,
13953                                 &r);
13954
13955         if (!NT_STATUS_IS_OK(status)) {
13956                 return status;
13957         }
13958
13959         if (DEBUGLEVEL >= 10) {
13960                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrinterKey, &r);
13961         }
13962
13963         if (NT_STATUS_IS_ERR(status)) {
13964                 return status;
13965         }
13966
13967         /* Return variables */
13968
13969         /* Return result */
13970         if (werror) {
13971                 *werror = r.out.result;
13972         }
13973
13974         return werror_to_ntstatus(r.out.result);
13975 }
13976
13977 struct rpccli_spoolss_53_state {
13978         struct spoolss_53 orig;
13979         struct spoolss_53 tmp;
13980         TALLOC_CTX *out_mem_ctx;
13981         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
13982 };
13983
13984 static void rpccli_spoolss_53_done(struct tevent_req *subreq);
13985
13986 struct tevent_req *rpccli_spoolss_53_send(TALLOC_CTX *mem_ctx,
13987                                           struct tevent_context *ev,
13988                                           struct rpc_pipe_client *cli)
13989 {
13990         struct tevent_req *req;
13991         struct rpccli_spoolss_53_state *state;
13992         struct tevent_req *subreq;
13993
13994         req = tevent_req_create(mem_ctx, &state,
13995                                 struct rpccli_spoolss_53_state);
13996         if (req == NULL) {
13997                 return NULL;
13998         }
13999         state->out_mem_ctx = NULL;
14000         state->dispatch_recv = cli->dispatch_recv;
14001
14002         /* In parameters */
14003
14004         /* Out parameters */
14005
14006         /* Result */
14007         ZERO_STRUCT(state->orig.out.result);
14008
14009         if (DEBUGLEVEL >= 10) {
14010                 NDR_PRINT_IN_DEBUG(spoolss_53, &state->orig);
14011         }
14012
14013         /* make a temporary copy, that we pass to the dispatch function */
14014         state->tmp = state->orig;
14015
14016         subreq = cli->dispatch_send(state, ev, cli,
14017                                     &ndr_table_spoolss,
14018                                     NDR_SPOOLSS_53,
14019                                     &state->tmp);
14020         if (tevent_req_nomem(subreq, req)) {
14021                 return tevent_req_post(req, ev);
14022         }
14023         tevent_req_set_callback(subreq, rpccli_spoolss_53_done, req);
14024         return req;
14025 }
14026
14027 static void rpccli_spoolss_53_done(struct tevent_req *subreq)
14028 {
14029         struct tevent_req *req = tevent_req_callback_data(
14030                 subreq, struct tevent_req);
14031         struct rpccli_spoolss_53_state *state = tevent_req_data(
14032                 req, struct rpccli_spoolss_53_state);
14033         NTSTATUS status;
14034         TALLOC_CTX *mem_ctx;
14035
14036         if (state->out_mem_ctx) {
14037                 mem_ctx = state->out_mem_ctx;
14038         } else {
14039                 mem_ctx = state;
14040         }
14041
14042         status = state->dispatch_recv(subreq, mem_ctx);
14043         TALLOC_FREE(subreq);
14044         if (!NT_STATUS_IS_OK(status)) {
14045                 tevent_req_nterror(req, status);
14046                 return;
14047         }
14048
14049         /* Copy out parameters */
14050
14051         /* Copy result */
14052         state->orig.out.result = state->tmp.out.result;
14053
14054         /* Reset temporary structure */
14055         ZERO_STRUCT(state->tmp);
14056
14057         if (DEBUGLEVEL >= 10) {
14058                 NDR_PRINT_OUT_DEBUG(spoolss_53, &state->orig);
14059         }
14060
14061         tevent_req_done(req);
14062 }
14063
14064 NTSTATUS rpccli_spoolss_53_recv(struct tevent_req *req,
14065                                 TALLOC_CTX *mem_ctx,
14066                                 WERROR *result)
14067 {
14068         struct rpccli_spoolss_53_state *state = tevent_req_data(
14069                 req, struct rpccli_spoolss_53_state);
14070         NTSTATUS status;
14071
14072         if (tevent_req_is_nterror(req, &status)) {
14073                 tevent_req_received(req);
14074                 return status;
14075         }
14076
14077         /* Steal possbile out parameters to the callers context */
14078         talloc_steal(mem_ctx, state->out_mem_ctx);
14079
14080         /* Return result */
14081         *result = state->orig.out.result;
14082
14083         tevent_req_received(req);
14084         return NT_STATUS_OK;
14085 }
14086
14087 NTSTATUS rpccli_spoolss_53(struct rpc_pipe_client *cli,
14088                            TALLOC_CTX *mem_ctx,
14089                            WERROR *werror)
14090 {
14091         struct spoolss_53 r;
14092         NTSTATUS status;
14093
14094         /* In parameters */
14095
14096         if (DEBUGLEVEL >= 10) {
14097                 NDR_PRINT_IN_DEBUG(spoolss_53, &r);
14098         }
14099
14100         status = cli->dispatch(cli,
14101                                 mem_ctx,
14102                                 &ndr_table_spoolss,
14103                                 NDR_SPOOLSS_53,
14104                                 &r);
14105
14106         if (!NT_STATUS_IS_OK(status)) {
14107                 return status;
14108         }
14109
14110         if (DEBUGLEVEL >= 10) {
14111                 NDR_PRINT_OUT_DEBUG(spoolss_53, &r);
14112         }
14113
14114         if (NT_STATUS_IS_ERR(status)) {
14115                 return status;
14116         }
14117
14118         /* Return variables */
14119
14120         /* Return result */
14121         if (werror) {
14122                 *werror = r.out.result;
14123         }
14124
14125         return werror_to_ntstatus(r.out.result);
14126 }
14127
14128 struct rpccli_spoolss_DeletePrinterDriverEx_state {
14129         struct spoolss_DeletePrinterDriverEx orig;
14130         struct spoolss_DeletePrinterDriverEx tmp;
14131         TALLOC_CTX *out_mem_ctx;
14132         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
14133 };
14134
14135 static void rpccli_spoolss_DeletePrinterDriverEx_done(struct tevent_req *subreq);
14136
14137 struct tevent_req *rpccli_spoolss_DeletePrinterDriverEx_send(TALLOC_CTX *mem_ctx,
14138                                                              struct tevent_context *ev,
14139                                                              struct rpc_pipe_client *cli,
14140                                                              const char *_server /* [in] [unique,charset(UTF16)] */,
14141                                                              const char *_architecture /* [in] [charset(UTF16)] */,
14142                                                              const char *_driver /* [in] [charset(UTF16)] */,
14143                                                              uint32_t _delete_flags /* [in]  */,
14144                                                              uint32_t _version /* [in]  */)
14145 {
14146         struct tevent_req *req;
14147         struct rpccli_spoolss_DeletePrinterDriverEx_state *state;
14148         struct tevent_req *subreq;
14149
14150         req = tevent_req_create(mem_ctx, &state,
14151                                 struct rpccli_spoolss_DeletePrinterDriverEx_state);
14152         if (req == NULL) {
14153                 return NULL;
14154         }
14155         state->out_mem_ctx = NULL;
14156         state->dispatch_recv = cli->dispatch_recv;
14157
14158         /* In parameters */
14159         state->orig.in.server = _server;
14160         state->orig.in.architecture = _architecture;
14161         state->orig.in.driver = _driver;
14162         state->orig.in.delete_flags = _delete_flags;
14163         state->orig.in.version = _version;
14164
14165         /* Out parameters */
14166
14167         /* Result */
14168         ZERO_STRUCT(state->orig.out.result);
14169
14170         if (DEBUGLEVEL >= 10) {
14171                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrinterDriverEx, &state->orig);
14172         }
14173
14174         /* make a temporary copy, that we pass to the dispatch function */
14175         state->tmp = state->orig;
14176
14177         subreq = cli->dispatch_send(state, ev, cli,
14178                                     &ndr_table_spoolss,
14179                                     NDR_SPOOLSS_DELETEPRINTERDRIVEREX,
14180                                     &state->tmp);
14181         if (tevent_req_nomem(subreq, req)) {
14182                 return tevent_req_post(req, ev);
14183         }
14184         tevent_req_set_callback(subreq, rpccli_spoolss_DeletePrinterDriverEx_done, req);
14185         return req;
14186 }
14187
14188 static void rpccli_spoolss_DeletePrinterDriverEx_done(struct tevent_req *subreq)
14189 {
14190         struct tevent_req *req = tevent_req_callback_data(
14191                 subreq, struct tevent_req);
14192         struct rpccli_spoolss_DeletePrinterDriverEx_state *state = tevent_req_data(
14193                 req, struct rpccli_spoolss_DeletePrinterDriverEx_state);
14194         NTSTATUS status;
14195         TALLOC_CTX *mem_ctx;
14196
14197         if (state->out_mem_ctx) {
14198                 mem_ctx = state->out_mem_ctx;
14199         } else {
14200                 mem_ctx = state;
14201         }
14202
14203         status = state->dispatch_recv(subreq, mem_ctx);
14204         TALLOC_FREE(subreq);
14205         if (!NT_STATUS_IS_OK(status)) {
14206                 tevent_req_nterror(req, status);
14207                 return;
14208         }
14209
14210         /* Copy out parameters */
14211
14212         /* Copy result */
14213         state->orig.out.result = state->tmp.out.result;
14214
14215         /* Reset temporary structure */
14216         ZERO_STRUCT(state->tmp);
14217
14218         if (DEBUGLEVEL >= 10) {
14219                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrinterDriverEx, &state->orig);
14220         }
14221
14222         tevent_req_done(req);
14223 }
14224
14225 NTSTATUS rpccli_spoolss_DeletePrinterDriverEx_recv(struct tevent_req *req,
14226                                                    TALLOC_CTX *mem_ctx,
14227                                                    WERROR *result)
14228 {
14229         struct rpccli_spoolss_DeletePrinterDriverEx_state *state = tevent_req_data(
14230                 req, struct rpccli_spoolss_DeletePrinterDriverEx_state);
14231         NTSTATUS status;
14232
14233         if (tevent_req_is_nterror(req, &status)) {
14234                 tevent_req_received(req);
14235                 return status;
14236         }
14237
14238         /* Steal possbile out parameters to the callers context */
14239         talloc_steal(mem_ctx, state->out_mem_ctx);
14240
14241         /* Return result */
14242         *result = state->orig.out.result;
14243
14244         tevent_req_received(req);
14245         return NT_STATUS_OK;
14246 }
14247
14248 NTSTATUS rpccli_spoolss_DeletePrinterDriverEx(struct rpc_pipe_client *cli,
14249                                               TALLOC_CTX *mem_ctx,
14250                                               const char *server /* [in] [unique,charset(UTF16)] */,
14251                                               const char *architecture /* [in] [charset(UTF16)] */,
14252                                               const char *driver /* [in] [charset(UTF16)] */,
14253                                               uint32_t delete_flags /* [in]  */,
14254                                               uint32_t version /* [in]  */,
14255                                               WERROR *werror)
14256 {
14257         struct spoolss_DeletePrinterDriverEx r;
14258         NTSTATUS status;
14259
14260         /* In parameters */
14261         r.in.server = server;
14262         r.in.architecture = architecture;
14263         r.in.driver = driver;
14264         r.in.delete_flags = delete_flags;
14265         r.in.version = version;
14266
14267         if (DEBUGLEVEL >= 10) {
14268                 NDR_PRINT_IN_DEBUG(spoolss_DeletePrinterDriverEx, &r);
14269         }
14270
14271         status = cli->dispatch(cli,
14272                                 mem_ctx,
14273                                 &ndr_table_spoolss,
14274                                 NDR_SPOOLSS_DELETEPRINTERDRIVEREX,
14275                                 &r);
14276
14277         if (!NT_STATUS_IS_OK(status)) {
14278                 return status;
14279         }
14280
14281         if (DEBUGLEVEL >= 10) {
14282                 NDR_PRINT_OUT_DEBUG(spoolss_DeletePrinterDriverEx, &r);
14283         }
14284
14285         if (NT_STATUS_IS_ERR(status)) {
14286                 return status;
14287         }
14288
14289         /* Return variables */
14290
14291         /* Return result */
14292         if (werror) {
14293                 *werror = r.out.result;
14294         }
14295
14296         return werror_to_ntstatus(r.out.result);
14297 }
14298
14299 struct rpccli_spoolss_55_state {
14300         struct spoolss_55 orig;
14301         struct spoolss_55 tmp;
14302         TALLOC_CTX *out_mem_ctx;
14303         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
14304 };
14305
14306 static void rpccli_spoolss_55_done(struct tevent_req *subreq);
14307
14308 struct tevent_req *rpccli_spoolss_55_send(TALLOC_CTX *mem_ctx,
14309                                           struct tevent_context *ev,
14310                                           struct rpc_pipe_client *cli)
14311 {
14312         struct tevent_req *req;
14313         struct rpccli_spoolss_55_state *state;
14314         struct tevent_req *subreq;
14315
14316         req = tevent_req_create(mem_ctx, &state,
14317                                 struct rpccli_spoolss_55_state);
14318         if (req == NULL) {
14319                 return NULL;
14320         }
14321         state->out_mem_ctx = NULL;
14322         state->dispatch_recv = cli->dispatch_recv;
14323
14324         /* In parameters */
14325
14326         /* Out parameters */
14327
14328         /* Result */
14329         ZERO_STRUCT(state->orig.out.result);
14330
14331         if (DEBUGLEVEL >= 10) {
14332                 NDR_PRINT_IN_DEBUG(spoolss_55, &state->orig);
14333         }
14334
14335         /* make a temporary copy, that we pass to the dispatch function */
14336         state->tmp = state->orig;
14337
14338         subreq = cli->dispatch_send(state, ev, cli,
14339                                     &ndr_table_spoolss,
14340                                     NDR_SPOOLSS_55,
14341                                     &state->tmp);
14342         if (tevent_req_nomem(subreq, req)) {
14343                 return tevent_req_post(req, ev);
14344         }
14345         tevent_req_set_callback(subreq, rpccli_spoolss_55_done, req);
14346         return req;
14347 }
14348
14349 static void rpccli_spoolss_55_done(struct tevent_req *subreq)
14350 {
14351         struct tevent_req *req = tevent_req_callback_data(
14352                 subreq, struct tevent_req);
14353         struct rpccli_spoolss_55_state *state = tevent_req_data(
14354                 req, struct rpccli_spoolss_55_state);
14355         NTSTATUS status;
14356         TALLOC_CTX *mem_ctx;
14357
14358         if (state->out_mem_ctx) {
14359                 mem_ctx = state->out_mem_ctx;
14360         } else {
14361                 mem_ctx = state;
14362         }
14363
14364         status = state->dispatch_recv(subreq, mem_ctx);
14365         TALLOC_FREE(subreq);
14366         if (!NT_STATUS_IS_OK(status)) {
14367                 tevent_req_nterror(req, status);
14368                 return;
14369         }
14370
14371         /* Copy out parameters */
14372
14373         /* Copy result */
14374         state->orig.out.result = state->tmp.out.result;
14375
14376         /* Reset temporary structure */
14377         ZERO_STRUCT(state->tmp);
14378
14379         if (DEBUGLEVEL >= 10) {
14380                 NDR_PRINT_OUT_DEBUG(spoolss_55, &state->orig);
14381         }
14382
14383         tevent_req_done(req);
14384 }
14385
14386 NTSTATUS rpccli_spoolss_55_recv(struct tevent_req *req,
14387                                 TALLOC_CTX *mem_ctx,
14388                                 WERROR *result)
14389 {
14390         struct rpccli_spoolss_55_state *state = tevent_req_data(
14391                 req, struct rpccli_spoolss_55_state);
14392         NTSTATUS status;
14393
14394         if (tevent_req_is_nterror(req, &status)) {
14395                 tevent_req_received(req);
14396                 return status;
14397         }
14398
14399         /* Steal possbile out parameters to the callers context */
14400         talloc_steal(mem_ctx, state->out_mem_ctx);
14401
14402         /* Return result */
14403         *result = state->orig.out.result;
14404
14405         tevent_req_received(req);
14406         return NT_STATUS_OK;
14407 }
14408
14409 NTSTATUS rpccli_spoolss_55(struct rpc_pipe_client *cli,
14410                            TALLOC_CTX *mem_ctx,
14411                            WERROR *werror)
14412 {
14413         struct spoolss_55 r;
14414         NTSTATUS status;
14415
14416         /* In parameters */
14417
14418         if (DEBUGLEVEL >= 10) {
14419                 NDR_PRINT_IN_DEBUG(spoolss_55, &r);
14420         }
14421
14422         status = cli->dispatch(cli,
14423                                 mem_ctx,
14424                                 &ndr_table_spoolss,
14425                                 NDR_SPOOLSS_55,
14426                                 &r);
14427
14428         if (!NT_STATUS_IS_OK(status)) {
14429                 return status;
14430         }
14431
14432         if (DEBUGLEVEL >= 10) {
14433                 NDR_PRINT_OUT_DEBUG(spoolss_55, &r);
14434         }
14435
14436         if (NT_STATUS_IS_ERR(status)) {
14437                 return status;
14438         }
14439
14440         /* Return variables */
14441
14442         /* Return result */
14443         if (werror) {
14444                 *werror = r.out.result;
14445         }
14446
14447         return werror_to_ntstatus(r.out.result);
14448 }
14449
14450 struct rpccli_spoolss_56_state {
14451         struct spoolss_56 orig;
14452         struct spoolss_56 tmp;
14453         TALLOC_CTX *out_mem_ctx;
14454         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
14455 };
14456
14457 static void rpccli_spoolss_56_done(struct tevent_req *subreq);
14458
14459 struct tevent_req *rpccli_spoolss_56_send(TALLOC_CTX *mem_ctx,
14460                                           struct tevent_context *ev,
14461                                           struct rpc_pipe_client *cli)
14462 {
14463         struct tevent_req *req;
14464         struct rpccli_spoolss_56_state *state;
14465         struct tevent_req *subreq;
14466
14467         req = tevent_req_create(mem_ctx, &state,
14468                                 struct rpccli_spoolss_56_state);
14469         if (req == NULL) {
14470                 return NULL;
14471         }
14472         state->out_mem_ctx = NULL;
14473         state->dispatch_recv = cli->dispatch_recv;
14474
14475         /* In parameters */
14476
14477         /* Out parameters */
14478
14479         /* Result */
14480         ZERO_STRUCT(state->orig.out.result);
14481
14482         if (DEBUGLEVEL >= 10) {
14483                 NDR_PRINT_IN_DEBUG(spoolss_56, &state->orig);
14484         }
14485
14486         /* make a temporary copy, that we pass to the dispatch function */
14487         state->tmp = state->orig;
14488
14489         subreq = cli->dispatch_send(state, ev, cli,
14490                                     &ndr_table_spoolss,
14491                                     NDR_SPOOLSS_56,
14492                                     &state->tmp);
14493         if (tevent_req_nomem(subreq, req)) {
14494                 return tevent_req_post(req, ev);
14495         }
14496         tevent_req_set_callback(subreq, rpccli_spoolss_56_done, req);
14497         return req;
14498 }
14499
14500 static void rpccli_spoolss_56_done(struct tevent_req *subreq)
14501 {
14502         struct tevent_req *req = tevent_req_callback_data(
14503                 subreq, struct tevent_req);
14504         struct rpccli_spoolss_56_state *state = tevent_req_data(
14505                 req, struct rpccli_spoolss_56_state);
14506         NTSTATUS status;
14507         TALLOC_CTX *mem_ctx;
14508
14509         if (state->out_mem_ctx) {
14510                 mem_ctx = state->out_mem_ctx;
14511         } else {
14512                 mem_ctx = state;
14513         }
14514
14515         status = state->dispatch_recv(subreq, mem_ctx);
14516         TALLOC_FREE(subreq);
14517         if (!NT_STATUS_IS_OK(status)) {
14518                 tevent_req_nterror(req, status);
14519                 return;
14520         }
14521
14522         /* Copy out parameters */
14523
14524         /* Copy result */
14525         state->orig.out.result = state->tmp.out.result;
14526
14527         /* Reset temporary structure */
14528         ZERO_STRUCT(state->tmp);
14529
14530         if (DEBUGLEVEL >= 10) {
14531                 NDR_PRINT_OUT_DEBUG(spoolss_56, &state->orig);
14532         }
14533
14534         tevent_req_done(req);
14535 }
14536
14537 NTSTATUS rpccli_spoolss_56_recv(struct tevent_req *req,
14538                                 TALLOC_CTX *mem_ctx,
14539                                 WERROR *result)
14540 {
14541         struct rpccli_spoolss_56_state *state = tevent_req_data(
14542                 req, struct rpccli_spoolss_56_state);
14543         NTSTATUS status;
14544
14545         if (tevent_req_is_nterror(req, &status)) {
14546                 tevent_req_received(req);
14547                 return status;
14548         }
14549
14550         /* Steal possbile out parameters to the callers context */
14551         talloc_steal(mem_ctx, state->out_mem_ctx);
14552
14553         /* Return result */
14554         *result = state->orig.out.result;
14555
14556         tevent_req_received(req);
14557         return NT_STATUS_OK;
14558 }
14559
14560 NTSTATUS rpccli_spoolss_56(struct rpc_pipe_client *cli,
14561                            TALLOC_CTX *mem_ctx,
14562                            WERROR *werror)
14563 {
14564         struct spoolss_56 r;
14565         NTSTATUS status;
14566
14567         /* In parameters */
14568
14569         if (DEBUGLEVEL >= 10) {
14570                 NDR_PRINT_IN_DEBUG(spoolss_56, &r);
14571         }
14572
14573         status = cli->dispatch(cli,
14574                                 mem_ctx,
14575                                 &ndr_table_spoolss,
14576                                 NDR_SPOOLSS_56,
14577                                 &r);
14578
14579         if (!NT_STATUS_IS_OK(status)) {
14580                 return status;
14581         }
14582
14583         if (DEBUGLEVEL >= 10) {
14584                 NDR_PRINT_OUT_DEBUG(spoolss_56, &r);
14585         }
14586
14587         if (NT_STATUS_IS_ERR(status)) {
14588                 return status;
14589         }
14590
14591         /* Return variables */
14592
14593         /* Return result */
14594         if (werror) {
14595                 *werror = r.out.result;
14596         }
14597
14598         return werror_to_ntstatus(r.out.result);
14599 }
14600
14601 struct rpccli_spoolss_57_state {
14602         struct spoolss_57 orig;
14603         struct spoolss_57 tmp;
14604         TALLOC_CTX *out_mem_ctx;
14605         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
14606 };
14607
14608 static void rpccli_spoolss_57_done(struct tevent_req *subreq);
14609
14610 struct tevent_req *rpccli_spoolss_57_send(TALLOC_CTX *mem_ctx,
14611                                           struct tevent_context *ev,
14612                                           struct rpc_pipe_client *cli)
14613 {
14614         struct tevent_req *req;
14615         struct rpccli_spoolss_57_state *state;
14616         struct tevent_req *subreq;
14617
14618         req = tevent_req_create(mem_ctx, &state,
14619                                 struct rpccli_spoolss_57_state);
14620         if (req == NULL) {
14621                 return NULL;
14622         }
14623         state->out_mem_ctx = NULL;
14624         state->dispatch_recv = cli->dispatch_recv;
14625
14626         /* In parameters */
14627
14628         /* Out parameters */
14629
14630         /* Result */
14631         ZERO_STRUCT(state->orig.out.result);
14632
14633         if (DEBUGLEVEL >= 10) {
14634                 NDR_PRINT_IN_DEBUG(spoolss_57, &state->orig);
14635         }
14636
14637         /* make a temporary copy, that we pass to the dispatch function */
14638         state->tmp = state->orig;
14639
14640         subreq = cli->dispatch_send(state, ev, cli,
14641                                     &ndr_table_spoolss,
14642                                     NDR_SPOOLSS_57,
14643                                     &state->tmp);
14644         if (tevent_req_nomem(subreq, req)) {
14645                 return tevent_req_post(req, ev);
14646         }
14647         tevent_req_set_callback(subreq, rpccli_spoolss_57_done, req);
14648         return req;
14649 }
14650
14651 static void rpccli_spoolss_57_done(struct tevent_req *subreq)
14652 {
14653         struct tevent_req *req = tevent_req_callback_data(
14654                 subreq, struct tevent_req);
14655         struct rpccli_spoolss_57_state *state = tevent_req_data(
14656                 req, struct rpccli_spoolss_57_state);
14657         NTSTATUS status;
14658         TALLOC_CTX *mem_ctx;
14659
14660         if (state->out_mem_ctx) {
14661                 mem_ctx = state->out_mem_ctx;
14662         } else {
14663                 mem_ctx = state;
14664         }
14665
14666         status = state->dispatch_recv(subreq, mem_ctx);
14667         TALLOC_FREE(subreq);
14668         if (!NT_STATUS_IS_OK(status)) {
14669                 tevent_req_nterror(req, status);
14670                 return;
14671         }
14672
14673         /* Copy out parameters */
14674
14675         /* Copy result */
14676         state->orig.out.result = state->tmp.out.result;
14677
14678         /* Reset temporary structure */
14679         ZERO_STRUCT(state->tmp);
14680
14681         if (DEBUGLEVEL >= 10) {
14682                 NDR_PRINT_OUT_DEBUG(spoolss_57, &state->orig);
14683         }
14684
14685         tevent_req_done(req);
14686 }
14687
14688 NTSTATUS rpccli_spoolss_57_recv(struct tevent_req *req,
14689                                 TALLOC_CTX *mem_ctx,
14690                                 WERROR *result)
14691 {
14692         struct rpccli_spoolss_57_state *state = tevent_req_data(
14693                 req, struct rpccli_spoolss_57_state);
14694         NTSTATUS status;
14695
14696         if (tevent_req_is_nterror(req, &status)) {
14697                 tevent_req_received(req);
14698                 return status;
14699         }
14700
14701         /* Steal possbile out parameters to the callers context */
14702         talloc_steal(mem_ctx, state->out_mem_ctx);
14703
14704         /* Return result */
14705         *result = state->orig.out.result;
14706
14707         tevent_req_received(req);
14708         return NT_STATUS_OK;
14709 }
14710
14711 NTSTATUS rpccli_spoolss_57(struct rpc_pipe_client *cli,
14712                            TALLOC_CTX *mem_ctx,
14713                            WERROR *werror)
14714 {
14715         struct spoolss_57 r;
14716         NTSTATUS status;
14717
14718         /* In parameters */
14719
14720         if (DEBUGLEVEL >= 10) {
14721                 NDR_PRINT_IN_DEBUG(spoolss_57, &r);
14722         }
14723
14724         status = cli->dispatch(cli,
14725                                 mem_ctx,
14726                                 &ndr_table_spoolss,
14727                                 NDR_SPOOLSS_57,
14728                                 &r);
14729
14730         if (!NT_STATUS_IS_OK(status)) {
14731                 return status;
14732         }
14733
14734         if (DEBUGLEVEL >= 10) {
14735                 NDR_PRINT_OUT_DEBUG(spoolss_57, &r);
14736         }
14737
14738         if (NT_STATUS_IS_ERR(status)) {
14739                 return status;
14740         }
14741
14742         /* Return variables */
14743
14744         /* Return result */
14745         if (werror) {
14746                 *werror = r.out.result;
14747         }
14748
14749         return werror_to_ntstatus(r.out.result);
14750 }
14751
14752 struct rpccli_spoolss_XcvData_state {
14753         struct spoolss_XcvData orig;
14754         struct spoolss_XcvData tmp;
14755         TALLOC_CTX *out_mem_ctx;
14756         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
14757 };
14758
14759 static void rpccli_spoolss_XcvData_done(struct tevent_req *subreq);
14760
14761 struct tevent_req *rpccli_spoolss_XcvData_send(TALLOC_CTX *mem_ctx,
14762                                                struct tevent_context *ev,
14763                                                struct rpc_pipe_client *cli,
14764                                                struct policy_handle *_handle /* [in] [ref] */,
14765                                                const char *_function_name /* [in] [charset(UTF16)] */,
14766                                                DATA_BLOB _in_data /* [in]  */,
14767                                                uint32_t __in_data_length /* [in] [value(r->in.in_data.length)] */,
14768                                                uint8_t *_out_data /* [out] [ref,size_is(out_data_size)] */,
14769                                                uint32_t _out_data_size /* [in]  */,
14770                                                uint32_t *_needed /* [out] [ref] */,
14771                                                uint32_t *_status_code /* [in,out] [ref] */)
14772 {
14773         struct tevent_req *req;
14774         struct rpccli_spoolss_XcvData_state *state;
14775         struct tevent_req *subreq;
14776
14777         req = tevent_req_create(mem_ctx, &state,
14778                                 struct rpccli_spoolss_XcvData_state);
14779         if (req == NULL) {
14780                 return NULL;
14781         }
14782         state->out_mem_ctx = NULL;
14783         state->dispatch_recv = cli->dispatch_recv;
14784
14785         /* In parameters */
14786         state->orig.in.handle = _handle;
14787         state->orig.in.function_name = _function_name;
14788         state->orig.in.in_data = _in_data;
14789         state->orig.in._in_data_length = __in_data_length;
14790         state->orig.in.out_data_size = _out_data_size;
14791         state->orig.in.status_code = _status_code;
14792
14793         /* Out parameters */
14794         state->orig.out.out_data = _out_data;
14795         state->orig.out.needed = _needed;
14796         state->orig.out.status_code = _status_code;
14797
14798         /* Result */
14799         ZERO_STRUCT(state->orig.out.result);
14800
14801         if (DEBUGLEVEL >= 10) {
14802                 NDR_PRINT_IN_DEBUG(spoolss_XcvData, &state->orig);
14803         }
14804
14805         state->out_mem_ctx = talloc_named_const(state, 0,
14806                              "rpccli_spoolss_XcvData_out_memory");
14807         if (tevent_req_nomem(state->out_mem_ctx, req)) {
14808                 return tevent_req_post(req, ev);
14809         }
14810
14811         /* make a temporary copy, that we pass to the dispatch function */
14812         state->tmp = state->orig;
14813
14814         subreq = cli->dispatch_send(state, ev, cli,
14815                                     &ndr_table_spoolss,
14816                                     NDR_SPOOLSS_XCVDATA,
14817                                     &state->tmp);
14818         if (tevent_req_nomem(subreq, req)) {
14819                 return tevent_req_post(req, ev);
14820         }
14821         tevent_req_set_callback(subreq, rpccli_spoolss_XcvData_done, req);
14822         return req;
14823 }
14824
14825 static void rpccli_spoolss_XcvData_done(struct tevent_req *subreq)
14826 {
14827         struct tevent_req *req = tevent_req_callback_data(
14828                 subreq, struct tevent_req);
14829         struct rpccli_spoolss_XcvData_state *state = tevent_req_data(
14830                 req, struct rpccli_spoolss_XcvData_state);
14831         NTSTATUS status;
14832         TALLOC_CTX *mem_ctx;
14833
14834         if (state->out_mem_ctx) {
14835                 mem_ctx = state->out_mem_ctx;
14836         } else {
14837                 mem_ctx = state;
14838         }
14839
14840         status = state->dispatch_recv(subreq, mem_ctx);
14841         TALLOC_FREE(subreq);
14842         if (!NT_STATUS_IS_OK(status)) {
14843                 tevent_req_nterror(req, status);
14844                 return;
14845         }
14846
14847         /* Copy out parameters */
14848         memcpy(state->orig.out.out_data, state->tmp.out.out_data, state->tmp.in.out_data_size * sizeof(*state->orig.out.out_data));
14849         *state->orig.out.needed = *state->tmp.out.needed;
14850         *state->orig.out.status_code = *state->tmp.out.status_code;
14851
14852         /* Copy result */
14853         state->orig.out.result = state->tmp.out.result;
14854
14855         /* Reset temporary structure */
14856         ZERO_STRUCT(state->tmp);
14857
14858         if (DEBUGLEVEL >= 10) {
14859                 NDR_PRINT_OUT_DEBUG(spoolss_XcvData, &state->orig);
14860         }
14861
14862         tevent_req_done(req);
14863 }
14864
14865 NTSTATUS rpccli_spoolss_XcvData_recv(struct tevent_req *req,
14866                                      TALLOC_CTX *mem_ctx,
14867                                      WERROR *result)
14868 {
14869         struct rpccli_spoolss_XcvData_state *state = tevent_req_data(
14870                 req, struct rpccli_spoolss_XcvData_state);
14871         NTSTATUS status;
14872
14873         if (tevent_req_is_nterror(req, &status)) {
14874                 tevent_req_received(req);
14875                 return status;
14876         }
14877
14878         /* Steal possbile out parameters to the callers context */
14879         talloc_steal(mem_ctx, state->out_mem_ctx);
14880
14881         /* Return result */
14882         *result = state->orig.out.result;
14883
14884         tevent_req_received(req);
14885         return NT_STATUS_OK;
14886 }
14887
14888 NTSTATUS rpccli_spoolss_XcvData(struct rpc_pipe_client *cli,
14889                                 TALLOC_CTX *mem_ctx,
14890                                 struct policy_handle *handle /* [in] [ref] */,
14891                                 const char *function_name /* [in] [charset(UTF16)] */,
14892                                 DATA_BLOB in_data /* [in]  */,
14893                                 uint32_t _in_data_length /* [in] [value(r->in.in_data.length)] */,
14894                                 uint8_t *out_data /* [out] [ref,size_is(out_data_size)] */,
14895                                 uint32_t out_data_size /* [in]  */,
14896                                 uint32_t *needed /* [out] [ref] */,
14897                                 uint32_t *status_code /* [in,out] [ref] */,
14898                                 WERROR *werror)
14899 {
14900         struct spoolss_XcvData r;
14901         NTSTATUS status;
14902
14903         /* In parameters */
14904         r.in.handle = handle;
14905         r.in.function_name = function_name;
14906         r.in.in_data = in_data;
14907         r.in._in_data_length = _in_data_length;
14908         r.in.out_data_size = out_data_size;
14909         r.in.status_code = status_code;
14910
14911         if (DEBUGLEVEL >= 10) {
14912                 NDR_PRINT_IN_DEBUG(spoolss_XcvData, &r);
14913         }
14914
14915         status = cli->dispatch(cli,
14916                                 mem_ctx,
14917                                 &ndr_table_spoolss,
14918                                 NDR_SPOOLSS_XCVDATA,
14919                                 &r);
14920
14921         if (!NT_STATUS_IS_OK(status)) {
14922                 return status;
14923         }
14924
14925         if (DEBUGLEVEL >= 10) {
14926                 NDR_PRINT_OUT_DEBUG(spoolss_XcvData, &r);
14927         }
14928
14929         if (NT_STATUS_IS_ERR(status)) {
14930                 return status;
14931         }
14932
14933         /* Return variables */
14934         memcpy(out_data, r.out.out_data, r.in.out_data_size * sizeof(*out_data));
14935         *needed = *r.out.needed;
14936         *status_code = *r.out.status_code;
14937
14938         /* Return result */
14939         if (werror) {
14940                 *werror = r.out.result;
14941         }
14942
14943         return werror_to_ntstatus(r.out.result);
14944 }
14945
14946 struct rpccli_spoolss_AddPrinterDriverEx_state {
14947         struct spoolss_AddPrinterDriverEx orig;
14948         struct spoolss_AddPrinterDriverEx tmp;
14949         TALLOC_CTX *out_mem_ctx;
14950         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
14951 };
14952
14953 static void rpccli_spoolss_AddPrinterDriverEx_done(struct tevent_req *subreq);
14954
14955 struct tevent_req *rpccli_spoolss_AddPrinterDriverEx_send(TALLOC_CTX *mem_ctx,
14956                                                           struct tevent_context *ev,
14957                                                           struct rpc_pipe_client *cli,
14958                                                           const char *_servername /* [in] [unique,charset(UTF16)] */,
14959                                                           struct spoolss_AddDriverInfoCtr *_info_ctr /* [in] [ref] */,
14960                                                           uint32_t _flags /* [in]  */)
14961 {
14962         struct tevent_req *req;
14963         struct rpccli_spoolss_AddPrinterDriverEx_state *state;
14964         struct tevent_req *subreq;
14965
14966         req = tevent_req_create(mem_ctx, &state,
14967                                 struct rpccli_spoolss_AddPrinterDriverEx_state);
14968         if (req == NULL) {
14969                 return NULL;
14970         }
14971         state->out_mem_ctx = NULL;
14972         state->dispatch_recv = cli->dispatch_recv;
14973
14974         /* In parameters */
14975         state->orig.in.servername = _servername;
14976         state->orig.in.info_ctr = _info_ctr;
14977         state->orig.in.flags = _flags;
14978
14979         /* Out parameters */
14980
14981         /* Result */
14982         ZERO_STRUCT(state->orig.out.result);
14983
14984         if (DEBUGLEVEL >= 10) {
14985                 NDR_PRINT_IN_DEBUG(spoolss_AddPrinterDriverEx, &state->orig);
14986         }
14987
14988         /* make a temporary copy, that we pass to the dispatch function */
14989         state->tmp = state->orig;
14990
14991         subreq = cli->dispatch_send(state, ev, cli,
14992                                     &ndr_table_spoolss,
14993                                     NDR_SPOOLSS_ADDPRINTERDRIVEREX,
14994                                     &state->tmp);
14995         if (tevent_req_nomem(subreq, req)) {
14996                 return tevent_req_post(req, ev);
14997         }
14998         tevent_req_set_callback(subreq, rpccli_spoolss_AddPrinterDriverEx_done, req);
14999         return req;
15000 }
15001
15002 static void rpccli_spoolss_AddPrinterDriverEx_done(struct tevent_req *subreq)
15003 {
15004         struct tevent_req *req = tevent_req_callback_data(
15005                 subreq, struct tevent_req);
15006         struct rpccli_spoolss_AddPrinterDriverEx_state *state = tevent_req_data(
15007                 req, struct rpccli_spoolss_AddPrinterDriverEx_state);
15008         NTSTATUS status;
15009         TALLOC_CTX *mem_ctx;
15010
15011         if (state->out_mem_ctx) {
15012                 mem_ctx = state->out_mem_ctx;
15013         } else {
15014                 mem_ctx = state;
15015         }
15016
15017         status = state->dispatch_recv(subreq, mem_ctx);
15018         TALLOC_FREE(subreq);
15019         if (!NT_STATUS_IS_OK(status)) {
15020                 tevent_req_nterror(req, status);
15021                 return;
15022         }
15023
15024         /* Copy out parameters */
15025
15026         /* Copy result */
15027         state->orig.out.result = state->tmp.out.result;
15028
15029         /* Reset temporary structure */
15030         ZERO_STRUCT(state->tmp);
15031
15032         if (DEBUGLEVEL >= 10) {
15033                 NDR_PRINT_OUT_DEBUG(spoolss_AddPrinterDriverEx, &state->orig);
15034         }
15035
15036         tevent_req_done(req);
15037 }
15038
15039 NTSTATUS rpccli_spoolss_AddPrinterDriverEx_recv(struct tevent_req *req,
15040                                                 TALLOC_CTX *mem_ctx,
15041                                                 WERROR *result)
15042 {
15043         struct rpccli_spoolss_AddPrinterDriverEx_state *state = tevent_req_data(
15044                 req, struct rpccli_spoolss_AddPrinterDriverEx_state);
15045         NTSTATUS status;
15046
15047         if (tevent_req_is_nterror(req, &status)) {
15048                 tevent_req_received(req);
15049                 return status;
15050         }
15051
15052         /* Steal possbile out parameters to the callers context */
15053         talloc_steal(mem_ctx, state->out_mem_ctx);
15054
15055         /* Return result */
15056         *result = state->orig.out.result;
15057
15058         tevent_req_received(req);
15059         return NT_STATUS_OK;
15060 }
15061
15062 NTSTATUS rpccli_spoolss_AddPrinterDriverEx(struct rpc_pipe_client *cli,
15063                                            TALLOC_CTX *mem_ctx,
15064                                            const char *servername /* [in] [unique,charset(UTF16)] */,
15065                                            struct spoolss_AddDriverInfoCtr *info_ctr /* [in] [ref] */,
15066                                            uint32_t flags /* [in]  */,
15067                                            WERROR *werror)
15068 {
15069         struct spoolss_AddPrinterDriverEx r;
15070         NTSTATUS status;
15071
15072         /* In parameters */
15073         r.in.servername = servername;
15074         r.in.info_ctr = info_ctr;
15075         r.in.flags = flags;
15076
15077         if (DEBUGLEVEL >= 10) {
15078                 NDR_PRINT_IN_DEBUG(spoolss_AddPrinterDriverEx, &r);
15079         }
15080
15081         status = cli->dispatch(cli,
15082                                 mem_ctx,
15083                                 &ndr_table_spoolss,
15084                                 NDR_SPOOLSS_ADDPRINTERDRIVEREX,
15085                                 &r);
15086
15087         if (!NT_STATUS_IS_OK(status)) {
15088                 return status;
15089         }
15090
15091         if (DEBUGLEVEL >= 10) {
15092                 NDR_PRINT_OUT_DEBUG(spoolss_AddPrinterDriverEx, &r);
15093         }
15094
15095         if (NT_STATUS_IS_ERR(status)) {
15096                 return status;
15097         }
15098
15099         /* Return variables */
15100
15101         /* Return result */
15102         if (werror) {
15103                 *werror = r.out.result;
15104         }
15105
15106         return werror_to_ntstatus(r.out.result);
15107 }
15108
15109 struct rpccli_spoolss_5a_state {
15110         struct spoolss_5a orig;
15111         struct spoolss_5a tmp;
15112         TALLOC_CTX *out_mem_ctx;
15113         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
15114 };
15115
15116 static void rpccli_spoolss_5a_done(struct tevent_req *subreq);
15117
15118 struct tevent_req *rpccli_spoolss_5a_send(TALLOC_CTX *mem_ctx,
15119                                           struct tevent_context *ev,
15120                                           struct rpc_pipe_client *cli)
15121 {
15122         struct tevent_req *req;
15123         struct rpccli_spoolss_5a_state *state;
15124         struct tevent_req *subreq;
15125
15126         req = tevent_req_create(mem_ctx, &state,
15127                                 struct rpccli_spoolss_5a_state);
15128         if (req == NULL) {
15129                 return NULL;
15130         }
15131         state->out_mem_ctx = NULL;
15132         state->dispatch_recv = cli->dispatch_recv;
15133
15134         /* In parameters */
15135
15136         /* Out parameters */
15137
15138         /* Result */
15139         ZERO_STRUCT(state->orig.out.result);
15140
15141         if (DEBUGLEVEL >= 10) {
15142                 NDR_PRINT_IN_DEBUG(spoolss_5a, &state->orig);
15143         }
15144
15145         /* make a temporary copy, that we pass to the dispatch function */
15146         state->tmp = state->orig;
15147
15148         subreq = cli->dispatch_send(state, ev, cli,
15149                                     &ndr_table_spoolss,
15150                                     NDR_SPOOLSS_5A,
15151                                     &state->tmp);
15152         if (tevent_req_nomem(subreq, req)) {
15153                 return tevent_req_post(req, ev);
15154         }
15155         tevent_req_set_callback(subreq, rpccli_spoolss_5a_done, req);
15156         return req;
15157 }
15158
15159 static void rpccli_spoolss_5a_done(struct tevent_req *subreq)
15160 {
15161         struct tevent_req *req = tevent_req_callback_data(
15162                 subreq, struct tevent_req);
15163         struct rpccli_spoolss_5a_state *state = tevent_req_data(
15164                 req, struct rpccli_spoolss_5a_state);
15165         NTSTATUS status;
15166         TALLOC_CTX *mem_ctx;
15167
15168         if (state->out_mem_ctx) {
15169                 mem_ctx = state->out_mem_ctx;
15170         } else {
15171                 mem_ctx = state;
15172         }
15173
15174         status = state->dispatch_recv(subreq, mem_ctx);
15175         TALLOC_FREE(subreq);
15176         if (!NT_STATUS_IS_OK(status)) {
15177                 tevent_req_nterror(req, status);
15178                 return;
15179         }
15180
15181         /* Copy out parameters */
15182
15183         /* Copy result */
15184         state->orig.out.result = state->tmp.out.result;
15185
15186         /* Reset temporary structure */
15187         ZERO_STRUCT(state->tmp);
15188
15189         if (DEBUGLEVEL >= 10) {
15190                 NDR_PRINT_OUT_DEBUG(spoolss_5a, &state->orig);
15191         }
15192
15193         tevent_req_done(req);
15194 }
15195
15196 NTSTATUS rpccli_spoolss_5a_recv(struct tevent_req *req,
15197                                 TALLOC_CTX *mem_ctx,
15198                                 WERROR *result)
15199 {
15200         struct rpccli_spoolss_5a_state *state = tevent_req_data(
15201                 req, struct rpccli_spoolss_5a_state);
15202         NTSTATUS status;
15203
15204         if (tevent_req_is_nterror(req, &status)) {
15205                 tevent_req_received(req);
15206                 return status;
15207         }
15208
15209         /* Steal possbile out parameters to the callers context */
15210         talloc_steal(mem_ctx, state->out_mem_ctx);
15211
15212         /* Return result */
15213         *result = state->orig.out.result;
15214
15215         tevent_req_received(req);
15216         return NT_STATUS_OK;
15217 }
15218
15219 NTSTATUS rpccli_spoolss_5a(struct rpc_pipe_client *cli,
15220                            TALLOC_CTX *mem_ctx,
15221                            WERROR *werror)
15222 {
15223         struct spoolss_5a r;
15224         NTSTATUS status;
15225
15226         /* In parameters */
15227
15228         if (DEBUGLEVEL >= 10) {
15229                 NDR_PRINT_IN_DEBUG(spoolss_5a, &r);
15230         }
15231
15232         status = cli->dispatch(cli,
15233                                 mem_ctx,
15234                                 &ndr_table_spoolss,
15235                                 NDR_SPOOLSS_5A,
15236                                 &r);
15237
15238         if (!NT_STATUS_IS_OK(status)) {
15239                 return status;
15240         }
15241
15242         if (DEBUGLEVEL >= 10) {
15243                 NDR_PRINT_OUT_DEBUG(spoolss_5a, &r);
15244         }
15245
15246         if (NT_STATUS_IS_ERR(status)) {
15247                 return status;
15248         }
15249
15250         /* Return variables */
15251
15252         /* Return result */
15253         if (werror) {
15254                 *werror = r.out.result;
15255         }
15256
15257         return werror_to_ntstatus(r.out.result);
15258 }
15259
15260 struct rpccli_spoolss_5b_state {
15261         struct spoolss_5b orig;
15262         struct spoolss_5b tmp;
15263         TALLOC_CTX *out_mem_ctx;
15264         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
15265 };
15266
15267 static void rpccli_spoolss_5b_done(struct tevent_req *subreq);
15268
15269 struct tevent_req *rpccli_spoolss_5b_send(TALLOC_CTX *mem_ctx,
15270                                           struct tevent_context *ev,
15271                                           struct rpc_pipe_client *cli)
15272 {
15273         struct tevent_req *req;
15274         struct rpccli_spoolss_5b_state *state;
15275         struct tevent_req *subreq;
15276
15277         req = tevent_req_create(mem_ctx, &state,
15278                                 struct rpccli_spoolss_5b_state);
15279         if (req == NULL) {
15280                 return NULL;
15281         }
15282         state->out_mem_ctx = NULL;
15283         state->dispatch_recv = cli->dispatch_recv;
15284
15285         /* In parameters */
15286
15287         /* Out parameters */
15288
15289         /* Result */
15290         ZERO_STRUCT(state->orig.out.result);
15291
15292         if (DEBUGLEVEL >= 10) {
15293                 NDR_PRINT_IN_DEBUG(spoolss_5b, &state->orig);
15294         }
15295
15296         /* make a temporary copy, that we pass to the dispatch function */
15297         state->tmp = state->orig;
15298
15299         subreq = cli->dispatch_send(state, ev, cli,
15300                                     &ndr_table_spoolss,
15301                                     NDR_SPOOLSS_5B,
15302                                     &state->tmp);
15303         if (tevent_req_nomem(subreq, req)) {
15304                 return tevent_req_post(req, ev);
15305         }
15306         tevent_req_set_callback(subreq, rpccli_spoolss_5b_done, req);
15307         return req;
15308 }
15309
15310 static void rpccli_spoolss_5b_done(struct tevent_req *subreq)
15311 {
15312         struct tevent_req *req = tevent_req_callback_data(
15313                 subreq, struct tevent_req);
15314         struct rpccli_spoolss_5b_state *state = tevent_req_data(
15315                 req, struct rpccli_spoolss_5b_state);
15316         NTSTATUS status;
15317         TALLOC_CTX *mem_ctx;
15318
15319         if (state->out_mem_ctx) {
15320                 mem_ctx = state->out_mem_ctx;
15321         } else {
15322                 mem_ctx = state;
15323         }
15324
15325         status = state->dispatch_recv(subreq, mem_ctx);
15326         TALLOC_FREE(subreq);
15327         if (!NT_STATUS_IS_OK(status)) {
15328                 tevent_req_nterror(req, status);
15329                 return;
15330         }
15331
15332         /* Copy out parameters */
15333
15334         /* Copy result */
15335         state->orig.out.result = state->tmp.out.result;
15336
15337         /* Reset temporary structure */
15338         ZERO_STRUCT(state->tmp);
15339
15340         if (DEBUGLEVEL >= 10) {
15341                 NDR_PRINT_OUT_DEBUG(spoolss_5b, &state->orig);
15342         }
15343
15344         tevent_req_done(req);
15345 }
15346
15347 NTSTATUS rpccli_spoolss_5b_recv(struct tevent_req *req,
15348                                 TALLOC_CTX *mem_ctx,
15349                                 WERROR *result)
15350 {
15351         struct rpccli_spoolss_5b_state *state = tevent_req_data(
15352                 req, struct rpccli_spoolss_5b_state);
15353         NTSTATUS status;
15354
15355         if (tevent_req_is_nterror(req, &status)) {
15356                 tevent_req_received(req);
15357                 return status;
15358         }
15359
15360         /* Steal possbile out parameters to the callers context */
15361         talloc_steal(mem_ctx, state->out_mem_ctx);
15362
15363         /* Return result */
15364         *result = state->orig.out.result;
15365
15366         tevent_req_received(req);
15367         return NT_STATUS_OK;
15368 }
15369
15370 NTSTATUS rpccli_spoolss_5b(struct rpc_pipe_client *cli,
15371                            TALLOC_CTX *mem_ctx,
15372                            WERROR *werror)
15373 {
15374         struct spoolss_5b r;
15375         NTSTATUS status;
15376
15377         /* In parameters */
15378
15379         if (DEBUGLEVEL >= 10) {
15380                 NDR_PRINT_IN_DEBUG(spoolss_5b, &r);
15381         }
15382
15383         status = cli->dispatch(cli,
15384                                 mem_ctx,
15385                                 &ndr_table_spoolss,
15386                                 NDR_SPOOLSS_5B,
15387                                 &r);
15388
15389         if (!NT_STATUS_IS_OK(status)) {
15390                 return status;
15391         }
15392
15393         if (DEBUGLEVEL >= 10) {
15394                 NDR_PRINT_OUT_DEBUG(spoolss_5b, &r);
15395         }
15396
15397         if (NT_STATUS_IS_ERR(status)) {
15398                 return status;
15399         }
15400
15401         /* Return variables */
15402
15403         /* Return result */
15404         if (werror) {
15405                 *werror = r.out.result;
15406         }
15407
15408         return werror_to_ntstatus(r.out.result);
15409 }
15410
15411 struct rpccli_spoolss_5c_state {
15412         struct spoolss_5c orig;
15413         struct spoolss_5c tmp;
15414         TALLOC_CTX *out_mem_ctx;
15415         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
15416 };
15417
15418 static void rpccli_spoolss_5c_done(struct tevent_req *subreq);
15419
15420 struct tevent_req *rpccli_spoolss_5c_send(TALLOC_CTX *mem_ctx,
15421                                           struct tevent_context *ev,
15422                                           struct rpc_pipe_client *cli)
15423 {
15424         struct tevent_req *req;
15425         struct rpccli_spoolss_5c_state *state;
15426         struct tevent_req *subreq;
15427
15428         req = tevent_req_create(mem_ctx, &state,
15429                                 struct rpccli_spoolss_5c_state);
15430         if (req == NULL) {
15431                 return NULL;
15432         }
15433         state->out_mem_ctx = NULL;
15434         state->dispatch_recv = cli->dispatch_recv;
15435
15436         /* In parameters */
15437
15438         /* Out parameters */
15439
15440         /* Result */
15441         ZERO_STRUCT(state->orig.out.result);
15442
15443         if (DEBUGLEVEL >= 10) {
15444                 NDR_PRINT_IN_DEBUG(spoolss_5c, &state->orig);
15445         }
15446
15447         /* make a temporary copy, that we pass to the dispatch function */
15448         state->tmp = state->orig;
15449
15450         subreq = cli->dispatch_send(state, ev, cli,
15451                                     &ndr_table_spoolss,
15452                                     NDR_SPOOLSS_5C,
15453                                     &state->tmp);
15454         if (tevent_req_nomem(subreq, req)) {
15455                 return tevent_req_post(req, ev);
15456         }
15457         tevent_req_set_callback(subreq, rpccli_spoolss_5c_done, req);
15458         return req;
15459 }
15460
15461 static void rpccli_spoolss_5c_done(struct tevent_req *subreq)
15462 {
15463         struct tevent_req *req = tevent_req_callback_data(
15464                 subreq, struct tevent_req);
15465         struct rpccli_spoolss_5c_state *state = tevent_req_data(
15466                 req, struct rpccli_spoolss_5c_state);
15467         NTSTATUS status;
15468         TALLOC_CTX *mem_ctx;
15469
15470         if (state->out_mem_ctx) {
15471                 mem_ctx = state->out_mem_ctx;
15472         } else {
15473                 mem_ctx = state;
15474         }
15475
15476         status = state->dispatch_recv(subreq, mem_ctx);
15477         TALLOC_FREE(subreq);
15478         if (!NT_STATUS_IS_OK(status)) {
15479                 tevent_req_nterror(req, status);
15480                 return;
15481         }
15482
15483         /* Copy out parameters */
15484
15485         /* Copy result */
15486         state->orig.out.result = state->tmp.out.result;
15487
15488         /* Reset temporary structure */
15489         ZERO_STRUCT(state->tmp);
15490
15491         if (DEBUGLEVEL >= 10) {
15492                 NDR_PRINT_OUT_DEBUG(spoolss_5c, &state->orig);
15493         }
15494
15495         tevent_req_done(req);
15496 }
15497
15498 NTSTATUS rpccli_spoolss_5c_recv(struct tevent_req *req,
15499                                 TALLOC_CTX *mem_ctx,
15500                                 WERROR *result)
15501 {
15502         struct rpccli_spoolss_5c_state *state = tevent_req_data(
15503                 req, struct rpccli_spoolss_5c_state);
15504         NTSTATUS status;
15505
15506         if (tevent_req_is_nterror(req, &status)) {
15507                 tevent_req_received(req);
15508                 return status;
15509         }
15510
15511         /* Steal possbile out parameters to the callers context */
15512         talloc_steal(mem_ctx, state->out_mem_ctx);
15513
15514         /* Return result */
15515         *result = state->orig.out.result;
15516
15517         tevent_req_received(req);
15518         return NT_STATUS_OK;
15519 }
15520
15521 NTSTATUS rpccli_spoolss_5c(struct rpc_pipe_client *cli,
15522                            TALLOC_CTX *mem_ctx,
15523                            WERROR *werror)
15524 {
15525         struct spoolss_5c r;
15526         NTSTATUS status;
15527
15528         /* In parameters */
15529
15530         if (DEBUGLEVEL >= 10) {
15531                 NDR_PRINT_IN_DEBUG(spoolss_5c, &r);
15532         }
15533
15534         status = cli->dispatch(cli,
15535                                 mem_ctx,
15536                                 &ndr_table_spoolss,
15537                                 NDR_SPOOLSS_5C,
15538                                 &r);
15539
15540         if (!NT_STATUS_IS_OK(status)) {
15541                 return status;
15542         }
15543
15544         if (DEBUGLEVEL >= 10) {
15545                 NDR_PRINT_OUT_DEBUG(spoolss_5c, &r);
15546         }
15547
15548         if (NT_STATUS_IS_ERR(status)) {
15549                 return status;
15550         }
15551
15552         /* Return variables */
15553
15554         /* Return result */
15555         if (werror) {
15556                 *werror = r.out.result;
15557         }
15558
15559         return werror_to_ntstatus(r.out.result);
15560 }
15561
15562 struct rpccli_spoolss_5d_state {
15563         struct spoolss_5d orig;
15564         struct spoolss_5d tmp;
15565         TALLOC_CTX *out_mem_ctx;
15566         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
15567 };
15568
15569 static void rpccli_spoolss_5d_done(struct tevent_req *subreq);
15570
15571 struct tevent_req *rpccli_spoolss_5d_send(TALLOC_CTX *mem_ctx,
15572                                           struct tevent_context *ev,
15573                                           struct rpc_pipe_client *cli)
15574 {
15575         struct tevent_req *req;
15576         struct rpccli_spoolss_5d_state *state;
15577         struct tevent_req *subreq;
15578
15579         req = tevent_req_create(mem_ctx, &state,
15580                                 struct rpccli_spoolss_5d_state);
15581         if (req == NULL) {
15582                 return NULL;
15583         }
15584         state->out_mem_ctx = NULL;
15585         state->dispatch_recv = cli->dispatch_recv;
15586
15587         /* In parameters */
15588
15589         /* Out parameters */
15590
15591         /* Result */
15592         ZERO_STRUCT(state->orig.out.result);
15593
15594         if (DEBUGLEVEL >= 10) {
15595                 NDR_PRINT_IN_DEBUG(spoolss_5d, &state->orig);
15596         }
15597
15598         /* make a temporary copy, that we pass to the dispatch function */
15599         state->tmp = state->orig;
15600
15601         subreq = cli->dispatch_send(state, ev, cli,
15602                                     &ndr_table_spoolss,
15603                                     NDR_SPOOLSS_5D,
15604                                     &state->tmp);
15605         if (tevent_req_nomem(subreq, req)) {
15606                 return tevent_req_post(req, ev);
15607         }
15608         tevent_req_set_callback(subreq, rpccli_spoolss_5d_done, req);
15609         return req;
15610 }
15611
15612 static void rpccli_spoolss_5d_done(struct tevent_req *subreq)
15613 {
15614         struct tevent_req *req = tevent_req_callback_data(
15615                 subreq, struct tevent_req);
15616         struct rpccli_spoolss_5d_state *state = tevent_req_data(
15617                 req, struct rpccli_spoolss_5d_state);
15618         NTSTATUS status;
15619         TALLOC_CTX *mem_ctx;
15620
15621         if (state->out_mem_ctx) {
15622                 mem_ctx = state->out_mem_ctx;
15623         } else {
15624                 mem_ctx = state;
15625         }
15626
15627         status = state->dispatch_recv(subreq, mem_ctx);
15628         TALLOC_FREE(subreq);
15629         if (!NT_STATUS_IS_OK(status)) {
15630                 tevent_req_nterror(req, status);
15631                 return;
15632         }
15633
15634         /* Copy out parameters */
15635
15636         /* Copy result */
15637         state->orig.out.result = state->tmp.out.result;
15638
15639         /* Reset temporary structure */
15640         ZERO_STRUCT(state->tmp);
15641
15642         if (DEBUGLEVEL >= 10) {
15643                 NDR_PRINT_OUT_DEBUG(spoolss_5d, &state->orig);
15644         }
15645
15646         tevent_req_done(req);
15647 }
15648
15649 NTSTATUS rpccli_spoolss_5d_recv(struct tevent_req *req,
15650                                 TALLOC_CTX *mem_ctx,
15651                                 WERROR *result)
15652 {
15653         struct rpccli_spoolss_5d_state *state = tevent_req_data(
15654                 req, struct rpccli_spoolss_5d_state);
15655         NTSTATUS status;
15656
15657         if (tevent_req_is_nterror(req, &status)) {
15658                 tevent_req_received(req);
15659                 return status;
15660         }
15661
15662         /* Steal possbile out parameters to the callers context */
15663         talloc_steal(mem_ctx, state->out_mem_ctx);
15664
15665         /* Return result */
15666         *result = state->orig.out.result;
15667
15668         tevent_req_received(req);
15669         return NT_STATUS_OK;
15670 }
15671
15672 NTSTATUS rpccli_spoolss_5d(struct rpc_pipe_client *cli,
15673                            TALLOC_CTX *mem_ctx,
15674                            WERROR *werror)
15675 {
15676         struct spoolss_5d r;
15677         NTSTATUS status;
15678
15679         /* In parameters */
15680
15681         if (DEBUGLEVEL >= 10) {
15682                 NDR_PRINT_IN_DEBUG(spoolss_5d, &r);
15683         }
15684
15685         status = cli->dispatch(cli,
15686                                 mem_ctx,
15687                                 &ndr_table_spoolss,
15688                                 NDR_SPOOLSS_5D,
15689                                 &r);
15690
15691         if (!NT_STATUS_IS_OK(status)) {
15692                 return status;
15693         }
15694
15695         if (DEBUGLEVEL >= 10) {
15696                 NDR_PRINT_OUT_DEBUG(spoolss_5d, &r);
15697         }
15698
15699         if (NT_STATUS_IS_ERR(status)) {
15700                 return status;
15701         }
15702
15703         /* Return variables */
15704
15705         /* Return result */
15706         if (werror) {
15707                 *werror = r.out.result;
15708         }
15709
15710         return werror_to_ntstatus(r.out.result);
15711 }
15712
15713 struct rpccli_spoolss_5e_state {
15714         struct spoolss_5e orig;
15715         struct spoolss_5e tmp;
15716         TALLOC_CTX *out_mem_ctx;
15717         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
15718 };
15719
15720 static void rpccli_spoolss_5e_done(struct tevent_req *subreq);
15721
15722 struct tevent_req *rpccli_spoolss_5e_send(TALLOC_CTX *mem_ctx,
15723                                           struct tevent_context *ev,
15724                                           struct rpc_pipe_client *cli)
15725 {
15726         struct tevent_req *req;
15727         struct rpccli_spoolss_5e_state *state;
15728         struct tevent_req *subreq;
15729
15730         req = tevent_req_create(mem_ctx, &state,
15731                                 struct rpccli_spoolss_5e_state);
15732         if (req == NULL) {
15733                 return NULL;
15734         }
15735         state->out_mem_ctx = NULL;
15736         state->dispatch_recv = cli->dispatch_recv;
15737
15738         /* In parameters */
15739
15740         /* Out parameters */
15741
15742         /* Result */
15743         ZERO_STRUCT(state->orig.out.result);
15744
15745         if (DEBUGLEVEL >= 10) {
15746                 NDR_PRINT_IN_DEBUG(spoolss_5e, &state->orig);
15747         }
15748
15749         /* make a temporary copy, that we pass to the dispatch function */
15750         state->tmp = state->orig;
15751
15752         subreq = cli->dispatch_send(state, ev, cli,
15753                                     &ndr_table_spoolss,
15754                                     NDR_SPOOLSS_5E,
15755                                     &state->tmp);
15756         if (tevent_req_nomem(subreq, req)) {
15757                 return tevent_req_post(req, ev);
15758         }
15759         tevent_req_set_callback(subreq, rpccli_spoolss_5e_done, req);
15760         return req;
15761 }
15762
15763 static void rpccli_spoolss_5e_done(struct tevent_req *subreq)
15764 {
15765         struct tevent_req *req = tevent_req_callback_data(
15766                 subreq, struct tevent_req);
15767         struct rpccli_spoolss_5e_state *state = tevent_req_data(
15768                 req, struct rpccli_spoolss_5e_state);
15769         NTSTATUS status;
15770         TALLOC_CTX *mem_ctx;
15771
15772         if (state->out_mem_ctx) {
15773                 mem_ctx = state->out_mem_ctx;
15774         } else {
15775                 mem_ctx = state;
15776         }
15777
15778         status = state->dispatch_recv(subreq, mem_ctx);
15779         TALLOC_FREE(subreq);
15780         if (!NT_STATUS_IS_OK(status)) {
15781                 tevent_req_nterror(req, status);
15782                 return;
15783         }
15784
15785         /* Copy out parameters */
15786
15787         /* Copy result */
15788         state->orig.out.result = state->tmp.out.result;
15789
15790         /* Reset temporary structure */
15791         ZERO_STRUCT(state->tmp);
15792
15793         if (DEBUGLEVEL >= 10) {
15794                 NDR_PRINT_OUT_DEBUG(spoolss_5e, &state->orig);
15795         }
15796
15797         tevent_req_done(req);
15798 }
15799
15800 NTSTATUS rpccli_spoolss_5e_recv(struct tevent_req *req,
15801                                 TALLOC_CTX *mem_ctx,
15802                                 WERROR *result)
15803 {
15804         struct rpccli_spoolss_5e_state *state = tevent_req_data(
15805                 req, struct rpccli_spoolss_5e_state);
15806         NTSTATUS status;
15807
15808         if (tevent_req_is_nterror(req, &status)) {
15809                 tevent_req_received(req);
15810                 return status;
15811         }
15812
15813         /* Steal possbile out parameters to the callers context */
15814         talloc_steal(mem_ctx, state->out_mem_ctx);
15815
15816         /* Return result */
15817         *result = state->orig.out.result;
15818
15819         tevent_req_received(req);
15820         return NT_STATUS_OK;
15821 }
15822
15823 NTSTATUS rpccli_spoolss_5e(struct rpc_pipe_client *cli,
15824                            TALLOC_CTX *mem_ctx,
15825                            WERROR *werror)
15826 {
15827         struct spoolss_5e r;
15828         NTSTATUS status;
15829
15830         /* In parameters */
15831
15832         if (DEBUGLEVEL >= 10) {
15833                 NDR_PRINT_IN_DEBUG(spoolss_5e, &r);
15834         }
15835
15836         status = cli->dispatch(cli,
15837                                 mem_ctx,
15838                                 &ndr_table_spoolss,
15839                                 NDR_SPOOLSS_5E,
15840                                 &r);
15841
15842         if (!NT_STATUS_IS_OK(status)) {
15843                 return status;
15844         }
15845
15846         if (DEBUGLEVEL >= 10) {
15847                 NDR_PRINT_OUT_DEBUG(spoolss_5e, &r);
15848         }
15849
15850         if (NT_STATUS_IS_ERR(status)) {
15851                 return status;
15852         }
15853
15854         /* Return variables */
15855
15856         /* Return result */
15857         if (werror) {
15858                 *werror = r.out.result;
15859         }
15860
15861         return werror_to_ntstatus(r.out.result);
15862 }
15863
15864 struct rpccli_spoolss_5f_state {
15865         struct spoolss_5f orig;
15866         struct spoolss_5f tmp;
15867         TALLOC_CTX *out_mem_ctx;
15868         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
15869 };
15870
15871 static void rpccli_spoolss_5f_done(struct tevent_req *subreq);
15872
15873 struct tevent_req *rpccli_spoolss_5f_send(TALLOC_CTX *mem_ctx,
15874                                           struct tevent_context *ev,
15875                                           struct rpc_pipe_client *cli)
15876 {
15877         struct tevent_req *req;
15878         struct rpccli_spoolss_5f_state *state;
15879         struct tevent_req *subreq;
15880
15881         req = tevent_req_create(mem_ctx, &state,
15882                                 struct rpccli_spoolss_5f_state);
15883         if (req == NULL) {
15884                 return NULL;
15885         }
15886         state->out_mem_ctx = NULL;
15887         state->dispatch_recv = cli->dispatch_recv;
15888
15889         /* In parameters */
15890
15891         /* Out parameters */
15892
15893         /* Result */
15894         ZERO_STRUCT(state->orig.out.result);
15895
15896         if (DEBUGLEVEL >= 10) {
15897                 NDR_PRINT_IN_DEBUG(spoolss_5f, &state->orig);
15898         }
15899
15900         /* make a temporary copy, that we pass to the dispatch function */
15901         state->tmp = state->orig;
15902
15903         subreq = cli->dispatch_send(state, ev, cli,
15904                                     &ndr_table_spoolss,
15905                                     NDR_SPOOLSS_5F,
15906                                     &state->tmp);
15907         if (tevent_req_nomem(subreq, req)) {
15908                 return tevent_req_post(req, ev);
15909         }
15910         tevent_req_set_callback(subreq, rpccli_spoolss_5f_done, req);
15911         return req;
15912 }
15913
15914 static void rpccli_spoolss_5f_done(struct tevent_req *subreq)
15915 {
15916         struct tevent_req *req = tevent_req_callback_data(
15917                 subreq, struct tevent_req);
15918         struct rpccli_spoolss_5f_state *state = tevent_req_data(
15919                 req, struct rpccli_spoolss_5f_state);
15920         NTSTATUS status;
15921         TALLOC_CTX *mem_ctx;
15922
15923         if (state->out_mem_ctx) {
15924                 mem_ctx = state->out_mem_ctx;
15925         } else {
15926                 mem_ctx = state;
15927         }
15928
15929         status = state->dispatch_recv(subreq, mem_ctx);
15930         TALLOC_FREE(subreq);
15931         if (!NT_STATUS_IS_OK(status)) {
15932                 tevent_req_nterror(req, status);
15933                 return;
15934         }
15935
15936         /* Copy out parameters */
15937
15938         /* Copy result */
15939         state->orig.out.result = state->tmp.out.result;
15940
15941         /* Reset temporary structure */
15942         ZERO_STRUCT(state->tmp);
15943
15944         if (DEBUGLEVEL >= 10) {
15945                 NDR_PRINT_OUT_DEBUG(spoolss_5f, &state->orig);
15946         }
15947
15948         tevent_req_done(req);
15949 }
15950
15951 NTSTATUS rpccli_spoolss_5f_recv(struct tevent_req *req,
15952                                 TALLOC_CTX *mem_ctx,
15953                                 WERROR *result)
15954 {
15955         struct rpccli_spoolss_5f_state *state = tevent_req_data(
15956                 req, struct rpccli_spoolss_5f_state);
15957         NTSTATUS status;
15958
15959         if (tevent_req_is_nterror(req, &status)) {
15960                 tevent_req_received(req);
15961                 return status;
15962         }
15963
15964         /* Steal possbile out parameters to the callers context */
15965         talloc_steal(mem_ctx, state->out_mem_ctx);
15966
15967         /* Return result */
15968         *result = state->orig.out.result;
15969
15970         tevent_req_received(req);
15971         return NT_STATUS_OK;
15972 }
15973
15974 NTSTATUS rpccli_spoolss_5f(struct rpc_pipe_client *cli,
15975                            TALLOC_CTX *mem_ctx,
15976                            WERROR *werror)
15977 {
15978         struct spoolss_5f r;
15979         NTSTATUS status;
15980
15981         /* In parameters */
15982
15983         if (DEBUGLEVEL >= 10) {
15984                 NDR_PRINT_IN_DEBUG(spoolss_5f, &r);
15985         }
15986
15987         status = cli->dispatch(cli,
15988                                 mem_ctx,
15989                                 &ndr_table_spoolss,
15990                                 NDR_SPOOLSS_5F,
15991                                 &r);
15992
15993         if (!NT_STATUS_IS_OK(status)) {
15994                 return status;
15995         }
15996
15997         if (DEBUGLEVEL >= 10) {
15998                 NDR_PRINT_OUT_DEBUG(spoolss_5f, &r);
15999         }
16000
16001         if (NT_STATUS_IS_ERR(status)) {
16002                 return status;
16003         }
16004
16005         /* Return variables */
16006
16007         /* Return result */
16008         if (werror) {
16009                 *werror = r.out.result;
16010         }
16011
16012         return werror_to_ntstatus(r.out.result);
16013 }
16014