s3:re-run make samba3-idl.
[amitay/samba.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         state->out_mem_ctx = talloc_named_const(state, 0,
58                              "rpccli_spoolss_EnumPrinters_out_memory");
59         if (tevent_req_nomem(state->out_mem_ctx, req)) {
60                 return tevent_req_post(req, ev);
61         }
62
63         /* make a temporary copy, that we pass to the dispatch function */
64         state->tmp = state->orig;
65
66         subreq = cli->dispatch_send(state, ev, cli,
67                                     &ndr_table_spoolss,
68                                     NDR_SPOOLSS_ENUMPRINTERS,
69                                     &state->tmp);
70         if (tevent_req_nomem(subreq, req)) {
71                 return tevent_req_post(req, ev);
72         }
73         tevent_req_set_callback(subreq, rpccli_spoolss_EnumPrinters_done, req);
74         return req;
75 }
76
77 static void rpccli_spoolss_EnumPrinters_done(struct tevent_req *subreq)
78 {
79         struct tevent_req *req = tevent_req_callback_data(
80                 subreq, struct tevent_req);
81         struct rpccli_spoolss_EnumPrinters_state *state = tevent_req_data(
82                 req, struct rpccli_spoolss_EnumPrinters_state);
83         NTSTATUS status;
84         TALLOC_CTX *mem_ctx;
85
86         if (state->out_mem_ctx) {
87                 mem_ctx = state->out_mem_ctx;
88         } else {
89                 mem_ctx = state;
90         }
91
92         status = state->dispatch_recv(subreq, mem_ctx);
93         TALLOC_FREE(subreq);
94         if (!NT_STATUS_IS_OK(status)) {
95                 tevent_req_nterror(req, status);
96                 return;
97         }
98
99         /* Copy out parameters */
100         *state->orig.out.count = *state->tmp.out.count;
101         *state->orig.out.info = *state->tmp.out.info;
102         *state->orig.out.needed = *state->tmp.out.needed;
103
104         /* Copy result */
105         state->orig.out.result = state->tmp.out.result;
106
107         /* Reset temporary structure */
108         ZERO_STRUCT(state->tmp);
109
110         tevent_req_done(req);
111 }
112
113 NTSTATUS rpccli_spoolss_EnumPrinters_recv(struct tevent_req *req,
114                                           TALLOC_CTX *mem_ctx,
115                                           WERROR *result)
116 {
117         struct rpccli_spoolss_EnumPrinters_state *state = tevent_req_data(
118                 req, struct rpccli_spoolss_EnumPrinters_state);
119         NTSTATUS status;
120
121         if (tevent_req_is_nterror(req, &status)) {
122                 tevent_req_received(req);
123                 return status;
124         }
125
126         /* Steal possbile out parameters to the callers context */
127         talloc_steal(mem_ctx, state->out_mem_ctx);
128
129         /* Return result */
130         *result = state->orig.out.result;
131
132         tevent_req_received(req);
133         return NT_STATUS_OK;
134 }
135
136 NTSTATUS rpccli_spoolss_EnumPrinters(struct rpc_pipe_client *cli,
137                                      TALLOC_CTX *mem_ctx,
138                                      uint32_t flags /* [in]  */,
139                                      const char *server /* [in] [unique,charset(UTF16)] */,
140                                      uint32_t level /* [in]  */,
141                                      DATA_BLOB *buffer /* [in] [unique] */,
142                                      uint32_t offered /* [in]  */,
143                                      uint32_t *count /* [out] [ref] */,
144                                      union spoolss_PrinterInfo **info /* [out] [ref,switch_is(level),size_is(,*count)] */,
145                                      uint32_t *needed /* [out] [ref] */,
146                                      WERROR *werror)
147 {
148         struct spoolss_EnumPrinters r;
149         NTSTATUS status;
150
151         /* In parameters */
152         r.in.flags = flags;
153         r.in.server = server;
154         r.in.level = level;
155         r.in.buffer = buffer;
156         r.in.offered = offered;
157
158         status = cli->dispatch(cli,
159                                 mem_ctx,
160                                 &ndr_table_spoolss,
161                                 NDR_SPOOLSS_ENUMPRINTERS,
162                                 &r);
163
164         if (!NT_STATUS_IS_OK(status)) {
165                 return status;
166         }
167
168         if (NT_STATUS_IS_ERR(status)) {
169                 return status;
170         }
171
172         /* Return variables */
173         *count = *r.out.count;
174         *info = *r.out.info;
175         *needed = *r.out.needed;
176
177         /* Return result */
178         if (werror) {
179                 *werror = r.out.result;
180         }
181
182         return werror_to_ntstatus(r.out.result);
183 }
184
185 struct rpccli_spoolss_OpenPrinter_state {
186         struct spoolss_OpenPrinter orig;
187         struct spoolss_OpenPrinter tmp;
188         TALLOC_CTX *out_mem_ctx;
189         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
190 };
191
192 static void rpccli_spoolss_OpenPrinter_done(struct tevent_req *subreq);
193
194 struct tevent_req *rpccli_spoolss_OpenPrinter_send(TALLOC_CTX *mem_ctx,
195                                                    struct tevent_context *ev,
196                                                    struct rpc_pipe_client *cli,
197                                                    const char *_printername /* [in] [unique,charset(UTF16)] */,
198                                                    const char *_datatype /* [in] [unique,charset(UTF16)] */,
199                                                    struct spoolss_DevmodeContainer _devmode_ctr /* [in]  */,
200                                                    uint32_t _access_mask /* [in]  */,
201                                                    struct policy_handle *_handle /* [out] [ref] */)
202 {
203         struct tevent_req *req;
204         struct rpccli_spoolss_OpenPrinter_state *state;
205         struct tevent_req *subreq;
206
207         req = tevent_req_create(mem_ctx, &state,
208                                 struct rpccli_spoolss_OpenPrinter_state);
209         if (req == NULL) {
210                 return NULL;
211         }
212         state->out_mem_ctx = NULL;
213         state->dispatch_recv = cli->dispatch_recv;
214
215         /* In parameters */
216         state->orig.in.printername = _printername;
217         state->orig.in.datatype = _datatype;
218         state->orig.in.devmode_ctr = _devmode_ctr;
219         state->orig.in.access_mask = _access_mask;
220
221         /* Out parameters */
222         state->orig.out.handle = _handle;
223
224         /* Result */
225         ZERO_STRUCT(state->orig.out.result);
226
227         state->out_mem_ctx = talloc_named_const(state, 0,
228                              "rpccli_spoolss_OpenPrinter_out_memory");
229         if (tevent_req_nomem(state->out_mem_ctx, req)) {
230                 return tevent_req_post(req, ev);
231         }
232
233         /* make a temporary copy, that we pass to the dispatch function */
234         state->tmp = state->orig;
235
236         subreq = cli->dispatch_send(state, ev, cli,
237                                     &ndr_table_spoolss,
238                                     NDR_SPOOLSS_OPENPRINTER,
239                                     &state->tmp);
240         if (tevent_req_nomem(subreq, req)) {
241                 return tevent_req_post(req, ev);
242         }
243         tevent_req_set_callback(subreq, rpccli_spoolss_OpenPrinter_done, req);
244         return req;
245 }
246
247 static void rpccli_spoolss_OpenPrinter_done(struct tevent_req *subreq)
248 {
249         struct tevent_req *req = tevent_req_callback_data(
250                 subreq, struct tevent_req);
251         struct rpccli_spoolss_OpenPrinter_state *state = tevent_req_data(
252                 req, struct rpccli_spoolss_OpenPrinter_state);
253         NTSTATUS status;
254         TALLOC_CTX *mem_ctx;
255
256         if (state->out_mem_ctx) {
257                 mem_ctx = state->out_mem_ctx;
258         } else {
259                 mem_ctx = state;
260         }
261
262         status = state->dispatch_recv(subreq, mem_ctx);
263         TALLOC_FREE(subreq);
264         if (!NT_STATUS_IS_OK(status)) {
265                 tevent_req_nterror(req, status);
266                 return;
267         }
268
269         /* Copy out parameters */
270         *state->orig.out.handle = *state->tmp.out.handle;
271
272         /* Copy result */
273         state->orig.out.result = state->tmp.out.result;
274
275         /* Reset temporary structure */
276         ZERO_STRUCT(state->tmp);
277
278         tevent_req_done(req);
279 }
280
281 NTSTATUS rpccli_spoolss_OpenPrinter_recv(struct tevent_req *req,
282                                          TALLOC_CTX *mem_ctx,
283                                          WERROR *result)
284 {
285         struct rpccli_spoolss_OpenPrinter_state *state = tevent_req_data(
286                 req, struct rpccli_spoolss_OpenPrinter_state);
287         NTSTATUS status;
288
289         if (tevent_req_is_nterror(req, &status)) {
290                 tevent_req_received(req);
291                 return status;
292         }
293
294         /* Steal possbile out parameters to the callers context */
295         talloc_steal(mem_ctx, state->out_mem_ctx);
296
297         /* Return result */
298         *result = state->orig.out.result;
299
300         tevent_req_received(req);
301         return NT_STATUS_OK;
302 }
303
304 NTSTATUS rpccli_spoolss_OpenPrinter(struct rpc_pipe_client *cli,
305                                     TALLOC_CTX *mem_ctx,
306                                     const char *printername /* [in] [unique,charset(UTF16)] */,
307                                     const char *datatype /* [in] [unique,charset(UTF16)] */,
308                                     struct spoolss_DevmodeContainer devmode_ctr /* [in]  */,
309                                     uint32_t access_mask /* [in]  */,
310                                     struct policy_handle *handle /* [out] [ref] */,
311                                     WERROR *werror)
312 {
313         struct spoolss_OpenPrinter r;
314         NTSTATUS status;
315
316         /* In parameters */
317         r.in.printername = printername;
318         r.in.datatype = datatype;
319         r.in.devmode_ctr = devmode_ctr;
320         r.in.access_mask = access_mask;
321
322         status = cli->dispatch(cli,
323                                 mem_ctx,
324                                 &ndr_table_spoolss,
325                                 NDR_SPOOLSS_OPENPRINTER,
326                                 &r);
327
328         if (!NT_STATUS_IS_OK(status)) {
329                 return status;
330         }
331
332         if (NT_STATUS_IS_ERR(status)) {
333                 return status;
334         }
335
336         /* Return variables */
337         *handle = *r.out.handle;
338
339         /* Return result */
340         if (werror) {
341                 *werror = r.out.result;
342         }
343
344         return werror_to_ntstatus(r.out.result);
345 }
346
347 struct rpccli_spoolss_SetJob_state {
348         struct spoolss_SetJob orig;
349         struct spoolss_SetJob tmp;
350         TALLOC_CTX *out_mem_ctx;
351         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
352 };
353
354 static void rpccli_spoolss_SetJob_done(struct tevent_req *subreq);
355
356 struct tevent_req *rpccli_spoolss_SetJob_send(TALLOC_CTX *mem_ctx,
357                                               struct tevent_context *ev,
358                                               struct rpc_pipe_client *cli,
359                                               struct policy_handle *_handle /* [in] [ref] */,
360                                               uint32_t _job_id /* [in]  */,
361                                               struct spoolss_JobInfoContainer *_ctr /* [in] [unique] */,
362                                               enum spoolss_JobControl _command /* [in]  */)
363 {
364         struct tevent_req *req;
365         struct rpccli_spoolss_SetJob_state *state;
366         struct tevent_req *subreq;
367
368         req = tevent_req_create(mem_ctx, &state,
369                                 struct rpccli_spoolss_SetJob_state);
370         if (req == NULL) {
371                 return NULL;
372         }
373         state->out_mem_ctx = NULL;
374         state->dispatch_recv = cli->dispatch_recv;
375
376         /* In parameters */
377         state->orig.in.handle = _handle;
378         state->orig.in.job_id = _job_id;
379         state->orig.in.ctr = _ctr;
380         state->orig.in.command = _command;
381
382         /* Out parameters */
383
384         /* Result */
385         ZERO_STRUCT(state->orig.out.result);
386
387         /* make a temporary copy, that we pass to the dispatch function */
388         state->tmp = state->orig;
389
390         subreq = cli->dispatch_send(state, ev, cli,
391                                     &ndr_table_spoolss,
392                                     NDR_SPOOLSS_SETJOB,
393                                     &state->tmp);
394         if (tevent_req_nomem(subreq, req)) {
395                 return tevent_req_post(req, ev);
396         }
397         tevent_req_set_callback(subreq, rpccli_spoolss_SetJob_done, req);
398         return req;
399 }
400
401 static void rpccli_spoolss_SetJob_done(struct tevent_req *subreq)
402 {
403         struct tevent_req *req = tevent_req_callback_data(
404                 subreq, struct tevent_req);
405         struct rpccli_spoolss_SetJob_state *state = tevent_req_data(
406                 req, struct rpccli_spoolss_SetJob_state);
407         NTSTATUS status;
408         TALLOC_CTX *mem_ctx;
409
410         if (state->out_mem_ctx) {
411                 mem_ctx = state->out_mem_ctx;
412         } else {
413                 mem_ctx = state;
414         }
415
416         status = state->dispatch_recv(subreq, mem_ctx);
417         TALLOC_FREE(subreq);
418         if (!NT_STATUS_IS_OK(status)) {
419                 tevent_req_nterror(req, status);
420                 return;
421         }
422
423         /* Copy out parameters */
424
425         /* Copy result */
426         state->orig.out.result = state->tmp.out.result;
427
428         /* Reset temporary structure */
429         ZERO_STRUCT(state->tmp);
430
431         tevent_req_done(req);
432 }
433
434 NTSTATUS rpccli_spoolss_SetJob_recv(struct tevent_req *req,
435                                     TALLOC_CTX *mem_ctx,
436                                     WERROR *result)
437 {
438         struct rpccli_spoolss_SetJob_state *state = tevent_req_data(
439                 req, struct rpccli_spoolss_SetJob_state);
440         NTSTATUS status;
441
442         if (tevent_req_is_nterror(req, &status)) {
443                 tevent_req_received(req);
444                 return status;
445         }
446
447         /* Steal possbile out parameters to the callers context */
448         talloc_steal(mem_ctx, state->out_mem_ctx);
449
450         /* Return result */
451         *result = state->orig.out.result;
452
453         tevent_req_received(req);
454         return NT_STATUS_OK;
455 }
456
457 NTSTATUS rpccli_spoolss_SetJob(struct rpc_pipe_client *cli,
458                                TALLOC_CTX *mem_ctx,
459                                struct policy_handle *handle /* [in] [ref] */,
460                                uint32_t job_id /* [in]  */,
461                                struct spoolss_JobInfoContainer *ctr /* [in] [unique] */,
462                                enum spoolss_JobControl command /* [in]  */,
463                                WERROR *werror)
464 {
465         struct spoolss_SetJob r;
466         NTSTATUS status;
467
468         /* In parameters */
469         r.in.handle = handle;
470         r.in.job_id = job_id;
471         r.in.ctr = ctr;
472         r.in.command = command;
473
474         status = cli->dispatch(cli,
475                                 mem_ctx,
476                                 &ndr_table_spoolss,
477                                 NDR_SPOOLSS_SETJOB,
478                                 &r);
479
480         if (!NT_STATUS_IS_OK(status)) {
481                 return status;
482         }
483
484         if (NT_STATUS_IS_ERR(status)) {
485                 return status;
486         }
487
488         /* Return variables */
489
490         /* Return result */
491         if (werror) {
492                 *werror = r.out.result;
493         }
494
495         return werror_to_ntstatus(r.out.result);
496 }
497
498 struct rpccli_spoolss_GetJob_state {
499         struct spoolss_GetJob orig;
500         struct spoolss_GetJob tmp;
501         TALLOC_CTX *out_mem_ctx;
502         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
503 };
504
505 static void rpccli_spoolss_GetJob_done(struct tevent_req *subreq);
506
507 struct tevent_req *rpccli_spoolss_GetJob_send(TALLOC_CTX *mem_ctx,
508                                               struct tevent_context *ev,
509                                               struct rpc_pipe_client *cli,
510                                               struct policy_handle *_handle /* [in] [ref] */,
511                                               uint32_t _job_id /* [in]  */,
512                                               uint32_t _level /* [in]  */,
513                                               DATA_BLOB *_buffer /* [in] [unique] */,
514                                               uint32_t _offered /* [in]  */,
515                                               union spoolss_JobInfo *_info /* [out] [unique,subcontext_size(offered),subcontext(4),switch_is(level)] */,
516                                               uint32_t *_needed /* [out] [ref] */)
517 {
518         struct tevent_req *req;
519         struct rpccli_spoolss_GetJob_state *state;
520         struct tevent_req *subreq;
521
522         req = tevent_req_create(mem_ctx, &state,
523                                 struct rpccli_spoolss_GetJob_state);
524         if (req == NULL) {
525                 return NULL;
526         }
527         state->out_mem_ctx = NULL;
528         state->dispatch_recv = cli->dispatch_recv;
529
530         /* In parameters */
531         state->orig.in.handle = _handle;
532         state->orig.in.job_id = _job_id;
533         state->orig.in.level = _level;
534         state->orig.in.buffer = _buffer;
535         state->orig.in.offered = _offered;
536
537         /* Out parameters */
538         state->orig.out.info = _info;
539         state->orig.out.needed = _needed;
540
541         /* Result */
542         ZERO_STRUCT(state->orig.out.result);
543
544         state->out_mem_ctx = talloc_named_const(state, 0,
545                              "rpccli_spoolss_GetJob_out_memory");
546         if (tevent_req_nomem(state->out_mem_ctx, req)) {
547                 return tevent_req_post(req, ev);
548         }
549
550         /* make a temporary copy, that we pass to the dispatch function */
551         state->tmp = state->orig;
552
553         subreq = cli->dispatch_send(state, ev, cli,
554                                     &ndr_table_spoolss,
555                                     NDR_SPOOLSS_GETJOB,
556                                     &state->tmp);
557         if (tevent_req_nomem(subreq, req)) {
558                 return tevent_req_post(req, ev);
559         }
560         tevent_req_set_callback(subreq, rpccli_spoolss_GetJob_done, req);
561         return req;
562 }
563
564 static void rpccli_spoolss_GetJob_done(struct tevent_req *subreq)
565 {
566         struct tevent_req *req = tevent_req_callback_data(
567                 subreq, struct tevent_req);
568         struct rpccli_spoolss_GetJob_state *state = tevent_req_data(
569                 req, struct rpccli_spoolss_GetJob_state);
570         NTSTATUS status;
571         TALLOC_CTX *mem_ctx;
572
573         if (state->out_mem_ctx) {
574                 mem_ctx = state->out_mem_ctx;
575         } else {
576                 mem_ctx = state;
577         }
578
579         status = state->dispatch_recv(subreq, mem_ctx);
580         TALLOC_FREE(subreq);
581         if (!NT_STATUS_IS_OK(status)) {
582                 tevent_req_nterror(req, status);
583                 return;
584         }
585
586         /* Copy out parameters */
587         if (state->orig.out.info && state->tmp.out.info) {
588                 *state->orig.out.info = *state->tmp.out.info;
589         }
590         *state->orig.out.needed = *state->tmp.out.needed;
591
592         /* Copy result */
593         state->orig.out.result = state->tmp.out.result;
594
595         /* Reset temporary structure */
596         ZERO_STRUCT(state->tmp);
597
598         tevent_req_done(req);
599 }
600
601 NTSTATUS rpccli_spoolss_GetJob_recv(struct tevent_req *req,
602                                     TALLOC_CTX *mem_ctx,
603                                     WERROR *result)
604 {
605         struct rpccli_spoolss_GetJob_state *state = tevent_req_data(
606                 req, struct rpccli_spoolss_GetJob_state);
607         NTSTATUS status;
608
609         if (tevent_req_is_nterror(req, &status)) {
610                 tevent_req_received(req);
611                 return status;
612         }
613
614         /* Steal possbile out parameters to the callers context */
615         talloc_steal(mem_ctx, state->out_mem_ctx);
616
617         /* Return result */
618         *result = state->orig.out.result;
619
620         tevent_req_received(req);
621         return NT_STATUS_OK;
622 }
623
624 NTSTATUS rpccli_spoolss_GetJob(struct rpc_pipe_client *cli,
625                                TALLOC_CTX *mem_ctx,
626                                struct policy_handle *handle /* [in] [ref] */,
627                                uint32_t job_id /* [in]  */,
628                                uint32_t level /* [in]  */,
629                                DATA_BLOB *buffer /* [in] [unique] */,
630                                uint32_t offered /* [in]  */,
631                                union spoolss_JobInfo *info /* [out] [unique,subcontext_size(offered),subcontext(4),switch_is(level)] */,
632                                uint32_t *needed /* [out] [ref] */,
633                                WERROR *werror)
634 {
635         struct spoolss_GetJob r;
636         NTSTATUS status;
637
638         /* In parameters */
639         r.in.handle = handle;
640         r.in.job_id = job_id;
641         r.in.level = level;
642         r.in.buffer = buffer;
643         r.in.offered = offered;
644
645         status = cli->dispatch(cli,
646                                 mem_ctx,
647                                 &ndr_table_spoolss,
648                                 NDR_SPOOLSS_GETJOB,
649                                 &r);
650
651         if (!NT_STATUS_IS_OK(status)) {
652                 return status;
653         }
654
655         if (NT_STATUS_IS_ERR(status)) {
656                 return status;
657         }
658
659         /* Return variables */
660         if (info && r.out.info) {
661                 *info = *r.out.info;
662         }
663         *needed = *r.out.needed;
664
665         /* Return result */
666         if (werror) {
667                 *werror = r.out.result;
668         }
669
670         return werror_to_ntstatus(r.out.result);
671 }
672
673 struct rpccli_spoolss_EnumJobs_state {
674         struct spoolss_EnumJobs orig;
675         struct spoolss_EnumJobs tmp;
676         TALLOC_CTX *out_mem_ctx;
677         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
678 };
679
680 static void rpccli_spoolss_EnumJobs_done(struct tevent_req *subreq);
681
682 struct tevent_req *rpccli_spoolss_EnumJobs_send(TALLOC_CTX *mem_ctx,
683                                                 struct tevent_context *ev,
684                                                 struct rpc_pipe_client *cli,
685                                                 struct policy_handle *_handle /* [in] [ref] */,
686                                                 uint32_t _firstjob /* [in]  */,
687                                                 uint32_t _numjobs /* [in]  */,
688                                                 uint32_t _level /* [in]  */,
689                                                 DATA_BLOB *_buffer /* [in] [unique] */,
690                                                 uint32_t _offered /* [in]  */,
691                                                 uint32_t *_count /* [out] [ref] */,
692                                                 union spoolss_JobInfo **_info /* [out] [ref,switch_is(level),size_is(,*count)] */,
693                                                 uint32_t *_needed /* [out] [ref] */)
694 {
695         struct tevent_req *req;
696         struct rpccli_spoolss_EnumJobs_state *state;
697         struct tevent_req *subreq;
698
699         req = tevent_req_create(mem_ctx, &state,
700                                 struct rpccli_spoolss_EnumJobs_state);
701         if (req == NULL) {
702                 return NULL;
703         }
704         state->out_mem_ctx = NULL;
705         state->dispatch_recv = cli->dispatch_recv;
706
707         /* In parameters */
708         state->orig.in.handle = _handle;
709         state->orig.in.firstjob = _firstjob;
710         state->orig.in.numjobs = _numjobs;
711         state->orig.in.level = _level;
712         state->orig.in.buffer = _buffer;
713         state->orig.in.offered = _offered;
714
715         /* Out parameters */
716         state->orig.out.count = _count;
717         state->orig.out.info = _info;
718         state->orig.out.needed = _needed;
719
720         /* Result */
721         ZERO_STRUCT(state->orig.out.result);
722
723         state->out_mem_ctx = talloc_named_const(state, 0,
724                              "rpccli_spoolss_EnumJobs_out_memory");
725         if (tevent_req_nomem(state->out_mem_ctx, req)) {
726                 return tevent_req_post(req, ev);
727         }
728
729         /* make a temporary copy, that we pass to the dispatch function */
730         state->tmp = state->orig;
731
732         subreq = cli->dispatch_send(state, ev, cli,
733                                     &ndr_table_spoolss,
734                                     NDR_SPOOLSS_ENUMJOBS,
735                                     &state->tmp);
736         if (tevent_req_nomem(subreq, req)) {
737                 return tevent_req_post(req, ev);
738         }
739         tevent_req_set_callback(subreq, rpccli_spoolss_EnumJobs_done, req);
740         return req;
741 }
742
743 static void rpccli_spoolss_EnumJobs_done(struct tevent_req *subreq)
744 {
745         struct tevent_req *req = tevent_req_callback_data(
746                 subreq, struct tevent_req);
747         struct rpccli_spoolss_EnumJobs_state *state = tevent_req_data(
748                 req, struct rpccli_spoolss_EnumJobs_state);
749         NTSTATUS status;
750         TALLOC_CTX *mem_ctx;
751
752         if (state->out_mem_ctx) {
753                 mem_ctx = state->out_mem_ctx;
754         } else {
755                 mem_ctx = state;
756         }
757
758         status = state->dispatch_recv(subreq, mem_ctx);
759         TALLOC_FREE(subreq);
760         if (!NT_STATUS_IS_OK(status)) {
761                 tevent_req_nterror(req, status);
762                 return;
763         }
764
765         /* Copy out parameters */
766         *state->orig.out.count = *state->tmp.out.count;
767         *state->orig.out.info = *state->tmp.out.info;
768         *state->orig.out.needed = *state->tmp.out.needed;
769
770         /* Copy result */
771         state->orig.out.result = state->tmp.out.result;
772
773         /* Reset temporary structure */
774         ZERO_STRUCT(state->tmp);
775
776         tevent_req_done(req);
777 }
778
779 NTSTATUS rpccli_spoolss_EnumJobs_recv(struct tevent_req *req,
780                                       TALLOC_CTX *mem_ctx,
781                                       WERROR *result)
782 {
783         struct rpccli_spoolss_EnumJobs_state *state = tevent_req_data(
784                 req, struct rpccli_spoolss_EnumJobs_state);
785         NTSTATUS status;
786
787         if (tevent_req_is_nterror(req, &status)) {
788                 tevent_req_received(req);
789                 return status;
790         }
791
792         /* Steal possbile out parameters to the callers context */
793         talloc_steal(mem_ctx, state->out_mem_ctx);
794
795         /* Return result */
796         *result = state->orig.out.result;
797
798         tevent_req_received(req);
799         return NT_STATUS_OK;
800 }
801
802 NTSTATUS rpccli_spoolss_EnumJobs(struct rpc_pipe_client *cli,
803                                  TALLOC_CTX *mem_ctx,
804                                  struct policy_handle *handle /* [in] [ref] */,
805                                  uint32_t firstjob /* [in]  */,
806                                  uint32_t numjobs /* [in]  */,
807                                  uint32_t level /* [in]  */,
808                                  DATA_BLOB *buffer /* [in] [unique] */,
809                                  uint32_t offered /* [in]  */,
810                                  uint32_t *count /* [out] [ref] */,
811                                  union spoolss_JobInfo **info /* [out] [ref,switch_is(level),size_is(,*count)] */,
812                                  uint32_t *needed /* [out] [ref] */,
813                                  WERROR *werror)
814 {
815         struct spoolss_EnumJobs r;
816         NTSTATUS status;
817
818         /* In parameters */
819         r.in.handle = handle;
820         r.in.firstjob = firstjob;
821         r.in.numjobs = numjobs;
822         r.in.level = level;
823         r.in.buffer = buffer;
824         r.in.offered = offered;
825
826         status = cli->dispatch(cli,
827                                 mem_ctx,
828                                 &ndr_table_spoolss,
829                                 NDR_SPOOLSS_ENUMJOBS,
830                                 &r);
831
832         if (!NT_STATUS_IS_OK(status)) {
833                 return status;
834         }
835
836         if (NT_STATUS_IS_ERR(status)) {
837                 return status;
838         }
839
840         /* Return variables */
841         *count = *r.out.count;
842         *info = *r.out.info;
843         *needed = *r.out.needed;
844
845         /* Return result */
846         if (werror) {
847                 *werror = r.out.result;
848         }
849
850         return werror_to_ntstatus(r.out.result);
851 }
852
853 struct rpccli_spoolss_AddPrinter_state {
854         struct spoolss_AddPrinter orig;
855         struct spoolss_AddPrinter tmp;
856         TALLOC_CTX *out_mem_ctx;
857         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
858 };
859
860 static void rpccli_spoolss_AddPrinter_done(struct tevent_req *subreq);
861
862 struct tevent_req *rpccli_spoolss_AddPrinter_send(TALLOC_CTX *mem_ctx,
863                                                   struct tevent_context *ev,
864                                                   struct rpc_pipe_client *cli,
865                                                   const char *_server /* [in] [unique,charset(UTF16)] */,
866                                                   struct spoolss_SetPrinterInfoCtr *_info_ctr /* [in] [ref] */,
867                                                   struct spoolss_DevmodeContainer *_devmode_ctr /* [in] [ref] */,
868                                                   struct sec_desc_buf *_secdesc_ctr /* [in] [ref] */,
869                                                   struct policy_handle *_handle /* [out] [ref] */)
870 {
871         struct tevent_req *req;
872         struct rpccli_spoolss_AddPrinter_state *state;
873         struct tevent_req *subreq;
874
875         req = tevent_req_create(mem_ctx, &state,
876                                 struct rpccli_spoolss_AddPrinter_state);
877         if (req == NULL) {
878                 return NULL;
879         }
880         state->out_mem_ctx = NULL;
881         state->dispatch_recv = cli->dispatch_recv;
882
883         /* In parameters */
884         state->orig.in.server = _server;
885         state->orig.in.info_ctr = _info_ctr;
886         state->orig.in.devmode_ctr = _devmode_ctr;
887         state->orig.in.secdesc_ctr = _secdesc_ctr;
888
889         /* Out parameters */
890         state->orig.out.handle = _handle;
891
892         /* Result */
893         ZERO_STRUCT(state->orig.out.result);
894
895         state->out_mem_ctx = talloc_named_const(state, 0,
896                              "rpccli_spoolss_AddPrinter_out_memory");
897         if (tevent_req_nomem(state->out_mem_ctx, req)) {
898                 return tevent_req_post(req, ev);
899         }
900
901         /* make a temporary copy, that we pass to the dispatch function */
902         state->tmp = state->orig;
903
904         subreq = cli->dispatch_send(state, ev, cli,
905                                     &ndr_table_spoolss,
906                                     NDR_SPOOLSS_ADDPRINTER,
907                                     &state->tmp);
908         if (tevent_req_nomem(subreq, req)) {
909                 return tevent_req_post(req, ev);
910         }
911         tevent_req_set_callback(subreq, rpccli_spoolss_AddPrinter_done, req);
912         return req;
913 }
914
915 static void rpccli_spoolss_AddPrinter_done(struct tevent_req *subreq)
916 {
917         struct tevent_req *req = tevent_req_callback_data(
918                 subreq, struct tevent_req);
919         struct rpccli_spoolss_AddPrinter_state *state = tevent_req_data(
920                 req, struct rpccli_spoolss_AddPrinter_state);
921         NTSTATUS status;
922         TALLOC_CTX *mem_ctx;
923
924         if (state->out_mem_ctx) {
925                 mem_ctx = state->out_mem_ctx;
926         } else {
927                 mem_ctx = state;
928         }
929
930         status = state->dispatch_recv(subreq, mem_ctx);
931         TALLOC_FREE(subreq);
932         if (!NT_STATUS_IS_OK(status)) {
933                 tevent_req_nterror(req, status);
934                 return;
935         }
936
937         /* Copy out parameters */
938         *state->orig.out.handle = *state->tmp.out.handle;
939
940         /* Copy result */
941         state->orig.out.result = state->tmp.out.result;
942
943         /* Reset temporary structure */
944         ZERO_STRUCT(state->tmp);
945
946         tevent_req_done(req);
947 }
948
949 NTSTATUS rpccli_spoolss_AddPrinter_recv(struct tevent_req *req,
950                                         TALLOC_CTX *mem_ctx,
951                                         WERROR *result)
952 {
953         struct rpccli_spoolss_AddPrinter_state *state = tevent_req_data(
954                 req, struct rpccli_spoolss_AddPrinter_state);
955         NTSTATUS status;
956
957         if (tevent_req_is_nterror(req, &status)) {
958                 tevent_req_received(req);
959                 return status;
960         }
961
962         /* Steal possbile out parameters to the callers context */
963         talloc_steal(mem_ctx, state->out_mem_ctx);
964
965         /* Return result */
966         *result = state->orig.out.result;
967
968         tevent_req_received(req);
969         return NT_STATUS_OK;
970 }
971
972 NTSTATUS rpccli_spoolss_AddPrinter(struct rpc_pipe_client *cli,
973                                    TALLOC_CTX *mem_ctx,
974                                    const char *server /* [in] [unique,charset(UTF16)] */,
975                                    struct spoolss_SetPrinterInfoCtr *info_ctr /* [in] [ref] */,
976                                    struct spoolss_DevmodeContainer *devmode_ctr /* [in] [ref] */,
977                                    struct sec_desc_buf *secdesc_ctr /* [in] [ref] */,
978                                    struct policy_handle *handle /* [out] [ref] */,
979                                    WERROR *werror)
980 {
981         struct spoolss_AddPrinter r;
982         NTSTATUS status;
983
984         /* In parameters */
985         r.in.server = server;
986         r.in.info_ctr = info_ctr;
987         r.in.devmode_ctr = devmode_ctr;
988         r.in.secdesc_ctr = secdesc_ctr;
989
990         status = cli->dispatch(cli,
991                                 mem_ctx,
992                                 &ndr_table_spoolss,
993                                 NDR_SPOOLSS_ADDPRINTER,
994                                 &r);
995
996         if (!NT_STATUS_IS_OK(status)) {
997                 return status;
998         }
999
1000         if (NT_STATUS_IS_ERR(status)) {
1001                 return status;
1002         }
1003
1004         /* Return variables */
1005         *handle = *r.out.handle;
1006
1007         /* Return result */
1008         if (werror) {
1009                 *werror = r.out.result;
1010         }
1011
1012         return werror_to_ntstatus(r.out.result);
1013 }
1014
1015 struct rpccli_spoolss_DeletePrinter_state {
1016         struct spoolss_DeletePrinter orig;
1017         struct spoolss_DeletePrinter tmp;
1018         TALLOC_CTX *out_mem_ctx;
1019         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1020 };
1021
1022 static void rpccli_spoolss_DeletePrinter_done(struct tevent_req *subreq);
1023
1024 struct tevent_req *rpccli_spoolss_DeletePrinter_send(TALLOC_CTX *mem_ctx,
1025                                                      struct tevent_context *ev,
1026                                                      struct rpc_pipe_client *cli,
1027                                                      struct policy_handle *_handle /* [in] [ref] */)
1028 {
1029         struct tevent_req *req;
1030         struct rpccli_spoolss_DeletePrinter_state *state;
1031         struct tevent_req *subreq;
1032
1033         req = tevent_req_create(mem_ctx, &state,
1034                                 struct rpccli_spoolss_DeletePrinter_state);
1035         if (req == NULL) {
1036                 return NULL;
1037         }
1038         state->out_mem_ctx = NULL;
1039         state->dispatch_recv = cli->dispatch_recv;
1040
1041         /* In parameters */
1042         state->orig.in.handle = _handle;
1043
1044         /* Out parameters */
1045
1046         /* Result */
1047         ZERO_STRUCT(state->orig.out.result);
1048
1049         /* make a temporary copy, that we pass to the dispatch function */
1050         state->tmp = state->orig;
1051
1052         subreq = cli->dispatch_send(state, ev, cli,
1053                                     &ndr_table_spoolss,
1054                                     NDR_SPOOLSS_DELETEPRINTER,
1055                                     &state->tmp);
1056         if (tevent_req_nomem(subreq, req)) {
1057                 return tevent_req_post(req, ev);
1058         }
1059         tevent_req_set_callback(subreq, rpccli_spoolss_DeletePrinter_done, req);
1060         return req;
1061 }
1062
1063 static void rpccli_spoolss_DeletePrinter_done(struct tevent_req *subreq)
1064 {
1065         struct tevent_req *req = tevent_req_callback_data(
1066                 subreq, struct tevent_req);
1067         struct rpccli_spoolss_DeletePrinter_state *state = tevent_req_data(
1068                 req, struct rpccli_spoolss_DeletePrinter_state);
1069         NTSTATUS status;
1070         TALLOC_CTX *mem_ctx;
1071
1072         if (state->out_mem_ctx) {
1073                 mem_ctx = state->out_mem_ctx;
1074         } else {
1075                 mem_ctx = state;
1076         }
1077
1078         status = state->dispatch_recv(subreq, mem_ctx);
1079         TALLOC_FREE(subreq);
1080         if (!NT_STATUS_IS_OK(status)) {
1081                 tevent_req_nterror(req, status);
1082                 return;
1083         }
1084
1085         /* Copy out parameters */
1086
1087         /* Copy result */
1088         state->orig.out.result = state->tmp.out.result;
1089
1090         /* Reset temporary structure */
1091         ZERO_STRUCT(state->tmp);
1092
1093         tevent_req_done(req);
1094 }
1095
1096 NTSTATUS rpccli_spoolss_DeletePrinter_recv(struct tevent_req *req,
1097                                            TALLOC_CTX *mem_ctx,
1098                                            WERROR *result)
1099 {
1100         struct rpccli_spoolss_DeletePrinter_state *state = tevent_req_data(
1101                 req, struct rpccli_spoolss_DeletePrinter_state);
1102         NTSTATUS status;
1103
1104         if (tevent_req_is_nterror(req, &status)) {
1105                 tevent_req_received(req);
1106                 return status;
1107         }
1108
1109         /* Steal possbile out parameters to the callers context */
1110         talloc_steal(mem_ctx, state->out_mem_ctx);
1111
1112         /* Return result */
1113         *result = state->orig.out.result;
1114
1115         tevent_req_received(req);
1116         return NT_STATUS_OK;
1117 }
1118
1119 NTSTATUS rpccli_spoolss_DeletePrinter(struct rpc_pipe_client *cli,
1120                                       TALLOC_CTX *mem_ctx,
1121                                       struct policy_handle *handle /* [in] [ref] */,
1122                                       WERROR *werror)
1123 {
1124         struct spoolss_DeletePrinter r;
1125         NTSTATUS status;
1126
1127         /* In parameters */
1128         r.in.handle = handle;
1129
1130         status = cli->dispatch(cli,
1131                                 mem_ctx,
1132                                 &ndr_table_spoolss,
1133                                 NDR_SPOOLSS_DELETEPRINTER,
1134                                 &r);
1135
1136         if (!NT_STATUS_IS_OK(status)) {
1137                 return status;
1138         }
1139
1140         if (NT_STATUS_IS_ERR(status)) {
1141                 return status;
1142         }
1143
1144         /* Return variables */
1145
1146         /* Return result */
1147         if (werror) {
1148                 *werror = r.out.result;
1149         }
1150
1151         return werror_to_ntstatus(r.out.result);
1152 }
1153
1154 struct rpccli_spoolss_SetPrinter_state {
1155         struct spoolss_SetPrinter orig;
1156         struct spoolss_SetPrinter tmp;
1157         TALLOC_CTX *out_mem_ctx;
1158         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1159 };
1160
1161 static void rpccli_spoolss_SetPrinter_done(struct tevent_req *subreq);
1162
1163 struct tevent_req *rpccli_spoolss_SetPrinter_send(TALLOC_CTX *mem_ctx,
1164                                                   struct tevent_context *ev,
1165                                                   struct rpc_pipe_client *cli,
1166                                                   struct policy_handle *_handle /* [in] [ref] */,
1167                                                   struct spoolss_SetPrinterInfoCtr *_info_ctr /* [in] [ref] */,
1168                                                   struct spoolss_DevmodeContainer *_devmode_ctr /* [in] [ref] */,
1169                                                   struct sec_desc_buf *_secdesc_ctr /* [in] [ref] */,
1170                                                   enum spoolss_PrinterControl _command /* [in]  */)
1171 {
1172         struct tevent_req *req;
1173         struct rpccli_spoolss_SetPrinter_state *state;
1174         struct tevent_req *subreq;
1175
1176         req = tevent_req_create(mem_ctx, &state,
1177                                 struct rpccli_spoolss_SetPrinter_state);
1178         if (req == NULL) {
1179                 return NULL;
1180         }
1181         state->out_mem_ctx = NULL;
1182         state->dispatch_recv = cli->dispatch_recv;
1183
1184         /* In parameters */
1185         state->orig.in.handle = _handle;
1186         state->orig.in.info_ctr = _info_ctr;
1187         state->orig.in.devmode_ctr = _devmode_ctr;
1188         state->orig.in.secdesc_ctr = _secdesc_ctr;
1189         state->orig.in.command = _command;
1190
1191         /* Out parameters */
1192
1193         /* Result */
1194         ZERO_STRUCT(state->orig.out.result);
1195
1196         /* make a temporary copy, that we pass to the dispatch function */
1197         state->tmp = state->orig;
1198
1199         subreq = cli->dispatch_send(state, ev, cli,
1200                                     &ndr_table_spoolss,
1201                                     NDR_SPOOLSS_SETPRINTER,
1202                                     &state->tmp);
1203         if (tevent_req_nomem(subreq, req)) {
1204                 return tevent_req_post(req, ev);
1205         }
1206         tevent_req_set_callback(subreq, rpccli_spoolss_SetPrinter_done, req);
1207         return req;
1208 }
1209
1210 static void rpccli_spoolss_SetPrinter_done(struct tevent_req *subreq)
1211 {
1212         struct tevent_req *req = tevent_req_callback_data(
1213                 subreq, struct tevent_req);
1214         struct rpccli_spoolss_SetPrinter_state *state = tevent_req_data(
1215                 req, struct rpccli_spoolss_SetPrinter_state);
1216         NTSTATUS status;
1217         TALLOC_CTX *mem_ctx;
1218
1219         if (state->out_mem_ctx) {
1220                 mem_ctx = state->out_mem_ctx;
1221         } else {
1222                 mem_ctx = state;
1223         }
1224
1225         status = state->dispatch_recv(subreq, mem_ctx);
1226         TALLOC_FREE(subreq);
1227         if (!NT_STATUS_IS_OK(status)) {
1228                 tevent_req_nterror(req, status);
1229                 return;
1230         }
1231
1232         /* Copy out parameters */
1233
1234         /* Copy result */
1235         state->orig.out.result = state->tmp.out.result;
1236
1237         /* Reset temporary structure */
1238         ZERO_STRUCT(state->tmp);
1239
1240         tevent_req_done(req);
1241 }
1242
1243 NTSTATUS rpccli_spoolss_SetPrinter_recv(struct tevent_req *req,
1244                                         TALLOC_CTX *mem_ctx,
1245                                         WERROR *result)
1246 {
1247         struct rpccli_spoolss_SetPrinter_state *state = tevent_req_data(
1248                 req, struct rpccli_spoolss_SetPrinter_state);
1249         NTSTATUS status;
1250
1251         if (tevent_req_is_nterror(req, &status)) {
1252                 tevent_req_received(req);
1253                 return status;
1254         }
1255
1256         /* Steal possbile out parameters to the callers context */
1257         talloc_steal(mem_ctx, state->out_mem_ctx);
1258
1259         /* Return result */
1260         *result = state->orig.out.result;
1261
1262         tevent_req_received(req);
1263         return NT_STATUS_OK;
1264 }
1265
1266 NTSTATUS rpccli_spoolss_SetPrinter(struct rpc_pipe_client *cli,
1267                                    TALLOC_CTX *mem_ctx,
1268                                    struct policy_handle *handle /* [in] [ref] */,
1269                                    struct spoolss_SetPrinterInfoCtr *info_ctr /* [in] [ref] */,
1270                                    struct spoolss_DevmodeContainer *devmode_ctr /* [in] [ref] */,
1271                                    struct sec_desc_buf *secdesc_ctr /* [in] [ref] */,
1272                                    enum spoolss_PrinterControl command /* [in]  */,
1273                                    WERROR *werror)
1274 {
1275         struct spoolss_SetPrinter r;
1276         NTSTATUS status;
1277
1278         /* In parameters */
1279         r.in.handle = handle;
1280         r.in.info_ctr = info_ctr;
1281         r.in.devmode_ctr = devmode_ctr;
1282         r.in.secdesc_ctr = secdesc_ctr;
1283         r.in.command = command;
1284
1285         status = cli->dispatch(cli,
1286                                 mem_ctx,
1287                                 &ndr_table_spoolss,
1288                                 NDR_SPOOLSS_SETPRINTER,
1289                                 &r);
1290
1291         if (!NT_STATUS_IS_OK(status)) {
1292                 return status;
1293         }
1294
1295         if (NT_STATUS_IS_ERR(status)) {
1296                 return status;
1297         }
1298
1299         /* Return variables */
1300
1301         /* Return result */
1302         if (werror) {
1303                 *werror = r.out.result;
1304         }
1305
1306         return werror_to_ntstatus(r.out.result);
1307 }
1308
1309 struct rpccli_spoolss_GetPrinter_state {
1310         struct spoolss_GetPrinter orig;
1311         struct spoolss_GetPrinter tmp;
1312         TALLOC_CTX *out_mem_ctx;
1313         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1314 };
1315
1316 static void rpccli_spoolss_GetPrinter_done(struct tevent_req *subreq);
1317
1318 struct tevent_req *rpccli_spoolss_GetPrinter_send(TALLOC_CTX *mem_ctx,
1319                                                   struct tevent_context *ev,
1320                                                   struct rpc_pipe_client *cli,
1321                                                   struct policy_handle *_handle /* [in] [ref] */,
1322                                                   uint32_t _level /* [in]  */,
1323                                                   DATA_BLOB *_buffer /* [in] [unique] */,
1324                                                   uint32_t _offered /* [in]  */,
1325                                                   union spoolss_PrinterInfo *_info /* [out] [unique,subcontext_size(offered),subcontext(4),switch_is(level)] */,
1326                                                   uint32_t *_needed /* [out] [ref] */)
1327 {
1328         struct tevent_req *req;
1329         struct rpccli_spoolss_GetPrinter_state *state;
1330         struct tevent_req *subreq;
1331
1332         req = tevent_req_create(mem_ctx, &state,
1333                                 struct rpccli_spoolss_GetPrinter_state);
1334         if (req == NULL) {
1335                 return NULL;
1336         }
1337         state->out_mem_ctx = NULL;
1338         state->dispatch_recv = cli->dispatch_recv;
1339
1340         /* In parameters */
1341         state->orig.in.handle = _handle;
1342         state->orig.in.level = _level;
1343         state->orig.in.buffer = _buffer;
1344         state->orig.in.offered = _offered;
1345
1346         /* Out parameters */
1347         state->orig.out.info = _info;
1348         state->orig.out.needed = _needed;
1349
1350         /* Result */
1351         ZERO_STRUCT(state->orig.out.result);
1352
1353         state->out_mem_ctx = talloc_named_const(state, 0,
1354                              "rpccli_spoolss_GetPrinter_out_memory");
1355         if (tevent_req_nomem(state->out_mem_ctx, req)) {
1356                 return tevent_req_post(req, ev);
1357         }
1358
1359         /* make a temporary copy, that we pass to the dispatch function */
1360         state->tmp = state->orig;
1361
1362         subreq = cli->dispatch_send(state, ev, cli,
1363                                     &ndr_table_spoolss,
1364                                     NDR_SPOOLSS_GETPRINTER,
1365                                     &state->tmp);
1366         if (tevent_req_nomem(subreq, req)) {
1367                 return tevent_req_post(req, ev);
1368         }
1369         tevent_req_set_callback(subreq, rpccli_spoolss_GetPrinter_done, req);
1370         return req;
1371 }
1372
1373 static void rpccli_spoolss_GetPrinter_done(struct tevent_req *subreq)
1374 {
1375         struct tevent_req *req = tevent_req_callback_data(
1376                 subreq, struct tevent_req);
1377         struct rpccli_spoolss_GetPrinter_state *state = tevent_req_data(
1378                 req, struct rpccli_spoolss_GetPrinter_state);
1379         NTSTATUS status;
1380         TALLOC_CTX *mem_ctx;
1381
1382         if (state->out_mem_ctx) {
1383                 mem_ctx = state->out_mem_ctx;
1384         } else {
1385                 mem_ctx = state;
1386         }
1387
1388         status = state->dispatch_recv(subreq, mem_ctx);
1389         TALLOC_FREE(subreq);
1390         if (!NT_STATUS_IS_OK(status)) {
1391                 tevent_req_nterror(req, status);
1392                 return;
1393         }
1394
1395         /* Copy out parameters */
1396         if (state->orig.out.info && state->tmp.out.info) {
1397                 *state->orig.out.info = *state->tmp.out.info;
1398         }
1399         *state->orig.out.needed = *state->tmp.out.needed;
1400
1401         /* Copy result */
1402         state->orig.out.result = state->tmp.out.result;
1403
1404         /* Reset temporary structure */
1405         ZERO_STRUCT(state->tmp);
1406
1407         tevent_req_done(req);
1408 }
1409
1410 NTSTATUS rpccli_spoolss_GetPrinter_recv(struct tevent_req *req,
1411                                         TALLOC_CTX *mem_ctx,
1412                                         WERROR *result)
1413 {
1414         struct rpccli_spoolss_GetPrinter_state *state = tevent_req_data(
1415                 req, struct rpccli_spoolss_GetPrinter_state);
1416         NTSTATUS status;
1417
1418         if (tevent_req_is_nterror(req, &status)) {
1419                 tevent_req_received(req);
1420                 return status;
1421         }
1422
1423         /* Steal possbile out parameters to the callers context */
1424         talloc_steal(mem_ctx, state->out_mem_ctx);
1425
1426         /* Return result */
1427         *result = state->orig.out.result;
1428
1429         tevent_req_received(req);
1430         return NT_STATUS_OK;
1431 }
1432
1433 NTSTATUS rpccli_spoolss_GetPrinter(struct rpc_pipe_client *cli,
1434                                    TALLOC_CTX *mem_ctx,
1435                                    struct policy_handle *handle /* [in] [ref] */,
1436                                    uint32_t level /* [in]  */,
1437                                    DATA_BLOB *buffer /* [in] [unique] */,
1438                                    uint32_t offered /* [in]  */,
1439                                    union spoolss_PrinterInfo *info /* [out] [unique,subcontext_size(offered),subcontext(4),switch_is(level)] */,
1440                                    uint32_t *needed /* [out] [ref] */,
1441                                    WERROR *werror)
1442 {
1443         struct spoolss_GetPrinter r;
1444         NTSTATUS status;
1445
1446         /* In parameters */
1447         r.in.handle = handle;
1448         r.in.level = level;
1449         r.in.buffer = buffer;
1450         r.in.offered = offered;
1451
1452         status = cli->dispatch(cli,
1453                                 mem_ctx,
1454                                 &ndr_table_spoolss,
1455                                 NDR_SPOOLSS_GETPRINTER,
1456                                 &r);
1457
1458         if (!NT_STATUS_IS_OK(status)) {
1459                 return status;
1460         }
1461
1462         if (NT_STATUS_IS_ERR(status)) {
1463                 return status;
1464         }
1465
1466         /* Return variables */
1467         if (info && r.out.info) {
1468                 *info = *r.out.info;
1469         }
1470         *needed = *r.out.needed;
1471
1472         /* Return result */
1473         if (werror) {
1474                 *werror = r.out.result;
1475         }
1476
1477         return werror_to_ntstatus(r.out.result);
1478 }
1479
1480 struct rpccli_spoolss_AddPrinterDriver_state {
1481         struct spoolss_AddPrinterDriver orig;
1482         struct spoolss_AddPrinterDriver tmp;
1483         TALLOC_CTX *out_mem_ctx;
1484         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1485 };
1486
1487 static void rpccli_spoolss_AddPrinterDriver_done(struct tevent_req *subreq);
1488
1489 struct tevent_req *rpccli_spoolss_AddPrinterDriver_send(TALLOC_CTX *mem_ctx,
1490                                                         struct tevent_context *ev,
1491                                                         struct rpc_pipe_client *cli,
1492                                                         const char *_servername /* [in] [unique,charset(UTF16)] */,
1493                                                         struct spoolss_AddDriverInfoCtr *_info_ctr /* [in] [ref] */)
1494 {
1495         struct tevent_req *req;
1496         struct rpccli_spoolss_AddPrinterDriver_state *state;
1497         struct tevent_req *subreq;
1498
1499         req = tevent_req_create(mem_ctx, &state,
1500                                 struct rpccli_spoolss_AddPrinterDriver_state);
1501         if (req == NULL) {
1502                 return NULL;
1503         }
1504         state->out_mem_ctx = NULL;
1505         state->dispatch_recv = cli->dispatch_recv;
1506
1507         /* In parameters */
1508         state->orig.in.servername = _servername;
1509         state->orig.in.info_ctr = _info_ctr;
1510
1511         /* Out parameters */
1512
1513         /* Result */
1514         ZERO_STRUCT(state->orig.out.result);
1515
1516         /* make a temporary copy, that we pass to the dispatch function */
1517         state->tmp = state->orig;
1518
1519         subreq = cli->dispatch_send(state, ev, cli,
1520                                     &ndr_table_spoolss,
1521                                     NDR_SPOOLSS_ADDPRINTERDRIVER,
1522                                     &state->tmp);
1523         if (tevent_req_nomem(subreq, req)) {
1524                 return tevent_req_post(req, ev);
1525         }
1526         tevent_req_set_callback(subreq, rpccli_spoolss_AddPrinterDriver_done, req);
1527         return req;
1528 }
1529
1530 static void rpccli_spoolss_AddPrinterDriver_done(struct tevent_req *subreq)
1531 {
1532         struct tevent_req *req = tevent_req_callback_data(
1533                 subreq, struct tevent_req);
1534         struct rpccli_spoolss_AddPrinterDriver_state *state = tevent_req_data(
1535                 req, struct rpccli_spoolss_AddPrinterDriver_state);
1536         NTSTATUS status;
1537         TALLOC_CTX *mem_ctx;
1538
1539         if (state->out_mem_ctx) {
1540                 mem_ctx = state->out_mem_ctx;
1541         } else {
1542                 mem_ctx = state;
1543         }
1544
1545         status = state->dispatch_recv(subreq, mem_ctx);
1546         TALLOC_FREE(subreq);
1547         if (!NT_STATUS_IS_OK(status)) {
1548                 tevent_req_nterror(req, status);
1549                 return;
1550         }
1551
1552         /* Copy out parameters */
1553
1554         /* Copy result */
1555         state->orig.out.result = state->tmp.out.result;
1556
1557         /* Reset temporary structure */
1558         ZERO_STRUCT(state->tmp);
1559
1560         tevent_req_done(req);
1561 }
1562
1563 NTSTATUS rpccli_spoolss_AddPrinterDriver_recv(struct tevent_req *req,
1564                                               TALLOC_CTX *mem_ctx,
1565                                               WERROR *result)
1566 {
1567         struct rpccli_spoolss_AddPrinterDriver_state *state = tevent_req_data(
1568                 req, struct rpccli_spoolss_AddPrinterDriver_state);
1569         NTSTATUS status;
1570
1571         if (tevent_req_is_nterror(req, &status)) {
1572                 tevent_req_received(req);
1573                 return status;
1574         }
1575
1576         /* Steal possbile out parameters to the callers context */
1577         talloc_steal(mem_ctx, state->out_mem_ctx);
1578
1579         /* Return result */
1580         *result = state->orig.out.result;
1581
1582         tevent_req_received(req);
1583         return NT_STATUS_OK;
1584 }
1585
1586 NTSTATUS rpccli_spoolss_AddPrinterDriver(struct rpc_pipe_client *cli,
1587                                          TALLOC_CTX *mem_ctx,
1588                                          const char *servername /* [in] [unique,charset(UTF16)] */,
1589                                          struct spoolss_AddDriverInfoCtr *info_ctr /* [in] [ref] */,
1590                                          WERROR *werror)
1591 {
1592         struct spoolss_AddPrinterDriver r;
1593         NTSTATUS status;
1594
1595         /* In parameters */
1596         r.in.servername = servername;
1597         r.in.info_ctr = info_ctr;
1598
1599         status = cli->dispatch(cli,
1600                                 mem_ctx,
1601                                 &ndr_table_spoolss,
1602                                 NDR_SPOOLSS_ADDPRINTERDRIVER,
1603                                 &r);
1604
1605         if (!NT_STATUS_IS_OK(status)) {
1606                 return status;
1607         }
1608
1609         if (NT_STATUS_IS_ERR(status)) {
1610                 return status;
1611         }
1612
1613         /* Return variables */
1614
1615         /* Return result */
1616         if (werror) {
1617                 *werror = r.out.result;
1618         }
1619
1620         return werror_to_ntstatus(r.out.result);
1621 }
1622
1623 struct rpccli_spoolss_EnumPrinterDrivers_state {
1624         struct spoolss_EnumPrinterDrivers orig;
1625         struct spoolss_EnumPrinterDrivers tmp;
1626         TALLOC_CTX *out_mem_ctx;
1627         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1628 };
1629
1630 static void rpccli_spoolss_EnumPrinterDrivers_done(struct tevent_req *subreq);
1631
1632 struct tevent_req *rpccli_spoolss_EnumPrinterDrivers_send(TALLOC_CTX *mem_ctx,
1633                                                           struct tevent_context *ev,
1634                                                           struct rpc_pipe_client *cli,
1635                                                           const char *_server /* [in] [unique,charset(UTF16)] */,
1636                                                           const char *_environment /* [in] [unique,charset(UTF16)] */,
1637                                                           uint32_t _level /* [in]  */,
1638                                                           DATA_BLOB *_buffer /* [in] [unique] */,
1639                                                           uint32_t _offered /* [in]  */,
1640                                                           uint32_t *_count /* [out] [ref] */,
1641                                                           union spoolss_DriverInfo **_info /* [out] [ref,switch_is(level),size_is(,*count)] */,
1642                                                           uint32_t *_needed /* [out] [ref] */)
1643 {
1644         struct tevent_req *req;
1645         struct rpccli_spoolss_EnumPrinterDrivers_state *state;
1646         struct tevent_req *subreq;
1647
1648         req = tevent_req_create(mem_ctx, &state,
1649                                 struct rpccli_spoolss_EnumPrinterDrivers_state);
1650         if (req == NULL) {
1651                 return NULL;
1652         }
1653         state->out_mem_ctx = NULL;
1654         state->dispatch_recv = cli->dispatch_recv;
1655
1656         /* In parameters */
1657         state->orig.in.server = _server;
1658         state->orig.in.environment = _environment;
1659         state->orig.in.level = _level;
1660         state->orig.in.buffer = _buffer;
1661         state->orig.in.offered = _offered;
1662
1663         /* Out parameters */
1664         state->orig.out.count = _count;
1665         state->orig.out.info = _info;
1666         state->orig.out.needed = _needed;
1667
1668         /* Result */
1669         ZERO_STRUCT(state->orig.out.result);
1670
1671         state->out_mem_ctx = talloc_named_const(state, 0,
1672                              "rpccli_spoolss_EnumPrinterDrivers_out_memory");
1673         if (tevent_req_nomem(state->out_mem_ctx, req)) {
1674                 return tevent_req_post(req, ev);
1675         }
1676
1677         /* make a temporary copy, that we pass to the dispatch function */
1678         state->tmp = state->orig;
1679
1680         subreq = cli->dispatch_send(state, ev, cli,
1681                                     &ndr_table_spoolss,
1682                                     NDR_SPOOLSS_ENUMPRINTERDRIVERS,
1683                                     &state->tmp);
1684         if (tevent_req_nomem(subreq, req)) {
1685                 return tevent_req_post(req, ev);
1686         }
1687         tevent_req_set_callback(subreq, rpccli_spoolss_EnumPrinterDrivers_done, req);
1688         return req;
1689 }
1690
1691 static void rpccli_spoolss_EnumPrinterDrivers_done(struct tevent_req *subreq)
1692 {
1693         struct tevent_req *req = tevent_req_callback_data(
1694                 subreq, struct tevent_req);
1695         struct rpccli_spoolss_EnumPrinterDrivers_state *state = tevent_req_data(
1696                 req, struct rpccli_spoolss_EnumPrinterDrivers_state);
1697         NTSTATUS status;
1698         TALLOC_CTX *mem_ctx;
1699
1700         if (state->out_mem_ctx) {
1701                 mem_ctx = state->out_mem_ctx;
1702         } else {
1703                 mem_ctx = state;
1704         }
1705
1706         status = state->dispatch_recv(subreq, mem_ctx);
1707         TALLOC_FREE(subreq);
1708         if (!NT_STATUS_IS_OK(status)) {
1709                 tevent_req_nterror(req, status);
1710                 return;
1711         }
1712
1713         /* Copy out parameters */
1714         *state->orig.out.count = *state->tmp.out.count;
1715         *state->orig.out.info = *state->tmp.out.info;
1716         *state->orig.out.needed = *state->tmp.out.needed;
1717
1718         /* Copy result */
1719         state->orig.out.result = state->tmp.out.result;
1720
1721         /* Reset temporary structure */
1722         ZERO_STRUCT(state->tmp);
1723
1724         tevent_req_done(req);
1725 }
1726
1727 NTSTATUS rpccli_spoolss_EnumPrinterDrivers_recv(struct tevent_req *req,
1728                                                 TALLOC_CTX *mem_ctx,
1729                                                 WERROR *result)
1730 {
1731         struct rpccli_spoolss_EnumPrinterDrivers_state *state = tevent_req_data(
1732                 req, struct rpccli_spoolss_EnumPrinterDrivers_state);
1733         NTSTATUS status;
1734
1735         if (tevent_req_is_nterror(req, &status)) {
1736                 tevent_req_received(req);
1737                 return status;
1738         }
1739
1740         /* Steal possbile out parameters to the callers context */
1741         talloc_steal(mem_ctx, state->out_mem_ctx);
1742
1743         /* Return result */
1744         *result = state->orig.out.result;
1745
1746         tevent_req_received(req);
1747         return NT_STATUS_OK;
1748 }
1749
1750 NTSTATUS rpccli_spoolss_EnumPrinterDrivers(struct rpc_pipe_client *cli,
1751                                            TALLOC_CTX *mem_ctx,
1752                                            const char *server /* [in] [unique,charset(UTF16)] */,
1753                                            const char *environment /* [in] [unique,charset(UTF16)] */,
1754                                            uint32_t level /* [in]  */,
1755                                            DATA_BLOB *buffer /* [in] [unique] */,
1756                                            uint32_t offered /* [in]  */,
1757                                            uint32_t *count /* [out] [ref] */,
1758                                            union spoolss_DriverInfo **info /* [out] [ref,switch_is(level),size_is(,*count)] */,
1759                                            uint32_t *needed /* [out] [ref] */,
1760                                            WERROR *werror)
1761 {
1762         struct spoolss_EnumPrinterDrivers r;
1763         NTSTATUS status;
1764
1765         /* In parameters */
1766         r.in.server = server;
1767         r.in.environment = environment;
1768         r.in.level = level;
1769         r.in.buffer = buffer;
1770         r.in.offered = offered;
1771
1772         status = cli->dispatch(cli,
1773                                 mem_ctx,
1774                                 &ndr_table_spoolss,
1775                                 NDR_SPOOLSS_ENUMPRINTERDRIVERS,
1776                                 &r);
1777
1778         if (!NT_STATUS_IS_OK(status)) {
1779                 return status;
1780         }
1781
1782         if (NT_STATUS_IS_ERR(status)) {
1783                 return status;
1784         }
1785
1786         /* Return variables */
1787         *count = *r.out.count;
1788         *info = *r.out.info;
1789         *needed = *r.out.needed;
1790
1791         /* Return result */
1792         if (werror) {
1793                 *werror = r.out.result;
1794         }
1795
1796         return werror_to_ntstatus(r.out.result);
1797 }
1798
1799 struct rpccli_spoolss_GetPrinterDriver_state {
1800         struct spoolss_GetPrinterDriver orig;
1801         struct spoolss_GetPrinterDriver tmp;
1802         TALLOC_CTX *out_mem_ctx;
1803         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1804 };
1805
1806 static void rpccli_spoolss_GetPrinterDriver_done(struct tevent_req *subreq);
1807
1808 struct tevent_req *rpccli_spoolss_GetPrinterDriver_send(TALLOC_CTX *mem_ctx,
1809                                                         struct tevent_context *ev,
1810                                                         struct rpc_pipe_client *cli,
1811                                                         struct policy_handle *_handle /* [in] [ref] */,
1812                                                         const char *_architecture /* [in] [unique,charset(UTF16)] */,
1813                                                         uint32_t _level /* [in]  */,
1814                                                         DATA_BLOB *_buffer /* [in] [unique] */,
1815                                                         uint32_t _offered /* [in]  */,
1816                                                         union spoolss_DriverInfo *_info /* [out] [unique,subcontext_size(offered),subcontext(4),switch_is(level)] */,
1817                                                         uint32_t *_needed /* [out] [ref] */)
1818 {
1819         struct tevent_req *req;
1820         struct rpccli_spoolss_GetPrinterDriver_state *state;
1821         struct tevent_req *subreq;
1822
1823         req = tevent_req_create(mem_ctx, &state,
1824                                 struct rpccli_spoolss_GetPrinterDriver_state);
1825         if (req == NULL) {
1826                 return NULL;
1827         }
1828         state->out_mem_ctx = NULL;
1829         state->dispatch_recv = cli->dispatch_recv;
1830
1831         /* In parameters */
1832         state->orig.in.handle = _handle;
1833         state->orig.in.architecture = _architecture;
1834         state->orig.in.level = _level;
1835         state->orig.in.buffer = _buffer;
1836         state->orig.in.offered = _offered;
1837
1838         /* Out parameters */
1839         state->orig.out.info = _info;
1840         state->orig.out.needed = _needed;
1841
1842         /* Result */
1843         ZERO_STRUCT(state->orig.out.result);
1844
1845         state->out_mem_ctx = talloc_named_const(state, 0,
1846                              "rpccli_spoolss_GetPrinterDriver_out_memory");
1847         if (tevent_req_nomem(state->out_mem_ctx, req)) {
1848                 return tevent_req_post(req, ev);
1849         }
1850
1851         /* make a temporary copy, that we pass to the dispatch function */
1852         state->tmp = state->orig;
1853
1854         subreq = cli->dispatch_send(state, ev, cli,
1855                                     &ndr_table_spoolss,
1856                                     NDR_SPOOLSS_GETPRINTERDRIVER,
1857                                     &state->tmp);
1858         if (tevent_req_nomem(subreq, req)) {
1859                 return tevent_req_post(req, ev);
1860         }
1861         tevent_req_set_callback(subreq, rpccli_spoolss_GetPrinterDriver_done, req);
1862         return req;
1863 }
1864
1865 static void rpccli_spoolss_GetPrinterDriver_done(struct tevent_req *subreq)
1866 {
1867         struct tevent_req *req = tevent_req_callback_data(
1868                 subreq, struct tevent_req);
1869         struct rpccli_spoolss_GetPrinterDriver_state *state = tevent_req_data(
1870                 req, struct rpccli_spoolss_GetPrinterDriver_state);
1871         NTSTATUS status;
1872         TALLOC_CTX *mem_ctx;
1873
1874         if (state->out_mem_ctx) {
1875                 mem_ctx = state->out_mem_ctx;
1876         } else {
1877                 mem_ctx = state;
1878         }
1879
1880         status = state->dispatch_recv(subreq, mem_ctx);
1881         TALLOC_FREE(subreq);
1882         if (!NT_STATUS_IS_OK(status)) {
1883                 tevent_req_nterror(req, status);
1884                 return;
1885         }
1886
1887         /* Copy out parameters */
1888         if (state->orig.out.info && state->tmp.out.info) {
1889                 *state->orig.out.info = *state->tmp.out.info;
1890         }
1891         *state->orig.out.needed = *state->tmp.out.needed;
1892
1893         /* Copy result */
1894         state->orig.out.result = state->tmp.out.result;
1895
1896         /* Reset temporary structure */
1897         ZERO_STRUCT(state->tmp);
1898
1899         tevent_req_done(req);
1900 }
1901
1902 NTSTATUS rpccli_spoolss_GetPrinterDriver_recv(struct tevent_req *req,
1903                                               TALLOC_CTX *mem_ctx,
1904                                               WERROR *result)
1905 {
1906         struct rpccli_spoolss_GetPrinterDriver_state *state = tevent_req_data(
1907                 req, struct rpccli_spoolss_GetPrinterDriver_state);
1908         NTSTATUS status;
1909
1910         if (tevent_req_is_nterror(req, &status)) {
1911                 tevent_req_received(req);
1912                 return status;
1913         }
1914
1915         /* Steal possbile out parameters to the callers context */
1916         talloc_steal(mem_ctx, state->out_mem_ctx);
1917
1918         /* Return result */
1919         *result = state->orig.out.result;
1920
1921         tevent_req_received(req);
1922         return NT_STATUS_OK;
1923 }
1924
1925 NTSTATUS rpccli_spoolss_GetPrinterDriver(struct rpc_pipe_client *cli,
1926                                          TALLOC_CTX *mem_ctx,
1927                                          struct policy_handle *handle /* [in] [ref] */,
1928                                          const char *architecture /* [in] [unique,charset(UTF16)] */,
1929                                          uint32_t level /* [in]  */,
1930                                          DATA_BLOB *buffer /* [in] [unique] */,
1931                                          uint32_t offered /* [in]  */,
1932                                          union spoolss_DriverInfo *info /* [out] [unique,subcontext_size(offered),subcontext(4),switch_is(level)] */,
1933                                          uint32_t *needed /* [out] [ref] */,
1934                                          WERROR *werror)
1935 {
1936         struct spoolss_GetPrinterDriver r;
1937         NTSTATUS status;
1938
1939         /* In parameters */
1940         r.in.handle = handle;
1941         r.in.architecture = architecture;
1942         r.in.level = level;
1943         r.in.buffer = buffer;
1944         r.in.offered = offered;
1945
1946         status = cli->dispatch(cli,
1947                                 mem_ctx,
1948                                 &ndr_table_spoolss,
1949                                 NDR_SPOOLSS_GETPRINTERDRIVER,
1950                                 &r);
1951
1952         if (!NT_STATUS_IS_OK(status)) {
1953                 return status;
1954         }
1955
1956         if (NT_STATUS_IS_ERR(status)) {
1957                 return status;
1958         }
1959
1960         /* Return variables */
1961         if (info && r.out.info) {
1962                 *info = *r.out.info;
1963         }
1964         *needed = *r.out.needed;
1965
1966         /* Return result */
1967         if (werror) {
1968                 *werror = r.out.result;
1969         }
1970
1971         return werror_to_ntstatus(r.out.result);
1972 }
1973
1974 struct rpccli_spoolss_GetPrinterDriverDirectory_state {
1975         struct spoolss_GetPrinterDriverDirectory orig;
1976         struct spoolss_GetPrinterDriverDirectory tmp;
1977         TALLOC_CTX *out_mem_ctx;
1978         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1979 };
1980
1981 static void rpccli_spoolss_GetPrinterDriverDirectory_done(struct tevent_req *subreq);
1982
1983 struct tevent_req *rpccli_spoolss_GetPrinterDriverDirectory_send(TALLOC_CTX *mem_ctx,
1984                                                                  struct tevent_context *ev,
1985                                                                  struct rpc_pipe_client *cli,
1986                                                                  const char *_server /* [in] [unique,charset(UTF16)] */,
1987                                                                  const char *_environment /* [in] [unique,charset(UTF16)] */,
1988                                                                  uint32_t _level /* [in]  */,
1989                                                                  DATA_BLOB *_buffer /* [in] [unique] */,
1990                                                                  uint32_t _offered /* [in]  */,
1991                                                                  union spoolss_DriverDirectoryInfo *_info /* [out] [unique,subcontext_size(offered),subcontext(4),switch_is(level)] */,
1992                                                                  uint32_t *_needed /* [out] [ref] */)
1993 {
1994         struct tevent_req *req;
1995         struct rpccli_spoolss_GetPrinterDriverDirectory_state *state;
1996         struct tevent_req *subreq;
1997
1998         req = tevent_req_create(mem_ctx, &state,
1999                                 struct rpccli_spoolss_GetPrinterDriverDirectory_state);
2000         if (req == NULL) {
2001                 return NULL;
2002         }
2003         state->out_mem_ctx = NULL;
2004         state->dispatch_recv = cli->dispatch_recv;
2005
2006         /* In parameters */
2007         state->orig.in.server = _server;
2008         state->orig.in.environment = _environment;
2009         state->orig.in.level = _level;
2010         state->orig.in.buffer = _buffer;
2011         state->orig.in.offered = _offered;
2012
2013         /* Out parameters */
2014         state->orig.out.info = _info;
2015         state->orig.out.needed = _needed;
2016
2017         /* Result */
2018         ZERO_STRUCT(state->orig.out.result);
2019
2020         state->out_mem_ctx = talloc_named_const(state, 0,
2021                              "rpccli_spoolss_GetPrinterDriverDirectory_out_memory");
2022         if (tevent_req_nomem(state->out_mem_ctx, req)) {
2023                 return tevent_req_post(req, ev);
2024         }
2025
2026         /* make a temporary copy, that we pass to the dispatch function */
2027         state->tmp = state->orig;
2028
2029         subreq = cli->dispatch_send(state, ev, cli,
2030                                     &ndr_table_spoolss,
2031                                     NDR_SPOOLSS_GETPRINTERDRIVERDIRECTORY,
2032                                     &state->tmp);
2033         if (tevent_req_nomem(subreq, req)) {
2034                 return tevent_req_post(req, ev);
2035         }
2036         tevent_req_set_callback(subreq, rpccli_spoolss_GetPrinterDriverDirectory_done, req);
2037         return req;
2038 }
2039
2040 static void rpccli_spoolss_GetPrinterDriverDirectory_done(struct tevent_req *subreq)
2041 {
2042         struct tevent_req *req = tevent_req_callback_data(
2043                 subreq, struct tevent_req);
2044         struct rpccli_spoolss_GetPrinterDriverDirectory_state *state = tevent_req_data(
2045                 req, struct rpccli_spoolss_GetPrinterDriverDirectory_state);
2046         NTSTATUS status;
2047         TALLOC_CTX *mem_ctx;
2048
2049         if (state->out_mem_ctx) {
2050                 mem_ctx = state->out_mem_ctx;
2051         } else {
2052                 mem_ctx = state;
2053         }
2054
2055         status = state->dispatch_recv(subreq, mem_ctx);
2056         TALLOC_FREE(subreq);
2057         if (!NT_STATUS_IS_OK(status)) {
2058                 tevent_req_nterror(req, status);
2059                 return;
2060         }
2061
2062         /* Copy out parameters */
2063         if (state->orig.out.info && state->tmp.out.info) {
2064                 *state->orig.out.info = *state->tmp.out.info;
2065         }
2066         *state->orig.out.needed = *state->tmp.out.needed;
2067
2068         /* Copy result */
2069         state->orig.out.result = state->tmp.out.result;
2070
2071         /* Reset temporary structure */
2072         ZERO_STRUCT(state->tmp);
2073
2074         tevent_req_done(req);
2075 }
2076
2077 NTSTATUS rpccli_spoolss_GetPrinterDriverDirectory_recv(struct tevent_req *req,
2078                                                        TALLOC_CTX *mem_ctx,
2079                                                        WERROR *result)
2080 {
2081         struct rpccli_spoolss_GetPrinterDriverDirectory_state *state = tevent_req_data(
2082                 req, struct rpccli_spoolss_GetPrinterDriverDirectory_state);
2083         NTSTATUS status;
2084
2085         if (tevent_req_is_nterror(req, &status)) {
2086                 tevent_req_received(req);
2087                 return status;
2088         }
2089
2090         /* Steal possbile out parameters to the callers context */
2091         talloc_steal(mem_ctx, state->out_mem_ctx);
2092
2093         /* Return result */
2094         *result = state->orig.out.result;
2095
2096         tevent_req_received(req);
2097         return NT_STATUS_OK;
2098 }
2099
2100 NTSTATUS rpccli_spoolss_GetPrinterDriverDirectory(struct rpc_pipe_client *cli,
2101                                                   TALLOC_CTX *mem_ctx,
2102                                                   const char *server /* [in] [unique,charset(UTF16)] */,
2103                                                   const char *environment /* [in] [unique,charset(UTF16)] */,
2104                                                   uint32_t level /* [in]  */,
2105                                                   DATA_BLOB *buffer /* [in] [unique] */,
2106                                                   uint32_t offered /* [in]  */,
2107                                                   union spoolss_DriverDirectoryInfo *info /* [out] [unique,subcontext_size(offered),subcontext(4),switch_is(level)] */,
2108                                                   uint32_t *needed /* [out] [ref] */,
2109                                                   WERROR *werror)
2110 {
2111         struct spoolss_GetPrinterDriverDirectory r;
2112         NTSTATUS status;
2113
2114         /* In parameters */
2115         r.in.server = server;
2116         r.in.environment = environment;
2117         r.in.level = level;
2118         r.in.buffer = buffer;
2119         r.in.offered = offered;
2120
2121         status = cli->dispatch(cli,
2122                                 mem_ctx,
2123                                 &ndr_table_spoolss,
2124                                 NDR_SPOOLSS_GETPRINTERDRIVERDIRECTORY,
2125                                 &r);
2126
2127         if (!NT_STATUS_IS_OK(status)) {
2128                 return status;
2129         }
2130
2131         if (NT_STATUS_IS_ERR(status)) {
2132                 return status;
2133         }
2134
2135         /* Return variables */
2136         if (info && r.out.info) {
2137                 *info = *r.out.info;
2138         }
2139         *needed = *r.out.needed;
2140
2141         /* Return result */
2142         if (werror) {
2143                 *werror = r.out.result;
2144         }
2145
2146         return werror_to_ntstatus(r.out.result);
2147 }
2148
2149 struct rpccli_spoolss_DeletePrinterDriver_state {
2150         struct spoolss_DeletePrinterDriver orig;
2151         struct spoolss_DeletePrinterDriver tmp;
2152         TALLOC_CTX *out_mem_ctx;
2153         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2154 };
2155
2156 static void rpccli_spoolss_DeletePrinterDriver_done(struct tevent_req *subreq);
2157
2158 struct tevent_req *rpccli_spoolss_DeletePrinterDriver_send(TALLOC_CTX *mem_ctx,
2159                                                            struct tevent_context *ev,
2160                                                            struct rpc_pipe_client *cli,
2161                                                            const char *_server /* [in] [unique,charset(UTF16)] */,
2162                                                            const char *_architecture /* [in] [charset(UTF16)] */,
2163                                                            const char *_driver /* [in] [charset(UTF16)] */)
2164 {
2165         struct tevent_req *req;
2166         struct rpccli_spoolss_DeletePrinterDriver_state *state;
2167         struct tevent_req *subreq;
2168
2169         req = tevent_req_create(mem_ctx, &state,
2170                                 struct rpccli_spoolss_DeletePrinterDriver_state);
2171         if (req == NULL) {
2172                 return NULL;
2173         }
2174         state->out_mem_ctx = NULL;
2175         state->dispatch_recv = cli->dispatch_recv;
2176
2177         /* In parameters */
2178         state->orig.in.server = _server;
2179         state->orig.in.architecture = _architecture;
2180         state->orig.in.driver = _driver;
2181
2182         /* Out parameters */
2183
2184         /* Result */
2185         ZERO_STRUCT(state->orig.out.result);
2186
2187         /* make a temporary copy, that we pass to the dispatch function */
2188         state->tmp = state->orig;
2189
2190         subreq = cli->dispatch_send(state, ev, cli,
2191                                     &ndr_table_spoolss,
2192                                     NDR_SPOOLSS_DELETEPRINTERDRIVER,
2193                                     &state->tmp);
2194         if (tevent_req_nomem(subreq, req)) {
2195                 return tevent_req_post(req, ev);
2196         }
2197         tevent_req_set_callback(subreq, rpccli_spoolss_DeletePrinterDriver_done, req);
2198         return req;
2199 }
2200
2201 static void rpccli_spoolss_DeletePrinterDriver_done(struct tevent_req *subreq)
2202 {
2203         struct tevent_req *req = tevent_req_callback_data(
2204                 subreq, struct tevent_req);
2205         struct rpccli_spoolss_DeletePrinterDriver_state *state = tevent_req_data(
2206                 req, struct rpccli_spoolss_DeletePrinterDriver_state);
2207         NTSTATUS status;
2208         TALLOC_CTX *mem_ctx;
2209
2210         if (state->out_mem_ctx) {
2211                 mem_ctx = state->out_mem_ctx;
2212         } else {
2213                 mem_ctx = state;
2214         }
2215
2216         status = state->dispatch_recv(subreq, mem_ctx);
2217         TALLOC_FREE(subreq);
2218         if (!NT_STATUS_IS_OK(status)) {
2219                 tevent_req_nterror(req, status);
2220                 return;
2221         }
2222
2223         /* Copy out parameters */
2224
2225         /* Copy result */
2226         state->orig.out.result = state->tmp.out.result;
2227
2228         /* Reset temporary structure */
2229         ZERO_STRUCT(state->tmp);
2230
2231         tevent_req_done(req);
2232 }
2233
2234 NTSTATUS rpccli_spoolss_DeletePrinterDriver_recv(struct tevent_req *req,
2235                                                  TALLOC_CTX *mem_ctx,
2236                                                  WERROR *result)
2237 {
2238         struct rpccli_spoolss_DeletePrinterDriver_state *state = tevent_req_data(
2239                 req, struct rpccli_spoolss_DeletePrinterDriver_state);
2240         NTSTATUS status;
2241
2242         if (tevent_req_is_nterror(req, &status)) {
2243                 tevent_req_received(req);
2244                 return status;
2245         }
2246
2247         /* Steal possbile out parameters to the callers context */
2248         talloc_steal(mem_ctx, state->out_mem_ctx);
2249
2250         /* Return result */
2251         *result = state->orig.out.result;
2252
2253         tevent_req_received(req);
2254         return NT_STATUS_OK;
2255 }
2256
2257 NTSTATUS rpccli_spoolss_DeletePrinterDriver(struct rpc_pipe_client *cli,
2258                                             TALLOC_CTX *mem_ctx,
2259                                             const char *server /* [in] [unique,charset(UTF16)] */,
2260                                             const char *architecture /* [in] [charset(UTF16)] */,
2261                                             const char *driver /* [in] [charset(UTF16)] */,
2262                                             WERROR *werror)
2263 {
2264         struct spoolss_DeletePrinterDriver r;
2265         NTSTATUS status;
2266
2267         /* In parameters */
2268         r.in.server = server;
2269         r.in.architecture = architecture;
2270         r.in.driver = driver;
2271
2272         status = cli->dispatch(cli,
2273                                 mem_ctx,
2274                                 &ndr_table_spoolss,
2275                                 NDR_SPOOLSS_DELETEPRINTERDRIVER,
2276                                 &r);
2277
2278         if (!NT_STATUS_IS_OK(status)) {
2279                 return status;
2280         }
2281
2282         if (NT_STATUS_IS_ERR(status)) {
2283                 return status;
2284         }
2285
2286         /* Return variables */
2287
2288         /* Return result */
2289         if (werror) {
2290                 *werror = r.out.result;
2291         }
2292
2293         return werror_to_ntstatus(r.out.result);
2294 }
2295
2296 struct rpccli_spoolss_AddPrintProcessor_state {
2297         struct spoolss_AddPrintProcessor orig;
2298         struct spoolss_AddPrintProcessor tmp;
2299         TALLOC_CTX *out_mem_ctx;
2300         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2301 };
2302
2303 static void rpccli_spoolss_AddPrintProcessor_done(struct tevent_req *subreq);
2304
2305 struct tevent_req *rpccli_spoolss_AddPrintProcessor_send(TALLOC_CTX *mem_ctx,
2306                                                          struct tevent_context *ev,
2307                                                          struct rpc_pipe_client *cli,
2308                                                          const char *_server /* [in] [unique,charset(UTF16)] */,
2309                                                          const char *_architecture /* [in] [charset(UTF16)] */,
2310                                                          const char *_path_name /* [in] [charset(UTF16)] */,
2311                                                          const char *_print_processor_name /* [in] [charset(UTF16)] */)
2312 {
2313         struct tevent_req *req;
2314         struct rpccli_spoolss_AddPrintProcessor_state *state;
2315         struct tevent_req *subreq;
2316
2317         req = tevent_req_create(mem_ctx, &state,
2318                                 struct rpccli_spoolss_AddPrintProcessor_state);
2319         if (req == NULL) {
2320                 return NULL;
2321         }
2322         state->out_mem_ctx = NULL;
2323         state->dispatch_recv = cli->dispatch_recv;
2324
2325         /* In parameters */
2326         state->orig.in.server = _server;
2327         state->orig.in.architecture = _architecture;
2328         state->orig.in.path_name = _path_name;
2329         state->orig.in.print_processor_name = _print_processor_name;
2330
2331         /* Out parameters */
2332
2333         /* Result */
2334         ZERO_STRUCT(state->orig.out.result);
2335
2336         /* make a temporary copy, that we pass to the dispatch function */
2337         state->tmp = state->orig;
2338
2339         subreq = cli->dispatch_send(state, ev, cli,
2340                                     &ndr_table_spoolss,
2341                                     NDR_SPOOLSS_ADDPRINTPROCESSOR,
2342                                     &state->tmp);
2343         if (tevent_req_nomem(subreq, req)) {
2344                 return tevent_req_post(req, ev);
2345         }
2346         tevent_req_set_callback(subreq, rpccli_spoolss_AddPrintProcessor_done, req);
2347         return req;
2348 }
2349
2350 static void rpccli_spoolss_AddPrintProcessor_done(struct tevent_req *subreq)
2351 {
2352         struct tevent_req *req = tevent_req_callback_data(
2353                 subreq, struct tevent_req);
2354         struct rpccli_spoolss_AddPrintProcessor_state *state = tevent_req_data(
2355                 req, struct rpccli_spoolss_AddPrintProcessor_state);
2356         NTSTATUS status;
2357         TALLOC_CTX *mem_ctx;
2358
2359         if (state->out_mem_ctx) {
2360                 mem_ctx = state->out_mem_ctx;
2361         } else {
2362                 mem_ctx = state;
2363         }
2364
2365         status = state->dispatch_recv(subreq, mem_ctx);
2366         TALLOC_FREE(subreq);
2367         if (!NT_STATUS_IS_OK(status)) {
2368                 tevent_req_nterror(req, status);
2369                 return;
2370         }
2371
2372         /* Copy out parameters */
2373
2374         /* Copy result */
2375         state->orig.out.result = state->tmp.out.result;
2376
2377         /* Reset temporary structure */
2378         ZERO_STRUCT(state->tmp);
2379
2380         tevent_req_done(req);
2381 }
2382
2383 NTSTATUS rpccli_spoolss_AddPrintProcessor_recv(struct tevent_req *req,
2384                                                TALLOC_CTX *mem_ctx,
2385                                                WERROR *result)
2386 {
2387         struct rpccli_spoolss_AddPrintProcessor_state *state = tevent_req_data(
2388                 req, struct rpccli_spoolss_AddPrintProcessor_state);
2389         NTSTATUS status;
2390
2391         if (tevent_req_is_nterror(req, &status)) {
2392                 tevent_req_received(req);
2393                 return status;
2394         }
2395
2396         /* Steal possbile out parameters to the callers context */
2397         talloc_steal(mem_ctx, state->out_mem_ctx);
2398
2399         /* Return result */
2400         *result = state->orig.out.result;
2401
2402         tevent_req_received(req);
2403         return NT_STATUS_OK;
2404 }
2405
2406 NTSTATUS rpccli_spoolss_AddPrintProcessor(struct rpc_pipe_client *cli,
2407                                           TALLOC_CTX *mem_ctx,
2408                                           const char *server /* [in] [unique,charset(UTF16)] */,
2409                                           const char *architecture /* [in] [charset(UTF16)] */,
2410                                           const char *path_name /* [in] [charset(UTF16)] */,
2411                                           const char *print_processor_name /* [in] [charset(UTF16)] */,
2412                                           WERROR *werror)
2413 {
2414         struct spoolss_AddPrintProcessor r;
2415         NTSTATUS status;
2416
2417         /* In parameters */
2418         r.in.server = server;
2419         r.in.architecture = architecture;
2420         r.in.path_name = path_name;
2421         r.in.print_processor_name = print_processor_name;
2422
2423         status = cli->dispatch(cli,
2424                                 mem_ctx,
2425                                 &ndr_table_spoolss,
2426                                 NDR_SPOOLSS_ADDPRINTPROCESSOR,
2427                                 &r);
2428
2429         if (!NT_STATUS_IS_OK(status)) {
2430                 return status;
2431         }
2432
2433         if (NT_STATUS_IS_ERR(status)) {
2434                 return status;
2435         }
2436
2437         /* Return variables */
2438
2439         /* Return result */
2440         if (werror) {
2441                 *werror = r.out.result;
2442         }
2443
2444         return werror_to_ntstatus(r.out.result);
2445 }
2446
2447 struct rpccli_spoolss_EnumPrintProcessors_state {
2448         struct spoolss_EnumPrintProcessors orig;
2449         struct spoolss_EnumPrintProcessors tmp;
2450         TALLOC_CTX *out_mem_ctx;
2451         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2452 };
2453
2454 static void rpccli_spoolss_EnumPrintProcessors_done(struct tevent_req *subreq);
2455
2456 struct tevent_req *rpccli_spoolss_EnumPrintProcessors_send(TALLOC_CTX *mem_ctx,
2457                                                            struct tevent_context *ev,
2458                                                            struct rpc_pipe_client *cli,
2459                                                            const char *_servername /* [in] [unique,charset(UTF16)] */,
2460                                                            const char *_environment /* [in] [unique,charset(UTF16)] */,
2461                                                            uint32_t _level /* [in]  */,
2462                                                            DATA_BLOB *_buffer /* [in] [unique] */,
2463                                                            uint32_t _offered /* [in]  */,
2464                                                            uint32_t *_count /* [out] [ref] */,
2465                                                            union spoolss_PrintProcessorInfo **_info /* [out] [ref,switch_is(level),size_is(,*count)] */,
2466                                                            uint32_t *_needed /* [out] [ref] */)
2467 {
2468         struct tevent_req *req;
2469         struct rpccli_spoolss_EnumPrintProcessors_state *state;
2470         struct tevent_req *subreq;
2471
2472         req = tevent_req_create(mem_ctx, &state,
2473                                 struct rpccli_spoolss_EnumPrintProcessors_state);
2474         if (req == NULL) {
2475                 return NULL;
2476         }
2477         state->out_mem_ctx = NULL;
2478         state->dispatch_recv = cli->dispatch_recv;
2479
2480         /* In parameters */
2481         state->orig.in.servername = _servername;
2482         state->orig.in.environment = _environment;
2483         state->orig.in.level = _level;
2484         state->orig.in.buffer = _buffer;
2485         state->orig.in.offered = _offered;
2486
2487         /* Out parameters */
2488         state->orig.out.count = _count;
2489         state->orig.out.info = _info;
2490         state->orig.out.needed = _needed;
2491
2492         /* Result */
2493         ZERO_STRUCT(state->orig.out.result);
2494
2495         state->out_mem_ctx = talloc_named_const(state, 0,
2496                              "rpccli_spoolss_EnumPrintProcessors_out_memory");
2497         if (tevent_req_nomem(state->out_mem_ctx, req)) {
2498                 return tevent_req_post(req, ev);
2499         }
2500
2501         /* make a temporary copy, that we pass to the dispatch function */
2502         state->tmp = state->orig;
2503
2504         subreq = cli->dispatch_send(state, ev, cli,
2505                                     &ndr_table_spoolss,
2506                                     NDR_SPOOLSS_ENUMPRINTPROCESSORS,
2507                                     &state->tmp);
2508         if (tevent_req_nomem(subreq, req)) {
2509                 return tevent_req_post(req, ev);
2510         }
2511         tevent_req_set_callback(subreq, rpccli_spoolss_EnumPrintProcessors_done, req);
2512         return req;
2513 }
2514
2515 static void rpccli_spoolss_EnumPrintProcessors_done(struct tevent_req *subreq)
2516 {
2517         struct tevent_req *req = tevent_req_callback_data(
2518                 subreq, struct tevent_req);
2519         struct rpccli_spoolss_EnumPrintProcessors_state *state = tevent_req_data(
2520                 req, struct rpccli_spoolss_EnumPrintProcessors_state);
2521         NTSTATUS status;
2522         TALLOC_CTX *mem_ctx;
2523
2524         if (state->out_mem_ctx) {
2525                 mem_ctx = state->out_mem_ctx;
2526         } else {
2527                 mem_ctx = state;
2528         }
2529
2530         status = state->dispatch_recv(subreq, mem_ctx);
2531         TALLOC_FREE(subreq);
2532         if (!NT_STATUS_IS_OK(status)) {
2533                 tevent_req_nterror(req, status);
2534                 return;
2535         }
2536
2537         /* Copy out parameters */
2538         *state->orig.out.count = *state->tmp.out.count;
2539         *state->orig.out.info = *state->tmp.out.info;
2540         *state->orig.out.needed = *state->tmp.out.needed;
2541
2542         /* Copy result */
2543         state->orig.out.result = state->tmp.out.result;
2544
2545         /* Reset temporary structure */
2546         ZERO_STRUCT(state->tmp);
2547
2548         tevent_req_done(req);
2549 }
2550
2551 NTSTATUS rpccli_spoolss_EnumPrintProcessors_recv(struct tevent_req *req,
2552                                                  TALLOC_CTX *mem_ctx,
2553                                                  WERROR *result)
2554 {
2555         struct rpccli_spoolss_EnumPrintProcessors_state *state = tevent_req_data(
2556                 req, struct rpccli_spoolss_EnumPrintProcessors_state);
2557         NTSTATUS status;
2558
2559         if (tevent_req_is_nterror(req, &status)) {
2560                 tevent_req_received(req);
2561                 return status;
2562         }
2563
2564         /* Steal possbile out parameters to the callers context */
2565         talloc_steal(mem_ctx, state->out_mem_ctx);
2566
2567         /* Return result */
2568         *result = state->orig.out.result;
2569
2570         tevent_req_received(req);
2571         return NT_STATUS_OK;
2572 }
2573
2574 NTSTATUS rpccli_spoolss_EnumPrintProcessors(struct rpc_pipe_client *cli,
2575                                             TALLOC_CTX *mem_ctx,
2576                                             const char *servername /* [in] [unique,charset(UTF16)] */,
2577                                             const char *environment /* [in] [unique,charset(UTF16)] */,
2578                                             uint32_t level /* [in]  */,
2579                                             DATA_BLOB *buffer /* [in] [unique] */,
2580                                             uint32_t offered /* [in]  */,
2581                                             uint32_t *count /* [out] [ref] */,
2582                                             union spoolss_PrintProcessorInfo **info /* [out] [ref,switch_is(level),size_is(,*count)] */,
2583                                             uint32_t *needed /* [out] [ref] */,
2584                                             WERROR *werror)
2585 {
2586         struct spoolss_EnumPrintProcessors r;
2587         NTSTATUS status;
2588
2589         /* In parameters */
2590         r.in.servername = servername;
2591         r.in.environment = environment;
2592         r.in.level = level;
2593         r.in.buffer = buffer;
2594         r.in.offered = offered;
2595
2596         status = cli->dispatch(cli,
2597                                 mem_ctx,
2598                                 &ndr_table_spoolss,
2599                                 NDR_SPOOLSS_ENUMPRINTPROCESSORS,
2600                                 &r);
2601
2602         if (!NT_STATUS_IS_OK(status)) {
2603                 return status;
2604         }
2605
2606         if (NT_STATUS_IS_ERR(status)) {
2607                 return status;
2608         }
2609
2610         /* Return variables */
2611         *count = *r.out.count;
2612         *info = *r.out.info;
2613         *needed = *r.out.needed;
2614
2615         /* Return result */
2616         if (werror) {
2617                 *werror = r.out.result;
2618         }
2619
2620         return werror_to_ntstatus(r.out.result);
2621 }
2622
2623 struct rpccli_spoolss_GetPrintProcessorDirectory_state {
2624         struct spoolss_GetPrintProcessorDirectory orig;
2625         struct spoolss_GetPrintProcessorDirectory tmp;
2626         TALLOC_CTX *out_mem_ctx;
2627         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2628 };
2629
2630 static void rpccli_spoolss_GetPrintProcessorDirectory_done(struct tevent_req *subreq);
2631
2632 struct tevent_req *rpccli_spoolss_GetPrintProcessorDirectory_send(TALLOC_CTX *mem_ctx,
2633                                                                   struct tevent_context *ev,
2634                                                                   struct rpc_pipe_client *cli,
2635                                                                   const char *_server /* [in] [unique,charset(UTF16)] */,
2636                                                                   const char *_environment /* [in] [unique,charset(UTF16)] */,
2637                                                                   uint32_t _level /* [in]  */,
2638                                                                   DATA_BLOB *_buffer /* [in] [unique] */,
2639                                                                   uint32_t _offered /* [in]  */,
2640                                                                   union spoolss_PrintProcessorDirectoryInfo *_info /* [out] [unique,subcontext_size(offered),subcontext(4),switch_is(level)] */,
2641                                                                   uint32_t *_needed /* [out] [ref] */)
2642 {
2643         struct tevent_req *req;
2644         struct rpccli_spoolss_GetPrintProcessorDirectory_state *state;
2645         struct tevent_req *subreq;
2646
2647         req = tevent_req_create(mem_ctx, &state,
2648                                 struct rpccli_spoolss_GetPrintProcessorDirectory_state);
2649         if (req == NULL) {
2650                 return NULL;
2651         }
2652         state->out_mem_ctx = NULL;
2653         state->dispatch_recv = cli->dispatch_recv;
2654
2655         /* In parameters */
2656         state->orig.in.server = _server;
2657         state->orig.in.environment = _environment;
2658         state->orig.in.level = _level;
2659         state->orig.in.buffer = _buffer;
2660         state->orig.in.offered = _offered;
2661
2662         /* Out parameters */
2663         state->orig.out.info = _info;
2664         state->orig.out.needed = _needed;
2665
2666         /* Result */
2667         ZERO_STRUCT(state->orig.out.result);
2668
2669         state->out_mem_ctx = talloc_named_const(state, 0,
2670                              "rpccli_spoolss_GetPrintProcessorDirectory_out_memory");
2671         if (tevent_req_nomem(state->out_mem_ctx, req)) {
2672                 return tevent_req_post(req, ev);
2673         }
2674
2675         /* make a temporary copy, that we pass to the dispatch function */
2676         state->tmp = state->orig;
2677
2678         subreq = cli->dispatch_send(state, ev, cli,
2679                                     &ndr_table_spoolss,
2680                                     NDR_SPOOLSS_GETPRINTPROCESSORDIRECTORY,
2681                                     &state->tmp);
2682         if (tevent_req_nomem(subreq, req)) {
2683                 return tevent_req_post(req, ev);
2684         }
2685         tevent_req_set_callback(subreq, rpccli_spoolss_GetPrintProcessorDirectory_done, req);
2686         return req;
2687 }
2688
2689 static void rpccli_spoolss_GetPrintProcessorDirectory_done(struct tevent_req *subreq)
2690 {
2691         struct tevent_req *req = tevent_req_callback_data(
2692                 subreq, struct tevent_req);
2693         struct rpccli_spoolss_GetPrintProcessorDirectory_state *state = tevent_req_data(
2694                 req, struct rpccli_spoolss_GetPrintProcessorDirectory_state);
2695         NTSTATUS status;
2696         TALLOC_CTX *mem_ctx;
2697
2698         if (state->out_mem_ctx) {
2699                 mem_ctx = state->out_mem_ctx;
2700         } else {
2701                 mem_ctx = state;
2702         }
2703
2704         status = state->dispatch_recv(subreq, mem_ctx);
2705         TALLOC_FREE(subreq);
2706         if (!NT_STATUS_IS_OK(status)) {
2707                 tevent_req_nterror(req, status);
2708                 return;
2709         }
2710
2711         /* Copy out parameters */
2712         if (state->orig.out.info && state->tmp.out.info) {
2713                 *state->orig.out.info = *state->tmp.out.info;
2714         }
2715         *state->orig.out.needed = *state->tmp.out.needed;
2716
2717         /* Copy result */
2718         state->orig.out.result = state->tmp.out.result;
2719
2720         /* Reset temporary structure */
2721         ZERO_STRUCT(state->tmp);
2722
2723         tevent_req_done(req);
2724 }
2725
2726 NTSTATUS rpccli_spoolss_GetPrintProcessorDirectory_recv(struct tevent_req *req,
2727                                                         TALLOC_CTX *mem_ctx,
2728                                                         WERROR *result)
2729 {
2730         struct rpccli_spoolss_GetPrintProcessorDirectory_state *state = tevent_req_data(
2731                 req, struct rpccli_spoolss_GetPrintProcessorDirectory_state);
2732         NTSTATUS status;
2733
2734         if (tevent_req_is_nterror(req, &status)) {
2735                 tevent_req_received(req);
2736                 return status;
2737         }
2738
2739         /* Steal possbile out parameters to the callers context */
2740         talloc_steal(mem_ctx, state->out_mem_ctx);
2741
2742         /* Return result */
2743         *result = state->orig.out.result;
2744
2745         tevent_req_received(req);
2746         return NT_STATUS_OK;
2747 }
2748
2749 NTSTATUS rpccli_spoolss_GetPrintProcessorDirectory(struct rpc_pipe_client *cli,
2750                                                    TALLOC_CTX *mem_ctx,
2751                                                    const char *server /* [in] [unique,charset(UTF16)] */,
2752                                                    const char *environment /* [in] [unique,charset(UTF16)] */,
2753                                                    uint32_t level /* [in]  */,
2754                                                    DATA_BLOB *buffer /* [in] [unique] */,
2755                                                    uint32_t offered /* [in]  */,
2756                                                    union spoolss_PrintProcessorDirectoryInfo *info /* [out] [unique,subcontext_size(offered),subcontext(4),switch_is(level)] */,
2757                                                    uint32_t *needed /* [out] [ref] */,
2758                                                    WERROR *werror)
2759 {
2760         struct spoolss_GetPrintProcessorDirectory r;
2761         NTSTATUS status;
2762
2763         /* In parameters */
2764         r.in.server = server;
2765         r.in.environment = environment;
2766         r.in.level = level;
2767         r.in.buffer = buffer;
2768         r.in.offered = offered;
2769
2770         status = cli->dispatch(cli,
2771                                 mem_ctx,
2772                                 &ndr_table_spoolss,
2773                                 NDR_SPOOLSS_GETPRINTPROCESSORDIRECTORY,
2774                                 &r);
2775
2776         if (!NT_STATUS_IS_OK(status)) {
2777                 return status;
2778         }
2779
2780         if (NT_STATUS_IS_ERR(status)) {
2781                 return status;
2782         }
2783
2784         /* Return variables */
2785         if (info && r.out.info) {
2786                 *info = *r.out.info;
2787         }
2788         *needed = *r.out.needed;
2789
2790         /* Return result */
2791         if (werror) {
2792                 *werror = r.out.result;
2793         }
2794
2795         return werror_to_ntstatus(r.out.result);
2796 }
2797
2798 struct rpccli_spoolss_StartDocPrinter_state {
2799         struct spoolss_StartDocPrinter orig;
2800         struct spoolss_StartDocPrinter tmp;
2801         TALLOC_CTX *out_mem_ctx;
2802         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2803 };
2804
2805 static void rpccli_spoolss_StartDocPrinter_done(struct tevent_req *subreq);
2806
2807 struct tevent_req *rpccli_spoolss_StartDocPrinter_send(TALLOC_CTX *mem_ctx,
2808                                                        struct tevent_context *ev,
2809                                                        struct rpc_pipe_client *cli,
2810                                                        struct policy_handle *_handle /* [in] [ref] */,
2811                                                        uint32_t _level /* [in]  */,
2812                                                        union spoolss_DocumentInfo _info /* [in] [switch_is(level)] */,
2813                                                        uint32_t *_job_id /* [out] [ref] */)
2814 {
2815         struct tevent_req *req;
2816         struct rpccli_spoolss_StartDocPrinter_state *state;
2817         struct tevent_req *subreq;
2818
2819         req = tevent_req_create(mem_ctx, &state,
2820                                 struct rpccli_spoolss_StartDocPrinter_state);
2821         if (req == NULL) {
2822                 return NULL;
2823         }
2824         state->out_mem_ctx = NULL;
2825         state->dispatch_recv = cli->dispatch_recv;
2826
2827         /* In parameters */
2828         state->orig.in.handle = _handle;
2829         state->orig.in.level = _level;
2830         state->orig.in.info = _info;
2831
2832         /* Out parameters */
2833         state->orig.out.job_id = _job_id;
2834
2835         /* Result */
2836         ZERO_STRUCT(state->orig.out.result);
2837
2838         state->out_mem_ctx = talloc_named_const(state, 0,
2839                              "rpccli_spoolss_StartDocPrinter_out_memory");
2840         if (tevent_req_nomem(state->out_mem_ctx, req)) {
2841                 return tevent_req_post(req, ev);
2842         }
2843
2844         /* make a temporary copy, that we pass to the dispatch function */
2845         state->tmp = state->orig;
2846
2847         subreq = cli->dispatch_send(state, ev, cli,
2848                                     &ndr_table_spoolss,
2849                                     NDR_SPOOLSS_STARTDOCPRINTER,
2850                                     &state->tmp);
2851         if (tevent_req_nomem(subreq, req)) {
2852                 return tevent_req_post(req, ev);
2853         }
2854         tevent_req_set_callback(subreq, rpccli_spoolss_StartDocPrinter_done, req);
2855         return req;
2856 }
2857
2858 static void rpccli_spoolss_StartDocPrinter_done(struct tevent_req *subreq)
2859 {
2860         struct tevent_req *req = tevent_req_callback_data(
2861                 subreq, struct tevent_req);
2862         struct rpccli_spoolss_StartDocPrinter_state *state = tevent_req_data(
2863                 req, struct rpccli_spoolss_StartDocPrinter_state);
2864         NTSTATUS status;
2865         TALLOC_CTX *mem_ctx;
2866
2867         if (state->out_mem_ctx) {
2868                 mem_ctx = state->out_mem_ctx;
2869         } else {
2870                 mem_ctx = state;
2871         }
2872
2873         status = state->dispatch_recv(subreq, mem_ctx);
2874         TALLOC_FREE(subreq);
2875         if (!NT_STATUS_IS_OK(status)) {
2876                 tevent_req_nterror(req, status);
2877                 return;
2878         }
2879
2880         /* Copy out parameters */
2881         *state->orig.out.job_id = *state->tmp.out.job_id;
2882
2883         /* Copy result */
2884         state->orig.out.result = state->tmp.out.result;
2885
2886         /* Reset temporary structure */
2887         ZERO_STRUCT(state->tmp);
2888
2889         tevent_req_done(req);
2890 }
2891
2892 NTSTATUS rpccli_spoolss_StartDocPrinter_recv(struct tevent_req *req,
2893                                              TALLOC_CTX *mem_ctx,
2894                                              WERROR *result)
2895 {
2896         struct rpccli_spoolss_StartDocPrinter_state *state = tevent_req_data(
2897                 req, struct rpccli_spoolss_StartDocPrinter_state);
2898         NTSTATUS status;
2899
2900         if (tevent_req_is_nterror(req, &status)) {
2901                 tevent_req_received(req);
2902                 return status;
2903         }
2904
2905         /* Steal possbile out parameters to the callers context */
2906         talloc_steal(mem_ctx, state->out_mem_ctx);
2907
2908         /* Return result */
2909         *result = state->orig.out.result;
2910
2911         tevent_req_received(req);
2912         return NT_STATUS_OK;
2913 }
2914
2915 NTSTATUS rpccli_spoolss_StartDocPrinter(struct rpc_pipe_client *cli,
2916                                         TALLOC_CTX *mem_ctx,
2917                                         struct policy_handle *handle /* [in] [ref] */,
2918                                         uint32_t level /* [in]  */,
2919                                         union spoolss_DocumentInfo info /* [in] [switch_is(level)] */,
2920                                         uint32_t *job_id /* [out] [ref] */,
2921                                         WERROR *werror)
2922 {
2923         struct spoolss_StartDocPrinter r;
2924         NTSTATUS status;
2925
2926         /* In parameters */
2927         r.in.handle = handle;
2928         r.in.level = level;
2929         r.in.info = info;
2930
2931         status = cli->dispatch(cli,
2932                                 mem_ctx,
2933                                 &ndr_table_spoolss,
2934                                 NDR_SPOOLSS_STARTDOCPRINTER,
2935                                 &r);
2936
2937         if (!NT_STATUS_IS_OK(status)) {
2938                 return status;
2939         }
2940
2941         if (NT_STATUS_IS_ERR(status)) {
2942                 return status;
2943         }
2944
2945         /* Return variables */
2946         *job_id = *r.out.job_id;
2947
2948         /* Return result */
2949         if (werror) {
2950                 *werror = r.out.result;
2951         }
2952
2953         return werror_to_ntstatus(r.out.result);
2954 }
2955
2956 struct rpccli_spoolss_StartPagePrinter_state {
2957         struct spoolss_StartPagePrinter orig;
2958         struct spoolss_StartPagePrinter tmp;
2959         TALLOC_CTX *out_mem_ctx;
2960         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2961 };
2962
2963 static void rpccli_spoolss_StartPagePrinter_done(struct tevent_req *subreq);
2964
2965 struct tevent_req *rpccli_spoolss_StartPagePrinter_send(TALLOC_CTX *mem_ctx,
2966                                                         struct tevent_context *ev,
2967                                                         struct rpc_pipe_client *cli,
2968                                                         struct policy_handle *_handle /* [in] [ref] */)
2969 {
2970         struct tevent_req *req;
2971         struct rpccli_spoolss_StartPagePrinter_state *state;
2972         struct tevent_req *subreq;
2973
2974         req = tevent_req_create(mem_ctx, &state,
2975                                 struct rpccli_spoolss_StartPagePrinter_state);
2976         if (req == NULL) {
2977                 return NULL;
2978         }
2979         state->out_mem_ctx = NULL;
2980         state->dispatch_recv = cli->dispatch_recv;
2981
2982         /* In parameters */
2983         state->orig.in.handle = _handle;
2984
2985         /* Out parameters */
2986
2987         /* Result */
2988         ZERO_STRUCT(state->orig.out.result);
2989
2990         /* make a temporary copy, that we pass to the dispatch function */
2991         state->tmp = state->orig;
2992
2993         subreq = cli->dispatch_send(state, ev, cli,
2994                                     &ndr_table_spoolss,
2995                                     NDR_SPOOLSS_STARTPAGEPRINTER,
2996                                     &state->tmp);
2997         if (tevent_req_nomem(subreq, req)) {
2998                 return tevent_req_post(req, ev);
2999         }
3000         tevent_req_set_callback(subreq, rpccli_spoolss_StartPagePrinter_done, req);
3001         return req;
3002 }
3003
3004 static void rpccli_spoolss_StartPagePrinter_done(struct tevent_req *subreq)
3005 {
3006         struct tevent_req *req = tevent_req_callback_data(
3007                 subreq, struct tevent_req);
3008         struct rpccli_spoolss_StartPagePrinter_state *state = tevent_req_data(
3009                 req, struct rpccli_spoolss_StartPagePrinter_state);
3010         NTSTATUS status;
3011         TALLOC_CTX *mem_ctx;
3012
3013         if (state->out_mem_ctx) {
3014                 mem_ctx = state->out_mem_ctx;
3015         } else {
3016                 mem_ctx = state;
3017         }
3018
3019         status = state->dispatch_recv(subreq, mem_ctx);
3020         TALLOC_FREE(subreq);
3021         if (!NT_STATUS_IS_OK(status)) {
3022                 tevent_req_nterror(req, status);
3023                 return;
3024         }
3025
3026         /* Copy out parameters */
3027
3028         /* Copy result */
3029         state->orig.out.result = state->tmp.out.result;
3030
3031         /* Reset temporary structure */
3032         ZERO_STRUCT(state->tmp);
3033
3034         tevent_req_done(req);
3035 }
3036
3037 NTSTATUS rpccli_spoolss_StartPagePrinter_recv(struct tevent_req *req,
3038                                               TALLOC_CTX *mem_ctx,
3039                                               WERROR *result)
3040 {
3041         struct rpccli_spoolss_StartPagePrinter_state *state = tevent_req_data(
3042                 req, struct rpccli_spoolss_StartPagePrinter_state);
3043         NTSTATUS status;
3044
3045         if (tevent_req_is_nterror(req, &status)) {
3046                 tevent_req_received(req);
3047                 return status;
3048         }
3049
3050         /* Steal possbile out parameters to the callers context */
3051         talloc_steal(mem_ctx, state->out_mem_ctx);
3052
3053         /* Return result */
3054         *result = state->orig.out.result;
3055
3056         tevent_req_received(req);
3057         return NT_STATUS_OK;
3058 }
3059
3060 NTSTATUS rpccli_spoolss_StartPagePrinter(struct rpc_pipe_client *cli,
3061                                          TALLOC_CTX *mem_ctx,
3062                                          struct policy_handle *handle /* [in] [ref] */,
3063                                          WERROR *werror)
3064 {
3065         struct spoolss_StartPagePrinter r;
3066         NTSTATUS status;
3067
3068         /* In parameters */
3069         r.in.handle = handle;
3070
3071         status = cli->dispatch(cli,
3072                                 mem_ctx,
3073                                 &ndr_table_spoolss,
3074                                 NDR_SPOOLSS_STARTPAGEPRINTER,
3075                                 &r);
3076
3077         if (!NT_STATUS_IS_OK(status)) {
3078                 return status;
3079         }
3080
3081         if (NT_STATUS_IS_ERR(status)) {
3082                 return status;
3083         }
3084
3085         /* Return variables */
3086
3087         /* Return result */
3088         if (werror) {
3089                 *werror = r.out.result;
3090         }
3091
3092         return werror_to_ntstatus(r.out.result);
3093 }
3094
3095 struct rpccli_spoolss_WritePrinter_state {
3096         struct spoolss_WritePrinter orig;
3097         struct spoolss_WritePrinter tmp;
3098         TALLOC_CTX *out_mem_ctx;
3099         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
3100 };
3101
3102 static void rpccli_spoolss_WritePrinter_done(struct tevent_req *subreq);
3103
3104 struct tevent_req *rpccli_spoolss_WritePrinter_send(TALLOC_CTX *mem_ctx,
3105                                                     struct tevent_context *ev,
3106                                                     struct rpc_pipe_client *cli,
3107                                                     struct policy_handle *_handle /* [in] [ref] */,
3108                                                     DATA_BLOB _data /* [in]  */,
3109                                                     uint32_t __data_size /* [in] [value(r->in.data.length)] */,
3110                                                     uint32_t *_num_written /* [out] [ref] */)
3111 {
3112         struct tevent_req *req;
3113         struct rpccli_spoolss_WritePrinter_state *state;
3114         struct tevent_req *subreq;
3115
3116         req = tevent_req_create(mem_ctx, &state,
3117                                 struct rpccli_spoolss_WritePrinter_state);
3118         if (req == NULL) {
3119                 return NULL;
3120         }
3121         state->out_mem_ctx = NULL;
3122         state->dispatch_recv = cli->dispatch_recv;
3123
3124         /* In parameters */
3125         state->orig.in.handle = _handle;
3126         state->orig.in.data = _data;
3127         state->orig.in._data_size = __data_size;
3128
3129         /* Out parameters */
3130         state->orig.out.num_written = _num_written;
3131
3132         /* Result */
3133         ZERO_STRUCT(state->orig.out.result);
3134
3135         state->out_mem_ctx = talloc_named_const(state, 0,
3136                              "rpccli_spoolss_WritePrinter_out_memory");
3137         if (tevent_req_nomem(state->out_mem_ctx, req)) {
3138                 return tevent_req_post(req, ev);
3139         }
3140
3141         /* make a temporary copy, that we pass to the dispatch function */
3142         state->tmp = state->orig;
3143
3144         subreq = cli->dispatch_send(state, ev, cli,
3145                                     &ndr_table_spoolss,
3146                                     NDR_SPOOLSS_WRITEPRINTER,
3147                                     &state->tmp);
3148         if (tevent_req_nomem(subreq, req)) {
3149                 return tevent_req_post(req, ev);
3150         }
3151         tevent_req_set_callback(subreq, rpccli_spoolss_WritePrinter_done, req);
3152         return req;
3153 }
3154
3155 static void rpccli_spoolss_WritePrinter_done(struct tevent_req *subreq)
3156 {
3157         struct tevent_req *req = tevent_req_callback_data(
3158                 subreq, struct tevent_req);
3159         struct rpccli_spoolss_WritePrinter_state *state = tevent_req_data(
3160                 req, struct rpccli_spoolss_WritePrinter_state);
3161         NTSTATUS status;
3162         TALLOC_CTX *mem_ctx;
3163
3164         if (state->out_mem_ctx) {
3165                 mem_ctx = state->out_mem_ctx;
3166         } else {
3167                 mem_ctx = state;
3168         }
3169
3170         status = state->dispatch_recv(subreq, mem_ctx);
3171         TALLOC_FREE(subreq);
3172         if (!NT_STATUS_IS_OK(status)) {
3173                 tevent_req_nterror(req, status);
3174                 return;
3175         }
3176
3177         /* Copy out parameters */
3178         *state->orig.out.num_written = *state->tmp.out.num_written;
3179
3180         /* Copy result */
3181         state->orig.out.result = state->tmp.out.result;
3182
3183         /* Reset temporary structure */
3184         ZERO_STRUCT(state->tmp);
3185
3186         tevent_req_done(req);
3187 }
3188
3189 NTSTATUS rpccli_spoolss_WritePrinter_recv(struct tevent_req *req,
3190                                           TALLOC_CTX *mem_ctx,
3191                                           WERROR *result)
3192 {
3193         struct rpccli_spoolss_WritePrinter_state *state = tevent_req_data(
3194                 req, struct rpccli_spoolss_WritePrinter_state);
3195         NTSTATUS status;
3196
3197         if (tevent_req_is_nterror(req, &status)) {
3198                 tevent_req_received(req);
3199                 return status;
3200         }
3201
3202         /* Steal possbile out parameters to the callers context */
3203         talloc_steal(mem_ctx, state->out_mem_ctx);
3204
3205         /* Return result */
3206         *result = state->orig.out.result;
3207
3208         tevent_req_received(req);
3209         return NT_STATUS_OK;
3210 }
3211
3212 NTSTATUS rpccli_spoolss_WritePrinter(struct rpc_pipe_client *cli,
3213                                      TALLOC_CTX *mem_ctx,
3214                                      struct policy_handle *handle /* [in] [ref] */,
3215                                      DATA_BLOB data /* [in]  */,
3216                                      uint32_t _data_size /* [in] [value(r->in.data.length)] */,
3217                                      uint32_t *num_written /* [out] [ref] */,
3218                                      WERROR *werror)
3219 {
3220         struct spoolss_WritePrinter r;
3221         NTSTATUS status;
3222
3223         /* In parameters */
3224         r.in.handle = handle;
3225         r.in.data = data;
3226         r.in._data_size = _data_size;
3227
3228         status = cli->dispatch(cli,
3229                                 mem_ctx,
3230                                 &ndr_table_spoolss,
3231                                 NDR_SPOOLSS_WRITEPRINTER,
3232                                 &r);
3233
3234         if (!NT_STATUS_IS_OK(status)) {
3235                 return status;
3236         }
3237
3238         if (NT_STATUS_IS_ERR(status)) {
3239                 return status;
3240         }
3241
3242         /* Return variables */
3243         *num_written = *r.out.num_written;
3244
3245         /* Return result */
3246         if (werror) {
3247                 *werror = r.out.result;
3248         }
3249
3250         return werror_to_ntstatus(r.out.result);
3251 }
3252
3253 struct rpccli_spoolss_EndPagePrinter_state {
3254         struct spoolss_EndPagePrinter orig;
3255         struct spoolss_EndPagePrinter tmp;
3256         TALLOC_CTX *out_mem_ctx;
3257         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
3258 };
3259
3260 static void rpccli_spoolss_EndPagePrinter_done(struct tevent_req *subreq);
3261
3262 struct tevent_req *rpccli_spoolss_EndPagePrinter_send(TALLOC_CTX *mem_ctx,
3263                                                       struct tevent_context *ev,
3264                                                       struct rpc_pipe_client *cli,
3265                                                       struct policy_handle *_handle /* [in] [ref] */)
3266 {
3267         struct tevent_req *req;
3268         struct rpccli_spoolss_EndPagePrinter_state *state;
3269         struct tevent_req *subreq;
3270
3271         req = tevent_req_create(mem_ctx, &state,
3272                                 struct rpccli_spoolss_EndPagePrinter_state);
3273         if (req == NULL) {
3274                 return NULL;
3275         }
3276         state->out_mem_ctx = NULL;
3277         state->dispatch_recv = cli->dispatch_recv;
3278
3279         /* In parameters */
3280         state->orig.in.handle = _handle;
3281
3282         /* Out parameters */
3283
3284         /* Result */
3285         ZERO_STRUCT(state->orig.out.result);
3286
3287         /* make a temporary copy, that we pass to the dispatch function */
3288         state->tmp = state->orig;
3289
3290         subreq = cli->dispatch_send(state, ev, cli,
3291                                     &ndr_table_spoolss,
3292                                     NDR_SPOOLSS_ENDPAGEPRINTER,
3293                                     &state->tmp);
3294         if (tevent_req_nomem(subreq, req)) {
3295                 return tevent_req_post(req, ev);
3296         }
3297         tevent_req_set_callback(subreq, rpccli_spoolss_EndPagePrinter_done, req);
3298         return req;
3299 }
3300
3301 static void rpccli_spoolss_EndPagePrinter_done(struct tevent_req *subreq)
3302 {
3303         struct tevent_req *req = tevent_req_callback_data(
3304                 subreq, struct tevent_req);
3305         struct rpccli_spoolss_EndPagePrinter_state *state = tevent_req_data(
3306                 req, struct rpccli_spoolss_EndPagePrinter_state);
3307         NTSTATUS status;
3308         TALLOC_CTX *mem_ctx;
3309
3310         if (state->out_mem_ctx) {
3311                 mem_ctx = state->out_mem_ctx;
3312         } else {
3313                 mem_ctx = state;
3314         }
3315
3316         status = state->dispatch_recv(subreq, mem_ctx);
3317         TALLOC_FREE(subreq);
3318         if (!NT_STATUS_IS_OK(status)) {
3319                 tevent_req_nterror(req, status);
3320                 return;
3321         }
3322
3323         /* Copy out parameters */
3324
3325         /* Copy result */
3326         state->orig.out.result = state->tmp.out.result;
3327
3328         /* Reset temporary structure */
3329         ZERO_STRUCT(state->tmp);
3330
3331         tevent_req_done(req);
3332 }
3333
3334 NTSTATUS rpccli_spoolss_EndPagePrinter_recv(struct tevent_req *req,
3335                                             TALLOC_CTX *mem_ctx,
3336                                             WERROR *result)
3337 {
3338         struct rpccli_spoolss_EndPagePrinter_state *state = tevent_req_data(
3339                 req, struct rpccli_spoolss_EndPagePrinter_state);
3340         NTSTATUS status;
3341
3342         if (tevent_req_is_nterror(req, &status)) {
3343                 tevent_req_received(req);
3344                 return status;
3345         }
3346
3347         /* Steal possbile out parameters to the callers context */
3348         talloc_steal(mem_ctx, state->out_mem_ctx);
3349
3350         /* Return result */
3351         *result = state->orig.out.result;
3352
3353         tevent_req_received(req);
3354         return NT_STATUS_OK;
3355 }
3356
3357 NTSTATUS rpccli_spoolss_EndPagePrinter(struct rpc_pipe_client *cli,
3358                                        TALLOC_CTX *mem_ctx,
3359                                        struct policy_handle *handle /* [in] [ref] */,
3360                                        WERROR *werror)
3361 {
3362         struct spoolss_EndPagePrinter r;
3363         NTSTATUS status;
3364
3365         /* In parameters */
3366         r.in.handle = handle;
3367
3368         status = cli->dispatch(cli,
3369                                 mem_ctx,
3370                                 &ndr_table_spoolss,
3371                                 NDR_SPOOLSS_ENDPAGEPRINTER,
3372                                 &r);
3373
3374         if (!NT_STATUS_IS_OK(status)) {
3375                 return status;
3376         }
3377
3378         if (NT_STATUS_IS_ERR(status)) {
3379                 return status;
3380         }
3381
3382         /* Return variables */
3383
3384         /* Return result */
3385         if (werror) {
3386                 *werror = r.out.result;
3387         }
3388
3389         return werror_to_ntstatus(r.out.result);
3390 }
3391
3392 struct rpccli_spoolss_AbortPrinter_state {
3393         struct spoolss_AbortPrinter orig;
3394         struct spoolss_AbortPrinter tmp;
3395         TALLOC_CTX *out_mem_ctx;
3396         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
3397 };
3398
3399 static void rpccli_spoolss_AbortPrinter_done(struct tevent_req *subreq);
3400
3401 struct tevent_req *rpccli_spoolss_AbortPrinter_send(TALLOC_CTX *mem_ctx,
3402                                                     struct tevent_context *ev,
3403                                                     struct rpc_pipe_client *cli,
3404                                                     struct policy_handle *_handle /* [in] [ref] */)
3405 {
3406         struct tevent_req *req;
3407         struct rpccli_spoolss_AbortPrinter_state *state;
3408         struct tevent_req *subreq;
3409
3410         req = tevent_req_create(mem_ctx, &state,
3411                                 struct rpccli_spoolss_AbortPrinter_state);
3412         if (req == NULL) {
3413                 return NULL;
3414         }
3415         state->out_mem_ctx = NULL;
3416         state->dispatch_recv = cli->dispatch_recv;
3417
3418         /* In parameters */
3419         state->orig.in.handle = _handle;
3420
3421         /* Out parameters */
3422
3423         /* Result */
3424         ZERO_STRUCT(state->orig.out.result);
3425
3426         /* make a temporary copy, that we pass to the dispatch function */
3427         state->tmp = state->orig;
3428
3429         subreq = cli->dispatch_send(state, ev, cli,
3430                                     &ndr_table_spoolss,
3431                                     NDR_SPOOLSS_ABORTPRINTER,
3432                                     &state->tmp);
3433         if (tevent_req_nomem(subreq, req)) {
3434                 return tevent_req_post(req, ev);
3435         }
3436         tevent_req_set_callback(subreq, rpccli_spoolss_AbortPrinter_done, req);
3437         return req;
3438 }
3439
3440 static void rpccli_spoolss_AbortPrinter_done(struct tevent_req *subreq)
3441 {
3442         struct tevent_req *req = tevent_req_callback_data(
3443                 subreq, struct tevent_req);
3444         struct rpccli_spoolss_AbortPrinter_state *state = tevent_req_data(
3445                 req, struct rpccli_spoolss_AbortPrinter_state);
3446         NTSTATUS status;
3447         TALLOC_CTX *mem_ctx;
3448
3449         if (state->out_mem_ctx) {
3450                 mem_ctx = state->out_mem_ctx;
3451         } else {
3452                 mem_ctx = state;
3453         }
3454
3455         status = state->dispatch_recv(subreq, mem_ctx);
3456         TALLOC_FREE(subreq);
3457         if (!NT_STATUS_IS_OK(status)) {
3458                 tevent_req_nterror(req, status);
3459                 return;
3460         }
3461
3462         /* Copy out parameters */
3463
3464         /* Copy result */
3465         state->orig.out.result = state->tmp.out.result;
3466
3467         /* Reset temporary structure */
3468         ZERO_STRUCT(state->tmp);
3469
3470         tevent_req_done(req);
3471 }
3472
3473 NTSTATUS rpccli_spoolss_AbortPrinter_recv(struct tevent_req *req,
3474                                           TALLOC_CTX *mem_ctx,
3475                                           WERROR *result)
3476 {
3477         struct rpccli_spoolss_AbortPrinter_state *state = tevent_req_data(
3478                 req, struct rpccli_spoolss_AbortPrinter_state);
3479         NTSTATUS status;
3480
3481         if (tevent_req_is_nterror(req, &status)) {
3482                 tevent_req_received(req);
3483                 return status;
3484         }
3485
3486         /* Steal possbile out parameters to the callers context */
3487         talloc_steal(mem_ctx, state->out_mem_ctx);
3488
3489         /* Return result */
3490         *result = state->orig.out.result;
3491
3492         tevent_req_received(req);
3493         return NT_STATUS_OK;
3494 }
3495
3496 NTSTATUS rpccli_spoolss_AbortPrinter(struct rpc_pipe_client *cli,
3497                                      TALLOC_CTX *mem_ctx,
3498                                      struct policy_handle *handle /* [in] [ref] */,
3499                                      WERROR *werror)
3500 {
3501         struct spoolss_AbortPrinter r;
3502         NTSTATUS status;
3503
3504         /* In parameters */
3505         r.in.handle = handle;
3506
3507         status = cli->dispatch(cli,
3508                                 mem_ctx,
3509                                 &ndr_table_spoolss,
3510                                 NDR_SPOOLSS_ABORTPRINTER,
3511                                 &r);
3512
3513         if (!NT_STATUS_IS_OK(status)) {
3514                 return status;
3515         }
3516
3517         if (NT_STATUS_IS_ERR(status)) {
3518                 return status;
3519         }
3520
3521         /* Return variables */
3522
3523         /* Return result */
3524         if (werror) {
3525                 *werror = r.out.result;
3526         }
3527
3528         return werror_to_ntstatus(r.out.result);
3529 }
3530
3531 struct rpccli_spoolss_ReadPrinter_state {
3532         struct spoolss_ReadPrinter orig;
3533         struct spoolss_ReadPrinter tmp;
3534         TALLOC_CTX *out_mem_ctx;
3535         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
3536 };
3537
3538 static void rpccli_spoolss_ReadPrinter_done(struct tevent_req *subreq);
3539
3540 struct tevent_req *rpccli_spoolss_ReadPrinter_send(TALLOC_CTX *mem_ctx,
3541                                                    struct tevent_context *ev,
3542                                                    struct rpc_pipe_client *cli,
3543                                                    struct policy_handle *_handle /* [in] [ref] */,
3544                                                    uint8_t *_data /* [out] [ref,size_is(data_size)] */,
3545                                                    uint32_t _data_size /* [in]  */,
3546                                                    uint32_t *__data_size /* [out] [ref] */)
3547 {
3548         struct tevent_req *req;
3549         struct rpccli_spoolss_ReadPrinter_state *state;
3550         struct tevent_req *subreq;
3551
3552         req = tevent_req_create(mem_ctx, &state,
3553                                 struct rpccli_spoolss_ReadPrinter_state);
3554         if (req == NULL) {
3555                 return NULL;
3556         }
3557         state->out_mem_ctx = NULL;
3558         state->dispatch_recv = cli->dispatch_recv;
3559
3560         /* In parameters */
3561         state->orig.in.handle = _handle;
3562         state->orig.in.data_size = _data_size;
3563
3564         /* Out parameters */
3565         state->orig.out.data = _data;
3566         state->orig.out._data_size = __data_size;
3567
3568         /* Result */
3569         ZERO_STRUCT(state->orig.out.result);
3570
3571         state->out_mem_ctx = talloc_named_const(state, 0,
3572                              "rpccli_spoolss_ReadPrinter_out_memory");
3573         if (tevent_req_nomem(state->out_mem_ctx, req)) {
3574                 return tevent_req_post(req, ev);
3575         }
3576
3577         /* make a temporary copy, that we pass to the dispatch function */
3578         state->tmp = state->orig;
3579
3580         subreq = cli->dispatch_send(state, ev, cli,
3581                                     &ndr_table_spoolss,
3582                                     NDR_SPOOLSS_READPRINTER,
3583                                     &state->tmp);
3584         if (tevent_req_nomem(subreq, req)) {
3585                 return tevent_req_post(req, ev);
3586         }
3587         tevent_req_set_callback(subreq, rpccli_spoolss_ReadPrinter_done, req);
3588         return req;
3589 }
3590
3591 static void rpccli_spoolss_ReadPrinter_done(struct tevent_req *subreq)
3592 {
3593         struct tevent_req *req = tevent_req_callback_data(
3594                 subreq, struct tevent_req);
3595         struct rpccli_spoolss_ReadPrinter_state *state = tevent_req_data(
3596                 req, struct rpccli_spoolss_ReadPrinter_state);
3597         NTSTATUS status;
3598         TALLOC_CTX *mem_ctx;
3599
3600         if (state->out_mem_ctx) {
3601                 mem_ctx = state->out_mem_ctx;
3602         } else {
3603                 mem_ctx = state;
3604         }
3605
3606         status = state->dispatch_recv(subreq, mem_ctx);
3607         TALLOC_FREE(subreq);
3608         if (!NT_STATUS_IS_OK(status)) {
3609                 tevent_req_nterror(req, status);
3610                 return;
3611         }
3612
3613         /* Copy out parameters */
3614         memcpy(state->orig.out.data, state->tmp.out.data, (state->tmp.in.data_size) * sizeof(*state->orig.out.data));
3615         *state->orig.out._data_size = *state->tmp.out._data_size;
3616
3617         /* Copy result */
3618         state->orig.out.result = state->tmp.out.result;
3619
3620         /* Reset temporary structure */
3621         ZERO_STRUCT(state->tmp);
3622
3623         tevent_req_done(req);
3624 }
3625
3626 NTSTATUS rpccli_spoolss_ReadPrinter_recv(struct tevent_req *req,
3627                                          TALLOC_CTX *mem_ctx,
3628                                          WERROR *result)
3629 {
3630         struct rpccli_spoolss_ReadPrinter_state *state = tevent_req_data(
3631                 req, struct rpccli_spoolss_ReadPrinter_state);
3632         NTSTATUS status;
3633
3634         if (tevent_req_is_nterror(req, &status)) {
3635                 tevent_req_received(req);
3636                 return status;
3637         }
3638
3639         /* Steal possbile out parameters to the callers context */
3640         talloc_steal(mem_ctx, state->out_mem_ctx);
3641
3642         /* Return result */
3643         *result = state->orig.out.result;
3644
3645         tevent_req_received(req);
3646         return NT_STATUS_OK;
3647 }
3648
3649 NTSTATUS rpccli_spoolss_ReadPrinter(struct rpc_pipe_client *cli,
3650                                     TALLOC_CTX *mem_ctx,
3651                                     struct policy_handle *handle /* [in] [ref] */,
3652                                     uint8_t *data /* [out] [ref,size_is(data_size)] */,
3653                                     uint32_t data_size /* [in]  */,
3654                                     uint32_t *_data_size /* [out] [ref] */,
3655                                     WERROR *werror)
3656 {
3657         struct spoolss_ReadPrinter r;
3658         NTSTATUS status;
3659
3660         /* In parameters */
3661         r.in.handle = handle;
3662         r.in.data_size = data_size;
3663
3664         status = cli->dispatch(cli,
3665                                 mem_ctx,
3666                                 &ndr_table_spoolss,
3667                                 NDR_SPOOLSS_READPRINTER,
3668                                 &r);
3669
3670         if (!NT_STATUS_IS_OK(status)) {
3671                 return status;
3672         }
3673
3674         if (NT_STATUS_IS_ERR(status)) {
3675                 return status;
3676         }
3677
3678         /* Return variables */
3679         memcpy(data, r.out.data, (r.in.data_size) * sizeof(*data));
3680         *_data_size = *r.out._data_size;
3681
3682         /* Return result */
3683         if (werror) {
3684                 *werror = r.out.result;
3685         }
3686
3687         return werror_to_ntstatus(r.out.result);
3688 }
3689
3690 struct rpccli_spoolss_EndDocPrinter_state {
3691         struct spoolss_EndDocPrinter orig;
3692         struct spoolss_EndDocPrinter tmp;
3693         TALLOC_CTX *out_mem_ctx;
3694         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
3695 };
3696
3697 static void rpccli_spoolss_EndDocPrinter_done(struct tevent_req *subreq);
3698
3699 struct tevent_req *rpccli_spoolss_EndDocPrinter_send(TALLOC_CTX *mem_ctx,
3700                                                      struct tevent_context *ev,
3701                                                      struct rpc_pipe_client *cli,
3702                                                      struct policy_handle *_handle /* [in] [ref] */)
3703 {
3704         struct tevent_req *req;
3705         struct rpccli_spoolss_EndDocPrinter_state *state;
3706         struct tevent_req *subreq;
3707
3708         req = tevent_req_create(mem_ctx, &state,
3709                                 struct rpccli_spoolss_EndDocPrinter_state);
3710         if (req == NULL) {
3711                 return NULL;
3712         }
3713         state->out_mem_ctx = NULL;
3714         state->dispatch_recv = cli->dispatch_recv;
3715
3716         /* In parameters */
3717         state->orig.in.handle = _handle;
3718
3719         /* Out parameters */
3720
3721         /* Result */
3722         ZERO_STRUCT(state->orig.out.result);
3723
3724         /* make a temporary copy, that we pass to the dispatch function */
3725         state->tmp = state->orig;
3726
3727         subreq = cli->dispatch_send(state, ev, cli,
3728                                     &ndr_table_spoolss,
3729                                     NDR_SPOOLSS_ENDDOCPRINTER,
3730                                     &state->tmp);
3731         if (tevent_req_nomem(subreq, req)) {
3732                 return tevent_req_post(req, ev);
3733         }
3734         tevent_req_set_callback(subreq, rpccli_spoolss_EndDocPrinter_done, req);
3735         return req;
3736 }
3737
3738 static void rpccli_spoolss_EndDocPrinter_done(struct tevent_req *subreq)
3739 {
3740         struct tevent_req *req = tevent_req_callback_data(
3741                 subreq, struct tevent_req);
3742         struct rpccli_spoolss_EndDocPrinter_state *state = tevent_req_data(
3743                 req, struct rpccli_spoolss_EndDocPrinter_state);
3744         NTSTATUS status;
3745         TALLOC_CTX *mem_ctx;
3746
3747         if (state->out_mem_ctx) {
3748                 mem_ctx = state->out_mem_ctx;
3749         } else {
3750                 mem_ctx = state;
3751         }
3752
3753         status = state->dispatch_recv(subreq, mem_ctx);
3754         TALLOC_FREE(subreq);
3755         if (!NT_STATUS_IS_OK(status)) {
3756                 tevent_req_nterror(req, status);
3757                 return;
3758         }
3759
3760         /* Copy out parameters */
3761
3762         /* Copy result */
3763         state->orig.out.result = state->tmp.out.result;
3764
3765         /* Reset temporary structure */
3766         ZERO_STRUCT(state->tmp);
3767
3768         tevent_req_done(req);
3769 }
3770
3771 NTSTATUS rpccli_spoolss_EndDocPrinter_recv(struct tevent_req *req,
3772                                            TALLOC_CTX *mem_ctx,
3773                                            WERROR *result)
3774 {
3775         struct rpccli_spoolss_EndDocPrinter_state *state = tevent_req_data(
3776                 req, struct rpccli_spoolss_EndDocPrinter_state);
3777         NTSTATUS status;
3778
3779         if (tevent_req_is_nterror(req, &status)) {
3780                 tevent_req_received(req);
3781                 return status;
3782         }
3783
3784         /* Steal possbile out parameters to the callers context */
3785         talloc_steal(mem_ctx, state->out_mem_ctx);
3786
3787         /* Return result */
3788         *result = state->orig.out.result;
3789
3790         tevent_req_received(req);
3791         return NT_STATUS_OK;
3792 }
3793
3794 NTSTATUS rpccli_spoolss_EndDocPrinter(struct rpc_pipe_client *cli,
3795                                       TALLOC_CTX *mem_ctx,
3796                                       struct policy_handle *handle /* [in] [ref] */,
3797                                       WERROR *werror)
3798 {
3799         struct spoolss_EndDocPrinter r;
3800         NTSTATUS status;
3801
3802         /* In parameters */
3803         r.in.handle = handle;
3804
3805         status = cli->dispatch(cli,
3806                                 mem_ctx,
3807                                 &ndr_table_spoolss,
3808                                 NDR_SPOOLSS_ENDDOCPRINTER,
3809                                 &r);
3810
3811         if (!NT_STATUS_IS_OK(status)) {
3812                 return status;
3813         }
3814
3815         if (NT_STATUS_IS_ERR(status)) {
3816                 return status;
3817         }
3818
3819         /* Return variables */
3820
3821         /* Return result */
3822         if (werror) {
3823                 *werror = r.out.result;
3824         }
3825
3826         return werror_to_ntstatus(r.out.result);
3827 }
3828
3829 struct rpccli_spoolss_AddJob_state {
3830         struct spoolss_AddJob orig;
3831         struct spoolss_AddJob tmp;
3832         TALLOC_CTX *out_mem_ctx;
3833         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
3834 };
3835
3836 static void rpccli_spoolss_AddJob_done(struct tevent_req *subreq);
3837
3838 struct tevent_req *rpccli_spoolss_AddJob_send(TALLOC_CTX *mem_ctx,
3839                                               struct tevent_context *ev,
3840                                               struct rpc_pipe_client *cli,
3841                                               struct policy_handle *_handle /* [in] [ref] */,
3842                                               uint32_t _level /* [in]  */,
3843                                               uint8_t *_buffer /* [in,out] [unique,size_is(offered)] */,
3844                                               uint32_t _offered /* [in]  */,
3845                                               uint32_t *_needed /* [out] [ref] */)
3846 {
3847         struct tevent_req *req;
3848         struct rpccli_spoolss_AddJob_state *state;
3849         struct tevent_req *subreq;
3850
3851         req = tevent_req_create(mem_ctx, &state,
3852                                 struct rpccli_spoolss_AddJob_state);
3853         if (req == NULL) {
3854                 return NULL;
3855         }
3856         state->out_mem_ctx = NULL;
3857         state->dispatch_recv = cli->dispatch_recv;
3858
3859         /* In parameters */
3860         state->orig.in.handle = _handle;
3861         state->orig.in.level = _level;
3862         state->orig.in.buffer = _buffer;
3863         state->orig.in.offered = _offered;
3864
3865         /* Out parameters */
3866         state->orig.out.buffer = _buffer;
3867         state->orig.out.needed = _needed;
3868
3869         /* Result */
3870         ZERO_STRUCT(state->orig.out.result);
3871
3872         state->out_mem_ctx = talloc_named_const(state, 0,
3873                              "rpccli_spoolss_AddJob_out_memory");
3874         if (tevent_req_nomem(state->out_mem_ctx, req)) {
3875                 return tevent_req_post(req, ev);
3876         }
3877
3878         /* make a temporary copy, that we pass to the dispatch function */
3879         state->tmp = state->orig;
3880
3881         subreq = cli->dispatch_send(state, ev, cli,
3882                                     &ndr_table_spoolss,
3883                                     NDR_SPOOLSS_ADDJOB,
3884                                     &state->tmp);
3885         if (tevent_req_nomem(subreq, req)) {
3886                 return tevent_req_post(req, ev);
3887         }
3888         tevent_req_set_callback(subreq, rpccli_spoolss_AddJob_done, req);
3889         return req;
3890 }
3891
3892 static void rpccli_spoolss_AddJob_done(struct tevent_req *subreq)
3893 {
3894         struct tevent_req *req = tevent_req_callback_data(
3895                 subreq, struct tevent_req);
3896         struct rpccli_spoolss_AddJob_state *state = tevent_req_data(
3897                 req, struct rpccli_spoolss_AddJob_state);
3898         NTSTATUS status;
3899         TALLOC_CTX *mem_ctx;
3900
3901         if (state->out_mem_ctx) {
3902                 mem_ctx = state->out_mem_ctx;
3903         } else {
3904                 mem_ctx = state;
3905         }
3906
3907         status = state->dispatch_recv(subreq, mem_ctx);
3908         TALLOC_FREE(subreq);
3909         if (!NT_STATUS_IS_OK(status)) {
3910                 tevent_req_nterror(req, status);
3911                 return;
3912         }
3913
3914         /* Copy out parameters */
3915         if (state->orig.out.buffer && state->tmp.out.buffer) {
3916                 memcpy(state->orig.out.buffer, state->tmp.out.buffer, (state->tmp.in.offered) * sizeof(*state->orig.out.buffer));
3917         }
3918         *state->orig.out.needed = *state->tmp.out.needed;
3919
3920         /* Copy result */
3921         state->orig.out.result = state->tmp.out.result;
3922
3923         /* Reset temporary structure */
3924         ZERO_STRUCT(state->tmp);
3925
3926         tevent_req_done(req);
3927 }
3928
3929 NTSTATUS rpccli_spoolss_AddJob_recv(struct tevent_req *req,
3930                                     TALLOC_CTX *mem_ctx,
3931                                     WERROR *result)
3932 {
3933         struct rpccli_spoolss_AddJob_state *state = tevent_req_data(
3934                 req, struct rpccli_spoolss_AddJob_state);
3935         NTSTATUS status;
3936
3937         if (tevent_req_is_nterror(req, &status)) {
3938                 tevent_req_received(req);
3939                 return status;
3940         }
3941
3942         /* Steal possbile out parameters to the callers context */
3943         talloc_steal(mem_ctx, state->out_mem_ctx);
3944
3945         /* Return result */
3946         *result = state->orig.out.result;
3947
3948         tevent_req_received(req);
3949         return NT_STATUS_OK;
3950 }
3951
3952 NTSTATUS rpccli_spoolss_AddJob(struct rpc_pipe_client *cli,
3953                                TALLOC_CTX *mem_ctx,
3954                                struct policy_handle *handle /* [in] [ref] */,
3955                                uint32_t level /* [in]  */,
3956                                uint8_t *buffer /* [in,out] [unique,size_is(offered)] */,
3957                                uint32_t offered /* [in]  */,
3958                                uint32_t *needed /* [out] [ref] */,
3959                                WERROR *werror)
3960 {
3961         struct spoolss_AddJob r;
3962         NTSTATUS status;
3963
3964         /* In parameters */
3965         r.in.handle = handle;
3966         r.in.level = level;
3967         r.in.buffer = buffer;
3968         r.in.offered = offered;
3969
3970         status = cli->dispatch(cli,
3971                                 mem_ctx,
3972                                 &ndr_table_spoolss,
3973                                 NDR_SPOOLSS_ADDJOB,
3974                                 &r);
3975
3976         if (!NT_STATUS_IS_OK(status)) {
3977                 return status;
3978         }
3979
3980         if (NT_STATUS_IS_ERR(status)) {
3981                 return status;
3982         }
3983
3984         /* Return variables */
3985         if (buffer && r.out.buffer) {
3986                 memcpy(buffer, r.out.buffer, (r.in.offered) * sizeof(*buffer));
3987         }
3988         *needed = *r.out.needed;
3989
3990         /* Return result */
3991         if (werror) {
3992                 *werror = r.out.result;
3993         }
3994
3995         return werror_to_ntstatus(r.out.result);
3996 }
3997
3998 struct rpccli_spoolss_ScheduleJob_state {
3999         struct spoolss_ScheduleJob orig;
4000         struct spoolss_ScheduleJob tmp;
4001         TALLOC_CTX *out_mem_ctx;
4002         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
4003 };
4004
4005 static void rpccli_spoolss_ScheduleJob_done(struct tevent_req *subreq);
4006
4007 struct tevent_req *rpccli_spoolss_ScheduleJob_send(TALLOC_CTX *mem_ctx,
4008                                                    struct tevent_context *ev,
4009                                                    struct rpc_pipe_client *cli,
4010                                                    struct policy_handle *_handle /* [in] [ref] */,
4011                                                    uint32_t _jobid /* [in]  */)
4012 {
4013         struct tevent_req *req;
4014         struct rpccli_spoolss_ScheduleJob_state *state;
4015         struct tevent_req *subreq;
4016
4017         req = tevent_req_create(mem_ctx, &state,
4018                                 struct rpccli_spoolss_ScheduleJob_state);
4019         if (req == NULL) {
4020                 return NULL;
4021         }
4022         state->out_mem_ctx = NULL;
4023         state->dispatch_recv = cli->dispatch_recv;
4024
4025         /* In parameters */
4026         state->orig.in.handle = _handle;
4027         state->orig.in.jobid = _jobid;
4028
4029         /* Out parameters */
4030
4031         /* Result */
4032         ZERO_STRUCT(state->orig.out.result);
4033
4034         /* make a temporary copy, that we pass to the dispatch function */
4035         state->tmp = state->orig;
4036
4037         subreq = cli->dispatch_send(state, ev, cli,
4038                                     &ndr_table_spoolss,
4039                                     NDR_SPOOLSS_SCHEDULEJOB,
4040                                     &state->tmp);
4041         if (tevent_req_nomem(subreq, req)) {
4042                 return tevent_req_post(req, ev);
4043         }
4044         tevent_req_set_callback(subreq, rpccli_spoolss_ScheduleJob_done, req);
4045         return req;
4046 }
4047
4048 static void rpccli_spoolss_ScheduleJob_done(struct tevent_req *subreq)
4049 {
4050         struct tevent_req *req = tevent_req_callback_data(
4051                 subreq, struct tevent_req);
4052         struct rpccli_spoolss_ScheduleJob_state *state = tevent_req_data(
4053                 req, struct rpccli_spoolss_ScheduleJob_state);
4054         NTSTATUS status;
4055         TALLOC_CTX *mem_ctx;
4056
4057         if (state->out_mem_ctx) {
4058                 mem_ctx = state->out_mem_ctx;
4059         } else {
4060                 mem_ctx = state;
4061         }
4062
4063         status = state->dispatch_recv(subreq, mem_ctx);
4064         TALLOC_FREE(subreq);
4065         if (!NT_STATUS_IS_OK(status)) {
4066                 tevent_req_nterror(req, status);
4067                 return;
4068         }
4069
4070         /* Copy out parameters */
4071
4072         /* Copy result */
4073         state->orig.out.result = state->tmp.out.result;
4074
4075         /* Reset temporary structure */
4076         ZERO_STRUCT(state->tmp);
4077
4078         tevent_req_done(req);
4079 }
4080
4081 NTSTATUS rpccli_spoolss_ScheduleJob_recv(struct tevent_req *req,
4082                                          TALLOC_CTX *mem_ctx,
4083                                          WERROR *result)
4084 {
4085         struct rpccli_spoolss_ScheduleJob_state *state = tevent_req_data(
4086                 req, struct rpccli_spoolss_ScheduleJob_state);
4087         NTSTATUS status;
4088
4089         if (tevent_req_is_nterror(req, &status)) {
4090                 tevent_req_received(req);
4091                 return status;
4092         }
4093
4094         /* Steal possbile out parameters to the callers context */
4095         talloc_steal(mem_ctx, state->out_mem_ctx);
4096
4097         /* Return result */
4098         *result = state->orig.out.result;
4099
4100         tevent_req_received(req);
4101         return NT_STATUS_OK;
4102 }
4103
4104 NTSTATUS rpccli_spoolss_ScheduleJob(struct rpc_pipe_client *cli,
4105                                     TALLOC_CTX *mem_ctx,
4106                                     struct policy_handle *handle /* [in] [ref] */,
4107                                     uint32_t jobid /* [in]  */,
4108                                     WERROR *werror)
4109 {
4110         struct spoolss_ScheduleJob r;
4111         NTSTATUS status;
4112
4113         /* In parameters */
4114         r.in.handle = handle;
4115         r.in.jobid = jobid;
4116
4117         status = cli->dispatch(cli,
4118                                 mem_ctx,
4119                                 &ndr_table_spoolss,
4120                                 NDR_SPOOLSS_SCHEDULEJOB,
4121                                 &r);
4122
4123         if (!NT_STATUS_IS_OK(status)) {
4124                 return status;
4125         }
4126
4127         if (NT_STATUS_IS_ERR(status)) {
4128                 return status;
4129         }
4130
4131         /* Return variables */
4132
4133         /* Return result */
4134         if (werror) {
4135                 *werror = r.out.result;
4136         }
4137
4138         return werror_to_ntstatus(r.out.result);
4139 }
4140
4141 struct rpccli_spoolss_GetPrinterData_state {
4142         struct spoolss_GetPrinterData orig;
4143         struct spoolss_GetPrinterData tmp;
4144         TALLOC_CTX *out_mem_ctx;
4145         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
4146 };
4147
4148 static void rpccli_spoolss_GetPrinterData_done(struct tevent_req *subreq);
4149
4150 struct tevent_req *rpccli_spoolss_GetPrinterData_send(TALLOC_CTX *mem_ctx,
4151                                                       struct tevent_context *ev,
4152                                                       struct rpc_pipe_client *cli,
4153                                                       struct policy_handle *_handle /* [in] [ref] */,
4154                                                       const char *_value_name /* [in] [charset(UTF16)] */,
4155                                                       enum winreg_Type *_type /* [out] [ref] */,
4156                                                       uint8_t *_data /* [out] [ref,size_is(offered)] */,
4157                                                       uint32_t _offered /* [in]  */,
4158                                                       uint32_t *_needed /* [out] [ref] */)
4159 {
4160         struct tevent_req *req;
4161         struct rpccli_spoolss_GetPrinterData_state *state;
4162         struct tevent_req *subreq;
4163
4164         req = tevent_req_create(mem_ctx, &state,
4165                                 struct rpccli_spoolss_GetPrinterData_state);
4166         if (req == NULL) {
4167                 return NULL;
4168         }
4169         state->out_mem_ctx = NULL;
4170         state->dispatch_recv = cli->dispatch_recv;
4171
4172         /* In parameters */
4173         state->orig.in.handle = _handle;
4174         state->orig.in.value_name = _value_name;
4175         state->orig.in.offered = _offered;
4176
4177         /* Out parameters */
4178         state->orig.out.type = _type;
4179         state->orig.out.data = _data;
4180         state->orig.out.needed = _needed;
4181
4182         /* Result */
4183         ZERO_STRUCT(state->orig.out.result);
4184
4185         state->out_mem_ctx = talloc_named_const(state, 0,
4186                              "rpccli_spoolss_GetPrinterData_out_memory");
4187         if (tevent_req_nomem(state->out_mem_ctx, req)) {
4188                 return tevent_req_post(req, ev);
4189         }
4190
4191         /* make a temporary copy, that we pass to the dispatch function */
4192         state->tmp = state->orig;
4193
4194         subreq = cli->dispatch_send(state, ev, cli,
4195                                     &ndr_table_spoolss,
4196                                     NDR_SPOOLSS_GETPRINTERDATA,
4197                                     &state->tmp);
4198         if (tevent_req_nomem(subreq, req)) {
4199                 return tevent_req_post(req, ev);
4200         }
4201         tevent_req_set_callback(subreq, rpccli_spoolss_GetPrinterData_done, req);
4202         return req;
4203 }
4204
4205 static void rpccli_spoolss_GetPrinterData_done(struct tevent_req *subreq)
4206 {
4207         struct tevent_req *req = tevent_req_callback_data(
4208                 subreq, struct tevent_req);
4209         struct rpccli_spoolss_GetPrinterData_state *state = tevent_req_data(
4210                 req, struct rpccli_spoolss_GetPrinterData_state);
4211         NTSTATUS status;
4212         TALLOC_CTX *mem_ctx;
4213
4214         if (state->out_mem_ctx) {
4215                 mem_ctx = state->out_mem_ctx;
4216         } else {
4217                 mem_ctx = state;
4218         }
4219
4220         status = state->dispatch_recv(subreq, mem_ctx);
4221         TALLOC_FREE(subreq);
4222         if (!NT_STATUS_IS_OK(status)) {
4223                 tevent_req_nterror(req, status);
4224                 return;
4225         }
4226
4227         /* Copy out parameters */
4228         *state->orig.out.type = *state->tmp.out.type;
4229         memcpy(state->orig.out.data, state->tmp.out.data, (state->tmp.in.offered) * sizeof(*state->orig.out.data));
4230         *state->orig.out.needed = *state->tmp.out.needed;
4231
4232         /* Copy result */
4233         state->orig.out.result = state->tmp.out.result;
4234
4235         /* Reset temporary structure */
4236         ZERO_STRUCT(state->tmp);
4237
4238         tevent_req_done(req);
4239 }
4240
4241 NTSTATUS rpccli_spoolss_GetPrinterData_recv(struct tevent_req *req,
4242                                             TALLOC_CTX *mem_ctx,
4243                                             WERROR *result)
4244 {
4245         struct rpccli_spoolss_GetPrinterData_state *state = tevent_req_data(
4246                 req, struct rpccli_spoolss_GetPrinterData_state);
4247         NTSTATUS status;
4248
4249         if (tevent_req_is_nterror(req, &status)) {
4250                 tevent_req_received(req);
4251                 return status;
4252         }
4253
4254         /* Steal possbile out parameters to the callers context */
4255         talloc_steal(mem_ctx, state->out_mem_ctx);
4256
4257         /* Return result */
4258         *result = state->orig.out.result;
4259
4260         tevent_req_received(req);
4261         return NT_STATUS_OK;
4262 }
4263
4264 NTSTATUS rpccli_spoolss_GetPrinterData(struct rpc_pipe_client *cli,
4265                                        TALLOC_CTX *mem_ctx,
4266                                        struct policy_handle *handle /* [in] [ref] */,
4267                                        const char *value_name /* [in] [charset(UTF16)] */,
4268                                        enum winreg_Type *type /* [out] [ref] */,
4269                                        uint8_t *data /* [out] [ref,size_is(offered)] */,
4270                                        uint32_t offered /* [in]  */,
4271                                        uint32_t *needed /* [out] [ref] */,
4272                                        WERROR *werror)
4273 {
4274         struct spoolss_GetPrinterData r;
4275         NTSTATUS status;
4276
4277         /* In parameters */
4278         r.in.handle = handle;
4279         r.in.value_name = value_name;
4280         r.in.offered = offered;
4281
4282         status = cli->dispatch(cli,
4283                                 mem_ctx,
4284                                 &ndr_table_spoolss,
4285                                 NDR_SPOOLSS_GETPRINTERDATA,
4286                                 &r);
4287
4288         if (!NT_STATUS_IS_OK(status)) {
4289                 return status;
4290         }
4291
4292         if (NT_STATUS_IS_ERR(status)) {
4293                 return status;
4294         }
4295
4296         /* Return variables */
4297         *type = *r.out.type;
4298         memcpy(data, r.out.data, (r.in.offered) * sizeof(*data));
4299         *needed = *r.out.needed;
4300
4301         /* Return result */
4302         if (werror) {
4303                 *werror = r.out.result;
4304         }
4305
4306         return werror_to_ntstatus(r.out.result);
4307 }
4308
4309 struct rpccli_spoolss_SetPrinterData_state {
4310         struct spoolss_SetPrinterData orig;
4311         struct spoolss_SetPrinterData tmp;
4312         TALLOC_CTX *out_mem_ctx;
4313         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
4314 };
4315
4316 static void rpccli_spoolss_SetPrinterData_done(struct tevent_req *subreq);
4317
4318 struct tevent_req *rpccli_spoolss_SetPrinterData_send(TALLOC_CTX *mem_ctx,
4319                                                       struct tevent_context *ev,
4320                                                       struct rpc_pipe_client *cli,
4321                                                       struct policy_handle *_handle /* [in] [ref] */,
4322                                                       const char *_value_name /* [in] [charset(UTF16)] */,
4323                                                       enum winreg_Type _type /* [in]  */,
4324                                                       uint8_t *_data /* [in] [ref,size_is(offered)] */,
4325                                                       uint32_t _offered /* [in]  */)
4326 {
4327         struct tevent_req *req;
4328         struct rpccli_spoolss_SetPrinterData_state *state;
4329         struct tevent_req *subreq;
4330
4331         req = tevent_req_create(mem_ctx, &state,
4332                                 struct rpccli_spoolss_SetPrinterData_state);
4333         if (req == NULL) {
4334                 return NULL;
4335         }
4336         state->out_mem_ctx = NULL;
4337         state->dispatch_recv = cli->dispatch_recv;
4338
4339         /* In parameters */
4340         state->orig.in.handle = _handle;
4341         state->orig.in.value_name = _value_name;
4342         state->orig.in.type = _type;
4343         state->orig.in.data = _data;
4344         state->orig.in.offered = _offered;
4345
4346         /* Out parameters */
4347
4348         /* Result */
4349         ZERO_STRUCT(state->orig.out.result);
4350
4351         /* make a temporary copy, that we pass to the dispatch function */
4352         state->tmp = state->orig;
4353
4354         subreq = cli->dispatch_send(state, ev, cli,
4355                                     &ndr_table_spoolss,
4356                                     NDR_SPOOLSS_SETPRINTERDATA,
4357                                     &state->tmp);
4358         if (tevent_req_nomem(subreq, req)) {
4359                 return tevent_req_post(req, ev);
4360         }
4361         tevent_req_set_callback(subreq, rpccli_spoolss_SetPrinterData_done, req);
4362         return req;
4363 }
4364
4365 static void rpccli_spoolss_SetPrinterData_done(struct tevent_req *subreq)
4366 {
4367         struct tevent_req *req = tevent_req_callback_data(
4368                 subreq, struct tevent_req);
4369         struct rpccli_spoolss_SetPrinterData_state *state = tevent_req_data(
4370                 req, struct rpccli_spoolss_SetPrinterData_state);
4371         NTSTATUS status;
4372         TALLOC_CTX *mem_ctx;
4373
4374         if (state->out_mem_ctx) {
4375                 mem_ctx = state->out_mem_ctx;
4376         } else {
4377                 mem_ctx = state;
4378         }
4379
4380         status = state->dispatch_recv(subreq, mem_ctx);
4381         TALLOC_FREE(subreq);
4382         if (!NT_STATUS_IS_OK(status)) {
4383                 tevent_req_nterror(req, status);
4384                 return;
4385         }
4386
4387         /* Copy out parameters */
4388
4389         /* Copy result */
4390         state->orig.out.result = state->tmp.out.result;
4391
4392         /* Reset temporary structure */
4393         ZERO_STRUCT(state->tmp);
4394
4395         tevent_req_done(req);
4396 }
4397
4398 NTSTATUS rpccli_spoolss_SetPrinterData_recv(struct tevent_req *req,
4399                                             TALLOC_CTX *mem_ctx,
4400                                             WERROR *result)
4401 {
4402         struct rpccli_spoolss_SetPrinterData_state *state = tevent_req_data(
4403                 req, struct rpccli_spoolss_SetPrinterData_state);
4404         NTSTATUS status;
4405
4406         if (tevent_req_is_nterror(req, &status)) {
4407                 tevent_req_received(req);
4408                 return status;
4409         }
4410
4411         /* Steal possbile out parameters to the callers context */
4412         talloc_steal(mem_ctx, state->out_mem_ctx);
4413
4414         /* Return result */
4415         *result = state->orig.out.result;
4416
4417         tevent_req_received(req);
4418         return NT_STATUS_OK;
4419 }
4420
4421 NTSTATUS rpccli_spoolss_SetPrinterData(struct rpc_pipe_client *cli,
4422                                        TALLOC_CTX *mem_ctx,
4423                                        struct policy_handle *handle /* [in] [ref] */,
4424                                        const char *value_name /* [in] [charset(UTF16)] */,
4425                                        enum winreg_Type type /* [in]  */,
4426                                        uint8_t *data /* [in] [ref,size_is(offered)] */,
4427                                        uint32_t offered /* [in]  */,
4428                                        WERROR *werror)
4429 {
4430         struct spoolss_SetPrinterData r;
4431         NTSTATUS status;
4432
4433         /* In parameters */
4434         r.in.handle = handle;
4435         r.in.value_name = value_name;
4436         r.in.type = type;
4437         r.in.data = data;
4438         r.in.offered = offered;
4439
4440         status = cli->dispatch(cli,
4441                                 mem_ctx,
4442                                 &ndr_table_spoolss,
4443                                 NDR_SPOOLSS_SETPRINTERDATA,
4444                                 &r);
4445
4446         if (!NT_STATUS_IS_OK(status)) {
4447                 return status;
4448         }
4449
4450         if (NT_STATUS_IS_ERR(status)) {
4451                 return status;
4452         }
4453
4454         /* Return variables */
4455
4456         /* Return result */
4457         if (werror) {
4458                 *werror = r.out.result;
4459         }
4460
4461         return werror_to_ntstatus(r.out.result);
4462 }
4463
4464 struct rpccli_spoolss_WaitForPrinterChange_state {
4465         struct spoolss_WaitForPrinterChange orig;
4466         struct spoolss_WaitForPrinterChange tmp;
4467         TALLOC_CTX *out_mem_ctx;
4468         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
4469 };
4470
4471 static void rpccli_spoolss_WaitForPrinterChange_done(struct tevent_req *subreq);
4472
4473 struct tevent_req *rpccli_spoolss_WaitForPrinterChange_send(TALLOC_CTX *mem_ctx,
4474                                                             struct tevent_context *ev,
4475                                                             struct rpc_pipe_client *cli)
4476 {
4477         struct tevent_req *req;
4478         struct rpccli_spoolss_WaitForPrinterChange_state *state;
4479         struct tevent_req *subreq;
4480
4481         req = tevent_req_create(mem_ctx, &state,
4482                                 struct rpccli_spoolss_WaitForPrinterChange_state);
4483         if (req == NULL) {
4484                 return NULL;
4485         }
4486         state->out_mem_ctx = NULL;
4487         state->dispatch_recv = cli->dispatch_recv;
4488
4489         /* In parameters */
4490
4491         /* Out parameters */
4492
4493         /* Result */
4494         ZERO_STRUCT(state->orig.out.result);
4495
4496         /* make a temporary copy, that we pass to the dispatch function */
4497         state->tmp = state->orig;
4498
4499         subreq = cli->dispatch_send(state, ev, cli,
4500                                     &ndr_table_spoolss,
4501                                     NDR_SPOOLSS_WAITFORPRINTERCHANGE,
4502                                     &state->tmp);
4503         if (tevent_req_nomem(subreq, req)) {
4504                 return tevent_req_post(req, ev);
4505         }
4506         tevent_req_set_callback(subreq, rpccli_spoolss_WaitForPrinterChange_done, req);
4507         return req;
4508 }
4509
4510 static void rpccli_spoolss_WaitForPrinterChange_done(struct tevent_req *subreq)
4511 {
4512         struct tevent_req *req = tevent_req_callback_data(
4513                 subreq, struct tevent_req);
4514         struct rpccli_spoolss_WaitForPrinterChange_state *state = tevent_req_data(
4515                 req, struct rpccli_spoolss_WaitForPrinterChange_state);
4516         NTSTATUS status;
4517         TALLOC_CTX *mem_ctx;
4518
4519         if (state->out_mem_ctx) {
4520                 mem_ctx = state->out_mem_ctx;
4521         } else {
4522                 mem_ctx = state;
4523         }
4524
4525         status = state->dispatch_recv(subreq, mem_ctx);
4526         TALLOC_FREE(subreq);
4527         if (!NT_STATUS_IS_OK(status)) {
4528                 tevent_req_nterror(req, status);
4529                 return;
4530         }
4531
4532         /* Copy out parameters */
4533
4534         /* Copy result */
4535         state->orig.out.result = state->tmp.out.result;
4536
4537         /* Reset temporary structure */
4538         ZERO_STRUCT(state->tmp);
4539
4540         tevent_req_done(req);
4541 }
4542
4543 NTSTATUS rpccli_spoolss_WaitForPrinterChange_recv(struct tevent_req *req,
4544                                                   TALLOC_CTX *mem_ctx,
4545                                                   WERROR *result)
4546 {
4547         struct rpccli_spoolss_WaitForPrinterChange_state *state = tevent_req_data(
4548                 req, struct rpccli_spoolss_WaitForPrinterChange_state);
4549         NTSTATUS status;
4550
4551         if (tevent_req_is_nterror(req, &status)) {
4552                 tevent_req_received(req);
4553                 return status;
4554         }
4555
4556         /* Steal possbile out parameters to the callers context */
4557         talloc_steal(mem_ctx, state->out_mem_ctx);
4558
4559         /* Return result */
4560         *result = state->orig.out.result;
4561
4562         tevent_req_received(req);
4563         return NT_STATUS_OK;
4564 }
4565
4566 NTSTATUS rpccli_spoolss_WaitForPrinterChange(struct rpc_pipe_client *cli,
4567                                              TALLOC_CTX *mem_ctx,
4568                                              WERROR *werror)
4569 {
4570         struct spoolss_WaitForPrinterChange r;
4571         NTSTATUS status;
4572
4573         /* In parameters */
4574
4575         status = cli->dispatch(cli,
4576                                 mem_ctx,
4577                                 &ndr_table_spoolss,
4578                                 NDR_SPOOLSS_WAITFORPRINTERCHANGE,
4579                                 &r);
4580
4581         if (!NT_STATUS_IS_OK(status)) {
4582                 return status;
4583         }
4584
4585         if (NT_STATUS_IS_ERR(status)) {
4586                 return status;
4587         }
4588
4589         /* Return variables */
4590
4591         /* Return result */
4592         if (werror) {
4593                 *werror = r.out.result;
4594         }
4595
4596         return werror_to_ntstatus(r.out.result);
4597 }
4598
4599 struct rpccli_spoolss_ClosePrinter_state {
4600         struct spoolss_ClosePrinter orig;
4601         struct spoolss_ClosePrinter tmp;
4602         TALLOC_CTX *out_mem_ctx;
4603         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
4604 };
4605
4606 static void rpccli_spoolss_ClosePrinter_done(struct tevent_req *subreq);
4607
4608 struct tevent_req *rpccli_spoolss_ClosePrinter_send(TALLOC_CTX *mem_ctx,
4609                                                     struct tevent_context *ev,
4610                                                     struct rpc_pipe_client *cli,
4611                                                     struct policy_handle *_handle /* [in,out] [ref] */)
4612 {
4613         struct tevent_req *req;
4614         struct rpccli_spoolss_ClosePrinter_state *state;
4615         struct tevent_req *subreq;
4616
4617         req = tevent_req_create(mem_ctx, &state,
4618                                 struct rpccli_spoolss_ClosePrinter_state);
4619         if (req == NULL) {
4620                 return NULL;
4621         }
4622         state->out_mem_ctx = NULL;
4623         state->dispatch_recv = cli->dispatch_recv;
4624
4625         /* In parameters */
4626         state->orig.in.handle = _handle;
4627
4628         /* Out parameters */
4629         state->orig.out.handle = _handle;
4630
4631         /* Result */
4632         ZERO_STRUCT(state->orig.out.result);
4633
4634         state->out_mem_ctx = talloc_named_const(state, 0,
4635                              "rpccli_spoolss_ClosePrinter_out_memory");
4636         if (tevent_req_nomem(state->out_mem_ctx, req)) {
4637                 return tevent_req_post(req, ev);
4638         }
4639
4640         /* make a temporary copy, that we pass to the dispatch function */
4641         state->tmp = state->orig;
4642
4643         subreq = cli->dispatch_send(state, ev, cli,
4644                                     &ndr_table_spoolss,
4645                                     NDR_SPOOLSS_CLOSEPRINTER,
4646                                     &state->tmp);
4647         if (tevent_req_nomem(subreq, req)) {
4648                 return tevent_req_post(req, ev);
4649         }
4650         tevent_req_set_callback(subreq, rpccli_spoolss_ClosePrinter_done, req);
4651         return req;
4652 }
4653
4654 static void rpccli_spoolss_ClosePrinter_done(struct tevent_req *subreq)
4655 {
4656         struct tevent_req *req = tevent_req_callback_data(
4657                 subreq, struct tevent_req);
4658         struct rpccli_spoolss_ClosePrinter_state *state = tevent_req_data(
4659                 req, struct rpccli_spoolss_ClosePrinter_state);
4660         NTSTATUS status;
4661         TALLOC_CTX *mem_ctx;
4662
4663         if (state->out_mem_ctx) {
4664                 mem_ctx = state->out_mem_ctx;
4665         } else {
4666                 mem_ctx = state;
4667         }
4668
4669         status = state->dispatch_recv(subreq, mem_ctx);
4670         TALLOC_FREE(subreq);
4671         if (!NT_STATUS_IS_OK(status)) {
4672                 tevent_req_nterror(req, status);
4673                 return;
4674         }
4675
4676         /* Copy out parameters */
4677         *state->orig.out.handle = *state->tmp.out.handle;
4678
4679         /* Copy result */
4680         state->orig.out.result = state->tmp.out.result;
4681
4682         /* Reset temporary structure */
4683         ZERO_STRUCT(state->tmp);
4684
4685         tevent_req_done(req);
4686 }
4687
4688 NTSTATUS rpccli_spoolss_ClosePrinter_recv(struct tevent_req *req,
4689                                           TALLOC_CTX *mem_ctx,
4690                                           WERROR *result)
4691 {
4692         struct rpccli_spoolss_ClosePrinter_state *state = tevent_req_data(
4693                 req, struct rpccli_spoolss_ClosePrinter_state);
4694         NTSTATUS status;
4695
4696         if (tevent_req_is_nterror(req, &status)) {
4697                 tevent_req_received(req);
4698                 return status;
4699         }
4700
4701         /* Steal possbile out parameters to the callers context */
4702         talloc_steal(mem_ctx, state->out_mem_ctx);
4703
4704         /* Return result */
4705         *result = state->orig.out.result;
4706
4707         tevent_req_received(req);
4708         return NT_STATUS_OK;
4709 }
4710
4711 NTSTATUS rpccli_spoolss_ClosePrinter(struct rpc_pipe_client *cli,
4712                                      TALLOC_CTX *mem_ctx,
4713                                      struct policy_handle *handle /* [in,out] [ref] */,
4714                                      WERROR *werror)
4715 {
4716         struct spoolss_ClosePrinter r;
4717         NTSTATUS status;
4718
4719         /* In parameters */
4720         r.in.handle = handle;
4721
4722         status = cli->dispatch(cli,
4723                                 mem_ctx,
4724                                 &ndr_table_spoolss,
4725                                 NDR_SPOOLSS_CLOSEPRINTER,
4726                                 &r);
4727
4728         if (!NT_STATUS_IS_OK(status)) {
4729                 return status;
4730         }
4731
4732         if (NT_STATUS_IS_ERR(status)) {
4733                 return status;
4734         }
4735
4736         /* Return variables */
4737         *handle = *r.out.handle;
4738
4739         /* Return result */
4740         if (werror) {
4741                 *werror = r.out.result;
4742         }
4743
4744         return werror_to_ntstatus(r.out.result);
4745 }
4746
4747 struct rpccli_spoolss_AddForm_state {
4748         struct spoolss_AddForm orig;
4749         struct spoolss_AddForm tmp;
4750         TALLOC_CTX *out_mem_ctx;
4751         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
4752 };
4753
4754 static void rpccli_spoolss_AddForm_done(struct tevent_req *subreq);
4755
4756 struct tevent_req *rpccli_spoolss_AddForm_send(TALLOC_CTX *mem_ctx,
4757                                                struct tevent_context *ev,
4758                                                struct rpc_pipe_client *cli,
4759                                                struct policy_handle *_handle /* [in] [ref] */,
4760                                                uint32_t _level /* [in]  */,
4761                                                union spoolss_AddFormInfo _info /* [in] [switch_is(level)] */)
4762 {
4763         struct tevent_req *req;
4764         struct rpccli_spoolss_AddForm_state *state;
4765         struct tevent_req *subreq;
4766
4767         req = tevent_req_create(mem_ctx, &state,
4768                                 struct rpccli_spoolss_AddForm_state);
4769         if (req == NULL) {
4770                 return NULL;
4771         }
4772         state->out_mem_ctx = NULL;
4773         state->dispatch_recv = cli->dispatch_recv;
4774
4775         /* In parameters */
4776         state->orig.in.handle = _handle;
4777         state->orig.in.level = _level;
4778         state->orig.in.info = _info;
4779
4780         /* Out parameters */
4781
4782         /* Result */
4783         ZERO_STRUCT(state->orig.out.result);
4784
4785         /* make a temporary copy, that we pass to the dispatch function */
4786         state->tmp = state->orig;
4787
4788         subreq = cli->dispatch_send(state, ev, cli,
4789                                     &ndr_table_spoolss,
4790                                     NDR_SPOOLSS_ADDFORM,
4791                                     &state->tmp);
4792         if (tevent_req_nomem(subreq, req)) {
4793                 return tevent_req_post(req, ev);
4794         }
4795         tevent_req_set_callback(subreq, rpccli_spoolss_AddForm_done, req);
4796         return req;
4797 }
4798
4799 static void rpccli_spoolss_AddForm_done(struct tevent_req *subreq)
4800 {
4801         struct tevent_req *req = tevent_req_callback_data(
4802                 subreq, struct tevent_req);
4803         struct rpccli_spoolss_AddForm_state *state = tevent_req_data(
4804                 req, struct rpccli_spoolss_AddForm_state);
4805         NTSTATUS status;
4806         TALLOC_CTX *mem_ctx;
4807
4808         if (state->out_mem_ctx) {
4809                 mem_ctx = state->out_mem_ctx;
4810         } else {
4811                 mem_ctx = state;
4812         }
4813
4814         status = state->dispatch_recv(subreq, mem_ctx);
4815         TALLOC_FREE(subreq);
4816         if (!NT_STATUS_IS_OK(status)) {
4817                 tevent_req_nterror(req, status);
4818                 return;
4819         }
4820
4821         /* Copy out parameters */
4822
4823         /* Copy result */
4824         state->orig.out.result = state->tmp.out.result;
4825
4826         /* Reset temporary structure */
4827         ZERO_STRUCT(state->tmp);
4828
4829         tevent_req_done(req);
4830 }
4831
4832 NTSTATUS rpccli_spoolss_AddForm_recv(struct tevent_req *req,
4833                                      TALLOC_CTX *mem_ctx,
4834                                      WERROR *result)
4835 {
4836         struct rpccli_spoolss_AddForm_state *state = tevent_req_data(
4837                 req, struct rpccli_spoolss_AddForm_state);
4838         NTSTATUS status;
4839
4840         if (tevent_req_is_nterror(req, &status)) {
4841                 tevent_req_received(req);
4842                 return status;
4843         }
4844
4845         /* Steal possbile out parameters to the callers context */
4846         talloc_steal(mem_ctx, state->out_mem_ctx);
4847
4848         /* Return result */
4849         *result = state->orig.out.result;
4850
4851         tevent_req_received(req);
4852         return NT_STATUS_OK;
4853 }
4854
4855 NTSTATUS rpccli_spoolss_AddForm(struct rpc_pipe_client *cli,
4856                                 TALLOC_CTX *mem_ctx,
4857                                 struct policy_handle *handle /* [in] [ref] */,
4858                                 uint32_t level /* [in]  */,
4859                                 union spoolss_AddFormInfo info /* [in] [switch_is(level)] */,
4860                                 WERROR *werror)
4861 {
4862         struct spoolss_AddForm r;
4863         NTSTATUS status;
4864
4865         /* In parameters */
4866         r.in.handle = handle;
4867         r.in.level = level;
4868         r.in.info = info;
4869
4870         status = cli->dispatch(cli,
4871                                 mem_ctx,
4872                                 &ndr_table_spoolss,
4873                                 NDR_SPOOLSS_ADDFORM,
4874                                 &r);
4875
4876         if (!NT_STATUS_IS_OK(status)) {
4877                 return status;
4878         }
4879
4880         if (NT_STATUS_IS_ERR(status)) {
4881                 return status;
4882         }
4883
4884         /* Return variables */
4885
4886         /* Return result */
4887         if (werror) {
4888                 *werror = r.out.result;
4889         }
4890
4891         return werror_to_ntstatus(r.out.result);
4892 }
4893
4894 struct rpccli_spoolss_DeleteForm_state {
4895         struct spoolss_DeleteForm orig;
4896         struct spoolss_DeleteForm tmp;
4897         TALLOC_CTX *out_mem_ctx;
4898         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
4899 };
4900
4901 static void rpccli_spoolss_DeleteForm_done(struct tevent_req *subreq);
4902
4903 struct tevent_req *rpccli_spoolss_DeleteForm_send(TALLOC_CTX *mem_ctx,
4904                                                   struct tevent_context *ev,
4905                                                   struct rpc_pipe_client *cli,
4906                                                   struct policy_handle *_handle /* [in] [ref] */,
4907                                                   const char *_form_name /* [in] [charset(UTF16)] */)
4908 {
4909         struct tevent_req *req;
4910         struct rpccli_spoolss_DeleteForm_state *state;
4911         struct tevent_req *subreq;
4912
4913         req = tevent_req_create(mem_ctx, &state,
4914                                 struct rpccli_spoolss_DeleteForm_state);
4915         if (req == NULL) {
4916                 return NULL;
4917         }
4918         state->out_mem_ctx = NULL;
4919         state->dispatch_recv = cli->dispatch_recv;
4920
4921         /* In parameters */
4922         state->orig.in.handle = _handle;
4923         state->orig.in.form_name = _form_name;
4924
4925         /* Out parameters */
4926
4927         /* Result */
4928         ZERO_STRUCT(state->orig.out.result);
4929
4930         /* make a temporary copy, that we pass to the dispatch function */
4931         state->tmp = state->orig;
4932
4933         subreq = cli->dispatch_send(state, ev, cli,
4934                                     &ndr_table_spoolss,
4935                                     NDR_SPOOLSS_DELETEFORM,
4936                                     &state->tmp);
4937         if (tevent_req_nomem(subreq, req)) {
4938                 return tevent_req_post(req, ev);
4939         }
4940         tevent_req_set_callback(subreq, rpccli_spoolss_DeleteForm_done, req);
4941         return req;
4942 }
4943
4944 static void rpccli_spoolss_DeleteForm_done(struct tevent_req *subreq)
4945 {
4946         struct tevent_req *req = tevent_req_callback_data(
4947                 subreq, struct tevent_req);
4948         struct rpccli_spoolss_DeleteForm_state *state = tevent_req_data(
4949                 req, struct rpccli_spoolss_DeleteForm_state);
4950         NTSTATUS status;
4951         TALLOC_CTX *mem_ctx;
4952
4953         if (state->out_mem_ctx) {
4954                 mem_ctx = state->out_mem_ctx;
4955         } else {
4956                 mem_ctx = state;
4957         }
4958
4959         status = state->dispatch_recv(subreq, mem_ctx);
4960         TALLOC_FREE(subreq);
4961         if (!NT_STATUS_IS_OK(status)) {
4962                 tevent_req_nterror(req, status);
4963                 return;
4964         }
4965
4966         /* Copy out parameters */
4967
4968         /* Copy result */
4969         state->orig.out.result = state->tmp.out.result;
4970
4971         /* Reset temporary structure */
4972         ZERO_STRUCT(state->tmp);
4973
4974         tevent_req_done(req);
4975 }
4976
4977 NTSTATUS rpccli_spoolss_DeleteForm_recv(struct tevent_req *req,
4978                                         TALLOC_CTX *mem_ctx,
4979                                         WERROR *result)
4980 {
4981         struct rpccli_spoolss_DeleteForm_state *state = tevent_req_data(
4982                 req, struct rpccli_spoolss_DeleteForm_state);
4983         NTSTATUS status;
4984
4985         if (tevent_req_is_nterror(req, &status)) {
4986                 tevent_req_received(req);
4987                 return status;
4988         }
4989
4990         /* Steal possbile out parameters to the callers context */
4991         talloc_steal(mem_ctx, state->out_mem_ctx);
4992
4993         /* Return result */
4994         *result = state->orig.out.result;
4995
4996         tevent_req_received(req);
4997         return NT_STATUS_OK;
4998 }
4999
5000 NTSTATUS rpccli_spoolss_DeleteForm(struct rpc_pipe_client *cli,
5001                                    TALLOC_CTX *mem_ctx,
5002                                    struct policy_handle *handle /* [in] [ref] */,
5003                                    const char *form_name /* [in] [charset(UTF16)] */,
5004                                    WERROR *werror)
5005 {
5006         struct spoolss_DeleteForm r;
5007         NTSTATUS status;
5008
5009         /* In parameters */
5010         r.in.handle = handle;
5011         r.in.form_name = form_name;
5012
5013         status = cli->dispatch(cli,
5014                                 mem_ctx,
5015                                 &ndr_table_spoolss,
5016                                 NDR_SPOOLSS_DELETEFORM,
5017                                 &r);
5018
5019         if (!NT_STATUS_IS_OK(status)) {
5020                 return status;
5021         }
5022
5023         if (NT_STATUS_IS_ERR(status)) {
5024                 return status;
5025         }
5026
5027         /* Return variables */
5028
5029         /* Return result */
5030         if (werror) {
5031                 *werror = r.out.result;
5032         }
5033
5034         return werror_to_ntstatus(r.out.result);
5035 }
5036
5037 struct rpccli_spoolss_GetForm_state {
5038         struct spoolss_GetForm orig;
5039         struct spoolss_GetForm tmp;
5040         TALLOC_CTX *out_mem_ctx;
5041         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
5042 };
5043
5044 static void rpccli_spoolss_GetForm_done(struct tevent_req *subreq);
5045
5046 struct tevent_req *rpccli_spoolss_GetForm_send(TALLOC_CTX *mem_ctx,
5047                                                struct tevent_context *ev,
5048                                                struct rpc_pipe_client *cli,
5049                                                struct policy_handle *_handle /* [in] [ref] */,
5050                                                const char *_form_name /* [in] [charset(UTF16)] */,
5051                                                uint32_t _level /* [in]  */,
5052                                                DATA_BLOB *_buffer /* [in] [unique] */,
5053                                                uint32_t _offered /* [in]  */,
5054                                                union spoolss_FormInfo *_info /* [out] [unique,subcontext_size(offered),subcontext(4),switch_is(level)] */,
5055                                                uint32_t *_needed /* [out] [ref] */)
5056 {
5057         struct tevent_req *req;
5058         struct rpccli_spoolss_GetForm_state *state;
5059         struct tevent_req *subreq;
5060
5061         req = tevent_req_create(mem_ctx, &state,
5062                                 struct rpccli_spoolss_GetForm_state);
5063         if (req == NULL) {
5064                 return NULL;
5065         }
5066         state->out_mem_ctx = NULL;
5067         state->dispatch_recv = cli->dispatch_recv;
5068
5069         /* In parameters */
5070         state->orig.in.handle = _handle;
5071         state->orig.in.form_name = _form_name;
5072         state->orig.in.level = _level;
5073         state->orig.in.buffer = _buffer;
5074         state->orig.in.offered = _offered;
5075
5076         /* Out parameters */
5077         state->orig.out.info = _info;
5078         state->orig.out.needed = _needed;
5079
5080         /* Result */
5081         ZERO_STRUCT(state->orig.out.result);
5082
5083         state->out_mem_ctx = talloc_named_const(state, 0,
5084                              "rpccli_spoolss_GetForm_out_memory");
5085         if (tevent_req_nomem(state->out_mem_ctx, req)) {
5086                 return tevent_req_post(req, ev);
5087         }
5088
5089         /* make a temporary copy, that we pass to the dispatch function */
5090         state->tmp = state->orig;
5091
5092         subreq = cli->dispatch_send(state, ev, cli,
5093                                     &ndr_table_spoolss,
5094                                     NDR_SPOOLSS_GETFORM,
5095                                     &state->tmp);
5096         if (tevent_req_nomem(subreq, req)) {
5097                 return tevent_req_post(req, ev);
5098         }
5099         tevent_req_set_callback(subreq, rpccli_spoolss_GetForm_done, req);
5100         return req;
5101 }
5102
5103 static void rpccli_spoolss_GetForm_done(struct tevent_req *subreq)
5104 {
5105         struct tevent_req *req = tevent_req_callback_data(
5106                 subreq, struct tevent_req);
5107         struct rpccli_spoolss_GetForm_state *state = tevent_req_data(
5108                 req, struct rpccli_spoolss_GetForm_state);
5109         NTSTATUS status;
5110         TALLOC_CTX *mem_ctx;
5111
5112         if (state->out_mem_ctx) {
5113                 mem_ctx = state->out_mem_ctx;
5114         } else {
5115                 mem_ctx = state;
5116         }
5117
5118         status = state->dispatch_recv(subreq, mem_ctx);
5119         TALLOC_FREE(subreq);
5120         if (!NT_STATUS_IS_OK(status)) {
5121                 tevent_req_nterror(req, status);
5122                 return;
5123         }
5124
5125         /* Copy out parameters */
5126         if (state->orig.out.info && state->tmp.out.info) {
5127                 *state->orig.out.info = *state->tmp.out.info;
5128         }
5129         *state->orig.out.needed = *state->tmp.out.needed;
5130
5131         /* Copy result */
5132         state->orig.out.result = state->tmp.out.result;
5133
5134         /* Reset temporary structure */
5135         ZERO_STRUCT(state->tmp);
5136
5137         tevent_req_done(req);
5138 }
5139
5140 NTSTATUS rpccli_spoolss_GetForm_recv(struct tevent_req *req,
5141                                      TALLOC_CTX *mem_ctx,
5142                                      WERROR *result)
5143 {
5144         struct rpccli_spoolss_GetForm_state *state = tevent_req_data(
5145                 req, struct rpccli_spoolss_GetForm_state);
5146         NTSTATUS status;
5147
5148         if (tevent_req_is_nterror(req, &status)) {
5149                 tevent_req_received(req);
5150                 return status;
5151         }
5152
5153         /* Steal possbile out parameters to the callers context */
5154         talloc_steal(mem_ctx, state->out_mem_ctx);
5155
5156         /* Return result */
5157         *result = state->orig.out.result;
5158
5159         tevent_req_received(req);
5160         return NT_STATUS_OK;
5161 }
5162
5163 NTSTATUS rpccli_spoolss_GetForm(struct rpc_pipe_client *cli,
5164                                 TALLOC_CTX *mem_ctx,
5165                                 struct policy_handle *handle /* [in] [ref] */,
5166                                 const char *form_name /* [in] [charset(UTF16)] */,
5167                                 uint32_t level /* [in]  */,
5168                                 DATA_BLOB *buffer /* [in] [unique] */,
5169                                 uint32_t offered /* [in]  */,
5170                                 union spoolss_FormInfo *info /* [out] [unique,subcontext_size(offered),subcontext(4),switch_is(level)] */,
5171                                 uint32_t *needed /* [out] [ref] */,
5172                                 WERROR *werror)
5173 {
5174         struct spoolss_GetForm r;
5175         NTSTATUS status;
5176
5177         /* In parameters */
5178         r.in.handle = handle;
5179         r.in.form_name = form_name;
5180         r.in.level = level;
5181         r.in.buffer = buffer;
5182         r.in.offered = offered;
5183
5184         status = cli->dispatch(cli,
5185                                 mem_ctx,
5186                                 &ndr_table_spoolss,
5187                                 NDR_SPOOLSS_GETFORM,
5188                                 &r);
5189
5190         if (!NT_STATUS_IS_OK(status)) {
5191                 return status;
5192         }
5193
5194         if (NT_STATUS_IS_ERR(status)) {
5195                 return status;
5196         }
5197
5198         /* Return variables */
5199         if (info && r.out.info) {
5200                 *info = *r.out.info;
5201         }
5202         *needed = *r.out.needed;
5203
5204         /* Return result */
5205         if (werror) {
5206                 *werror = r.out.result;
5207         }
5208
5209         return werror_to_ntstatus(r.out.result);
5210 }
5211
5212 struct rpccli_spoolss_SetForm_state {
5213         struct spoolss_SetForm orig;
5214         struct spoolss_SetForm tmp;
5215         TALLOC_CTX *out_mem_ctx;
5216         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
5217 };
5218
5219 static void rpccli_spoolss_SetForm_done(struct tevent_req *subreq);
5220
5221 struct tevent_req *rpccli_spoolss_SetForm_send(TALLOC_CTX *mem_ctx,
5222                                                struct tevent_context *ev,
5223                                                struct rpc_pipe_client *cli,
5224                                                struct policy_handle *_handle /* [in] [ref] */,
5225                                                const char *_form_name /* [in] [charset(UTF16)] */,
5226                                                uint32_t _level /* [in]  */,
5227                                                union spoolss_AddFormInfo _info /* [in] [switch_is(level)] */)
5228 {
5229         struct tevent_req *req;
5230         struct rpccli_spoolss_SetForm_state *state;
5231         struct tevent_req *subreq;
5232
5233         req = tevent_req_create(mem_ctx, &state,
5234                                 struct rpccli_spoolss_SetForm_state);
5235         if (req == NULL) {
5236                 return NULL;
5237         }
5238         state->out_mem_ctx = NULL;
5239         state->dispatch_recv = cli->dispatch_recv;
5240
5241         /* In parameters */
5242         state->orig.in.handle = _handle;
5243         state->orig.in.form_name = _form_name;
5244         state->orig.in.level = _level;
5245         state->orig.in.info = _info;
5246
5247         /* Out parameters */
5248
5249         /* Result */
5250         ZERO_STRUCT(state->orig.out.result);
5251
5252         /* make a temporary copy, that we pass to the dispatch function */
5253         state->tmp = state->orig;
5254
5255         subreq = cli->dispatch_send(state, ev, cli,
5256                                     &ndr_table_spoolss,
5257                                     NDR_SPOOLSS_SETFORM,
5258                                     &state->tmp);
5259         if (tevent_req_nomem(subreq, req)) {
5260                 return tevent_req_post(req, ev);
5261         }
5262         tevent_req_set_callback(subreq, rpccli_spoolss_SetForm_done, req);
5263         return req;
5264 }
5265
5266 static void rpccli_spoolss_SetForm_done(struct tevent_req *subreq)
5267 {
5268         struct tevent_req *req = tevent_req_callback_data(
5269                 subreq, struct tevent_req);
5270         struct rpccli_spoolss_SetForm_state *state = tevent_req_data(
5271                 req, struct rpccli_spoolss_SetForm_state);
5272         NTSTATUS status;
5273         TALLOC_CTX *mem_ctx;
5274
5275         if (state->out_mem_ctx) {
5276                 mem_ctx = state->out_mem_ctx;
5277         } else {
5278                 mem_ctx = state;
5279         }
5280
5281         status = state->dispatch_recv(subreq, mem_ctx);
5282         TALLOC_FREE(subreq);
5283         if (!NT_STATUS_IS_OK(status)) {
5284                 tevent_req_nterror(req, status);
5285                 return;
5286         }
5287
5288         /* Copy out parameters */
5289
5290         /* Copy result */
5291         state->orig.out.result = state->tmp.out.result;
5292
5293         /* Reset temporary structure */
5294         ZERO_STRUCT(state->tmp);
5295
5296         tevent_req_done(req);
5297 }
5298
5299 NTSTATUS rpccli_spoolss_SetForm_recv(struct tevent_req *req,
5300                                      TALLOC_CTX *mem_ctx,
5301                                      WERROR *result)
5302 {
5303         struct rpccli_spoolss_SetForm_state *state = tevent_req_data(
5304                 req, struct rpccli_spoolss_SetForm_state);
5305         NTSTATUS status;
5306
5307         if (tevent_req_is_nterror(req, &status)) {
5308                 tevent_req_received(req);
5309                 return status;
5310         }
5311
5312         /* Steal possbile out parameters to the callers context */
5313         talloc_steal(mem_ctx, state->out_mem_ctx);
5314
5315         /* Return result */
5316         *result = state->orig.out.result;
5317
5318         tevent_req_received(req);
5319         return NT_STATUS_OK;
5320 }
5321
5322 NTSTATUS rpccli_spoolss_SetForm(struct rpc_pipe_client *cli,
5323                                 TALLOC_CTX *mem_ctx,
5324                                 struct policy_handle *handle /* [in] [ref] */,
5325                                 const char *form_name /* [in] [charset(UTF16)] */,
5326                                 uint32_t level /* [in]  */,
5327                                 union spoolss_AddFormInfo info /* [in] [switch_is(level)] */,
5328                                 WERROR *werror)
5329 {
5330         struct spoolss_SetForm r;
5331         NTSTATUS status;
5332
5333         /* In parameters */
5334         r.in.handle = handle;
5335         r.in.form_name = form_name;
5336         r.in.level = level;
5337         r.in.info = info;
5338
5339         status = cli->dispatch(cli,
5340                                 mem_ctx,
5341                                 &ndr_table_spoolss,
5342                                 NDR_SPOOLSS_SETFORM,
5343                                 &r);
5344
5345         if (!NT_STATUS_IS_OK(status)) {
5346                 return status;
5347         }
5348
5349         if (NT_STATUS_IS_ERR(status)) {
5350                 return status;
5351         }
5352
5353         /* Return variables */
5354
5355         /* Return result */
5356         if (werror) {
5357                 *werror = r.out.result;
5358         }
5359
5360         return werror_to_ntstatus(r.out.result);
5361 }
5362
5363 struct rpccli_spoolss_EnumForms_state {
5364         struct spoolss_EnumForms orig;
5365         struct spoolss_EnumForms tmp;
5366         TALLOC_CTX *out_mem_ctx;
5367         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
5368 };
5369
5370 static void rpccli_spoolss_EnumForms_done(struct tevent_req *subreq);
5371
5372 struct tevent_req *rpccli_spoolss_EnumForms_send(TALLOC_CTX *mem_ctx,
5373                                                  struct tevent_context *ev,
5374                                                  struct rpc_pipe_client *cli,
5375                                                  struct policy_handle *_handle /* [in] [ref] */,
5376                                                  uint32_t _level /* [in]  */,
5377                                                  DATA_BLOB *_buffer /* [in] [unique] */,
5378                                                  uint32_t _offered /* [in]  */,
5379                                                  uint32_t *_count /* [out] [ref] */,
5380                                                  union spoolss_FormInfo **_info /* [out] [ref,switch_is(level),size_is(,*count)] */,
5381                                                  uint32_t *_needed /* [out] [ref] */)
5382 {
5383         struct tevent_req *req;
5384         struct rpccli_spoolss_EnumForms_state *state;
5385         struct tevent_req *subreq;
5386
5387         req = tevent_req_create(mem_ctx, &state,
5388                                 struct rpccli_spoolss_EnumForms_state);
5389         if (req == NULL) {
5390                 return NULL;
5391         }
5392         state->out_mem_ctx = NULL;
5393         state->dispatch_recv = cli->dispatch_recv;
5394
5395         /* In parameters */
5396         state->orig.in.handle = _handle;
5397         state->orig.in.level = _level;
5398         state->orig.in.buffer = _buffer;
5399         state->orig.in.offered = _offered;
5400
5401         /* Out parameters */
5402         state->orig.out.count = _count;
5403         state->orig.out.info = _info;
5404         state->orig.out.needed = _needed;
5405
5406         /* Result */
5407         ZERO_STRUCT(state->orig.out.result);
5408
5409         state->out_mem_ctx = talloc_named_const(state, 0,
5410                              "rpccli_spoolss_EnumForms_out_memory");
5411         if (tevent_req_nomem(state->out_mem_ctx, req)) {
5412                 return tevent_req_post(req, ev);
5413         }
5414
5415         /* make a temporary copy, that we pass to the dispatch function */
5416         state->tmp = state->orig;
5417
5418         subreq = cli->dispatch_send(state, ev, cli,
5419                                     &ndr_table_spoolss,
5420                                     NDR_SPOOLSS_ENUMFORMS,
5421                                     &state->tmp);
5422         if (tevent_req_nomem(subreq, req)) {
5423                 return tevent_req_post(req, ev);
5424         }
5425         tevent_req_set_callback(subreq, rpccli_spoolss_EnumForms_done, req);
5426         return req;
5427 }
5428
5429 static void rpccli_spoolss_EnumForms_done(struct tevent_req *subreq)
5430 {
5431         struct tevent_req *req = tevent_req_callback_data(
5432                 subreq, struct tevent_req);
5433         struct rpccli_spoolss_EnumForms_state *state = tevent_req_data(
5434                 req, struct rpccli_spoolss_EnumForms_state);
5435         NTSTATUS status;
5436         TALLOC_CTX *mem_ctx;
5437
5438         if (state->out_mem_ctx) {
5439                 mem_ctx = state->out_mem_ctx;
5440         } else {
5441                 mem_ctx = state;
5442         }
5443
5444         status = state->dispatch_recv(subreq, mem_ctx);
5445         TALLOC_FREE(subreq);
5446         if (!NT_STATUS_IS_OK(status)) {
5447                 tevent_req_nterror(req, status);
5448                 return;
5449         }
5450
5451         /* Copy out parameters */
5452         *state->orig.out.count = *state->tmp.out.count;
5453         *state->orig.out.info = *state->tmp.out.info;
5454         *state->orig.out.needed = *state->tmp.out.needed;
5455
5456         /* Copy result */
5457         state->orig.out.result = state->tmp.out.result;
5458
5459         /* Reset temporary structure */
5460         ZERO_STRUCT(state->tmp);
5461
5462         tevent_req_done(req);
5463 }
5464
5465 NTSTATUS rpccli_spoolss_EnumForms_recv(struct tevent_req *req,
5466                                        TALLOC_CTX *mem_ctx,
5467                                        WERROR *result)
5468 {
5469         struct rpccli_spoolss_EnumForms_state *state = tevent_req_data(
5470                 req, struct rpccli_spoolss_EnumForms_state);
5471         NTSTATUS status;
5472
5473         if (tevent_req_is_nterror(req, &status)) {
5474                 tevent_req_received(req);
5475                 return status;
5476         }
5477
5478         /* Steal possbile out parameters to the callers context */
5479         talloc_steal(mem_ctx, state->out_mem_ctx);
5480
5481         /* Return result */
5482         *result = state->orig.out.result;
5483
5484         tevent_req_received(req);
5485         return NT_STATUS_OK;
5486 }
5487
5488 NTSTATUS rpccli_spoolss_EnumForms(struct rpc_pipe_client *cli,
5489                                   TALLOC_CTX *mem_ctx,
5490                                   struct policy_handle *handle /* [in] [ref] */,
5491                                   uint32_t level /* [in]  */,
5492                                   DATA_BLOB *buffer /* [in] [unique] */,
5493                                   uint32_t offered /* [in]  */,
5494                                   uint32_t *count /* [out] [ref] */,
5495                                   union spoolss_FormInfo **info /* [out] [ref,switch_is(level),size_is(,*count)] */,
5496                                   uint32_t *needed /* [out] [ref] */,
5497                                   WERROR *werror)
5498 {
5499         struct spoolss_EnumForms r;
5500         NTSTATUS status;
5501
5502         /* In parameters */
5503         r.in.handle = handle;
5504         r.in.level = level;
5505         r.in.buffer = buffer;
5506         r.in.offered = offered;
5507
5508         status = cli->dispatch(cli,
5509                                 mem_ctx,
5510                                 &ndr_table_spoolss,
5511                                 NDR_SPOOLSS_ENUMFORMS,
5512                                 &r);
5513
5514         if (!NT_STATUS_IS_OK(status)) {
5515                 return status;
5516         }
5517
5518         if (NT_STATUS_IS_ERR(status)) {
5519                 return status;
5520         }
5521
5522         /* Return variables */
5523         *count = *r.out.count;
5524         *info = *r.out.info;
5525         *needed = *r.out.needed;
5526
5527         /* Return result */
5528         if (werror) {
5529                 *werror = r.out.result;
5530         }
5531
5532         return werror_to_ntstatus(r.out.result);
5533 }
5534
5535 struct rpccli_spoolss_EnumPorts_state {
5536         struct spoolss_EnumPorts orig;
5537         struct spoolss_EnumPorts tmp;
5538         TALLOC_CTX *out_mem_ctx;
5539         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
5540 };
5541
5542 static void rpccli_spoolss_EnumPorts_done(struct tevent_req *subreq);
5543
5544 struct tevent_req *rpccli_spoolss_EnumPorts_send(TALLOC_CTX *mem_ctx,
5545                                                  struct tevent_context *ev,
5546                                                  struct rpc_pipe_client *cli,
5547                                                  const char *_servername /* [in] [unique,charset(UTF16)] */,
5548                                                  uint32_t _level /* [in]  */,
5549                                                  DATA_BLOB *_buffer /* [in] [unique] */,
5550                                                  uint32_t _offered /* [in]  */,
5551                                                  uint32_t *_count /* [out] [ref] */,
5552                                                  union spoolss_PortInfo **_info /* [out] [ref,switch_is(level),size_is(,*count)] */,
5553                                                  uint32_t *_needed /* [out] [ref] */)
5554 {
5555         struct tevent_req *req;
5556         struct rpccli_spoolss_EnumPorts_state *state;
5557         struct tevent_req *subreq;
5558
5559         req = tevent_req_create(mem_ctx, &state,
5560                                 struct rpccli_spoolss_EnumPorts_state);
5561         if (req == NULL) {
5562                 return NULL;
5563         }
5564         state->out_mem_ctx = NULL;
5565         state->dispatch_recv = cli->dispatch_recv;
5566
5567         /* In parameters */
5568         state->orig.in.servername = _servername;
5569         state->orig.in.level = _level;
5570         state->orig.in.buffer = _buffer;
5571         state->orig.in.offered = _offered;
5572
5573         /* Out parameters */
5574         state->orig.out.count = _count;
5575         state->orig.out.info = _info;
5576         state->orig.out.needed = _needed;
5577
5578         /* Result */
5579         ZERO_STRUCT(state->orig.out.result);
5580
5581         state->out_mem_ctx = talloc_named_const(state, 0,
5582                              "rpccli_spoolss_EnumPorts_out_memory");
5583         if (tevent_req_nomem(state->out_mem_ctx, req)) {
5584                 return tevent_req_post(req, ev);
5585         }
5586
5587         /* make a temporary copy, that we pass to the dispatch function */
5588         state->tmp = state->orig;
5589
5590         subreq = cli->dispatch_send(state, ev, cli,
5591                                     &ndr_table_spoolss,
5592                                     NDR_SPOOLSS_ENUMPORTS,
5593                                     &state->tmp);
5594         if (tevent_req_nomem(subreq, req)) {
5595                 return tevent_req_post(req, ev);
5596         }
5597         tevent_req_set_callback(subreq, rpccli_spoolss_EnumPorts_done, req);
5598         return req;
5599 }
5600
5601 static void rpccli_spoolss_EnumPorts_done(struct tevent_req *subreq)
5602 {
5603         struct tevent_req *req = tevent_req_callback_data(
5604                 subreq, struct tevent_req);
5605         struct rpccli_spoolss_EnumPorts_state *state = tevent_req_data(
5606                 req, struct rpccli_spoolss_EnumPorts_state);
5607         NTSTATUS status;
5608         TALLOC_CTX *mem_ctx;
5609
5610         if (state->out_mem_ctx) {
5611                 mem_ctx = state->out_mem_ctx;
5612         } else {
5613                 mem_ctx = state;
5614         }
5615
5616         status = state->dispatch_recv(subreq, mem_ctx);
5617         TALLOC_FREE(subreq);
5618         if (!NT_STATUS_IS_OK(status)) {
5619                 tevent_req_nterror(req, status);
5620                 return;
5621         }
5622
5623         /* Copy out parameters */
5624         *state->orig.out.count = *state->tmp.out.count;
5625         *state->orig.out.info = *state->tmp.out.info;
5626         *state->orig.out.needed = *state->tmp.out.needed;
5627
5628         /* Copy result */
5629         state->orig.out.result = state->tmp.out.result;
5630
5631         /* Reset temporary structure */
5632         ZERO_STRUCT(state->tmp);
5633
5634         tevent_req_done(req);
5635 }
5636
5637 NTSTATUS rpccli_spoolss_EnumPorts_recv(struct tevent_req *req,
5638                                        TALLOC_CTX *mem_ctx,
5639                                        WERROR *result)
5640 {
5641         struct rpccli_spoolss_EnumPorts_state *state = tevent_req_data(
5642                 req, struct rpccli_spoolss_EnumPorts_state);
5643         NTSTATUS status;
5644
5645         if (tevent_req_is_nterror(req, &status)) {
5646                 tevent_req_received(req);
5647                 return status;
5648         }
5649
5650         /* Steal possbile out parameters to the callers context */
5651         talloc_steal(mem_ctx, state->out_mem_ctx);
5652
5653         /* Return result */
5654         *result = state->orig.out.result;
5655
5656         tevent_req_received(req);
5657         return NT_STATUS_OK;
5658 }
5659
5660 NTSTATUS rpccli_spoolss_EnumPorts(struct rpc_pipe_client *cli,
5661                                   TALLOC_CTX *mem_ctx,
5662                                   const char *servername /* [in] [unique,charset(UTF16)] */,
5663                                   uint32_t level /* [in]  */,
5664                                   DATA_BLOB *buffer /* [in] [unique] */,
5665                                   uint32_t offered /* [in]  */,
5666                                   uint32_t *count /* [out] [ref] */,
5667                                   union spoolss_PortInfo **info /* [out] [ref,switch_is(level),size_is(,*count)] */,
5668                                   uint32_t *needed /* [out] [ref] */,
5669                                   WERROR *werror)
5670 {
5671         struct spoolss_EnumPorts r;
5672         NTSTATUS status;
5673
5674         /* In parameters */
5675         r.in.servername = servername;
5676         r.in.level = level;
5677         r.in.buffer = buffer;
5678         r.in.offered = offered;
5679
5680         status = cli->dispatch(cli,
5681                                 mem_ctx,
5682                                 &ndr_table_spoolss,
5683                                 NDR_SPOOLSS_ENUMPORTS,
5684                                 &r);
5685
5686         if (!NT_STATUS_IS_OK(status)) {
5687                 return status;
5688         }
5689
5690         if (NT_STATUS_IS_ERR(status)) {
5691                 return status;
5692         }
5693
5694         /* Return variables */
5695         *count = *r.out.count;
5696         *info = *r.out.info;
5697         *needed = *r.out.needed;
5698
5699         /* Return result */
5700         if (werror) {
5701                 *werror = r.out.result;
5702         }
5703
5704         return werror_to_ntstatus(r.out.result);
5705 }
5706
5707 struct rpccli_spoolss_EnumMonitors_state {
5708         struct spoolss_EnumMonitors orig;
5709         struct spoolss_EnumMonitors tmp;
5710         TALLOC_CTX *out_mem_ctx;
5711         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
5712 };
5713
5714 static void rpccli_spoolss_EnumMonitors_done(struct tevent_req *subreq);
5715
5716 struct tevent_req *rpccli_spoolss_EnumMonitors_send(TALLOC_CTX *mem_ctx,
5717                                                     struct tevent_context *ev,
5718                                                     struct rpc_pipe_client *cli,
5719                                                     const char *_servername /* [in] [unique,charset(UTF16)] */,
5720                                                     uint32_t _level /* [in]  */,
5721                                                     DATA_BLOB *_buffer /* [in] [unique] */,
5722                                                     uint32_t _offered /* [in]  */,
5723                                                     uint32_t *_count /* [out] [ref] */,
5724                                                     union spoolss_MonitorInfo **_info /* [out] [ref,switch_is(level),size_is(,*count)] */,
5725                                                     uint32_t *_needed /* [out] [ref] */)
5726 {
5727         struct tevent_req *req;
5728         struct rpccli_spoolss_EnumMonitors_state *state;
5729         struct tevent_req *subreq;
5730
5731         req = tevent_req_create(mem_ctx, &state,
5732                                 struct rpccli_spoolss_EnumMonitors_state);
5733         if (req == NULL) {
5734                 return NULL;
5735         }
5736         state->out_mem_ctx = NULL;
5737         state->dispatch_recv = cli->dispatch_recv;
5738
5739         /* In parameters */
5740         state->orig.in.servername = _servername;
5741         state->orig.in.level = _level;
5742         state->orig.in.buffer = _buffer;
5743         state->orig.in.offered = _offered;
5744
5745         /* Out parameters */
5746         state->orig.out.count = _count;
5747         state->orig.out.info = _info;
5748         state->orig.out.needed = _needed;
5749
5750         /* Result */
5751         ZERO_STRUCT(state->orig.out.result);
5752
5753         state->out_mem_ctx = talloc_named_const(state, 0,
5754                              "rpccli_spoolss_EnumMonitors_out_memory");
5755         if (tevent_req_nomem(state->out_mem_ctx, req)) {
5756                 return tevent_req_post(req, ev);
5757         }
5758
5759         /* make a temporary copy, that we pass to the dispatch function */
5760         state->tmp = state->orig;
5761
5762         subreq = cli->dispatch_send(state, ev, cli,
5763                                     &ndr_table_spoolss,
5764                                     NDR_SPOOLSS_ENUMMONITORS,
5765                                     &state->tmp);
5766         if (tevent_req_nomem(subreq, req)) {
5767                 return tevent_req_post(req, ev);
5768         }
5769         tevent_req_set_callback(subreq, rpccli_spoolss_EnumMonitors_done, req);
5770         return req;
5771 }
5772
5773 static void rpccli_spoolss_EnumMonitors_done(struct tevent_req *subreq)
5774 {
5775         struct tevent_req *req = tevent_req_callback_data(
5776                 subreq, struct tevent_req);
5777         struct rpccli_spoolss_EnumMonitors_state *state = tevent_req_data(
5778                 req, struct rpccli_spoolss_EnumMonitors_state);
5779         NTSTATUS status;
5780         TALLOC_CTX *mem_ctx;
5781
5782         if (state->out_mem_ctx) {
5783                 mem_ctx = state->out_mem_ctx;
5784         } else {
5785                 mem_ctx = state;
5786         }
5787
5788         status = state->dispatch_recv(subreq, mem_ctx);
5789         TALLOC_FREE(subreq);
5790         if (!NT_STATUS_IS_OK(status)) {
5791                 tevent_req_nterror(req, status);
5792                 return;
5793         }
5794
5795         /* Copy out parameters */
5796         *state->orig.out.count = *state->tmp.out.count;
5797         *state->orig.out.info = *state->tmp.out.info;
5798         *state->orig.out.needed = *state->tmp.out.needed;
5799
5800         /* Copy result */
5801         state->orig.out.result = state->tmp.out.result;
5802
5803         /* Reset temporary structure */
5804         ZERO_STRUCT(state->tmp);
5805
5806         tevent_req_done(req);
5807 }
5808
5809 NTSTATUS rpccli_spoolss_EnumMonitors_recv(struct tevent_req *req,
5810                                           TALLOC_CTX *mem_ctx,
5811                                           WERROR *result)
5812 {
5813         struct rpccli_spoolss_EnumMonitors_state *state = tevent_req_data(
5814                 req, struct rpccli_spoolss_EnumMonitors_state);
5815         NTSTATUS status;
5816
5817         if (tevent_req_is_nterror(req, &status)) {
5818                 tevent_req_received(req);
5819                 return status;
5820         }
5821
5822         /* Steal possbile out parameters to the callers context */
5823         talloc_steal(mem_ctx, state->out_mem_ctx);
5824
5825         /* Return result */
5826         *result = state->orig.out.result;
5827
5828         tevent_req_received(req);
5829         return NT_STATUS_OK;
5830 }
5831
5832 NTSTATUS rpccli_spoolss_EnumMonitors(struct rpc_pipe_client *cli,
5833                                      TALLOC_CTX *mem_ctx,
5834                                      const char *servername /* [in] [unique,charset(UTF16)] */,
5835                                      uint32_t level /* [in]  */,
5836                                      DATA_BLOB *buffer /* [in] [unique] */,
5837                                      uint32_t offered /* [in]  */,
5838                                      uint32_t *count /* [out] [ref] */,
5839                                      union spoolss_MonitorInfo **info /* [out] [ref,switch_is(level),size_is(,*count)] */,
5840                                      uint32_t *needed /* [out] [ref] */,
5841                                      WERROR *werror)
5842 {
5843         struct spoolss_EnumMonitors r;
5844         NTSTATUS status;
5845
5846         /* In parameters */
5847         r.in.servername = servername;
5848         r.in.level = level;
5849         r.in.buffer = buffer;
5850         r.in.offered = offered;
5851
5852         status = cli->dispatch(cli,
5853                                 mem_ctx,
5854                                 &ndr_table_spoolss,
5855                                 NDR_SPOOLSS_ENUMMONITORS,
5856                                 &r);
5857
5858         if (!NT_STATUS_IS_OK(status)) {
5859                 return status;
5860         }
5861
5862         if (NT_STATUS_IS_ERR(status)) {
5863                 return status;
5864         }
5865
5866         /* Return variables */
5867         *count = *r.out.count;
5868         *info = *r.out.info;
5869         *needed = *r.out.needed;
5870
5871         /* Return result */
5872         if (werror) {
5873                 *werror = r.out.result;
5874         }
5875
5876         return werror_to_ntstatus(r.out.result);
5877 }
5878
5879 struct rpccli_spoolss_AddPort_state {
5880         struct spoolss_AddPort orig;
5881         struct spoolss_AddPort tmp;
5882         TALLOC_CTX *out_mem_ctx;
5883         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
5884 };
5885
5886 static void rpccli_spoolss_AddPort_done(struct tevent_req *subreq);
5887
5888 struct tevent_req *rpccli_spoolss_AddPort_send(TALLOC_CTX *mem_ctx,
5889                                                struct tevent_context *ev,
5890                                                struct rpc_pipe_client *cli,
5891                                                const char *_server_name /* [in] [unique,charset(UTF16)] */,
5892                                                uint32_t _unknown /* [in]  */,
5893                                                const char *_monitor_name /* [in] [charset(UTF16)] */)
5894 {
5895         struct tevent_req *req;
5896         struct rpccli_spoolss_AddPort_state *state;
5897         struct tevent_req *subreq;
5898
5899         req = tevent_req_create(mem_ctx, &state,
5900                                 struct rpccli_spoolss_AddPort_state);
5901         if (req == NULL) {
5902                 return NULL;
5903         }
5904         state->out_mem_ctx = NULL;
5905         state->dispatch_recv = cli->dispatch_recv;
5906
5907         /* In parameters */
5908         state->orig.in.server_name = _server_name;
5909         state->orig.in.unknown = _unknown;
5910         state->orig.in.monitor_name = _monitor_name;
5911
5912         /* Out parameters */
5913
5914         /* Result */
5915         ZERO_STRUCT(state->orig.out.result);
5916
5917         /* make a temporary copy, that we pass to the dispatch function */
5918         state->tmp = state->orig;
5919
5920         subreq = cli->dispatch_send(state, ev, cli,
5921                                     &ndr_table_spoolss,
5922                                     NDR_SPOOLSS_ADDPORT,
5923                                     &state->tmp);
5924         if (tevent_req_nomem(subreq, req)) {
5925                 return tevent_req_post(req, ev);
5926         }
5927         tevent_req_set_callback(subreq, rpccli_spoolss_AddPort_done, req);
5928         return req;
5929 }
5930
5931 static void rpccli_spoolss_AddPort_done(struct tevent_req *subreq)
5932 {
5933         struct tevent_req *req = tevent_req_callback_data(
5934                 subreq, struct tevent_req);
5935         struct rpccli_spoolss_AddPort_state *state = tevent_req_data(
5936                 req, struct rpccli_spoolss_AddPort_state);
5937         NTSTATUS status;
5938         TALLOC_CTX *mem_ctx;
5939
5940         if (state->out_mem_ctx) {
5941                 mem_ctx = state->out_mem_ctx;
5942         } else {
5943                 mem_ctx = state;
5944         }
5945
5946         status = state->dispatch_recv(subreq, mem_ctx);
5947         TALLOC_FREE(subreq);
5948         if (!NT_STATUS_IS_OK(status)) {
5949                 tevent_req_nterror(req, status);
5950                 return;
5951         }
5952
5953         /* Copy out parameters */
5954
5955         /* Copy result */
5956         state->orig.out.result = state->tmp.out.result;
5957
5958         /* Reset temporary structure */
5959         ZERO_STRUCT(state->tmp);
5960
5961         tevent_req_done(req);
5962 }
5963
5964 NTSTATUS rpccli_spoolss_AddPort_recv(struct tevent_req *req,
5965                                      TALLOC_CTX *mem_ctx,
5966                                      WERROR *result)
5967 {
5968         struct rpccli_spoolss_AddPort_state *state = tevent_req_data(
5969                 req, struct rpccli_spoolss_AddPort_state);
5970         NTSTATUS status;
5971
5972         if (tevent_req_is_nterror(req, &status)) {
5973                 tevent_req_received(req);
5974                 return status;
5975         }
5976
5977         /* Steal possbile out parameters to the callers context */
5978         talloc_steal(mem_ctx, state->out_mem_ctx);
5979
5980         /* Return result */
5981         *result = state->orig.out.result;
5982
5983         tevent_req_received(req);
5984         return NT_STATUS_OK;
5985 }
5986
5987 NTSTATUS rpccli_spoolss_AddPort(struct rpc_pipe_client *cli,
5988                                 TALLOC_CTX *mem_ctx,
5989                                 const char *server_name /* [in] [unique,charset(UTF16)] */,
5990                                 uint32_t unknown /* [in]  */,
5991                                 const char *monitor_name /* [in] [charset(UTF16)] */,
5992                                 WERROR *werror)
5993 {
5994         struct spoolss_AddPort r;
5995         NTSTATUS status;
5996
5997         /* In parameters */
5998         r.in.server_name = server_name;
5999         r.in.unknown = unknown;
6000         r.in.monitor_name = monitor_name;
6001
6002         status = cli->dispatch(cli,
6003                                 mem_ctx,
6004                                 &ndr_table_spoolss,
6005                                 NDR_SPOOLSS_ADDPORT,
6006                                 &r);
6007
6008         if (!NT_STATUS_IS_OK(status)) {
6009                 return status;
6010         }
6011
6012         if (NT_STATUS_IS_ERR(status)) {
6013                 return status;
6014         }
6015
6016         /* Return variables */
6017
6018         /* Return result */
6019         if (werror) {
6020                 *werror = r.out.result;
6021         }
6022
6023         return werror_to_ntstatus(r.out.result);
6024 }
6025
6026 struct rpccli_spoolss_ConfigurePort_state {
6027         struct spoolss_ConfigurePort orig;
6028         struct spoolss_ConfigurePort tmp;
6029         TALLOC_CTX *out_mem_ctx;
6030         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
6031 };
6032
6033 static void rpccli_spoolss_ConfigurePort_done(struct tevent_req *subreq);
6034
6035 struct tevent_req *rpccli_spoolss_ConfigurePort_send(TALLOC_CTX *mem_ctx,
6036                                                      struct tevent_context *ev,
6037                                                      struct rpc_pipe_client *cli)
6038 {
6039         struct tevent_req *req;
6040         struct rpccli_spoolss_ConfigurePort_state *state;
6041         struct tevent_req *subreq;
6042
6043         req = tevent_req_create(mem_ctx, &state,
6044                                 struct rpccli_spoolss_ConfigurePort_state);
6045         if (req == NULL) {
6046                 return NULL;
6047         }
6048         state->out_mem_ctx = NULL;
6049         state->dispatch_recv = cli->dispatch_recv;
6050
6051         /* In parameters */
6052
6053         /* Out parameters */
6054
6055         /* Result */
6056         ZERO_STRUCT(state->orig.out.result);
6057
6058         /* make a temporary copy, that we pass to the dispatch function */
6059         state->tmp = state->orig;
6060
6061         subreq = cli->dispatch_send(state, ev, cli,
6062                                     &ndr_table_spoolss,
6063                                     NDR_SPOOLSS_CONFIGUREPORT,
6064                                     &state->tmp);
6065         if (tevent_req_nomem(subreq, req)) {
6066                 return tevent_req_post(req, ev);
6067         }
6068         tevent_req_set_callback(subreq, rpccli_spoolss_ConfigurePort_done, req);
6069         return req;
6070 }
6071
6072 static void rpccli_spoolss_ConfigurePort_done(struct tevent_req *subreq)
6073 {
6074         struct tevent_req *req = tevent_req_callback_data(
6075                 subreq, struct tevent_req);
6076         struct rpccli_spoolss_ConfigurePort_state *state = tevent_req_data(
6077                 req, struct rpccli_spoolss_ConfigurePort_state);
6078         NTSTATUS status;
6079         TALLOC_CTX *mem_ctx;
6080
6081         if (state->out_mem_ctx) {
6082                 mem_ctx = state->out_mem_ctx;
6083         } else {
6084                 mem_ctx = state;
6085         }
6086
6087         status = state->dispatch_recv(subreq, mem_ctx);
6088         TALLOC_FREE(subreq);
6089         if (!NT_STATUS_IS_OK(status)) {
6090                 tevent_req_nterror(req, status);
6091                 return;
6092         }
6093
6094         /* Copy out parameters */
6095
6096         /* Copy result */
6097         state->orig.out.result = state->tmp.out.result;
6098
6099         /* Reset temporary structure */
6100         ZERO_STRUCT(state->tmp);
6101
6102         tevent_req_done(req);
6103 }
6104
6105 NTSTATUS rpccli_spoolss_ConfigurePort_recv(struct tevent_req *req,
6106                                            TALLOC_CTX *mem_ctx,
6107                                            WERROR *result)
6108 {
6109         struct rpccli_spoolss_ConfigurePort_state *state = tevent_req_data(
6110                 req, struct rpccli_spoolss_ConfigurePort_state);
6111         NTSTATUS status;
6112
6113         if (tevent_req_is_nterror(req, &status)) {
6114                 tevent_req_received(req);
6115                 return status;
6116         }
6117
6118         /* Steal possbile out parameters to the callers context */
6119         talloc_steal(mem_ctx, state->out_mem_ctx);
6120
6121         /* Return result */
6122         *result = state->orig.out.result;
6123
6124         tevent_req_received(req);
6125         return NT_STATUS_OK;
6126 }
6127
6128 NTSTATUS rpccli_spoolss_ConfigurePort(struct rpc_pipe_client *cli,
6129                                       TALLOC_CTX *mem_ctx,
6130                                       WERROR *werror)
6131 {
6132         struct spoolss_ConfigurePort r;
6133         NTSTATUS status;
6134
6135         /* In parameters */
6136
6137         status = cli->dispatch(cli,
6138                                 mem_ctx,
6139                                 &ndr_table_spoolss,
6140                                 NDR_SPOOLSS_CONFIGUREPORT,
6141                                 &r);
6142
6143         if (!NT_STATUS_IS_OK(status)) {
6144                 return status;
6145         }
6146
6147         if (NT_STATUS_IS_ERR(status)) {
6148                 return status;
6149         }
6150
6151         /* Return variables */
6152
6153         /* Return result */
6154         if (werror) {
6155                 *werror = r.out.result;
6156         }
6157
6158         return werror_to_ntstatus(r.out.result);
6159 }
6160
6161 struct rpccli_spoolss_DeletePort_state {
6162         struct spoolss_DeletePort orig;
6163         struct spoolss_DeletePort tmp;
6164         TALLOC_CTX *out_mem_ctx;
6165         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
6166 };
6167
6168 static void rpccli_spoolss_DeletePort_done(struct tevent_req *subreq);
6169
6170 struct tevent_req *rpccli_spoolss_DeletePort_send(TALLOC_CTX *mem_ctx,
6171                                                   struct tevent_context *ev,
6172                                                   struct rpc_pipe_client *cli)
6173 {
6174         struct tevent_req *req;
6175         struct rpccli_spoolss_DeletePort_state *state;
6176         struct tevent_req *subreq;
6177
6178         req = tevent_req_create(mem_ctx, &state,
6179                                 struct rpccli_spoolss_DeletePort_state);
6180         if (req == NULL) {
6181                 return NULL;
6182         }
6183         state->out_mem_ctx = NULL;
6184         state->dispatch_recv = cli->dispatch_recv;
6185
6186         /* In parameters */
6187
6188         /* Out parameters */
6189
6190         /* Result */
6191         ZERO_STRUCT(state->orig.out.result);
6192
6193         /* make a temporary copy, that we pass to the dispatch function */
6194         state->tmp = state->orig;
6195
6196         subreq = cli->dispatch_send(state, ev, cli,
6197                                     &ndr_table_spoolss,
6198                                     NDR_SPOOLSS_DELETEPORT,
6199                                     &state->tmp);
6200         if (tevent_req_nomem(subreq, req)) {
6201                 return tevent_req_post(req, ev);
6202         }
6203         tevent_req_set_callback(subreq, rpccli_spoolss_DeletePort_done, req);
6204         return req;
6205 }
6206
6207 static void rpccli_spoolss_DeletePort_done(struct tevent_req *subreq)
6208 {
6209         struct tevent_req *req = tevent_req_callback_data(
6210                 subreq, struct tevent_req);
6211         struct rpccli_spoolss_DeletePort_state *state = tevent_req_data(
6212                 req, struct rpccli_spoolss_DeletePort_state);
6213         NTSTATUS status;
6214         TALLOC_CTX *mem_ctx;
6215
6216         if (state->out_mem_ctx) {
6217                 mem_ctx = state->out_mem_ctx;
6218         } else {
6219                 mem_ctx = state;
6220         }
6221
6222         status = state->dispatch_recv(subreq, mem_ctx);
6223         TALLOC_FREE(subreq);
6224         if (!NT_STATUS_IS_OK(status)) {
6225                 tevent_req_nterror(req, status);
6226                 return;
6227         }
6228
6229         /* Copy out parameters */
6230
6231         /* Copy result */
6232         state->orig.out.result = state->tmp.out.result;
6233
6234         /* Reset temporary structure */
6235         ZERO_STRUCT(state->tmp);
6236
6237         tevent_req_done(req);
6238 }
6239
6240 NTSTATUS rpccli_spoolss_DeletePort_recv(struct tevent_req *req,
6241                                         TALLOC_CTX *mem_ctx,
6242                                         WERROR *result)
6243 {
6244         struct rpccli_spoolss_DeletePort_state *state = tevent_req_data(
6245                 req, struct rpccli_spoolss_DeletePort_state);
6246         NTSTATUS status;
6247
6248         if (tevent_req_is_nterror(req, &status)) {
6249                 tevent_req_received(req);
6250                 return status;
6251         }
6252
6253         /* Steal possbile out parameters to the callers context */
6254         talloc_steal(mem_ctx, state->out_mem_ctx);
6255
6256         /* Return result */
6257         *result = state->orig.out.result;
6258
6259         tevent_req_received(req);
6260         return NT_STATUS_OK;
6261 }
6262
6263 NTSTATUS rpccli_spoolss_DeletePort(struct rpc_pipe_client *cli,
6264                                    TALLOC_CTX *mem_ctx,
6265                                    WERROR *werror)
6266 {
6267         struct spoolss_DeletePort r;
6268         NTSTATUS status;
6269
6270         /* In parameters */
6271
6272         status = cli->dispatch(cli,
6273                                 mem_ctx,
6274                                 &ndr_table_spoolss,
6275                                 NDR_SPOOLSS_DELETEPORT,
6276                                 &r);
6277
6278         if (!NT_STATUS_IS_OK(status)) {
6279                 return status;
6280         }
6281
6282         if (NT_STATUS_IS_ERR(status)) {
6283                 return status;
6284         }
6285
6286         /* Return variables */
6287
6288         /* Return result */
6289         if (werror) {
6290                 *werror = r.out.result;
6291         }
6292
6293         return werror_to_ntstatus(r.out.result);
6294 }
6295
6296 struct rpccli_spoolss_CreatePrinterIC_state {
6297         struct spoolss_CreatePrinterIC orig;
6298         struct spoolss_CreatePrinterIC tmp;
6299         TALLOC_CTX *out_mem_ctx;
6300         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
6301 };
6302
6303 static void rpccli_spoolss_CreatePrinterIC_done(struct tevent_req *subreq);
6304
6305 struct tevent_req *rpccli_spoolss_CreatePrinterIC_send(TALLOC_CTX *mem_ctx,
6306                                                        struct tevent_context *ev,
6307                                                        struct rpc_pipe_client *cli,
6308                                                        struct policy_handle *_handle /* [in] [ref] */,
6309                                                        struct policy_handle *_gdi_handle /* [out] [ref] */,
6310                                                        struct spoolss_DevmodeContainer *_devmode_ctr /* [in] [ref] */)
6311 {
6312         struct tevent_req *req;
6313         struct rpccli_spoolss_CreatePrinterIC_state *state;
6314         struct tevent_req *subreq;
6315
6316         req = tevent_req_create(mem_ctx, &state,
6317                                 struct rpccli_spoolss_CreatePrinterIC_state);
6318         if (req == NULL) {
6319                 return NULL;
6320         }
6321         state->out_mem_ctx = NULL;
6322         state->dispatch_recv = cli->dispatch_recv;
6323
6324         /* In parameters */
6325         state->orig.in.handle = _handle;
6326         state->orig.in.devmode_ctr = _devmode_ctr;
6327
6328         /* Out parameters */
6329         state->orig.out.gdi_handle = _gdi_handle;
6330
6331         /* Result */
6332         ZERO_STRUCT(state->orig.out.result);
6333
6334         state->out_mem_ctx = talloc_named_const(state, 0,
6335                              "rpccli_spoolss_CreatePrinterIC_out_memory");
6336         if (tevent_req_nomem(state->out_mem_ctx, req)) {
6337                 return tevent_req_post(req, ev);
6338         }
6339
6340         /* make a temporary copy, that we pass to the dispatch function */
6341         state->tmp = state->orig;
6342
6343         subreq = cli->dispatch_send(state, ev, cli,
6344                                     &ndr_table_spoolss,
6345                                     NDR_SPOOLSS_CREATEPRINTERIC,
6346                                     &state->tmp);
6347         if (tevent_req_nomem(subreq, req)) {
6348                 return tevent_req_post(req, ev);
6349         }
6350         tevent_req_set_callback(subreq, rpccli_spoolss_CreatePrinterIC_done, req);
6351         return req;
6352 }
6353
6354 static void rpccli_spoolss_CreatePrinterIC_done(struct tevent_req *subreq)
6355 {
6356         struct tevent_req *req = tevent_req_callback_data(
6357                 subreq, struct tevent_req);
6358         struct rpccli_spoolss_CreatePrinterIC_state *state = tevent_req_data(
6359                 req, struct rpccli_spoolss_CreatePrinterIC_state);
6360         NTSTATUS status;
6361         TALLOC_CTX *mem_ctx;
6362
6363         if (state->out_mem_ctx) {
6364                 mem_ctx = state->out_mem_ctx;
6365         } else {
6366                 mem_ctx = state;
6367         }
6368
6369         status = state->dispatch_recv(subreq, mem_ctx);
6370         TALLOC_FREE(subreq);
6371         if (!NT_STATUS_IS_OK(status)) {
6372                 tevent_req_nterror(req, status);
6373                 return;
6374         }
6375
6376         /* Copy out parameters */
6377         *state->orig.out.gdi_handle = *state->tmp.out.gdi_handle;
6378
6379         /* Copy result */
6380         state->orig.out.result = state->tmp.out.result;
6381
6382         /* Reset temporary structure */
6383         ZERO_STRUCT(state->tmp);
6384
6385         tevent_req_done(req);
6386 }
6387
6388 NTSTATUS rpccli_spoolss_CreatePrinterIC_recv(struct tevent_req *req,
6389                                              TALLOC_CTX *mem_ctx,
6390                                              WERROR *result)
6391 {
6392         struct rpccli_spoolss_CreatePrinterIC_state *state = tevent_req_data(
6393                 req, struct rpccli_spoolss_CreatePrinterIC_state);
6394         NTSTATUS status;
6395
6396         if (tevent_req_is_nterror(req, &status)) {
6397                 tevent_req_received(req);
6398                 return status;
6399         }
6400
6401         /* Steal possbile out parameters to the callers context */
6402         talloc_steal(mem_ctx, state->out_mem_ctx);
6403
6404         /* Return result */
6405         *result = state->orig.out.result;
6406
6407         tevent_req_received(req);
6408         return NT_STATUS_OK;
6409 }
6410
6411 NTSTATUS rpccli_spoolss_CreatePrinterIC(struct rpc_pipe_client *cli,
6412                                         TALLOC_CTX *mem_ctx,
6413                                         struct policy_handle *handle /* [in] [ref] */,
6414                                         struct policy_handle *gdi_handle /* [out] [ref] */,
6415                                         struct spoolss_DevmodeContainer *devmode_ctr /* [in] [ref] */,
6416                                         WERROR *werror)
6417 {
6418         struct spoolss_CreatePrinterIC r;
6419         NTSTATUS status;
6420
6421         /* In parameters */
6422         r.in.handle = handle;
6423         r.in.devmode_ctr = devmode_ctr;
6424
6425         status = cli->dispatch(cli,
6426                                 mem_ctx,
6427                                 &ndr_table_spoolss,
6428                                 NDR_SPOOLSS_CREATEPRINTERIC,
6429                                 &r);
6430
6431         if (!NT_STATUS_IS_OK(status)) {
6432                 return status;
6433         }
6434
6435         if (NT_STATUS_IS_ERR(status)) {
6436                 return status;
6437         }
6438
6439         /* Return variables */
6440         *gdi_handle = *r.out.gdi_handle;
6441
6442         /* Return result */
6443         if (werror) {
6444                 *werror = r.out.result;
6445         }
6446
6447         return werror_to_ntstatus(r.out.result);
6448 }
6449
6450 struct rpccli_spoolss_PlayGDIScriptOnPrinterIC_state {
6451         struct spoolss_PlayGDIScriptOnPrinterIC orig;
6452         struct spoolss_PlayGDIScriptOnPrinterIC tmp;
6453         TALLOC_CTX *out_mem_ctx;
6454         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
6455 };
6456
6457 static void rpccli_spoolss_PlayGDIScriptOnPrinterIC_done(struct tevent_req *subreq);
6458
6459 struct tevent_req *rpccli_spoolss_PlayGDIScriptOnPrinterIC_send(TALLOC_CTX *mem_ctx,
6460                                                                 struct tevent_context *ev,
6461                                                                 struct rpc_pipe_client *cli)
6462 {
6463         struct tevent_req *req;
6464         struct rpccli_spoolss_PlayGDIScriptOnPrinterIC_state *state;
6465         struct tevent_req *subreq;
6466
6467         req = tevent_req_create(mem_ctx, &state,
6468                                 struct rpccli_spoolss_PlayGDIScriptOnPrinterIC_state);
6469         if (req == NULL) {
6470                 return NULL;
6471         }
6472         state->out_mem_ctx = NULL;
6473         state->dispatch_recv = cli->dispatch_recv;
6474
6475         /* In parameters */
6476
6477         /* Out parameters */
6478
6479         /* Result */
6480         ZERO_STRUCT(state->orig.out.result);
6481
6482         /* make a temporary copy, that we pass to the dispatch function */
6483         state->tmp = state->orig;
6484
6485         subreq = cli->dispatch_send(state, ev, cli,
6486                                     &ndr_table_spoolss,
6487                                     NDR_SPOOLSS_PLAYGDISCRIPTONPRINTERIC,
6488                                     &state->tmp);
6489         if (tevent_req_nomem(subreq, req)) {
6490                 return tevent_req_post(req, ev);
6491         }
6492         tevent_req_set_callback(subreq, rpccli_spoolss_PlayGDIScriptOnPrinterIC_done, req);
6493         return req;
6494 }
6495
6496 static void rpccli_spoolss_PlayGDIScriptOnPrinterIC_done(struct tevent_req *subreq)
6497 {
6498         struct tevent_req *req = tevent_req_callback_data(
6499                 subreq, struct tevent_req);
6500         struct rpccli_spoolss_PlayGDIScriptOnPrinterIC_state *state = tevent_req_data(
6501                 req, struct rpccli_spoolss_PlayGDIScriptOnPrinterIC_state);
6502         NTSTATUS status;
6503         TALLOC_CTX *mem_ctx;
6504
6505         if (state->out_mem_ctx) {
6506                 mem_ctx = state->out_mem_ctx;
6507         } else {
6508                 mem_ctx = state;
6509         }
6510
6511         status = state->dispatch_recv(subreq, mem_ctx);
6512         TALLOC_FREE(subreq);
6513         if (!NT_STATUS_IS_OK(status)) {
6514                 tevent_req_nterror(req, status);
6515                 return;
6516         }
6517
6518         /* Copy out parameters */
6519
6520         /* Copy result */
6521         state->orig.out.result = state->tmp.out.result;
6522
6523         /* Reset temporary structure */
6524         ZERO_STRUCT(state->tmp);
6525
6526         tevent_req_done(req);
6527 }
6528
6529 NTSTATUS rpccli_spoolss_PlayGDIScriptOnPrinterIC_recv(struct tevent_req *req,
6530                                                       TALLOC_CTX *mem_ctx,
6531                                                       WERROR *result)
6532 {
6533         struct rpccli_spoolss_PlayGDIScriptOnPrinterIC_state *state = tevent_req_data(
6534                 req, struct rpccli_spoolss_PlayGDIScriptOnPrinterIC_state);
6535         NTSTATUS status;
6536
6537         if (tevent_req_is_nterror(req, &status)) {
6538                 tevent_req_received(req);
6539                 return status;
6540         }
6541
6542         /* Steal possbile out parameters to the callers context */
6543         talloc_steal(mem_ctx, state->out_mem_ctx);
6544
6545         /* Return result */
6546         *result = state->orig.out.result;
6547
6548         tevent_req_received(req);
6549         return NT_STATUS_OK;
6550 }
6551
6552 NTSTATUS rpccli_spoolss_PlayGDIScriptOnPrinterIC(struct rpc_pipe_client *cli,
6553                                                  TALLOC_CTX *mem_ctx,
6554                                                  WERROR *werror)
6555 {
6556         struct spoolss_PlayGDIScriptOnPrinterIC r;
6557         NTSTATUS status;
6558
6559         /* In parameters */
6560
6561         status = cli->dispatch(cli,
6562                                 mem_ctx,
6563                                 &ndr_table_spoolss,
6564                                 NDR_SPOOLSS_PLAYGDISCRIPTONPRINTERIC,
6565                                 &r);
6566
6567         if (!NT_STATUS_IS_OK(status)) {
6568                 return status;
6569         }
6570
6571         if (NT_STATUS_IS_ERR(status)) {
6572                 return status;
6573         }
6574
6575         /* Return variables */
6576
6577         /* Return result */
6578         if (werror) {
6579                 *werror = r.out.result;
6580         }
6581
6582         return werror_to_ntstatus(r.out.result);
6583 }
6584
6585 struct rpccli_spoolss_DeletePrinterIC_state {
6586         struct spoolss_DeletePrinterIC orig;
6587         struct spoolss_DeletePrinterIC tmp;
6588         TALLOC_CTX *out_mem_ctx;
6589         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
6590 };
6591
6592 static void rpccli_spoolss_DeletePrinterIC_done(struct tevent_req *subreq);
6593
6594 struct tevent_req *rpccli_spoolss_DeletePrinterIC_send(TALLOC_CTX *mem_ctx,
6595                                                        struct tevent_context *ev,
6596                                                        struct rpc_pipe_client *cli,
6597                                                        struct policy_handle *_gdi_handle /* [in,out] [ref] */)
6598 {
6599         struct tevent_req *req;
6600         struct rpccli_spoolss_DeletePrinterIC_state *state;
6601         struct tevent_req *subreq;
6602
6603         req = tevent_req_create(mem_ctx, &state,
6604                                 struct rpccli_spoolss_DeletePrinterIC_state);
6605         if (req == NULL) {
6606                 return NULL;
6607         }
6608         state->out_mem_ctx = NULL;
6609         state->dispatch_recv = cli->dispatch_recv;
6610
6611         /* In parameters */
6612         state->orig.in.gdi_handle = _gdi_handle;
6613
6614         /* Out parameters */
6615         state->orig.out.gdi_handle = _gdi_handle;
6616
6617         /* Result */
6618         ZERO_STRUCT(state->orig.out.result);
6619
6620         state->out_mem_ctx = talloc_named_const(state, 0,
6621                              "rpccli_spoolss_DeletePrinterIC_out_memory");
6622         if (tevent_req_nomem(state->out_mem_ctx, req)) {
6623                 return tevent_req_post(req, ev);
6624         }
6625
6626         /* make a temporary copy, that we pass to the dispatch function */
6627         state->tmp = state->orig;
6628
6629         subreq = cli->dispatch_send(state, ev, cli,
6630                                     &ndr_table_spoolss,
6631                                     NDR_SPOOLSS_DELETEPRINTERIC,
6632                                     &state->tmp);
6633         if (tevent_req_nomem(subreq, req)) {
6634                 return tevent_req_post(req, ev);
6635         }
6636         tevent_req_set_callback(subreq, rpccli_spoolss_DeletePrinterIC_done, req);
6637         return req;
6638 }
6639
6640 static void rpccli_spoolss_DeletePrinterIC_done(struct tevent_req *subreq)
6641 {
6642         struct tevent_req *req = tevent_req_callback_data(
6643                 subreq, struct tevent_req);
6644         struct rpccli_spoolss_DeletePrinterIC_state *state = tevent_req_data(
6645                 req, struct rpccli_spoolss_DeletePrinterIC_state);
6646         NTSTATUS status;
6647         TALLOC_CTX *mem_ctx;
6648
6649         if (state->out_mem_ctx) {
6650                 mem_ctx = state->out_mem_ctx;
6651         } else {
6652                 mem_ctx = state;
6653         }
6654
6655         status = state->dispatch_recv(subreq, mem_ctx);
6656         TALLOC_FREE(subreq);
6657         if (!NT_STATUS_IS_OK(status)) {
6658                 tevent_req_nterror(req, status);
6659                 return;
6660         }
6661
6662         /* Copy out parameters */
6663         *state->orig.out.gdi_handle = *state->tmp.out.gdi_handle;
6664
6665         /* Copy result */
6666         state->orig.out.result = state->tmp.out.result;
6667
6668         /* Reset temporary structure */
6669         ZERO_STRUCT(state->tmp);
6670
6671         tevent_req_done(req);
6672 }
6673
6674 NTSTATUS rpccli_spoolss_DeletePrinterIC_recv(struct tevent_req *req,
6675                                              TALLOC_CTX *mem_ctx,
6676                                              WERROR *result)
6677 {
6678         struct rpccli_spoolss_DeletePrinterIC_state *state = tevent_req_data(
6679                 req, struct rpccli_spoolss_DeletePrinterIC_state);
6680         NTSTATUS status;
6681
6682         if (tevent_req_is_nterror(req, &status)) {
6683                 tevent_req_received(req);
6684                 return status;
6685         }
6686
6687         /* Steal possbile out parameters to the callers context */
6688         talloc_steal(mem_ctx, state->out_mem_ctx);
6689
6690         /* Return result */
6691         *result = state->orig.out.result;
6692
6693         tevent_req_received(req);
6694         return NT_STATUS_OK;
6695 }
6696
6697 NTSTATUS rpccli_spoolss_DeletePrinterIC(struct rpc_pipe_client *cli,
6698                                         TALLOC_CTX *mem_ctx,
6699                                         struct policy_handle *gdi_handle /* [in,out] [ref] */,
6700                                         WERROR *werror)
6701 {
6702         struct spoolss_DeletePrinterIC r;
6703         NTSTATUS status;
6704
6705         /* In parameters */
6706         r.in.gdi_handle = gdi_handle;
6707
6708         status = cli->dispatch(cli,
6709                                 mem_ctx,
6710                                 &ndr_table_spoolss,
6711                                 NDR_SPOOLSS_DELETEPRINTERIC,
6712                                 &r);
6713
6714         if (!NT_STATUS_IS_OK(status)) {
6715                 return status;
6716         }
6717
6718         if (NT_STATUS_IS_ERR(status)) {
6719                 return status;
6720         }
6721
6722         /* Return variables */
6723         *gdi_handle = *r.out.gdi_handle;
6724
6725         /* Return result */
6726         if (werror) {
6727                 *werror = r.out.result;
6728         }
6729
6730         return werror_to_ntstatus(r.out.result);
6731 }
6732
6733 struct rpccli_spoolss_AddPrinterConnection_state {
6734         struct spoolss_AddPrinterConnection orig;
6735         struct spoolss_AddPrinterConnection tmp;
6736         TALLOC_CTX *out_mem_ctx;
6737         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
6738 };
6739
6740 static void rpccli_spoolss_AddPrinterConnection_done(struct tevent_req *subreq);
6741
6742 struct tevent_req *rpccli_spoolss_AddPrinterConnection_send(TALLOC_CTX *mem_ctx,
6743                                                             struct tevent_context *ev,
6744                                                             struct rpc_pipe_client *cli)
6745 {
6746         struct tevent_req *req;
6747         struct rpccli_spoolss_AddPrinterConnection_state *state;
6748         struct tevent_req *subreq;
6749
6750         req = tevent_req_create(mem_ctx, &state,
6751                                 struct rpccli_spoolss_AddPrinterConnection_state);
6752         if (req == NULL) {
6753                 return NULL;
6754         }
6755         state->out_mem_ctx = NULL;
6756         state->dispatch_recv = cli->dispatch_recv;
6757
6758         /* In parameters */
6759
6760         /* Out parameters */
6761
6762         /* Result */
6763         ZERO_STRUCT(state->orig.out.result);
6764
6765         /* make a temporary copy, that we pass to the dispatch function */
6766         state->tmp = state->orig;
6767
6768         subreq = cli->dispatch_send(state, ev, cli,
6769                                     &ndr_table_spoolss,
6770                                     NDR_SPOOLSS_ADDPRINTERCONNECTION,
6771                                     &state->tmp);
6772         if (tevent_req_nomem(subreq, req)) {
6773                 return tevent_req_post(req, ev);
6774         }
6775         tevent_req_set_callback(subreq, rpccli_spoolss_AddPrinterConnection_done, req);
6776         return req;
6777 }
6778
6779 static void rpccli_spoolss_AddPrinterConnection_done(struct tevent_req *subreq)
6780 {
6781         struct tevent_req *req = tevent_req_callback_data(
6782                 subreq, struct tevent_req);
6783         struct rpccli_spoolss_AddPrinterConnection_state *state = tevent_req_data(
6784                 req, struct rpccli_spoolss_AddPrinterConnection_state);
6785         NTSTATUS status;
6786         TALLOC_CTX *mem_ctx;
6787
6788         if (state->out_mem_ctx) {
6789                 mem_ctx = state->out_mem_ctx;
6790         } else {
6791                 mem_ctx = state;
6792         }
6793
6794         status = state->dispatch_recv(subreq, mem_ctx);
6795         TALLOC_FREE(subreq);
6796         if (!NT_STATUS_IS_OK(status)) {
6797                 tevent_req_nterror(req, status);
6798                 return;
6799         }
6800
6801         /* Copy out parameters */
6802
6803         /* Copy result */
6804         state->orig.out.result = state->tmp.out.result;
6805
6806         /* Reset temporary structure */
6807         ZERO_STRUCT(state->tmp);
6808
6809         tevent_req_done(req);
6810 }
6811
6812 NTSTATUS rpccli_spoolss_AddPrinterConnection_recv(struct tevent_req *req,
6813                                                   TALLOC_CTX *mem_ctx,
6814                                                   WERROR *result)
6815 {
6816         struct rpccli_spoolss_AddPrinterConnection_state *state = tevent_req_data(
6817                 req, struct rpccli_spoolss_AddPrinterConnection_state);
6818         NTSTATUS status;
6819
6820         if (tevent_req_is_nterror(req, &status)) {
6821                 tevent_req_received(req);
6822                 return status;
6823         }
6824
6825         /* Steal possbile out parameters to the callers context */
6826         talloc_steal(mem_ctx, state->out_mem_ctx);
6827
6828         /* Return result */
6829         *result = state->orig.out.result;
6830
6831         tevent_req_received(req);
6832         return NT_STATUS_OK;
6833 }
6834
6835 NTSTATUS rpccli_spoolss_AddPrinterConnection(struct rpc_pipe_client *cli,
6836                                              TALLOC_CTX *mem_ctx,
6837                                              WERROR *werror)
6838 {
6839         struct spoolss_AddPrinterConnection r;
6840         NTSTATUS status;
6841
6842         /* In parameters */
6843
6844         status = cli->dispatch(cli,
6845                                 mem_ctx,
6846                                 &ndr_table_spoolss,
6847                                 NDR_SPOOLSS_ADDPRINTERCONNECTION,
6848                                 &r);
6849
6850         if (!NT_STATUS_IS_OK(status)) {
6851                 return status;
6852         }
6853
6854         if (NT_STATUS_IS_ERR(status)) {
6855                 return status;
6856         }
6857
6858         /* Return variables */
6859
6860         /* Return result */
6861         if (werror) {
6862                 *werror = r.out.result;
6863         }
6864
6865         return werror_to_ntstatus(r.out.result);
6866 }
6867
6868 struct rpccli_spoolss_DeletePrinterConnection_state {
6869         struct spoolss_DeletePrinterConnection orig;
6870         struct spoolss_DeletePrinterConnection tmp;
6871         TALLOC_CTX *out_mem_ctx;
6872         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
6873 };
6874
6875 static void rpccli_spoolss_DeletePrinterConnection_done(struct tevent_req *subreq);
6876
6877 struct tevent_req *rpccli_spoolss_DeletePrinterConnection_send(TALLOC_CTX *mem_ctx,
6878                                                                struct tevent_context *ev,
6879                                                                struct rpc_pipe_client *cli)
6880 {
6881         struct tevent_req *req;
6882         struct rpccli_spoolss_DeletePrinterConnection_state *state;
6883         struct tevent_req *subreq;
6884
6885         req = tevent_req_create(mem_ctx, &state,
6886                                 struct rpccli_spoolss_DeletePrinterConnection_state);
6887         if (req == NULL) {
6888                 return NULL;
6889         }
6890         state->out_mem_ctx = NULL;
6891         state->dispatch_recv = cli->dispatch_recv;
6892
6893         /* In parameters */
6894
6895         /* Out parameters */
6896
6897         /* Result */
6898         ZERO_STRUCT(state->orig.out.result);
6899
6900         /* make a temporary copy, that we pass to the dispatch function */
6901         state->tmp = state->orig;
6902
6903         subreq = cli->dispatch_send(state, ev, cli,
6904                                     &ndr_table_spoolss,
6905                                     NDR_SPOOLSS_DELETEPRINTERCONNECTION,
6906                                     &state->tmp);
6907         if (tevent_req_nomem(subreq, req)) {
6908                 return tevent_req_post(req, ev);
6909         }
6910         tevent_req_set_callback(subreq, rpccli_spoolss_DeletePrinterConnection_done, req);
6911         return req;
6912 }
6913
6914 static void rpccli_spoolss_DeletePrinterConnection_done(struct tevent_req *subreq)
6915 {
6916         struct tevent_req *req = tevent_req_callback_data(
6917                 subreq, struct tevent_req);
6918         struct rpccli_spoolss_DeletePrinterConnection_state *state = tevent_req_data(
6919                 req, struct rpccli_spoolss_DeletePrinterConnection_state);
6920         NTSTATUS status;
6921         TALLOC_CTX *mem_ctx;
6922
6923         if (state->out_mem_ctx) {
6924                 mem_ctx = state->out_mem_ctx;
6925         } else {
6926                 mem_ctx = state;
6927         }
6928
6929         status = state->dispatch_recv(subreq, mem_ctx);
6930         TALLOC_FREE(subreq);
6931         if (!NT_STATUS_IS_OK(status)) {
6932                 tevent_req_nterror(req, status);
6933                 return;
6934         }
6935
6936         /* Copy out parameters */
6937
6938         /* Copy result */
6939         state->orig.out.result = state->tmp.out.result;
6940
6941         /* Reset temporary structure */
6942         ZERO_STRUCT(state->tmp);
6943
6944         tevent_req_done(req);
6945 }
6946
6947 NTSTATUS rpccli_spoolss_DeletePrinterConnection_recv(struct tevent_req *req,
6948                                                      TALLOC_CTX *mem_ctx,
6949                                                      WERROR *result)
6950 {
6951         struct rpccli_spoolss_DeletePrinterConnection_state *state = tevent_req_data(
6952                 req, struct rpccli_spoolss_DeletePrinterConnection_state);
6953         NTSTATUS status;
6954
6955         if (tevent_req_is_nterror(req, &status)) {
6956                 tevent_req_received(req);
6957                 return status;
6958         }
6959
6960         /* Steal possbile out parameters to the callers context */
6961         talloc_steal(mem_ctx, state->out_mem_ctx);
6962
6963         /* Return result */
6964         *result = state->orig.out.result;
6965
6966         tevent_req_received(req);
6967         return NT_STATUS_OK;
6968 }
6969
6970 NTSTATUS rpccli_spoolss_DeletePrinterConnection(struct rpc_pipe_client *cli,
6971                                                 TALLOC_CTX *mem_ctx,
6972                                                 WERROR *werror)
6973 {
6974         struct spoolss_DeletePrinterConnection r;
6975         NTSTATUS status;
6976
6977         /* In parameters */
6978
6979         status = cli->dispatch(cli,
6980                                 mem_ctx,
6981                                 &ndr_table_spoolss,
6982                                 NDR_SPOOLSS_DELETEPRINTERCONNECTION,
6983                                 &r);
6984
6985         if (!NT_STATUS_IS_OK(status)) {
6986                 return status;
6987         }
6988
6989         if (NT_STATUS_IS_ERR(status)) {
6990                 return status;
6991         }
6992
6993         /* Return variables */
6994
6995         /* Return result */
6996         if (werror) {
6997                 *werror = r.out.result;
6998         }
6999
7000         return werror_to_ntstatus(r.out.result);
7001 }
7002
7003 struct rpccli_spoolss_PrinterMessageBox_state {
7004         struct spoolss_PrinterMessageBox orig;
7005         struct spoolss_PrinterMessageBox tmp;
7006         TALLOC_CTX *out_mem_ctx;
7007         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
7008 };
7009
7010 static void rpccli_spoolss_PrinterMessageBox_done(struct tevent_req *subreq);
7011
7012 struct tevent_req *rpccli_spoolss_PrinterMessageBox_send(TALLOC_CTX *mem_ctx,
7013                                                          struct tevent_context *ev,
7014                                                          struct rpc_pipe_client *cli)
7015 {
7016         struct tevent_req *req;
7017         struct rpccli_spoolss_PrinterMessageBox_state *state;
7018         struct tevent_req *subreq;
7019
7020         req = tevent_req_create(mem_ctx, &state,
7021                                 struct rpccli_spoolss_PrinterMessageBox_state);
7022         if (req == NULL) {
7023                 return NULL;
7024         }
7025         state->out_mem_ctx = NULL;
7026         state->dispatch_recv = cli->dispatch_recv;
7027
7028         /* In parameters */
7029
7030         /* Out parameters */
7031
7032         /* Result */
7033         ZERO_STRUCT(state->orig.out.result);
7034
7035         /* make a temporary copy, that we pass to the dispatch function */
7036         state->tmp = state->orig;
7037
7038         subreq = cli->dispatch_send(state, ev, cli,
7039                                     &ndr_table_spoolss,
7040                                     NDR_SPOOLSS_PRINTERMESSAGEBOX,
7041                                     &state->tmp);
7042         if (tevent_req_nomem(subreq, req)) {
7043                 return tevent_req_post(req, ev);
7044         }
7045         tevent_req_set_callback(subreq, rpccli_spoolss_PrinterMessageBox_done, req);
7046         return req;
7047 }
7048
7049 static void rpccli_spoolss_PrinterMessageBox_done(struct tevent_req *subreq)
7050 {
7051         struct tevent_req *req = tevent_req_callback_data(
7052                 subreq, struct tevent_req);
7053         struct rpccli_spoolss_PrinterMessageBox_state *state = tevent_req_data(
7054                 req, struct rpccli_spoolss_PrinterMessageBox_state);
7055         NTSTATUS status;
7056         TALLOC_CTX *mem_ctx;
7057
7058         if (state->out_mem_ctx) {
7059                 mem_ctx = state->out_mem_ctx;
7060         } else {
7061                 mem_ctx = state;
7062         }
7063
7064         status = state->dispatch_recv(subreq, mem_ctx);
7065         TALLOC_FREE(subreq);
7066         if (!NT_STATUS_IS_OK(status)) {
7067                 tevent_req_nterror(req, status);
7068                 return;
7069         }
7070
7071         /* Copy out parameters */
7072
7073         /* Copy result */
7074         state->orig.out.result = state->tmp.out.result;
7075
7076         /* Reset temporary structure */
7077         ZERO_STRUCT(state->tmp);
7078
7079         tevent_req_done(req);
7080 }
7081
7082 NTSTATUS rpccli_spoolss_PrinterMessageBox_recv(struct tevent_req *req,
7083                                                TALLOC_CTX *mem_ctx,
7084                                                WERROR *result)
7085 {
7086         struct rpccli_spoolss_PrinterMessageBox_state *state = tevent_req_data(
7087                 req, struct rpccli_spoolss_PrinterMessageBox_state);
7088         NTSTATUS status;
7089
7090         if (tevent_req_is_nterror(req, &status)) {
7091                 tevent_req_received(req);
7092                 return status;
7093         }
7094
7095         /* Steal possbile out parameters to the callers context */
7096         talloc_steal(mem_ctx, state->out_mem_ctx);
7097
7098         /* Return result */
7099         *result = state->orig.out.result;
7100
7101         tevent_req_received(req);
7102         return NT_STATUS_OK;
7103 }
7104
7105 NTSTATUS rpccli_spoolss_PrinterMessageBox(struct rpc_pipe_client *cli,
7106                                           TALLOC_CTX *mem_ctx,
7107                                           WERROR *werror)
7108 {
7109         struct spoolss_PrinterMessageBox r;
7110         NTSTATUS status;
7111
7112         /* In parameters */
7113
7114         status = cli->dispatch(cli,
7115                                 mem_ctx,
7116                                 &ndr_table_spoolss,
7117                                 NDR_SPOOLSS_PRINTERMESSAGEBOX,
7118                                 &r);
7119
7120         if (!NT_STATUS_IS_OK(status)) {
7121                 return status;
7122         }
7123
7124         if (NT_STATUS_IS_ERR(status)) {
7125                 return status;
7126         }
7127
7128         /* Return variables */
7129
7130         /* Return result */
7131         if (werror) {
7132                 *werror = r.out.result;
7133         }
7134
7135         return werror_to_ntstatus(r.out.result);
7136 }
7137
7138 struct rpccli_spoolss_AddMonitor_state {
7139         struct spoolss_AddMonitor orig;
7140         struct spoolss_AddMonitor tmp;
7141         TALLOC_CTX *out_mem_ctx;
7142         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
7143 };
7144
7145 static void rpccli_spoolss_AddMonitor_done(struct tevent_req *subreq);
7146
7147 struct tevent_req *rpccli_spoolss_AddMonitor_send(TALLOC_CTX *mem_ctx,
7148                                                   struct tevent_context *ev,
7149                                                   struct rpc_pipe_client *cli)
7150 {
7151         struct tevent_req *req;
7152         struct rpccli_spoolss_AddMonitor_state *state;
7153         struct tevent_req *subreq;
7154
7155         req = tevent_req_create(mem_ctx, &state,
7156                                 struct rpccli_spoolss_AddMonitor_state);
7157         if (req == NULL) {
7158                 return NULL;
7159         }
7160         state->out_mem_ctx = NULL;
7161         state->dispatch_recv = cli->dispatch_recv;
7162
7163         /* In parameters */
7164
7165         /* Out parameters */
7166
7167         /* Result */
7168         ZERO_STRUCT(state->orig.out.result);
7169
7170         /* make a temporary copy, that we pass to the dispatch function */
7171         state->tmp = state->orig;
7172
7173         subreq = cli->dispatch_send(state, ev, cli,
7174                                     &ndr_table_spoolss,
7175                                     NDR_SPOOLSS_ADDMONITOR,
7176                                     &state->tmp);
7177         if (tevent_req_nomem(subreq, req)) {
7178                 return tevent_req_post(req, ev);
7179         }
7180         tevent_req_set_callback(subreq, rpccli_spoolss_AddMonitor_done, req);
7181         return req;
7182 }
7183
7184 static void rpccli_spoolss_AddMonitor_done(struct tevent_req *subreq)
7185 {
7186         struct tevent_req *req = tevent_req_callback_data(
7187                 subreq, struct tevent_req);
7188         struct rpccli_spoolss_AddMonitor_state *state = tevent_req_data(
7189                 req, struct rpccli_spoolss_AddMonitor_state);
7190         NTSTATUS status;
7191         TALLOC_CTX *mem_ctx;
7192
7193         if (state->out_mem_ctx) {
7194                 mem_ctx = state->out_mem_ctx;
7195         } else {
7196                 mem_ctx = state;
7197         }
7198
7199         status = state->dispatch_recv(subreq, mem_ctx);
7200         TALLOC_FREE(subreq);
7201         if (!NT_STATUS_IS_OK(status)) {
7202                 tevent_req_nterror(req, status);
7203                 return;
7204         }
7205
7206         /* Copy out parameters */
7207
7208         /* Copy result */
7209         state->orig.out.result = state->tmp.out.result;
7210
7211         /* Reset temporary structure */
7212         ZERO_STRUCT(state->tmp);
7213
7214         tevent_req_done(req);
7215 }
7216
7217 NTSTATUS rpccli_spoolss_AddMonitor_recv(struct tevent_req *req,
7218                                         TALLOC_CTX *mem_ctx,
7219                                         WERROR *result)
7220 {
7221         struct rpccli_spoolss_AddMonitor_state *state = tevent_req_data(
7222                 req, struct rpccli_spoolss_AddMonitor_state);
7223         NTSTATUS status;
7224
7225         if (tevent_req_is_nterror(req, &status)) {
7226                 tevent_req_received(req);
7227                 return status;
7228         }
7229
7230         /* Steal possbile out parameters to the callers context */
7231         talloc_steal(mem_ctx, state->out_mem_ctx);
7232
7233         /* Return result */
7234         *result = state->orig.out.result;
7235
7236         tevent_req_received(req);
7237         return NT_STATUS_OK;
7238 }
7239
7240 NTSTATUS rpccli_spoolss_AddMonitor(struct rpc_pipe_client *cli,
7241                                    TALLOC_CTX *mem_ctx,
7242                                    WERROR *werror)
7243 {
7244         struct spoolss_AddMonitor r;
7245         NTSTATUS status;
7246
7247         /* In parameters */
7248
7249         status = cli->dispatch(cli,
7250                                 mem_ctx,
7251                                 &ndr_table_spoolss,
7252                                 NDR_SPOOLSS_ADDMONITOR,
7253                                 &r);
7254
7255         if (!NT_STATUS_IS_OK(status)) {
7256                 return status;
7257         }
7258
7259         if (NT_STATUS_IS_ERR(status)) {
7260                 return status;
7261         }
7262
7263         /* Return variables */
7264
7265         /* Return result */
7266         if (werror) {
7267                 *werror = r.out.result;
7268         }
7269
7270         return werror_to_ntstatus(r.out.result);
7271 }
7272
7273 struct rpccli_spoolss_DeleteMonitor_state {
7274         struct spoolss_DeleteMonitor orig;
7275         struct spoolss_DeleteMonitor tmp;
7276         TALLOC_CTX *out_mem_ctx;
7277         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
7278 };
7279
7280 static void rpccli_spoolss_DeleteMonitor_done(struct tevent_req *subreq);
7281
7282 struct tevent_req *rpccli_spoolss_DeleteMonitor_send(TALLOC_CTX *mem_ctx,
7283                                                      struct tevent_context *ev,
7284                                                      struct rpc_pipe_client *cli)
7285 {
7286         struct tevent_req *req;
7287         struct rpccli_spoolss_DeleteMonitor_state *state;
7288         struct tevent_req *subreq;
7289
7290         req = tevent_req_create(mem_ctx, &state,
7291                                 struct rpccli_spoolss_DeleteMonitor_state);
7292         if (req == NULL) {
7293                 return NULL;
7294         }
7295         state->out_mem_ctx = NULL;
7296         state->dispatch_recv = cli->dispatch_recv;
7297
7298         /* In parameters */
7299
7300         /* Out parameters */
7301
7302         /* Result */
7303         ZERO_STRUCT(state->orig.out.result);
7304
7305         /* make a temporary copy, that we pass to the dispatch function */
7306         state->tmp = state->orig;
7307
7308         subreq = cli->dispatch_send(state, ev, cli,
7309                                     &ndr_table_spoolss,
7310                                     NDR_SPOOLSS_DELETEMONITOR,
7311                                     &state->tmp);
7312         if (tevent_req_nomem(subreq, req)) {
7313                 return tevent_req_post(req, ev);
7314         }
7315         tevent_req_set_callback(subreq, rpccli_spoolss_DeleteMonitor_done, req);
7316         return req;
7317 }
7318
7319 static void rpccli_spoolss_DeleteMonitor_done(struct tevent_req *subreq)
7320 {
7321         struct tevent_req *req = tevent_req_callback_data(
7322                 subreq, struct tevent_req);
7323         struct rpccli_spoolss_DeleteMonitor_state *state = tevent_req_data(
7324                 req, struct rpccli_spoolss_DeleteMonitor_state);
7325         NTSTATUS status;
7326         TALLOC_CTX *mem_ctx;
7327
7328         if (state->out_mem_ctx) {
7329                 mem_ctx = state->out_mem_ctx;
7330         } else {
7331                 mem_ctx = state;
7332         }
7333
7334         status = state->dispatch_recv(subreq, mem_ctx);
7335         TALLOC_FREE(subreq);
7336         if (!NT_STATUS_IS_OK(status)) {
7337                 tevent_req_nterror(req, status);
7338                 return;
7339         }
7340
7341         /* Copy out parameters */
7342
7343         /* Copy result */
7344         state->orig.out.result = state->tmp.out.result;
7345
7346         /* Reset temporary structure */
7347         ZERO_STRUCT(state->tmp);
7348
7349         tevent_req_done(req);
7350 }
7351
7352 NTSTATUS rpccli_spoolss_DeleteMonitor_recv(struct tevent_req *req,
7353                                            TALLOC_CTX *mem_ctx,
7354                                            WERROR *result)
7355 {
7356         struct rpccli_spoolss_DeleteMonitor_state *state = tevent_req_data(
7357                 req, struct rpccli_spoolss_DeleteMonitor_state);
7358         NTSTATUS status;
7359
7360         if (tevent_req_is_nterror(req, &status)) {
7361                 tevent_req_received(req);
7362                 return status;
7363         }
7364
7365         /* Steal possbile out parameters to the callers context */
7366         talloc_steal(mem_ctx, state->out_mem_ctx);
7367
7368         /* Return result */
7369         *result = state->orig.out.result;
7370
7371         tevent_req_received(req);
7372         return NT_STATUS_OK;
7373 }
7374
7375 NTSTATUS rpccli_spoolss_DeleteMonitor(struct rpc_pipe_client *cli,
7376                                       TALLOC_CTX *mem_ctx,
7377                                       WERROR *werror)
7378 {
7379         struct spoolss_DeleteMonitor r;
7380         NTSTATUS status;
7381
7382         /* In parameters */
7383
7384         status = cli->dispatch(cli,
7385                                 mem_ctx,
7386                                 &ndr_table_spoolss,
7387                                 NDR_SPOOLSS_DELETEMONITOR,
7388                                 &r);
7389
7390         if (!NT_STATUS_IS_OK(status)) {
7391                 return status;
7392         }
7393
7394         if (NT_STATUS_IS_ERR(status)) {
7395                 return status;
7396         }
7397
7398         /* Return variables */
7399
7400         /* Return result */
7401         if (werror) {
7402                 *werror = r.out.result;
7403         }
7404
7405         return werror_to_ntstatus(r.out.result);
7406 }
7407
7408 struct rpccli_spoolss_DeletePrintProcessor_state {
7409         struct spoolss_DeletePrintProcessor orig;
7410         struct spoolss_DeletePrintProcessor tmp;
7411         TALLOC_CTX *out_mem_ctx;
7412         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
7413 };
7414
7415 static void rpccli_spoolss_DeletePrintProcessor_done(struct tevent_req *subreq);
7416
7417 struct tevent_req *rpccli_spoolss_DeletePrintProcessor_send(TALLOC_CTX *mem_ctx,
7418                                                             struct tevent_context *ev,
7419                                                             struct rpc_pipe_client *cli)
7420 {
7421         struct tevent_req *req;
7422         struct rpccli_spoolss_DeletePrintProcessor_state *state;
7423         struct tevent_req *subreq;
7424
7425         req = tevent_req_create(mem_ctx, &state,
7426                                 struct rpccli_spoolss_DeletePrintProcessor_state);
7427         if (req == NULL) {
7428                 return NULL;
7429         }
7430         state->out_mem_ctx = NULL;
7431         state->dispatch_recv = cli->dispatch_recv;
7432
7433         /* In parameters */
7434
7435         /* Out parameters */
7436
7437         /* Result */
7438         ZERO_STRUCT(state->orig.out.result);
7439
7440         /* make a temporary copy, that we pass to the dispatch function */
7441         state->tmp = state->orig;
7442
7443         subreq = cli->dispatch_send(state, ev, cli,
7444                                     &ndr_table_spoolss,
7445                                     NDR_SPOOLSS_DELETEPRINTPROCESSOR,
7446                                     &state->tmp);
7447         if (tevent_req_nomem(subreq, req)) {
7448                 return tevent_req_post(req, ev);
7449         }
7450         tevent_req_set_callback(subreq, rpccli_spoolss_DeletePrintProcessor_done, req);
7451         return req;
7452 }
7453
7454 static void rpccli_spoolss_DeletePrintProcessor_done(struct tevent_req *subreq)
7455 {
7456         struct tevent_req *req = tevent_req_callback_data(
7457                 subreq, struct tevent_req);
7458         struct rpccli_spoolss_DeletePrintProcessor_state *state = tevent_req_data(
7459                 req, struct rpccli_spoolss_DeletePrintProcessor_state);
7460         NTSTATUS status;
7461         TALLOC_CTX *mem_ctx;
7462
7463         if (state->out_mem_ctx) {
7464                 mem_ctx = state->out_mem_ctx;
7465         } else {
7466                 mem_ctx = state;
7467         }
7468
7469         status = state->dispatch_recv(subreq, mem_ctx);
7470         TALLOC_FREE(subreq);
7471         if (!NT_STATUS_IS_OK(status)) {
7472                 tevent_req_nterror(req, status);
7473                 return;
7474         }
7475
7476         /* Copy out parameters */
7477
7478         /* Copy result */
7479         state->orig.out.result = state->tmp.out.result;
7480
7481         /* Reset temporary structure */
7482         ZERO_STRUCT(state->tmp);
7483
7484         tevent_req_done(req);
7485 }
7486
7487 NTSTATUS rpccli_spoolss_DeletePrintProcessor_recv(struct tevent_req *req,
7488                                                   TALLOC_CTX *mem_ctx,
7489                                                   WERROR *result)
7490 {
7491         struct rpccli_spoolss_DeletePrintProcessor_state *state = tevent_req_data(
7492                 req, struct rpccli_spoolss_DeletePrintProcessor_state);
7493         NTSTATUS status;
7494
7495         if (tevent_req_is_nterror(req, &status)) {
7496                 tevent_req_received(req);
7497                 return status;
7498         }
7499
7500         /* Steal possbile out parameters to the callers context */
7501         talloc_steal(mem_ctx, state->out_mem_ctx);
7502
7503         /* Return result */
7504         *result = state->orig.out.result;
7505
7506         tevent_req_received(req);
7507         return NT_STATUS_OK;
7508 }
7509
7510 NTSTATUS rpccli_spoolss_DeletePrintProcessor(struct rpc_pipe_client *cli,
7511                                              TALLOC_CTX *mem_ctx,
7512                                              WERROR *werror)
7513 {
7514         struct spoolss_DeletePrintProcessor r;
7515         NTSTATUS status;
7516
7517         /* In parameters */
7518
7519         status = cli->dispatch(cli,
7520                                 mem_ctx,
7521                                 &ndr_table_spoolss,
7522                                 NDR_SPOOLSS_DELETEPRINTPROCESSOR,
7523                                 &r);
7524
7525         if (!NT_STATUS_IS_OK(status)) {
7526                 return status;
7527         }
7528
7529         if (NT_STATUS_IS_ERR(status)) {
7530                 return status;
7531         }
7532
7533         /* Return variables */
7534
7535         /* Return result */
7536         if (werror) {
7537                 *werror = r.out.result;
7538         }
7539
7540         return werror_to_ntstatus(r.out.result);
7541 }
7542
7543 struct rpccli_spoolss_AddPrintProvidor_state {
7544         struct spoolss_AddPrintProvidor orig;
7545         struct spoolss_AddPrintProvidor tmp;
7546         TALLOC_CTX *out_mem_ctx;
7547         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
7548 };
7549
7550 static void rpccli_spoolss_AddPrintProvidor_done(struct tevent_req *subreq);
7551
7552 struct tevent_req *rpccli_spoolss_AddPrintProvidor_send(TALLOC_CTX *mem_ctx,
7553                                                         struct tevent_context *ev,
7554                                                         struct rpc_pipe_client *cli)
7555 {
7556         struct tevent_req *req;
7557         struct rpccli_spoolss_AddPrintProvidor_state *state;
7558         struct tevent_req *subreq;
7559
7560         req = tevent_req_create(mem_ctx, &state,
7561                                 struct rpccli_spoolss_AddPrintProvidor_state);
7562         if (req == NULL) {
7563                 return NULL;
7564         }
7565         state->out_mem_ctx = NULL;
7566         state->dispatch_recv = cli->dispatch_recv;
7567
7568         /* In parameters */
7569
7570         /* Out parameters */
7571
7572         /* Result */
7573         ZERO_STRUCT(state->orig.out.result);
7574
7575         /* make a temporary copy, that we pass to the dispatch function */
7576         state->tmp = state->orig;
7577
7578         subreq = cli->dispatch_send(state, ev, cli,
7579                                     &ndr_table_spoolss,
7580                                     NDR_SPOOLSS_ADDPRINTPROVIDOR,
7581                                     &state->tmp);
7582         if (tevent_req_nomem(subreq, req)) {
7583                 return tevent_req_post(req, ev);
7584         }
7585         tevent_req_set_callback(subreq, rpccli_spoolss_AddPrintProvidor_done, req);
7586         return req;
7587 }
7588
7589 static void rpccli_spoolss_AddPrintProvidor_done(struct tevent_req *subreq)
7590 {
7591         struct tevent_req *req = tevent_req_callback_data(
7592                 subreq, struct tevent_req);
7593         struct rpccli_spoolss_AddPrintProvidor_state *state = tevent_req_data(
7594                 req, struct rpccli_spoolss_AddPrintProvidor_state);
7595         NTSTATUS status;
7596         TALLOC_CTX *mem_ctx;
7597
7598         if (state->out_mem_ctx) {
7599                 mem_ctx = state->out_mem_ctx;
7600         } else {
7601                 mem_ctx = state;
7602         }
7603
7604         status = state->dispatch_recv(subreq, mem_ctx);
7605         TALLOC_FREE(subreq);
7606         if (!NT_STATUS_IS_OK(status)) {
7607                 tevent_req_nterror(req, status);
7608                 return;
7609         }
7610
7611         /* Copy out parameters */
7612
7613         /* Copy result */
7614         state->orig.out.result = state->tmp.out.result;
7615
7616         /* Reset temporary structure */
7617         ZERO_STRUCT(state->tmp);
7618
7619         tevent_req_done(req);
7620 }
7621
7622 NTSTATUS rpccli_spoolss_AddPrintProvidor_recv(struct tevent_req *req,
7623                                               TALLOC_CTX *mem_ctx,
7624                                               WERROR *result)
7625 {
7626         struct rpccli_spoolss_AddPrintProvidor_state *state = tevent_req_data(
7627                 req, struct rpccli_spoolss_AddPrintProvidor_state);
7628         NTSTATUS status;
7629
7630         if (tevent_req_is_nterror(req, &status)) {
7631                 tevent_req_received(req);
7632                 return status;
7633         }
7634
7635         /* Steal possbile out parameters to the callers context */
7636         talloc_steal(mem_ctx, state->out_mem_ctx);
7637
7638         /* Return result */
7639         *result = state->orig.out.result;
7640
7641         tevent_req_received(req);
7642         return NT_STATUS_OK;
7643 }
7644
7645 NTSTATUS rpccli_spoolss_AddPrintProvidor(struct rpc_pipe_client *cli,
7646                                          TALLOC_CTX *mem_ctx,
7647                                          WERROR *werror)
7648 {
7649         struct spoolss_AddPrintProvidor r;
7650         NTSTATUS status;
7651
7652         /* In parameters */
7653
7654         status = cli->dispatch(cli,
7655                                 mem_ctx,
7656                                 &ndr_table_spoolss,
7657                                 NDR_SPOOLSS_ADDPRINTPROVIDOR,
7658                                 &r);
7659
7660         if (!NT_STATUS_IS_OK(status)) {
7661                 return status;
7662         }
7663
7664         if (NT_STATUS_IS_ERR(status)) {
7665                 return status;
7666         }
7667
7668         /* Return variables */
7669
7670         /* Return result */
7671         if (werror) {
7672                 *werror = r.out.result;
7673         }
7674
7675         return werror_to_ntstatus(r.out.result);
7676 }
7677
7678 struct rpccli_spoolss_DeletePrintProvidor_state {
7679         struct spoolss_DeletePrintProvidor orig;
7680         struct spoolss_DeletePrintProvidor tmp;
7681         TALLOC_CTX *out_mem_ctx;
7682         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
7683 };
7684
7685 static void rpccli_spoolss_DeletePrintProvidor_done(struct tevent_req *subreq);
7686
7687 struct tevent_req *rpccli_spoolss_DeletePrintProvidor_send(TALLOC_CTX *mem_ctx,
7688                                                            struct tevent_context *ev,
7689                                                            struct rpc_pipe_client *cli)
7690 {
7691         struct tevent_req *req;
7692         struct rpccli_spoolss_DeletePrintProvidor_state *state;
7693         struct tevent_req *subreq;
7694
7695         req = tevent_req_create(mem_ctx, &state,
7696                                 struct rpccli_spoolss_DeletePrintProvidor_state);
7697         if (req == NULL) {
7698                 return NULL;
7699         }
7700         state->out_mem_ctx = NULL;
7701         state->dispatch_recv = cli->dispatch_recv;
7702
7703         /* In parameters */
7704
7705         /* Out parameters */
7706
7707         /* Result */
7708         ZERO_STRUCT(state->orig.out.result);
7709
7710         /* make a temporary copy, that we pass to the dispatch function */
7711         state->tmp = state->orig;
7712
7713         subreq = cli->dispatch_send(state, ev, cli,
7714                                     &ndr_table_spoolss,
7715                                     NDR_SPOOLSS_DELETEPRINTPROVIDOR,
7716                                     &state->tmp);
7717         if (tevent_req_nomem(subreq, req)) {
7718                 return tevent_req_post(req, ev);
7719         }
7720         tevent_req_set_callback(subreq, rpccli_spoolss_DeletePrintProvidor_done, req);
7721         return req;
7722 }
7723
7724 static void rpccli_spoolss_DeletePrintProvidor_done(struct tevent_req *subreq)
7725 {
7726         struct tevent_req *req = tevent_req_callback_data(
7727                 subreq, struct tevent_req);
7728         struct rpccli_spoolss_DeletePrintProvidor_state *state = tevent_req_data(
7729                 req, struct rpccli_spoolss_DeletePrintProvidor_state);
7730         NTSTATUS status;
7731         TALLOC_CTX *mem_ctx;
7732
7733         if (state->out_mem_ctx) {
7734                 mem_ctx = state->out_mem_ctx;
7735         } else {
7736                 mem_ctx = state;
7737         }
7738
7739         status = state->dispatch_recv(subreq, mem_ctx);
7740         TALLOC_FREE(subreq);
7741         if (!NT_STATUS_IS_OK(status)) {
7742                 tevent_req_nterror(req, status);
7743                 return;
7744         }
7745
7746         /* Copy out parameters */
7747
7748         /* Copy result */
7749         state->orig.out.result = state->tmp.out.result;
7750
7751         /* Reset temporary structure */
7752         ZERO_STRUCT(state->tmp);
7753
7754         tevent_req_done(req);
7755 }
7756
7757 NTSTATUS rpccli_spoolss_DeletePrintProvidor_recv(struct tevent_req *req,
7758                                                  TALLOC_CTX *mem_ctx,
7759                                                  WERROR *result)
7760 {
7761         struct rpccli_spoolss_DeletePrintProvidor_state *state = tevent_req_data(
7762                 req, struct rpccli_spoolss_DeletePrintProvidor_state);
7763         NTSTATUS status;
7764
7765         if (tevent_req_is_nterror(req, &status)) {
7766                 tevent_req_received(req);
7767                 return status;
7768         }
7769
7770         /* Steal possbile out parameters to the callers context */
7771         talloc_steal(mem_ctx, state->out_mem_ctx);
7772
7773         /* Return result */
7774         *result = state->orig.out.result;
7775
7776         tevent_req_received(req);
7777         return NT_STATUS_OK;
7778 }
7779
7780 NTSTATUS rpccli_spoolss_DeletePrintProvidor(struct rpc_pipe_client *cli,
7781                                             TALLOC_CTX *mem_ctx,
7782                                             WERROR *werror)
7783 {
7784         struct spoolss_DeletePrintProvidor r;
7785         NTSTATUS status;
7786
7787         /* In parameters */
7788
7789         status = cli->dispatch(cli,
7790                                 mem_ctx,
7791                                 &ndr_table_spoolss,
7792                                 NDR_SPOOLSS_DELETEPRINTPROVIDOR,
7793                                 &r);
7794
7795         if (!NT_STATUS_IS_OK(status)) {
7796                 return status;
7797         }
7798
7799         if (NT_STATUS_IS_ERR(status)) {
7800                 return status;
7801         }
7802
7803         /* Return variables */
7804
7805         /* Return result */
7806         if (werror) {
7807                 *werror = r.out.result;
7808         }
7809
7810         return werror_to_ntstatus(r.out.result);
7811 }
7812
7813 struct rpccli_spoolss_EnumPrintProcDataTypes_state {
7814         struct spoolss_EnumPrintProcDataTypes orig;
7815         struct spoolss_EnumPrintProcDataTypes tmp;
7816         TALLOC_CTX *out_mem_ctx;
7817         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
7818 };
7819
7820 static void rpccli_spoolss_EnumPrintProcDataTypes_done(struct tevent_req *subreq);
7821
7822 struct tevent_req *rpccli_spoolss_EnumPrintProcDataTypes_send(TALLOC_CTX *mem_ctx,
7823                                                               struct tevent_context *ev,
7824                                                               struct rpc_pipe_client *cli,
7825                                                               const char *_servername /* [in] [unique,charset(UTF16)] */,
7826                                                               const char *_print_processor_name /* [in] [unique,charset(UTF16)] */,
7827                                                               uint32_t _level /* [in]  */,
7828                                                               DATA_BLOB *_buffer /* [in] [unique] */,
7829                                                               uint32_t _offered /* [in]  */,
7830                                                               uint32_t *_count /* [out] [ref] */,
7831                                                               union spoolss_PrintProcDataTypesInfo **_info /* [out] [ref,switch_is(level),size_is(,*count)] */,
7832                                                               uint32_t *_needed /* [out] [ref] */)
7833 {
7834         struct tevent_req *req;
7835         struct rpccli_spoolss_EnumPrintProcDataTypes_state *state;
7836         struct tevent_req *subreq;
7837
7838         req = tevent_req_create(mem_ctx, &state,
7839                                 struct rpccli_spoolss_EnumPrintProcDataTypes_state);
7840         if (req == NULL) {
7841                 return NULL;
7842         }
7843         state->out_mem_ctx = NULL;
7844         state->dispatch_recv = cli->dispatch_recv;
7845
7846         /* In parameters */
7847         state->orig.in.servername = _servername;
7848         state->orig.in.print_processor_name = _print_processor_name;
7849         state->orig.in.level = _level;
7850         state->orig.in.buffer = _buffer;
7851         state->orig.in.offered = _offered;
7852
7853         /* Out parameters */
7854         state->orig.out.count = _count;
7855         state->orig.out.info = _info;
7856         state->orig.out.needed = _needed;
7857
7858         /* Result */
7859         ZERO_STRUCT(state->orig.out.result);
7860
7861         state->out_mem_ctx = talloc_named_const(state, 0,
7862                              "rpccli_spoolss_EnumPrintProcDataTypes_out_memory");
7863         if (tevent_req_nomem(state->out_mem_ctx, req)) {
7864                 return tevent_req_post(req, ev);
7865         }
7866
7867         /* make a temporary copy, that we pass to the dispatch function */
7868         state->tmp = state->orig;
7869
7870         subreq = cli->dispatch_send(state, ev, cli,
7871                                     &ndr_table_spoolss,
7872                                     NDR_SPOOLSS_ENUMPRINTPROCDATATYPES,
7873                                     &state->tmp);
7874         if (tevent_req_nomem(subreq, req)) {
7875                 return tevent_req_post(req, ev);
7876         }
7877         tevent_req_set_callback(subreq, rpccli_spoolss_EnumPrintProcDataTypes_done, req);
7878         return req;
7879 }
7880
7881 static void rpccli_spoolss_EnumPrintProcDataTypes_done(struct tevent_req *subreq)
7882 {
7883         struct tevent_req *req = tevent_req_callback_data(
7884                 subreq, struct tevent_req);
7885         struct rpccli_spoolss_EnumPrintProcDataTypes_state *state = tevent_req_data(
7886                 req, struct rpccli_spoolss_EnumPrintProcDataTypes_state);
7887         NTSTATUS status;
7888         TALLOC_CTX *mem_ctx;
7889
7890         if (state->out_mem_ctx) {
7891                 mem_ctx = state->out_mem_ctx;
7892         } else {
7893                 mem_ctx = state;
7894         }
7895
7896         status = state->dispatch_recv(subreq, mem_ctx);
7897         TALLOC_FREE(subreq);
7898         if (!NT_STATUS_IS_OK(status)) {
7899                 tevent_req_nterror(req, status);
7900                 return;
7901         }
7902
7903         /* Copy out parameters */
7904         *state->orig.out.count = *state->tmp.out.count;
7905         *state->orig.out.info = *state->tmp.out.info;
7906         *state->orig.out.needed = *state->tmp.out.needed;
7907
7908         /* Copy result */
7909         state->orig.out.result = state->tmp.out.result;
7910
7911         /* Reset temporary structure */
7912         ZERO_STRUCT(state->tmp);
7913
7914         tevent_req_done(req);
7915 }
7916
7917 NTSTATUS rpccli_spoolss_EnumPrintProcDataTypes_recv(struct tevent_req *req,
7918                                                     TALLOC_CTX *mem_ctx,
7919                                                     WERROR *result)
7920 {
7921         struct rpccli_spoolss_EnumPrintProcDataTypes_state *state = tevent_req_data(
7922                 req, struct rpccli_spoolss_EnumPrintProcDataTypes_state);
7923         NTSTATUS status;
7924
7925         if (tevent_req_is_nterror(req, &status)) {
7926                 tevent_req_received(req);
7927                 return status;
7928         }
7929
7930         /* Steal possbile out parameters to the callers context */
7931         talloc_steal(mem_ctx, state->out_mem_ctx);
7932
7933         /* Return result */
7934         *result = state->orig.out.result;
7935
7936         tevent_req_received(req);
7937         return NT_STATUS_OK;
7938 }
7939
7940 NTSTATUS rpccli_spoolss_EnumPrintProcDataTypes(struct rpc_pipe_client *cli,
7941                                                TALLOC_CTX *mem_ctx,
7942                                                const char *servername /* [in] [unique,charset(UTF16)] */,
7943                                                const char *print_processor_name /* [in] [unique,charset(UTF16)] */,
7944                                                uint32_t level /* [in]  */,
7945                                                DATA_BLOB *buffer /* [in] [unique] */,
7946                                                uint32_t offered /* [in]  */,
7947                                                uint32_t *count /* [out] [ref] */,
7948                                                union spoolss_PrintProcDataTypesInfo **info /* [out] [ref,switch_is(level),size_is(,*count)] */,
7949                                                uint32_t *needed /* [out] [ref] */,
7950                                                WERROR *werror)
7951 {
7952         struct spoolss_EnumPrintProcDataTypes r;
7953         NTSTATUS status;
7954
7955         /* In parameters */
7956         r.in.servername = servername;
7957         r.in.print_processor_name = print_processor_name;
7958         r.in.level = level;
7959         r.in.buffer = buffer;
7960         r.in.offered = offered;
7961
7962         status = cli->dispatch(cli,
7963                                 mem_ctx,
7964                                 &ndr_table_spoolss,
7965                                 NDR_SPOOLSS_ENUMPRINTPROCDATATYPES,
7966                                 &r);
7967
7968         if (!NT_STATUS_IS_OK(status)) {
7969                 return status;
7970         }
7971
7972         if (NT_STATUS_IS_ERR(status)) {
7973                 return status;
7974         }
7975
7976         /* Return variables */
7977         *count = *r.out.count;
7978         *info = *r.out.info;
7979         *needed = *r.out.needed;
7980
7981         /* Return result */
7982         if (werror) {
7983                 *werror = r.out.result;
7984         }
7985
7986         return werror_to_ntstatus(r.out.result);
7987 }
7988
7989 struct rpccli_spoolss_ResetPrinter_state {
7990         struct spoolss_ResetPrinter orig;
7991         struct spoolss_ResetPrinter tmp;
7992         TALLOC_CTX *out_mem_ctx;
7993         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
7994 };
7995
7996 static void rpccli_spoolss_ResetPrinter_done(struct tevent_req *subreq);
7997
7998 struct tevent_req *rpccli_spoolss_ResetPrinter_send(TALLOC_CTX *mem_ctx,
7999                                                     struct tevent_context *ev,
8000                                                     struct rpc_pipe_client *cli,
8001                                                     struct policy_handle *_handle /* [in] [ref] */,
8002                                                     const char *_data_type /* [in] [unique,charset(UTF16)] */,
8003                                                     struct spoolss_DevmodeContainer *_devmode_ctr /* [in] [ref] */)
8004 {
8005         struct tevent_req *req;
8006         struct rpccli_spoolss_ResetPrinter_state *state;
8007         struct tevent_req *subreq;
8008
8009         req = tevent_req_create(mem_ctx, &state,
8010                                 struct rpccli_spoolss_ResetPrinter_state);
8011         if (req == NULL) {
8012                 return NULL;
8013         }
8014         state->out_mem_ctx = NULL;
8015         state->dispatch_recv = cli->dispatch_recv;
8016
8017         /* In parameters */
8018         state->orig.in.handle = _handle;
8019         state->orig.in.data_type = _data_type;
8020         state->orig.in.devmode_ctr = _devmode_ctr;
8021
8022         /* Out parameters */
8023
8024         /* Result */
8025         ZERO_STRUCT(state->orig.out.result);
8026
8027         /* make a temporary copy, that we pass to the dispatch function */
8028         state->tmp = state->orig;
8029
8030         subreq = cli->dispatch_send(state, ev, cli,
8031                                     &ndr_table_spoolss,
8032                                     NDR_SPOOLSS_RESETPRINTER,
8033                                     &state->tmp);
8034         if (tevent_req_nomem(subreq, req)) {
8035                 return tevent_req_post(req, ev);
8036         }
8037         tevent_req_set_callback(subreq, rpccli_spoolss_ResetPrinter_done, req);
8038         return req;
8039 }
8040
8041 static void rpccli_spoolss_ResetPrinter_done(struct tevent_req *subreq)
8042 {
8043         struct tevent_req *req = tevent_req_callback_data(
8044                 subreq, struct tevent_req);
8045         struct rpccli_spoolss_ResetPrinter_state *state = tevent_req_data(
8046                 req, struct rpccli_spoolss_ResetPrinter_state);
8047         NTSTATUS status;
8048         TALLOC_CTX *mem_ctx;
8049
8050         if (state->out_mem_ctx) {
8051                 mem_ctx = state->out_mem_ctx;
8052         } else {
8053                 mem_ctx = state;
8054         }
8055
8056         status = state->dispatch_recv(subreq, mem_ctx);
8057         TALLOC_FREE(subreq);
8058         if (!NT_STATUS_IS_OK(status)) {
8059                 tevent_req_nterror(req, status);
8060                 return;
8061         }
8062
8063         /* Copy out parameters */
8064
8065         /* Copy result */
8066         state->orig.out.result = state->tmp.out.result;
8067
8068         /* Reset temporary structure */
8069         ZERO_STRUCT(state->tmp);
8070
8071         tevent_req_done(req);
8072 }
8073
8074 NTSTATUS rpccli_spoolss_ResetPrinter_recv(struct tevent_req *req,
8075                                           TALLOC_CTX *mem_ctx,
8076                                           WERROR *result)
8077 {
8078         struct rpccli_spoolss_ResetPrinter_state *state = tevent_req_data(
8079                 req, struct rpccli_spoolss_ResetPrinter_state);
8080         NTSTATUS status;
8081
8082         if (tevent_req_is_nterror(req, &status)) {
8083                 tevent_req_received(req);
8084                 return status;
8085         }
8086
8087         /* Steal possbile out parameters to the callers context */
8088         talloc_steal(mem_ctx, state->out_mem_ctx);
8089
8090         /* Return result */
8091         *result = state->orig.out.result;
8092
8093         tevent_req_received(req);
8094         return NT_STATUS_OK;
8095 }
8096
8097 NTSTATUS rpccli_spoolss_ResetPrinter(struct rpc_pipe_client *cli,
8098                                      TALLOC_CTX *mem_ctx,
8099                                      struct policy_handle *handle /* [in] [ref] */,
8100                                      const char *data_type /* [in] [unique,charset(UTF16)] */,
8101                                      struct spoolss_DevmodeContainer *devmode_ctr /* [in] [ref] */,
8102                                      WERROR *werror)
8103 {
8104         struct spoolss_ResetPrinter r;
8105         NTSTATUS status;
8106
8107         /* In parameters */
8108         r.in.handle = handle;
8109         r.in.data_type = data_type;
8110         r.in.devmode_ctr = devmode_ctr;
8111
8112         status = cli->dispatch(cli,
8113                                 mem_ctx,
8114                                 &ndr_table_spoolss,
8115                                 NDR_SPOOLSS_RESETPRINTER,
8116                                 &r);
8117
8118         if (!NT_STATUS_IS_OK(status)) {
8119                 return status;
8120         }
8121
8122         if (NT_STATUS_IS_ERR(status)) {
8123                 return status;
8124         }
8125
8126         /* Return variables */
8127
8128         /* Return result */
8129         if (werror) {
8130                 *werror = r.out.result;
8131         }
8132
8133         return werror_to_ntstatus(r.out.result);
8134 }
8135
8136 struct rpccli_spoolss_GetPrinterDriver2_state {
8137         struct spoolss_GetPrinterDriver2 orig;
8138         struct spoolss_GetPrinterDriver2 tmp;
8139         TALLOC_CTX *out_mem_ctx;
8140         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
8141 };
8142
8143 static void rpccli_spoolss_GetPrinterDriver2_done(struct tevent_req *subreq);
8144
8145 struct tevent_req *rpccli_spoolss_GetPrinterDriver2_send(TALLOC_CTX *mem_ctx,
8146                                                          struct tevent_context *ev,
8147                                                          struct rpc_pipe_client *cli,
8148                                                          struct policy_handle *_handle /* [in] [ref] */,
8149                                                          const char *_architecture /* [in] [unique,charset(UTF16)] */,
8150                                                          uint32_t _level /* [in]  */,
8151                                                          DATA_BLOB *_buffer /* [in] [unique] */,
8152                                                          uint32_t _offered /* [in]  */,
8153                                                          uint32_t _client_major_version /* [in]  */,
8154                                                          uint32_t _client_minor_version /* [in]  */,
8155                                                          union spoolss_DriverInfo *_info /* [out] [unique,subcontext_size(offered),subcontext(4),switch_is(level)] */,
8156                                                          uint32_t *_needed /* [out] [ref] */,
8157                                                          uint32_t *_server_major_version /* [out] [ref] */,
8158                                                          uint32_t *_server_minor_version /* [out] [ref] */)
8159 {
8160         struct tevent_req *req;
8161         struct rpccli_spoolss_GetPrinterDriver2_state *state;
8162         struct tevent_req *subreq;
8163
8164         req = tevent_req_create(mem_ctx, &state,
8165                                 struct rpccli_spoolss_GetPrinterDriver2_state);
8166         if (req == NULL) {
8167                 return NULL;
8168         }
8169         state->out_mem_ctx = NULL;
8170         state->dispatch_recv = cli->dispatch_recv;
8171
8172         /* In parameters */
8173         state->orig.in.handle = _handle;
8174         state->orig.in.architecture = _architecture;
8175         state->orig.in.level = _level;
8176         state->orig.in.buffer = _buffer;
8177         state->orig.in.offered = _offered;
8178         state->orig.in.client_major_version = _client_major_version;
8179         state->orig.in.client_minor_version = _client_minor_version;
8180
8181         /* Out parameters */
8182         state->orig.out.info = _info;
8183         state->orig.out.needed = _needed;
8184         state->orig.out.server_major_version = _server_major_version;
8185         state->orig.out.server_minor_version = _server_minor_version;
8186
8187         /* Result */
8188         ZERO_STRUCT(state->orig.out.result);
8189
8190         state->out_mem_ctx = talloc_named_const(state, 0,
8191                              "rpccli_spoolss_GetPrinterDriver2_out_memory");
8192         if (tevent_req_nomem(state->out_mem_ctx, req)) {
8193                 return tevent_req_post(req, ev);
8194         }
8195
8196         /* make a temporary copy, that we pass to the dispatch function */
8197         state->tmp = state->orig;
8198
8199         subreq = cli->dispatch_send(state, ev, cli,
8200                                     &ndr_table_spoolss,
8201                                     NDR_SPOOLSS_GETPRINTERDRIVER2,
8202                                     &state->tmp);
8203         if (tevent_req_nomem(subreq, req)) {
8204                 return tevent_req_post(req, ev);
8205         }
8206         tevent_req_set_callback(subreq, rpccli_spoolss_GetPrinterDriver2_done, req);
8207         return req;
8208 }
8209
8210 static void rpccli_spoolss_GetPrinterDriver2_done(struct tevent_req *subreq)
8211 {
8212         struct tevent_req *req = tevent_req_callback_data(
8213                 subreq, struct tevent_req);
8214         struct rpccli_spoolss_GetPrinterDriver2_state *state = tevent_req_data(
8215                 req, struct rpccli_spoolss_GetPrinterDriver2_state);
8216         NTSTATUS status;
8217         TALLOC_CTX *mem_ctx;
8218
8219         if (state->out_mem_ctx) {
8220                 mem_ctx = state->out_mem_ctx;
8221         } else {
8222                 mem_ctx = state;
8223         }
8224
8225         status = state->dispatch_recv(subreq, mem_ctx);
8226         TALLOC_FREE(subreq);
8227         if (!NT_STATUS_IS_OK(status)) {
8228                 tevent_req_nterror(req, status);
8229                 return;
8230         }
8231
8232         /* Copy out parameters */
8233         if (state->orig.out.info && state->tmp.out.info) {
8234                 *state->orig.out.info = *state->tmp.out.info;
8235         }
8236         *state->orig.out.needed = *state->tmp.out.needed;
8237         *state->orig.out.server_major_version = *state->tmp.out.server_major_version;
8238         *state->orig.out.server_minor_version = *state->tmp.out.server_minor_version;
8239
8240         /* Copy result */
8241         state->orig.out.result = state->tmp.out.result;
8242
8243         /* Reset temporary structure */
8244         ZERO_STRUCT(state->tmp);
8245
8246         tevent_req_done(req);
8247 }
8248
8249 NTSTATUS rpccli_spoolss_GetPrinterDriver2_recv(struct tevent_req *req,
8250                                                TALLOC_CTX *mem_ctx,
8251                                                WERROR *result)
8252 {
8253         struct rpccli_spoolss_GetPrinterDriver2_state *state = tevent_req_data(
8254                 req, struct rpccli_spoolss_GetPrinterDriver2_state);
8255         NTSTATUS status;
8256
8257         if (tevent_req_is_nterror(req, &status)) {
8258                 tevent_req_received(req);
8259                 return status;
8260         }
8261
8262         /* Steal possbile out parameters to the callers context */
8263         talloc_steal(mem_ctx, state->out_mem_ctx);
8264
8265         /* Return result */
8266         *result = state->orig.out.result;
8267
8268         tevent_req_received(req);
8269         return NT_STATUS_OK;
8270 }
8271
8272 NTSTATUS rpccli_spoolss_GetPrinterDriver2(struct rpc_pipe_client *cli,
8273                                           TALLOC_CTX *mem_ctx,
8274                                           struct policy_handle *handle /* [in] [ref] */,
8275                                           const char *architecture /* [in] [unique,charset(UTF16)] */,
8276                                           uint32_t level /* [in]  */,
8277                                           DATA_BLOB *buffer /* [in] [unique] */,
8278                                           uint32_t offered /* [in]  */,
8279                                           uint32_t client_major_version /* [in]  */,
8280                                           uint32_t client_minor_version /* [in]  */,
8281                                           union spoolss_DriverInfo *info /* [out] [unique,subcontext_size(offered),subcontext(4),switch_is(level)] */,
8282                                           uint32_t *needed /* [out] [ref] */,
8283                                           uint32_t *server_major_version /* [out] [ref] */,
8284                                           uint32_t *server_minor_version /* [out] [ref] */,
8285                                           WERROR *werror)
8286 {
8287         struct spoolss_GetPrinterDriver2 r;
8288         NTSTATUS status;
8289
8290         /* In parameters */
8291         r.in.handle = handle;
8292         r.in.architecture = architecture;
8293         r.in.level = level;
8294         r.in.buffer = buffer;
8295         r.in.offered = offered;
8296         r.in.client_major_version = client_major_version;
8297         r.in.client_minor_version = client_minor_version;
8298
8299         status = cli->dispatch(cli,
8300                                 mem_ctx,
8301                                 &ndr_table_spoolss,
8302                                 NDR_SPOOLSS_GETPRINTERDRIVER2,
8303                                 &r);
8304
8305         if (!NT_STATUS_IS_OK(status)) {
8306                 return status;
8307         }
8308
8309         if (NT_STATUS_IS_ERR(status)) {
8310                 return status;
8311         }
8312
8313         /* Return variables */
8314         if (info && r.out.info) {
8315                 *info = *r.out.info;
8316         }
8317         *needed = *r.out.needed;
8318         *server_major_version = *r.out.server_major_version;
8319         *server_minor_version = *r.out.server_minor_version;
8320
8321         /* Return result */
8322         if (werror) {
8323                 *werror = r.out.result;
8324         }
8325
8326         return werror_to_ntstatus(r.out.result);
8327 }
8328
8329 struct rpccli_spoolss_FindFirstPrinterChangeNotification_state {
8330         struct spoolss_FindFirstPrinterChangeNotification orig;
8331         struct spoolss_FindFirstPrinterChangeNotification tmp;
8332         TALLOC_CTX *out_mem_ctx;
8333         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
8334 };
8335
8336 static void rpccli_spoolss_FindFirstPrinterChangeNotification_done(struct tevent_req *subreq);
8337
8338 struct tevent_req *rpccli_spoolss_FindFirstPrinterChangeNotification_send(TALLOC_CTX *mem_ctx,
8339                                                                           struct tevent_context *ev,
8340                                                                           struct rpc_pipe_client *cli)
8341 {
8342         struct tevent_req *req;
8343         struct rpccli_spoolss_FindFirstPrinterChangeNotification_state *state;
8344         struct tevent_req *subreq;
8345
8346         req = tevent_req_create(mem_ctx, &state,
8347                                 struct rpccli_spoolss_FindFirstPrinterChangeNotification_state);
8348         if (req == NULL) {
8349                 return NULL;
8350         }
8351         state->out_mem_ctx = NULL;
8352         state->dispatch_recv = cli->dispatch_recv;
8353
8354         /* In parameters */
8355
8356         /* Out parameters */
8357
8358         /* Result */
8359         ZERO_STRUCT(state->orig.out.result);
8360
8361         /* make a temporary copy, that we pass to the dispatch function */
8362         state->tmp = state->orig;
8363
8364         subreq = cli->dispatch_send(state, ev, cli,
8365                                     &ndr_table_spoolss,
8366                                     NDR_SPOOLSS_FINDFIRSTPRINTERCHANGENOTIFICATION,
8367                                     &state->tmp);
8368         if (tevent_req_nomem(subreq, req)) {
8369                 return tevent_req_post(req, ev);
8370         }
8371         tevent_req_set_callback(subreq, rpccli_spoolss_FindFirstPrinterChangeNotification_done, req);
8372         return req;
8373 }
8374
8375 static void rpccli_spoolss_FindFirstPrinterChangeNotification_done(struct tevent_req *subreq)
8376 {
8377         struct tevent_req *req = tevent_req_callback_data(
8378                 subreq, struct tevent_req);
8379         struct rpccli_spoolss_FindFirstPrinterChangeNotification_state *state = tevent_req_data(
8380                 req, struct rpccli_spoolss_FindFirstPrinterChangeNotification_state);
8381         NTSTATUS status;
8382         TALLOC_CTX *mem_ctx;
8383
8384         if (state->out_mem_ctx) {
8385                 mem_ctx = state->out_mem_ctx;
8386         } else {
8387                 mem_ctx = state;
8388         }
8389
8390         status = state->dispatch_recv(subreq, mem_ctx);
8391         TALLOC_FREE(subreq);
8392         if (!NT_STATUS_IS_OK(status)) {
8393                 tevent_req_nterror(req, status);
8394                 return;
8395         }
8396
8397         /* Copy out parameters */
8398
8399         /* Copy result */
8400         state->orig.out.result = state->tmp.out.result;
8401
8402         /* Reset temporary structure */
8403         ZERO_STRUCT(state->tmp);
8404
8405         tevent_req_done(req);
8406 }
8407
8408 NTSTATUS rpccli_spoolss_FindFirstPrinterChangeNotification_recv(struct tevent_req *req,
8409                                                                 TALLOC_CTX *mem_ctx,
8410                                                                 WERROR *result)
8411 {
8412         struct rpccli_spoolss_FindFirstPrinterChangeNotification_state *state = tevent_req_data(
8413                 req, struct rpccli_spoolss_FindFirstPrinterChangeNotification_state);
8414         NTSTATUS status;
8415
8416         if (tevent_req_is_nterror(req, &status)) {
8417                 tevent_req_received(req);
8418                 return status;
8419         }
8420
8421         /* Steal possbile out parameters to the callers context */
8422         talloc_steal(mem_ctx, state->out_mem_ctx);
8423
8424         /* Return result */
8425         *result = state->orig.out.result;
8426
8427         tevent_req_received(req);
8428         return NT_STATUS_OK;
8429 }
8430
8431 NTSTATUS rpccli_spoolss_FindFirstPrinterChangeNotification(struct rpc_pipe_client *cli,
8432                                                            TALLOC_CTX *mem_ctx,
8433                                                            WERROR *werror)
8434 {
8435         struct spoolss_FindFirstPrinterChangeNotification r;
8436         NTSTATUS status;
8437
8438         /* In parameters */
8439
8440         status = cli->dispatch(cli,
8441                                 mem_ctx,
8442                                 &ndr_table_spoolss,
8443                                 NDR_SPOOLSS_FINDFIRSTPRINTERCHANGENOTIFICATION,
8444                                 &r);
8445
8446         if (!NT_STATUS_IS_OK(status)) {
8447                 return status;
8448         }
8449
8450         if (NT_STATUS_IS_ERR(status)) {
8451                 return status;
8452         }
8453
8454         /* Return variables */
8455
8456         /* Return result */
8457         if (werror) {
8458                 *werror = r.out.result;
8459         }
8460
8461         return werror_to_ntstatus(r.out.result);
8462 }
8463
8464 struct rpccli_spoolss_FindNextPrinterChangeNotification_state {
8465         struct spoolss_FindNextPrinterChangeNotification orig;
8466         struct spoolss_FindNextPrinterChangeNotification tmp;
8467         TALLOC_CTX *out_mem_ctx;
8468         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
8469 };
8470
8471 static void rpccli_spoolss_FindNextPrinterChangeNotification_done(struct tevent_req *subreq);
8472
8473 struct tevent_req *rpccli_spoolss_FindNextPrinterChangeNotification_send(TALLOC_CTX *mem_ctx,
8474                                                                          struct tevent_context *ev,
8475                                                                          struct rpc_pipe_client *cli)
8476 {
8477         struct tevent_req *req;
8478         struct rpccli_spoolss_FindNextPrinterChangeNotification_state *state;
8479         struct tevent_req *subreq;
8480
8481         req = tevent_req_create(mem_ctx, &state,
8482                                 struct rpccli_spoolss_FindNextPrinterChangeNotification_state);
8483         if (req == NULL) {
8484                 return NULL;
8485         }
8486         state->out_mem_ctx = NULL;
8487         state->dispatch_recv = cli->dispatch_recv;
8488
8489         /* In parameters */
8490
8491         /* Out parameters */
8492
8493         /* Result */
8494         ZERO_STRUCT(state->orig.out.result);
8495
8496         /* make a temporary copy, that we pass to the dispatch function */
8497         state->tmp = state->orig;
8498
8499         subreq = cli->dispatch_send(state, ev, cli,
8500                                     &ndr_table_spoolss,
8501                                     NDR_SPOOLSS_FINDNEXTPRINTERCHANGENOTIFICATION,
8502                                     &state->tmp);
8503         if (tevent_req_nomem(subreq, req)) {
8504                 return tevent_req_post(req, ev);
8505         }
8506         tevent_req_set_callback(subreq, rpccli_spoolss_FindNextPrinterChangeNotification_done, req);
8507         return req;
8508 }
8509
8510 static void rpccli_spoolss_FindNextPrinterChangeNotification_done(struct tevent_req *subreq)
8511 {
8512         struct tevent_req *req = tevent_req_callback_data(
8513                 subreq, struct tevent_req);
8514         struct rpccli_spoolss_FindNextPrinterChangeNotification_state *state = tevent_req_data(
8515                 req, struct rpccli_spoolss_FindNextPrinterChangeNotification_state);
8516         NTSTATUS status;
8517         TALLOC_CTX *mem_ctx;
8518
8519         if (state->out_mem_ctx) {
8520                 mem_ctx = state->out_mem_ctx;
8521         } else {
8522                 mem_ctx = state;
8523         }
8524
8525         status = state->dispatch_recv(subreq, mem_ctx);
8526         TALLOC_FREE(subreq);
8527         if (!NT_STATUS_IS_OK(status)) {
8528                 tevent_req_nterror(req, status);
8529                 return;
8530         }
8531
8532         /* Copy out parameters */
8533
8534         /* Copy result */
8535         state->orig.out.result = state->tmp.out.result;
8536
8537         /* Reset temporary structure */
8538         ZERO_STRUCT(state->tmp);
8539
8540         tevent_req_done(req);
8541 }
8542
8543 NTSTATUS rpccli_spoolss_FindNextPrinterChangeNotification_recv(struct tevent_req *req,
8544                                                                TALLOC_CTX *mem_ctx,
8545                                                                WERROR *result)
8546 {
8547         struct rpccli_spoolss_FindNextPrinterChangeNotification_state *state = tevent_req_data(
8548                 req, struct rpccli_spoolss_FindNextPrinterChangeNotification_state);
8549         NTSTATUS status;
8550
8551         if (tevent_req_is_nterror(req, &status)) {
8552                 tevent_req_received(req);
8553                 return status;
8554         }
8555
8556         /* Steal possbile out parameters to the callers context */
8557         talloc_steal(mem_ctx, state->out_mem_ctx);
8558
8559         /* Return result */
8560         *result = state->orig.out.result;
8561
8562         tevent_req_received(req);
8563         return NT_STATUS_OK;
8564 }
8565
8566 NTSTATUS rpccli_spoolss_FindNextPrinterChangeNotification(struct rpc_pipe_client *cli,
8567                                                           TALLOC_CTX *mem_ctx,
8568                                                           WERROR *werror)
8569 {
8570         struct spoolss_FindNextPrinterChangeNotification r;
8571         NTSTATUS status;
8572
8573         /* In parameters */
8574
8575         status = cli->dispatch(cli,
8576                                 mem_ctx,
8577                                 &ndr_table_spoolss,
8578                                 NDR_SPOOLSS_FINDNEXTPRINTERCHANGENOTIFICATION,
8579                                 &r);
8580
8581         if (!NT_STATUS_IS_OK(status)) {
8582                 return status;
8583         }
8584
8585         if (NT_STATUS_IS_ERR(status)) {
8586                 return status;
8587         }
8588
8589         /* Return variables */
8590
8591         /* Return result */
8592         if (werror) {
8593                 *werror = r.out.result;
8594         }
8595
8596         return werror_to_ntstatus(r.out.result);
8597 }
8598
8599 struct rpccli_spoolss_FindClosePrinterNotify_state {
8600         struct spoolss_FindClosePrinterNotify orig;
8601         struct spoolss_FindClosePrinterNotify tmp;
8602         TALLOC_CTX *out_mem_ctx;
8603         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
8604 };
8605
8606 static void rpccli_spoolss_FindClosePrinterNotify_done(struct tevent_req *subreq);
8607
8608 struct tevent_req *rpccli_spoolss_FindClosePrinterNotify_send(TALLOC_CTX *mem_ctx,
8609                                                               struct tevent_context *ev,
8610                                                               struct rpc_pipe_client *cli,
8611                                                               struct policy_handle *_handle /* [in] [ref] */)
8612 {
8613         struct tevent_req *req;
8614         struct rpccli_spoolss_FindClosePrinterNotify_state *state;
8615         struct tevent_req *subreq;
8616
8617         req = tevent_req_create(mem_ctx, &state,
8618                                 struct rpccli_spoolss_FindClosePrinterNotify_state);
8619         if (req == NULL) {
8620                 return NULL;
8621         }
8622         state->out_mem_ctx = NULL;
8623         state->dispatch_recv = cli->dispatch_recv;
8624
8625         /* In parameters */
8626         state->orig.in.handle = _handle;
8627
8628         /* Out parameters */
8629
8630         /* Result */
8631         ZERO_STRUCT(state->orig.out.result);
8632
8633         /* make a temporary copy, that we pass to the dispatch function */
8634         state->tmp = state->orig;
8635
8636         subreq = cli->dispatch_send(state, ev, cli,
8637                                     &ndr_table_spoolss,
8638                                     NDR_SPOOLSS_FINDCLOSEPRINTERNOTIFY,
8639                                     &state->tmp);
8640         if (tevent_req_nomem(subreq, req)) {
8641                 return tevent_req_post(req, ev);
8642         }
8643         tevent_req_set_callback(subreq, rpccli_spoolss_FindClosePrinterNotify_done, req);
8644         return req;
8645 }
8646
8647 static void rpccli_spoolss_FindClosePrinterNotify_done(struct tevent_req *subreq)
8648 {
8649         struct tevent_req *req = tevent_req_callback_data(
8650                 subreq, struct tevent_req);
8651         struct rpccli_spoolss_FindClosePrinterNotify_state *state = tevent_req_data(
8652                 req, struct rpccli_spoolss_FindClosePrinterNotify_state);
8653         NTSTATUS status;
8654         TALLOC_CTX *mem_ctx;
8655
8656         if (state->out_mem_ctx) {
8657                 mem_ctx = state->out_mem_ctx;
8658         } else {
8659                 mem_ctx = state;
8660         }
8661
8662         status = state->dispatch_recv(subreq, mem_ctx);
8663         TALLOC_FREE(subreq);
8664         if (!NT_STATUS_IS_OK(status)) {
8665                 tevent_req_nterror(req, status);
8666                 return;
8667         }
8668
8669         /* Copy out parameters */
8670
8671         /* Copy result */
8672         state->orig.out.result = state->tmp.out.result;
8673
8674         /* Reset temporary structure */
8675         ZERO_STRUCT(state->tmp);
8676
8677         tevent_req_done(req);
8678 }
8679
8680 NTSTATUS rpccli_spoolss_FindClosePrinterNotify_recv(struct tevent_req *req,
8681                                                     TALLOC_CTX *mem_ctx,
8682                                                     WERROR *result)
8683 {
8684         struct rpccli_spoolss_FindClosePrinterNotify_state *state = tevent_req_data(
8685                 req, struct rpccli_spoolss_FindClosePrinterNotify_state);
8686         NTSTATUS status;
8687
8688         if (tevent_req_is_nterror(req, &status)) {
8689                 tevent_req_received(req);
8690                 return status;
8691         }
8692
8693         /* Steal possbile out parameters to the callers context */
8694         talloc_steal(mem_ctx, state->out_mem_ctx);
8695
8696         /* Return result */
8697         *result = state->orig.out.result;
8698
8699         tevent_req_received(req);
8700         return NT_STATUS_OK;
8701 }
8702
8703 NTSTATUS rpccli_spoolss_FindClosePrinterNotify(struct rpc_pipe_client *cli,
8704                                                TALLOC_CTX *mem_ctx,
8705                                                struct policy_handle *handle /* [in] [ref] */,
8706                                                WERROR *werror)
8707 {
8708         struct spoolss_FindClosePrinterNotify r;
8709         NTSTATUS status;
8710
8711         /* In parameters */
8712         r.in.handle = handle;
8713
8714         status = cli->dispatch(cli,
8715                                 mem_ctx,
8716                                 &ndr_table_spoolss,
8717                                 NDR_SPOOLSS_FINDCLOSEPRINTERNOTIFY,
8718                                 &r);
8719
8720         if (!NT_STATUS_IS_OK(status)) {
8721                 return status;
8722         }
8723
8724         if (NT_STATUS_IS_ERR(status)) {
8725                 return status;
8726         }
8727
8728         /* Return variables */
8729
8730         /* Return result */
8731         if (werror) {
8732                 *werror = r.out.result;
8733         }
8734
8735         return werror_to_ntstatus(r.out.result);
8736 }
8737
8738 struct rpccli_spoolss_RouterFindFirstPrinterChangeNotificationOld_state {
8739         struct spoolss_RouterFindFirstPrinterChangeNotificationOld orig;
8740         struct spoolss_RouterFindFirstPrinterChangeNotificationOld tmp;
8741         TALLOC_CTX *out_mem_ctx;
8742         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
8743 };
8744
8745 static void rpccli_spoolss_RouterFindFirstPrinterChangeNotificationOld_done(struct tevent_req *subreq);
8746
8747 struct tevent_req *rpccli_spoolss_RouterFindFirstPrinterChangeNotificationOld_send(TALLOC_CTX *mem_ctx,
8748                                                                                    struct tevent_context *ev,
8749                                                                                    struct rpc_pipe_client *cli)
8750 {
8751         struct tevent_req *req;
8752         struct rpccli_spoolss_RouterFindFirstPrinterChangeNotificationOld_state *state;
8753         struct tevent_req *subreq;
8754
8755         req = tevent_req_create(mem_ctx, &state,
8756                                 struct rpccli_spoolss_RouterFindFirstPrinterChangeNotificationOld_state);
8757         if (req == NULL) {
8758                 return NULL;
8759         }
8760         state->out_mem_ctx = NULL;
8761         state->dispatch_recv = cli->dispatch_recv;
8762
8763         /* In parameters */
8764
8765         /* Out parameters */
8766
8767         /* Result */
8768         ZERO_STRUCT(state->orig.out.result);
8769
8770         /* make a temporary copy, that we pass to the dispatch function */
8771         state->tmp = state->orig;
8772
8773         subreq = cli->dispatch_send(state, ev, cli,
8774                                     &ndr_table_spoolss,
8775                                     NDR_SPOOLSS_ROUTERFINDFIRSTPRINTERCHANGENOTIFICATIONOLD,
8776                                     &state->tmp);
8777         if (tevent_req_nomem(subreq, req)) {
8778                 return tevent_req_post(req, ev);
8779         }
8780         tevent_req_set_callback(subreq, rpccli_spoolss_RouterFindFirstPrinterChangeNotificationOld_done, req);
8781         return req;
8782 }
8783
8784 static void rpccli_spoolss_RouterFindFirstPrinterChangeNotificationOld_done(struct tevent_req *subreq)
8785 {
8786         struct tevent_req *req = tevent_req_callback_data(
8787                 subreq, struct tevent_req);
8788         struct rpccli_spoolss_RouterFindFirstPrinterChangeNotificationOld_state *state = tevent_req_data(
8789                 req, struct rpccli_spoolss_RouterFindFirstPrinterChangeNotificationOld_state);
8790         NTSTATUS status;
8791         TALLOC_CTX *mem_ctx;
8792
8793         if (state->out_mem_ctx) {
8794                 mem_ctx = state->out_mem_ctx;
8795         } else {
8796                 mem_ctx = state;
8797         }
8798
8799         status = state->dispatch_recv(subreq, mem_ctx);
8800         TALLOC_FREE(subreq);
8801         if (!NT_STATUS_IS_OK(status)) {
8802                 tevent_req_nterror(req, status);
8803                 return;
8804         }
8805
8806         /* Copy out parameters */
8807
8808         /* Copy result */
8809         state->orig.out.result = state->tmp.out.result;
8810
8811         /* Reset temporary structure */
8812         ZERO_STRUCT(state->tmp);
8813
8814         tevent_req_done(req);
8815 }
8816
8817 NTSTATUS rpccli_spoolss_RouterFindFirstPrinterChangeNotificationOld_recv(struct tevent_req *req,
8818                                                                          TALLOC_CTX *mem_ctx,
8819                                                                          WERROR *result)
8820 {
8821         struct rpccli_spoolss_RouterFindFirstPrinterChangeNotificationOld_state *state = tevent_req_data(
8822                 req, struct rpccli_spoolss_RouterFindFirstPrinterChangeNotificationOld_state);
8823         NTSTATUS status;
8824
8825         if (tevent_req_is_nterror(req, &status)) {
8826                 tevent_req_received(req);
8827                 return status;
8828         }
8829
8830         /* Steal possbile out parameters to the callers context */
8831         talloc_steal(mem_ctx, state->out_mem_ctx);
8832
8833         /* Return result */
8834         *result = state->orig.out.result;
8835
8836         tevent_req_received(req);
8837         return NT_STATUS_OK;
8838 }
8839
8840 NTSTATUS rpccli_spoolss_RouterFindFirstPrinterChangeNotificationOld(struct rpc_pipe_client *cli,
8841                                                                     TALLOC_CTX *mem_ctx,
8842                                                                     WERROR *werror)
8843 {
8844         struct spoolss_RouterFindFirstPrinterChangeNotificationOld r;
8845         NTSTATUS status;
8846
8847         /* In parameters */
8848
8849         status = cli->dispatch(cli,
8850                                 mem_ctx,
8851                                 &ndr_table_spoolss,
8852                                 NDR_SPOOLSS_ROUTERFINDFIRSTPRINTERCHANGENOTIFICATIONOLD,
8853                                 &r);
8854
8855         if (!NT_STATUS_IS_OK(status)) {
8856                 return status;
8857         }
8858
8859         if (NT_STATUS_IS_ERR(status)) {
8860                 return status;
8861         }
8862
8863         /* Return variables */
8864
8865         /* Return result */
8866         if (werror) {
8867                 *werror = r.out.result;
8868         }
8869
8870         return werror_to_ntstatus(r.out.result);
8871 }
8872
8873 struct rpccli_spoolss_ReplyOpenPrinter_state {
8874         struct spoolss_ReplyOpenPrinter orig;
8875         struct spoolss_ReplyOpenPrinter tmp;
8876         TALLOC_CTX *out_mem_ctx;
8877         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
8878 };
8879
8880 static void rpccli_spoolss_ReplyOpenPrinter_done(struct tevent_req *subreq);
8881
8882 struct tevent_req *rpccli_spoolss_ReplyOpenPrinter_send(TALLOC_CTX *mem_ctx,
8883                                                         struct tevent_context *ev,
8884                                                         struct rpc_pipe_client *cli,
8885                                                         const char *_server_name /* [in] [charset(UTF16)] */,
8886                                                         uint32_t _printer_local /* [in]  */,
8887                                                         enum winreg_Type _type /* [in]  */,
8888                                                         uint32_t _bufsize /* [in] [range(0,512)] */,
8889                                                         uint8_t *_buffer /* [in] [unique,size_is(bufsize)] */,
8890                                                         struct policy_handle *_handle /* [out] [ref] */)
8891 {
8892         struct tevent_req *req;
8893         struct rpccli_spoolss_ReplyOpenPrinter_state *state;
8894         struct tevent_req *subreq;
8895
8896         req = tevent_req_create(mem_ctx, &state,
8897                                 struct rpccli_spoolss_ReplyOpenPrinter_state);
8898         if (req == NULL) {
8899                 return NULL;
8900         }
8901         state->out_mem_ctx = NULL;
8902         state->dispatch_recv = cli->dispatch_recv;
8903
8904         /* In parameters */
8905         state->orig.in.server_name = _server_name;
8906         state->orig.in.printer_local = _printer_local;
8907         state->orig.in.type = _type;
8908         state->orig.in.bufsize = _bufsize;
8909         state->orig.in.buffer = _buffer;
8910
8911         /* Out parameters */
8912         state->orig.out.handle = _handle;
8913
8914         /* Result */
8915         ZERO_STRUCT(state->orig.out.result);
8916
8917         state->out_mem_ctx = talloc_named_const(state, 0,
8918                              "rpccli_spoolss_ReplyOpenPrinter_out_memory");
8919         if (tevent_req_nomem(state->out_mem_ctx, req)) {
8920                 return tevent_req_post(req, ev);
8921         }
8922
8923         /* make a temporary copy, that we pass to the dispatch function */
8924         state->tmp = state->orig;
8925
8926         subreq = cli->dispatch_send(state, ev, cli,
8927                                     &ndr_table_spoolss,
8928                                     NDR_SPOOLSS_REPLYOPENPRINTER,
8929                                     &state->tmp);
8930         if (tevent_req_nomem(subreq, req)) {
8931                 return tevent_req_post(req, ev);
8932         }
8933         tevent_req_set_callback(subreq, rpccli_spoolss_ReplyOpenPrinter_done, req);
8934         return req;
8935 }
8936
8937 static void rpccli_spoolss_ReplyOpenPrinter_done(struct tevent_req *subreq)
8938 {
8939         struct tevent_req *req = tevent_req_callback_data(
8940                 subreq, struct tevent_req);
8941         struct rpccli_spoolss_ReplyOpenPrinter_state *state = tevent_req_data(
8942                 req, struct rpccli_spoolss_ReplyOpenPrinter_state);
8943         NTSTATUS status;
8944         TALLOC_CTX *mem_ctx;
8945
8946         if (state->out_mem_ctx) {
8947                 mem_ctx = state->out_mem_ctx;
8948         } else {
8949                 mem_ctx = state;
8950         }
8951
8952         status = state->dispatch_recv(subreq, mem_ctx);
8953         TALLOC_FREE(subreq);
8954         if (!NT_STATUS_IS_OK(status)) {
8955                 tevent_req_nterror(req, status);
8956                 return;
8957         }
8958
8959         /* Copy out parameters */
8960         *state->orig.out.handle = *state->tmp.out.handle;
8961
8962         /* Copy result */
8963         state->orig.out.result = state->tmp.out.result;
8964
8965         /* Reset temporary structure */
8966         ZERO_STRUCT(state->tmp);
8967
8968         tevent_req_done(req);
8969 }
8970
8971 NTSTATUS rpccli_spoolss_ReplyOpenPrinter_recv(struct tevent_req *req,
8972                                               TALLOC_CTX *mem_ctx,
8973                                               WERROR *result)
8974 {
8975         struct rpccli_spoolss_ReplyOpenPrinter_state *state = tevent_req_data(
8976                 req, struct rpccli_spoolss_ReplyOpenPrinter_state);
8977         NTSTATUS status;
8978
8979         if (tevent_req_is_nterror(req, &status)) {
8980                 tevent_req_received(req);
8981                 return status;
8982         }
8983
8984         /* Steal possbile out parameters to the callers context */
8985         talloc_steal(mem_ctx, state->out_mem_ctx);
8986
8987         /* Return result */
8988         *result = state->orig.out.result;
8989
8990         tevent_req_received(req);
8991         return NT_STATUS_OK;
8992 }
8993
8994 NTSTATUS rpccli_spoolss_ReplyOpenPrinter(struct rpc_pipe_client *cli,
8995                                          TALLOC_CTX *mem_ctx,
8996                                          const char *server_name /* [in] [charset(UTF16)] */,
8997                                          uint32_t printer_local /* [in]  */,
8998                                          enum winreg_Type type /* [in]  */,
8999                                          uint32_t bufsize /* [in] [range(0,512)] */,
9000                                          uint8_t *buffer /* [in] [unique,size_is(bufsize)] */,
9001                                          struct policy_handle *handle /* [out] [ref] */,
9002                                          WERROR *werror)
9003 {
9004         struct spoolss_ReplyOpenPrinter r;
9005         NTSTATUS status;
9006
9007         /* In parameters */
9008         r.in.server_name = server_name;
9009         r.in.printer_local = printer_local;
9010         r.in.type = type;
9011         r.in.bufsize = bufsize;
9012         r.in.buffer = buffer;
9013
9014         status = cli->dispatch(cli,
9015                                 mem_ctx,
9016                                 &ndr_table_spoolss,
9017                                 NDR_SPOOLSS_REPLYOPENPRINTER,
9018                                 &r);
9019
9020         if (!NT_STATUS_IS_OK(status)) {
9021                 return status;
9022         }
9023
9024         if (NT_STATUS_IS_ERR(status)) {
9025                 return status;
9026         }
9027
9028         /* Return variables */
9029         *handle = *r.out.handle;
9030
9031         /* Return result */
9032         if (werror) {
9033                 *werror = r.out.result;
9034         }
9035
9036         return werror_to_ntstatus(r.out.result);
9037 }
9038
9039 struct rpccli_spoolss_RouterReplyPrinter_state {
9040         struct spoolss_RouterReplyPrinter orig;
9041         struct spoolss_RouterReplyPrinter tmp;
9042         TALLOC_CTX *out_mem_ctx;
9043         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
9044 };
9045
9046 static void rpccli_spoolss_RouterReplyPrinter_done(struct tevent_req *subreq);
9047
9048 struct tevent_req *rpccli_spoolss_RouterReplyPrinter_send(TALLOC_CTX *mem_ctx,
9049                                                           struct tevent_context *ev,
9050                                                           struct rpc_pipe_client *cli,
9051                                                           struct policy_handle *_handle /* [in] [ref] */,
9052                                                           uint32_t _flags /* [in]  */,
9053                                                           uint32_t _bufsize /* [in] [range(0,512)] */,
9054                                                           uint8_t *_buffer /* [in] [unique,size_is(bufsize)] */)
9055 {
9056         struct tevent_req *req;
9057         struct rpccli_spoolss_RouterReplyPrinter_state *state;
9058         struct tevent_req *subreq;
9059
9060         req = tevent_req_create(mem_ctx, &state,
9061                                 struct rpccli_spoolss_RouterReplyPrinter_state);
9062         if (req == NULL) {
9063                 return NULL;
9064         }
9065         state->out_mem_ctx = NULL;
9066         state->dispatch_recv = cli->dispatch_recv;
9067
9068         /* In parameters */
9069         state->orig.in.handle = _handle;
9070         state->orig.in.flags = _flags;
9071         state->orig.in.bufsize = _bufsize;
9072         state->orig.in.buffer = _buffer;
9073
9074         /* Out parameters */
9075
9076         /* Result */
9077         ZERO_STRUCT(state->orig.out.result);
9078
9079         /* make a temporary copy, that we pass to the dispatch function */
9080         state->tmp = state->orig;
9081
9082         subreq = cli->dispatch_send(state, ev, cli,
9083                                     &ndr_table_spoolss,
9084                                     NDR_SPOOLSS_ROUTERREPLYPRINTER,
9085                                     &state->tmp);
9086         if (tevent_req_nomem(subreq, req)) {
9087                 return tevent_req_post(req, ev);
9088         }
9089         tevent_req_set_callback(subreq, rpccli_spoolss_RouterReplyPrinter_done, req);
9090         return req;
9091 }
9092
9093 static void rpccli_spoolss_RouterReplyPrinter_done(struct tevent_req *subreq)
9094 {
9095         struct tevent_req *req = tevent_req_callback_data(
9096                 subreq, struct tevent_req);
9097         struct rpccli_spoolss_RouterReplyPrinter_state *state = tevent_req_data(
9098                 req, struct rpccli_spoolss_RouterReplyPrinter_state);
9099         NTSTATUS status;
9100         TALLOC_CTX *mem_ctx;
9101
9102         if (state->out_mem_ctx) {
9103                 mem_ctx = state->out_mem_ctx;
9104         } else {
9105                 mem_ctx = state;
9106         }
9107
9108         status = state->dispatch_recv(subreq, mem_ctx);
9109         TALLOC_FREE(subreq);
9110         if (!NT_STATUS_IS_OK(status)) {
9111                 tevent_req_nterror(req, status);
9112                 return;
9113         }
9114
9115         /* Copy out parameters */
9116
9117         /* Copy result */
9118         state->orig.out.result = state->tmp.out.result;
9119
9120         /* Reset temporary structure */
9121         ZERO_STRUCT(state->tmp);
9122
9123         tevent_req_done(req);
9124 }
9125
9126 NTSTATUS rpccli_spoolss_RouterReplyPrinter_recv(struct tevent_req *req,
9127                                                 TALLOC_CTX *mem_ctx,
9128                                                 WERROR *result)
9129 {
9130         struct rpccli_spoolss_RouterReplyPrinter_state *state = tevent_req_data(
9131                 req, struct rpccli_spoolss_RouterReplyPrinter_state);
9132         NTSTATUS status;
9133
9134         if (tevent_req_is_nterror(req, &status)) {
9135                 tevent_req_received(req);
9136                 return status;
9137         }
9138
9139         /* Steal possbile out parameters to the callers context */
9140         talloc_steal(mem_ctx, state->out_mem_ctx);
9141
9142         /* Return result */
9143         *result = state->orig.out.result;
9144
9145         tevent_req_received(req);
9146         return NT_STATUS_OK;
9147 }
9148
9149 NTSTATUS rpccli_spoolss_RouterReplyPrinter(struct rpc_pipe_client *cli,
9150                                            TALLOC_CTX *mem_ctx,
9151                                            struct policy_handle *handle /* [in] [ref] */,
9152                                            uint32_t flags /* [in]  */,
9153                                            uint32_t bufsize /* [in] [range(0,512)] */,
9154                                            uint8_t *buffer /* [in] [unique,size_is(bufsize)] */,
9155                                            WERROR *werror)
9156 {
9157         struct spoolss_RouterReplyPrinter r;
9158         NTSTATUS status;
9159
9160         /* In parameters */
9161         r.in.handle = handle;
9162         r.in.flags = flags;
9163         r.in.bufsize = bufsize;
9164         r.in.buffer = buffer;
9165
9166         status = cli->dispatch(cli,
9167                                 mem_ctx,
9168                                 &ndr_table_spoolss,
9169                                 NDR_SPOOLSS_ROUTERREPLYPRINTER,
9170                                 &r);
9171
9172         if (!NT_STATUS_IS_OK(status)) {
9173                 return status;
9174         }
9175
9176         if (NT_STATUS_IS_ERR(status)) {
9177                 return status;
9178         }
9179
9180         /* Return variables */
9181
9182         /* Return result */
9183         if (werror) {
9184                 *werror = r.out.result;
9185         }
9186
9187         return werror_to_ntstatus(r.out.result);
9188 }
9189
9190 struct rpccli_spoolss_ReplyClosePrinter_state {
9191         struct spoolss_ReplyClosePrinter orig;
9192         struct spoolss_ReplyClosePrinter tmp;
9193         TALLOC_CTX *out_mem_ctx;
9194         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
9195 };
9196
9197 static void rpccli_spoolss_ReplyClosePrinter_done(struct tevent_req *subreq);
9198
9199 struct tevent_req *rpccli_spoolss_ReplyClosePrinter_send(TALLOC_CTX *mem_ctx,
9200                                                          struct tevent_context *ev,
9201                                                          struct rpc_pipe_client *cli,
9202                                                          struct policy_handle *_handle /* [in,out] [ref] */)
9203 {
9204         struct tevent_req *req;
9205         struct rpccli_spoolss_ReplyClosePrinter_state *state;
9206         struct tevent_req *subreq;
9207
9208         req = tevent_req_create(mem_ctx, &state,
9209                                 struct rpccli_spoolss_ReplyClosePrinter_state);
9210         if (req == NULL) {
9211                 return NULL;
9212         }
9213         state->out_mem_ctx = NULL;
9214         state->dispatch_recv = cli->dispatch_recv;
9215
9216         /* In parameters */
9217         state->orig.in.handle = _handle;
9218
9219         /* Out parameters */
9220         state->orig.out.handle = _handle;
9221
9222         /* Result */
9223         ZERO_STRUCT(state->orig.out.result);
9224
9225         state->out_mem_ctx = talloc_named_const(state, 0,
9226                              "rpccli_spoolss_ReplyClosePrinter_out_memory");
9227         if (tevent_req_nomem(state->out_mem_ctx, req)) {
9228                 return tevent_req_post(req, ev);
9229         }
9230
9231         /* make a temporary copy, that we pass to the dispatch function */
9232         state->tmp = state->orig;
9233
9234         subreq = cli->dispatch_send(state, ev, cli,
9235                                     &ndr_table_spoolss,
9236                                     NDR_SPOOLSS_REPLYCLOSEPRINTER,
9237                                     &state->tmp);
9238         if (tevent_req_nomem(subreq, req)) {
9239                 return tevent_req_post(req, ev);
9240         }
9241         tevent_req_set_callback(subreq, rpccli_spoolss_ReplyClosePrinter_done, req);
9242         return req;
9243 }
9244
9245 static void rpccli_spoolss_ReplyClosePrinter_done(struct tevent_req *subreq)
9246 {
9247         struct tevent_req *req = tevent_req_callback_data(
9248                 subreq, struct tevent_req);
9249         struct rpccli_spoolss_ReplyClosePrinter_state *state = tevent_req_data(
9250                 req, struct rpccli_spoolss_ReplyClosePrinter_state);
9251         NTSTATUS status;
9252         TALLOC_CTX *mem_ctx;
9253
9254         if (state->out_mem_ctx) {
9255                 mem_ctx = state->out_mem_ctx;
9256         } else {
9257                 mem_ctx = state;
9258         }
9259
9260         status = state->dispatch_recv(subreq, mem_ctx);
9261         TALLOC_FREE(subreq);
9262         if (!NT_STATUS_IS_OK(status)) {
9263                 tevent_req_nterror(req, status);
9264                 return;
9265         }
9266
9267         /* Copy out parameters */
9268         *state->orig.out.handle = *state->tmp.out.handle;
9269
9270         /* Copy result */
9271         state->orig.out.result = state->tmp.out.result;
9272
9273         /* Reset temporary structure */
9274         ZERO_STRUCT(state->tmp);
9275
9276         tevent_req_done(req);
9277 }
9278
9279 NTSTATUS rpccli_spoolss_ReplyClosePrinter_recv(struct tevent_req *req,
9280                                                TALLOC_CTX *mem_ctx,
9281                                                WERROR *result)
9282 {
9283         struct rpccli_spoolss_ReplyClosePrinter_state *state = tevent_req_data(
9284                 req, struct rpccli_spoolss_ReplyClosePrinter_state);
9285         NTSTATUS status;
9286
9287         if (tevent_req_is_nterror(req, &status)) {
9288                 tevent_req_received(req);
9289                 return status;
9290         }
9291
9292         /* Steal possbile out parameters to the callers context */
9293         talloc_steal(mem_ctx, state->out_mem_ctx);
9294
9295         /* Return result */
9296         *result = state->orig.out.result;
9297
9298         tevent_req_received(req);
9299         return NT_STATUS_OK;
9300 }
9301
9302 NTSTATUS rpccli_spoolss_ReplyClosePrinter(struct rpc_pipe_client *cli,
9303                                           TALLOC_CTX *mem_ctx,
9304                                           struct policy_handle *handle /* [in,out] [ref] */,
9305                                           WERROR *werror)
9306 {
9307         struct spoolss_ReplyClosePrinter r;
9308         NTSTATUS status;
9309
9310         /* In parameters */
9311         r.in.handle = handle;
9312
9313         status = cli->dispatch(cli,
9314                                 mem_ctx,
9315                                 &ndr_table_spoolss,
9316                                 NDR_SPOOLSS_REPLYCLOSEPRINTER,
9317                                 &r);
9318
9319         if (!NT_STATUS_IS_OK(status)) {
9320                 return status;
9321         }
9322
9323         if (NT_STATUS_IS_ERR(status)) {
9324                 return status;
9325         }
9326
9327         /* Return variables */
9328         *handle = *r.out.handle;
9329
9330         /* Return result */
9331         if (werror) {
9332                 *werror = r.out.result;
9333         }
9334
9335         return werror_to_ntstatus(r.out.result);
9336 }
9337
9338 struct rpccli_spoolss_AddPortEx_state {
9339         struct spoolss_AddPortEx orig;
9340         struct spoolss_AddPortEx tmp;
9341         TALLOC_CTX *out_mem_ctx;
9342         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
9343 };
9344
9345 static void rpccli_spoolss_AddPortEx_done(struct tevent_req *subreq);
9346
9347 struct tevent_req *rpccli_spoolss_AddPortEx_send(TALLOC_CTX *mem_ctx,
9348                                                  struct tevent_context *ev,
9349                                                  struct rpc_pipe_client *cli)
9350 {
9351         struct tevent_req *req;
9352         struct rpccli_spoolss_AddPortEx_state *state;
9353         struct tevent_req *subreq;
9354
9355         req = tevent_req_create(mem_ctx, &state,
9356                                 struct rpccli_spoolss_AddPortEx_state);
9357         if (req == NULL) {
9358                 return NULL;
9359         }
9360         state->out_mem_ctx = NULL;
9361         state->dispatch_recv = cli->dispatch_recv;
9362
9363         /* In parameters */
9364
9365         /* Out parameters */
9366
9367         /* Result */
9368         ZERO_STRUCT(state->orig.out.result);
9369
9370         /* make a temporary copy, that we pass to the dispatch function */
9371         state->tmp = state->orig;
9372
9373         subreq = cli->dispatch_send(state, ev, cli,
9374                                     &ndr_table_spoolss,
9375                                     NDR_SPOOLSS_ADDPORTEX,
9376                                     &state->tmp);
9377         if (tevent_req_nomem(subreq, req)) {
9378                 return tevent_req_post(req, ev);
9379         }
9380         tevent_req_set_callback(subreq, rpccli_spoolss_AddPortEx_done, req);
9381         return req;
9382 }
9383
9384 static void rpccli_spoolss_AddPortEx_done(struct tevent_req *subreq)
9385 {
9386         struct tevent_req *req = tevent_req_callback_data(
9387                 subreq, struct tevent_req);
9388         struct rpccli_spoolss_AddPortEx_state *state = tevent_req_data(
9389                 req, struct rpccli_spoolss_AddPortEx_state);
9390         NTSTATUS status;
9391         TALLOC_CTX *mem_ctx;
9392
9393         if (state->out_mem_ctx) {
9394                 mem_ctx = state->out_mem_ctx;
9395         } else {
9396                 mem_ctx = state;
9397         }
9398
9399         status = state->dispatch_recv(subreq, mem_ctx);
9400         TALLOC_FREE(subreq);
9401         if (!NT_STATUS_IS_OK(status)) {
9402                 tevent_req_nterror(req, status);
9403                 return;
9404         }
9405
9406         /* Copy out parameters */
9407
9408         /* Copy result */
9409         state->orig.out.result = state->tmp.out.result;
9410
9411         /* Reset temporary structure */
9412         ZERO_STRUCT(state->tmp);
9413
9414         tevent_req_done(req);
9415 }
9416
9417 NTSTATUS rpccli_spoolss_AddPortEx_recv(struct tevent_req *req,
9418                                        TALLOC_CTX *mem_ctx,
9419                                        WERROR *result)
9420 {
9421         struct rpccli_spoolss_AddPortEx_state *state = tevent_req_data(
9422                 req, struct rpccli_spoolss_AddPortEx_state);
9423         NTSTATUS status;
9424
9425         if (tevent_req_is_nterror(req, &status)) {
9426                 tevent_req_received(req);
9427                 return status;
9428         }
9429
9430         /* Steal possbile out parameters to the callers context */
9431         talloc_steal(mem_ctx, state->out_mem_ctx);
9432
9433         /* Return result */
9434         *result = state->orig.out.result;
9435
9436         tevent_req_received(req);
9437         return NT_STATUS_OK;
9438 }
9439
9440 NTSTATUS rpccli_spoolss_AddPortEx(struct rpc_pipe_client *cli,
9441                                   TALLOC_CTX *mem_ctx,
9442                                   WERROR *werror)
9443 {
9444         struct spoolss_AddPortEx r;
9445         NTSTATUS status;
9446
9447         /* In parameters */
9448
9449         status = cli->dispatch(cli,
9450                                 mem_ctx,
9451                                 &ndr_table_spoolss,
9452                                 NDR_SPOOLSS_ADDPORTEX,
9453                                 &r);
9454
9455         if (!NT_STATUS_IS_OK(status)) {
9456                 return status;
9457         }
9458
9459         if (NT_STATUS_IS_ERR(status)) {
9460                 return status;
9461         }
9462
9463         /* Return variables */
9464
9465         /* Return result */
9466         if (werror) {
9467                 *werror = r.out.result;
9468         }
9469
9470         return werror_to_ntstatus(r.out.result);
9471 }
9472
9473 struct rpccli_spoolss_RouterFindFirstPrinterChangeNotification_state {
9474         struct spoolss_RouterFindFirstPrinterChangeNotification orig;
9475         struct spoolss_RouterFindFirstPrinterChangeNotification tmp;
9476         TALLOC_CTX *out_mem_ctx;
9477         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
9478 };
9479
9480 static void rpccli_spoolss_RouterFindFirstPrinterChangeNotification_done(struct tevent_req *subreq);
9481
9482 struct tevent_req *rpccli_spoolss_RouterFindFirstPrinterChangeNotification_send(TALLOC_CTX *mem_ctx,
9483                                                                                 struct tevent_context *ev,
9484                                                                                 struct rpc_pipe_client *cli)
9485 {
9486         struct tevent_req *req;
9487         struct rpccli_spoolss_RouterFindFirstPrinterChangeNotification_state *state;
9488         struct tevent_req *subreq;
9489
9490         req = tevent_req_create(mem_ctx, &state,
9491                                 struct rpccli_spoolss_RouterFindFirstPrinterChangeNotification_state);
9492         if (req == NULL) {
9493                 return NULL;
9494         }
9495         state->out_mem_ctx = NULL;
9496         state->dispatch_recv = cli->dispatch_recv;
9497
9498         /* In parameters */
9499
9500         /* Out parameters */
9501
9502         /* Result */
9503         ZERO_STRUCT(state->orig.out.result);
9504
9505         /* make a temporary copy, that we pass to the dispatch function */
9506         state->tmp = state->orig;
9507
9508         subreq = cli->dispatch_send(state, ev, cli,
9509                                     &ndr_table_spoolss,
9510                                     NDR_SPOOLSS_ROUTERFINDFIRSTPRINTERCHANGENOTIFICATION,
9511                                     &state->tmp);
9512         if (tevent_req_nomem(subreq, req)) {
9513                 return tevent_req_post(req, ev);
9514         }
9515         tevent_req_set_callback(subreq, rpccli_spoolss_RouterFindFirstPrinterChangeNotification_done, req);
9516         return req;
9517 }
9518
9519 static void rpccli_spoolss_RouterFindFirstPrinterChangeNotification_done(struct tevent_req *subreq)
9520 {
9521         struct tevent_req *req = tevent_req_callback_data(
9522                 subreq, struct tevent_req);
9523         struct rpccli_spoolss_RouterFindFirstPrinterChangeNotification_state *state = tevent_req_data(
9524                 req, struct rpccli_spoolss_RouterFindFirstPrinterChangeNotification_state);
9525         NTSTATUS status;
9526         TALLOC_CTX *mem_ctx;
9527
9528         if (state->out_mem_ctx) {
9529                 mem_ctx = state->out_mem_ctx;
9530         } else {
9531                 mem_ctx = state;
9532         }
9533
9534         status = state->dispatch_recv(subreq, mem_ctx);
9535         TALLOC_FREE(subreq);
9536         if (!NT_STATUS_IS_OK(status)) {
9537                 tevent_req_nterror(req, status);
9538                 return;
9539         }
9540
9541         /* Copy out parameters */
9542
9543         /* Copy result */
9544         state->orig.out.result = state->tmp.out.result;
9545
9546         /* Reset temporary structure */
9547         ZERO_STRUCT(state->tmp);
9548
9549         tevent_req_done(req);
9550 }
9551
9552 NTSTATUS rpccli_spoolss_RouterFindFirstPrinterChangeNotification_recv(struct tevent_req *req,
9553                                                                       TALLOC_CTX *mem_ctx,
9554                                                                       WERROR *result)
9555 {
9556         struct rpccli_spoolss_RouterFindFirstPrinterChangeNotification_state *state = tevent_req_data(
9557                 req, struct rpccli_spoolss_RouterFindFirstPrinterChangeNotification_state);
9558         NTSTATUS status;
9559
9560         if (tevent_req_is_nterror(req, &status)) {
9561                 tevent_req_received(req);
9562                 return status;
9563         }
9564
9565         /* Steal possbile out parameters to the callers context */
9566         talloc_steal(mem_ctx, state->out_mem_ctx);
9567
9568         /* Return result */
9569         *result = state->orig.out.result;
9570
9571         tevent_req_received(req);
9572         return NT_STATUS_OK;
9573 }
9574
9575 NTSTATUS rpccli_spoolss_RouterFindFirstPrinterChangeNotification(struct rpc_pipe_client *cli,
9576                                                                  TALLOC_CTX *mem_ctx,
9577                                                                  WERROR *werror)
9578 {
9579         struct spoolss_RouterFindFirstPrinterChangeNotification r;
9580         NTSTATUS status;
9581
9582         /* In parameters */
9583
9584         status = cli->dispatch(cli,
9585                                 mem_ctx,
9586                                 &ndr_table_spoolss,
9587                                 NDR_SPOOLSS_ROUTERFINDFIRSTPRINTERCHANGENOTIFICATION,
9588                                 &r);
9589
9590         if (!NT_STATUS_IS_OK(status)) {
9591                 return status;
9592         }
9593
9594         if (NT_STATUS_IS_ERR(status)) {
9595                 return status;
9596         }
9597
9598         /* Return variables */
9599
9600         /* Return result */
9601         if (werror) {
9602                 *werror = r.out.result;
9603         }
9604
9605         return werror_to_ntstatus(r.out.result);
9606 }
9607
9608 struct rpccli_spoolss_SpoolerInit_state {
9609         struct spoolss_SpoolerInit orig;
9610         struct spoolss_SpoolerInit tmp;
9611         TALLOC_CTX *out_mem_ctx;
9612         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
9613 };
9614
9615 static void rpccli_spoolss_SpoolerInit_done(struct tevent_req *subreq);
9616
9617 struct tevent_req *rpccli_spoolss_SpoolerInit_send(TALLOC_CTX *mem_ctx,
9618                                                    struct tevent_context *ev,
9619                                                    struct rpc_pipe_client *cli)
9620 {
9621         struct tevent_req *req;
9622         struct rpccli_spoolss_SpoolerInit_state *state;
9623         struct tevent_req *subreq;
9624
9625         req = tevent_req_create(mem_ctx, &state,
9626                                 struct rpccli_spoolss_SpoolerInit_state);
9627         if (req == NULL) {
9628                 return NULL;
9629         }
9630         state->out_mem_ctx = NULL;
9631         state->dispatch_recv = cli->dispatch_recv;
9632
9633         /* In parameters */
9634
9635         /* Out parameters */
9636
9637         /* Result */
9638         ZERO_STRUCT(state->orig.out.result);
9639
9640         /* make a temporary copy, that we pass to the dispatch function */
9641         state->tmp = state->orig;
9642
9643         subreq = cli->dispatch_send(state, ev, cli,
9644                                     &ndr_table_spoolss,
9645                                     NDR_SPOOLSS_SPOOLERINIT,
9646                                     &state->tmp);
9647         if (tevent_req_nomem(subreq, req)) {
9648                 return tevent_req_post(req, ev);
9649         }
9650         tevent_req_set_callback(subreq, rpccli_spoolss_SpoolerInit_done, req);
9651         return req;
9652 }
9653
9654 static void rpccli_spoolss_SpoolerInit_done(struct tevent_req *subreq)
9655 {
9656         struct tevent_req *req = tevent_req_callback_data(
9657                 subreq, struct tevent_req);
9658         struct rpccli_spoolss_SpoolerInit_state *state = tevent_req_data(
9659                 req, struct rpccli_spoolss_SpoolerInit_state);
9660         NTSTATUS status;
9661         TALLOC_CTX *mem_ctx;
9662
9663         if (state->out_mem_ctx) {
9664                 mem_ctx = state->out_mem_ctx;
9665         } else {
9666                 mem_ctx = state;
9667         }
9668
9669         status = state->dispatch_recv(subreq, mem_ctx);
9670         TALLOC_FREE(subreq);
9671         if (!NT_STATUS_IS_OK(status)) {
9672                 tevent_req_nterror(req, status);
9673                 return;
9674         }
9675
9676         /* Copy out parameters */
9677
9678         /* Copy result */
9679         state->orig.out.result = state->tmp.out.result;
9680
9681         /* Reset temporary structure */
9682         ZERO_STRUCT(state->tmp);
9683
9684         tevent_req_done(req);
9685 }
9686
9687 NTSTATUS rpccli_spoolss_SpoolerInit_recv(struct tevent_req *req,
9688                                          TALLOC_CTX *mem_ctx,
9689                                          WERROR *result)
9690 {
9691         struct rpccli_spoolss_SpoolerInit_state *state = tevent_req_data(
9692                 req, struct rpccli_spoolss_SpoolerInit_state);
9693         NTSTATUS status;
9694
9695         if (tevent_req_is_nterror(req, &status)) {
9696                 tevent_req_received(req);
9697                 return status;
9698         }
9699
9700         /* Steal possbile out parameters to the callers context */
9701         talloc_steal(mem_ctx, state->out_mem_ctx);
9702
9703         /* Return result */
9704         *result = state->orig.out.result;
9705
9706         tevent_req_received(req);
9707         return NT_STATUS_OK;
9708 }
9709
9710 NTSTATUS rpccli_spoolss_SpoolerInit(struct rpc_pipe_client *cli,
9711                                     TALLOC_CTX *mem_ctx,
9712                                     WERROR *werror)
9713 {
9714         struct spoolss_SpoolerInit r;
9715         NTSTATUS status;
9716
9717         /* In parameters */
9718
9719         status = cli->dispatch(cli,
9720                                 mem_ctx,
9721                                 &ndr_table_spoolss,
9722                                 NDR_SPOOLSS_SPOOLERINIT,
9723                                 &r);
9724
9725         if (!NT_STATUS_IS_OK(status)) {
9726                 return status;
9727         }
9728
9729         if (NT_STATUS_IS_ERR(status)) {
9730                 return status;
9731         }
9732
9733         /* Return variables */
9734
9735         /* Return result */
9736         if (werror) {
9737                 *werror = r.out.result;
9738         }
9739
9740         return werror_to_ntstatus(r.out.result);
9741 }
9742
9743 struct rpccli_spoolss_ResetPrinterEx_state {
9744         struct spoolss_ResetPrinterEx orig;
9745         struct spoolss_ResetPrinterEx tmp;
9746         TALLOC_CTX *out_mem_ctx;
9747         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
9748 };
9749
9750 static void rpccli_spoolss_ResetPrinterEx_done(struct tevent_req *subreq);
9751
9752 struct tevent_req *rpccli_spoolss_ResetPrinterEx_send(TALLOC_CTX *mem_ctx,
9753                                                       struct tevent_context *ev,
9754                                                       struct rpc_pipe_client *cli)
9755 {
9756         struct tevent_req *req;
9757         struct rpccli_spoolss_ResetPrinterEx_state *state;
9758         struct tevent_req *subreq;
9759
9760         req = tevent_req_create(mem_ctx, &state,
9761                                 struct rpccli_spoolss_ResetPrinterEx_state);
9762         if (req == NULL) {
9763                 return NULL;
9764         }
9765         state->out_mem_ctx = NULL;
9766         state->dispatch_recv = cli->dispatch_recv;
9767
9768         /* In parameters */
9769
9770         /* Out parameters */
9771
9772         /* Result */
9773         ZERO_STRUCT(state->orig.out.result);
9774
9775         /* make a temporary copy, that we pass to the dispatch function */
9776         state->tmp = state->orig;
9777
9778         subreq = cli->dispatch_send(state, ev, cli,
9779                                     &ndr_table_spoolss,
9780                                     NDR_SPOOLSS_RESETPRINTEREX,
9781                                     &state->tmp);
9782         if (tevent_req_nomem(subreq, req)) {
9783                 return tevent_req_post(req, ev);
9784         }
9785         tevent_req_set_callback(subreq, rpccli_spoolss_ResetPrinterEx_done, req);
9786         return req;
9787 }
9788
9789 static void rpccli_spoolss_ResetPrinterEx_done(struct tevent_req *subreq)
9790 {
9791         struct tevent_req *req = tevent_req_callback_data(
9792                 subreq, struct tevent_req);
9793         struct rpccli_spoolss_ResetPrinterEx_state *state = tevent_req_data(
9794                 req, struct rpccli_spoolss_ResetPrinterEx_state);
9795         NTSTATUS status;
9796         TALLOC_CTX *mem_ctx;
9797
9798         if (state->out_mem_ctx) {
9799                 mem_ctx = state->out_mem_ctx;
9800         } else {
9801                 mem_ctx = state;
9802         }
9803
9804         status = state->dispatch_recv(subreq, mem_ctx);
9805         TALLOC_FREE(subreq);
9806         if (!NT_STATUS_IS_OK(status)) {
9807                 tevent_req_nterror(req, status);
9808                 return;
9809         }
9810
9811         /* Copy out parameters */
9812
9813         /* Copy result */
9814         state->orig.out.result = state->tmp.out.result;
9815
9816         /* Reset temporary structure */
9817         ZERO_STRUCT(state->tmp);
9818
9819         tevent_req_done(req);
9820 }
9821
9822 NTSTATUS rpccli_spoolss_ResetPrinterEx_recv(struct tevent_req *req,
9823                                             TALLOC_CTX *mem_ctx,
9824                                             WERROR *result)
9825 {
9826         struct rpccli_spoolss_ResetPrinterEx_state *state = tevent_req_data(
9827                 req, struct rpccli_spoolss_ResetPrinterEx_state);
9828         NTSTATUS status;
9829
9830         if (tevent_req_is_nterror(req, &status)) {
9831                 tevent_req_received(req);
9832                 return status;
9833         }
9834
9835         /* Steal possbile out parameters to the callers context */
9836         talloc_steal(mem_ctx, state->out_mem_ctx);
9837
9838         /* Return result */
9839         *result = state->orig.out.result;
9840
9841         tevent_req_received(req);
9842         return NT_STATUS_OK;
9843 }
9844
9845 NTSTATUS rpccli_spoolss_ResetPrinterEx(struct rpc_pipe_client *cli,
9846                                        TALLOC_CTX *mem_ctx,
9847                                        WERROR *werror)
9848 {
9849         struct spoolss_ResetPrinterEx r;
9850         NTSTATUS status;
9851
9852         /* In parameters */
9853
9854         status = cli->dispatch(cli,
9855                                 mem_ctx,
9856                                 &ndr_table_spoolss,
9857                                 NDR_SPOOLSS_RESETPRINTEREX,
9858                                 &r);
9859
9860         if (!NT_STATUS_IS_OK(status)) {
9861                 return status;
9862         }
9863
9864         if (NT_STATUS_IS_ERR(status)) {
9865                 return status;
9866         }
9867
9868         /* Return variables */
9869
9870         /* Return result */
9871         if (werror) {
9872                 *werror = r.out.result;
9873         }
9874
9875         return werror_to_ntstatus(r.out.result);
9876 }
9877
9878 struct rpccli_spoolss_RemoteFindFirstPrinterChangeNotifyEx_state {
9879         struct spoolss_RemoteFindFirstPrinterChangeNotifyEx orig;
9880         struct spoolss_RemoteFindFirstPrinterChangeNotifyEx tmp;
9881         TALLOC_CTX *out_mem_ctx;
9882         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
9883 };
9884
9885 static void rpccli_spoolss_RemoteFindFirstPrinterChangeNotifyEx_done(struct tevent_req *subreq);
9886
9887 struct tevent_req *rpccli_spoolss_RemoteFindFirstPrinterChangeNotifyEx_send(TALLOC_CTX *mem_ctx,
9888                                                                             struct tevent_context *ev,
9889                                                                             struct rpc_pipe_client *cli,
9890                                                                             struct policy_handle *_handle /* [in] [ref] */,
9891                                                                             uint32_t _flags /* [in]  */,
9892                                                                             uint32_t _options /* [in]  */,
9893                                                                             const char *_local_machine /* [in] [unique,charset(UTF16)] */,
9894                                                                             uint32_t _printer_local /* [in]  */,
9895                                                                             struct spoolss_NotifyOption *_notify_options /* [in] [unique] */)
9896 {
9897         struct tevent_req *req;
9898         struct rpccli_spoolss_RemoteFindFirstPrinterChangeNotifyEx_state *state;
9899         struct tevent_req *subreq;
9900
9901         req = tevent_req_create(mem_ctx, &state,
9902                                 struct rpccli_spoolss_RemoteFindFirstPrinterChangeNotifyEx_state);
9903         if (req == NULL) {
9904                 return NULL;
9905         }
9906         state->out_mem_ctx = NULL;
9907         state->dispatch_recv = cli->dispatch_recv;
9908
9909         /* In parameters */
9910         state->orig.in.handle = _handle;
9911         state->orig.in.flags = _flags;
9912         state->orig.in.options = _options;
9913         state->orig.in.local_machine = _local_machine;
9914         state->orig.in.printer_local = _printer_local;
9915         state->orig.in.notify_options = _notify_options;
9916
9917         /* Out parameters */
9918
9919         /* Result */
9920         ZERO_STRUCT(state->orig.out.result);
9921
9922         /* make a temporary copy, that we pass to the dispatch function */
9923         state->tmp = state->orig;
9924
9925         subreq = cli->dispatch_send(state, ev, cli,
9926                                     &ndr_table_spoolss,
9927                                     NDR_SPOOLSS_REMOTEFINDFIRSTPRINTERCHANGENOTIFYEX,
9928                                     &state->tmp);
9929         if (tevent_req_nomem(subreq, req)) {
9930                 return tevent_req_post(req, ev);
9931         }
9932         tevent_req_set_callback(subreq, rpccli_spoolss_RemoteFindFirstPrinterChangeNotifyEx_done, req);
9933         return req;
9934 }
9935
9936 static void rpccli_spoolss_RemoteFindFirstPrinterChangeNotifyEx_done(struct tevent_req *subreq)
9937 {
9938         struct tevent_req *req = tevent_req_callback_data(
9939                 subreq, struct tevent_req);
9940         struct rpccli_spoolss_RemoteFindFirstPrinterChangeNotifyEx_state *state = tevent_req_data(
9941                 req, struct rpccli_spoolss_RemoteFindFirstPrinterChangeNotifyEx_state);
9942         NTSTATUS status;
9943         TALLOC_CTX *mem_ctx;
9944
9945         if (state->out_mem_ctx) {
9946                 mem_ctx = state->out_mem_ctx;
9947         } else {
9948                 mem_ctx = state;
9949         }
9950
9951         status = state->dispatch_recv(subreq, mem_ctx);
9952         TALLOC_FREE(subreq);
9953         if (!NT_STATUS_IS_OK(status)) {
9954                 tevent_req_nterror(req, status);
9955                 return;
9956         }
9957
9958         /* Copy out parameters */
9959
9960         /* Copy result */
9961         state->orig.out.result = state->tmp.out.result;
9962
9963         /* Reset temporary structure */
9964         ZERO_STRUCT(state->tmp);
9965
9966         tevent_req_done(req);
9967 }
9968
9969 NTSTATUS rpccli_spoolss_RemoteFindFirstPrinterChangeNotifyEx_recv(struct tevent_req *req,
9970                                                                   TALLOC_CTX *mem_ctx,
9971                                                                   WERROR *result)
9972 {
9973         struct rpccli_spoolss_RemoteFindFirstPrinterChangeNotifyEx_state *state = tevent_req_data(
9974                 req, struct rpccli_spoolss_RemoteFindFirstPrinterChangeNotifyEx_state);
9975         NTSTATUS status;
9976
9977         if (tevent_req_is_nterror(req, &status)) {
9978                 tevent_req_received(req);
9979                 return status;
9980         }
9981
9982         /* Steal possbile out parameters to the callers context */
9983         talloc_steal(mem_ctx, state->out_mem_ctx);
9984
9985         /* Return result */
9986         *result = state->orig.out.result;
9987
9988         tevent_req_received(req);
9989         return NT_STATUS_OK;
9990 }
9991
9992 NTSTATUS rpccli_spoolss_RemoteFindFirstPrinterChangeNotifyEx(struct rpc_pipe_client *cli,
9993                                                              TALLOC_CTX *mem_ctx,
9994                                                              struct policy_handle *handle /* [in] [ref] */,
9995                                                              uint32_t flags /* [in]  */,
9996                                                              uint32_t options /* [in]  */,
9997                                                              const char *local_machine /* [in] [unique,charset(UTF16)] */,
9998                                                              uint32_t printer_local /* [in]  */,
9999                                                              struct spoolss_NotifyOption *notify_options /* [in] [unique] */,
10000                                                              WERROR *werror)
10001 {
10002         struct spoolss_RemoteFindFirstPrinterChangeNotifyEx r;
10003         NTSTATUS status;
10004
10005         /* In parameters */
10006         r.in.handle = handle;
10007         r.in.flags = flags;
10008         r.in.options = options;
10009         r.in.local_machine = local_machine;
10010         r.in.printer_local = printer_local;
10011         r.in.notify_options = notify_options;
10012
10013         status = cli->dispatch(cli,
10014                                 mem_ctx,
10015                                 &ndr_table_spoolss,
10016                                 NDR_SPOOLSS_REMOTEFINDFIRSTPRINTERCHANGENOTIFYEX,
10017                                 &r);
10018
10019         if (!NT_STATUS_IS_OK(status)) {
10020                 return status;
10021         }
10022
10023         if (NT_STATUS_IS_ERR(status)) {
10024                 return status;
10025         }
10026
10027         /* Return variables */
10028
10029         /* Return result */
10030         if (werror) {
10031                 *werror = r.out.result;
10032         }
10033
10034         return werror_to_ntstatus(r.out.result);
10035 }
10036
10037 struct rpccli_spoolss_RouterReplyPrinterEx_state {
10038         struct spoolss_RouterReplyPrinterEx orig;
10039         struct spoolss_RouterReplyPrinterEx tmp;
10040         TALLOC_CTX *out_mem_ctx;
10041         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
10042 };
10043
10044 static void rpccli_spoolss_RouterReplyPrinterEx_done(struct tevent_req *subreq);
10045
10046 struct tevent_req *rpccli_spoolss_RouterReplyPrinterEx_send(TALLOC_CTX *mem_ctx,
10047                                                             struct tevent_context *ev,
10048                                                             struct rpc_pipe_client *cli,
10049                                                             struct policy_handle *_handle /* [in] [ref] */,
10050                                                             uint32_t _color /* [in]  */,
10051                                                             uint32_t _flags /* [in]  */,
10052                                                             uint32_t *_reply_result /* [out] [ref] */,
10053                                                             uint32_t _reply_type /* [in]  */,
10054                                                             union spoolss_ReplyPrinterInfo _info /* [in] [switch_is(reply_type)] */)
10055 {
10056         struct tevent_req *req;
10057         struct rpccli_spoolss_RouterReplyPrinterEx_state *state;
10058         struct tevent_req *subreq;
10059
10060         req = tevent_req_create(mem_ctx, &state,
10061                                 struct rpccli_spoolss_RouterReplyPrinterEx_state);
10062         if (req == NULL) {
10063                 return NULL;
10064         }
10065         state->out_mem_ctx = NULL;
10066         state->dispatch_recv = cli->dispatch_recv;
10067
10068         /* In parameters */
10069         state->orig.in.handle = _handle;
10070         state->orig.in.color = _color;
10071         state->orig.in.flags = _flags;
10072         state->orig.in.reply_type = _reply_type;
10073         state->orig.in.info = _info;
10074
10075         /* Out parameters */
10076         state->orig.out.reply_result = _reply_result;
10077
10078         /* Result */
10079         ZERO_STRUCT(state->orig.out.result);
10080
10081         state->out_mem_ctx = talloc_named_const(state, 0,
10082                              "rpccli_spoolss_RouterReplyPrinterEx_out_memory");
10083         if (tevent_req_nomem(state->out_mem_ctx, req)) {
10084                 return tevent_req_post(req, ev);
10085         }
10086
10087         /* make a temporary copy, that we pass to the dispatch function */
10088         state->tmp = state->orig;
10089
10090         subreq = cli->dispatch_send(state, ev, cli,
10091                                     &ndr_table_spoolss,
10092                                     NDR_SPOOLSS_ROUTERREPLYPRINTEREX,
10093                                     &state->tmp);
10094         if (tevent_req_nomem(subreq, req)) {
10095                 return tevent_req_post(req, ev);
10096         }
10097         tevent_req_set_callback(subreq, rpccli_spoolss_RouterReplyPrinterEx_done, req);
10098         return req;
10099 }
10100
10101 static void rpccli_spoolss_RouterReplyPrinterEx_done(struct tevent_req *subreq)
10102 {
10103         struct tevent_req *req = tevent_req_callback_data(
10104                 subreq, struct tevent_req);
10105         struct rpccli_spoolss_RouterReplyPrinterEx_state *state = tevent_req_data(
10106                 req, struct rpccli_spoolss_RouterReplyPrinterEx_state);
10107         NTSTATUS status;
10108         TALLOC_CTX *mem_ctx;
10109
10110         if (state->out_mem_ctx) {
10111                 mem_ctx = state->out_mem_ctx;
10112         } else {
10113                 mem_ctx = state;
10114         }
10115
10116         status = state->dispatch_recv(subreq, mem_ctx);
10117         TALLOC_FREE(subreq);
10118         if (!NT_STATUS_IS_OK(status)) {
10119                 tevent_req_nterror(req, status);
10120                 return;
10121         }
10122
10123         /* Copy out parameters */
10124         *state->orig.out.reply_result = *state->tmp.out.reply_result;
10125
10126         /* Copy result */
10127         state->orig.out.result = state->tmp.out.result;
10128
10129         /* Reset temporary structure */
10130         ZERO_STRUCT(state->tmp);
10131
10132         tevent_req_done(req);
10133 }
10134
10135 NTSTATUS rpccli_spoolss_RouterReplyPrinterEx_recv(struct tevent_req *req,
10136                                                   TALLOC_CTX *mem_ctx,
10137                                                   WERROR *result)
10138 {
10139         struct rpccli_spoolss_RouterReplyPrinterEx_state *state = tevent_req_data(
10140                 req, struct rpccli_spoolss_RouterReplyPrinterEx_state);
10141         NTSTATUS status;
10142
10143         if (tevent_req_is_nterror(req, &status)) {
10144                 tevent_req_received(req);
10145                 return status;
10146         }
10147
10148         /* Steal possbile out parameters to the callers context */
10149         talloc_steal(mem_ctx, state->out_mem_ctx);
10150
10151         /* Return result */
10152         *result = state->orig.out.result;
10153
10154         tevent_req_received(req);
10155         return NT_STATUS_OK;
10156 }
10157
10158 NTSTATUS rpccli_spoolss_RouterReplyPrinterEx(struct rpc_pipe_client *cli,
10159                                              TALLOC_CTX *mem_ctx,
10160                                              struct policy_handle *handle /* [in] [ref] */,
10161                                              uint32_t color /* [in]  */,
10162                                              uint32_t flags /* [in]  */,
10163                                              uint32_t *reply_result /* [out] [ref] */,
10164                                              uint32_t reply_type /* [in]  */,
10165                                              union spoolss_ReplyPrinterInfo info /* [in] [switch_is(reply_type)] */,
10166                                              WERROR *werror)
10167 {
10168         struct spoolss_RouterReplyPrinterEx r;
10169         NTSTATUS status;
10170
10171         /* In parameters */
10172         r.in.handle = handle;
10173         r.in.color = color;
10174         r.in.flags = flags;
10175         r.in.reply_type = reply_type;
10176         r.in.info = info;
10177
10178         status = cli->dispatch(cli,
10179                                 mem_ctx,
10180                                 &ndr_table_spoolss,
10181                                 NDR_SPOOLSS_ROUTERREPLYPRINTEREX,
10182                                 &r);
10183
10184         if (!NT_STATUS_IS_OK(status)) {
10185                 return status;
10186         }
10187
10188         if (NT_STATUS_IS_ERR(status)) {
10189                 return status;
10190         }
10191
10192         /* Return variables */
10193         *reply_result = *r.out.reply_result;
10194
10195         /* Return result */
10196         if (werror) {
10197                 *werror = r.out.result;
10198         }
10199
10200         return werror_to_ntstatus(r.out.result);
10201 }
10202
10203 struct rpccli_spoolss_RouterRefreshPrinterChangeNotify_state {
10204         struct spoolss_RouterRefreshPrinterChangeNotify orig;
10205         struct spoolss_RouterRefreshPrinterChangeNotify tmp;
10206         TALLOC_CTX *out_mem_ctx;
10207         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
10208 };
10209
10210 static void rpccli_spoolss_RouterRefreshPrinterChangeNotify_done(struct tevent_req *subreq);
10211
10212 struct tevent_req *rpccli_spoolss_RouterRefreshPrinterChangeNotify_send(TALLOC_CTX *mem_ctx,
10213                                                                         struct tevent_context *ev,
10214                                                                         struct rpc_pipe_client *cli,
10215                                                                         struct policy_handle *_handle /* [in] [ref] */,
10216                                                                         uint32_t _change_low /* [in]  */,
10217                                                                         struct spoolss_NotifyOption *_options /* [in] [unique] */,
10218                                                                         struct spoolss_NotifyInfo **_info /* [out] [ref] */)
10219 {
10220         struct tevent_req *req;
10221         struct rpccli_spoolss_RouterRefreshPrinterChangeNotify_state *state;
10222         struct tevent_req *subreq;
10223
10224         req = tevent_req_create(mem_ctx, &state,
10225                                 struct rpccli_spoolss_RouterRefreshPrinterChangeNotify_state);
10226         if (req == NULL) {
10227                 return NULL;
10228         }
10229         state->out_mem_ctx = NULL;
10230         state->dispatch_recv = cli->dispatch_recv;
10231
10232         /* In parameters */
10233         state->orig.in.handle = _handle;
10234         state->orig.in.change_low = _change_low;
10235         state->orig.in.options = _options;
10236
10237         /* Out parameters */
10238         state->orig.out.info = _info;
10239
10240         /* Result */
10241         ZERO_STRUCT(state->orig.out.result);
10242
10243         state->out_mem_ctx = talloc_named_const(state, 0,
10244                              "rpccli_spoolss_RouterRefreshPrinterChangeNotify_out_memory");
10245         if (tevent_req_nomem(state->out_mem_ctx, req)) {
10246                 return tevent_req_post(req, ev);
10247         }
10248
10249         /* make a temporary copy, that we pass to the dispatch function */
10250         state->tmp = state->orig;
10251
10252         subreq = cli->dispatch_send(state, ev, cli,
10253                                     &ndr_table_spoolss,
10254                                     NDR_SPOOLSS_ROUTERREFRESHPRINTERCHANGENOTIFY,
10255                                     &state->tmp);
10256         if (tevent_req_nomem(subreq, req)) {
10257                 return tevent_req_post(req, ev);
10258         }
10259         tevent_req_set_callback(subreq, rpccli_spoolss_RouterRefreshPrinterChangeNotify_done, req);
10260         return req;
10261 }
10262
10263 static void rpccli_spoolss_RouterRefreshPrinterChangeNotify_done(struct tevent_req *subreq)
10264 {
10265         struct tevent_req *req = tevent_req_callback_data(
10266                 subreq, struct tevent_req);
10267         struct rpccli_spoolss_RouterRefreshPrinterChangeNotify_state *state = tevent_req_data(
10268                 req, struct rpccli_spoolss_RouterRefreshPrinterChangeNotify_state);
10269         NTSTATUS status;
10270         TALLOC_CTX *mem_ctx;
10271
10272         if (state->out_mem_ctx) {
10273                 mem_ctx = state->out_mem_ctx;
10274         } else {
10275                 mem_ctx = state;
10276         }
10277
10278         status = state->dispatch_recv(subreq, mem_ctx);
10279         TALLOC_FREE(subreq);
10280         if (!NT_STATUS_IS_OK(status)) {
10281                 tevent_req_nterror(req, status);
10282                 return;
10283         }
10284
10285         /* Copy out parameters */
10286         *state->orig.out.info = *state->tmp.out.info;
10287
10288         /* Copy result */
10289         state->orig.out.result = state->tmp.out.result;
10290
10291         /* Reset temporary structure */
10292         ZERO_STRUCT(state->tmp);
10293
10294         tevent_req_done(req);
10295 }
10296
10297 NTSTATUS rpccli_spoolss_RouterRefreshPrinterChangeNotify_recv(struct tevent_req *req,
10298                                                               TALLOC_CTX *mem_ctx,
10299                                                               WERROR *result)
10300 {
10301         struct rpccli_spoolss_RouterRefreshPrinterChangeNotify_state *state = tevent_req_data(
10302                 req, struct rpccli_spoolss_RouterRefreshPrinterChangeNotify_state);
10303         NTSTATUS status;
10304
10305         if (tevent_req_is_nterror(req, &status)) {
10306                 tevent_req_received(req);
10307                 return status;
10308         }
10309
10310         /* Steal possbile out parameters to the callers context */
10311         talloc_steal(mem_ctx, state->out_mem_ctx);
10312
10313         /* Return result */
10314         *result = state->orig.out.result;
10315
10316         tevent_req_received(req);
10317         return NT_STATUS_OK;
10318 }
10319
10320 NTSTATUS rpccli_spoolss_RouterRefreshPrinterChangeNotify(struct rpc_pipe_client *cli,
10321                                                          TALLOC_CTX *mem_ctx,
10322                                                          struct policy_handle *handle /* [in] [ref] */,
10323                                                          uint32_t change_low /* [in]  */,
10324                                                          struct spoolss_NotifyOption *options /* [in] [unique] */,
10325                                                          struct spoolss_NotifyInfo **info /* [out] [ref] */,
10326                                                          WERROR *werror)
10327 {
10328         struct spoolss_RouterRefreshPrinterChangeNotify r;
10329         NTSTATUS status;
10330
10331         /* In parameters */
10332         r.in.handle = handle;
10333         r.in.change_low = change_low;
10334         r.in.options = options;
10335
10336         status = cli->dispatch(cli,
10337                                 mem_ctx,
10338                                 &ndr_table_spoolss,
10339                                 NDR_SPOOLSS_ROUTERREFRESHPRINTERCHANGENOTIFY,
10340                                 &r);
10341
10342         if (!NT_STATUS_IS_OK(status)) {
10343                 return status;
10344         }
10345
10346         if (NT_STATUS_IS_ERR(status)) {
10347                 return status;
10348         }
10349
10350         /* Return variables */
10351         *info = *r.out.info;
10352
10353         /* Return result */
10354         if (werror) {
10355                 *werror = r.out.result;
10356         }
10357
10358         return werror_to_ntstatus(r.out.result);
10359 }
10360
10361 struct rpccli_spoolss_44_state {
10362         struct spoolss_44 orig;
10363         struct spoolss_44 tmp;
10364         TALLOC_CTX *out_mem_ctx;
10365         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
10366 };
10367
10368 static void rpccli_spoolss_44_done(struct tevent_req *subreq);
10369
10370 struct tevent_req *rpccli_spoolss_44_send(TALLOC_CTX *mem_ctx,
10371                                           struct tevent_context *ev,
10372                                           struct rpc_pipe_client *cli)
10373 {
10374         struct tevent_req *req;
10375         struct rpccli_spoolss_44_state *state;
10376         struct tevent_req *subreq;
10377
10378         req = tevent_req_create(mem_ctx, &state,
10379                                 struct rpccli_spoolss_44_state);
10380         if (req == NULL) {
10381                 return NULL;
10382         }
10383         state->out_mem_ctx = NULL;
10384         state->dispatch_recv = cli->dispatch_recv;
10385
10386         /* In parameters */
10387
10388         /* Out parameters */
10389
10390         /* Result */
10391         ZERO_STRUCT(state->orig.out.result);
10392
10393         /* make a temporary copy, that we pass to the dispatch function */
10394         state->tmp = state->orig;
10395
10396         subreq = cli->dispatch_send(state, ev, cli,
10397                                     &ndr_table_spoolss,
10398                                     NDR_SPOOLSS_44,
10399                                     &state->tmp);
10400         if (tevent_req_nomem(subreq, req)) {
10401                 return tevent_req_post(req, ev);
10402         }
10403         tevent_req_set_callback(subreq, rpccli_spoolss_44_done, req);
10404         return req;
10405 }
10406
10407 static void rpccli_spoolss_44_done(struct tevent_req *subreq)
10408 {
10409         struct tevent_req *req = tevent_req_callback_data(
10410                 subreq, struct tevent_req);
10411         struct rpccli_spoolss_44_state *state = tevent_req_data(
10412                 req, struct rpccli_spoolss_44_state);
10413         NTSTATUS status;
10414         TALLOC_CTX *mem_ctx;
10415
10416         if (state->out_mem_ctx) {
10417                 mem_ctx = state->out_mem_ctx;
10418         } else {
10419                 mem_ctx = state;
10420         }
10421
10422         status = state->dispatch_recv(subreq, mem_ctx);
10423         TALLOC_FREE(subreq);
10424         if (!NT_STATUS_IS_OK(status)) {
10425                 tevent_req_nterror(req, status);
10426                 return;
10427         }
10428
10429         /* Copy out parameters */
10430
10431         /* Copy result */
10432         state->orig.out.result = state->tmp.out.result;
10433
10434         /* Reset temporary structure */
10435         ZERO_STRUCT(state->tmp);
10436
10437         tevent_req_done(req);
10438 }
10439
10440 NTSTATUS rpccli_spoolss_44_recv(struct tevent_req *req,
10441                                 TALLOC_CTX *mem_ctx,
10442                                 WERROR *result)
10443 {
10444         struct rpccli_spoolss_44_state *state = tevent_req_data(
10445                 req, struct rpccli_spoolss_44_state);
10446         NTSTATUS status;
10447
10448         if (tevent_req_is_nterror(req, &status)) {
10449                 tevent_req_received(req);
10450                 return status;
10451         }
10452
10453         /* Steal possbile out parameters to the callers context */
10454         talloc_steal(mem_ctx, state->out_mem_ctx);
10455
10456         /* Return result */
10457         *result = state->orig.out.result;
10458
10459         tevent_req_received(req);
10460         return NT_STATUS_OK;
10461 }
10462
10463 NTSTATUS rpccli_spoolss_44(struct rpc_pipe_client *cli,
10464                            TALLOC_CTX *mem_ctx,
10465                            WERROR *werror)
10466 {
10467         struct spoolss_44 r;
10468         NTSTATUS status;
10469
10470         /* In parameters */
10471
10472         status = cli->dispatch(cli,
10473                                 mem_ctx,
10474                                 &ndr_table_spoolss,
10475                                 NDR_SPOOLSS_44,
10476                                 &r);
10477
10478         if (!NT_STATUS_IS_OK(status)) {
10479                 return status;
10480         }
10481
10482         if (NT_STATUS_IS_ERR(status)) {
10483                 return status;
10484         }
10485
10486         /* Return variables */
10487
10488         /* Return result */
10489         if (werror) {
10490                 *werror = r.out.result;
10491         }
10492
10493         return werror_to_ntstatus(r.out.result);
10494 }
10495
10496 struct rpccli_spoolss_OpenPrinterEx_state {
10497         struct spoolss_OpenPrinterEx orig;
10498         struct spoolss_OpenPrinterEx tmp;
10499         TALLOC_CTX *out_mem_ctx;
10500         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
10501 };
10502
10503 static void rpccli_spoolss_OpenPrinterEx_done(struct tevent_req *subreq);
10504
10505 struct tevent_req *rpccli_spoolss_OpenPrinterEx_send(TALLOC_CTX *mem_ctx,
10506                                                      struct tevent_context *ev,
10507                                                      struct rpc_pipe_client *cli,
10508                                                      const char *_printername /* [in] [unique,charset(UTF16)] */,
10509                                                      const char *_datatype /* [in] [unique,charset(UTF16)] */,
10510                                                      struct spoolss_DevmodeContainer _devmode_ctr /* [in]  */,
10511                                                      uint32_t _access_mask /* [in]  */,
10512                                                      uint32_t _level /* [in]  */,
10513                                                      union spoolss_UserLevel _userlevel /* [in] [switch_is(level)] */,
10514                                                      struct policy_handle *_handle /* [out] [ref] */)
10515 {
10516         struct tevent_req *req;
10517         struct rpccli_spoolss_OpenPrinterEx_state *state;
10518         struct tevent_req *subreq;
10519
10520         req = tevent_req_create(mem_ctx, &state,
10521                                 struct rpccli_spoolss_OpenPrinterEx_state);
10522         if (req == NULL) {
10523                 return NULL;
10524         }
10525         state->out_mem_ctx = NULL;
10526         state->dispatch_recv = cli->dispatch_recv;
10527
10528         /* In parameters */
10529         state->orig.in.printername = _printername;
10530         state->orig.in.datatype = _datatype;
10531         state->orig.in.devmode_ctr = _devmode_ctr;
10532         state->orig.in.access_mask = _access_mask;
10533         state->orig.in.level = _level;
10534         state->orig.in.userlevel = _userlevel;
10535
10536         /* Out parameters */
10537         state->orig.out.handle = _handle;
10538
10539         /* Result */
10540         ZERO_STRUCT(state->orig.out.result);
10541
10542         state->out_mem_ctx = talloc_named_const(state, 0,
10543                              "rpccli_spoolss_OpenPrinterEx_out_memory");
10544         if (tevent_req_nomem(state->out_mem_ctx, req)) {
10545                 return tevent_req_post(req, ev);
10546         }
10547
10548         /* make a temporary copy, that we pass to the dispatch function */
10549         state->tmp = state->orig;
10550
10551         subreq = cli->dispatch_send(state, ev, cli,
10552                                     &ndr_table_spoolss,
10553                                     NDR_SPOOLSS_OPENPRINTEREX,
10554                                     &state->tmp);
10555         if (tevent_req_nomem(subreq, req)) {
10556                 return tevent_req_post(req, ev);
10557         }
10558         tevent_req_set_callback(subreq, rpccli_spoolss_OpenPrinterEx_done, req);
10559         return req;
10560 }
10561
10562 static void rpccli_spoolss_OpenPrinterEx_done(struct tevent_req *subreq)
10563 {
10564         struct tevent_req *req = tevent_req_callback_data(
10565                 subreq, struct tevent_req);
10566         struct rpccli_spoolss_OpenPrinterEx_state *state = tevent_req_data(
10567                 req, struct rpccli_spoolss_OpenPrinterEx_state);
10568         NTSTATUS status;
10569         TALLOC_CTX *mem_ctx;
10570
10571         if (state->out_mem_ctx) {
10572                 mem_ctx = state->out_mem_ctx;
10573         } else {
10574                 mem_ctx = state;
10575         }
10576
10577         status = state->dispatch_recv(subreq, mem_ctx);
10578         TALLOC_FREE(subreq);
10579         if (!NT_STATUS_IS_OK(status)) {
10580                 tevent_req_nterror(req, status);
10581                 return;
10582         }
10583
10584         /* Copy out parameters */
10585         *state->orig.out.handle = *state->tmp.out.handle;
10586
10587         /* Copy result */
10588         state->orig.out.result = state->tmp.out.result;
10589
10590         /* Reset temporary structure */
10591         ZERO_STRUCT(state->tmp);
10592
10593         tevent_req_done(req);
10594 }
10595
10596 NTSTATUS rpccli_spoolss_OpenPrinterEx_recv(struct tevent_req *req,
10597                                            TALLOC_CTX *mem_ctx,
10598                                            WERROR *result)
10599 {
10600         struct rpccli_spoolss_OpenPrinterEx_state *state = tevent_req_data(
10601                 req, struct rpccli_spoolss_OpenPrinterEx_state);
10602         NTSTATUS status;
10603
10604         if (tevent_req_is_nterror(req, &status)) {
10605                 tevent_req_received(req);
10606                 return status;
10607         }
10608
10609         /* Steal possbile out parameters to the callers context */
10610         talloc_steal(mem_ctx, state->out_mem_ctx);
10611
10612         /* Return result */
10613         *result = state->orig.out.result;
10614
10615         tevent_req_received(req);
10616         return NT_STATUS_OK;
10617 }
10618
10619 NTSTATUS rpccli_spoolss_OpenPrinterEx(struct rpc_pipe_client *cli,
10620                                       TALLOC_CTX *mem_ctx,
10621                                       const char *printername /* [in] [unique,charset(UTF16)] */,
10622                                       const char *datatype /* [in] [unique,charset(UTF16)] */,
10623                                       struct spoolss_DevmodeContainer devmode_ctr /* [in]  */,
10624                                       uint32_t access_mask /* [in]  */,
10625                                       uint32_t level /* [in]  */,
10626                                       union spoolss_UserLevel userlevel /* [in] [switch_is(level)] */,
10627                                       struct policy_handle *handle /* [out] [ref] */,
10628                                       WERROR *werror)
10629 {
10630         struct spoolss_OpenPrinterEx r;
10631         NTSTATUS status;
10632
10633         /* In parameters */
10634         r.in.printername = printername;
10635         r.in.datatype = datatype;
10636         r.in.devmode_ctr = devmode_ctr;
10637         r.in.access_mask = access_mask;
10638         r.in.level = level;
10639         r.in.userlevel = userlevel;
10640
10641         status = cli->dispatch(cli,
10642                                 mem_ctx,
10643                                 &ndr_table_spoolss,
10644                                 NDR_SPOOLSS_OPENPRINTEREX,
10645                                 &r);
10646
10647         if (!NT_STATUS_IS_OK(status)) {
10648                 return status;
10649         }
10650
10651         if (NT_STATUS_IS_ERR(status)) {
10652                 return status;
10653         }
10654
10655         /* Return variables */
10656         *handle = *r.out.handle;
10657
10658         /* Return result */
10659         if (werror) {
10660                 *werror = r.out.result;
10661         }
10662
10663         return werror_to_ntstatus(r.out.result);
10664 }
10665
10666 struct rpccli_spoolss_AddPrinterEx_state {
10667         struct spoolss_AddPrinterEx orig;
10668         struct spoolss_AddPrinterEx tmp;
10669         TALLOC_CTX *out_mem_ctx;
10670         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
10671 };
10672
10673 static void rpccli_spoolss_AddPrinterEx_done(struct tevent_req *subreq);
10674
10675 struct tevent_req *rpccli_spoolss_AddPrinterEx_send(TALLOC_CTX *mem_ctx,
10676                                                     struct tevent_context *ev,
10677                                                     struct rpc_pipe_client *cli,
10678                                                     const char *_server /* [in] [unique,charset(UTF16)] */,
10679                                                     struct spoolss_SetPrinterInfoCtr *_info_ctr /* [in] [ref] */,
10680                                                     struct spoolss_DevmodeContainer *_devmode_ctr /* [in] [ref] */,
10681                                                     struct sec_desc_buf *_secdesc_ctr /* [in] [ref] */,
10682                                                     struct spoolss_UserLevelCtr *_userlevel_ctr /* [in] [ref] */,
10683                                                     struct policy_handle *_handle /* [out] [ref] */)
10684 {
10685         struct tevent_req *req;
10686         struct rpccli_spoolss_AddPrinterEx_state *state;
10687         struct tevent_req *subreq;
10688
10689         req = tevent_req_create(mem_ctx, &state,
10690                                 struct rpccli_spoolss_AddPrinterEx_state);
10691         if (req == NULL) {
10692                 return NULL;
10693         }
10694         state->out_mem_ctx = NULL;
10695         state->dispatch_recv = cli->dispatch_recv;
10696
10697         /* In parameters */
10698         state->orig.in.server = _server;
10699         state->orig.in.info_ctr = _info_ctr;
10700         state->orig.in.devmode_ctr = _devmode_ctr;
10701         state->orig.in.secdesc_ctr = _secdesc_ctr;
10702         state->orig.in.userlevel_ctr = _userlevel_ctr;
10703
10704         /* Out parameters */
10705         state->orig.out.handle = _handle;
10706
10707         /* Result */
10708         ZERO_STRUCT(state->orig.out.result);
10709
10710         state->out_mem_ctx = talloc_named_const(state, 0,
10711                              "rpccli_spoolss_AddPrinterEx_out_memory");
10712         if (tevent_req_nomem(state->out_mem_ctx, req)) {
10713                 return tevent_req_post(req, ev);
10714         }
10715
10716         /* make a temporary copy, that we pass to the dispatch function */
10717         state->tmp = state->orig;
10718
10719         subreq = cli->dispatch_send(state, ev, cli,
10720                                     &ndr_table_spoolss,
10721                                     NDR_SPOOLSS_ADDPRINTEREX,
10722                                     &state->tmp);
10723         if (tevent_req_nomem(subreq, req)) {
10724                 return tevent_req_post(req, ev);
10725         }
10726         tevent_req_set_callback(subreq, rpccli_spoolss_AddPrinterEx_done, req);
10727         return req;
10728 }
10729
10730 static void rpccli_spoolss_AddPrinterEx_done(struct tevent_req *subreq)
10731 {
10732         struct tevent_req *req = tevent_req_callback_data(
10733                 subreq, struct tevent_req);
10734         struct rpccli_spoolss_AddPrinterEx_state *state = tevent_req_data(
10735                 req, struct rpccli_spoolss_AddPrinterEx_state);
10736         NTSTATUS status;
10737         TALLOC_CTX *mem_ctx;
10738
10739         if (state->out_mem_ctx) {
10740                 mem_ctx = state->out_mem_ctx;
10741         } else {
10742                 mem_ctx = state;
10743         }
10744
10745         status = state->dispatch_recv(subreq, mem_ctx);
10746         TALLOC_FREE(subreq);
10747         if (!NT_STATUS_IS_OK(status)) {
10748                 tevent_req_nterror(req, status);
10749                 return;
10750         }
10751
10752         /* Copy out parameters */
10753         *state->orig.out.handle = *state->tmp.out.handle;
10754
10755         /* Copy result */
10756         state->orig.out.result = state->tmp.out.result;
10757
10758         /* Reset temporary structure */
10759         ZERO_STRUCT(state->tmp);
10760
10761         tevent_req_done(req);
10762 }
10763
10764 NTSTATUS rpccli_spoolss_AddPrinterEx_recv(struct tevent_req *req,
10765                                           TALLOC_CTX *mem_ctx,
10766                                           WERROR *result)
10767 {
10768         struct rpccli_spoolss_AddPrinterEx_state *state = tevent_req_data(
10769                 req, struct rpccli_spoolss_AddPrinterEx_state);
10770         NTSTATUS status;
10771
10772         if (tevent_req_is_nterror(req, &status)) {
10773                 tevent_req_received(req);
10774                 return status;
10775         }
10776
10777         /* Steal possbile out parameters to the callers context */
10778         talloc_steal(mem_ctx, state->out_mem_ctx);
10779
10780         /* Return result */
10781         *result = state->orig.out.result;
10782
10783         tevent_req_received(req);
10784         return NT_STATUS_OK;
10785 }
10786
10787 NTSTATUS rpccli_spoolss_AddPrinterEx(struct rpc_pipe_client *cli,
10788                                      TALLOC_CTX *mem_ctx,
10789                                      const char *server /* [in] [unique,charset(UTF16)] */,
10790                                      struct spoolss_SetPrinterInfoCtr *info_ctr /* [in] [ref] */,
10791                                      struct spoolss_DevmodeContainer *devmode_ctr /* [in] [ref] */,
10792                                      struct sec_desc_buf *secdesc_ctr /* [in] [ref] */,
10793                                      struct spoolss_UserLevelCtr *userlevel_ctr /* [in] [ref] */,
10794                                      struct policy_handle *handle /* [out] [ref] */,
10795                                      WERROR *werror)
10796 {
10797         struct spoolss_AddPrinterEx r;
10798         NTSTATUS status;
10799
10800         /* In parameters */
10801         r.in.server = server;
10802         r.in.info_ctr = info_ctr;
10803         r.in.devmode_ctr = devmode_ctr;
10804         r.in.secdesc_ctr = secdesc_ctr;
10805         r.in.userlevel_ctr = userlevel_ctr;
10806
10807         status = cli->dispatch(cli,
10808                                 mem_ctx,
10809                                 &ndr_table_spoolss,
10810                                 NDR_SPOOLSS_ADDPRINTEREX,
10811                                 &r);
10812
10813         if (!NT_STATUS_IS_OK(status)) {
10814                 return status;
10815         }
10816
10817         if (NT_STATUS_IS_ERR(status)) {
10818                 return status;
10819         }
10820
10821         /* Return variables */
10822         *handle = *r.out.handle;
10823
10824         /* Return result */
10825         if (werror) {
10826                 *werror = r.out.result;
10827         }
10828
10829         return werror_to_ntstatus(r.out.result);
10830 }
10831
10832 struct rpccli_spoolss_47_state {
10833         struct spoolss_47 orig;
10834         struct spoolss_47 tmp;
10835         TALLOC_CTX *out_mem_ctx;
10836         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
10837 };
10838
10839 static void rpccli_spoolss_47_done(struct tevent_req *subreq);
10840
10841 struct tevent_req *rpccli_spoolss_47_send(TALLOC_CTX *mem_ctx,
10842                                           struct tevent_context *ev,
10843                                           struct rpc_pipe_client *cli)
10844 {
10845         struct tevent_req *req;
10846         struct rpccli_spoolss_47_state *state;
10847         struct tevent_req *subreq;
10848
10849         req = tevent_req_create(mem_ctx, &state,
10850                                 struct rpccli_spoolss_47_state);
10851         if (req == NULL) {
10852                 return NULL;
10853         }
10854         state->out_mem_ctx = NULL;
10855         state->dispatch_recv = cli->dispatch_recv;
10856
10857         /* In parameters */
10858
10859         /* Out parameters */
10860
10861         /* Result */
10862         ZERO_STRUCT(state->orig.out.result);
10863
10864         /* make a temporary copy, that we pass to the dispatch function */
10865         state->tmp = state->orig;
10866
10867         subreq = cli->dispatch_send(state, ev, cli,
10868                                     &ndr_table_spoolss,
10869                                     NDR_SPOOLSS_47,
10870                                     &state->tmp);
10871         if (tevent_req_nomem(subreq, req)) {
10872                 return tevent_req_post(req, ev);
10873         }
10874         tevent_req_set_callback(subreq, rpccli_spoolss_47_done, req);
10875         return req;
10876 }
10877
10878 static void rpccli_spoolss_47_done(struct tevent_req *subreq)
10879 {
10880         struct tevent_req *req = tevent_req_callback_data(
10881                 subreq, struct tevent_req);
10882         struct rpccli_spoolss_47_state *state = tevent_req_data(
10883                 req, struct rpccli_spoolss_47_state);
10884         NTSTATUS status;
10885         TALLOC_CTX *mem_ctx;
10886
10887         if (state->out_mem_ctx) {
10888                 mem_ctx = state->out_mem_ctx;
10889         } else {
10890                 mem_ctx = state;
10891         }
10892
10893         status = state->dispatch_recv(subreq, mem_ctx);
10894         TALLOC_FREE(subreq);
10895         if (!NT_STATUS_IS_OK(status)) {
10896                 tevent_req_nterror(req, status);
10897                 return;
10898         }
10899
10900         /* Copy out parameters */
10901
10902         /* Copy result */
10903         state->orig.out.result = state->tmp.out.result;
10904
10905         /* Reset temporary structure */
10906         ZERO_STRUCT(state->tmp);
10907
10908         tevent_req_done(req);
10909 }
10910
10911 NTSTATUS rpccli_spoolss_47_recv(struct tevent_req *req,
10912                                 TALLOC_CTX *mem_ctx,
10913                                 WERROR *result)
10914 {
10915         struct rpccli_spoolss_47_state *state = tevent_req_data(
10916                 req, struct rpccli_spoolss_47_state);
10917         NTSTATUS status;
10918
10919         if (tevent_req_is_nterror(req, &status)) {
10920                 tevent_req_received(req);
10921                 return status;
10922         }
10923
10924         /* Steal possbile out parameters to the callers context */
10925         talloc_steal(mem_ctx, state->out_mem_ctx);
10926
10927         /* Return result */
10928         *result = state->orig.out.result;
10929
10930         tevent_req_received(req);
10931         return NT_STATUS_OK;
10932 }
10933
10934 NTSTATUS rpccli_spoolss_47(struct rpc_pipe_client *cli,
10935                            TALLOC_CTX *mem_ctx,
10936                            WERROR *werror)
10937 {
10938         struct spoolss_47 r;
10939         NTSTATUS status;
10940
10941         /* In parameters */
10942
10943         status = cli->dispatch(cli,
10944                                 mem_ctx,
10945                                 &ndr_table_spoolss,
10946                                 NDR_SPOOLSS_47,
10947                                 &r);
10948
10949         if (!NT_STATUS_IS_OK(status)) {
10950                 return status;
10951         }
10952
10953         if (NT_STATUS_IS_ERR(status)) {
10954                 return status;
10955         }
10956
10957         /* Return variables */
10958
10959         /* Return result */
10960         if (werror) {
10961                 *werror = r.out.result;
10962         }
10963
10964         return werror_to_ntstatus(r.out.result);
10965 }
10966
10967 struct rpccli_spoolss_EnumPrinterData_state {
10968         struct spoolss_EnumPrinterData orig;
10969         struct spoolss_EnumPrinterData tmp;
10970         TALLOC_CTX *out_mem_ctx;
10971         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
10972 };
10973
10974 static void rpccli_spoolss_EnumPrinterData_done(struct tevent_req *subreq);
10975
10976 struct tevent_req *rpccli_spoolss_EnumPrinterData_send(TALLOC_CTX *mem_ctx,
10977                                                        struct tevent_context *ev,
10978                                                        struct rpc_pipe_client *cli,
10979                                                        struct policy_handle *_handle /* [in] [ref] */,
10980                                                        uint32_t _enum_index /* [in]  */,
10981                                                        const char *_value_name /* [out] [charset(UTF16),size_is(value_offered/2)] */,
10982                                                        uint32_t _value_offered /* [in]  */,
10983                                                        uint32_t *_value_needed /* [out] [ref] */,
10984                                                        enum winreg_Type *_type /* [out] [ref] */,
10985                                                        uint8_t *_data /* [out] [ref,flag(LIBNDR_PRINT_ARRAY_HEX),size_is(data_offered)] */,
10986                                                        uint32_t _data_offered /* [in]  */,
10987                                                        uint32_t *_data_needed /* [out] [ref] */)
10988 {
10989         struct tevent_req *req;
10990         struct rpccli_spoolss_EnumPrinterData_state *state;
10991         struct tevent_req *subreq;
10992
10993         req = tevent_req_create(mem_ctx, &state,
10994                                 struct rpccli_spoolss_EnumPrinterData_state);
10995         if (req == NULL) {
10996                 return NULL;
10997         }
10998         state->out_mem_ctx = NULL;
10999         state->dispatch_recv = cli->dispatch_recv;
11000
11001         /* In parameters */
11002         state->orig.in.handle = _handle;
11003         state->orig.in.enum_index = _enum_index;
11004         state->orig.in.value_offered = _value_offered;
11005         state->orig.in.data_offered = _data_offered;
11006
11007         /* Out parameters */
11008         state->orig.out.value_name = _value_name;
11009         state->orig.out.value_needed = _value_needed;
11010         state->orig.out.type = _type;
11011         state->orig.out.data = _data;
11012         state->orig.out.data_needed = _data_needed;
11013
11014         /* Result */
11015         ZERO_STRUCT(state->orig.out.result);
11016
11017         state->out_mem_ctx = talloc_named_const(state, 0,
11018                              "rpccli_spoolss_EnumPrinterData_out_memory");
11019         if (tevent_req_nomem(state->out_mem_ctx, req)) {
11020                 return tevent_req_post(req, ev);
11021         }
11022
11023         /* make a temporary copy, that we pass to the dispatch function */
11024         state->tmp = state->orig;
11025
11026         subreq = cli->dispatch_send(state, ev, cli,
11027                                     &ndr_table_spoolss,
11028                                     NDR_SPOOLSS_ENUMPRINTERDATA,
11029                                     &state->tmp);
11030         if (tevent_req_nomem(subreq, req)) {
11031                 return tevent_req_post(req, ev);
11032         }
11033         tevent_req_set_callback(subreq, rpccli_spoolss_EnumPrinterData_done, req);
11034         return req;
11035 }
11036
11037 static void rpccli_spoolss_EnumPrinterData_done(struct tevent_req *subreq)
11038 {
11039         struct tevent_req *req = tevent_req_callback_data(
11040                 subreq, struct tevent_req);
11041         struct rpccli_spoolss_EnumPrinterData_state *state = tevent_req_data(
11042                 req, struct rpccli_spoolss_EnumPrinterData_state);
11043         NTSTATUS status;
11044         TALLOC_CTX *mem_ctx;
11045
11046         if (state->out_mem_ctx) {
11047                 mem_ctx = state->out_mem_ctx;
11048         } else {
11049                 mem_ctx = state;
11050         }
11051
11052         status = state->dispatch_recv(subreq, mem_ctx);
11053         TALLOC_FREE(subreq);
11054         if (!NT_STATUS_IS_OK(status)) {
11055                 tevent_req_nterror(req, status);
11056                 return;
11057         }
11058
11059         /* Copy out parameters */
11060         memcpy(discard_const_p(uint8_t *, state->orig.out.value_name), state->tmp.out.value_name, (state->tmp.in.value_offered / 2) * sizeof(*state->orig.out.value_name));
11061         *state->orig.out.value_needed = *state->tmp.out.value_needed;
11062         *state->orig.out.type = *state->tmp.out.type;
11063         memcpy(state->orig.out.data, state->tmp.out.data, (state->tmp.in.data_offered) * sizeof(*state->orig.out.data));
11064         *state->orig.out.data_needed = *state->tmp.out.data_needed;
11065
11066         /* Copy result */
11067         state->orig.out.result = state->tmp.out.result;
11068
11069         /* Reset temporary structure */
11070         ZERO_STRUCT(state->tmp);
11071
11072         tevent_req_done(req);
11073 }
11074
11075 NTSTATUS rpccli_spoolss_EnumPrinterData_recv(struct tevent_req *req,
11076                                              TALLOC_CTX *mem_ctx,
11077                                              WERROR *result)
11078 {
11079         struct rpccli_spoolss_EnumPrinterData_state *state = tevent_req_data(
11080                 req, struct rpccli_spoolss_EnumPrinterData_state);
11081         NTSTATUS status;
11082
11083         if (tevent_req_is_nterror(req, &status)) {
11084                 tevent_req_received(req);
11085                 return status;
11086         }
11087
11088         /* Steal possbile out parameters to the callers context */
11089         talloc_steal(mem_ctx, state->out_mem_ctx);
11090
11091         /* Return result */
11092         *result = state->orig.out.result;
11093
11094         tevent_req_received(req);
11095         return NT_STATUS_OK;
11096 }
11097
11098 NTSTATUS rpccli_spoolss_EnumPrinterData(struct rpc_pipe_client *cli,
11099                                         TALLOC_CTX *mem_ctx,
11100                                         struct policy_handle *handle /* [in] [ref] */,
11101                                         uint32_t enum_index /* [in]  */,
11102                                         const char *value_name /* [out] [charset(UTF16),size_is(value_offered/2)] */,
11103                                         uint32_t value_offered /* [in]  */,
11104                                         uint32_t *value_needed /* [out] [ref] */,
11105                                         enum winreg_Type *type /* [out] [ref] */,
11106                                         uint8_t *data /* [out] [ref,flag(LIBNDR_PRINT_ARRAY_HEX),size_is(data_offered)] */,
11107                                         uint32_t data_offered /* [in]  */,
11108                                         uint32_t *data_needed /* [out] [ref] */,
11109                                         WERROR *werror)
11110 {
11111         struct spoolss_EnumPrinterData r;
11112         NTSTATUS status;
11113
11114         /* In parameters */
11115         r.in.handle = handle;
11116         r.in.enum_index = enum_index;
11117         r.in.value_offered = value_offered;
11118         r.in.data_offered = data_offered;
11119
11120         status = cli->dispatch(cli,
11121                                 mem_ctx,
11122                                 &ndr_table_spoolss,
11123                                 NDR_SPOOLSS_ENUMPRINTERDATA,
11124                                 &r);
11125
11126         if (!NT_STATUS_IS_OK(status)) {
11127                 return status;
11128         }
11129
11130         if (NT_STATUS_IS_ERR(status)) {
11131                 return status;
11132         }
11133
11134         /* Return variables */
11135         memcpy(discard_const_p(uint8_t *, value_name), r.out.value_name, (r.in.value_offered / 2) * sizeof(*value_name));
11136         *value_needed = *r.out.value_needed;
11137         *type = *r.out.type;
11138         memcpy(data, r.out.data, (r.in.data_offered) * sizeof(*data));
11139         *data_needed = *r.out.data_needed;
11140
11141         /* Return result */
11142         if (werror) {
11143                 *werror = r.out.result;
11144         }
11145
11146         return werror_to_ntstatus(r.out.result);
11147 }
11148
11149 struct rpccli_spoolss_DeletePrinterData_state {
11150         struct spoolss_DeletePrinterData orig;
11151         struct spoolss_DeletePrinterData tmp;
11152         TALLOC_CTX *out_mem_ctx;
11153         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
11154 };
11155
11156 static void rpccli_spoolss_DeletePrinterData_done(struct tevent_req *subreq);
11157
11158 struct tevent_req *rpccli_spoolss_DeletePrinterData_send(TALLOC_CTX *mem_ctx,
11159                                                          struct tevent_context *ev,
11160                                                          struct rpc_pipe_client *cli,
11161                                                          struct policy_handle *_handle /* [in] [ref] */,
11162                                                          const char *_value_name /* [in] [charset(UTF16)] */)
11163 {
11164         struct tevent_req *req;
11165         struct rpccli_spoolss_DeletePrinterData_state *state;
11166         struct tevent_req *subreq;
11167
11168         req = tevent_req_create(mem_ctx, &state,
11169                                 struct rpccli_spoolss_DeletePrinterData_state);
11170         if (req == NULL) {
11171                 return NULL;
11172         }
11173         state->out_mem_ctx = NULL;
11174         state->dispatch_recv = cli->dispatch_recv;
11175
11176         /* In parameters */
11177         state->orig.in.handle = _handle;
11178         state->orig.in.value_name = _value_name;
11179
11180         /* Out parameters */
11181
11182         /* Result */
11183         ZERO_STRUCT(state->orig.out.result);
11184
11185         /* make a temporary copy, that we pass to the dispatch function */
11186         state->tmp = state->orig;
11187
11188         subreq = cli->dispatch_send(state, ev, cli,
11189                                     &ndr_table_spoolss,
11190                                     NDR_SPOOLSS_DELETEPRINTERDATA,
11191                                     &state->tmp);
11192         if (tevent_req_nomem(subreq, req)) {
11193                 return tevent_req_post(req, ev);
11194         }
11195         tevent_req_set_callback(subreq, rpccli_spoolss_DeletePrinterData_done, req);
11196         return req;
11197 }
11198
11199 static void rpccli_spoolss_DeletePrinterData_done(struct tevent_req *subreq)
11200 {
11201         struct tevent_req *req = tevent_req_callback_data(
11202                 subreq, struct tevent_req);
11203         struct rpccli_spoolss_DeletePrinterData_state *state = tevent_req_data(
11204                 req, struct rpccli_spoolss_DeletePrinterData_state);
11205         NTSTATUS status;
11206         TALLOC_CTX *mem_ctx;
11207
11208         if (state->out_mem_ctx) {
11209                 mem_ctx = state->out_mem_ctx;
11210         } else {
11211                 mem_ctx = state;
11212         }
11213
11214         status = state->dispatch_recv(subreq, mem_ctx);
11215         TALLOC_FREE(subreq);
11216         if (!NT_STATUS_IS_OK(status)) {
11217                 tevent_req_nterror(req, status);
11218                 return;
11219         }
11220
11221         /* Copy out parameters */
11222
11223         /* Copy result */
11224         state->orig.out.result = state->tmp.out.result;
11225
11226         /* Reset temporary structure */
11227         ZERO_STRUCT(state->tmp);
11228
11229         tevent_req_done(req);
11230 }
11231
11232 NTSTATUS rpccli_spoolss_DeletePrinterData_recv(struct tevent_req *req,
11233                                                TALLOC_CTX *mem_ctx,
11234                                                WERROR *result)
11235 {
11236         struct rpccli_spoolss_DeletePrinterData_state *state = tevent_req_data(
11237                 req, struct rpccli_spoolss_DeletePrinterData_state);
11238         NTSTATUS status;
11239
11240         if (tevent_req_is_nterror(req, &status)) {
11241                 tevent_req_received(req);
11242                 return status;
11243         }
11244
11245         /* Steal possbile out parameters to the callers context */
11246         talloc_steal(mem_ctx, state->out_mem_ctx);
11247
11248         /* Return result */
11249         *result = state->orig.out.result;
11250
11251         tevent_req_received(req);
11252         return NT_STATUS_OK;
11253 }
11254
11255 NTSTATUS rpccli_spoolss_DeletePrinterData(struct rpc_pipe_client *cli,
11256                                           TALLOC_CTX *mem_ctx,
11257                                           struct policy_handle *handle /* [in] [ref] */,
11258                                           const char *value_name /* [in] [charset(UTF16)] */,
11259                                           WERROR *werror)
11260 {
11261         struct spoolss_DeletePrinterData r;
11262         NTSTATUS status;
11263
11264         /* In parameters */
11265         r.in.handle = handle;
11266         r.in.value_name = value_name;
11267
11268         status = cli->dispatch(cli,
11269                                 mem_ctx,
11270                                 &ndr_table_spoolss,
11271                                 NDR_SPOOLSS_DELETEPRINTERDATA,
11272                                 &r);
11273
11274         if (!NT_STATUS_IS_OK(status)) {
11275                 return status;
11276         }
11277
11278         if (NT_STATUS_IS_ERR(status)) {
11279                 return status;
11280         }
11281
11282         /* Return variables */
11283
11284         /* Return result */
11285         if (werror) {
11286                 *werror = r.out.result;
11287         }
11288
11289         return werror_to_ntstatus(r.out.result);
11290 }
11291
11292 struct rpccli_spoolss_4a_state {
11293         struct spoolss_4a orig;
11294         struct spoolss_4a tmp;
11295         TALLOC_CTX *out_mem_ctx;
11296         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
11297 };
11298
11299 static void rpccli_spoolss_4a_done(struct tevent_req *subreq);
11300
11301 struct tevent_req *rpccli_spoolss_4a_send(TALLOC_CTX *mem_ctx,
11302                                           struct tevent_context *ev,
11303                                           struct rpc_pipe_client *cli)
11304 {
11305         struct tevent_req *req;
11306         struct rpccli_spoolss_4a_state *state;
11307         struct tevent_req *subreq;
11308
11309         req = tevent_req_create(mem_ctx, &state,
11310                                 struct rpccli_spoolss_4a_state);
11311         if (req == NULL) {
11312                 return NULL;
11313         }
11314         state->out_mem_ctx = NULL;
11315         state->dispatch_recv = cli->dispatch_recv;
11316
11317         /* In parameters */
11318
11319         /* Out parameters */
11320
11321         /* Result */
11322         ZERO_STRUCT(state->orig.out.result);
11323
11324         /* make a temporary copy, that we pass to the dispatch function */
11325         state->tmp = state->orig;
11326
11327         subreq = cli->dispatch_send(state, ev, cli,
11328                                     &ndr_table_spoolss,
11329                                     NDR_SPOOLSS_4A,
11330                                     &state->tmp);
11331         if (tevent_req_nomem(subreq, req)) {
11332                 return tevent_req_post(req, ev);
11333         }
11334         tevent_req_set_callback(subreq, rpccli_spoolss_4a_done, req);
11335         return req;
11336 }
11337
11338 static void rpccli_spoolss_4a_done(struct tevent_req *subreq)
11339 {
11340         struct tevent_req *req = tevent_req_callback_data(
11341                 subreq, struct tevent_req);
11342         struct rpccli_spoolss_4a_state *state = tevent_req_data(
11343                 req, struct rpccli_spoolss_4a_state);
11344         NTSTATUS status;
11345         TALLOC_CTX *mem_ctx;
11346
11347         if (state->out_mem_ctx) {
11348                 mem_ctx = state->out_mem_ctx;
11349         } else {
11350                 mem_ctx = state;
11351         }
11352
11353         status = state->dispatch_recv(subreq, mem_ctx);
11354         TALLOC_FREE(subreq);
11355         if (!NT_STATUS_IS_OK(status)) {
11356                 tevent_req_nterror(req, status);
11357                 return;
11358         }
11359
11360         /* Copy out parameters */
11361
11362         /* Copy result */
11363         state->orig.out.result = state->tmp.out.result;
11364
11365         /* Reset temporary structure */
11366         ZERO_STRUCT(state->tmp);
11367
11368         tevent_req_done(req);
11369 }
11370
11371 NTSTATUS rpccli_spoolss_4a_recv(struct tevent_req *req,
11372                                 TALLOC_CTX *mem_ctx,
11373                                 WERROR *result)
11374 {
11375         struct rpccli_spoolss_4a_state *state = tevent_req_data(
11376                 req, struct rpccli_spoolss_4a_state);
11377         NTSTATUS status;
11378
11379         if (tevent_req_is_nterror(req, &status)) {
11380                 tevent_req_received(req);
11381                 return status;
11382         }
11383
11384         /* Steal possbile out parameters to the callers context */
11385         talloc_steal(mem_ctx, state->out_mem_ctx);
11386
11387         /* Return result */
11388         *result = state->orig.out.result;
11389
11390         tevent_req_received(req);
11391         return NT_STATUS_OK;
11392 }
11393
11394 NTSTATUS rpccli_spoolss_4a(struct rpc_pipe_client *cli,
11395                            TALLOC_CTX *mem_ctx,
11396                            WERROR *werror)
11397 {
11398         struct spoolss_4a r;
11399         NTSTATUS status;
11400
11401         /* In parameters */
11402
11403         status = cli->dispatch(cli,
11404                                 mem_ctx,
11405                                 &ndr_table_spoolss,
11406                                 NDR_SPOOLSS_4A,
11407                                 &r);
11408
11409         if (!NT_STATUS_IS_OK(status)) {
11410                 return status;
11411         }
11412
11413         if (NT_STATUS_IS_ERR(status)) {
11414                 return status;
11415         }
11416
11417         /* Return variables */
11418
11419         /* Return result */
11420         if (werror) {
11421                 *werror = r.out.result;
11422         }
11423
11424         return werror_to_ntstatus(r.out.result);
11425 }
11426
11427 struct rpccli_spoolss_4b_state {
11428         struct spoolss_4b orig;
11429         struct spoolss_4b tmp;
11430         TALLOC_CTX *out_mem_ctx;
11431         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
11432 };
11433
11434 static void rpccli_spoolss_4b_done(struct tevent_req *subreq);
11435
11436 struct tevent_req *rpccli_spoolss_4b_send(TALLOC_CTX *mem_ctx,
11437                                           struct tevent_context *ev,
11438                                           struct rpc_pipe_client *cli)
11439 {
11440         struct tevent_req *req;
11441         struct rpccli_spoolss_4b_state *state;
11442         struct tevent_req *subreq;
11443
11444         req = tevent_req_create(mem_ctx, &state,
11445                                 struct rpccli_spoolss_4b_state);
11446         if (req == NULL) {
11447                 return NULL;
11448         }
11449         state->out_mem_ctx = NULL;
11450         state->dispatch_recv = cli->dispatch_recv;
11451
11452         /* In parameters */
11453
11454         /* Out parameters */
11455
11456         /* Result */
11457         ZERO_STRUCT(state->orig.out.result);
11458
11459         /* make a temporary copy, that we pass to the dispatch function */
11460         state->tmp = state->orig;
11461
11462         subreq = cli->dispatch_send(state, ev, cli,
11463                                     &ndr_table_spoolss,
11464                                     NDR_SPOOLSS_4B,
11465                                     &state->tmp);
11466         if (tevent_req_nomem(subreq, req)) {
11467                 return tevent_req_post(req, ev);
11468         }
11469         tevent_req_set_callback(subreq, rpccli_spoolss_4b_done, req);
11470         return req;
11471 }
11472
11473 static void rpccli_spoolss_4b_done(struct tevent_req *subreq)
11474 {
11475         struct tevent_req *req = tevent_req_callback_data(
11476                 subreq, struct tevent_req);
11477         struct rpccli_spoolss_4b_state *state = tevent_req_data(
11478                 req, struct rpccli_spoolss_4b_state);
11479         NTSTATUS status;
11480         TALLOC_CTX *mem_ctx;
11481
11482         if (state->out_mem_ctx) {
11483                 mem_ctx = state->out_mem_ctx;
11484         } else {
11485                 mem_ctx = state;
11486         }
11487
11488         status = state->dispatch_recv(subreq, mem_ctx);
11489         TALLOC_FREE(subreq);
11490         if (!NT_STATUS_IS_OK(status)) {
11491                 tevent_req_nterror(req, status);
11492                 return;
11493         }
11494
11495         /* Copy out parameters */
11496
11497         /* Copy result */
11498         state->orig.out.result = state->tmp.out.result;
11499
11500         /* Reset temporary structure */
11501         ZERO_STRUCT(state->tmp);
11502
11503         tevent_req_done(req);
11504 }
11505
11506 NTSTATUS rpccli_spoolss_4b_recv(struct tevent_req *req,
11507                                 TALLOC_CTX *mem_ctx,
11508                                 WERROR *result)
11509 {
11510         struct rpccli_spoolss_4b_state *state = tevent_req_data(
11511                 req, struct rpccli_spoolss_4b_state);
11512         NTSTATUS status;
11513
11514         if (tevent_req_is_nterror(req, &status)) {
11515                 tevent_req_received(req);
11516                 return status;
11517         }
11518
11519         /* Steal possbile out parameters to the callers context */
11520         talloc_steal(mem_ctx, state->out_mem_ctx);
11521
11522         /* Return result */
11523         *result = state->orig.out.result;
11524
11525         tevent_req_received(req);
11526         return NT_STATUS_OK;
11527 }
11528
11529 NTSTATUS rpccli_spoolss_4b(struct rpc_pipe_client *cli,
11530                            TALLOC_CTX *mem_ctx,
11531                            WERROR *werror)
11532 {
11533         struct spoolss_4b r;
11534         NTSTATUS status;
11535
11536         /* In parameters */
11537
11538         status = cli->dispatch(cli,
11539                                 mem_ctx,
11540                                 &ndr_table_spoolss,
11541                                 NDR_SPOOLSS_4B,
11542                                 &r);
11543
11544         if (!NT_STATUS_IS_OK(status)) {
11545                 return status;
11546         }
11547
11548         if (NT_STATUS_IS_ERR(status)) {
11549                 return status;
11550         }
11551
11552         /* Return variables */
11553
11554         /* Return result */
11555         if (werror) {
11556                 *werror = r.out.result;
11557         }
11558
11559         return werror_to_ntstatus(r.out.result);
11560 }
11561
11562 struct rpccli_spoolss_4c_state {
11563         struct spoolss_4c orig;
11564         struct spoolss_4c tmp;
11565         TALLOC_CTX *out_mem_ctx;
11566         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
11567 };
11568
11569 static void rpccli_spoolss_4c_done(struct tevent_req *subreq);
11570
11571 struct tevent_req *rpccli_spoolss_4c_send(TALLOC_CTX *mem_ctx,
11572                                           struct tevent_context *ev,
11573                                           struct rpc_pipe_client *cli)
11574 {
11575         struct tevent_req *req;
11576         struct rpccli_spoolss_4c_state *state;
11577         struct tevent_req *subreq;
11578
11579         req = tevent_req_create(mem_ctx, &state,
11580                                 struct rpccli_spoolss_4c_state);
11581         if (req == NULL) {
11582                 return NULL;
11583         }
11584         state->out_mem_ctx = NULL;
11585         state->dispatch_recv = cli->dispatch_recv;
11586
11587         /* In parameters */
11588
11589         /* Out parameters */
11590
11591         /* Result */
11592         ZERO_STRUCT(state->orig.out.result);
11593
11594         /* make a temporary copy, that we pass to the dispatch function */
11595         state->tmp = state->orig;
11596
11597         subreq = cli->dispatch_send(state, ev, cli,
11598                                     &ndr_table_spoolss,
11599                                     NDR_SPOOLSS_4C,
11600                                     &state->tmp);
11601         if (tevent_req_nomem(subreq, req)) {
11602                 return tevent_req_post(req, ev);
11603         }
11604         tevent_req_set_callback(subreq, rpccli_spoolss_4c_done, req);
11605         return req;
11606 }
11607
11608 static void rpccli_spoolss_4c_done(struct tevent_req *subreq)
11609 {
11610         struct tevent_req *req = tevent_req_callback_data(
11611                 subreq, struct tevent_req);
11612         struct rpccli_spoolss_4c_state *state = tevent_req_data(
11613                 req, struct rpccli_spoolss_4c_state);
11614         NTSTATUS status;
11615         TALLOC_CTX *mem_ctx;
11616
11617         if (state->out_mem_ctx) {
11618                 mem_ctx = state->out_mem_ctx;
11619         } else {
11620                 mem_ctx = state;
11621         }
11622
11623         status = state->dispatch_recv(subreq, mem_ctx);
11624         TALLOC_FREE(subreq);
11625         if (!NT_STATUS_IS_OK(status)) {
11626                 tevent_req_nterror(req, status);
11627                 return;
11628         }
11629
11630         /* Copy out parameters */
11631
11632         /* Copy result */
11633         state->orig.out.result = state->tmp.out.result;
11634
11635         /* Reset temporary structure */
11636         ZERO_STRUCT(state->tmp);
11637
11638         tevent_req_done(req);
11639 }
11640
11641 NTSTATUS rpccli_spoolss_4c_recv(struct tevent_req *req,
11642                                 TALLOC_CTX *mem_ctx,
11643                                 WERROR *result)
11644 {
11645         struct rpccli_spoolss_4c_state *state = tevent_req_data(
11646                 req, struct rpccli_spoolss_4c_state);
11647         NTSTATUS status;
11648
11649         if (tevent_req_is_nterror(req, &status)) {
11650                 tevent_req_received(req);
11651                 return status;
11652         }
11653
11654         /* Steal possbile out parameters to the callers context */
11655         talloc_steal(mem_ctx, state->out_mem_ctx);
11656
11657         /* Return result */
11658         *result = state->orig.out.result;
11659
11660         tevent_req_received(req);
11661         return NT_STATUS_OK;
11662 }
11663
11664 NTSTATUS rpccli_spoolss_4c(struct rpc_pipe_client *cli,
11665                            TALLOC_CTX *mem_ctx,
11666                            WERROR *werror)
11667 {
11668         struct spoolss_4c r;
11669         NTSTATUS status;
11670
11671         /* In parameters */
11672
11673         status = cli->dispatch(cli,
11674                                 mem_ctx,
11675                                 &ndr_table_spoolss,
11676                                 NDR_SPOOLSS_4C,
11677                                 &r);
11678
11679         if (!NT_STATUS_IS_OK(status)) {
11680                 return status;
11681         }
11682
11683         if (NT_STATUS_IS_ERR(status)) {
11684                 return status;
11685         }
11686
11687         /* Return variables */
11688
11689         /* Return result */
11690         if (werror) {
11691                 *werror = r.out.result;
11692         }
11693
11694         return werror_to_ntstatus(r.out.result);
11695 }
11696
11697 struct rpccli_spoolss_SetPrinterDataEx_state {
11698         struct spoolss_SetPrinterDataEx orig;
11699         struct spoolss_SetPrinterDataEx tmp;
11700         TALLOC_CTX *out_mem_ctx;
11701         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
11702 };
11703
11704 static void rpccli_spoolss_SetPrinterDataEx_done(struct tevent_req *subreq);
11705
11706 struct tevent_req *rpccli_spoolss_SetPrinterDataEx_send(TALLOC_CTX *mem_ctx,
11707                                                         struct tevent_context *ev,
11708                                                         struct rpc_pipe_client *cli,
11709                                                         struct policy_handle *_handle /* [in] [ref] */,
11710                                                         const char *_key_name /* [in] [charset(UTF16)] */,
11711                                                         const char *_value_name /* [in] [charset(UTF16)] */,
11712                                                         enum winreg_Type _type /* [in]  */,
11713                                                         uint8_t *_data /* [in] [ref,size_is(offered)] */,
11714                                                         uint32_t _offered /* [in]  */)
11715 {
11716         struct tevent_req *req;
11717         struct rpccli_spoolss_SetPrinterDataEx_state *state;
11718         struct tevent_req *subreq;
11719
11720         req = tevent_req_create(mem_ctx, &state,
11721                                 struct rpccli_spoolss_SetPrinterDataEx_state);
11722         if (req == NULL) {
11723                 return NULL;
11724         }
11725         state->out_mem_ctx = NULL;
11726         state->dispatch_recv = cli->dispatch_recv;
11727
11728         /* In parameters */
11729         state->orig.in.handle = _handle;
11730         state->orig.in.key_name = _key_name;
11731         state->orig.in.value_name = _value_name;
11732         state->orig.in.type = _type;
11733         state->orig.in.data = _data;
11734         state->orig.in.offered = _offered;
11735
11736         /* Out parameters */
11737
11738         /* Result */
11739         ZERO_STRUCT(state->orig.out.result);
11740
11741         /* make a temporary copy, that we pass to the dispatch function */
11742         state->tmp = state->orig;
11743
11744         subreq = cli->dispatch_send(state, ev, cli,
11745                                     &ndr_table_spoolss,
11746                                     NDR_SPOOLSS_SETPRINTERDATAEX,
11747                                     &state->tmp);
11748         if (tevent_req_nomem(subreq, req)) {
11749                 return tevent_req_post(req, ev);
11750         }
11751         tevent_req_set_callback(subreq, rpccli_spoolss_SetPrinterDataEx_done, req);
11752         return req;
11753 }
11754
11755 static void rpccli_spoolss_SetPrinterDataEx_done(struct tevent_req *subreq)
11756 {
11757         struct tevent_req *req = tevent_req_callback_data(
11758                 subreq, struct tevent_req);
11759         struct rpccli_spoolss_SetPrinterDataEx_state *state = tevent_req_data(
11760                 req, struct rpccli_spoolss_SetPrinterDataEx_state);
11761         NTSTATUS status;
11762         TALLOC_CTX *mem_ctx;
11763
11764         if (state->out_mem_ctx) {
11765                 mem_ctx = state->out_mem_ctx;
11766         } else {
11767                 mem_ctx = state;
11768         }
11769
11770         status = state->dispatch_recv(subreq, mem_ctx);
11771         TALLOC_FREE(subreq);
11772         if (!NT_STATUS_IS_OK(status)) {
11773                 tevent_req_nterror(req, status);
11774                 return;
11775         }
11776
11777         /* Copy out parameters */
11778
11779         /* Copy result */
11780         state->orig.out.result = state->tmp.out.result;
11781
11782         /* Reset temporary structure */
11783         ZERO_STRUCT(state->tmp);
11784
11785         tevent_req_done(req);
11786 }
11787
11788 NTSTATUS rpccli_spoolss_SetPrinterDataEx_recv(struct tevent_req *req,
11789                                               TALLOC_CTX *mem_ctx,
11790                                               WERROR *result)
11791 {
11792         struct rpccli_spoolss_SetPrinterDataEx_state *state = tevent_req_data(
11793                 req, struct rpccli_spoolss_SetPrinterDataEx_state);
11794         NTSTATUS status;
11795
11796         if (tevent_req_is_nterror(req, &status)) {
11797                 tevent_req_received(req);
11798                 return status;
11799         }
11800
11801         /* Steal possbile out parameters to the callers context */
11802         talloc_steal(mem_ctx, state->out_mem_ctx);
11803
11804         /* Return result */
11805         *result = state->orig.out.result;
11806
11807         tevent_req_received(req);
11808         return NT_STATUS_OK;
11809 }
11810
11811 NTSTATUS rpccli_spoolss_SetPrinterDataEx(struct rpc_pipe_client *cli,
11812                                          TALLOC_CTX *mem_ctx,
11813                                          struct policy_handle *handle /* [in] [ref] */,
11814                                          const char *key_name /* [in] [charset(UTF16)] */,
11815                                          const char *value_name /* [in] [charset(UTF16)] */,
11816                                          enum winreg_Type type /* [in]  */,
11817                                          uint8_t *data /* [in] [ref,size_is(offered)] */,
11818                                          uint32_t offered /* [in]  */,
11819                                          WERROR *werror)
11820 {
11821         struct spoolss_SetPrinterDataEx r;
11822         NTSTATUS status;
11823
11824         /* In parameters */
11825         r.in.handle = handle;
11826         r.in.key_name = key_name;
11827         r.in.value_name = value_name;
11828         r.in.type = type;
11829         r.in.data = data;
11830         r.in.offered = offered;
11831
11832         status = cli->dispatch(cli,
11833                                 mem_ctx,
11834                                 &ndr_table_spoolss,
11835                                 NDR_SPOOLSS_SETPRINTERDATAEX,
11836                                 &r);
11837
11838         if (!NT_STATUS_IS_OK(status)) {
11839                 return status;
11840         }
11841
11842         if (NT_STATUS_IS_ERR(status)) {
11843                 return status;
11844         }
11845
11846         /* Return variables */
11847
11848         /* Return result */
11849         if (werror) {
11850                 *werror = r.out.result;
11851         }
11852
11853         return werror_to_ntstatus(r.out.result);
11854 }
11855
11856 struct rpccli_spoolss_GetPrinterDataEx_state {
11857         struct spoolss_GetPrinterDataEx orig;
11858         struct spoolss_GetPrinterDataEx tmp;
11859         TALLOC_CTX *out_mem_ctx;
11860         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
11861 };
11862
11863 static void rpccli_spoolss_GetPrinterDataEx_done(struct tevent_req *subreq);
11864
11865 struct tevent_req *rpccli_spoolss_GetPrinterDataEx_send(TALLOC_CTX *mem_ctx,
11866                                                         struct tevent_context *ev,
11867                                                         struct rpc_pipe_client *cli,
11868                                                         struct policy_handle *_handle /* [in] [ref] */,
11869                                                         const char *_key_name /* [in] [charset(UTF16)] */,
11870                                                         const char *_value_name /* [in] [charset(UTF16)] */,
11871                                                         enum winreg_Type *_type /* [out] [ref] */,
11872                                                         uint8_t *_data /* [out] [ref,size_is(offered)] */,
11873                                                         uint32_t _offered /* [in]  */,
11874                                                         uint32_t *_needed /* [out] [ref] */)
11875 {
11876         struct tevent_req *req;
11877         struct rpccli_spoolss_GetPrinterDataEx_state *state;
11878         struct tevent_req *subreq;
11879
11880         req = tevent_req_create(mem_ctx, &state,
11881                                 struct rpccli_spoolss_GetPrinterDataEx_state);
11882         if (req == NULL) {
11883                 return NULL;
11884         }
11885         state->out_mem_ctx = NULL;
11886         state->dispatch_recv = cli->dispatch_recv;
11887
11888         /* In parameters */
11889         state->orig.in.handle = _handle;
11890         state->orig.in.key_name = _key_name;
11891         state->orig.in.value_name = _value_name;
11892         state->orig.in.offered = _offered;
11893
11894         /* Out parameters */
11895         state->orig.out.type = _type;
11896         state->orig.out.data = _data;
11897         state->orig.out.needed = _needed;
11898
11899         /* Result */
11900         ZERO_STRUCT(state->orig.out.result);
11901
11902         state->out_mem_ctx = talloc_named_const(state, 0,
11903                              "rpccli_spoolss_GetPrinterDataEx_out_memory");
11904         if (tevent_req_nomem(state->out_mem_ctx, req)) {
11905                 return tevent_req_post(req, ev);
11906         }
11907
11908         /* make a temporary copy, that we pass to the dispatch function */
11909         state->tmp = state->orig;
11910
11911         subreq = cli->dispatch_send(state, ev, cli,
11912                                     &ndr_table_spoolss,
11913                                     NDR_SPOOLSS_GETPRINTERDATAEX,
11914                                     &state->tmp);
11915         if (tevent_req_nomem(subreq, req)) {
11916                 return tevent_req_post(req, ev);
11917         }
11918         tevent_req_set_callback(subreq, rpccli_spoolss_GetPrinterDataEx_done, req);
11919         return req;
11920 }
11921
11922 static void rpccli_spoolss_GetPrinterDataEx_done(struct tevent_req *subreq)
11923 {
11924         struct tevent_req *req = tevent_req_callback_data(
11925                 subreq, struct tevent_req);
11926         struct rpccli_spoolss_GetPrinterDataEx_state *state = tevent_req_data(
11927                 req, struct rpccli_spoolss_GetPrinterDataEx_state);
11928         NTSTATUS status;
11929         TALLOC_CTX *mem_ctx;
11930
11931         if (state->out_mem_ctx) {
11932                 mem_ctx = state->out_mem_ctx;
11933         } else {
11934                 mem_ctx = state;
11935         }
11936
11937         status = state->dispatch_recv(subreq, mem_ctx);
11938         TALLOC_FREE(subreq);
11939         if (!NT_STATUS_IS_OK(status)) {
11940                 tevent_req_nterror(req, status);
11941                 return;
11942         }
11943
11944         /* Copy out parameters */
11945         *state->orig.out.type = *state->tmp.out.type;
11946         memcpy(state->orig.out.data, state->tmp.out.data, (state->tmp.in.offered) * sizeof(*state->orig.out.data));
11947         *state->orig.out.needed = *state->tmp.out.needed;
11948
11949         /* Copy result */
11950         state->orig.out.result = state->tmp.out.result;
11951
11952         /* Reset temporary structure */
11953         ZERO_STRUCT(state->tmp);
11954
11955         tevent_req_done(req);
11956 }
11957
11958 NTSTATUS rpccli_spoolss_GetPrinterDataEx_recv(struct tevent_req *req,
11959                                               TALLOC_CTX *mem_ctx,
11960                                               WERROR *result)
11961 {
11962         struct rpccli_spoolss_GetPrinterDataEx_state *state = tevent_req_data(
11963                 req, struct rpccli_spoolss_GetPrinterDataEx_state);
11964         NTSTATUS status;
11965
11966         if (tevent_req_is_nterror(req, &status)) {
11967                 tevent_req_received(req);
11968                 return status;
11969         }
11970
11971         /* Steal possbile out parameters to the callers context */
11972         talloc_steal(mem_ctx, state->out_mem_ctx);
11973
11974         /* Return result */
11975         *result = state->orig.out.result;
11976
11977         tevent_req_received(req);
11978         return NT_STATUS_OK;
11979 }
11980
11981 NTSTATUS rpccli_spoolss_GetPrinterDataEx(struct rpc_pipe_client *cli,
11982                                          TALLOC_CTX *mem_ctx,
11983                                          struct policy_handle *handle /* [in] [ref] */,
11984                                          const char *key_name /* [in] [charset(UTF16)] */,
11985                                          const char *value_name /* [in] [charset(UTF16)] */,
11986                                          enum winreg_Type *type /* [out] [ref] */,
11987                                          uint8_t *data /* [out] [ref,size_is(offered)] */,
11988                                          uint32_t offered /* [in]  */,
11989                                          uint32_t *needed /* [out] [ref] */,
11990                                          WERROR *werror)
11991 {
11992         struct spoolss_GetPrinterDataEx r;
11993         NTSTATUS status;
11994
11995         /* In parameters */
11996         r.in.handle = handle;
11997         r.in.key_name = key_name;
11998         r.in.value_name = value_name;
11999         r.in.offered = offered;
12000
12001         status = cli->dispatch(cli,
12002                                 mem_ctx,
12003                                 &ndr_table_spoolss,
12004                                 NDR_SPOOLSS_GETPRINTERDATAEX,
12005                                 &r);
12006
12007         if (!NT_STATUS_IS_OK(status)) {
12008                 return status;
12009         }
12010
12011         if (NT_STATUS_IS_ERR(status)) {
12012                 return status;
12013         }
12014
12015         /* Return variables */
12016         *type = *r.out.type;
12017         memcpy(data, r.out.data, (r.in.offered) * sizeof(*data));
12018         *needed = *r.out.needed;
12019
12020         /* Return result */
12021         if (werror) {
12022                 *werror = r.out.result;
12023         }
12024
12025         return werror_to_ntstatus(r.out.result);
12026 }
12027
12028 struct rpccli_spoolss_EnumPrinterDataEx_state {
12029         struct spoolss_EnumPrinterDataEx orig;
12030         struct spoolss_EnumPrinterDataEx tmp;
12031         TALLOC_CTX *out_mem_ctx;
12032         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
12033 };
12034
12035 static void rpccli_spoolss_EnumPrinterDataEx_done(struct tevent_req *subreq);
12036
12037 struct tevent_req *rpccli_spoolss_EnumPrinterDataEx_send(TALLOC_CTX *mem_ctx,
12038                                                          struct tevent_context *ev,
12039                                                          struct rpc_pipe_client *cli,
12040                                                          struct policy_handle *_handle /* [in] [ref] */,
12041                                                          const char *_key_name /* [in] [charset(UTF16)] */,
12042                                                          uint32_t _offered /* [in]  */,
12043                                                          uint32_t *_count /* [out] [ref] */,
12044                                                          struct spoolss_PrinterEnumValues **_info /* [out] [ref,size_is(,*count)] */,
12045                                                          uint32_t *_needed /* [out] [ref] */)
12046 {
12047         struct tevent_req *req;
12048         struct rpccli_spoolss_EnumPrinterDataEx_state *state;
12049         struct tevent_req *subreq;
12050
12051         req = tevent_req_create(mem_ctx, &state,
12052                                 struct rpccli_spoolss_EnumPrinterDataEx_state);
12053         if (req == NULL) {
12054                 return NULL;
12055         }
12056         state->out_mem_ctx = NULL;
12057         state->dispatch_recv = cli->dispatch_recv;
12058
12059         /* In parameters */
12060         state->orig.in.handle = _handle;
12061         state->orig.in.key_name = _key_name;
12062         state->orig.in.offered = _offered;
12063
12064         /* Out parameters */
12065         state->orig.out.count = _count;
12066         state->orig.out.info = _info;
12067         state->orig.out.needed = _needed;
12068
12069         /* Result */
12070         ZERO_STRUCT(state->orig.out.result);
12071
12072         state->out_mem_ctx = talloc_named_const(state, 0,
12073                              "rpccli_spoolss_EnumPrinterDataEx_out_memory");
12074         if (tevent_req_nomem(state->out_mem_ctx, req)) {
12075                 return tevent_req_post(req, ev);
12076         }
12077
12078         /* make a temporary copy, that we pass to the dispatch function */
12079         state->tmp = state->orig;
12080
12081         subreq = cli->dispatch_send(state, ev, cli,
12082                                     &ndr_table_spoolss,
12083                                     NDR_SPOOLSS_ENUMPRINTERDATAEX,
12084                                     &state->tmp);
12085         if (tevent_req_nomem(subreq, req)) {
12086                 return tevent_req_post(req, ev);
12087         }
12088         tevent_req_set_callback(subreq, rpccli_spoolss_EnumPrinterDataEx_done, req);
12089         return req;
12090 }
12091
12092 static void rpccli_spoolss_EnumPrinterDataEx_done(struct tevent_req *subreq)
12093 {
12094         struct tevent_req *req = tevent_req_callback_data(
12095                 subreq, struct tevent_req);
12096         struct rpccli_spoolss_EnumPrinterDataEx_state *state = tevent_req_data(
12097                 req, struct rpccli_spoolss_EnumPrinterDataEx_state);
12098         NTSTATUS status;
12099         TALLOC_CTX *mem_ctx;
12100
12101         if (state->out_mem_ctx) {
12102                 mem_ctx = state->out_mem_ctx;
12103         } else {
12104                 mem_ctx = state;
12105         }
12106
12107         status = state->dispatch_recv(subreq, mem_ctx);
12108         TALLOC_FREE(subreq);
12109         if (!NT_STATUS_IS_OK(status)) {
12110                 tevent_req_nterror(req, status);
12111                 return;
12112         }
12113
12114         /* Copy out parameters */
12115         *state->orig.out.count = *state->tmp.out.count;
12116         *state->orig.out.info = *state->tmp.out.info;
12117         *state->orig.out.needed = *state->tmp.out.needed;
12118
12119         /* Copy result */
12120         state->orig.out.result = state->tmp.out.result;
12121
12122         /* Reset temporary structure */
12123         ZERO_STRUCT(state->tmp);
12124
12125         tevent_req_done(req);
12126 }
12127
12128 NTSTATUS rpccli_spoolss_EnumPrinterDataEx_recv(struct tevent_req *req,
12129                                                TALLOC_CTX *mem_ctx,
12130                                                WERROR *result)
12131 {
12132         struct rpccli_spoolss_EnumPrinterDataEx_state *state = tevent_req_data(
12133                 req, struct rpccli_spoolss_EnumPrinterDataEx_state);
12134         NTSTATUS status;
12135
12136         if (tevent_req_is_nterror(req, &status)) {
12137                 tevent_req_received(req);
12138                 return status;
12139         }
12140
12141         /* Steal possbile out parameters to the callers context */
12142         talloc_steal(mem_ctx, state->out_mem_ctx);
12143
12144         /* Return result */
12145         *result = state->orig.out.result;
12146
12147         tevent_req_received(req);
12148         return NT_STATUS_OK;
12149 }
12150
12151 NTSTATUS rpccli_spoolss_EnumPrinterDataEx(struct rpc_pipe_client *cli,
12152                                           TALLOC_CTX *mem_ctx,
12153                                           struct policy_handle *handle /* [in] [ref] */,
12154                                           const char *key_name /* [in] [charset(UTF16)] */,
12155                                           uint32_t offered /* [in]  */,
12156                                           uint32_t *count /* [out] [ref] */,
12157                                           struct spoolss_PrinterEnumValues **info /* [out] [ref,size_is(,*count)] */,
12158                                           uint32_t *needed /* [out] [ref] */,
12159                                           WERROR *werror)
12160 {
12161         struct spoolss_EnumPrinterDataEx r;
12162         NTSTATUS status;
12163
12164         /* In parameters */
12165         r.in.handle = handle;
12166         r.in.key_name = key_name;
12167         r.in.offered = offered;
12168
12169         status = cli->dispatch(cli,
12170                                 mem_ctx,
12171                                 &ndr_table_spoolss,
12172                                 NDR_SPOOLSS_ENUMPRINTERDATAEX,
12173                                 &r);
12174
12175         if (!NT_STATUS_IS_OK(status)) {
12176                 return status;
12177         }
12178
12179         if (NT_STATUS_IS_ERR(status)) {
12180                 return status;
12181         }
12182
12183         /* Return variables */
12184         *count = *r.out.count;
12185         *info = *r.out.info;
12186         *needed = *r.out.needed;
12187
12188         /* Return result */
12189         if (werror) {
12190                 *werror = r.out.result;
12191         }
12192
12193         return werror_to_ntstatus(r.out.result);
12194 }
12195
12196 struct rpccli_spoolss_EnumPrinterKey_state {
12197         struct spoolss_EnumPrinterKey orig;
12198         struct spoolss_EnumPrinterKey tmp;
12199         TALLOC_CTX *out_mem_ctx;
12200         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
12201 };
12202
12203 static void rpccli_spoolss_EnumPrinterKey_done(struct tevent_req *subreq);
12204
12205 struct tevent_req *rpccli_spoolss_EnumPrinterKey_send(TALLOC_CTX *mem_ctx,
12206                                                       struct tevent_context *ev,
12207                                                       struct rpc_pipe_client *cli,
12208                                                       struct policy_handle *_handle /* [in] [ref] */,
12209                                                       const char *_key_name /* [in] [charset(UTF16)] */,
12210                                                       uint32_t *__ndr_size /* [out] [ref] */,
12211                                                       union spoolss_KeyNames *_key_buffer /* [out] [subcontext_size(*_ndr_size*2),ref,subcontext(0),switch_is(*_ndr_size)] */,
12212                                                       uint32_t _offered /* [in]  */,
12213                                                       uint32_t *_needed /* [out] [ref] */)
12214 {
12215         struct tevent_req *req;
12216         struct rpccli_spoolss_EnumPrinterKey_state *state;
12217         struct tevent_req *subreq;
12218
12219         req = tevent_req_create(mem_ctx, &state,
12220                                 struct rpccli_spoolss_EnumPrinterKey_state);
12221         if (req == NULL) {
12222                 return NULL;
12223         }
12224         state->out_mem_ctx = NULL;
12225         state->dispatch_recv = cli->dispatch_recv;
12226
12227         /* In parameters */
12228         state->orig.in.handle = _handle;
12229         state->orig.in.key_name = _key_name;
12230         state->orig.in.offered = _offered;
12231
12232         /* Out parameters */
12233         state->orig.out._ndr_size = __ndr_size;
12234         state->orig.out.key_buffer = _key_buffer;
12235         state->orig.out.needed = _needed;
12236
12237         /* Result */
12238         ZERO_STRUCT(state->orig.out.result);
12239
12240         state->out_mem_ctx = talloc_named_const(state, 0,
12241                              "rpccli_spoolss_EnumPrinterKey_out_memory");
12242         if (tevent_req_nomem(state->out_mem_ctx, req)) {
12243                 return tevent_req_post(req, ev);
12244         }
12245
12246         /* make a temporary copy, that we pass to the dispatch function */
12247         state->tmp = state->orig;
12248
12249         subreq = cli->dispatch_send(state, ev, cli,
12250                                     &ndr_table_spoolss,
12251                                     NDR_SPOOLSS_ENUMPRINTERKEY,
12252                                     &state->tmp);
12253         if (tevent_req_nomem(subreq, req)) {
12254                 return tevent_req_post(req, ev);
12255         }
12256         tevent_req_set_callback(subreq, rpccli_spoolss_EnumPrinterKey_done, req);
12257         return req;
12258 }
12259
12260 static void rpccli_spoolss_EnumPrinterKey_done(struct tevent_req *subreq)
12261 {
12262         struct tevent_req *req = tevent_req_callback_data(
12263                 subreq, struct tevent_req);
12264         struct rpccli_spoolss_EnumPrinterKey_state *state = tevent_req_data(
12265                 req, struct rpccli_spoolss_EnumPrinterKey_state);
12266         NTSTATUS status;
12267         TALLOC_CTX *mem_ctx;
12268
12269         if (state->out_mem_ctx) {
12270                 mem_ctx = state->out_mem_ctx;
12271         } else {
12272                 mem_ctx = state;
12273         }
12274
12275         status = state->dispatch_recv(subreq, mem_ctx);
12276         TALLOC_FREE(subreq);
12277         if (!NT_STATUS_IS_OK(status)) {
12278                 tevent_req_nterror(req, status);
12279                 return;
12280         }
12281
12282         /* Copy out parameters */
12283         *state->orig.out._ndr_size = *state->tmp.out._ndr_size;
12284         *state->orig.out.key_buffer = *state->tmp.out.key_buffer;
12285         *state->orig.out.needed = *state->tmp.out.needed;
12286
12287         /* Copy result */
12288         state->orig.out.result = state->tmp.out.result;
12289
12290         /* Reset temporary structure */
12291         ZERO_STRUCT(state->tmp);
12292
12293         tevent_req_done(req);
12294 }
12295
12296 NTSTATUS rpccli_spoolss_EnumPrinterKey_recv(struct tevent_req *req,
12297                                             TALLOC_CTX *mem_ctx,
12298                                             WERROR *result)
12299 {
12300         struct rpccli_spoolss_EnumPrinterKey_state *state = tevent_req_data(
12301                 req, struct rpccli_spoolss_EnumPrinterKey_state);
12302         NTSTATUS status;
12303
12304         if (tevent_req_is_nterror(req, &status)) {
12305                 tevent_req_received(req);
12306                 return status;
12307         }
12308
12309         /* Steal possbile out parameters to the callers context */
12310         talloc_steal(mem_ctx, state->out_mem_ctx);
12311
12312         /* Return result */
12313         *result = state->orig.out.result;
12314
12315         tevent_req_received(req);
12316         return NT_STATUS_OK;
12317 }
12318
12319 NTSTATUS rpccli_spoolss_EnumPrinterKey(struct rpc_pipe_client *cli,
12320                                        TALLOC_CTX *mem_ctx,
12321                                        struct policy_handle *handle /* [in] [ref] */,
12322                                        const char *key_name /* [in] [charset(UTF16)] */,
12323                                        uint32_t *_ndr_size /* [out] [ref] */,
12324                                        union spoolss_KeyNames *key_buffer /* [out] [subcontext_size(*_ndr_size*2),ref,subcontext(0),switch_is(*_ndr_size)] */,
12325                                        uint32_t offered /* [in]  */,
12326                                        uint32_t *needed /* [out] [ref] */,
12327                                        WERROR *werror)
12328 {
12329         struct spoolss_EnumPrinterKey r;
12330         NTSTATUS status;
12331
12332         /* In parameters */
12333         r.in.handle = handle;
12334         r.in.key_name = key_name;
12335         r.in.offered = offered;
12336
12337         status = cli->dispatch(cli,
12338                                 mem_ctx,
12339                                 &ndr_table_spoolss,
12340                                 NDR_SPOOLSS_ENUMPRINTERKEY,
12341                                 &r);
12342
12343         if (!NT_STATUS_IS_OK(status)) {
12344                 return status;
12345         }
12346
12347         if (NT_STATUS_IS_ERR(status)) {
12348                 return status;
12349         }
12350
12351         /* Return variables */
12352         *_ndr_size = *r.out._ndr_size;
12353         *key_buffer = *r.out.key_buffer;
12354         *needed = *r.out.needed;
12355
12356         /* Return result */
12357         if (werror) {
12358                 *werror = r.out.result;
12359         }
12360
12361         return werror_to_ntstatus(r.out.result);
12362 }
12363
12364 struct rpccli_spoolss_DeletePrinterDataEx_state {
12365         struct spoolss_DeletePrinterDataEx orig;
12366         struct spoolss_DeletePrinterDataEx tmp;
12367         TALLOC_CTX *out_mem_ctx;
12368         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
12369 };
12370
12371 static void rpccli_spoolss_DeletePrinterDataEx_done(struct tevent_req *subreq);
12372
12373 struct tevent_req *rpccli_spoolss_DeletePrinterDataEx_send(TALLOC_CTX *mem_ctx,
12374                                                            struct tevent_context *ev,
12375                                                            struct rpc_pipe_client *cli,
12376                                                            struct policy_handle *_handle /* [in] [ref] */,
12377                                                            const char *_key_name /* [in] [charset(UTF16)] */,
12378                                                            const char *_value_name /* [in] [charset(UTF16)] */)
12379 {
12380         struct tevent_req *req;
12381         struct rpccli_spoolss_DeletePrinterDataEx_state *state;
12382         struct tevent_req *subreq;
12383
12384         req = tevent_req_create(mem_ctx, &state,
12385                                 struct rpccli_spoolss_DeletePrinterDataEx_state);
12386         if (req == NULL) {
12387                 return NULL;
12388         }
12389         state->out_mem_ctx = NULL;
12390         state->dispatch_recv = cli->dispatch_recv;
12391
12392         /* In parameters */
12393         state->orig.in.handle = _handle;
12394         state->orig.in.key_name = _key_name;
12395         state->orig.in.value_name = _value_name;
12396
12397         /* Out parameters */
12398
12399         /* Result */
12400         ZERO_STRUCT(state->orig.out.result);
12401
12402         /* make a temporary copy, that we pass to the dispatch function */
12403         state->tmp = state->orig;
12404
12405         subreq = cli->dispatch_send(state, ev, cli,
12406                                     &ndr_table_spoolss,
12407                                     NDR_SPOOLSS_DELETEPRINTERDATAEX,
12408                                     &state->tmp);
12409         if (tevent_req_nomem(subreq, req)) {
12410                 return tevent_req_post(req, ev);
12411         }
12412         tevent_req_set_callback(subreq, rpccli_spoolss_DeletePrinterDataEx_done, req);
12413         return req;
12414 }
12415
12416 static void rpccli_spoolss_DeletePrinterDataEx_done(struct tevent_req *subreq)
12417 {
12418         struct tevent_req *req = tevent_req_callback_data(
12419                 subreq, struct tevent_req);
12420         struct rpccli_spoolss_DeletePrinterDataEx_state *state = tevent_req_data(
12421                 req, struct rpccli_spoolss_DeletePrinterDataEx_state);
12422         NTSTATUS status;
12423         TALLOC_CTX *mem_ctx;
12424
12425         if (state->out_mem_ctx) {
12426                 mem_ctx = state->out_mem_ctx;
12427         } else {
12428                 mem_ctx = state;
12429         }
12430
12431         status = state->dispatch_recv(subreq, mem_ctx);
12432         TALLOC_FREE(subreq);
12433         if (!NT_STATUS_IS_OK(status)) {
12434                 tevent_req_nterror(req, status);
12435                 return;
12436         }
12437
12438         /* Copy out parameters */
12439
12440         /* Copy result */
12441         state->orig.out.result = state->tmp.out.result;
12442
12443         /* Reset temporary structure */
12444         ZERO_STRUCT(state->tmp);
12445
12446         tevent_req_done(req);
12447 }
12448
12449 NTSTATUS rpccli_spoolss_DeletePrinterDataEx_recv(struct tevent_req *req,
12450                                                  TALLOC_CTX *mem_ctx,
12451                                                  WERROR *result)
12452 {
12453         struct rpccli_spoolss_DeletePrinterDataEx_state *state = tevent_req_data(
12454                 req, struct rpccli_spoolss_DeletePrinterDataEx_state);
12455         NTSTATUS status;
12456
12457         if (tevent_req_is_nterror(req, &status)) {
12458                 tevent_req_received(req);
12459                 return status;
12460         }
12461
12462         /* Steal possbile out parameters to the callers context */
12463         talloc_steal(mem_ctx, state->out_mem_ctx);
12464
12465         /* Return result */
12466         *result = state->orig.out.result;
12467
12468         tevent_req_received(req);
12469         return NT_STATUS_OK;
12470 }
12471
12472 NTSTATUS rpccli_spoolss_DeletePrinterDataEx(struct rpc_pipe_client *cli,
12473                                             TALLOC_CTX *mem_ctx,
12474                                             struct policy_handle *handle /* [in] [ref] */,
12475                                             const char *key_name /* [in] [charset(UTF16)] */,
12476                                             const char *value_name /* [in] [charset(UTF16)] */,
12477                                             WERROR *werror)
12478 {
12479         struct spoolss_DeletePrinterDataEx r;
12480         NTSTATUS status;
12481
12482         /* In parameters */
12483         r.in.handle = handle;
12484         r.in.key_name = key_name;
12485         r.in.value_name = value_name;
12486
12487         status = cli->dispatch(cli,
12488                                 mem_ctx,
12489                                 &ndr_table_spoolss,
12490                                 NDR_SPOOLSS_DELETEPRINTERDATAEX,
12491                                 &r);
12492
12493         if (!NT_STATUS_IS_OK(status)) {
12494                 return status;
12495         }
12496
12497         if (NT_STATUS_IS_ERR(status)) {
12498                 return status;
12499         }
12500
12501         /* Return variables */
12502
12503         /* Return result */
12504         if (werror) {
12505                 *werror = r.out.result;
12506         }
12507
12508         return werror_to_ntstatus(r.out.result);
12509 }
12510
12511 struct rpccli_spoolss_DeletePrinterKey_state {
12512         struct spoolss_DeletePrinterKey orig;
12513         struct spoolss_DeletePrinterKey tmp;
12514         TALLOC_CTX *out_mem_ctx;
12515         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
12516 };
12517
12518 static void rpccli_spoolss_DeletePrinterKey_done(struct tevent_req *subreq);
12519
12520 struct tevent_req *rpccli_spoolss_DeletePrinterKey_send(TALLOC_CTX *mem_ctx,
12521                                                         struct tevent_context *ev,
12522                                                         struct rpc_pipe_client *cli,
12523                                                         struct policy_handle *_handle /* [in] [ref] */,
12524                                                         const char *_key_name /* [in] [charset(UTF16)] */)
12525 {
12526         struct tevent_req *req;
12527         struct rpccli_spoolss_DeletePrinterKey_state *state;
12528         struct tevent_req *subreq;
12529
12530         req = tevent_req_create(mem_ctx, &state,
12531                                 struct rpccli_spoolss_DeletePrinterKey_state);
12532         if (req == NULL) {
12533                 return NULL;
12534         }
12535         state->out_mem_ctx = NULL;
12536         state->dispatch_recv = cli->dispatch_recv;
12537
12538         /* In parameters */
12539         state->orig.in.handle = _handle;
12540         state->orig.in.key_name = _key_name;
12541
12542         /* Out parameters */
12543
12544         /* Result */
12545         ZERO_STRUCT(state->orig.out.result);
12546
12547         /* make a temporary copy, that we pass to the dispatch function */
12548         state->tmp = state->orig;
12549
12550         subreq = cli->dispatch_send(state, ev, cli,
12551                                     &ndr_table_spoolss,
12552                                     NDR_SPOOLSS_DELETEPRINTERKEY,
12553                                     &state->tmp);
12554         if (tevent_req_nomem(subreq, req)) {
12555                 return tevent_req_post(req, ev);
12556         }
12557         tevent_req_set_callback(subreq, rpccli_spoolss_DeletePrinterKey_done, req);
12558         return req;
12559 }
12560
12561 static void rpccli_spoolss_DeletePrinterKey_done(struct tevent_req *subreq)
12562 {
12563         struct tevent_req *req = tevent_req_callback_data(
12564                 subreq, struct tevent_req);
12565         struct rpccli_spoolss_DeletePrinterKey_state *state = tevent_req_data(
12566                 req, struct rpccli_spoolss_DeletePrinterKey_state);
12567         NTSTATUS status;
12568         TALLOC_CTX *mem_ctx;
12569
12570         if (state->out_mem_ctx) {
12571                 mem_ctx = state->out_mem_ctx;
12572         } else {
12573                 mem_ctx = state;
12574         }
12575
12576         status = state->dispatch_recv(subreq, mem_ctx);
12577         TALLOC_FREE(subreq);
12578         if (!NT_STATUS_IS_OK(status)) {
12579                 tevent_req_nterror(req, status);
12580                 return;
12581         }
12582
12583         /* Copy out parameters */
12584
12585         /* Copy result */
12586         state->orig.out.result = state->tmp.out.result;
12587
12588         /* Reset temporary structure */
12589         ZERO_STRUCT(state->tmp);
12590
12591         tevent_req_done(req);
12592 }
12593
12594 NTSTATUS rpccli_spoolss_DeletePrinterKey_recv(struct tevent_req *req,
12595                                               TALLOC_CTX *mem_ctx,
12596                                               WERROR *result)
12597 {
12598         struct rpccli_spoolss_DeletePrinterKey_state *state = tevent_req_data(
12599                 req, struct rpccli_spoolss_DeletePrinterKey_state);
12600         NTSTATUS status;
12601
12602         if (tevent_req_is_nterror(req, &status)) {
12603                 tevent_req_received(req);
12604                 return status;
12605         }
12606
12607         /* Steal possbile out parameters to the callers context */
12608         talloc_steal(mem_ctx, state->out_mem_ctx);
12609
12610         /* Return result */
12611         *result = state->orig.out.result;
12612
12613         tevent_req_received(req);
12614         return NT_STATUS_OK;
12615 }
12616
12617 NTSTATUS rpccli_spoolss_DeletePrinterKey(struct rpc_pipe_client *cli,
12618                                          TALLOC_CTX *mem_ctx,
12619                                          struct policy_handle *handle /* [in] [ref] */,
12620                                          const char *key_name /* [in] [charset(UTF16)] */,
12621                                          WERROR *werror)
12622 {
12623         struct spoolss_DeletePrinterKey r;
12624         NTSTATUS status;
12625
12626         /* In parameters */
12627         r.in.handle = handle;
12628         r.in.key_name = key_name;
12629
12630         status = cli->dispatch(cli,
12631                                 mem_ctx,
12632                                 &ndr_table_spoolss,
12633                                 NDR_SPOOLSS_DELETEPRINTERKEY,
12634                                 &r);
12635
12636         if (!NT_STATUS_IS_OK(status)) {
12637                 return status;
12638         }
12639
12640         if (NT_STATUS_IS_ERR(status)) {
12641                 return status;
12642         }
12643
12644         /* Return variables */
12645
12646         /* Return result */
12647         if (werror) {
12648                 *werror = r.out.result;
12649         }
12650
12651         return werror_to_ntstatus(r.out.result);
12652 }
12653
12654 struct rpccli_spoolss_53_state {
12655         struct spoolss_53 orig;
12656         struct spoolss_53 tmp;
12657         TALLOC_CTX *out_mem_ctx;
12658         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
12659 };
12660
12661 static void rpccli_spoolss_53_done(struct tevent_req *subreq);
12662
12663 struct tevent_req *rpccli_spoolss_53_send(TALLOC_CTX *mem_ctx,
12664                                           struct tevent_context *ev,
12665                                           struct rpc_pipe_client *cli)
12666 {
12667         struct tevent_req *req;
12668         struct rpccli_spoolss_53_state *state;
12669         struct tevent_req *subreq;
12670
12671         req = tevent_req_create(mem_ctx, &state,
12672                                 struct rpccli_spoolss_53_state);
12673         if (req == NULL) {
12674                 return NULL;
12675         }
12676         state->out_mem_ctx = NULL;
12677         state->dispatch_recv = cli->dispatch_recv;
12678
12679         /* In parameters */
12680
12681         /* Out parameters */
12682
12683         /* Result */
12684         ZERO_STRUCT(state->orig.out.result);
12685
12686         /* make a temporary copy, that we pass to the dispatch function */
12687         state->tmp = state->orig;
12688
12689         subreq = cli->dispatch_send(state, ev, cli,
12690                                     &ndr_table_spoolss,
12691                                     NDR_SPOOLSS_53,
12692                                     &state->tmp);
12693         if (tevent_req_nomem(subreq, req)) {
12694                 return tevent_req_post(req, ev);
12695         }
12696         tevent_req_set_callback(subreq, rpccli_spoolss_53_done, req);
12697         return req;
12698 }
12699
12700 static void rpccli_spoolss_53_done(struct tevent_req *subreq)
12701 {
12702         struct tevent_req *req = tevent_req_callback_data(
12703                 subreq, struct tevent_req);
12704         struct rpccli_spoolss_53_state *state = tevent_req_data(
12705                 req, struct rpccli_spoolss_53_state);
12706         NTSTATUS status;
12707         TALLOC_CTX *mem_ctx;
12708
12709         if (state->out_mem_ctx) {
12710                 mem_ctx = state->out_mem_ctx;
12711         } else {
12712                 mem_ctx = state;
12713         }
12714
12715         status = state->dispatch_recv(subreq, mem_ctx);
12716         TALLOC_FREE(subreq);
12717         if (!NT_STATUS_IS_OK(status)) {
12718                 tevent_req_nterror(req, status);
12719                 return;
12720         }
12721
12722         /* Copy out parameters */
12723
12724         /* Copy result */
12725         state->orig.out.result = state->tmp.out.result;
12726
12727         /* Reset temporary structure */
12728         ZERO_STRUCT(state->tmp);
12729
12730         tevent_req_done(req);
12731 }
12732
12733 NTSTATUS rpccli_spoolss_53_recv(struct tevent_req *req,
12734                                 TALLOC_CTX *mem_ctx,
12735                                 WERROR *result)
12736 {
12737         struct rpccli_spoolss_53_state *state = tevent_req_data(
12738                 req, struct rpccli_spoolss_53_state);
12739         NTSTATUS status;
12740
12741         if (tevent_req_is_nterror(req, &status)) {
12742                 tevent_req_received(req);
12743                 return status;
12744         }
12745
12746         /* Steal possbile out parameters to the callers context */
12747         talloc_steal(mem_ctx, state->out_mem_ctx);
12748
12749         /* Return result */
12750         *result = state->orig.out.result;
12751
12752         tevent_req_received(req);
12753         return NT_STATUS_OK;
12754 }
12755
12756 NTSTATUS rpccli_spoolss_53(struct rpc_pipe_client *cli,
12757                            TALLOC_CTX *mem_ctx,
12758                            WERROR *werror)
12759 {
12760         struct spoolss_53 r;
12761         NTSTATUS status;
12762
12763         /* In parameters */
12764
12765         status = cli->dispatch(cli,
12766                                 mem_ctx,
12767                                 &ndr_table_spoolss,
12768                                 NDR_SPOOLSS_53,
12769                                 &r);
12770
12771         if (!NT_STATUS_IS_OK(status)) {
12772                 return status;
12773         }
12774
12775         if (NT_STATUS_IS_ERR(status)) {
12776                 return status;
12777         }
12778
12779         /* Return variables */
12780
12781         /* Return result */
12782         if (werror) {
12783                 *werror = r.out.result;
12784         }
12785
12786         return werror_to_ntstatus(r.out.result);
12787 }
12788
12789 struct rpccli_spoolss_DeletePrinterDriverEx_state {
12790         struct spoolss_DeletePrinterDriverEx orig;
12791         struct spoolss_DeletePrinterDriverEx tmp;
12792         TALLOC_CTX *out_mem_ctx;
12793         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
12794 };
12795
12796 static void rpccli_spoolss_DeletePrinterDriverEx_done(struct tevent_req *subreq);
12797
12798 struct tevent_req *rpccli_spoolss_DeletePrinterDriverEx_send(TALLOC_CTX *mem_ctx,
12799                                                              struct tevent_context *ev,
12800                                                              struct rpc_pipe_client *cli,
12801                                                              const char *_server /* [in] [unique,charset(UTF16)] */,
12802                                                              const char *_architecture /* [in] [charset(UTF16)] */,
12803                                                              const char *_driver /* [in] [charset(UTF16)] */,
12804                                                              uint32_t _delete_flags /* [in]  */,
12805                                                              uint32_t _version /* [in]  */)
12806 {
12807         struct tevent_req *req;
12808         struct rpccli_spoolss_DeletePrinterDriverEx_state *state;
12809         struct tevent_req *subreq;
12810
12811         req = tevent_req_create(mem_ctx, &state,
12812                                 struct rpccli_spoolss_DeletePrinterDriverEx_state);
12813         if (req == NULL) {
12814                 return NULL;
12815         }
12816         state->out_mem_ctx = NULL;
12817         state->dispatch_recv = cli->dispatch_recv;
12818
12819         /* In parameters */
12820         state->orig.in.server = _server;
12821         state->orig.in.architecture = _architecture;
12822         state->orig.in.driver = _driver;
12823         state->orig.in.delete_flags = _delete_flags;
12824         state->orig.in.version = _version;
12825
12826         /* Out parameters */
12827
12828         /* Result */
12829         ZERO_STRUCT(state->orig.out.result);
12830
12831         /* make a temporary copy, that we pass to the dispatch function */
12832         state->tmp = state->orig;
12833
12834         subreq = cli->dispatch_send(state, ev, cli,
12835                                     &ndr_table_spoolss,
12836                                     NDR_SPOOLSS_DELETEPRINTERDRIVEREX,
12837                                     &state->tmp);
12838         if (tevent_req_nomem(subreq, req)) {
12839                 return tevent_req_post(req, ev);
12840         }
12841         tevent_req_set_callback(subreq, rpccli_spoolss_DeletePrinterDriverEx_done, req);
12842         return req;
12843 }
12844
12845 static void rpccli_spoolss_DeletePrinterDriverEx_done(struct tevent_req *subreq)
12846 {
12847         struct tevent_req *req = tevent_req_callback_data(
12848                 subreq, struct tevent_req);
12849         struct rpccli_spoolss_DeletePrinterDriverEx_state *state = tevent_req_data(
12850                 req, struct rpccli_spoolss_DeletePrinterDriverEx_state);
12851         NTSTATUS status;
12852         TALLOC_CTX *mem_ctx;
12853
12854         if (state->out_mem_ctx) {
12855                 mem_ctx = state->out_mem_ctx;
12856         } else {
12857                 mem_ctx = state;
12858         }
12859
12860         status = state->dispatch_recv(subreq, mem_ctx);
12861         TALLOC_FREE(subreq);
12862         if (!NT_STATUS_IS_OK(status)) {
12863                 tevent_req_nterror(req, status);
12864                 return;
12865         }
12866
12867         /* Copy out parameters */
12868
12869         /* Copy result */
12870         state->orig.out.result = state->tmp.out.result;
12871
12872         /* Reset temporary structure */
12873         ZERO_STRUCT(state->tmp);
12874
12875         tevent_req_done(req);
12876 }
12877
12878 NTSTATUS rpccli_spoolss_DeletePrinterDriverEx_recv(struct tevent_req *req,
12879                                                    TALLOC_CTX *mem_ctx,
12880                                                    WERROR *result)
12881 {
12882         struct rpccli_spoolss_DeletePrinterDriverEx_state *state = tevent_req_data(
12883                 req, struct rpccli_spoolss_DeletePrinterDriverEx_state);
12884         NTSTATUS status;
12885
12886         if (tevent_req_is_nterror(req, &status)) {
12887                 tevent_req_received(req);
12888                 return status;
12889         }
12890
12891         /* Steal possbile out parameters to the callers context */
12892         talloc_steal(mem_ctx, state->out_mem_ctx);
12893
12894         /* Return result */
12895         *result = state->orig.out.result;
12896
12897         tevent_req_received(req);
12898         return NT_STATUS_OK;
12899 }
12900
12901 NTSTATUS rpccli_spoolss_DeletePrinterDriverEx(struct rpc_pipe_client *cli,
12902                                               TALLOC_CTX *mem_ctx,
12903                                               const char *server /* [in] [unique,charset(UTF16)] */,
12904                                               const char *architecture /* [in] [charset(UTF16)] */,
12905                                               const char *driver /* [in] [charset(UTF16)] */,
12906                                               uint32_t delete_flags /* [in]  */,
12907                                               uint32_t version /* [in]  */,
12908                                               WERROR *werror)
12909 {
12910         struct spoolss_DeletePrinterDriverEx r;
12911         NTSTATUS status;
12912
12913         /* In parameters */
12914         r.in.server = server;
12915         r.in.architecture = architecture;
12916         r.in.driver = driver;
12917         r.in.delete_flags = delete_flags;
12918         r.in.version = version;
12919
12920         status = cli->dispatch(cli,
12921                                 mem_ctx,
12922                                 &ndr_table_spoolss,
12923                                 NDR_SPOOLSS_DELETEPRINTERDRIVEREX,
12924                                 &r);
12925
12926         if (!NT_STATUS_IS_OK(status)) {
12927                 return status;
12928         }
12929
12930         if (NT_STATUS_IS_ERR(status)) {
12931                 return status;
12932         }
12933
12934         /* Return variables */
12935
12936         /* Return result */
12937         if (werror) {
12938                 *werror = r.out.result;
12939         }
12940
12941         return werror_to_ntstatus(r.out.result);
12942 }
12943
12944 struct rpccli_spoolss_55_state {
12945         struct spoolss_55 orig;
12946         struct spoolss_55 tmp;
12947         TALLOC_CTX *out_mem_ctx;
12948         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
12949 };
12950
12951 static void rpccli_spoolss_55_done(struct tevent_req *subreq);
12952
12953 struct tevent_req *rpccli_spoolss_55_send(TALLOC_CTX *mem_ctx,
12954                                           struct tevent_context *ev,
12955                                           struct rpc_pipe_client *cli)
12956 {
12957         struct tevent_req *req;
12958         struct rpccli_spoolss_55_state *state;
12959         struct tevent_req *subreq;
12960
12961         req = tevent_req_create(mem_ctx, &state,
12962                                 struct rpccli_spoolss_55_state);
12963         if (req == NULL) {
12964                 return NULL;
12965         }
12966         state->out_mem_ctx = NULL;
12967         state->dispatch_recv = cli->dispatch_recv;
12968
12969         /* In parameters */
12970
12971         /* Out parameters */
12972
12973         /* Result */
12974         ZERO_STRUCT(state->orig.out.result);
12975
12976         /* make a temporary copy, that we pass to the dispatch function */
12977         state->tmp = state->orig;
12978
12979         subreq = cli->dispatch_send(state, ev, cli,
12980                                     &ndr_table_spoolss,
12981                                     NDR_SPOOLSS_55,
12982                                     &state->tmp);
12983         if (tevent_req_nomem(subreq, req)) {
12984                 return tevent_req_post(req, ev);
12985         }
12986         tevent_req_set_callback(subreq, rpccli_spoolss_55_done, req);
12987         return req;
12988 }
12989
12990 static void rpccli_spoolss_55_done(struct tevent_req *subreq)
12991 {
12992         struct tevent_req *req = tevent_req_callback_data(
12993                 subreq, struct tevent_req);
12994         struct rpccli_spoolss_55_state *state = tevent_req_data(
12995                 req, struct rpccli_spoolss_55_state);
12996         NTSTATUS status;
12997         TALLOC_CTX *mem_ctx;
12998
12999         if (state->out_mem_ctx) {
13000                 mem_ctx = state->out_mem_ctx;
13001         } else {
13002                 mem_ctx = state;
13003         }
13004
13005         status = state->dispatch_recv(subreq, mem_ctx);
13006         TALLOC_FREE(subreq);
13007         if (!NT_STATUS_IS_OK(status)) {
13008                 tevent_req_nterror(req, status);
13009                 return;
13010         }
13011
13012         /* Copy out parameters */
13013
13014         /* Copy result */
13015         state->orig.out.result = state->tmp.out.result;
13016
13017         /* Reset temporary structure */
13018         ZERO_STRUCT(state->tmp);
13019
13020         tevent_req_done(req);
13021 }
13022
13023 NTSTATUS rpccli_spoolss_55_recv(struct tevent_req *req,
13024                                 TALLOC_CTX *mem_ctx,
13025                                 WERROR *result)
13026 {
13027         struct rpccli_spoolss_55_state *state = tevent_req_data(
13028                 req, struct rpccli_spoolss_55_state);
13029         NTSTATUS status;
13030
13031         if (tevent_req_is_nterror(req, &status)) {
13032                 tevent_req_received(req);
13033                 return status;
13034         }
13035
13036         /* Steal possbile out parameters to the callers context */
13037         talloc_steal(mem_ctx, state->out_mem_ctx);
13038
13039         /* Return result */
13040         *result = state->orig.out.result;
13041
13042         tevent_req_received(req);
13043         return NT_STATUS_OK;
13044 }
13045
13046 NTSTATUS rpccli_spoolss_55(struct rpc_pipe_client *cli,
13047                            TALLOC_CTX *mem_ctx,
13048                            WERROR *werror)
13049 {
13050         struct spoolss_55 r;
13051         NTSTATUS status;
13052
13053         /* In parameters */
13054
13055         status = cli->dispatch(cli,
13056                                 mem_ctx,
13057                                 &ndr_table_spoolss,
13058                                 NDR_SPOOLSS_55,
13059                                 &r);
13060
13061         if (!NT_STATUS_IS_OK(status)) {
13062                 return status;
13063         }
13064
13065         if (NT_STATUS_IS_ERR(status)) {
13066                 return status;
13067         }
13068
13069         /* Return variables */
13070
13071         /* Return result */
13072         if (werror) {
13073                 *werror = r.out.result;
13074         }
13075
13076         return werror_to_ntstatus(r.out.result);
13077 }
13078
13079 struct rpccli_spoolss_56_state {
13080         struct spoolss_56 orig;
13081         struct spoolss_56 tmp;
13082         TALLOC_CTX *out_mem_ctx;
13083         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
13084 };
13085
13086 static void rpccli_spoolss_56_done(struct tevent_req *subreq);
13087
13088 struct tevent_req *rpccli_spoolss_56_send(TALLOC_CTX *mem_ctx,
13089                                           struct tevent_context *ev,
13090                                           struct rpc_pipe_client *cli)
13091 {
13092         struct tevent_req *req;
13093         struct rpccli_spoolss_56_state *state;
13094         struct tevent_req *subreq;
13095
13096         req = tevent_req_create(mem_ctx, &state,
13097                                 struct rpccli_spoolss_56_state);
13098         if (req == NULL) {
13099                 return NULL;
13100         }
13101         state->out_mem_ctx = NULL;
13102         state->dispatch_recv = cli->dispatch_recv;
13103
13104         /* In parameters */
13105
13106         /* Out parameters */
13107
13108         /* Result */
13109         ZERO_STRUCT(state->orig.out.result);
13110
13111         /* make a temporary copy, that we pass to the dispatch function */
13112         state->tmp = state->orig;
13113
13114         subreq = cli->dispatch_send(state, ev, cli,
13115                                     &ndr_table_spoolss,
13116                                     NDR_SPOOLSS_56,
13117                                     &state->tmp);
13118         if (tevent_req_nomem(subreq, req)) {
13119                 return tevent_req_post(req, ev);
13120         }
13121         tevent_req_set_callback(subreq, rpccli_spoolss_56_done, req);
13122         return req;
13123 }
13124
13125 static void rpccli_spoolss_56_done(struct tevent_req *subreq)
13126 {
13127         struct tevent_req *req = tevent_req_callback_data(
13128                 subreq, struct tevent_req);
13129         struct rpccli_spoolss_56_state *state = tevent_req_data(
13130                 req, struct rpccli_spoolss_56_state);
13131         NTSTATUS status;
13132         TALLOC_CTX *mem_ctx;
13133
13134         if (state->out_mem_ctx) {
13135                 mem_ctx = state->out_mem_ctx;
13136         } else {
13137                 mem_ctx = state;
13138         }
13139
13140         status = state->dispatch_recv(subreq, mem_ctx);
13141         TALLOC_FREE(subreq);
13142         if (!NT_STATUS_IS_OK(status)) {
13143                 tevent_req_nterror(req, status);
13144                 return;
13145         }
13146
13147         /* Copy out parameters */
13148
13149         /* Copy result */
13150         state->orig.out.result = state->tmp.out.result;
13151
13152         /* Reset temporary structure */
13153         ZERO_STRUCT(state->tmp);
13154
13155         tevent_req_done(req);
13156 }
13157
13158 NTSTATUS rpccli_spoolss_56_recv(struct tevent_req *req,
13159                                 TALLOC_CTX *mem_ctx,
13160                                 WERROR *result)
13161 {
13162         struct rpccli_spoolss_56_state *state = tevent_req_data(
13163                 req, struct rpccli_spoolss_56_state);
13164         NTSTATUS status;
13165
13166         if (tevent_req_is_nterror(req, &status)) {
13167                 tevent_req_received(req);
13168                 return status;
13169         }
13170
13171         /* Steal possbile out parameters to the callers context */
13172         talloc_steal(mem_ctx, state->out_mem_ctx);
13173
13174         /* Return result */
13175         *result = state->orig.out.result;
13176
13177         tevent_req_received(req);
13178         return NT_STATUS_OK;
13179 }
13180
13181 NTSTATUS rpccli_spoolss_56(struct rpc_pipe_client *cli,
13182                            TALLOC_CTX *mem_ctx,
13183                            WERROR *werror)
13184 {
13185         struct spoolss_56 r;
13186         NTSTATUS status;
13187
13188         /* In parameters */
13189
13190         status = cli->dispatch(cli,
13191                                 mem_ctx,
13192                                 &ndr_table_spoolss,
13193                                 NDR_SPOOLSS_56,
13194                                 &r);
13195
13196         if (!NT_STATUS_IS_OK(status)) {
13197                 return status;
13198         }
13199
13200         if (NT_STATUS_IS_ERR(status)) {
13201                 return status;
13202         }
13203
13204         /* Return variables */
13205
13206         /* Return result */
13207         if (werror) {
13208                 *werror = r.out.result;
13209         }
13210
13211         return werror_to_ntstatus(r.out.result);
13212 }
13213
13214 struct rpccli_spoolss_57_state {
13215         struct spoolss_57 orig;
13216         struct spoolss_57 tmp;
13217         TALLOC_CTX *out_mem_ctx;
13218         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
13219 };
13220
13221 static void rpccli_spoolss_57_done(struct tevent_req *subreq);
13222
13223 struct tevent_req *rpccli_spoolss_57_send(TALLOC_CTX *mem_ctx,
13224                                           struct tevent_context *ev,
13225                                           struct rpc_pipe_client *cli)
13226 {
13227         struct tevent_req *req;
13228         struct rpccli_spoolss_57_state *state;
13229         struct tevent_req *subreq;
13230
13231         req = tevent_req_create(mem_ctx, &state,
13232                                 struct rpccli_spoolss_57_state);
13233         if (req == NULL) {
13234                 return NULL;
13235         }
13236         state->out_mem_ctx = NULL;
13237         state->dispatch_recv = cli->dispatch_recv;
13238
13239         /* In parameters */
13240
13241         /* Out parameters */
13242
13243         /* Result */
13244         ZERO_STRUCT(state->orig.out.result);
13245
13246         /* make a temporary copy, that we pass to the dispatch function */
13247         state->tmp = state->orig;
13248
13249         subreq = cli->dispatch_send(state, ev, cli,
13250                                     &ndr_table_spoolss,
13251                                     NDR_SPOOLSS_57,
13252                                     &state->tmp);
13253         if (tevent_req_nomem(subreq, req)) {
13254                 return tevent_req_post(req, ev);
13255         }
13256         tevent_req_set_callback(subreq, rpccli_spoolss_57_done, req);
13257         return req;
13258 }
13259
13260 static void rpccli_spoolss_57_done(struct tevent_req *subreq)
13261 {
13262         struct tevent_req *req = tevent_req_callback_data(
13263                 subreq, struct tevent_req);
13264         struct rpccli_spoolss_57_state *state = tevent_req_data(
13265                 req, struct rpccli_spoolss_57_state);
13266         NTSTATUS status;
13267         TALLOC_CTX *mem_ctx;
13268
13269         if (state->out_mem_ctx) {
13270                 mem_ctx = state->out_mem_ctx;
13271         } else {
13272                 mem_ctx = state;
13273         }
13274
13275         status = state->dispatch_recv(subreq, mem_ctx);
13276         TALLOC_FREE(subreq);
13277         if (!NT_STATUS_IS_OK(status)) {
13278                 tevent_req_nterror(req, status);
13279                 return;
13280         }
13281
13282         /* Copy out parameters */
13283
13284         /* Copy result */
13285         state->orig.out.result = state->tmp.out.result;
13286
13287         /* Reset temporary structure */
13288         ZERO_STRUCT(state->tmp);
13289
13290         tevent_req_done(req);
13291 }
13292
13293 NTSTATUS rpccli_spoolss_57_recv(struct tevent_req *req,
13294                                 TALLOC_CTX *mem_ctx,
13295                                 WERROR *result)
13296 {
13297         struct rpccli_spoolss_57_state *state = tevent_req_data(
13298                 req, struct rpccli_spoolss_57_state);
13299         NTSTATUS status;
13300
13301         if (tevent_req_is_nterror(req, &status)) {
13302                 tevent_req_received(req);
13303                 return status;
13304         }
13305
13306         /* Steal possbile out parameters to the callers context */
13307         talloc_steal(mem_ctx, state->out_mem_ctx);
13308
13309         /* Return result */
13310         *result = state->orig.out.result;
13311
13312         tevent_req_received(req);
13313         return NT_STATUS_OK;
13314 }
13315
13316 NTSTATUS rpccli_spoolss_57(struct rpc_pipe_client *cli,
13317                            TALLOC_CTX *mem_ctx,
13318                            WERROR *werror)
13319 {
13320         struct spoolss_57 r;
13321         NTSTATUS status;
13322
13323         /* In parameters */
13324
13325         status = cli->dispatch(cli,
13326                                 mem_ctx,
13327                                 &ndr_table_spoolss,
13328                                 NDR_SPOOLSS_57,
13329                                 &r);
13330
13331         if (!NT_STATUS_IS_OK(status)) {
13332                 return status;
13333         }
13334
13335         if (NT_STATUS_IS_ERR(status)) {
13336                 return status;
13337         }
13338
13339         /* Return variables */
13340
13341         /* Return result */
13342         if (werror) {
13343                 *werror = r.out.result;
13344         }
13345
13346         return werror_to_ntstatus(r.out.result);
13347 }
13348
13349 struct rpccli_spoolss_XcvData_state {
13350         struct spoolss_XcvData orig;
13351         struct spoolss_XcvData tmp;
13352         TALLOC_CTX *out_mem_ctx;
13353         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
13354 };
13355
13356 static void rpccli_spoolss_XcvData_done(struct tevent_req *subreq);
13357
13358 struct tevent_req *rpccli_spoolss_XcvData_send(TALLOC_CTX *mem_ctx,
13359                                                struct tevent_context *ev,
13360                                                struct rpc_pipe_client *cli,
13361                                                struct policy_handle *_handle /* [in] [ref] */,
13362                                                const char *_function_name /* [in] [charset(UTF16)] */,
13363                                                DATA_BLOB _in_data /* [in]  */,
13364                                                uint32_t __in_data_length /* [in] [value(r->in.in_data.length)] */,
13365                                                uint8_t *_out_data /* [out] [ref,size_is(out_data_size)] */,
13366                                                uint32_t _out_data_size /* [in]  */,
13367                                                uint32_t *_needed /* [out] [ref] */,
13368                                                uint32_t *_status_code /* [in,out] [ref] */)
13369 {
13370         struct tevent_req *req;
13371         struct rpccli_spoolss_XcvData_state *state;
13372         struct tevent_req *subreq;
13373
13374         req = tevent_req_create(mem_ctx, &state,
13375                                 struct rpccli_spoolss_XcvData_state);
13376         if (req == NULL) {
13377                 return NULL;
13378         }
13379         state->out_mem_ctx = NULL;
13380         state->dispatch_recv = cli->dispatch_recv;
13381
13382         /* In parameters */
13383         state->orig.in.handle = _handle;
13384         state->orig.in.function_name = _function_name;
13385         state->orig.in.in_data = _in_data;
13386         state->orig.in._in_data_length = __in_data_length;
13387         state->orig.in.out_data_size = _out_data_size;
13388         state->orig.in.status_code = _status_code;
13389
13390         /* Out parameters */
13391         state->orig.out.out_data = _out_data;
13392         state->orig.out.needed = _needed;
13393         state->orig.out.status_code = _status_code;
13394
13395         /* Result */
13396         ZERO_STRUCT(state->orig.out.result);
13397
13398         state->out_mem_ctx = talloc_named_const(state, 0,
13399                              "rpccli_spoolss_XcvData_out_memory");
13400         if (tevent_req_nomem(state->out_mem_ctx, req)) {
13401                 return tevent_req_post(req, ev);
13402         }
13403
13404         /* make a temporary copy, that we pass to the dispatch function */
13405         state->tmp = state->orig;
13406
13407         subreq = cli->dispatch_send(state, ev, cli,
13408                                     &ndr_table_spoolss,
13409                                     NDR_SPOOLSS_XCVDATA,
13410                                     &state->tmp);
13411         if (tevent_req_nomem(subreq, req)) {
13412                 return tevent_req_post(req, ev);
13413         }
13414         tevent_req_set_callback(subreq, rpccli_spoolss_XcvData_done, req);
13415         return req;
13416 }
13417
13418 static void rpccli_spoolss_XcvData_done(struct tevent_req *subreq)
13419 {
13420         struct tevent_req *req = tevent_req_callback_data(
13421                 subreq, struct tevent_req);
13422         struct rpccli_spoolss_XcvData_state *state = tevent_req_data(
13423                 req, struct rpccli_spoolss_XcvData_state);
13424         NTSTATUS status;
13425         TALLOC_CTX *mem_ctx;
13426
13427         if (state->out_mem_ctx) {
13428                 mem_ctx = state->out_mem_ctx;
13429         } else {
13430                 mem_ctx = state;
13431         }
13432
13433         status = state->dispatch_recv(subreq, mem_ctx);
13434         TALLOC_FREE(subreq);
13435         if (!NT_STATUS_IS_OK(status)) {
13436                 tevent_req_nterror(req, status);
13437                 return;
13438         }
13439
13440         /* Copy out parameters */
13441         memcpy(state->orig.out.out_data, state->tmp.out.out_data, (state->tmp.in.out_data_size) * sizeof(*state->orig.out.out_data));
13442         *state->orig.out.needed = *state->tmp.out.needed;
13443         *state->orig.out.status_code = *state->tmp.out.status_code;
13444
13445         /* Copy result */
13446         state->orig.out.result = state->tmp.out.result;
13447
13448         /* Reset temporary structure */
13449         ZERO_STRUCT(state->tmp);
13450
13451         tevent_req_done(req);
13452 }
13453
13454 NTSTATUS rpccli_spoolss_XcvData_recv(struct tevent_req *req,
13455                                      TALLOC_CTX *mem_ctx,
13456                                      WERROR *result)
13457 {
13458         struct rpccli_spoolss_XcvData_state *state = tevent_req_data(
13459                 req, struct rpccli_spoolss_XcvData_state);
13460         NTSTATUS status;
13461
13462         if (tevent_req_is_nterror(req, &status)) {
13463                 tevent_req_received(req);
13464                 return status;
13465         }
13466
13467         /* Steal possbile out parameters to the callers context */
13468         talloc_steal(mem_ctx, state->out_mem_ctx);
13469
13470         /* Return result */
13471         *result = state->orig.out.result;
13472
13473         tevent_req_received(req);
13474         return NT_STATUS_OK;
13475 }
13476
13477 NTSTATUS rpccli_spoolss_XcvData(struct rpc_pipe_client *cli,
13478                                 TALLOC_CTX *mem_ctx,
13479                                 struct policy_handle *handle /* [in] [ref] */,
13480                                 const char *function_name /* [in] [charset(UTF16)] */,
13481                                 DATA_BLOB in_data /* [in]  */,
13482                                 uint32_t _in_data_length /* [in] [value(r->in.in_data.length)] */,
13483                                 uint8_t *out_data /* [out] [ref,size_is(out_data_size)] */,
13484                                 uint32_t out_data_size /* [in]  */,
13485                                 uint32_t *needed /* [out] [ref] */,
13486                                 uint32_t *status_code /* [in,out] [ref] */,
13487                                 WERROR *werror)
13488 {
13489         struct spoolss_XcvData r;
13490         NTSTATUS status;
13491
13492         /* In parameters */
13493         r.in.handle = handle;
13494         r.in.function_name = function_name;
13495         r.in.in_data = in_data;
13496         r.in._in_data_length = _in_data_length;
13497         r.in.out_data_size = out_data_size;
13498         r.in.status_code = status_code;
13499
13500         status = cli->dispatch(cli,
13501                                 mem_ctx,
13502                                 &ndr_table_spoolss,
13503                                 NDR_SPOOLSS_XCVDATA,
13504                                 &r);
13505
13506         if (!NT_STATUS_IS_OK(status)) {
13507                 return status;
13508         }
13509
13510         if (NT_STATUS_IS_ERR(status)) {
13511                 return status;
13512         }
13513
13514         /* Return variables */
13515         memcpy(out_data, r.out.out_data, (r.in.out_data_size) * sizeof(*out_data));
13516         *needed = *r.out.needed;
13517         *status_code = *r.out.status_code;
13518
13519         /* Return result */
13520         if (werror) {
13521                 *werror = r.out.result;
13522         }
13523
13524         return werror_to_ntstatus(r.out.result);
13525 }
13526
13527 struct rpccli_spoolss_AddPrinterDriverEx_state {
13528         struct spoolss_AddPrinterDriverEx orig;
13529         struct spoolss_AddPrinterDriverEx tmp;
13530         TALLOC_CTX *out_mem_ctx;
13531         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
13532 };
13533
13534 static void rpccli_spoolss_AddPrinterDriverEx_done(struct tevent_req *subreq);
13535
13536 struct tevent_req *rpccli_spoolss_AddPrinterDriverEx_send(TALLOC_CTX *mem_ctx,
13537                                                           struct tevent_context *ev,
13538                                                           struct rpc_pipe_client *cli,
13539                                                           const char *_servername /* [in] [unique,charset(UTF16)] */,
13540                                                           struct spoolss_AddDriverInfoCtr *_info_ctr /* [in] [ref] */,
13541                                                           uint32_t _flags /* [in]  */)
13542 {
13543         struct tevent_req *req;
13544         struct rpccli_spoolss_AddPrinterDriverEx_state *state;
13545         struct tevent_req *subreq;
13546
13547         req = tevent_req_create(mem_ctx, &state,
13548                                 struct rpccli_spoolss_AddPrinterDriverEx_state);
13549         if (req == NULL) {
13550                 return NULL;
13551         }
13552         state->out_mem_ctx = NULL;
13553         state->dispatch_recv = cli->dispatch_recv;
13554
13555         /* In parameters */
13556         state->orig.in.servername = _servername;
13557         state->orig.in.info_ctr = _info_ctr;
13558         state->orig.in.flags = _flags;
13559
13560         /* Out parameters */
13561
13562         /* Result */
13563         ZERO_STRUCT(state->orig.out.result);
13564
13565         /* make a temporary copy, that we pass to the dispatch function */
13566         state->tmp = state->orig;
13567
13568         subreq = cli->dispatch_send(state, ev, cli,
13569                                     &ndr_table_spoolss,
13570                                     NDR_SPOOLSS_ADDPRINTERDRIVEREX,
13571                                     &state->tmp);
13572         if (tevent_req_nomem(subreq, req)) {
13573                 return tevent_req_post(req, ev);
13574         }
13575         tevent_req_set_callback(subreq, rpccli_spoolss_AddPrinterDriverEx_done, req);
13576         return req;
13577 }
13578
13579 static void rpccli_spoolss_AddPrinterDriverEx_done(struct tevent_req *subreq)
13580 {
13581         struct tevent_req *req = tevent_req_callback_data(
13582                 subreq, struct tevent_req);
13583         struct rpccli_spoolss_AddPrinterDriverEx_state *state = tevent_req_data(
13584                 req, struct rpccli_spoolss_AddPrinterDriverEx_state);
13585         NTSTATUS status;
13586         TALLOC_CTX *mem_ctx;
13587
13588         if (state->out_mem_ctx) {
13589                 mem_ctx = state->out_mem_ctx;
13590         } else {
13591                 mem_ctx = state;
13592         }
13593
13594         status = state->dispatch_recv(subreq, mem_ctx);
13595         TALLOC_FREE(subreq);
13596         if (!NT_STATUS_IS_OK(status)) {
13597                 tevent_req_nterror(req, status);
13598                 return;
13599         }
13600
13601         /* Copy out parameters */
13602
13603         /* Copy result */
13604         state->orig.out.result = state->tmp.out.result;
13605
13606         /* Reset temporary structure */
13607         ZERO_STRUCT(state->tmp);
13608
13609         tevent_req_done(req);
13610 }
13611
13612 NTSTATUS rpccli_spoolss_AddPrinterDriverEx_recv(struct tevent_req *req,
13613                                                 TALLOC_CTX *mem_ctx,
13614                                                 WERROR *result)
13615 {
13616         struct rpccli_spoolss_AddPrinterDriverEx_state *state = tevent_req_data(
13617                 req, struct rpccli_spoolss_AddPrinterDriverEx_state);
13618         NTSTATUS status;
13619
13620         if (tevent_req_is_nterror(req, &status)) {
13621                 tevent_req_received(req);
13622                 return status;
13623         }
13624
13625         /* Steal possbile out parameters to the callers context */
13626         talloc_steal(mem_ctx, state->out_mem_ctx);
13627
13628         /* Return result */
13629         *result = state->orig.out.result;
13630
13631         tevent_req_received(req);
13632         return NT_STATUS_OK;
13633 }
13634
13635 NTSTATUS rpccli_spoolss_AddPrinterDriverEx(struct rpc_pipe_client *cli,
13636                                            TALLOC_CTX *mem_ctx,
13637                                            const char *servername /* [in] [unique,charset(UTF16)] */,
13638                                            struct spoolss_AddDriverInfoCtr *info_ctr /* [in] [ref] */,
13639                                            uint32_t flags /* [in]  */,
13640                                            WERROR *werror)
13641 {
13642         struct spoolss_AddPrinterDriverEx r;
13643         NTSTATUS status;
13644
13645         /* In parameters */
13646         r.in.servername = servername;
13647         r.in.info_ctr = info_ctr;
13648         r.in.flags = flags;
13649
13650         status = cli->dispatch(cli,
13651                                 mem_ctx,
13652                                 &ndr_table_spoolss,
13653                                 NDR_SPOOLSS_ADDPRINTERDRIVEREX,
13654                                 &r);
13655
13656         if (!NT_STATUS_IS_OK(status)) {
13657                 return status;
13658         }
13659
13660         if (NT_STATUS_IS_ERR(status)) {
13661                 return status;
13662         }
13663
13664         /* Return variables */
13665
13666         /* Return result */
13667         if (werror) {
13668                 *werror = r.out.result;
13669         }
13670
13671         return werror_to_ntstatus(r.out.result);
13672 }
13673
13674 struct rpccli_spoolss_5a_state {
13675         struct spoolss_5a orig;
13676         struct spoolss_5a tmp;
13677         TALLOC_CTX *out_mem_ctx;
13678         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
13679 };
13680
13681 static void rpccli_spoolss_5a_done(struct tevent_req *subreq);
13682
13683 struct tevent_req *rpccli_spoolss_5a_send(TALLOC_CTX *mem_ctx,
13684                                           struct tevent_context *ev,
13685                                           struct rpc_pipe_client *cli)
13686 {
13687         struct tevent_req *req;
13688         struct rpccli_spoolss_5a_state *state;
13689         struct tevent_req *subreq;
13690
13691         req = tevent_req_create(mem_ctx, &state,
13692                                 struct rpccli_spoolss_5a_state);
13693         if (req == NULL) {
13694                 return NULL;
13695         }
13696         state->out_mem_ctx = NULL;
13697         state->dispatch_recv = cli->dispatch_recv;
13698
13699         /* In parameters */
13700
13701         /* Out parameters */
13702
13703         /* Result */
13704         ZERO_STRUCT(state->orig.out.result);
13705
13706         /* make a temporary copy, that we pass to the dispatch function */
13707         state->tmp = state->orig;
13708
13709         subreq = cli->dispatch_send(state, ev, cli,
13710                                     &ndr_table_spoolss,
13711                                     NDR_SPOOLSS_5A,
13712                                     &state->tmp);
13713         if (tevent_req_nomem(subreq, req)) {
13714                 return tevent_req_post(req, ev);
13715         }
13716         tevent_req_set_callback(subreq, rpccli_spoolss_5a_done, req);
13717         return req;
13718 }
13719
13720 static void rpccli_spoolss_5a_done(struct tevent_req *subreq)
13721 {
13722         struct tevent_req *req = tevent_req_callback_data(
13723                 subreq, struct tevent_req);
13724         struct rpccli_spoolss_5a_state *state = tevent_req_data(
13725                 req, struct rpccli_spoolss_5a_state);
13726         NTSTATUS status;
13727         TALLOC_CTX *mem_ctx;
13728
13729         if (state->out_mem_ctx) {
13730                 mem_ctx = state->out_mem_ctx;
13731         } else {
13732                 mem_ctx = state;
13733         }
13734
13735         status = state->dispatch_recv(subreq, mem_ctx);
13736         TALLOC_FREE(subreq);
13737         if (!NT_STATUS_IS_OK(status)) {
13738                 tevent_req_nterror(req, status);
13739                 return;
13740         }
13741
13742         /* Copy out parameters */
13743
13744         /* Copy result */
13745         state->orig.out.result = state->tmp.out.result;
13746
13747         /* Reset temporary structure */
13748         ZERO_STRUCT(state->tmp);
13749
13750         tevent_req_done(req);
13751 }
13752
13753 NTSTATUS rpccli_spoolss_5a_recv(struct tevent_req *req,
13754                                 TALLOC_CTX *mem_ctx,
13755                                 WERROR *result)
13756 {
13757         struct rpccli_spoolss_5a_state *state = tevent_req_data(
13758                 req, struct rpccli_spoolss_5a_state);
13759         NTSTATUS status;
13760
13761         if (tevent_req_is_nterror(req, &status)) {
13762                 tevent_req_received(req);
13763                 return status;
13764         }
13765
13766         /* Steal possbile out parameters to the callers context */
13767         talloc_steal(mem_ctx, state->out_mem_ctx);
13768
13769         /* Return result */
13770         *result = state->orig.out.result;
13771
13772         tevent_req_received(req);
13773         return NT_STATUS_OK;
13774 }
13775
13776 NTSTATUS rpccli_spoolss_5a(struct rpc_pipe_client *cli,
13777                            TALLOC_CTX *mem_ctx,
13778                            WERROR *werror)
13779 {
13780         struct spoolss_5a r;
13781         NTSTATUS status;
13782
13783         /* In parameters */
13784
13785         status = cli->dispatch(cli,
13786                                 mem_ctx,
13787                                 &ndr_table_spoolss,
13788                                 NDR_SPOOLSS_5A,
13789                                 &r);
13790
13791         if (!NT_STATUS_IS_OK(status)) {
13792                 return status;
13793         }
13794
13795         if (NT_STATUS_IS_ERR(status)) {
13796                 return status;
13797         }
13798
13799         /* Return variables */
13800
13801         /* Return result */
13802         if (werror) {
13803                 *werror = r.out.result;
13804         }
13805
13806         return werror_to_ntstatus(r.out.result);
13807 }
13808
13809 struct rpccli_spoolss_5b_state {
13810         struct spoolss_5b orig;
13811         struct spoolss_5b tmp;
13812         TALLOC_CTX *out_mem_ctx;
13813         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
13814 };
13815
13816 static void rpccli_spoolss_5b_done(struct tevent_req *subreq);
13817
13818 struct tevent_req *rpccli_spoolss_5b_send(TALLOC_CTX *mem_ctx,
13819                                           struct tevent_context *ev,
13820                                           struct rpc_pipe_client *cli)
13821 {
13822         struct tevent_req *req;
13823         struct rpccli_spoolss_5b_state *state;
13824         struct tevent_req *subreq;
13825
13826         req = tevent_req_create(mem_ctx, &state,
13827                                 struct rpccli_spoolss_5b_state);
13828         if (req == NULL) {
13829                 return NULL;
13830         }
13831         state->out_mem_ctx = NULL;
13832         state->dispatch_recv = cli->dispatch_recv;
13833
13834         /* In parameters */
13835
13836         /* Out parameters */
13837
13838         /* Result */
13839         ZERO_STRUCT(state->orig.out.result);
13840
13841         /* make a temporary copy, that we pass to the dispatch function */
13842         state->tmp = state->orig;
13843
13844         subreq = cli->dispatch_send(state, ev, cli,
13845                                     &ndr_table_spoolss,
13846                                     NDR_SPOOLSS_5B,
13847                                     &state->tmp);
13848         if (tevent_req_nomem(subreq, req)) {
13849                 return tevent_req_post(req, ev);
13850         }
13851         tevent_req_set_callback(subreq, rpccli_spoolss_5b_done, req);
13852         return req;
13853 }
13854
13855 static void rpccli_spoolss_5b_done(struct tevent_req *subreq)
13856 {
13857         struct tevent_req *req = tevent_req_callback_data(
13858                 subreq, struct tevent_req);
13859         struct rpccli_spoolss_5b_state *state = tevent_req_data(
13860                 req, struct rpccli_spoolss_5b_state);
13861         NTSTATUS status;
13862         TALLOC_CTX *mem_ctx;
13863
13864         if (state->out_mem_ctx) {
13865                 mem_ctx = state->out_mem_ctx;
13866         } else {
13867                 mem_ctx = state;
13868         }
13869
13870         status = state->dispatch_recv(subreq, mem_ctx);
13871         TALLOC_FREE(subreq);
13872         if (!NT_STATUS_IS_OK(status)) {
13873                 tevent_req_nterror(req, status);
13874                 return;
13875         }
13876
13877         /* Copy out parameters */
13878
13879         /* Copy result */
13880         state->orig.out.result = state->tmp.out.result;
13881
13882         /* Reset temporary structure */
13883         ZERO_STRUCT(state->tmp);
13884
13885         tevent_req_done(req);
13886 }
13887
13888 NTSTATUS rpccli_spoolss_5b_recv(struct tevent_req *req,
13889                                 TALLOC_CTX *mem_ctx,
13890                                 WERROR *result)
13891 {
13892         struct rpccli_spoolss_5b_state *state = tevent_req_data(
13893                 req, struct rpccli_spoolss_5b_state);
13894         NTSTATUS status;
13895
13896         if (tevent_req_is_nterror(req, &status)) {
13897                 tevent_req_received(req);
13898                 return status;
13899         }
13900
13901         /* Steal possbile out parameters to the callers context */
13902         talloc_steal(mem_ctx, state->out_mem_ctx);
13903
13904         /* Return result */
13905         *result = state->orig.out.result;
13906
13907         tevent_req_received(req);
13908         return NT_STATUS_OK;
13909 }
13910
13911 NTSTATUS rpccli_spoolss_5b(struct rpc_pipe_client *cli,
13912                            TALLOC_CTX *mem_ctx,
13913                            WERROR *werror)
13914 {
13915         struct spoolss_5b r;
13916         NTSTATUS status;
13917
13918         /* In parameters */
13919
13920         status = cli->dispatch(cli,
13921                                 mem_ctx,
13922                                 &ndr_table_spoolss,
13923                                 NDR_SPOOLSS_5B,
13924                                 &r);
13925
13926         if (!NT_STATUS_IS_OK(status)) {
13927                 return status;
13928         }
13929
13930         if (NT_STATUS_IS_ERR(status)) {
13931                 return status;
13932         }
13933
13934         /* Return variables */
13935
13936         /* Return result */
13937         if (werror) {
13938                 *werror = r.out.result;
13939         }
13940
13941         return werror_to_ntstatus(r.out.result);
13942 }
13943
13944 struct rpccli_spoolss_5c_state {
13945         struct spoolss_5c orig;
13946         struct spoolss_5c tmp;
13947         TALLOC_CTX *out_mem_ctx;
13948         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
13949 };
13950
13951 static void rpccli_spoolss_5c_done(struct tevent_req *subreq);
13952
13953 struct tevent_req *rpccli_spoolss_5c_send(TALLOC_CTX *mem_ctx,
13954                                           struct tevent_context *ev,
13955                                           struct rpc_pipe_client *cli)
13956 {
13957         struct tevent_req *req;
13958         struct rpccli_spoolss_5c_state *state;
13959         struct tevent_req *subreq;
13960
13961         req = tevent_req_create(mem_ctx, &state,
13962                                 struct rpccli_spoolss_5c_state);
13963         if (req == NULL) {
13964                 return NULL;
13965         }
13966         state->out_mem_ctx = NULL;
13967         state->dispatch_recv = cli->dispatch_recv;
13968
13969         /* In parameters */
13970
13971         /* Out parameters */
13972
13973         /* Result */
13974         ZERO_STRUCT(state->orig.out.result);
13975
13976         /* make a temporary copy, that we pass to the dispatch function */
13977         state->tmp = state->orig;
13978
13979         subreq = cli->dispatch_send(state, ev, cli,
13980                                     &ndr_table_spoolss,
13981                                     NDR_SPOOLSS_5C,
13982                                     &state->tmp);
13983         if (tevent_req_nomem(subreq, req)) {
13984                 return tevent_req_post(req, ev);
13985         }
13986         tevent_req_set_callback(subreq, rpccli_spoolss_5c_done, req);
13987         return req;
13988 }
13989
13990 static void rpccli_spoolss_5c_done(struct tevent_req *subreq)
13991 {
13992         struct tevent_req *req = tevent_req_callback_data(
13993                 subreq, struct tevent_req);
13994         struct rpccli_spoolss_5c_state *state = tevent_req_data(
13995                 req, struct rpccli_spoolss_5c_state);
13996         NTSTATUS status;
13997         TALLOC_CTX *mem_ctx;
13998
13999         if (state->out_mem_ctx) {
14000                 mem_ctx = state->out_mem_ctx;
14001         } else {
14002                 mem_ctx = state;
14003         }
14004
14005         status = state->dispatch_recv(subreq, mem_ctx);
14006         TALLOC_FREE(subreq);
14007         if (!NT_STATUS_IS_OK(status)) {
14008                 tevent_req_nterror(req, status);
14009                 return;
14010         }
14011
14012         /* Copy out parameters */
14013
14014         /* Copy result */
14015         state->orig.out.result = state->tmp.out.result;
14016
14017         /* Reset temporary structure */
14018         ZERO_STRUCT(state->tmp);
14019
14020         tevent_req_done(req);
14021 }
14022
14023 NTSTATUS rpccli_spoolss_5c_recv(struct tevent_req *req,
14024                                 TALLOC_CTX *mem_ctx,
14025                                 WERROR *result)
14026 {
14027         struct rpccli_spoolss_5c_state *state = tevent_req_data(
14028                 req, struct rpccli_spoolss_5c_state);
14029         NTSTATUS status;
14030
14031         if (tevent_req_is_nterror(req, &status)) {
14032                 tevent_req_received(req);
14033                 return status;
14034         }
14035
14036         /* Steal possbile out parameters to the callers context */
14037         talloc_steal(mem_ctx, state->out_mem_ctx);
14038
14039         /* Return result */
14040         *result = state->orig.out.result;
14041
14042         tevent_req_received(req);
14043         return NT_STATUS_OK;
14044 }
14045
14046 NTSTATUS rpccli_spoolss_5c(struct rpc_pipe_client *cli,
14047                            TALLOC_CTX *mem_ctx,
14048                            WERROR *werror)
14049 {
14050         struct spoolss_5c r;
14051         NTSTATUS status;
14052
14053         /* In parameters */
14054
14055         status = cli->dispatch(cli,
14056                                 mem_ctx,
14057                                 &ndr_table_spoolss,
14058                                 NDR_SPOOLSS_5C,
14059                                 &r);
14060
14061         if (!NT_STATUS_IS_OK(status)) {
14062                 return status;
14063         }
14064
14065         if (NT_STATUS_IS_ERR(status)) {
14066                 return status;
14067         }
14068
14069         /* Return variables */
14070
14071         /* Return result */
14072         if (werror) {
14073                 *werror = r.out.result;
14074         }
14075
14076         return werror_to_ntstatus(r.out.result);
14077 }
14078
14079 struct rpccli_spoolss_5d_state {
14080         struct spoolss_5d orig;
14081         struct spoolss_5d tmp;
14082         TALLOC_CTX *out_mem_ctx;
14083         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
14084 };
14085
14086 static void rpccli_spoolss_5d_done(struct tevent_req *subreq);
14087
14088 struct tevent_req *rpccli_spoolss_5d_send(TALLOC_CTX *mem_ctx,
14089                                           struct tevent_context *ev,
14090                                           struct rpc_pipe_client *cli)
14091 {
14092         struct tevent_req *req;
14093         struct rpccli_spoolss_5d_state *state;
14094         struct tevent_req *subreq;
14095
14096         req = tevent_req_create(mem_ctx, &state,
14097                                 struct rpccli_spoolss_5d_state);
14098         if (req == NULL) {
14099                 return NULL;
14100         }
14101         state->out_mem_ctx = NULL;
14102         state->dispatch_recv = cli->dispatch_recv;
14103
14104         /* In parameters */
14105
14106         /* Out parameters */
14107
14108         /* Result */
14109         ZERO_STRUCT(state->orig.out.result);
14110
14111         /* make a temporary copy, that we pass to the dispatch function */
14112         state->tmp = state->orig;
14113
14114         subreq = cli->dispatch_send(state, ev, cli,
14115                                     &ndr_table_spoolss,
14116                                     NDR_SPOOLSS_5D,
14117                                     &state->tmp);
14118         if (tevent_req_nomem(subreq, req)) {
14119                 return tevent_req_post(req, ev);
14120         }
14121         tevent_req_set_callback(subreq, rpccli_spoolss_5d_done, req);
14122         return req;
14123 }
14124
14125 static void rpccli_spoolss_5d_done(struct tevent_req *subreq)
14126 {
14127         struct tevent_req *req = tevent_req_callback_data(
14128                 subreq, struct tevent_req);
14129         struct rpccli_spoolss_5d_state *state = tevent_req_data(
14130                 req, struct rpccli_spoolss_5d_state);
14131         NTSTATUS status;
14132         TALLOC_CTX *mem_ctx;
14133
14134         if (state->out_mem_ctx) {
14135                 mem_ctx = state->out_mem_ctx;
14136         } else {
14137                 mem_ctx = state;
14138         }
14139
14140         status = state->dispatch_recv(subreq, mem_ctx);
14141         TALLOC_FREE(subreq);
14142         if (!NT_STATUS_IS_OK(status)) {
14143                 tevent_req_nterror(req, status);
14144                 return;
14145         }
14146
14147         /* Copy out parameters */
14148
14149         /* Copy result */
14150         state->orig.out.result = state->tmp.out.result;
14151
14152         /* Reset temporary structure */
14153         ZERO_STRUCT(state->tmp);
14154
14155         tevent_req_done(req);
14156 }
14157
14158 NTSTATUS rpccli_spoolss_5d_recv(struct tevent_req *req,
14159                                 TALLOC_CTX *mem_ctx,
14160                                 WERROR *result)
14161 {
14162         struct rpccli_spoolss_5d_state *state = tevent_req_data(
14163                 req, struct rpccli_spoolss_5d_state);
14164         NTSTATUS status;
14165
14166         if (tevent_req_is_nterror(req, &status)) {
14167                 tevent_req_received(req);
14168                 return status;
14169         }
14170
14171         /* Steal possbile out parameters to the callers context */
14172         talloc_steal(mem_ctx, state->out_mem_ctx);
14173
14174         /* Return result */
14175         *result = state->orig.out.result;
14176
14177         tevent_req_received(req);
14178         return NT_STATUS_OK;
14179 }
14180
14181 NTSTATUS rpccli_spoolss_5d(struct rpc_pipe_client *cli,
14182                            TALLOC_CTX *mem_ctx,
14183                            WERROR *werror)
14184 {
14185         struct spoolss_5d r;
14186         NTSTATUS status;
14187
14188         /* In parameters */
14189
14190         status = cli->dispatch(cli,
14191                                 mem_ctx,
14192                                 &ndr_table_spoolss,
14193                                 NDR_SPOOLSS_5D,
14194                                 &r);
14195
14196         if (!NT_STATUS_IS_OK(status)) {
14197                 return status;
14198         }
14199
14200         if (NT_STATUS_IS_ERR(status)) {
14201                 return status;
14202         }
14203
14204         /* Return variables */
14205
14206         /* Return result */
14207         if (werror) {
14208                 *werror = r.out.result;
14209         }
14210
14211         return werror_to_ntstatus(r.out.result);
14212 }
14213
14214 struct rpccli_spoolss_5e_state {
14215         struct spoolss_5e orig;
14216         struct spoolss_5e tmp;
14217         TALLOC_CTX *out_mem_ctx;
14218         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
14219 };
14220
14221 static void rpccli_spoolss_5e_done(struct tevent_req *subreq);
14222
14223 struct tevent_req *rpccli_spoolss_5e_send(TALLOC_CTX *mem_ctx,
14224                                           struct tevent_context *ev,
14225                                           struct rpc_pipe_client *cli)
14226 {
14227         struct tevent_req *req;
14228         struct rpccli_spoolss_5e_state *state;
14229         struct tevent_req *subreq;
14230
14231         req = tevent_req_create(mem_ctx, &state,
14232                                 struct rpccli_spoolss_5e_state);
14233         if (req == NULL) {
14234                 return NULL;
14235         }
14236         state->out_mem_ctx = NULL;
14237         state->dispatch_recv = cli->dispatch_recv;
14238
14239         /* In parameters */
14240
14241         /* Out parameters */
14242
14243         /* Result */
14244         ZERO_STRUCT(state->orig.out.result);
14245
14246         /* make a temporary copy, that we pass to the dispatch function */
14247         state->tmp = state->orig;
14248
14249         subreq = cli->dispatch_send(state, ev, cli,
14250                                     &ndr_table_spoolss,
14251                                     NDR_SPOOLSS_5E,
14252                                     &state->tmp);
14253         if (tevent_req_nomem(subreq, req)) {
14254                 return tevent_req_post(req, ev);
14255         }
14256         tevent_req_set_callback(subreq, rpccli_spoolss_5e_done, req);
14257         return req;
14258 }
14259
14260 static void rpccli_spoolss_5e_done(struct tevent_req *subreq)
14261 {
14262         struct tevent_req *req = tevent_req_callback_data(
14263                 subreq, struct tevent_req);
14264         struct rpccli_spoolss_5e_state *state = tevent_req_data(
14265                 req, struct rpccli_spoolss_5e_state);
14266         NTSTATUS status;
14267         TALLOC_CTX *mem_ctx;
14268
14269         if (state->out_mem_ctx) {
14270                 mem_ctx = state->out_mem_ctx;
14271         } else {
14272                 mem_ctx = state;
14273         }
14274
14275         status = state->dispatch_recv(subreq, mem_ctx);
14276         TALLOC_FREE(subreq);
14277         if (!NT_STATUS_IS_OK(status)) {
14278                 tevent_req_nterror(req, status);
14279                 return;
14280         }
14281
14282         /* Copy out parameters */
14283
14284         /* Copy result */
14285         state->orig.out.result = state->tmp.out.result;
14286
14287         /* Reset temporary structure */
14288         ZERO_STRUCT(state->tmp);
14289
14290         tevent_req_done(req);
14291 }
14292
14293 NTSTATUS rpccli_spoolss_5e_recv(struct tevent_req *req,
14294                                 TALLOC_CTX *mem_ctx,
14295                                 WERROR *result)
14296 {
14297         struct rpccli_spoolss_5e_state *state = tevent_req_data(
14298                 req, struct rpccli_spoolss_5e_state);
14299         NTSTATUS status;
14300
14301         if (tevent_req_is_nterror(req, &status)) {
14302                 tevent_req_received(req);
14303                 return status;
14304         }
14305
14306         /* Steal possbile out parameters to the callers context */
14307         talloc_steal(mem_ctx, state->out_mem_ctx);
14308
14309         /* Return result */
14310         *result = state->orig.out.result;
14311
14312         tevent_req_received(req);
14313         return NT_STATUS_OK;
14314 }
14315
14316 NTSTATUS rpccli_spoolss_5e(struct rpc_pipe_client *cli,
14317                            TALLOC_CTX *mem_ctx,
14318                            WERROR *werror)
14319 {
14320         struct spoolss_5e r;
14321         NTSTATUS status;
14322
14323         /* In parameters */
14324
14325         status = cli->dispatch(cli,
14326                                 mem_ctx,
14327                                 &ndr_table_spoolss,
14328                                 NDR_SPOOLSS_5E,
14329                                 &r);
14330
14331         if (!NT_STATUS_IS_OK(status)) {
14332                 return status;
14333         }
14334
14335         if (NT_STATUS_IS_ERR(status)) {
14336                 return status;
14337         }
14338
14339         /* Return variables */
14340
14341         /* Return result */
14342         if (werror) {
14343                 *werror = r.out.result;
14344         }
14345
14346         return werror_to_ntstatus(r.out.result);
14347 }
14348
14349 struct rpccli_spoolss_5f_state {
14350         struct spoolss_5f orig;
14351         struct spoolss_5f tmp;
14352         TALLOC_CTX *out_mem_ctx;
14353         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
14354 };
14355
14356 static void rpccli_spoolss_5f_done(struct tevent_req *subreq);
14357
14358 struct tevent_req *rpccli_spoolss_5f_send(TALLOC_CTX *mem_ctx,
14359                                           struct tevent_context *ev,
14360                                           struct rpc_pipe_client *cli)
14361 {
14362         struct tevent_req *req;
14363         struct rpccli_spoolss_5f_state *state;
14364         struct tevent_req *subreq;
14365
14366         req = tevent_req_create(mem_ctx, &state,
14367                                 struct rpccli_spoolss_5f_state);
14368         if (req == NULL) {
14369                 return NULL;
14370         }
14371         state->out_mem_ctx = NULL;
14372         state->dispatch_recv = cli->dispatch_recv;
14373
14374         /* In parameters */
14375
14376         /* Out parameters */
14377
14378         /* Result */
14379         ZERO_STRUCT(state->orig.out.result);
14380
14381         /* make a temporary copy, that we pass to the dispatch function */
14382         state->tmp = state->orig;
14383
14384         subreq = cli->dispatch_send(state, ev, cli,
14385                                     &ndr_table_spoolss,
14386                                     NDR_SPOOLSS_5F,
14387                                     &state->tmp);
14388         if (tevent_req_nomem(subreq, req)) {
14389                 return tevent_req_post(req, ev);
14390         }
14391         tevent_req_set_callback(subreq, rpccli_spoolss_5f_done, req);
14392         return req;
14393 }
14394
14395 static void rpccli_spoolss_5f_done(struct tevent_req *subreq)
14396 {
14397         struct tevent_req *req = tevent_req_callback_data(
14398                 subreq, struct tevent_req);
14399         struct rpccli_spoolss_5f_state *state = tevent_req_data(
14400                 req, struct rpccli_spoolss_5f_state);
14401         NTSTATUS status;
14402         TALLOC_CTX *mem_ctx;
14403
14404         if (state->out_mem_ctx) {
14405                 mem_ctx = state->out_mem_ctx;
14406         } else {
14407                 mem_ctx = state;
14408         }
14409
14410         status = state->dispatch_recv(subreq, mem_ctx);
14411         TALLOC_FREE(subreq);
14412         if (!NT_STATUS_IS_OK(status)) {
14413                 tevent_req_nterror(req, status);
14414                 return;
14415         }
14416
14417         /* Copy out parameters */
14418
14419         /* Copy result */
14420         state->orig.out.result = state->tmp.out.result;
14421
14422         /* Reset temporary structure */
14423         ZERO_STRUCT(state->tmp);
14424
14425         tevent_req_done(req);
14426 }
14427
14428 NTSTATUS rpccli_spoolss_5f_recv(struct tevent_req *req,
14429                                 TALLOC_CTX *mem_ctx,
14430                                 WERROR *result)
14431 {
14432         struct rpccli_spoolss_5f_state *state = tevent_req_data(
14433                 req, struct rpccli_spoolss_5f_state);
14434         NTSTATUS status;
14435
14436         if (tevent_req_is_nterror(req, &status)) {
14437                 tevent_req_received(req);
14438                 return status;
14439         }
14440
14441         /* Steal possbile out parameters to the callers context */
14442         talloc_steal(mem_ctx, state->out_mem_ctx);
14443
14444         /* Return result */
14445         *result = state->orig.out.result;
14446
14447         tevent_req_received(req);
14448         return NT_STATUS_OK;
14449 }
14450
14451 NTSTATUS rpccli_spoolss_5f(struct rpc_pipe_client *cli,
14452                            TALLOC_CTX *mem_ctx,
14453                            WERROR *werror)
14454 {
14455         struct spoolss_5f r;
14456         NTSTATUS status;
14457
14458         /* In parameters */
14459
14460         status = cli->dispatch(cli,
14461                                 mem_ctx,
14462                                 &ndr_table_spoolss,
14463                                 NDR_SPOOLSS_5F,
14464                                 &r);
14465
14466         if (!NT_STATUS_IS_OK(status)) {
14467                 return status;
14468         }
14469
14470         if (NT_STATUS_IS_ERR(status)) {
14471                 return status;
14472         }
14473
14474         /* Return variables */
14475
14476         /* Return result */
14477         if (werror) {
14478                 *werror = r.out.result;
14479         }
14480
14481         return werror_to_ntstatus(r.out.result);
14482 }
14483
14484 struct rpccli_spoolss_60_state {
14485         struct spoolss_60 orig;
14486         struct spoolss_60 tmp;
14487         TALLOC_CTX *out_mem_ctx;
14488         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
14489 };
14490
14491 static void rpccli_spoolss_60_done(struct tevent_req *subreq);
14492
14493 struct tevent_req *rpccli_spoolss_60_send(TALLOC_CTX *mem_ctx,
14494                                           struct tevent_context *ev,
14495                                           struct rpc_pipe_client *cli)
14496 {
14497         struct tevent_req *req;
14498         struct rpccli_spoolss_60_state *state;
14499         struct tevent_req *subreq;
14500
14501         req = tevent_req_create(mem_ctx, &state,
14502                                 struct rpccli_spoolss_60_state);
14503         if (req == NULL) {
14504                 return NULL;
14505         }
14506         state->out_mem_ctx = NULL;
14507         state->dispatch_recv = cli->dispatch_recv;
14508
14509         /* In parameters */
14510
14511         /* Out parameters */
14512
14513         /* Result */
14514         ZERO_STRUCT(state->orig.out.result);
14515
14516         /* make a temporary copy, that we pass to the dispatch function */
14517         state->tmp = state->orig;
14518
14519         subreq = cli->dispatch_send(state, ev, cli,
14520                                     &ndr_table_spoolss,
14521                                     NDR_SPOOLSS_60,
14522                                     &state->tmp);
14523         if (tevent_req_nomem(subreq, req)) {
14524                 return tevent_req_post(req, ev);
14525         }
14526         tevent_req_set_callback(subreq, rpccli_spoolss_60_done, req);
14527         return req;
14528 }
14529
14530 static void rpccli_spoolss_60_done(struct tevent_req *subreq)
14531 {
14532         struct tevent_req *req = tevent_req_callback_data(
14533                 subreq, struct tevent_req);
14534         struct rpccli_spoolss_60_state *state = tevent_req_data(
14535                 req, struct rpccli_spoolss_60_state);
14536         NTSTATUS status;
14537         TALLOC_CTX *mem_ctx;
14538
14539         if (state->out_mem_ctx) {
14540                 mem_ctx = state->out_mem_ctx;
14541         } else {
14542                 mem_ctx = state;
14543         }
14544
14545         status = state->dispatch_recv(subreq, mem_ctx);
14546         TALLOC_FREE(subreq);
14547         if (!NT_STATUS_IS_OK(status)) {
14548                 tevent_req_nterror(req, status);
14549                 return;
14550         }
14551
14552         /* Copy out parameters */
14553
14554         /* Copy result */
14555         state->orig.out.result = state->tmp.out.result;
14556
14557         /* Reset temporary structure */
14558         ZERO_STRUCT(state->tmp);
14559
14560         tevent_req_done(req);
14561 }
14562
14563 NTSTATUS rpccli_spoolss_60_recv(struct tevent_req *req,
14564                                 TALLOC_CTX *mem_ctx,
14565                                 WERROR *result)
14566 {
14567         struct rpccli_spoolss_60_state *state = tevent_req_data(
14568                 req, struct rpccli_spoolss_60_state);
14569         NTSTATUS status;
14570
14571         if (tevent_req_is_nterror(req, &status)) {
14572                 tevent_req_received(req);
14573                 return status;
14574         }
14575
14576         /* Steal possbile out parameters to the callers context */
14577         talloc_steal(mem_ctx, state->out_mem_ctx);
14578
14579         /* Return result */
14580         *result = state->orig.out.result;
14581
14582         tevent_req_received(req);
14583         return NT_STATUS_OK;
14584 }
14585
14586 NTSTATUS rpccli_spoolss_60(struct rpc_pipe_client *cli,
14587                            TALLOC_CTX *mem_ctx,
14588                            WERROR *werror)
14589 {
14590         struct spoolss_60 r;
14591         NTSTATUS status;
14592
14593         /* In parameters */
14594
14595         status = cli->dispatch(cli,
14596                                 mem_ctx,
14597                                 &ndr_table_spoolss,
14598                                 NDR_SPOOLSS_60,
14599                                 &r);
14600
14601         if (!NT_STATUS_IS_OK(status)) {
14602                 return status;
14603         }
14604
14605         if (NT_STATUS_IS_ERR(status)) {
14606                 return status;
14607         }
14608
14609         /* Return variables */
14610
14611         /* Return result */
14612         if (werror) {
14613                 *werror = r.out.result;
14614         }
14615
14616         return werror_to_ntstatus(r.out.result);
14617 }
14618
14619 struct rpccli_spoolss_61_state {
14620         struct spoolss_61 orig;
14621         struct spoolss_61 tmp;
14622         TALLOC_CTX *out_mem_ctx;
14623         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
14624 };
14625
14626 static void rpccli_spoolss_61_done(struct tevent_req *subreq);
14627
14628 struct tevent_req *rpccli_spoolss_61_send(TALLOC_CTX *mem_ctx,
14629                                           struct tevent_context *ev,
14630                                           struct rpc_pipe_client *cli)
14631 {
14632         struct tevent_req *req;
14633         struct rpccli_spoolss_61_state *state;
14634         struct tevent_req *subreq;
14635
14636         req = tevent_req_create(mem_ctx, &state,
14637                                 struct rpccli_spoolss_61_state);
14638         if (req == NULL) {
14639                 return NULL;
14640         }
14641         state->out_mem_ctx = NULL;
14642         state->dispatch_recv = cli->dispatch_recv;
14643
14644         /* In parameters */
14645
14646         /* Out parameters */
14647
14648         /* Result */
14649         ZERO_STRUCT(state->orig.out.result);
14650
14651         /* make a temporary copy, that we pass to the dispatch function */
14652         state->tmp = state->orig;
14653
14654         subreq = cli->dispatch_send(state, ev, cli,
14655                                     &ndr_table_spoolss,
14656                                     NDR_SPOOLSS_61,
14657                                     &state->tmp);
14658         if (tevent_req_nomem(subreq, req)) {
14659                 return tevent_req_post(req, ev);
14660         }
14661         tevent_req_set_callback(subreq, rpccli_spoolss_61_done, req);
14662         return req;
14663 }
14664
14665 static void rpccli_spoolss_61_done(struct tevent_req *subreq)
14666 {
14667         struct tevent_req *req = tevent_req_callback_data(
14668                 subreq, struct tevent_req);
14669         struct rpccli_spoolss_61_state *state = tevent_req_data(
14670                 req, struct rpccli_spoolss_61_state);
14671         NTSTATUS status;
14672         TALLOC_CTX *mem_ctx;
14673
14674         if (state->out_mem_ctx) {
14675                 mem_ctx = state->out_mem_ctx;
14676         } else {
14677                 mem_ctx = state;
14678         }
14679
14680         status = state->dispatch_recv(subreq, mem_ctx);
14681         TALLOC_FREE(subreq);
14682         if (!NT_STATUS_IS_OK(status)) {
14683                 tevent_req_nterror(req, status);
14684                 return;
14685         }
14686
14687         /* Copy out parameters */
14688
14689         /* Copy result */
14690         state->orig.out.result = state->tmp.out.result;
14691
14692         /* Reset temporary structure */
14693         ZERO_STRUCT(state->tmp);
14694
14695         tevent_req_done(req);
14696 }
14697
14698 NTSTATUS rpccli_spoolss_61_recv(struct tevent_req *req,
14699                                 TALLOC_CTX *mem_ctx,
14700                                 WERROR *result)
14701 {
14702         struct rpccli_spoolss_61_state *state = tevent_req_data(
14703                 req, struct rpccli_spoolss_61_state);
14704         NTSTATUS status;
14705
14706         if (tevent_req_is_nterror(req, &status)) {
14707                 tevent_req_received(req);
14708                 return status;
14709         }
14710
14711         /* Steal possbile out parameters to the callers context */
14712         talloc_steal(mem_ctx, state->out_mem_ctx);
14713
14714         /* Return result */
14715         *result = state->orig.out.result;
14716
14717         tevent_req_received(req);
14718         return NT_STATUS_OK;
14719 }
14720
14721 NTSTATUS rpccli_spoolss_61(struct rpc_pipe_client *cli,
14722                            TALLOC_CTX *mem_ctx,
14723                            WERROR *werror)
14724 {
14725         struct spoolss_61 r;
14726         NTSTATUS status;
14727
14728         /* In parameters */
14729
14730         status = cli->dispatch(cli,
14731                                 mem_ctx,
14732                                 &ndr_table_spoolss,
14733                                 NDR_SPOOLSS_61,
14734                                 &r);
14735
14736         if (!NT_STATUS_IS_OK(status)) {
14737                 return status;
14738         }
14739
14740         if (NT_STATUS_IS_ERR(status)) {
14741                 return status;
14742         }
14743
14744         /* Return variables */
14745
14746         /* Return result */
14747         if (werror) {
14748                 *werror = r.out.result;
14749         }
14750
14751         return werror_to_ntstatus(r.out.result);
14752 }
14753
14754 struct rpccli_spoolss_62_state {
14755         struct spoolss_62 orig;
14756         struct spoolss_62 tmp;
14757         TALLOC_CTX *out_mem_ctx;
14758         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
14759 };
14760
14761 static void rpccli_spoolss_62_done(struct tevent_req *subreq);
14762
14763 struct tevent_req *rpccli_spoolss_62_send(TALLOC_CTX *mem_ctx,
14764                                           struct tevent_context *ev,
14765                                           struct rpc_pipe_client *cli)
14766 {
14767         struct tevent_req *req;
14768         struct rpccli_spoolss_62_state *state;
14769         struct tevent_req *subreq;
14770
14771         req = tevent_req_create(mem_ctx, &state,
14772                                 struct rpccli_spoolss_62_state);
14773         if (req == NULL) {
14774                 return NULL;
14775         }
14776         state->out_mem_ctx = NULL;
14777         state->dispatch_recv = cli->dispatch_recv;
14778
14779         /* In parameters */
14780
14781         /* Out parameters */
14782
14783         /* Result */
14784         ZERO_STRUCT(state->orig.out.result);
14785
14786         /* make a temporary copy, that we pass to the dispatch function */
14787         state->tmp = state->orig;
14788
14789         subreq = cli->dispatch_send(state, ev, cli,
14790                                     &ndr_table_spoolss,
14791                                     NDR_SPOOLSS_62,
14792                                     &state->tmp);
14793         if (tevent_req_nomem(subreq, req)) {
14794                 return tevent_req_post(req, ev);
14795         }
14796         tevent_req_set_callback(subreq, rpccli_spoolss_62_done, req);
14797         return req;
14798 }
14799
14800 static void rpccli_spoolss_62_done(struct tevent_req *subreq)
14801 {
14802         struct tevent_req *req = tevent_req_callback_data(
14803                 subreq, struct tevent_req);
14804         struct rpccli_spoolss_62_state *state = tevent_req_data(
14805                 req, struct rpccli_spoolss_62_state);
14806         NTSTATUS status;
14807         TALLOC_CTX *mem_ctx;
14808
14809         if (state->out_mem_ctx) {
14810                 mem_ctx = state->out_mem_ctx;
14811         } else {
14812                 mem_ctx = state;
14813         }
14814
14815         status = state->dispatch_recv(subreq, mem_ctx);
14816         TALLOC_FREE(subreq);
14817         if (!NT_STATUS_IS_OK(status)) {
14818                 tevent_req_nterror(req, status);
14819                 return;
14820         }
14821
14822         /* Copy out parameters */
14823
14824         /* Copy result */
14825         state->orig.out.result = state->tmp.out.result;
14826
14827         /* Reset temporary structure */
14828         ZERO_STRUCT(state->tmp);
14829
14830         tevent_req_done(req);
14831 }
14832
14833 NTSTATUS rpccli_spoolss_62_recv(struct tevent_req *req,
14834                                 TALLOC_CTX *mem_ctx,
14835                                 WERROR *result)
14836 {
14837         struct rpccli_spoolss_62_state *state = tevent_req_data(
14838                 req, struct rpccli_spoolss_62_state);
14839         NTSTATUS status;
14840
14841         if (tevent_req_is_nterror(req, &status)) {
14842                 tevent_req_received(req);
14843                 return status;
14844         }
14845
14846         /* Steal possbile out parameters to the callers context */
14847         talloc_steal(mem_ctx, state->out_mem_ctx);
14848
14849         /* Return result */
14850         *result = state->orig.out.result;
14851
14852         tevent_req_received(req);
14853         return NT_STATUS_OK;
14854 }
14855
14856 NTSTATUS rpccli_spoolss_62(struct rpc_pipe_client *cli,
14857                            TALLOC_CTX *mem_ctx,
14858                            WERROR *werror)
14859 {
14860         struct spoolss_62 r;
14861         NTSTATUS status;
14862
14863         /* In parameters */
14864
14865         status = cli->dispatch(cli,
14866                                 mem_ctx,
14867                                 &ndr_table_spoolss,
14868                                 NDR_SPOOLSS_62,
14869                                 &r);
14870
14871         if (!NT_STATUS_IS_OK(status)) {
14872                 return status;
14873         }
14874
14875         if (NT_STATUS_IS_ERR(status)) {
14876                 return status;
14877         }
14878
14879         /* Return variables */
14880
14881         /* Return result */
14882         if (werror) {
14883                 *werror = r.out.result;
14884         }
14885
14886         return werror_to_ntstatus(r.out.result);
14887 }
14888
14889 struct rpccli_spoolss_63_state {
14890         struct spoolss_63 orig;
14891         struct spoolss_63 tmp;
14892         TALLOC_CTX *out_mem_ctx;
14893         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
14894 };
14895
14896 static void rpccli_spoolss_63_done(struct tevent_req *subreq);
14897
14898 struct tevent_req *rpccli_spoolss_63_send(TALLOC_CTX *mem_ctx,
14899                                           struct tevent_context *ev,
14900                                           struct rpc_pipe_client *cli)
14901 {
14902         struct tevent_req *req;
14903         struct rpccli_spoolss_63_state *state;
14904         struct tevent_req *subreq;
14905
14906         req = tevent_req_create(mem_ctx, &state,
14907                                 struct rpccli_spoolss_63_state);
14908         if (req == NULL) {
14909                 return NULL;
14910         }
14911         state->out_mem_ctx = NULL;
14912         state->dispatch_recv = cli->dispatch_recv;
14913
14914         /* In parameters */
14915
14916         /* Out parameters */
14917
14918         /* Result */
14919         ZERO_STRUCT(state->orig.out.result);
14920
14921         /* make a temporary copy, that we pass to the dispatch function */
14922         state->tmp = state->orig;
14923
14924         subreq = cli->dispatch_send(state, ev, cli,
14925                                     &ndr_table_spoolss,
14926                                     NDR_SPOOLSS_63,
14927                                     &state->tmp);
14928         if (tevent_req_nomem(subreq, req)) {
14929                 return tevent_req_post(req, ev);
14930         }
14931         tevent_req_set_callback(subreq, rpccli_spoolss_63_done, req);
14932         return req;
14933 }
14934
14935 static void rpccli_spoolss_63_done(struct tevent_req *subreq)
14936 {
14937         struct tevent_req *req = tevent_req_callback_data(
14938                 subreq, struct tevent_req);
14939         struct rpccli_spoolss_63_state *state = tevent_req_data(
14940                 req, struct rpccli_spoolss_63_state);
14941         NTSTATUS status;
14942         TALLOC_CTX *mem_ctx;
14943
14944         if (state->out_mem_ctx) {
14945                 mem_ctx = state->out_mem_ctx;
14946         } else {
14947                 mem_ctx = state;
14948         }
14949
14950         status = state->dispatch_recv(subreq, mem_ctx);
14951         TALLOC_FREE(subreq);
14952         if (!NT_STATUS_IS_OK(status)) {
14953                 tevent_req_nterror(req, status);
14954                 return;
14955         }
14956
14957         /* Copy out parameters */
14958
14959         /* Copy result */
14960         state->orig.out.result = state->tmp.out.result;
14961
14962         /* Reset temporary structure */
14963         ZERO_STRUCT(state->tmp);
14964
14965         tevent_req_done(req);
14966 }
14967
14968 NTSTATUS rpccli_spoolss_63_recv(struct tevent_req *req,
14969                                 TALLOC_CTX *mem_ctx,
14970                                 WERROR *result)
14971 {
14972         struct rpccli_spoolss_63_state *state = tevent_req_data(
14973                 req, struct rpccli_spoolss_63_state);
14974         NTSTATUS status;
14975
14976         if (tevent_req_is_nterror(req, &status)) {
14977                 tevent_req_received(req);
14978                 return status;
14979         }
14980
14981         /* Steal possbile out parameters to the callers context */
14982         talloc_steal(mem_ctx, state->out_mem_ctx);
14983
14984         /* Return result */
14985         *result = state->orig.out.result;
14986
14987         tevent_req_received(req);
14988         return NT_STATUS_OK;
14989 }
14990
14991 NTSTATUS rpccli_spoolss_63(struct rpc_pipe_client *cli,
14992                            TALLOC_CTX *mem_ctx,
14993                            WERROR *werror)
14994 {
14995         struct spoolss_63 r;
14996         NTSTATUS status;
14997
14998         /* In parameters */
14999
15000         status = cli->dispatch(cli,
15001                                 mem_ctx,
15002                                 &ndr_table_spoolss,
15003                                 NDR_SPOOLSS_63,
15004                                 &r);
15005
15006         if (!NT_STATUS_IS_OK(status)) {
15007                 return status;
15008         }
15009
15010         if (NT_STATUS_IS_ERR(status)) {
15011                 return status;
15012         }
15013
15014         /* Return variables */
15015
15016         /* Return result */
15017         if (werror) {
15018                 *werror = r.out.result;
15019         }
15020
15021         return werror_to_ntstatus(r.out.result);
15022 }
15023
15024 struct rpccli_spoolss_64_state {
15025         struct spoolss_64 orig;
15026         struct spoolss_64 tmp;
15027         TALLOC_CTX *out_mem_ctx;
15028         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
15029 };
15030
15031 static void rpccli_spoolss_64_done(struct tevent_req *subreq);
15032
15033 struct tevent_req *rpccli_spoolss_64_send(TALLOC_CTX *mem_ctx,
15034                                           struct tevent_context *ev,
15035                                           struct rpc_pipe_client *cli)
15036 {
15037         struct tevent_req *req;
15038         struct rpccli_spoolss_64_state *state;
15039         struct tevent_req *subreq;
15040
15041         req = tevent_req_create(mem_ctx, &state,
15042                                 struct rpccli_spoolss_64_state);
15043         if (req == NULL) {
15044                 return NULL;
15045         }
15046         state->out_mem_ctx = NULL;
15047         state->dispatch_recv = cli->dispatch_recv;
15048
15049         /* In parameters */
15050
15051         /* Out parameters */
15052
15053         /* Result */
15054         ZERO_STRUCT(state->orig.out.result);
15055
15056         /* make a temporary copy, that we pass to the dispatch function */
15057         state->tmp = state->orig;
15058
15059         subreq = cli->dispatch_send(state, ev, cli,
15060                                     &ndr_table_spoolss,
15061                                     NDR_SPOOLSS_64,
15062                                     &state->tmp);
15063         if (tevent_req_nomem(subreq, req)) {
15064                 return tevent_req_post(req, ev);
15065         }
15066         tevent_req_set_callback(subreq, rpccli_spoolss_64_done, req);
15067         return req;
15068 }
15069
15070 static void rpccli_spoolss_64_done(struct tevent_req *subreq)
15071 {
15072         struct tevent_req *req = tevent_req_callback_data(
15073                 subreq, struct tevent_req);
15074         struct rpccli_spoolss_64_state *state = tevent_req_data(
15075                 req, struct rpccli_spoolss_64_state);
15076         NTSTATUS status;
15077         TALLOC_CTX *mem_ctx;
15078
15079         if (state->out_mem_ctx) {
15080                 mem_ctx = state->out_mem_ctx;
15081         } else {
15082                 mem_ctx = state;
15083         }
15084
15085         status = state->dispatch_recv(subreq, mem_ctx);
15086         TALLOC_FREE(subreq);
15087         if (!NT_STATUS_IS_OK(status)) {
15088                 tevent_req_nterror(req, status);
15089                 return;
15090         }
15091
15092         /* Copy out parameters */
15093
15094         /* Copy result */
15095         state->orig.out.result = state->tmp.out.result;
15096
15097         /* Reset temporary structure */
15098         ZERO_STRUCT(state->tmp);
15099
15100         tevent_req_done(req);
15101 }
15102
15103 NTSTATUS rpccli_spoolss_64_recv(struct tevent_req *req,
15104                                 TALLOC_CTX *mem_ctx,
15105                                 WERROR *result)
15106 {
15107         struct rpccli_spoolss_64_state *state = tevent_req_data(
15108                 req, struct rpccli_spoolss_64_state);
15109         NTSTATUS status;
15110
15111         if (tevent_req_is_nterror(req, &status)) {
15112                 tevent_req_received(req);
15113                 return status;
15114         }
15115
15116         /* Steal possbile out parameters to the callers context */
15117         talloc_steal(mem_ctx, state->out_mem_ctx);
15118
15119         /* Return result */
15120         *result = state->orig.out.result;
15121
15122         tevent_req_received(req);
15123         return NT_STATUS_OK;
15124 }
15125
15126 NTSTATUS rpccli_spoolss_64(struct rpc_pipe_client *cli,
15127                            TALLOC_CTX *mem_ctx,
15128                            WERROR *werror)
15129 {
15130         struct spoolss_64 r;
15131         NTSTATUS status;
15132
15133         /* In parameters */
15134
15135         status = cli->dispatch(cli,
15136                                 mem_ctx,
15137                                 &ndr_table_spoolss,
15138                                 NDR_SPOOLSS_64,
15139                                 &r);
15140
15141         if (!NT_STATUS_IS_OK(status)) {
15142                 return status;
15143         }
15144
15145         if (NT_STATUS_IS_ERR(status)) {
15146                 return status;
15147         }
15148
15149         /* Return variables */
15150
15151         /* Return result */
15152         if (werror) {
15153                 *werror = r.out.result;
15154         }
15155
15156         return werror_to_ntstatus(r.out.result);
15157 }
15158
15159 struct rpccli_spoolss_65_state {
15160         struct spoolss_65 orig;
15161         struct spoolss_65 tmp;
15162         TALLOC_CTX *out_mem_ctx;
15163         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
15164 };
15165
15166 static void rpccli_spoolss_65_done(struct tevent_req *subreq);
15167
15168 struct tevent_req *rpccli_spoolss_65_send(TALLOC_CTX *mem_ctx,
15169                                           struct tevent_context *ev,
15170                                           struct rpc_pipe_client *cli)
15171 {
15172         struct tevent_req *req;
15173         struct rpccli_spoolss_65_state *state;
15174         struct tevent_req *subreq;
15175
15176         req = tevent_req_create(mem_ctx, &state,
15177                                 struct rpccli_spoolss_65_state);
15178         if (req == NULL) {
15179                 return NULL;
15180         }
15181         state->out_mem_ctx = NULL;
15182         state->dispatch_recv = cli->dispatch_recv;
15183
15184         /* In parameters */
15185
15186         /* Out parameters */
15187
15188         /* Result */
15189         ZERO_STRUCT(state->orig.out.result);
15190
15191         /* make a temporary copy, that we pass to the dispatch function */
15192         state->tmp = state->orig;
15193
15194         subreq = cli->dispatch_send(state, ev, cli,
15195                                     &ndr_table_spoolss,
15196                                     NDR_SPOOLSS_65,
15197                                     &state->tmp);
15198         if (tevent_req_nomem(subreq, req)) {
15199                 return tevent_req_post(req, ev);
15200         }
15201         tevent_req_set_callback(subreq, rpccli_spoolss_65_done, req);
15202         return req;
15203 }
15204
15205 static void rpccli_spoolss_65_done(struct tevent_req *subreq)
15206 {
15207         struct tevent_req *req = tevent_req_callback_data(
15208                 subreq, struct tevent_req);
15209         struct rpccli_spoolss_65_state *state = tevent_req_data(
15210                 req, struct rpccli_spoolss_65_state);
15211         NTSTATUS status;
15212         TALLOC_CTX *mem_ctx;
15213
15214         if (state->out_mem_ctx) {
15215                 mem_ctx = state->out_mem_ctx;
15216         } else {
15217                 mem_ctx = state;
15218         }
15219
15220         status = state->dispatch_recv(subreq, mem_ctx);
15221         TALLOC_FREE(subreq);
15222         if (!NT_STATUS_IS_OK(status)) {
15223                 tevent_req_nterror(req, status);
15224                 return;
15225         }
15226
15227         /* Copy out parameters */
15228
15229         /* Copy result */
15230         state->orig.out.result = state->tmp.out.result;
15231
15232         /* Reset temporary structure */
15233         ZERO_STRUCT(state->tmp);
15234
15235         tevent_req_done(req);
15236 }
15237
15238 NTSTATUS rpccli_spoolss_65_recv(struct tevent_req *req,
15239                                 TALLOC_CTX *mem_ctx,
15240                                 WERROR *result)
15241 {
15242         struct rpccli_spoolss_65_state *state = tevent_req_data(
15243                 req, struct rpccli_spoolss_65_state);
15244         NTSTATUS status;
15245
15246         if (tevent_req_is_nterror(req, &status)) {
15247                 tevent_req_received(req);
15248                 return status;
15249         }
15250
15251         /* Steal possbile out parameters to the callers context */
15252         talloc_steal(mem_ctx, state->out_mem_ctx);
15253
15254         /* Return result */
15255         *result = state->orig.out.result;
15256
15257         tevent_req_received(req);
15258         return NT_STATUS_OK;
15259 }
15260
15261 NTSTATUS rpccli_spoolss_65(struct rpc_pipe_client *cli,
15262                            TALLOC_CTX *mem_ctx,
15263                            WERROR *werror)
15264 {
15265         struct spoolss_65 r;
15266         NTSTATUS status;
15267
15268         /* In parameters */
15269
15270         status = cli->dispatch(cli,
15271                                 mem_ctx,
15272                                 &ndr_table_spoolss,
15273                                 NDR_SPOOLSS_65,
15274                                 &r);
15275
15276         if (!NT_STATUS_IS_OK(status)) {
15277                 return status;
15278         }
15279
15280         if (NT_STATUS_IS_ERR(status)) {
15281                 return status;
15282         }
15283
15284         /* Return variables */
15285
15286         /* Return result */
15287         if (werror) {
15288                 *werror = r.out.result;
15289         }
15290
15291         return werror_to_ntstatus(r.out.result);
15292 }
15293
15294 struct rpccli_spoolss_GetCorePrinterDrivers_state {
15295         struct spoolss_GetCorePrinterDrivers orig;
15296         struct spoolss_GetCorePrinterDrivers tmp;
15297         TALLOC_CTX *out_mem_ctx;
15298         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
15299 };
15300
15301 static void rpccli_spoolss_GetCorePrinterDrivers_done(struct tevent_req *subreq);
15302
15303 struct tevent_req *rpccli_spoolss_GetCorePrinterDrivers_send(TALLOC_CTX *mem_ctx,
15304                                                              struct tevent_context *ev,
15305                                                              struct rpc_pipe_client *cli,
15306                                                              const char *_servername /* [in] [unique,charset(UTF16)] */,
15307                                                              const char *_architecture /* [in] [ref,charset(UTF16)] */,
15308                                                              uint32_t _core_driver_size /* [in]  */,
15309                                                              const char *_core_driver_dependencies /* [in] [ref,charset(UTF16),size_is(core_driver_size)] */,
15310                                                              uint32_t _core_printer_driver_count /* [in]  */,
15311                                                              struct spoolss_CorePrinterDriver *_core_printer_drivers /* [out] [ref,size_is(core_printer_driver_count)] */)
15312 {
15313         struct tevent_req *req;
15314         struct rpccli_spoolss_GetCorePrinterDrivers_state *state;
15315         struct tevent_req *subreq;
15316
15317         req = tevent_req_create(mem_ctx, &state,
15318                                 struct rpccli_spoolss_GetCorePrinterDrivers_state);
15319         if (req == NULL) {
15320                 return NULL;
15321         }
15322         state->out_mem_ctx = NULL;
15323         state->dispatch_recv = cli->dispatch_recv;
15324
15325         /* In parameters */
15326         state->orig.in.servername = _servername;
15327         state->orig.in.architecture = _architecture;
15328         state->orig.in.core_driver_size = _core_driver_size;
15329         state->orig.in.core_driver_dependencies = _core_driver_dependencies;
15330         state->orig.in.core_printer_driver_count = _core_printer_driver_count;
15331
15332         /* Out parameters */
15333         state->orig.out.core_printer_drivers = _core_printer_drivers;
15334
15335         /* Result */
15336         ZERO_STRUCT(state->orig.out.result);
15337
15338         state->out_mem_ctx = talloc_named_const(state, 0,
15339                              "rpccli_spoolss_GetCorePrinterDrivers_out_memory");
15340         if (tevent_req_nomem(state->out_mem_ctx, req)) {
15341                 return tevent_req_post(req, ev);
15342         }
15343
15344         /* make a temporary copy, that we pass to the dispatch function */
15345         state->tmp = state->orig;
15346
15347         subreq = cli->dispatch_send(state, ev, cli,
15348                                     &ndr_table_spoolss,
15349                                     NDR_SPOOLSS_GETCOREPRINTERDRIVERS,
15350                                     &state->tmp);
15351         if (tevent_req_nomem(subreq, req)) {
15352                 return tevent_req_post(req, ev);
15353         }
15354         tevent_req_set_callback(subreq, rpccli_spoolss_GetCorePrinterDrivers_done, req);
15355         return req;
15356 }
15357
15358 static void rpccli_spoolss_GetCorePrinterDrivers_done(struct tevent_req *subreq)
15359 {
15360         struct tevent_req *req = tevent_req_callback_data(
15361                 subreq, struct tevent_req);
15362         struct rpccli_spoolss_GetCorePrinterDrivers_state *state = tevent_req_data(
15363                 req, struct rpccli_spoolss_GetCorePrinterDrivers_state);
15364         NTSTATUS status;
15365         TALLOC_CTX *mem_ctx;
15366
15367         if (state->out_mem_ctx) {
15368                 mem_ctx = state->out_mem_ctx;
15369         } else {
15370                 mem_ctx = state;
15371         }
15372
15373         status = state->dispatch_recv(subreq, mem_ctx);
15374         TALLOC_FREE(subreq);
15375         if (!NT_STATUS_IS_OK(status)) {
15376                 tevent_req_nterror(req, status);
15377                 return;
15378         }
15379
15380         /* Copy out parameters */
15381         memcpy(state->orig.out.core_printer_drivers, state->tmp.out.core_printer_drivers, (state->tmp.in.core_printer_driver_count) * sizeof(*state->orig.out.core_printer_drivers));
15382
15383         /* Copy result */
15384         state->orig.out.result = state->tmp.out.result;
15385
15386         /* Reset temporary structure */
15387         ZERO_STRUCT(state->tmp);
15388
15389         tevent_req_done(req);
15390 }
15391
15392 NTSTATUS rpccli_spoolss_GetCorePrinterDrivers_recv(struct tevent_req *req,
15393                                                    TALLOC_CTX *mem_ctx,
15394                                                    WERROR *result)
15395 {
15396         struct rpccli_spoolss_GetCorePrinterDrivers_state *state = tevent_req_data(
15397                 req, struct rpccli_spoolss_GetCorePrinterDrivers_state);
15398         NTSTATUS status;
15399
15400         if (tevent_req_is_nterror(req, &status)) {
15401                 tevent_req_received(req);
15402                 return status;
15403         }
15404
15405         /* Steal possbile out parameters to the callers context */
15406         talloc_steal(mem_ctx, state->out_mem_ctx);
15407
15408         /* Return result */
15409         *result = state->orig.out.result;
15410
15411         tevent_req_received(req);
15412         return NT_STATUS_OK;
15413 }
15414
15415 NTSTATUS rpccli_spoolss_GetCorePrinterDrivers(struct rpc_pipe_client *cli,
15416                                               TALLOC_CTX *mem_ctx,
15417                                               const char *servername /* [in] [unique,charset(UTF16)] */,
15418                                               const char *architecture /* [in] [ref,charset(UTF16)] */,
15419                                               uint32_t core_driver_size /* [in]  */,
15420                                               const char *core_driver_dependencies /* [in] [ref,charset(UTF16),size_is(core_driver_size)] */,
15421                                               uint32_t core_printer_driver_count /* [in]  */,
15422                                               struct spoolss_CorePrinterDriver *core_printer_drivers /* [out] [ref,size_is(core_printer_driver_count)] */,
15423                                               WERROR *werror)
15424 {
15425         struct spoolss_GetCorePrinterDrivers r;
15426         NTSTATUS status;
15427
15428         /* In parameters */
15429         r.in.servername = servername;
15430         r.in.architecture = architecture;
15431         r.in.core_driver_size = core_driver_size;
15432         r.in.core_driver_dependencies = core_driver_dependencies;
15433         r.in.core_printer_driver_count = core_printer_driver_count;
15434
15435         status = cli->dispatch(cli,
15436                                 mem_ctx,
15437                                 &ndr_table_spoolss,
15438                                 NDR_SPOOLSS_GETCOREPRINTERDRIVERS,
15439                                 &r);
15440
15441         if (!NT_STATUS_IS_OK(status)) {
15442                 return status;
15443         }
15444
15445         if (NT_STATUS_IS_ERR(status)) {
15446                 return status;
15447         }
15448
15449         /* Return variables */
15450         memcpy(core_printer_drivers, r.out.core_printer_drivers, (r.in.core_printer_driver_count) * sizeof(*core_printer_drivers));
15451
15452         /* Return result */
15453         if (werror) {
15454                 *werror = r.out.result;
15455         }
15456
15457         return werror_to_ntstatus(r.out.result);
15458 }
15459
15460 struct rpccli_spoolss_67_state {
15461         struct spoolss_67 orig;
15462         struct spoolss_67 tmp;
15463         TALLOC_CTX *out_mem_ctx;
15464         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
15465 };
15466
15467 static void rpccli_spoolss_67_done(struct tevent_req *subreq);
15468
15469 struct tevent_req *rpccli_spoolss_67_send(TALLOC_CTX *mem_ctx,
15470                                           struct tevent_context *ev,
15471                                           struct rpc_pipe_client *cli)
15472 {
15473         struct tevent_req *req;
15474         struct rpccli_spoolss_67_state *state;
15475         struct tevent_req *subreq;
15476
15477         req = tevent_req_create(mem_ctx, &state,
15478                                 struct rpccli_spoolss_67_state);
15479         if (req == NULL) {
15480                 return NULL;
15481         }
15482         state->out_mem_ctx = NULL;
15483         state->dispatch_recv = cli->dispatch_recv;
15484
15485         /* In parameters */
15486
15487         /* Out parameters */
15488
15489         /* Result */
15490         ZERO_STRUCT(state->orig.out.result);
15491
15492         /* make a temporary copy, that we pass to the dispatch function */
15493         state->tmp = state->orig;
15494
15495         subreq = cli->dispatch_send(state, ev, cli,
15496                                     &ndr_table_spoolss,
15497                                     NDR_SPOOLSS_67,
15498                                     &state->tmp);
15499         if (tevent_req_nomem(subreq, req)) {
15500                 return tevent_req_post(req, ev);
15501         }
15502         tevent_req_set_callback(subreq, rpccli_spoolss_67_done, req);
15503         return req;
15504 }
15505
15506 static void rpccli_spoolss_67_done(struct tevent_req *subreq)
15507 {
15508         struct tevent_req *req = tevent_req_callback_data(
15509                 subreq, struct tevent_req);
15510         struct rpccli_spoolss_67_state *state = tevent_req_data(
15511                 req, struct rpccli_spoolss_67_state);
15512         NTSTATUS status;
15513         TALLOC_CTX *mem_ctx;
15514
15515         if (state->out_mem_ctx) {
15516                 mem_ctx = state->out_mem_ctx;
15517         } else {
15518                 mem_ctx = state;
15519         }
15520
15521         status = state->dispatch_recv(subreq, mem_ctx);
15522         TALLOC_FREE(subreq);
15523         if (!NT_STATUS_IS_OK(status)) {
15524                 tevent_req_nterror(req, status);
15525                 return;
15526         }
15527
15528         /* Copy out parameters */
15529
15530         /* Copy result */
15531         state->orig.out.result = state->tmp.out.result;
15532
15533         /* Reset temporary structure */
15534         ZERO_STRUCT(state->tmp);
15535
15536         tevent_req_done(req);
15537 }
15538
15539 NTSTATUS rpccli_spoolss_67_recv(struct tevent_req *req,
15540                                 TALLOC_CTX *mem_ctx,
15541                                 WERROR *result)
15542 {
15543         struct rpccli_spoolss_67_state *state = tevent_req_data(
15544                 req, struct rpccli_spoolss_67_state);
15545         NTSTATUS status;
15546
15547         if (tevent_req_is_nterror(req, &status)) {
15548                 tevent_req_received(req);
15549                 return status;
15550         }
15551
15552         /* Steal possbile out parameters to the callers context */
15553         talloc_steal(mem_ctx, state->out_mem_ctx);
15554
15555         /* Return result */
15556         *result = state->orig.out.result;
15557
15558         tevent_req_received(req);
15559         return NT_STATUS_OK;
15560 }
15561
15562 NTSTATUS rpccli_spoolss_67(struct rpc_pipe_client *cli,
15563                            TALLOC_CTX *mem_ctx,
15564                            WERROR *werror)
15565 {
15566         struct spoolss_67 r;
15567         NTSTATUS status;
15568
15569         /* In parameters */
15570
15571         status = cli->dispatch(cli,
15572                                 mem_ctx,
15573                                 &ndr_table_spoolss,
15574                                 NDR_SPOOLSS_67,
15575                                 &r);
15576
15577         if (!NT_STATUS_IS_OK(status)) {
15578                 return status;
15579         }
15580
15581         if (NT_STATUS_IS_ERR(status)) {
15582                 return status;
15583         }
15584
15585         /* Return variables */
15586
15587         /* Return result */
15588         if (werror) {
15589                 *werror = r.out.result;
15590         }
15591
15592         return werror_to_ntstatus(r.out.result);
15593 }
15594
15595 struct rpccli_spoolss_GetPrinterDriverPackagePath_state {
15596         struct spoolss_GetPrinterDriverPackagePath orig;
15597         struct spoolss_GetPrinterDriverPackagePath tmp;
15598         TALLOC_CTX *out_mem_ctx;
15599         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
15600 };
15601
15602 static void rpccli_spoolss_GetPrinterDriverPackagePath_done(struct tevent_req *subreq);
15603
15604 struct tevent_req *rpccli_spoolss_GetPrinterDriverPackagePath_send(TALLOC_CTX *mem_ctx,
15605                                                                    struct tevent_context *ev,
15606                                                                    struct rpc_pipe_client *cli,
15607                                                                    const char *_servername /* [in] [unique,charset(UTF16)] */,
15608                                                                    const char *_architecture /* [in] [ref,charset(UTF16)] */,
15609                                                                    const char *_language /* [in] [unique,charset(UTF16)] */,
15610                                                                    const char *_package_id /* [in] [ref,charset(UTF16)] */,
15611                                                                    const char *_driver_package_cab /* [in,out] [unique,charset(UTF16),size_is(driver_package_cab_size)] */,
15612                                                                    uint32_t _driver_package_cab_size /* [in]  */,
15613                                                                    uint32_t *_required /* [out] [ref] */)
15614 {
15615         struct tevent_req *req;
15616         struct rpccli_spoolss_GetPrinterDriverPackagePath_state *state;
15617         struct tevent_req *subreq;
15618
15619         req = tevent_req_create(mem_ctx, &state,
15620                                 struct rpccli_spoolss_GetPrinterDriverPackagePath_state);
15621         if (req == NULL) {
15622                 return NULL;
15623         }
15624         state->out_mem_ctx = NULL;
15625         state->dispatch_recv = cli->dispatch_recv;
15626
15627         /* In parameters */
15628         state->orig.in.servername = _servername;
15629         state->orig.in.architecture = _architecture;
15630         state->orig.in.language = _language;
15631         state->orig.in.package_id = _package_id;
15632         state->orig.in.driver_package_cab = _driver_package_cab;
15633         state->orig.in.driver_package_cab_size = _driver_package_cab_size;
15634
15635         /* Out parameters */
15636         state->orig.out.driver_package_cab = _driver_package_cab;
15637         state->orig.out.required = _required;
15638
15639         /* Result */
15640         ZERO_STRUCT(state->orig.out.result);
15641
15642         state->out_mem_ctx = talloc_named_const(state, 0,
15643                              "rpccli_spoolss_GetPrinterDriverPackagePath_out_memory");
15644         if (tevent_req_nomem(state->out_mem_ctx, req)) {
15645                 return tevent_req_post(req, ev);
15646         }
15647
15648         /* make a temporary copy, that we pass to the dispatch function */
15649         state->tmp = state->orig;
15650
15651         subreq = cli->dispatch_send(state, ev, cli,
15652                                     &ndr_table_spoolss,
15653                                     NDR_SPOOLSS_GETPRINTERDRIVERPACKAGEPATH,
15654                                     &state->tmp);
15655         if (tevent_req_nomem(subreq, req)) {
15656                 return tevent_req_post(req, ev);
15657         }
15658         tevent_req_set_callback(subreq, rpccli_spoolss_GetPrinterDriverPackagePath_done, req);
15659         return req;
15660 }
15661
15662 static void rpccli_spoolss_GetPrinterDriverPackagePath_done(struct tevent_req *subreq)
15663 {
15664         struct tevent_req *req = tevent_req_callback_data(
15665                 subreq, struct tevent_req);
15666         struct rpccli_spoolss_GetPrinterDriverPackagePath_state *state = tevent_req_data(
15667                 req, struct rpccli_spoolss_GetPrinterDriverPackagePath_state);
15668         NTSTATUS status;
15669         TALLOC_CTX *mem_ctx;
15670
15671         if (state->out_mem_ctx) {
15672                 mem_ctx = state->out_mem_ctx;
15673         } else {
15674                 mem_ctx = state;
15675         }
15676
15677         status = state->dispatch_recv(subreq, mem_ctx);
15678         TALLOC_FREE(subreq);
15679         if (!NT_STATUS_IS_OK(status)) {
15680                 tevent_req_nterror(req, status);
15681                 return;
15682         }
15683
15684         /* Copy out parameters */
15685         if (state->orig.out.driver_package_cab && state->tmp.out.driver_package_cab) {
15686                 memcpy(discard_const_p(uint8_t *, state->orig.out.driver_package_cab), state->tmp.out.driver_package_cab, (state->tmp.in.driver_package_cab_size) * sizeof(*state->orig.out.driver_package_cab));
15687         }
15688         *state->orig.out.required = *state->tmp.out.required;
15689
15690         /* Copy result */
15691         state->orig.out.result = state->tmp.out.result;
15692
15693         /* Reset temporary structure */
15694         ZERO_STRUCT(state->tmp);
15695
15696         tevent_req_done(req);
15697 }
15698
15699 NTSTATUS rpccli_spoolss_GetPrinterDriverPackagePath_recv(struct tevent_req *req,
15700                                                          TALLOC_CTX *mem_ctx,
15701                                                          WERROR *result)
15702 {
15703         struct rpccli_spoolss_GetPrinterDriverPackagePath_state *state = tevent_req_data(
15704                 req, struct rpccli_spoolss_GetPrinterDriverPackagePath_state);
15705         NTSTATUS status;
15706
15707         if (tevent_req_is_nterror(req, &status)) {
15708                 tevent_req_received(req);
15709                 return status;
15710         }
15711
15712         /* Steal possbile out parameters to the callers context */
15713         talloc_steal(mem_ctx, state->out_mem_ctx);
15714
15715         /* Return result */
15716         *result = state->orig.out.result;
15717
15718         tevent_req_received(req);
15719         return NT_STATUS_OK;
15720 }
15721
15722 NTSTATUS rpccli_spoolss_GetPrinterDriverPackagePath(struct rpc_pipe_client *cli,
15723                                                     TALLOC_CTX *mem_ctx,
15724                                                     const char *servername /* [in] [unique,charset(UTF16)] */,
15725                                                     const char *architecture /* [in] [ref,charset(UTF16)] */,
15726                                                     const char *language /* [in] [unique,charset(UTF16)] */,
15727                                                     const char *package_id /* [in] [ref,charset(UTF16)] */,
15728                                                     const char *driver_package_cab /* [in,out] [unique,charset(UTF16),size_is(driver_package_cab_size)] */,
15729                                                     uint32_t driver_package_cab_size /* [in]  */,
15730                                                     uint32_t *required /* [out] [ref] */,
15731                                                     WERROR *werror)
15732 {
15733         struct spoolss_GetPrinterDriverPackagePath r;
15734         NTSTATUS status;
15735
15736         /* In parameters */
15737         r.in.servername = servername;
15738         r.in.architecture = architecture;
15739         r.in.language = language;
15740         r.in.package_id = package_id;
15741         r.in.driver_package_cab = driver_package_cab;
15742         r.in.driver_package_cab_size = driver_package_cab_size;
15743
15744         status = cli->dispatch(cli,
15745                                 mem_ctx,
15746                                 &ndr_table_spoolss,
15747                                 NDR_SPOOLSS_GETPRINTERDRIVERPACKAGEPATH,
15748                                 &r);
15749
15750         if (!NT_STATUS_IS_OK(status)) {
15751                 return status;
15752         }
15753
15754         if (NT_STATUS_IS_ERR(status)) {
15755                 return status;
15756         }
15757
15758         /* Return variables */
15759         if (driver_package_cab && r.out.driver_package_cab) {
15760                 memcpy(discard_const_p(uint8_t *, driver_package_cab), r.out.driver_package_cab, (r.in.driver_package_cab_size) * sizeof(*driver_package_cab));
15761         }
15762         *required = *r.out.required;
15763
15764         /* Return result */
15765         if (werror) {
15766                 *werror = r.out.result;
15767         }
15768
15769         return werror_to_ntstatus(r.out.result);
15770 }
15771
15772 struct rpccli_spoolss_69_state {
15773         struct spoolss_69 orig;
15774         struct spoolss_69 tmp;
15775         TALLOC_CTX *out_mem_ctx;
15776         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
15777 };
15778
15779 static void rpccli_spoolss_69_done(struct tevent_req *subreq);
15780
15781 struct tevent_req *rpccli_spoolss_69_send(TALLOC_CTX *mem_ctx,
15782                                           struct tevent_context *ev,
15783                                           struct rpc_pipe_client *cli)
15784 {
15785         struct tevent_req *req;
15786         struct rpccli_spoolss_69_state *state;
15787         struct tevent_req *subreq;
15788
15789         req = tevent_req_create(mem_ctx, &state,
15790                                 struct rpccli_spoolss_69_state);
15791         if (req == NULL) {
15792                 return NULL;
15793         }
15794         state->out_mem_ctx = NULL;
15795         state->dispatch_recv = cli->dispatch_recv;
15796
15797         /* In parameters */
15798
15799         /* Out parameters */
15800
15801         /* Result */
15802         ZERO_STRUCT(state->orig.out.result);
15803
15804         /* make a temporary copy, that we pass to the dispatch function */
15805         state->tmp = state->orig;
15806
15807         subreq = cli->dispatch_send(state, ev, cli,
15808                                     &ndr_table_spoolss,
15809                                     NDR_SPOOLSS_69,
15810                                     &state->tmp);
15811         if (tevent_req_nomem(subreq, req)) {
15812                 return tevent_req_post(req, ev);
15813         }
15814         tevent_req_set_callback(subreq, rpccli_spoolss_69_done, req);
15815         return req;
15816 }
15817
15818 static void rpccli_spoolss_69_done(struct tevent_req *subreq)
15819 {
15820         struct tevent_req *req = tevent_req_callback_data(
15821                 subreq, struct tevent_req);
15822         struct rpccli_spoolss_69_state *state = tevent_req_data(
15823                 req, struct rpccli_spoolss_69_state);
15824         NTSTATUS status;
15825         TALLOC_CTX *mem_ctx;
15826
15827         if (state->out_mem_ctx) {
15828                 mem_ctx = state->out_mem_ctx;
15829         } else {
15830                 mem_ctx = state;
15831         }
15832
15833         status = state->dispatch_recv(subreq, mem_ctx);
15834         TALLOC_FREE(subreq);
15835         if (!NT_STATUS_IS_OK(status)) {
15836                 tevent_req_nterror(req, status);
15837                 return;
15838         }
15839
15840         /* Copy out parameters */
15841
15842         /* Copy result */
15843         state->orig.out.result = state->tmp.out.result;
15844
15845         /* Reset temporary structure */
15846         ZERO_STRUCT(state->tmp);
15847
15848         tevent_req_done(req);
15849 }
15850
15851 NTSTATUS rpccli_spoolss_69_recv(struct tevent_req *req,
15852                                 TALLOC_CTX *mem_ctx,
15853                                 WERROR *result)
15854 {
15855         struct rpccli_spoolss_69_state *state = tevent_req_data(
15856                 req, struct rpccli_spoolss_69_state);
15857         NTSTATUS status;
15858
15859         if (tevent_req_is_nterror(req, &status)) {
15860                 tevent_req_received(req);
15861                 return status;
15862         }
15863
15864         /* Steal possbile out parameters to the callers context */
15865         talloc_steal(mem_ctx, state->out_mem_ctx);
15866
15867         /* Return result */
15868         *result = state->orig.out.result;
15869
15870         tevent_req_received(req);
15871         return NT_STATUS_OK;
15872 }
15873
15874 NTSTATUS rpccli_spoolss_69(struct rpc_pipe_client *cli,
15875                            TALLOC_CTX *mem_ctx,
15876                            WERROR *werror)
15877 {
15878         struct spoolss_69 r;
15879         NTSTATUS status;
15880
15881         /* In parameters */
15882
15883         status = cli->dispatch(cli,
15884                                 mem_ctx,
15885                                 &ndr_table_spoolss,
15886                                 NDR_SPOOLSS_69,
15887                                 &r);
15888
15889         if (!NT_STATUS_IS_OK(status)) {
15890                 return status;
15891         }
15892
15893         if (NT_STATUS_IS_ERR(status)) {
15894                 return status;
15895         }
15896
15897         /* Return variables */
15898
15899         /* Return result */
15900         if (werror) {
15901                 *werror = r.out.result;
15902         }
15903
15904         return werror_to_ntstatus(r.out.result);
15905 }
15906
15907 struct rpccli_spoolss_6a_state {
15908         struct spoolss_6a orig;
15909         struct spoolss_6a tmp;
15910         TALLOC_CTX *out_mem_ctx;
15911         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
15912 };
15913
15914 static void rpccli_spoolss_6a_done(struct tevent_req *subreq);
15915
15916 struct tevent_req *rpccli_spoolss_6a_send(TALLOC_CTX *mem_ctx,
15917                                           struct tevent_context *ev,
15918                                           struct rpc_pipe_client *cli)
15919 {
15920         struct tevent_req *req;
15921         struct rpccli_spoolss_6a_state *state;
15922         struct tevent_req *subreq;
15923
15924         req = tevent_req_create(mem_ctx, &state,
15925                                 struct rpccli_spoolss_6a_state);
15926         if (req == NULL) {
15927                 return NULL;
15928         }
15929         state->out_mem_ctx = NULL;
15930         state->dispatch_recv = cli->dispatch_recv;
15931
15932         /* In parameters */
15933
15934         /* Out parameters */
15935
15936         /* Result */
15937         ZERO_STRUCT(state->orig.out.result);
15938
15939         /* make a temporary copy, that we pass to the dispatch function */
15940         state->tmp = state->orig;
15941
15942         subreq = cli->dispatch_send(state, ev, cli,
15943                                     &ndr_table_spoolss,
15944                                     NDR_SPOOLSS_6A,
15945                                     &state->tmp);
15946         if (tevent_req_nomem(subreq, req)) {
15947                 return tevent_req_post(req, ev);
15948         }
15949         tevent_req_set_callback(subreq, rpccli_spoolss_6a_done, req);
15950         return req;
15951 }
15952
15953 static void rpccli_spoolss_6a_done(struct tevent_req *subreq)
15954 {
15955         struct tevent_req *req = tevent_req_callback_data(
15956                 subreq, struct tevent_req);
15957         struct rpccli_spoolss_6a_state *state = tevent_req_data(
15958                 req, struct rpccli_spoolss_6a_state);
15959         NTSTATUS status;
15960         TALLOC_CTX *mem_ctx;
15961
15962         if (state->out_mem_ctx) {
15963                 mem_ctx = state->out_mem_ctx;
15964         } else {
15965                 mem_ctx = state;
15966         }
15967
15968         status = state->dispatch_recv(subreq, mem_ctx);
15969         TALLOC_FREE(subreq);
15970         if (!NT_STATUS_IS_OK(status)) {
15971                 tevent_req_nterror(req, status);
15972                 return;
15973         }
15974
15975         /* Copy out parameters */
15976
15977         /* Copy result */
15978         state->orig.out.result = state->tmp.out.result;
15979
15980         /* Reset temporary structure */
15981         ZERO_STRUCT(state->tmp);
15982
15983         tevent_req_done(req);
15984 }
15985
15986 NTSTATUS rpccli_spoolss_6a_recv(struct tevent_req *req,
15987                                 TALLOC_CTX *mem_ctx,
15988                                 WERROR *result)
15989 {
15990         struct rpccli_spoolss_6a_state *state = tevent_req_data(
15991                 req, struct rpccli_spoolss_6a_state);
15992         NTSTATUS status;
15993
15994         if (tevent_req_is_nterror(req, &status)) {
15995                 tevent_req_received(req);
15996                 return status;
15997         }
15998
15999         /* Steal possbile out parameters to the callers context */
16000         talloc_steal(mem_ctx, state->out_mem_ctx);
16001
16002         /* Return result */
16003         *result = state->orig.out.result;
16004
16005         tevent_req_received(req);
16006         return NT_STATUS_OK;
16007 }
16008
16009 NTSTATUS rpccli_spoolss_6a(struct rpc_pipe_client *cli,
16010                            TALLOC_CTX *mem_ctx,
16011                            WERROR *werror)
16012 {
16013         struct spoolss_6a r;
16014         NTSTATUS status;
16015
16016         /* In parameters */
16017
16018         status = cli->dispatch(cli,
16019                                 mem_ctx,
16020                                 &ndr_table_spoolss,
16021                                 NDR_SPOOLSS_6A,
16022                                 &r);
16023
16024         if (!NT_STATUS_IS_OK(status)) {
16025                 return status;
16026         }
16027
16028         if (NT_STATUS_IS_ERR(status)) {
16029                 return status;
16030         }
16031
16032         /* Return variables */
16033
16034         /* Return result */
16035         if (werror) {
16036                 *werror = r.out.result;
16037         }
16038
16039         return werror_to_ntstatus(r.out.result);
16040 }
16041
16042 struct rpccli_spoolss_6b_state {
16043         struct spoolss_6b orig;
16044         struct spoolss_6b tmp;
16045         TALLOC_CTX *out_mem_ctx;
16046         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
16047 };
16048
16049 static void rpccli_spoolss_6b_done(struct tevent_req *subreq);
16050
16051 struct tevent_req *rpccli_spoolss_6b_send(TALLOC_CTX *mem_ctx,
16052                                           struct tevent_context *ev,
16053                                           struct rpc_pipe_client *cli)
16054 {
16055         struct tevent_req *req;
16056         struct rpccli_spoolss_6b_state *state;
16057         struct tevent_req *subreq;
16058
16059         req = tevent_req_create(mem_ctx, &state,
16060                                 struct rpccli_spoolss_6b_state);
16061         if (req == NULL) {
16062                 return NULL;
16063         }
16064         state->out_mem_ctx = NULL;
16065         state->dispatch_recv = cli->dispatch_recv;
16066
16067         /* In parameters */
16068
16069         /* Out parameters */
16070
16071         /* Result */
16072         ZERO_STRUCT(state->orig.out.result);
16073
16074         /* make a temporary copy, that we pass to the dispatch function */
16075         state->tmp = state->orig;
16076
16077         subreq = cli->dispatch_send(state, ev, cli,
16078                                     &ndr_table_spoolss,
16079                                     NDR_SPOOLSS_6B,
16080                                     &state->tmp);
16081         if (tevent_req_nomem(subreq, req)) {
16082                 return tevent_req_post(req, ev);
16083         }
16084         tevent_req_set_callback(subreq, rpccli_spoolss_6b_done, req);
16085         return req;
16086 }
16087
16088 static void rpccli_spoolss_6b_done(struct tevent_req *subreq)
16089 {
16090         struct tevent_req *req = tevent_req_callback_data(
16091                 subreq, struct tevent_req);
16092         struct rpccli_spoolss_6b_state *state = tevent_req_data(
16093                 req, struct rpccli_spoolss_6b_state);
16094         NTSTATUS status;
16095         TALLOC_CTX *mem_ctx;
16096
16097         if (state->out_mem_ctx) {
16098                 mem_ctx = state->out_mem_ctx;
16099         } else {
16100                 mem_ctx = state;
16101         }
16102
16103         status = state->dispatch_recv(subreq, mem_ctx);
16104         TALLOC_FREE(subreq);
16105         if (!NT_STATUS_IS_OK(status)) {
16106                 tevent_req_nterror(req, status);
16107                 return;
16108         }
16109
16110         /* Copy out parameters */
16111
16112         /* Copy result */
16113         state->orig.out.result = state->tmp.out.result;
16114
16115         /* Reset temporary structure */
16116         ZERO_STRUCT(state->tmp);
16117
16118         tevent_req_done(req);
16119 }
16120
16121 NTSTATUS rpccli_spoolss_6b_recv(struct tevent_req *req,
16122                                 TALLOC_CTX *mem_ctx,
16123                                 WERROR *result)
16124 {
16125         struct rpccli_spoolss_6b_state *state = tevent_req_data(
16126                 req, struct rpccli_spoolss_6b_state);
16127         NTSTATUS status;
16128
16129         if (tevent_req_is_nterror(req, &status)) {
16130                 tevent_req_received(req);
16131                 return status;
16132         }
16133
16134         /* Steal possbile out parameters to the callers context */
16135         talloc_steal(mem_ctx, state->out_mem_ctx);
16136
16137         /* Return result */
16138         *result = state->orig.out.result;
16139
16140         tevent_req_received(req);
16141         return NT_STATUS_OK;
16142 }
16143
16144 NTSTATUS rpccli_spoolss_6b(struct rpc_pipe_client *cli,
16145                            TALLOC_CTX *mem_ctx,
16146                            WERROR *werror)
16147 {
16148         struct spoolss_6b r;
16149         NTSTATUS status;
16150
16151         /* In parameters */
16152
16153         status = cli->dispatch(cli,
16154                                 mem_ctx,
16155                                 &ndr_table_spoolss,
16156                                 NDR_SPOOLSS_6B,
16157                                 &r);
16158
16159         if (!NT_STATUS_IS_OK(status)) {
16160                 return status;
16161         }
16162
16163         if (NT_STATUS_IS_ERR(status)) {
16164                 return status;
16165         }
16166
16167         /* Return variables */
16168
16169         /* Return result */
16170         if (werror) {
16171                 *werror = r.out.result;
16172         }
16173
16174         return werror_to_ntstatus(r.out.result);
16175 }
16176
16177 struct rpccli_spoolss_6c_state {
16178         struct spoolss_6c orig;
16179         struct spoolss_6c tmp;
16180         TALLOC_CTX *out_mem_ctx;
16181         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
16182 };
16183
16184 static void rpccli_spoolss_6c_done(struct tevent_req *subreq);
16185
16186 struct tevent_req *rpccli_spoolss_6c_send(TALLOC_CTX *mem_ctx,
16187                                           struct tevent_context *ev,
16188                                           struct rpc_pipe_client *cli)
16189 {
16190         struct tevent_req *req;
16191         struct rpccli_spoolss_6c_state *state;
16192         struct tevent_req *subreq;
16193
16194         req = tevent_req_create(mem_ctx, &state,
16195                                 struct rpccli_spoolss_6c_state);
16196         if (req == NULL) {
16197                 return NULL;
16198         }
16199         state->out_mem_ctx = NULL;
16200         state->dispatch_recv = cli->dispatch_recv;
16201
16202         /* In parameters */
16203
16204         /* Out parameters */
16205
16206         /* Result */
16207         ZERO_STRUCT(state->orig.out.result);
16208
16209         /* make a temporary copy, that we pass to the dispatch function */
16210         state->tmp = state->orig;
16211
16212         subreq = cli->dispatch_send(state, ev, cli,
16213                                     &ndr_table_spoolss,
16214                                     NDR_SPOOLSS_6C,
16215                                     &state->tmp);
16216         if (tevent_req_nomem(subreq, req)) {
16217                 return tevent_req_post(req, ev);
16218         }
16219         tevent_req_set_callback(subreq, rpccli_spoolss_6c_done, req);
16220         return req;
16221 }
16222
16223 static void rpccli_spoolss_6c_done(struct tevent_req *subreq)
16224 {
16225         struct tevent_req *req = tevent_req_callback_data(
16226                 subreq, struct tevent_req);
16227         struct rpccli_spoolss_6c_state *state = tevent_req_data(
16228                 req, struct rpccli_spoolss_6c_state);
16229         NTSTATUS status;
16230         TALLOC_CTX *mem_ctx;
16231
16232         if (state->out_mem_ctx) {
16233                 mem_ctx = state->out_mem_ctx;
16234         } else {
16235                 mem_ctx = state;
16236         }
16237
16238         status = state->dispatch_recv(subreq, mem_ctx);
16239         TALLOC_FREE(subreq);
16240         if (!NT_STATUS_IS_OK(status)) {
16241                 tevent_req_nterror(req, status);
16242                 return;
16243         }
16244
16245         /* Copy out parameters */
16246
16247         /* Copy result */
16248         state->orig.out.result = state->tmp.out.result;
16249
16250         /* Reset temporary structure */
16251         ZERO_STRUCT(state->tmp);
16252
16253         tevent_req_done(req);
16254 }
16255
16256 NTSTATUS rpccli_spoolss_6c_recv(struct tevent_req *req,
16257                                 TALLOC_CTX *mem_ctx,
16258                                 WERROR *result)
16259 {
16260         struct rpccli_spoolss_6c_state *state = tevent_req_data(
16261                 req, struct rpccli_spoolss_6c_state);
16262         NTSTATUS status;
16263
16264         if (tevent_req_is_nterror(req, &status)) {
16265                 tevent_req_received(req);
16266                 return status;
16267         }
16268
16269         /* Steal possbile out parameters to the callers context */
16270         talloc_steal(mem_ctx, state->out_mem_ctx);
16271
16272         /* Return result */
16273         *result = state->orig.out.result;
16274
16275         tevent_req_received(req);
16276         return NT_STATUS_OK;
16277 }
16278
16279 NTSTATUS rpccli_spoolss_6c(struct rpc_pipe_client *cli,
16280                            TALLOC_CTX *mem_ctx,
16281                            WERROR *werror)
16282 {
16283         struct spoolss_6c r;
16284         NTSTATUS status;
16285
16286         /* In parameters */
16287
16288         status = cli->dispatch(cli,
16289                                 mem_ctx,
16290                                 &ndr_table_spoolss,
16291                                 NDR_SPOOLSS_6C,
16292                                 &r);
16293
16294         if (!NT_STATUS_IS_OK(status)) {
16295                 return status;
16296         }
16297
16298         if (NT_STATUS_IS_ERR(status)) {
16299                 return status;
16300         }
16301
16302         /* Return variables */
16303
16304         /* Return result */
16305         if (werror) {
16306                 *werror = r.out.result;
16307         }
16308
16309         return werror_to_ntstatus(r.out.result);
16310 }
16311
16312 struct rpccli_spoolss_6d_state {
16313         struct spoolss_6d orig;
16314         struct spoolss_6d tmp;
16315         TALLOC_CTX *out_mem_ctx;
16316         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
16317 };
16318
16319 static void rpccli_spoolss_6d_done(struct tevent_req *subreq);
16320
16321 struct tevent_req *rpccli_spoolss_6d_send(TALLOC_CTX *mem_ctx,
16322                                           struct tevent_context *ev,
16323                                           struct rpc_pipe_client *cli)
16324 {
16325         struct tevent_req *req;
16326         struct rpccli_spoolss_6d_state *state;
16327         struct tevent_req *subreq;
16328
16329         req = tevent_req_create(mem_ctx, &state,
16330                                 struct rpccli_spoolss_6d_state);
16331         if (req == NULL) {
16332                 return NULL;
16333         }
16334         state->out_mem_ctx = NULL;
16335         state->dispatch_recv = cli->dispatch_recv;
16336
16337         /* In parameters */
16338
16339         /* Out parameters */
16340
16341         /* Result */
16342         ZERO_STRUCT(state->orig.out.result);
16343
16344         /* make a temporary copy, that we pass to the dispatch function */
16345         state->tmp = state->orig;
16346
16347         subreq = cli->dispatch_send(state, ev, cli,
16348                                     &ndr_table_spoolss,
16349                                     NDR_SPOOLSS_6D,
16350                                     &state->tmp);
16351         if (tevent_req_nomem(subreq, req)) {
16352                 return tevent_req_post(req, ev);
16353         }
16354         tevent_req_set_callback(subreq, rpccli_spoolss_6d_done, req);
16355         return req;
16356 }
16357
16358 static void rpccli_spoolss_6d_done(struct tevent_req *subreq)
16359 {
16360         struct tevent_req *req = tevent_req_callback_data(
16361                 subreq, struct tevent_req);
16362         struct rpccli_spoolss_6d_state *state = tevent_req_data(
16363                 req, struct rpccli_spoolss_6d_state);
16364         NTSTATUS status;
16365         TALLOC_CTX *mem_ctx;
16366
16367         if (state->out_mem_ctx) {
16368                 mem_ctx = state->out_mem_ctx;
16369         } else {
16370                 mem_ctx = state;
16371         }
16372
16373         status = state->dispatch_recv(subreq, mem_ctx);
16374         TALLOC_FREE(subreq);
16375         if (!NT_STATUS_IS_OK(status)) {
16376                 tevent_req_nterror(req, status);
16377                 return;
16378         }
16379
16380         /* Copy out parameters */
16381
16382         /* Copy result */
16383         state->orig.out.result = state->tmp.out.result;
16384
16385         /* Reset temporary structure */
16386         ZERO_STRUCT(state->tmp);
16387
16388         tevent_req_done(req);
16389 }
16390
16391 NTSTATUS rpccli_spoolss_6d_recv(struct tevent_req *req,
16392                                 TALLOC_CTX *mem_ctx,
16393                                 WERROR *result)
16394 {
16395         struct rpccli_spoolss_6d_state *state = tevent_req_data(
16396                 req, struct rpccli_spoolss_6d_state);
16397         NTSTATUS status;
16398
16399         if (tevent_req_is_nterror(req, &status)) {
16400                 tevent_req_received(req);
16401                 return status;
16402         }
16403
16404         /* Steal possbile out parameters to the callers context */
16405         talloc_steal(mem_ctx, state->out_mem_ctx);
16406
16407         /* Return result */
16408         *result = state->orig.out.result;
16409
16410         tevent_req_received(req);
16411         return NT_STATUS_OK;
16412 }
16413
16414 NTSTATUS rpccli_spoolss_6d(struct rpc_pipe_client *cli,
16415                            TALLOC_CTX *mem_ctx,
16416                            WERROR *werror)
16417 {
16418         struct spoolss_6d r;
16419         NTSTATUS status;
16420
16421         /* In parameters */
16422
16423         status = cli->dispatch(cli,
16424                                 mem_ctx,
16425                                 &ndr_table_spoolss,
16426                                 NDR_SPOOLSS_6D,
16427                                 &r);
16428
16429         if (!NT_STATUS_IS_OK(status)) {
16430                 return status;
16431         }
16432
16433         if (NT_STATUS_IS_ERR(status)) {
16434                 return status;
16435         }
16436
16437         /* Return variables */
16438
16439         /* Return result */
16440         if (werror) {
16441                 *werror = r.out.result;
16442         }
16443
16444         return werror_to_ntstatus(r.out.result);
16445 }
16446