git add -f bin/default/librpc/gen_ndr/*.[ch] bin/default/source*/librpc/gen_ndr/...
[metze/samba/wip.git] / bin.gen_ndr / default / librpc / gen_ndr / ndr_spoolss_c.c
1 /* client functions auto-generated by pidl */
2
3 #include "includes.h"
4 #include <tevent.h>
5 #include "lib/util/tevent_ntstatus.h"
6 #include "bin/default/librpc/gen_ndr/ndr_spoolss.h"
7 #include "bin/default/librpc/gen_ndr/ndr_spoolss_c.h"
8
9 /* spoolss - client functions generated by pidl */
10
11 struct dcerpc_spoolss_EnumPrinters_r_state {
12         TALLOC_CTX *out_mem_ctx;
13 };
14
15 static void dcerpc_spoolss_EnumPrinters_r_done(struct tevent_req *subreq);
16
17 struct tevent_req *dcerpc_spoolss_EnumPrinters_r_send(TALLOC_CTX *mem_ctx,
18         struct tevent_context *ev,
19         struct dcerpc_binding_handle *h,
20         struct spoolss_EnumPrinters *r)
21 {
22         struct tevent_req *req;
23         struct dcerpc_spoolss_EnumPrinters_r_state *state;
24         struct tevent_req *subreq;
25
26         req = tevent_req_create(mem_ctx, &state,
27                                 struct dcerpc_spoolss_EnumPrinters_r_state);
28         if (req == NULL) {
29                 return NULL;
30         }
31
32         state->out_mem_ctx = talloc_new(state);
33         if (tevent_req_nomem(state->out_mem_ctx, req)) {
34                 return tevent_req_post(req, ev);
35         }
36
37         subreq = dcerpc_binding_handle_call_send(state, ev, h,
38                         NULL, &ndr_table_spoolss,
39                         NDR_SPOOLSS_ENUMPRINTERS, state->out_mem_ctx, r);
40         if (tevent_req_nomem(subreq, req)) {
41                 return tevent_req_post(req, ev);
42         }
43         tevent_req_set_callback(subreq, dcerpc_spoolss_EnumPrinters_r_done, req);
44
45         return req;
46 }
47
48 static void dcerpc_spoolss_EnumPrinters_r_done(struct tevent_req *subreq)
49 {
50         struct tevent_req *req =
51                 tevent_req_callback_data(subreq,
52                 struct tevent_req);
53         NTSTATUS status;
54
55         status = dcerpc_binding_handle_call_recv(subreq);
56         TALLOC_FREE(subreq);
57         if (tevent_req_nterror(req, status)) {
58                 return;
59         }
60
61         tevent_req_done(req);
62 }
63
64 NTSTATUS dcerpc_spoolss_EnumPrinters_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
65 {
66         struct dcerpc_spoolss_EnumPrinters_r_state *state =
67                 tevent_req_data(req,
68                 struct dcerpc_spoolss_EnumPrinters_r_state);
69         NTSTATUS status;
70
71         if (tevent_req_is_nterror(req, &status)) {
72                 tevent_req_received(req);
73                 return status;
74         }
75
76         talloc_steal(mem_ctx, state->out_mem_ctx);
77
78         tevent_req_received(req);
79         return NT_STATUS_OK;
80 }
81
82 NTSTATUS dcerpc_spoolss_EnumPrinters_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_EnumPrinters *r)
83 {
84         NTSTATUS status;
85
86         status = dcerpc_binding_handle_call(h,
87                         NULL, &ndr_table_spoolss,
88                         NDR_SPOOLSS_ENUMPRINTERS, mem_ctx, r);
89
90         return status;
91 }
92
93 struct dcerpc_spoolss_EnumPrinters_state {
94         struct spoolss_EnumPrinters orig;
95         struct spoolss_EnumPrinters tmp;
96         TALLOC_CTX *out_mem_ctx;
97 };
98
99 static void dcerpc_spoolss_EnumPrinters_done(struct tevent_req *subreq);
100
101 struct tevent_req *dcerpc_spoolss_EnumPrinters_send(TALLOC_CTX *mem_ctx,
102                                                     struct tevent_context *ev,
103                                                     struct dcerpc_binding_handle *h,
104                                                     uint32_t _flags /* [in]  */,
105                                                     const char *_server /* [in] [unique,charset(UTF16)] */,
106                                                     uint32_t _level /* [in]  */,
107                                                     DATA_BLOB *_buffer /* [in] [unique] */,
108                                                     uint32_t _offered /* [in]  */,
109                                                     uint32_t *_count /* [out] [ref] */,
110                                                     union spoolss_PrinterInfo **_info /* [out] [ref,switch_is(level),size_is(,*count)] */,
111                                                     uint32_t *_needed /* [out] [ref] */)
112 {
113         struct tevent_req *req;
114         struct dcerpc_spoolss_EnumPrinters_state *state;
115         struct tevent_req *subreq;
116
117         req = tevent_req_create(mem_ctx, &state,
118                                 struct dcerpc_spoolss_EnumPrinters_state);
119         if (req == NULL) {
120                 return NULL;
121         }
122         state->out_mem_ctx = NULL;
123
124         /* In parameters */
125         state->orig.in.flags = _flags;
126         state->orig.in.server = _server;
127         state->orig.in.level = _level;
128         state->orig.in.buffer = _buffer;
129         state->orig.in.offered = _offered;
130
131         /* Out parameters */
132         state->orig.out.count = _count;
133         state->orig.out.info = _info;
134         state->orig.out.needed = _needed;
135
136         /* Result */
137         ZERO_STRUCT(state->orig.out.result);
138
139         state->out_mem_ctx = talloc_named_const(state, 0,
140                              "dcerpc_spoolss_EnumPrinters_out_memory");
141         if (tevent_req_nomem(state->out_mem_ctx, req)) {
142                 return tevent_req_post(req, ev);
143         }
144
145         /* make a temporary copy, that we pass to the dispatch function */
146         state->tmp = state->orig;
147
148         subreq = dcerpc_spoolss_EnumPrinters_r_send(state, ev, h, &state->tmp);
149         if (tevent_req_nomem(subreq, req)) {
150                 return tevent_req_post(req, ev);
151         }
152         tevent_req_set_callback(subreq, dcerpc_spoolss_EnumPrinters_done, req);
153         return req;
154 }
155
156 static void dcerpc_spoolss_EnumPrinters_done(struct tevent_req *subreq)
157 {
158         struct tevent_req *req = tevent_req_callback_data(
159                 subreq, struct tevent_req);
160         struct dcerpc_spoolss_EnumPrinters_state *state = tevent_req_data(
161                 req, struct dcerpc_spoolss_EnumPrinters_state);
162         NTSTATUS status;
163         TALLOC_CTX *mem_ctx;
164
165         if (state->out_mem_ctx) {
166                 mem_ctx = state->out_mem_ctx;
167         } else {
168                 mem_ctx = state;
169         }
170
171         status = dcerpc_spoolss_EnumPrinters_r_recv(subreq, mem_ctx);
172         TALLOC_FREE(subreq);
173         if (tevent_req_nterror(req, status)) {
174                 return;
175         }
176
177         /* Copy out parameters */
178         *state->orig.out.count = *state->tmp.out.count;
179         *state->orig.out.info = *state->tmp.out.info;
180         *state->orig.out.needed = *state->tmp.out.needed;
181
182         /* Copy result */
183         state->orig.out.result = state->tmp.out.result;
184
185         /* Reset temporary structure */
186         ZERO_STRUCT(state->tmp);
187
188         tevent_req_done(req);
189 }
190
191 NTSTATUS dcerpc_spoolss_EnumPrinters_recv(struct tevent_req *req,
192                                           TALLOC_CTX *mem_ctx,
193                                           WERROR *result)
194 {
195         struct dcerpc_spoolss_EnumPrinters_state *state = tevent_req_data(
196                 req, struct dcerpc_spoolss_EnumPrinters_state);
197         NTSTATUS status;
198
199         if (tevent_req_is_nterror(req, &status)) {
200                 tevent_req_received(req);
201                 return status;
202         }
203
204         /* Steal possible out parameters to the callers context */
205         talloc_steal(mem_ctx, state->out_mem_ctx);
206
207         /* Return result */
208         *result = state->orig.out.result;
209
210         tevent_req_received(req);
211         return NT_STATUS_OK;
212 }
213
214 NTSTATUS dcerpc_spoolss_EnumPrinters(struct dcerpc_binding_handle *h,
215                                      TALLOC_CTX *mem_ctx,
216                                      uint32_t _flags /* [in]  */,
217                                      const char *_server /* [in] [unique,charset(UTF16)] */,
218                                      uint32_t _level /* [in]  */,
219                                      DATA_BLOB *_buffer /* [in] [unique] */,
220                                      uint32_t _offered /* [in]  */,
221                                      uint32_t *_count /* [out] [ref] */,
222                                      union spoolss_PrinterInfo **_info /* [out] [ref,switch_is(level),size_is(,*count)] */,
223                                      uint32_t *_needed /* [out] [ref] */,
224                                      WERROR *result)
225 {
226         struct spoolss_EnumPrinters r;
227         NTSTATUS status;
228
229         /* In parameters */
230         r.in.flags = _flags;
231         r.in.server = _server;
232         r.in.level = _level;
233         r.in.buffer = _buffer;
234         r.in.offered = _offered;
235
236         status = dcerpc_spoolss_EnumPrinters_r(h, mem_ctx, &r);
237         if (!NT_STATUS_IS_OK(status)) {
238                 return status;
239         }
240
241         /* Return variables */
242         *_count = *r.out.count;
243         *_info = *r.out.info;
244         *_needed = *r.out.needed;
245
246         /* Return result */
247         *result = r.out.result;
248
249         return NT_STATUS_OK;
250 }
251
252 struct dcerpc_spoolss_OpenPrinter_r_state {
253         TALLOC_CTX *out_mem_ctx;
254 };
255
256 static void dcerpc_spoolss_OpenPrinter_r_done(struct tevent_req *subreq);
257
258 struct tevent_req *dcerpc_spoolss_OpenPrinter_r_send(TALLOC_CTX *mem_ctx,
259         struct tevent_context *ev,
260         struct dcerpc_binding_handle *h,
261         struct spoolss_OpenPrinter *r)
262 {
263         struct tevent_req *req;
264         struct dcerpc_spoolss_OpenPrinter_r_state *state;
265         struct tevent_req *subreq;
266
267         req = tevent_req_create(mem_ctx, &state,
268                                 struct dcerpc_spoolss_OpenPrinter_r_state);
269         if (req == NULL) {
270                 return NULL;
271         }
272
273         state->out_mem_ctx = talloc_new(state);
274         if (tevent_req_nomem(state->out_mem_ctx, req)) {
275                 return tevent_req_post(req, ev);
276         }
277
278         subreq = dcerpc_binding_handle_call_send(state, ev, h,
279                         NULL, &ndr_table_spoolss,
280                         NDR_SPOOLSS_OPENPRINTER, state->out_mem_ctx, r);
281         if (tevent_req_nomem(subreq, req)) {
282                 return tevent_req_post(req, ev);
283         }
284         tevent_req_set_callback(subreq, dcerpc_spoolss_OpenPrinter_r_done, req);
285
286         return req;
287 }
288
289 static void dcerpc_spoolss_OpenPrinter_r_done(struct tevent_req *subreq)
290 {
291         struct tevent_req *req =
292                 tevent_req_callback_data(subreq,
293                 struct tevent_req);
294         NTSTATUS status;
295
296         status = dcerpc_binding_handle_call_recv(subreq);
297         TALLOC_FREE(subreq);
298         if (tevent_req_nterror(req, status)) {
299                 return;
300         }
301
302         tevent_req_done(req);
303 }
304
305 NTSTATUS dcerpc_spoolss_OpenPrinter_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
306 {
307         struct dcerpc_spoolss_OpenPrinter_r_state *state =
308                 tevent_req_data(req,
309                 struct dcerpc_spoolss_OpenPrinter_r_state);
310         NTSTATUS status;
311
312         if (tevent_req_is_nterror(req, &status)) {
313                 tevent_req_received(req);
314                 return status;
315         }
316
317         talloc_steal(mem_ctx, state->out_mem_ctx);
318
319         tevent_req_received(req);
320         return NT_STATUS_OK;
321 }
322
323 NTSTATUS dcerpc_spoolss_OpenPrinter_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_OpenPrinter *r)
324 {
325         NTSTATUS status;
326
327         status = dcerpc_binding_handle_call(h,
328                         NULL, &ndr_table_spoolss,
329                         NDR_SPOOLSS_OPENPRINTER, mem_ctx, r);
330
331         return status;
332 }
333
334 struct dcerpc_spoolss_OpenPrinter_state {
335         struct spoolss_OpenPrinter orig;
336         struct spoolss_OpenPrinter tmp;
337         TALLOC_CTX *out_mem_ctx;
338 };
339
340 static void dcerpc_spoolss_OpenPrinter_done(struct tevent_req *subreq);
341
342 struct tevent_req *dcerpc_spoolss_OpenPrinter_send(TALLOC_CTX *mem_ctx,
343                                                    struct tevent_context *ev,
344                                                    struct dcerpc_binding_handle *h,
345                                                    const char *_printername /* [in] [unique,charset(UTF16)] */,
346                                                    const char *_datatype /* [in] [unique,charset(UTF16)] */,
347                                                    struct spoolss_DevmodeContainer _devmode_ctr /* [in]  */,
348                                                    uint32_t _access_mask /* [in]  */,
349                                                    struct policy_handle *_handle /* [out] [ref] */)
350 {
351         struct tevent_req *req;
352         struct dcerpc_spoolss_OpenPrinter_state *state;
353         struct tevent_req *subreq;
354
355         req = tevent_req_create(mem_ctx, &state,
356                                 struct dcerpc_spoolss_OpenPrinter_state);
357         if (req == NULL) {
358                 return NULL;
359         }
360         state->out_mem_ctx = NULL;
361
362         /* In parameters */
363         state->orig.in.printername = _printername;
364         state->orig.in.datatype = _datatype;
365         state->orig.in.devmode_ctr = _devmode_ctr;
366         state->orig.in.access_mask = _access_mask;
367
368         /* Out parameters */
369         state->orig.out.handle = _handle;
370
371         /* Result */
372         ZERO_STRUCT(state->orig.out.result);
373
374         state->out_mem_ctx = talloc_named_const(state, 0,
375                              "dcerpc_spoolss_OpenPrinter_out_memory");
376         if (tevent_req_nomem(state->out_mem_ctx, req)) {
377                 return tevent_req_post(req, ev);
378         }
379
380         /* make a temporary copy, that we pass to the dispatch function */
381         state->tmp = state->orig;
382
383         subreq = dcerpc_spoolss_OpenPrinter_r_send(state, ev, h, &state->tmp);
384         if (tevent_req_nomem(subreq, req)) {
385                 return tevent_req_post(req, ev);
386         }
387         tevent_req_set_callback(subreq, dcerpc_spoolss_OpenPrinter_done, req);
388         return req;
389 }
390
391 static void dcerpc_spoolss_OpenPrinter_done(struct tevent_req *subreq)
392 {
393         struct tevent_req *req = tevent_req_callback_data(
394                 subreq, struct tevent_req);
395         struct dcerpc_spoolss_OpenPrinter_state *state = tevent_req_data(
396                 req, struct dcerpc_spoolss_OpenPrinter_state);
397         NTSTATUS status;
398         TALLOC_CTX *mem_ctx;
399
400         if (state->out_mem_ctx) {
401                 mem_ctx = state->out_mem_ctx;
402         } else {
403                 mem_ctx = state;
404         }
405
406         status = dcerpc_spoolss_OpenPrinter_r_recv(subreq, mem_ctx);
407         TALLOC_FREE(subreq);
408         if (tevent_req_nterror(req, status)) {
409                 return;
410         }
411
412         /* Copy out parameters */
413         *state->orig.out.handle = *state->tmp.out.handle;
414
415         /* Copy result */
416         state->orig.out.result = state->tmp.out.result;
417
418         /* Reset temporary structure */
419         ZERO_STRUCT(state->tmp);
420
421         tevent_req_done(req);
422 }
423
424 NTSTATUS dcerpc_spoolss_OpenPrinter_recv(struct tevent_req *req,
425                                          TALLOC_CTX *mem_ctx,
426                                          WERROR *result)
427 {
428         struct dcerpc_spoolss_OpenPrinter_state *state = tevent_req_data(
429                 req, struct dcerpc_spoolss_OpenPrinter_state);
430         NTSTATUS status;
431
432         if (tevent_req_is_nterror(req, &status)) {
433                 tevent_req_received(req);
434                 return status;
435         }
436
437         /* Steal possible out parameters to the callers context */
438         talloc_steal(mem_ctx, state->out_mem_ctx);
439
440         /* Return result */
441         *result = state->orig.out.result;
442
443         tevent_req_received(req);
444         return NT_STATUS_OK;
445 }
446
447 NTSTATUS dcerpc_spoolss_OpenPrinter(struct dcerpc_binding_handle *h,
448                                     TALLOC_CTX *mem_ctx,
449                                     const char *_printername /* [in] [unique,charset(UTF16)] */,
450                                     const char *_datatype /* [in] [unique,charset(UTF16)] */,
451                                     struct spoolss_DevmodeContainer _devmode_ctr /* [in]  */,
452                                     uint32_t _access_mask /* [in]  */,
453                                     struct policy_handle *_handle /* [out] [ref] */,
454                                     WERROR *result)
455 {
456         struct spoolss_OpenPrinter r;
457         NTSTATUS status;
458
459         /* In parameters */
460         r.in.printername = _printername;
461         r.in.datatype = _datatype;
462         r.in.devmode_ctr = _devmode_ctr;
463         r.in.access_mask = _access_mask;
464
465         status = dcerpc_spoolss_OpenPrinter_r(h, mem_ctx, &r);
466         if (!NT_STATUS_IS_OK(status)) {
467                 return status;
468         }
469
470         /* Return variables */
471         *_handle = *r.out.handle;
472
473         /* Return result */
474         *result = r.out.result;
475
476         return NT_STATUS_OK;
477 }
478
479 struct dcerpc_spoolss_SetJob_r_state {
480         TALLOC_CTX *out_mem_ctx;
481 };
482
483 static void dcerpc_spoolss_SetJob_r_done(struct tevent_req *subreq);
484
485 struct tevent_req *dcerpc_spoolss_SetJob_r_send(TALLOC_CTX *mem_ctx,
486         struct tevent_context *ev,
487         struct dcerpc_binding_handle *h,
488         struct spoolss_SetJob *r)
489 {
490         struct tevent_req *req;
491         struct dcerpc_spoolss_SetJob_r_state *state;
492         struct tevent_req *subreq;
493
494         req = tevent_req_create(mem_ctx, &state,
495                                 struct dcerpc_spoolss_SetJob_r_state);
496         if (req == NULL) {
497                 return NULL;
498         }
499
500         state->out_mem_ctx = NULL;
501
502         subreq = dcerpc_binding_handle_call_send(state, ev, h,
503                         NULL, &ndr_table_spoolss,
504                         NDR_SPOOLSS_SETJOB, state, r);
505         if (tevent_req_nomem(subreq, req)) {
506                 return tevent_req_post(req, ev);
507         }
508         tevent_req_set_callback(subreq, dcerpc_spoolss_SetJob_r_done, req);
509
510         return req;
511 }
512
513 static void dcerpc_spoolss_SetJob_r_done(struct tevent_req *subreq)
514 {
515         struct tevent_req *req =
516                 tevent_req_callback_data(subreq,
517                 struct tevent_req);
518         NTSTATUS status;
519
520         status = dcerpc_binding_handle_call_recv(subreq);
521         TALLOC_FREE(subreq);
522         if (tevent_req_nterror(req, status)) {
523                 return;
524         }
525
526         tevent_req_done(req);
527 }
528
529 NTSTATUS dcerpc_spoolss_SetJob_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
530 {
531         struct dcerpc_spoolss_SetJob_r_state *state =
532                 tevent_req_data(req,
533                 struct dcerpc_spoolss_SetJob_r_state);
534         NTSTATUS status;
535
536         if (tevent_req_is_nterror(req, &status)) {
537                 tevent_req_received(req);
538                 return status;
539         }
540
541         talloc_steal(mem_ctx, state->out_mem_ctx);
542
543         tevent_req_received(req);
544         return NT_STATUS_OK;
545 }
546
547 NTSTATUS dcerpc_spoolss_SetJob_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_SetJob *r)
548 {
549         NTSTATUS status;
550
551         status = dcerpc_binding_handle_call(h,
552                         NULL, &ndr_table_spoolss,
553                         NDR_SPOOLSS_SETJOB, mem_ctx, r);
554
555         return status;
556 }
557
558 struct dcerpc_spoolss_SetJob_state {
559         struct spoolss_SetJob orig;
560         struct spoolss_SetJob tmp;
561         TALLOC_CTX *out_mem_ctx;
562 };
563
564 static void dcerpc_spoolss_SetJob_done(struct tevent_req *subreq);
565
566 struct tevent_req *dcerpc_spoolss_SetJob_send(TALLOC_CTX *mem_ctx,
567                                               struct tevent_context *ev,
568                                               struct dcerpc_binding_handle *h,
569                                               struct policy_handle *_handle /* [in] [ref] */,
570                                               uint32_t _job_id /* [in]  */,
571                                               struct spoolss_JobInfoContainer *_ctr /* [in] [unique] */,
572                                               enum spoolss_JobControl _command /* [in]  */)
573 {
574         struct tevent_req *req;
575         struct dcerpc_spoolss_SetJob_state *state;
576         struct tevent_req *subreq;
577
578         req = tevent_req_create(mem_ctx, &state,
579                                 struct dcerpc_spoolss_SetJob_state);
580         if (req == NULL) {
581                 return NULL;
582         }
583         state->out_mem_ctx = NULL;
584
585         /* In parameters */
586         state->orig.in.handle = _handle;
587         state->orig.in.job_id = _job_id;
588         state->orig.in.ctr = _ctr;
589         state->orig.in.command = _command;
590
591         /* Out parameters */
592
593         /* Result */
594         ZERO_STRUCT(state->orig.out.result);
595
596         /* make a temporary copy, that we pass to the dispatch function */
597         state->tmp = state->orig;
598
599         subreq = dcerpc_spoolss_SetJob_r_send(state, ev, h, &state->tmp);
600         if (tevent_req_nomem(subreq, req)) {
601                 return tevent_req_post(req, ev);
602         }
603         tevent_req_set_callback(subreq, dcerpc_spoolss_SetJob_done, req);
604         return req;
605 }
606
607 static void dcerpc_spoolss_SetJob_done(struct tevent_req *subreq)
608 {
609         struct tevent_req *req = tevent_req_callback_data(
610                 subreq, struct tevent_req);
611         struct dcerpc_spoolss_SetJob_state *state = tevent_req_data(
612                 req, struct dcerpc_spoolss_SetJob_state);
613         NTSTATUS status;
614         TALLOC_CTX *mem_ctx;
615
616         if (state->out_mem_ctx) {
617                 mem_ctx = state->out_mem_ctx;
618         } else {
619                 mem_ctx = state;
620         }
621
622         status = dcerpc_spoolss_SetJob_r_recv(subreq, mem_ctx);
623         TALLOC_FREE(subreq);
624         if (tevent_req_nterror(req, status)) {
625                 return;
626         }
627
628         /* Copy out parameters */
629
630         /* Copy result */
631         state->orig.out.result = state->tmp.out.result;
632
633         /* Reset temporary structure */
634         ZERO_STRUCT(state->tmp);
635
636         tevent_req_done(req);
637 }
638
639 NTSTATUS dcerpc_spoolss_SetJob_recv(struct tevent_req *req,
640                                     TALLOC_CTX *mem_ctx,
641                                     WERROR *result)
642 {
643         struct dcerpc_spoolss_SetJob_state *state = tevent_req_data(
644                 req, struct dcerpc_spoolss_SetJob_state);
645         NTSTATUS status;
646
647         if (tevent_req_is_nterror(req, &status)) {
648                 tevent_req_received(req);
649                 return status;
650         }
651
652         /* Steal possible out parameters to the callers context */
653         talloc_steal(mem_ctx, state->out_mem_ctx);
654
655         /* Return result */
656         *result = state->orig.out.result;
657
658         tevent_req_received(req);
659         return NT_STATUS_OK;
660 }
661
662 NTSTATUS dcerpc_spoolss_SetJob(struct dcerpc_binding_handle *h,
663                                TALLOC_CTX *mem_ctx,
664                                struct policy_handle *_handle /* [in] [ref] */,
665                                uint32_t _job_id /* [in]  */,
666                                struct spoolss_JobInfoContainer *_ctr /* [in] [unique] */,
667                                enum spoolss_JobControl _command /* [in]  */,
668                                WERROR *result)
669 {
670         struct spoolss_SetJob r;
671         NTSTATUS status;
672
673         /* In parameters */
674         r.in.handle = _handle;
675         r.in.job_id = _job_id;
676         r.in.ctr = _ctr;
677         r.in.command = _command;
678
679         status = dcerpc_spoolss_SetJob_r(h, mem_ctx, &r);
680         if (!NT_STATUS_IS_OK(status)) {
681                 return status;
682         }
683
684         /* Return variables */
685
686         /* Return result */
687         *result = r.out.result;
688
689         return NT_STATUS_OK;
690 }
691
692 struct dcerpc_spoolss_GetJob_r_state {
693         TALLOC_CTX *out_mem_ctx;
694 };
695
696 static void dcerpc_spoolss_GetJob_r_done(struct tevent_req *subreq);
697
698 struct tevent_req *dcerpc_spoolss_GetJob_r_send(TALLOC_CTX *mem_ctx,
699         struct tevent_context *ev,
700         struct dcerpc_binding_handle *h,
701         struct spoolss_GetJob *r)
702 {
703         struct tevent_req *req;
704         struct dcerpc_spoolss_GetJob_r_state *state;
705         struct tevent_req *subreq;
706
707         req = tevent_req_create(mem_ctx, &state,
708                                 struct dcerpc_spoolss_GetJob_r_state);
709         if (req == NULL) {
710                 return NULL;
711         }
712
713         state->out_mem_ctx = talloc_new(state);
714         if (tevent_req_nomem(state->out_mem_ctx, req)) {
715                 return tevent_req_post(req, ev);
716         }
717
718         subreq = dcerpc_binding_handle_call_send(state, ev, h,
719                         NULL, &ndr_table_spoolss,
720                         NDR_SPOOLSS_GETJOB, state->out_mem_ctx, r);
721         if (tevent_req_nomem(subreq, req)) {
722                 return tevent_req_post(req, ev);
723         }
724         tevent_req_set_callback(subreq, dcerpc_spoolss_GetJob_r_done, req);
725
726         return req;
727 }
728
729 static void dcerpc_spoolss_GetJob_r_done(struct tevent_req *subreq)
730 {
731         struct tevent_req *req =
732                 tevent_req_callback_data(subreq,
733                 struct tevent_req);
734         NTSTATUS status;
735
736         status = dcerpc_binding_handle_call_recv(subreq);
737         TALLOC_FREE(subreq);
738         if (tevent_req_nterror(req, status)) {
739                 return;
740         }
741
742         tevent_req_done(req);
743 }
744
745 NTSTATUS dcerpc_spoolss_GetJob_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
746 {
747         struct dcerpc_spoolss_GetJob_r_state *state =
748                 tevent_req_data(req,
749                 struct dcerpc_spoolss_GetJob_r_state);
750         NTSTATUS status;
751
752         if (tevent_req_is_nterror(req, &status)) {
753                 tevent_req_received(req);
754                 return status;
755         }
756
757         talloc_steal(mem_ctx, state->out_mem_ctx);
758
759         tevent_req_received(req);
760         return NT_STATUS_OK;
761 }
762
763 NTSTATUS dcerpc_spoolss_GetJob_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_GetJob *r)
764 {
765         NTSTATUS status;
766
767         status = dcerpc_binding_handle_call(h,
768                         NULL, &ndr_table_spoolss,
769                         NDR_SPOOLSS_GETJOB, mem_ctx, r);
770
771         return status;
772 }
773
774 struct dcerpc_spoolss_GetJob_state {
775         struct spoolss_GetJob orig;
776         struct spoolss_GetJob tmp;
777         TALLOC_CTX *out_mem_ctx;
778 };
779
780 static void dcerpc_spoolss_GetJob_done(struct tevent_req *subreq);
781
782 struct tevent_req *dcerpc_spoolss_GetJob_send(TALLOC_CTX *mem_ctx,
783                                               struct tevent_context *ev,
784                                               struct dcerpc_binding_handle *h,
785                                               struct policy_handle *_handle /* [in] [ref] */,
786                                               uint32_t _job_id /* [in]  */,
787                                               uint32_t _level /* [in]  */,
788                                               DATA_BLOB *_buffer /* [in] [unique] */,
789                                               uint32_t _offered /* [in]  */,
790                                               union spoolss_JobInfo *_info /* [out] [unique,subcontext_size(offered),subcontext(4),switch_is(level)] */,
791                                               uint32_t *_needed /* [out] [ref] */)
792 {
793         struct tevent_req *req;
794         struct dcerpc_spoolss_GetJob_state *state;
795         struct tevent_req *subreq;
796
797         req = tevent_req_create(mem_ctx, &state,
798                                 struct dcerpc_spoolss_GetJob_state);
799         if (req == NULL) {
800                 return NULL;
801         }
802         state->out_mem_ctx = NULL;
803
804         /* In parameters */
805         state->orig.in.handle = _handle;
806         state->orig.in.job_id = _job_id;
807         state->orig.in.level = _level;
808         state->orig.in.buffer = _buffer;
809         state->orig.in.offered = _offered;
810
811         /* Out parameters */
812         state->orig.out.info = _info;
813         state->orig.out.needed = _needed;
814
815         /* Result */
816         ZERO_STRUCT(state->orig.out.result);
817
818         state->out_mem_ctx = talloc_named_const(state, 0,
819                              "dcerpc_spoolss_GetJob_out_memory");
820         if (tevent_req_nomem(state->out_mem_ctx, req)) {
821                 return tevent_req_post(req, ev);
822         }
823
824         /* make a temporary copy, that we pass to the dispatch function */
825         state->tmp = state->orig;
826
827         subreq = dcerpc_spoolss_GetJob_r_send(state, ev, h, &state->tmp);
828         if (tevent_req_nomem(subreq, req)) {
829                 return tevent_req_post(req, ev);
830         }
831         tevent_req_set_callback(subreq, dcerpc_spoolss_GetJob_done, req);
832         return req;
833 }
834
835 static void dcerpc_spoolss_GetJob_done(struct tevent_req *subreq)
836 {
837         struct tevent_req *req = tevent_req_callback_data(
838                 subreq, struct tevent_req);
839         struct dcerpc_spoolss_GetJob_state *state = tevent_req_data(
840                 req, struct dcerpc_spoolss_GetJob_state);
841         NTSTATUS status;
842         TALLOC_CTX *mem_ctx;
843
844         if (state->out_mem_ctx) {
845                 mem_ctx = state->out_mem_ctx;
846         } else {
847                 mem_ctx = state;
848         }
849
850         status = dcerpc_spoolss_GetJob_r_recv(subreq, mem_ctx);
851         TALLOC_FREE(subreq);
852         if (tevent_req_nterror(req, status)) {
853                 return;
854         }
855
856         /* Copy out parameters */
857         if (state->orig.out.info && state->tmp.out.info) {
858                 *state->orig.out.info = *state->tmp.out.info;
859         }
860         *state->orig.out.needed = *state->tmp.out.needed;
861
862         /* Copy result */
863         state->orig.out.result = state->tmp.out.result;
864
865         /* Reset temporary structure */
866         ZERO_STRUCT(state->tmp);
867
868         tevent_req_done(req);
869 }
870
871 NTSTATUS dcerpc_spoolss_GetJob_recv(struct tevent_req *req,
872                                     TALLOC_CTX *mem_ctx,
873                                     WERROR *result)
874 {
875         struct dcerpc_spoolss_GetJob_state *state = tevent_req_data(
876                 req, struct dcerpc_spoolss_GetJob_state);
877         NTSTATUS status;
878
879         if (tevent_req_is_nterror(req, &status)) {
880                 tevent_req_received(req);
881                 return status;
882         }
883
884         /* Steal possible out parameters to the callers context */
885         talloc_steal(mem_ctx, state->out_mem_ctx);
886
887         /* Return result */
888         *result = state->orig.out.result;
889
890         tevent_req_received(req);
891         return NT_STATUS_OK;
892 }
893
894 NTSTATUS dcerpc_spoolss_GetJob(struct dcerpc_binding_handle *h,
895                                TALLOC_CTX *mem_ctx,
896                                struct policy_handle *_handle /* [in] [ref] */,
897                                uint32_t _job_id /* [in]  */,
898                                uint32_t _level /* [in]  */,
899                                DATA_BLOB *_buffer /* [in] [unique] */,
900                                uint32_t _offered /* [in]  */,
901                                union spoolss_JobInfo *_info /* [out] [unique,subcontext_size(offered),subcontext(4),switch_is(level)] */,
902                                uint32_t *_needed /* [out] [ref] */,
903                                WERROR *result)
904 {
905         struct spoolss_GetJob r;
906         NTSTATUS status;
907
908         /* In parameters */
909         r.in.handle = _handle;
910         r.in.job_id = _job_id;
911         r.in.level = _level;
912         r.in.buffer = _buffer;
913         r.in.offered = _offered;
914
915         status = dcerpc_spoolss_GetJob_r(h, mem_ctx, &r);
916         if (!NT_STATUS_IS_OK(status)) {
917                 return status;
918         }
919
920         /* Return variables */
921         if (_info && r.out.info) {
922                 *_info = *r.out.info;
923         }
924         *_needed = *r.out.needed;
925
926         /* Return result */
927         *result = r.out.result;
928
929         return NT_STATUS_OK;
930 }
931
932 struct dcerpc_spoolss_EnumJobs_r_state {
933         TALLOC_CTX *out_mem_ctx;
934 };
935
936 static void dcerpc_spoolss_EnumJobs_r_done(struct tevent_req *subreq);
937
938 struct tevent_req *dcerpc_spoolss_EnumJobs_r_send(TALLOC_CTX *mem_ctx,
939         struct tevent_context *ev,
940         struct dcerpc_binding_handle *h,
941         struct spoolss_EnumJobs *r)
942 {
943         struct tevent_req *req;
944         struct dcerpc_spoolss_EnumJobs_r_state *state;
945         struct tevent_req *subreq;
946
947         req = tevent_req_create(mem_ctx, &state,
948                                 struct dcerpc_spoolss_EnumJobs_r_state);
949         if (req == NULL) {
950                 return NULL;
951         }
952
953         state->out_mem_ctx = talloc_new(state);
954         if (tevent_req_nomem(state->out_mem_ctx, req)) {
955                 return tevent_req_post(req, ev);
956         }
957
958         subreq = dcerpc_binding_handle_call_send(state, ev, h,
959                         NULL, &ndr_table_spoolss,
960                         NDR_SPOOLSS_ENUMJOBS, state->out_mem_ctx, r);
961         if (tevent_req_nomem(subreq, req)) {
962                 return tevent_req_post(req, ev);
963         }
964         tevent_req_set_callback(subreq, dcerpc_spoolss_EnumJobs_r_done, req);
965
966         return req;
967 }
968
969 static void dcerpc_spoolss_EnumJobs_r_done(struct tevent_req *subreq)
970 {
971         struct tevent_req *req =
972                 tevent_req_callback_data(subreq,
973                 struct tevent_req);
974         NTSTATUS status;
975
976         status = dcerpc_binding_handle_call_recv(subreq);
977         TALLOC_FREE(subreq);
978         if (tevent_req_nterror(req, status)) {
979                 return;
980         }
981
982         tevent_req_done(req);
983 }
984
985 NTSTATUS dcerpc_spoolss_EnumJobs_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
986 {
987         struct dcerpc_spoolss_EnumJobs_r_state *state =
988                 tevent_req_data(req,
989                 struct dcerpc_spoolss_EnumJobs_r_state);
990         NTSTATUS status;
991
992         if (tevent_req_is_nterror(req, &status)) {
993                 tevent_req_received(req);
994                 return status;
995         }
996
997         talloc_steal(mem_ctx, state->out_mem_ctx);
998
999         tevent_req_received(req);
1000         return NT_STATUS_OK;
1001 }
1002
1003 NTSTATUS dcerpc_spoolss_EnumJobs_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_EnumJobs *r)
1004 {
1005         NTSTATUS status;
1006
1007         status = dcerpc_binding_handle_call(h,
1008                         NULL, &ndr_table_spoolss,
1009                         NDR_SPOOLSS_ENUMJOBS, mem_ctx, r);
1010
1011         return status;
1012 }
1013
1014 struct dcerpc_spoolss_EnumJobs_state {
1015         struct spoolss_EnumJobs orig;
1016         struct spoolss_EnumJobs tmp;
1017         TALLOC_CTX *out_mem_ctx;
1018 };
1019
1020 static void dcerpc_spoolss_EnumJobs_done(struct tevent_req *subreq);
1021
1022 struct tevent_req *dcerpc_spoolss_EnumJobs_send(TALLOC_CTX *mem_ctx,
1023                                                 struct tevent_context *ev,
1024                                                 struct dcerpc_binding_handle *h,
1025                                                 struct policy_handle *_handle /* [in] [ref] */,
1026                                                 uint32_t _firstjob /* [in]  */,
1027                                                 uint32_t _numjobs /* [in]  */,
1028                                                 uint32_t _level /* [in]  */,
1029                                                 DATA_BLOB *_buffer /* [in] [unique] */,
1030                                                 uint32_t _offered /* [in]  */,
1031                                                 uint32_t *_count /* [out] [ref] */,
1032                                                 union spoolss_JobInfo **_info /* [out] [ref,switch_is(level),size_is(,*count)] */,
1033                                                 uint32_t *_needed /* [out] [ref] */)
1034 {
1035         struct tevent_req *req;
1036         struct dcerpc_spoolss_EnumJobs_state *state;
1037         struct tevent_req *subreq;
1038
1039         req = tevent_req_create(mem_ctx, &state,
1040                                 struct dcerpc_spoolss_EnumJobs_state);
1041         if (req == NULL) {
1042                 return NULL;
1043         }
1044         state->out_mem_ctx = NULL;
1045
1046         /* In parameters */
1047         state->orig.in.handle = _handle;
1048         state->orig.in.firstjob = _firstjob;
1049         state->orig.in.numjobs = _numjobs;
1050         state->orig.in.level = _level;
1051         state->orig.in.buffer = _buffer;
1052         state->orig.in.offered = _offered;
1053
1054         /* Out parameters */
1055         state->orig.out.count = _count;
1056         state->orig.out.info = _info;
1057         state->orig.out.needed = _needed;
1058
1059         /* Result */
1060         ZERO_STRUCT(state->orig.out.result);
1061
1062         state->out_mem_ctx = talloc_named_const(state, 0,
1063                              "dcerpc_spoolss_EnumJobs_out_memory");
1064         if (tevent_req_nomem(state->out_mem_ctx, req)) {
1065                 return tevent_req_post(req, ev);
1066         }
1067
1068         /* make a temporary copy, that we pass to the dispatch function */
1069         state->tmp = state->orig;
1070
1071         subreq = dcerpc_spoolss_EnumJobs_r_send(state, ev, h, &state->tmp);
1072         if (tevent_req_nomem(subreq, req)) {
1073                 return tevent_req_post(req, ev);
1074         }
1075         tevent_req_set_callback(subreq, dcerpc_spoolss_EnumJobs_done, req);
1076         return req;
1077 }
1078
1079 static void dcerpc_spoolss_EnumJobs_done(struct tevent_req *subreq)
1080 {
1081         struct tevent_req *req = tevent_req_callback_data(
1082                 subreq, struct tevent_req);
1083         struct dcerpc_spoolss_EnumJobs_state *state = tevent_req_data(
1084                 req, struct dcerpc_spoolss_EnumJobs_state);
1085         NTSTATUS status;
1086         TALLOC_CTX *mem_ctx;
1087
1088         if (state->out_mem_ctx) {
1089                 mem_ctx = state->out_mem_ctx;
1090         } else {
1091                 mem_ctx = state;
1092         }
1093
1094         status = dcerpc_spoolss_EnumJobs_r_recv(subreq, mem_ctx);
1095         TALLOC_FREE(subreq);
1096         if (tevent_req_nterror(req, status)) {
1097                 return;
1098         }
1099
1100         /* Copy out parameters */
1101         *state->orig.out.count = *state->tmp.out.count;
1102         *state->orig.out.info = *state->tmp.out.info;
1103         *state->orig.out.needed = *state->tmp.out.needed;
1104
1105         /* Copy result */
1106         state->orig.out.result = state->tmp.out.result;
1107
1108         /* Reset temporary structure */
1109         ZERO_STRUCT(state->tmp);
1110
1111         tevent_req_done(req);
1112 }
1113
1114 NTSTATUS dcerpc_spoolss_EnumJobs_recv(struct tevent_req *req,
1115                                       TALLOC_CTX *mem_ctx,
1116                                       WERROR *result)
1117 {
1118         struct dcerpc_spoolss_EnumJobs_state *state = tevent_req_data(
1119                 req, struct dcerpc_spoolss_EnumJobs_state);
1120         NTSTATUS status;
1121
1122         if (tevent_req_is_nterror(req, &status)) {
1123                 tevent_req_received(req);
1124                 return status;
1125         }
1126
1127         /* Steal possible out parameters to the callers context */
1128         talloc_steal(mem_ctx, state->out_mem_ctx);
1129
1130         /* Return result */
1131         *result = state->orig.out.result;
1132
1133         tevent_req_received(req);
1134         return NT_STATUS_OK;
1135 }
1136
1137 NTSTATUS dcerpc_spoolss_EnumJobs(struct dcerpc_binding_handle *h,
1138                                  TALLOC_CTX *mem_ctx,
1139                                  struct policy_handle *_handle /* [in] [ref] */,
1140                                  uint32_t _firstjob /* [in]  */,
1141                                  uint32_t _numjobs /* [in]  */,
1142                                  uint32_t _level /* [in]  */,
1143                                  DATA_BLOB *_buffer /* [in] [unique] */,
1144                                  uint32_t _offered /* [in]  */,
1145                                  uint32_t *_count /* [out] [ref] */,
1146                                  union spoolss_JobInfo **_info /* [out] [ref,switch_is(level),size_is(,*count)] */,
1147                                  uint32_t *_needed /* [out] [ref] */,
1148                                  WERROR *result)
1149 {
1150         struct spoolss_EnumJobs r;
1151         NTSTATUS status;
1152
1153         /* In parameters */
1154         r.in.handle = _handle;
1155         r.in.firstjob = _firstjob;
1156         r.in.numjobs = _numjobs;
1157         r.in.level = _level;
1158         r.in.buffer = _buffer;
1159         r.in.offered = _offered;
1160
1161         status = dcerpc_spoolss_EnumJobs_r(h, mem_ctx, &r);
1162         if (!NT_STATUS_IS_OK(status)) {
1163                 return status;
1164         }
1165
1166         /* Return variables */
1167         *_count = *r.out.count;
1168         *_info = *r.out.info;
1169         *_needed = *r.out.needed;
1170
1171         /* Return result */
1172         *result = r.out.result;
1173
1174         return NT_STATUS_OK;
1175 }
1176
1177 struct dcerpc_spoolss_AddPrinter_r_state {
1178         TALLOC_CTX *out_mem_ctx;
1179 };
1180
1181 static void dcerpc_spoolss_AddPrinter_r_done(struct tevent_req *subreq);
1182
1183 struct tevent_req *dcerpc_spoolss_AddPrinter_r_send(TALLOC_CTX *mem_ctx,
1184         struct tevent_context *ev,
1185         struct dcerpc_binding_handle *h,
1186         struct spoolss_AddPrinter *r)
1187 {
1188         struct tevent_req *req;
1189         struct dcerpc_spoolss_AddPrinter_r_state *state;
1190         struct tevent_req *subreq;
1191
1192         req = tevent_req_create(mem_ctx, &state,
1193                                 struct dcerpc_spoolss_AddPrinter_r_state);
1194         if (req == NULL) {
1195                 return NULL;
1196         }
1197
1198         state->out_mem_ctx = talloc_new(state);
1199         if (tevent_req_nomem(state->out_mem_ctx, req)) {
1200                 return tevent_req_post(req, ev);
1201         }
1202
1203         subreq = dcerpc_binding_handle_call_send(state, ev, h,
1204                         NULL, &ndr_table_spoolss,
1205                         NDR_SPOOLSS_ADDPRINTER, state->out_mem_ctx, r);
1206         if (tevent_req_nomem(subreq, req)) {
1207                 return tevent_req_post(req, ev);
1208         }
1209         tevent_req_set_callback(subreq, dcerpc_spoolss_AddPrinter_r_done, req);
1210
1211         return req;
1212 }
1213
1214 static void dcerpc_spoolss_AddPrinter_r_done(struct tevent_req *subreq)
1215 {
1216         struct tevent_req *req =
1217                 tevent_req_callback_data(subreq,
1218                 struct tevent_req);
1219         NTSTATUS status;
1220
1221         status = dcerpc_binding_handle_call_recv(subreq);
1222         TALLOC_FREE(subreq);
1223         if (tevent_req_nterror(req, status)) {
1224                 return;
1225         }
1226
1227         tevent_req_done(req);
1228 }
1229
1230 NTSTATUS dcerpc_spoolss_AddPrinter_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
1231 {
1232         struct dcerpc_spoolss_AddPrinter_r_state *state =
1233                 tevent_req_data(req,
1234                 struct dcerpc_spoolss_AddPrinter_r_state);
1235         NTSTATUS status;
1236
1237         if (tevent_req_is_nterror(req, &status)) {
1238                 tevent_req_received(req);
1239                 return status;
1240         }
1241
1242         talloc_steal(mem_ctx, state->out_mem_ctx);
1243
1244         tevent_req_received(req);
1245         return NT_STATUS_OK;
1246 }
1247
1248 NTSTATUS dcerpc_spoolss_AddPrinter_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_AddPrinter *r)
1249 {
1250         NTSTATUS status;
1251
1252         status = dcerpc_binding_handle_call(h,
1253                         NULL, &ndr_table_spoolss,
1254                         NDR_SPOOLSS_ADDPRINTER, mem_ctx, r);
1255
1256         return status;
1257 }
1258
1259 struct dcerpc_spoolss_AddPrinter_state {
1260         struct spoolss_AddPrinter orig;
1261         struct spoolss_AddPrinter tmp;
1262         TALLOC_CTX *out_mem_ctx;
1263 };
1264
1265 static void dcerpc_spoolss_AddPrinter_done(struct tevent_req *subreq);
1266
1267 struct tevent_req *dcerpc_spoolss_AddPrinter_send(TALLOC_CTX *mem_ctx,
1268                                                   struct tevent_context *ev,
1269                                                   struct dcerpc_binding_handle *h,
1270                                                   const char *_server /* [in] [unique,charset(UTF16)] */,
1271                                                   struct spoolss_SetPrinterInfoCtr *_info_ctr /* [in] [ref] */,
1272                                                   struct spoolss_DevmodeContainer *_devmode_ctr /* [in] [ref] */,
1273                                                   struct sec_desc_buf *_secdesc_ctr /* [in] [ref] */,
1274                                                   struct policy_handle *_handle /* [out] [ref] */)
1275 {
1276         struct tevent_req *req;
1277         struct dcerpc_spoolss_AddPrinter_state *state;
1278         struct tevent_req *subreq;
1279
1280         req = tevent_req_create(mem_ctx, &state,
1281                                 struct dcerpc_spoolss_AddPrinter_state);
1282         if (req == NULL) {
1283                 return NULL;
1284         }
1285         state->out_mem_ctx = NULL;
1286
1287         /* In parameters */
1288         state->orig.in.server = _server;
1289         state->orig.in.info_ctr = _info_ctr;
1290         state->orig.in.devmode_ctr = _devmode_ctr;
1291         state->orig.in.secdesc_ctr = _secdesc_ctr;
1292
1293         /* Out parameters */
1294         state->orig.out.handle = _handle;
1295
1296         /* Result */
1297         ZERO_STRUCT(state->orig.out.result);
1298
1299         state->out_mem_ctx = talloc_named_const(state, 0,
1300                              "dcerpc_spoolss_AddPrinter_out_memory");
1301         if (tevent_req_nomem(state->out_mem_ctx, req)) {
1302                 return tevent_req_post(req, ev);
1303         }
1304
1305         /* make a temporary copy, that we pass to the dispatch function */
1306         state->tmp = state->orig;
1307
1308         subreq = dcerpc_spoolss_AddPrinter_r_send(state, ev, h, &state->tmp);
1309         if (tevent_req_nomem(subreq, req)) {
1310                 return tevent_req_post(req, ev);
1311         }
1312         tevent_req_set_callback(subreq, dcerpc_spoolss_AddPrinter_done, req);
1313         return req;
1314 }
1315
1316 static void dcerpc_spoolss_AddPrinter_done(struct tevent_req *subreq)
1317 {
1318         struct tevent_req *req = tevent_req_callback_data(
1319                 subreq, struct tevent_req);
1320         struct dcerpc_spoolss_AddPrinter_state *state = tevent_req_data(
1321                 req, struct dcerpc_spoolss_AddPrinter_state);
1322         NTSTATUS status;
1323         TALLOC_CTX *mem_ctx;
1324
1325         if (state->out_mem_ctx) {
1326                 mem_ctx = state->out_mem_ctx;
1327         } else {
1328                 mem_ctx = state;
1329         }
1330
1331         status = dcerpc_spoolss_AddPrinter_r_recv(subreq, mem_ctx);
1332         TALLOC_FREE(subreq);
1333         if (tevent_req_nterror(req, status)) {
1334                 return;
1335         }
1336
1337         /* Copy out parameters */
1338         *state->orig.out.handle = *state->tmp.out.handle;
1339
1340         /* Copy result */
1341         state->orig.out.result = state->tmp.out.result;
1342
1343         /* Reset temporary structure */
1344         ZERO_STRUCT(state->tmp);
1345
1346         tevent_req_done(req);
1347 }
1348
1349 NTSTATUS dcerpc_spoolss_AddPrinter_recv(struct tevent_req *req,
1350                                         TALLOC_CTX *mem_ctx,
1351                                         WERROR *result)
1352 {
1353         struct dcerpc_spoolss_AddPrinter_state *state = tevent_req_data(
1354                 req, struct dcerpc_spoolss_AddPrinter_state);
1355         NTSTATUS status;
1356
1357         if (tevent_req_is_nterror(req, &status)) {
1358                 tevent_req_received(req);
1359                 return status;
1360         }
1361
1362         /* Steal possible out parameters to the callers context */
1363         talloc_steal(mem_ctx, state->out_mem_ctx);
1364
1365         /* Return result */
1366         *result = state->orig.out.result;
1367
1368         tevent_req_received(req);
1369         return NT_STATUS_OK;
1370 }
1371
1372 NTSTATUS dcerpc_spoolss_AddPrinter(struct dcerpc_binding_handle *h,
1373                                    TALLOC_CTX *mem_ctx,
1374                                    const char *_server /* [in] [unique,charset(UTF16)] */,
1375                                    struct spoolss_SetPrinterInfoCtr *_info_ctr /* [in] [ref] */,
1376                                    struct spoolss_DevmodeContainer *_devmode_ctr /* [in] [ref] */,
1377                                    struct sec_desc_buf *_secdesc_ctr /* [in] [ref] */,
1378                                    struct policy_handle *_handle /* [out] [ref] */,
1379                                    WERROR *result)
1380 {
1381         struct spoolss_AddPrinter r;
1382         NTSTATUS status;
1383
1384         /* In parameters */
1385         r.in.server = _server;
1386         r.in.info_ctr = _info_ctr;
1387         r.in.devmode_ctr = _devmode_ctr;
1388         r.in.secdesc_ctr = _secdesc_ctr;
1389
1390         status = dcerpc_spoolss_AddPrinter_r(h, mem_ctx, &r);
1391         if (!NT_STATUS_IS_OK(status)) {
1392                 return status;
1393         }
1394
1395         /* Return variables */
1396         *_handle = *r.out.handle;
1397
1398         /* Return result */
1399         *result = r.out.result;
1400
1401         return NT_STATUS_OK;
1402 }
1403
1404 struct dcerpc_spoolss_DeletePrinter_r_state {
1405         TALLOC_CTX *out_mem_ctx;
1406 };
1407
1408 static void dcerpc_spoolss_DeletePrinter_r_done(struct tevent_req *subreq);
1409
1410 struct tevent_req *dcerpc_spoolss_DeletePrinter_r_send(TALLOC_CTX *mem_ctx,
1411         struct tevent_context *ev,
1412         struct dcerpc_binding_handle *h,
1413         struct spoolss_DeletePrinter *r)
1414 {
1415         struct tevent_req *req;
1416         struct dcerpc_spoolss_DeletePrinter_r_state *state;
1417         struct tevent_req *subreq;
1418
1419         req = tevent_req_create(mem_ctx, &state,
1420                                 struct dcerpc_spoolss_DeletePrinter_r_state);
1421         if (req == NULL) {
1422                 return NULL;
1423         }
1424
1425         state->out_mem_ctx = NULL;
1426
1427         subreq = dcerpc_binding_handle_call_send(state, ev, h,
1428                         NULL, &ndr_table_spoolss,
1429                         NDR_SPOOLSS_DELETEPRINTER, state, r);
1430         if (tevent_req_nomem(subreq, req)) {
1431                 return tevent_req_post(req, ev);
1432         }
1433         tevent_req_set_callback(subreq, dcerpc_spoolss_DeletePrinter_r_done, req);
1434
1435         return req;
1436 }
1437
1438 static void dcerpc_spoolss_DeletePrinter_r_done(struct tevent_req *subreq)
1439 {
1440         struct tevent_req *req =
1441                 tevent_req_callback_data(subreq,
1442                 struct tevent_req);
1443         NTSTATUS status;
1444
1445         status = dcerpc_binding_handle_call_recv(subreq);
1446         TALLOC_FREE(subreq);
1447         if (tevent_req_nterror(req, status)) {
1448                 return;
1449         }
1450
1451         tevent_req_done(req);
1452 }
1453
1454 NTSTATUS dcerpc_spoolss_DeletePrinter_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
1455 {
1456         struct dcerpc_spoolss_DeletePrinter_r_state *state =
1457                 tevent_req_data(req,
1458                 struct dcerpc_spoolss_DeletePrinter_r_state);
1459         NTSTATUS status;
1460
1461         if (tevent_req_is_nterror(req, &status)) {
1462                 tevent_req_received(req);
1463                 return status;
1464         }
1465
1466         talloc_steal(mem_ctx, state->out_mem_ctx);
1467
1468         tevent_req_received(req);
1469         return NT_STATUS_OK;
1470 }
1471
1472 NTSTATUS dcerpc_spoolss_DeletePrinter_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_DeletePrinter *r)
1473 {
1474         NTSTATUS status;
1475
1476         status = dcerpc_binding_handle_call(h,
1477                         NULL, &ndr_table_spoolss,
1478                         NDR_SPOOLSS_DELETEPRINTER, mem_ctx, r);
1479
1480         return status;
1481 }
1482
1483 struct dcerpc_spoolss_DeletePrinter_state {
1484         struct spoolss_DeletePrinter orig;
1485         struct spoolss_DeletePrinter tmp;
1486         TALLOC_CTX *out_mem_ctx;
1487 };
1488
1489 static void dcerpc_spoolss_DeletePrinter_done(struct tevent_req *subreq);
1490
1491 struct tevent_req *dcerpc_spoolss_DeletePrinter_send(TALLOC_CTX *mem_ctx,
1492                                                      struct tevent_context *ev,
1493                                                      struct dcerpc_binding_handle *h,
1494                                                      struct policy_handle *_handle /* [in] [ref] */)
1495 {
1496         struct tevent_req *req;
1497         struct dcerpc_spoolss_DeletePrinter_state *state;
1498         struct tevent_req *subreq;
1499
1500         req = tevent_req_create(mem_ctx, &state,
1501                                 struct dcerpc_spoolss_DeletePrinter_state);
1502         if (req == NULL) {
1503                 return NULL;
1504         }
1505         state->out_mem_ctx = NULL;
1506
1507         /* In parameters */
1508         state->orig.in.handle = _handle;
1509
1510         /* Out parameters */
1511
1512         /* Result */
1513         ZERO_STRUCT(state->orig.out.result);
1514
1515         /* make a temporary copy, that we pass to the dispatch function */
1516         state->tmp = state->orig;
1517
1518         subreq = dcerpc_spoolss_DeletePrinter_r_send(state, ev, h, &state->tmp);
1519         if (tevent_req_nomem(subreq, req)) {
1520                 return tevent_req_post(req, ev);
1521         }
1522         tevent_req_set_callback(subreq, dcerpc_spoolss_DeletePrinter_done, req);
1523         return req;
1524 }
1525
1526 static void dcerpc_spoolss_DeletePrinter_done(struct tevent_req *subreq)
1527 {
1528         struct tevent_req *req = tevent_req_callback_data(
1529                 subreq, struct tevent_req);
1530         struct dcerpc_spoolss_DeletePrinter_state *state = tevent_req_data(
1531                 req, struct dcerpc_spoolss_DeletePrinter_state);
1532         NTSTATUS status;
1533         TALLOC_CTX *mem_ctx;
1534
1535         if (state->out_mem_ctx) {
1536                 mem_ctx = state->out_mem_ctx;
1537         } else {
1538                 mem_ctx = state;
1539         }
1540
1541         status = dcerpc_spoolss_DeletePrinter_r_recv(subreq, mem_ctx);
1542         TALLOC_FREE(subreq);
1543         if (tevent_req_nterror(req, status)) {
1544                 return;
1545         }
1546
1547         /* Copy out parameters */
1548
1549         /* Copy result */
1550         state->orig.out.result = state->tmp.out.result;
1551
1552         /* Reset temporary structure */
1553         ZERO_STRUCT(state->tmp);
1554
1555         tevent_req_done(req);
1556 }
1557
1558 NTSTATUS dcerpc_spoolss_DeletePrinter_recv(struct tevent_req *req,
1559                                            TALLOC_CTX *mem_ctx,
1560                                            WERROR *result)
1561 {
1562         struct dcerpc_spoolss_DeletePrinter_state *state = tevent_req_data(
1563                 req, struct dcerpc_spoolss_DeletePrinter_state);
1564         NTSTATUS status;
1565
1566         if (tevent_req_is_nterror(req, &status)) {
1567                 tevent_req_received(req);
1568                 return status;
1569         }
1570
1571         /* Steal possible out parameters to the callers context */
1572         talloc_steal(mem_ctx, state->out_mem_ctx);
1573
1574         /* Return result */
1575         *result = state->orig.out.result;
1576
1577         tevent_req_received(req);
1578         return NT_STATUS_OK;
1579 }
1580
1581 NTSTATUS dcerpc_spoolss_DeletePrinter(struct dcerpc_binding_handle *h,
1582                                       TALLOC_CTX *mem_ctx,
1583                                       struct policy_handle *_handle /* [in] [ref] */,
1584                                       WERROR *result)
1585 {
1586         struct spoolss_DeletePrinter r;
1587         NTSTATUS status;
1588
1589         /* In parameters */
1590         r.in.handle = _handle;
1591
1592         status = dcerpc_spoolss_DeletePrinter_r(h, mem_ctx, &r);
1593         if (!NT_STATUS_IS_OK(status)) {
1594                 return status;
1595         }
1596
1597         /* Return variables */
1598
1599         /* Return result */
1600         *result = r.out.result;
1601
1602         return NT_STATUS_OK;
1603 }
1604
1605 struct dcerpc_spoolss_SetPrinter_r_state {
1606         TALLOC_CTX *out_mem_ctx;
1607 };
1608
1609 static void dcerpc_spoolss_SetPrinter_r_done(struct tevent_req *subreq);
1610
1611 struct tevent_req *dcerpc_spoolss_SetPrinter_r_send(TALLOC_CTX *mem_ctx,
1612         struct tevent_context *ev,
1613         struct dcerpc_binding_handle *h,
1614         struct spoolss_SetPrinter *r)
1615 {
1616         struct tevent_req *req;
1617         struct dcerpc_spoolss_SetPrinter_r_state *state;
1618         struct tevent_req *subreq;
1619
1620         req = tevent_req_create(mem_ctx, &state,
1621                                 struct dcerpc_spoolss_SetPrinter_r_state);
1622         if (req == NULL) {
1623                 return NULL;
1624         }
1625
1626         state->out_mem_ctx = NULL;
1627
1628         subreq = dcerpc_binding_handle_call_send(state, ev, h,
1629                         NULL, &ndr_table_spoolss,
1630                         NDR_SPOOLSS_SETPRINTER, state, r);
1631         if (tevent_req_nomem(subreq, req)) {
1632                 return tevent_req_post(req, ev);
1633         }
1634         tevent_req_set_callback(subreq, dcerpc_spoolss_SetPrinter_r_done, req);
1635
1636         return req;
1637 }
1638
1639 static void dcerpc_spoolss_SetPrinter_r_done(struct tevent_req *subreq)
1640 {
1641         struct tevent_req *req =
1642                 tevent_req_callback_data(subreq,
1643                 struct tevent_req);
1644         NTSTATUS status;
1645
1646         status = dcerpc_binding_handle_call_recv(subreq);
1647         TALLOC_FREE(subreq);
1648         if (tevent_req_nterror(req, status)) {
1649                 return;
1650         }
1651
1652         tevent_req_done(req);
1653 }
1654
1655 NTSTATUS dcerpc_spoolss_SetPrinter_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
1656 {
1657         struct dcerpc_spoolss_SetPrinter_r_state *state =
1658                 tevent_req_data(req,
1659                 struct dcerpc_spoolss_SetPrinter_r_state);
1660         NTSTATUS status;
1661
1662         if (tevent_req_is_nterror(req, &status)) {
1663                 tevent_req_received(req);
1664                 return status;
1665         }
1666
1667         talloc_steal(mem_ctx, state->out_mem_ctx);
1668
1669         tevent_req_received(req);
1670         return NT_STATUS_OK;
1671 }
1672
1673 NTSTATUS dcerpc_spoolss_SetPrinter_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_SetPrinter *r)
1674 {
1675         NTSTATUS status;
1676
1677         status = dcerpc_binding_handle_call(h,
1678                         NULL, &ndr_table_spoolss,
1679                         NDR_SPOOLSS_SETPRINTER, mem_ctx, r);
1680
1681         return status;
1682 }
1683
1684 struct dcerpc_spoolss_SetPrinter_state {
1685         struct spoolss_SetPrinter orig;
1686         struct spoolss_SetPrinter tmp;
1687         TALLOC_CTX *out_mem_ctx;
1688 };
1689
1690 static void dcerpc_spoolss_SetPrinter_done(struct tevent_req *subreq);
1691
1692 struct tevent_req *dcerpc_spoolss_SetPrinter_send(TALLOC_CTX *mem_ctx,
1693                                                   struct tevent_context *ev,
1694                                                   struct dcerpc_binding_handle *h,
1695                                                   struct policy_handle *_handle /* [in] [ref] */,
1696                                                   struct spoolss_SetPrinterInfoCtr *_info_ctr /* [in] [ref] */,
1697                                                   struct spoolss_DevmodeContainer *_devmode_ctr /* [in] [ref] */,
1698                                                   struct sec_desc_buf *_secdesc_ctr /* [in] [ref] */,
1699                                                   enum spoolss_PrinterControl _command /* [in]  */)
1700 {
1701         struct tevent_req *req;
1702         struct dcerpc_spoolss_SetPrinter_state *state;
1703         struct tevent_req *subreq;
1704
1705         req = tevent_req_create(mem_ctx, &state,
1706                                 struct dcerpc_spoolss_SetPrinter_state);
1707         if (req == NULL) {
1708                 return NULL;
1709         }
1710         state->out_mem_ctx = NULL;
1711
1712         /* In parameters */
1713         state->orig.in.handle = _handle;
1714         state->orig.in.info_ctr = _info_ctr;
1715         state->orig.in.devmode_ctr = _devmode_ctr;
1716         state->orig.in.secdesc_ctr = _secdesc_ctr;
1717         state->orig.in.command = _command;
1718
1719         /* Out parameters */
1720
1721         /* Result */
1722         ZERO_STRUCT(state->orig.out.result);
1723
1724         /* make a temporary copy, that we pass to the dispatch function */
1725         state->tmp = state->orig;
1726
1727         subreq = dcerpc_spoolss_SetPrinter_r_send(state, ev, h, &state->tmp);
1728         if (tevent_req_nomem(subreq, req)) {
1729                 return tevent_req_post(req, ev);
1730         }
1731         tevent_req_set_callback(subreq, dcerpc_spoolss_SetPrinter_done, req);
1732         return req;
1733 }
1734
1735 static void dcerpc_spoolss_SetPrinter_done(struct tevent_req *subreq)
1736 {
1737         struct tevent_req *req = tevent_req_callback_data(
1738                 subreq, struct tevent_req);
1739         struct dcerpc_spoolss_SetPrinter_state *state = tevent_req_data(
1740                 req, struct dcerpc_spoolss_SetPrinter_state);
1741         NTSTATUS status;
1742         TALLOC_CTX *mem_ctx;
1743
1744         if (state->out_mem_ctx) {
1745                 mem_ctx = state->out_mem_ctx;
1746         } else {
1747                 mem_ctx = state;
1748         }
1749
1750         status = dcerpc_spoolss_SetPrinter_r_recv(subreq, mem_ctx);
1751         TALLOC_FREE(subreq);
1752         if (tevent_req_nterror(req, status)) {
1753                 return;
1754         }
1755
1756         /* Copy out parameters */
1757
1758         /* Copy result */
1759         state->orig.out.result = state->tmp.out.result;
1760
1761         /* Reset temporary structure */
1762         ZERO_STRUCT(state->tmp);
1763
1764         tevent_req_done(req);
1765 }
1766
1767 NTSTATUS dcerpc_spoolss_SetPrinter_recv(struct tevent_req *req,
1768                                         TALLOC_CTX *mem_ctx,
1769                                         WERROR *result)
1770 {
1771         struct dcerpc_spoolss_SetPrinter_state *state = tevent_req_data(
1772                 req, struct dcerpc_spoolss_SetPrinter_state);
1773         NTSTATUS status;
1774
1775         if (tevent_req_is_nterror(req, &status)) {
1776                 tevent_req_received(req);
1777                 return status;
1778         }
1779
1780         /* Steal possible out parameters to the callers context */
1781         talloc_steal(mem_ctx, state->out_mem_ctx);
1782
1783         /* Return result */
1784         *result = state->orig.out.result;
1785
1786         tevent_req_received(req);
1787         return NT_STATUS_OK;
1788 }
1789
1790 NTSTATUS dcerpc_spoolss_SetPrinter(struct dcerpc_binding_handle *h,
1791                                    TALLOC_CTX *mem_ctx,
1792                                    struct policy_handle *_handle /* [in] [ref] */,
1793                                    struct spoolss_SetPrinterInfoCtr *_info_ctr /* [in] [ref] */,
1794                                    struct spoolss_DevmodeContainer *_devmode_ctr /* [in] [ref] */,
1795                                    struct sec_desc_buf *_secdesc_ctr /* [in] [ref] */,
1796                                    enum spoolss_PrinterControl _command /* [in]  */,
1797                                    WERROR *result)
1798 {
1799         struct spoolss_SetPrinter r;
1800         NTSTATUS status;
1801
1802         /* In parameters */
1803         r.in.handle = _handle;
1804         r.in.info_ctr = _info_ctr;
1805         r.in.devmode_ctr = _devmode_ctr;
1806         r.in.secdesc_ctr = _secdesc_ctr;
1807         r.in.command = _command;
1808
1809         status = dcerpc_spoolss_SetPrinter_r(h, mem_ctx, &r);
1810         if (!NT_STATUS_IS_OK(status)) {
1811                 return status;
1812         }
1813
1814         /* Return variables */
1815
1816         /* Return result */
1817         *result = r.out.result;
1818
1819         return NT_STATUS_OK;
1820 }
1821
1822 struct dcerpc_spoolss_GetPrinter_r_state {
1823         TALLOC_CTX *out_mem_ctx;
1824 };
1825
1826 static void dcerpc_spoolss_GetPrinter_r_done(struct tevent_req *subreq);
1827
1828 struct tevent_req *dcerpc_spoolss_GetPrinter_r_send(TALLOC_CTX *mem_ctx,
1829         struct tevent_context *ev,
1830         struct dcerpc_binding_handle *h,
1831         struct spoolss_GetPrinter *r)
1832 {
1833         struct tevent_req *req;
1834         struct dcerpc_spoolss_GetPrinter_r_state *state;
1835         struct tevent_req *subreq;
1836
1837         req = tevent_req_create(mem_ctx, &state,
1838                                 struct dcerpc_spoolss_GetPrinter_r_state);
1839         if (req == NULL) {
1840                 return NULL;
1841         }
1842
1843         state->out_mem_ctx = talloc_new(state);
1844         if (tevent_req_nomem(state->out_mem_ctx, req)) {
1845                 return tevent_req_post(req, ev);
1846         }
1847
1848         subreq = dcerpc_binding_handle_call_send(state, ev, h,
1849                         NULL, &ndr_table_spoolss,
1850                         NDR_SPOOLSS_GETPRINTER, state->out_mem_ctx, r);
1851         if (tevent_req_nomem(subreq, req)) {
1852                 return tevent_req_post(req, ev);
1853         }
1854         tevent_req_set_callback(subreq, dcerpc_spoolss_GetPrinter_r_done, req);
1855
1856         return req;
1857 }
1858
1859 static void dcerpc_spoolss_GetPrinter_r_done(struct tevent_req *subreq)
1860 {
1861         struct tevent_req *req =
1862                 tevent_req_callback_data(subreq,
1863                 struct tevent_req);
1864         NTSTATUS status;
1865
1866         status = dcerpc_binding_handle_call_recv(subreq);
1867         TALLOC_FREE(subreq);
1868         if (tevent_req_nterror(req, status)) {
1869                 return;
1870         }
1871
1872         tevent_req_done(req);
1873 }
1874
1875 NTSTATUS dcerpc_spoolss_GetPrinter_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
1876 {
1877         struct dcerpc_spoolss_GetPrinter_r_state *state =
1878                 tevent_req_data(req,
1879                 struct dcerpc_spoolss_GetPrinter_r_state);
1880         NTSTATUS status;
1881
1882         if (tevent_req_is_nterror(req, &status)) {
1883                 tevent_req_received(req);
1884                 return status;
1885         }
1886
1887         talloc_steal(mem_ctx, state->out_mem_ctx);
1888
1889         tevent_req_received(req);
1890         return NT_STATUS_OK;
1891 }
1892
1893 NTSTATUS dcerpc_spoolss_GetPrinter_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_GetPrinter *r)
1894 {
1895         NTSTATUS status;
1896
1897         status = dcerpc_binding_handle_call(h,
1898                         NULL, &ndr_table_spoolss,
1899                         NDR_SPOOLSS_GETPRINTER, mem_ctx, r);
1900
1901         return status;
1902 }
1903
1904 struct dcerpc_spoolss_GetPrinter_state {
1905         struct spoolss_GetPrinter orig;
1906         struct spoolss_GetPrinter tmp;
1907         TALLOC_CTX *out_mem_ctx;
1908 };
1909
1910 static void dcerpc_spoolss_GetPrinter_done(struct tevent_req *subreq);
1911
1912 struct tevent_req *dcerpc_spoolss_GetPrinter_send(TALLOC_CTX *mem_ctx,
1913                                                   struct tevent_context *ev,
1914                                                   struct dcerpc_binding_handle *h,
1915                                                   struct policy_handle *_handle /* [in] [ref] */,
1916                                                   uint32_t _level /* [in]  */,
1917                                                   DATA_BLOB *_buffer /* [in] [unique] */,
1918                                                   uint32_t _offered /* [in]  */,
1919                                                   union spoolss_PrinterInfo *_info /* [out] [unique,subcontext_size(offered),subcontext(4),switch_is(level)] */,
1920                                                   uint32_t *_needed /* [out] [ref] */)
1921 {
1922         struct tevent_req *req;
1923         struct dcerpc_spoolss_GetPrinter_state *state;
1924         struct tevent_req *subreq;
1925
1926         req = tevent_req_create(mem_ctx, &state,
1927                                 struct dcerpc_spoolss_GetPrinter_state);
1928         if (req == NULL) {
1929                 return NULL;
1930         }
1931         state->out_mem_ctx = NULL;
1932
1933         /* In parameters */
1934         state->orig.in.handle = _handle;
1935         state->orig.in.level = _level;
1936         state->orig.in.buffer = _buffer;
1937         state->orig.in.offered = _offered;
1938
1939         /* Out parameters */
1940         state->orig.out.info = _info;
1941         state->orig.out.needed = _needed;
1942
1943         /* Result */
1944         ZERO_STRUCT(state->orig.out.result);
1945
1946         state->out_mem_ctx = talloc_named_const(state, 0,
1947                              "dcerpc_spoolss_GetPrinter_out_memory");
1948         if (tevent_req_nomem(state->out_mem_ctx, req)) {
1949                 return tevent_req_post(req, ev);
1950         }
1951
1952         /* make a temporary copy, that we pass to the dispatch function */
1953         state->tmp = state->orig;
1954
1955         subreq = dcerpc_spoolss_GetPrinter_r_send(state, ev, h, &state->tmp);
1956         if (tevent_req_nomem(subreq, req)) {
1957                 return tevent_req_post(req, ev);
1958         }
1959         tevent_req_set_callback(subreq, dcerpc_spoolss_GetPrinter_done, req);
1960         return req;
1961 }
1962
1963 static void dcerpc_spoolss_GetPrinter_done(struct tevent_req *subreq)
1964 {
1965         struct tevent_req *req = tevent_req_callback_data(
1966                 subreq, struct tevent_req);
1967         struct dcerpc_spoolss_GetPrinter_state *state = tevent_req_data(
1968                 req, struct dcerpc_spoolss_GetPrinter_state);
1969         NTSTATUS status;
1970         TALLOC_CTX *mem_ctx;
1971
1972         if (state->out_mem_ctx) {
1973                 mem_ctx = state->out_mem_ctx;
1974         } else {
1975                 mem_ctx = state;
1976         }
1977
1978         status = dcerpc_spoolss_GetPrinter_r_recv(subreq, mem_ctx);
1979         TALLOC_FREE(subreq);
1980         if (tevent_req_nterror(req, status)) {
1981                 return;
1982         }
1983
1984         /* Copy out parameters */
1985         if (state->orig.out.info && state->tmp.out.info) {
1986                 *state->orig.out.info = *state->tmp.out.info;
1987         }
1988         *state->orig.out.needed = *state->tmp.out.needed;
1989
1990         /* Copy result */
1991         state->orig.out.result = state->tmp.out.result;
1992
1993         /* Reset temporary structure */
1994         ZERO_STRUCT(state->tmp);
1995
1996         tevent_req_done(req);
1997 }
1998
1999 NTSTATUS dcerpc_spoolss_GetPrinter_recv(struct tevent_req *req,
2000                                         TALLOC_CTX *mem_ctx,
2001                                         WERROR *result)
2002 {
2003         struct dcerpc_spoolss_GetPrinter_state *state = tevent_req_data(
2004                 req, struct dcerpc_spoolss_GetPrinter_state);
2005         NTSTATUS status;
2006
2007         if (tevent_req_is_nterror(req, &status)) {
2008                 tevent_req_received(req);
2009                 return status;
2010         }
2011
2012         /* Steal possible out parameters to the callers context */
2013         talloc_steal(mem_ctx, state->out_mem_ctx);
2014
2015         /* Return result */
2016         *result = state->orig.out.result;
2017
2018         tevent_req_received(req);
2019         return NT_STATUS_OK;
2020 }
2021
2022 NTSTATUS dcerpc_spoolss_GetPrinter(struct dcerpc_binding_handle *h,
2023                                    TALLOC_CTX *mem_ctx,
2024                                    struct policy_handle *_handle /* [in] [ref] */,
2025                                    uint32_t _level /* [in]  */,
2026                                    DATA_BLOB *_buffer /* [in] [unique] */,
2027                                    uint32_t _offered /* [in]  */,
2028                                    union spoolss_PrinterInfo *_info /* [out] [unique,subcontext_size(offered),subcontext(4),switch_is(level)] */,
2029                                    uint32_t *_needed /* [out] [ref] */,
2030                                    WERROR *result)
2031 {
2032         struct spoolss_GetPrinter r;
2033         NTSTATUS status;
2034
2035         /* In parameters */
2036         r.in.handle = _handle;
2037         r.in.level = _level;
2038         r.in.buffer = _buffer;
2039         r.in.offered = _offered;
2040
2041         status = dcerpc_spoolss_GetPrinter_r(h, mem_ctx, &r);
2042         if (!NT_STATUS_IS_OK(status)) {
2043                 return status;
2044         }
2045
2046         /* Return variables */
2047         if (_info && r.out.info) {
2048                 *_info = *r.out.info;
2049         }
2050         *_needed = *r.out.needed;
2051
2052         /* Return result */
2053         *result = r.out.result;
2054
2055         return NT_STATUS_OK;
2056 }
2057
2058 struct dcerpc_spoolss_AddPrinterDriver_r_state {
2059         TALLOC_CTX *out_mem_ctx;
2060 };
2061
2062 static void dcerpc_spoolss_AddPrinterDriver_r_done(struct tevent_req *subreq);
2063
2064 struct tevent_req *dcerpc_spoolss_AddPrinterDriver_r_send(TALLOC_CTX *mem_ctx,
2065         struct tevent_context *ev,
2066         struct dcerpc_binding_handle *h,
2067         struct spoolss_AddPrinterDriver *r)
2068 {
2069         struct tevent_req *req;
2070         struct dcerpc_spoolss_AddPrinterDriver_r_state *state;
2071         struct tevent_req *subreq;
2072
2073         req = tevent_req_create(mem_ctx, &state,
2074                                 struct dcerpc_spoolss_AddPrinterDriver_r_state);
2075         if (req == NULL) {
2076                 return NULL;
2077         }
2078
2079         state->out_mem_ctx = NULL;
2080
2081         subreq = dcerpc_binding_handle_call_send(state, ev, h,
2082                         NULL, &ndr_table_spoolss,
2083                         NDR_SPOOLSS_ADDPRINTERDRIVER, state, r);
2084         if (tevent_req_nomem(subreq, req)) {
2085                 return tevent_req_post(req, ev);
2086         }
2087         tevent_req_set_callback(subreq, dcerpc_spoolss_AddPrinterDriver_r_done, req);
2088
2089         return req;
2090 }
2091
2092 static void dcerpc_spoolss_AddPrinterDriver_r_done(struct tevent_req *subreq)
2093 {
2094         struct tevent_req *req =
2095                 tevent_req_callback_data(subreq,
2096                 struct tevent_req);
2097         NTSTATUS status;
2098
2099         status = dcerpc_binding_handle_call_recv(subreq);
2100         TALLOC_FREE(subreq);
2101         if (tevent_req_nterror(req, status)) {
2102                 return;
2103         }
2104
2105         tevent_req_done(req);
2106 }
2107
2108 NTSTATUS dcerpc_spoolss_AddPrinterDriver_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
2109 {
2110         struct dcerpc_spoolss_AddPrinterDriver_r_state *state =
2111                 tevent_req_data(req,
2112                 struct dcerpc_spoolss_AddPrinterDriver_r_state);
2113         NTSTATUS status;
2114
2115         if (tevent_req_is_nterror(req, &status)) {
2116                 tevent_req_received(req);
2117                 return status;
2118         }
2119
2120         talloc_steal(mem_ctx, state->out_mem_ctx);
2121
2122         tevent_req_received(req);
2123         return NT_STATUS_OK;
2124 }
2125
2126 NTSTATUS dcerpc_spoolss_AddPrinterDriver_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_AddPrinterDriver *r)
2127 {
2128         NTSTATUS status;
2129
2130         status = dcerpc_binding_handle_call(h,
2131                         NULL, &ndr_table_spoolss,
2132                         NDR_SPOOLSS_ADDPRINTERDRIVER, mem_ctx, r);
2133
2134         return status;
2135 }
2136
2137 struct dcerpc_spoolss_AddPrinterDriver_state {
2138         struct spoolss_AddPrinterDriver orig;
2139         struct spoolss_AddPrinterDriver tmp;
2140         TALLOC_CTX *out_mem_ctx;
2141 };
2142
2143 static void dcerpc_spoolss_AddPrinterDriver_done(struct tevent_req *subreq);
2144
2145 struct tevent_req *dcerpc_spoolss_AddPrinterDriver_send(TALLOC_CTX *mem_ctx,
2146                                                         struct tevent_context *ev,
2147                                                         struct dcerpc_binding_handle *h,
2148                                                         const char *_servername /* [in] [unique,charset(UTF16)] */,
2149                                                         struct spoolss_AddDriverInfoCtr *_info_ctr /* [in] [ref] */)
2150 {
2151         struct tevent_req *req;
2152         struct dcerpc_spoolss_AddPrinterDriver_state *state;
2153         struct tevent_req *subreq;
2154
2155         req = tevent_req_create(mem_ctx, &state,
2156                                 struct dcerpc_spoolss_AddPrinterDriver_state);
2157         if (req == NULL) {
2158                 return NULL;
2159         }
2160         state->out_mem_ctx = NULL;
2161
2162         /* In parameters */
2163         state->orig.in.servername = _servername;
2164         state->orig.in.info_ctr = _info_ctr;
2165
2166         /* Out parameters */
2167
2168         /* Result */
2169         ZERO_STRUCT(state->orig.out.result);
2170
2171         /* make a temporary copy, that we pass to the dispatch function */
2172         state->tmp = state->orig;
2173
2174         subreq = dcerpc_spoolss_AddPrinterDriver_r_send(state, ev, h, &state->tmp);
2175         if (tevent_req_nomem(subreq, req)) {
2176                 return tevent_req_post(req, ev);
2177         }
2178         tevent_req_set_callback(subreq, dcerpc_spoolss_AddPrinterDriver_done, req);
2179         return req;
2180 }
2181
2182 static void dcerpc_spoolss_AddPrinterDriver_done(struct tevent_req *subreq)
2183 {
2184         struct tevent_req *req = tevent_req_callback_data(
2185                 subreq, struct tevent_req);
2186         struct dcerpc_spoolss_AddPrinterDriver_state *state = tevent_req_data(
2187                 req, struct dcerpc_spoolss_AddPrinterDriver_state);
2188         NTSTATUS status;
2189         TALLOC_CTX *mem_ctx;
2190
2191         if (state->out_mem_ctx) {
2192                 mem_ctx = state->out_mem_ctx;
2193         } else {
2194                 mem_ctx = state;
2195         }
2196
2197         status = dcerpc_spoolss_AddPrinterDriver_r_recv(subreq, mem_ctx);
2198         TALLOC_FREE(subreq);
2199         if (tevent_req_nterror(req, status)) {
2200                 return;
2201         }
2202
2203         /* Copy out parameters */
2204
2205         /* Copy result */
2206         state->orig.out.result = state->tmp.out.result;
2207
2208         /* Reset temporary structure */
2209         ZERO_STRUCT(state->tmp);
2210
2211         tevent_req_done(req);
2212 }
2213
2214 NTSTATUS dcerpc_spoolss_AddPrinterDriver_recv(struct tevent_req *req,
2215                                               TALLOC_CTX *mem_ctx,
2216                                               WERROR *result)
2217 {
2218         struct dcerpc_spoolss_AddPrinterDriver_state *state = tevent_req_data(
2219                 req, struct dcerpc_spoolss_AddPrinterDriver_state);
2220         NTSTATUS status;
2221
2222         if (tevent_req_is_nterror(req, &status)) {
2223                 tevent_req_received(req);
2224                 return status;
2225         }
2226
2227         /* Steal possible out parameters to the callers context */
2228         talloc_steal(mem_ctx, state->out_mem_ctx);
2229
2230         /* Return result */
2231         *result = state->orig.out.result;
2232
2233         tevent_req_received(req);
2234         return NT_STATUS_OK;
2235 }
2236
2237 NTSTATUS dcerpc_spoolss_AddPrinterDriver(struct dcerpc_binding_handle *h,
2238                                          TALLOC_CTX *mem_ctx,
2239                                          const char *_servername /* [in] [unique,charset(UTF16)] */,
2240                                          struct spoolss_AddDriverInfoCtr *_info_ctr /* [in] [ref] */,
2241                                          WERROR *result)
2242 {
2243         struct spoolss_AddPrinterDriver r;
2244         NTSTATUS status;
2245
2246         /* In parameters */
2247         r.in.servername = _servername;
2248         r.in.info_ctr = _info_ctr;
2249
2250         status = dcerpc_spoolss_AddPrinterDriver_r(h, mem_ctx, &r);
2251         if (!NT_STATUS_IS_OK(status)) {
2252                 return status;
2253         }
2254
2255         /* Return variables */
2256
2257         /* Return result */
2258         *result = r.out.result;
2259
2260         return NT_STATUS_OK;
2261 }
2262
2263 struct dcerpc_spoolss_EnumPrinterDrivers_r_state {
2264         TALLOC_CTX *out_mem_ctx;
2265 };
2266
2267 static void dcerpc_spoolss_EnumPrinterDrivers_r_done(struct tevent_req *subreq);
2268
2269 struct tevent_req *dcerpc_spoolss_EnumPrinterDrivers_r_send(TALLOC_CTX *mem_ctx,
2270         struct tevent_context *ev,
2271         struct dcerpc_binding_handle *h,
2272         struct spoolss_EnumPrinterDrivers *r)
2273 {
2274         struct tevent_req *req;
2275         struct dcerpc_spoolss_EnumPrinterDrivers_r_state *state;
2276         struct tevent_req *subreq;
2277
2278         req = tevent_req_create(mem_ctx, &state,
2279                                 struct dcerpc_spoolss_EnumPrinterDrivers_r_state);
2280         if (req == NULL) {
2281                 return NULL;
2282         }
2283
2284         state->out_mem_ctx = talloc_new(state);
2285         if (tevent_req_nomem(state->out_mem_ctx, req)) {
2286                 return tevent_req_post(req, ev);
2287         }
2288
2289         subreq = dcerpc_binding_handle_call_send(state, ev, h,
2290                         NULL, &ndr_table_spoolss,
2291                         NDR_SPOOLSS_ENUMPRINTERDRIVERS, state->out_mem_ctx, r);
2292         if (tevent_req_nomem(subreq, req)) {
2293                 return tevent_req_post(req, ev);
2294         }
2295         tevent_req_set_callback(subreq, dcerpc_spoolss_EnumPrinterDrivers_r_done, req);
2296
2297         return req;
2298 }
2299
2300 static void dcerpc_spoolss_EnumPrinterDrivers_r_done(struct tevent_req *subreq)
2301 {
2302         struct tevent_req *req =
2303                 tevent_req_callback_data(subreq,
2304                 struct tevent_req);
2305         NTSTATUS status;
2306
2307         status = dcerpc_binding_handle_call_recv(subreq);
2308         TALLOC_FREE(subreq);
2309         if (tevent_req_nterror(req, status)) {
2310                 return;
2311         }
2312
2313         tevent_req_done(req);
2314 }
2315
2316 NTSTATUS dcerpc_spoolss_EnumPrinterDrivers_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
2317 {
2318         struct dcerpc_spoolss_EnumPrinterDrivers_r_state *state =
2319                 tevent_req_data(req,
2320                 struct dcerpc_spoolss_EnumPrinterDrivers_r_state);
2321         NTSTATUS status;
2322
2323         if (tevent_req_is_nterror(req, &status)) {
2324                 tevent_req_received(req);
2325                 return status;
2326         }
2327
2328         talloc_steal(mem_ctx, state->out_mem_ctx);
2329
2330         tevent_req_received(req);
2331         return NT_STATUS_OK;
2332 }
2333
2334 NTSTATUS dcerpc_spoolss_EnumPrinterDrivers_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_EnumPrinterDrivers *r)
2335 {
2336         NTSTATUS status;
2337
2338         status = dcerpc_binding_handle_call(h,
2339                         NULL, &ndr_table_spoolss,
2340                         NDR_SPOOLSS_ENUMPRINTERDRIVERS, mem_ctx, r);
2341
2342         return status;
2343 }
2344
2345 struct dcerpc_spoolss_EnumPrinterDrivers_state {
2346         struct spoolss_EnumPrinterDrivers orig;
2347         struct spoolss_EnumPrinterDrivers tmp;
2348         TALLOC_CTX *out_mem_ctx;
2349 };
2350
2351 static void dcerpc_spoolss_EnumPrinterDrivers_done(struct tevent_req *subreq);
2352
2353 struct tevent_req *dcerpc_spoolss_EnumPrinterDrivers_send(TALLOC_CTX *mem_ctx,
2354                                                           struct tevent_context *ev,
2355                                                           struct dcerpc_binding_handle *h,
2356                                                           const char *_server /* [in] [unique,charset(UTF16)] */,
2357                                                           const char *_environment /* [in] [unique,charset(UTF16)] */,
2358                                                           uint32_t _level /* [in]  */,
2359                                                           DATA_BLOB *_buffer /* [in] [unique] */,
2360                                                           uint32_t _offered /* [in]  */,
2361                                                           uint32_t *_count /* [out] [ref] */,
2362                                                           union spoolss_DriverInfo **_info /* [out] [ref,switch_is(level),size_is(,*count)] */,
2363                                                           uint32_t *_needed /* [out] [ref] */)
2364 {
2365         struct tevent_req *req;
2366         struct dcerpc_spoolss_EnumPrinterDrivers_state *state;
2367         struct tevent_req *subreq;
2368
2369         req = tevent_req_create(mem_ctx, &state,
2370                                 struct dcerpc_spoolss_EnumPrinterDrivers_state);
2371         if (req == NULL) {
2372                 return NULL;
2373         }
2374         state->out_mem_ctx = NULL;
2375
2376         /* In parameters */
2377         state->orig.in.server = _server;
2378         state->orig.in.environment = _environment;
2379         state->orig.in.level = _level;
2380         state->orig.in.buffer = _buffer;
2381         state->orig.in.offered = _offered;
2382
2383         /* Out parameters */
2384         state->orig.out.count = _count;
2385         state->orig.out.info = _info;
2386         state->orig.out.needed = _needed;
2387
2388         /* Result */
2389         ZERO_STRUCT(state->orig.out.result);
2390
2391         state->out_mem_ctx = talloc_named_const(state, 0,
2392                              "dcerpc_spoolss_EnumPrinterDrivers_out_memory");
2393         if (tevent_req_nomem(state->out_mem_ctx, req)) {
2394                 return tevent_req_post(req, ev);
2395         }
2396
2397         /* make a temporary copy, that we pass to the dispatch function */
2398         state->tmp = state->orig;
2399
2400         subreq = dcerpc_spoolss_EnumPrinterDrivers_r_send(state, ev, h, &state->tmp);
2401         if (tevent_req_nomem(subreq, req)) {
2402                 return tevent_req_post(req, ev);
2403         }
2404         tevent_req_set_callback(subreq, dcerpc_spoolss_EnumPrinterDrivers_done, req);
2405         return req;
2406 }
2407
2408 static void dcerpc_spoolss_EnumPrinterDrivers_done(struct tevent_req *subreq)
2409 {
2410         struct tevent_req *req = tevent_req_callback_data(
2411                 subreq, struct tevent_req);
2412         struct dcerpc_spoolss_EnumPrinterDrivers_state *state = tevent_req_data(
2413                 req, struct dcerpc_spoolss_EnumPrinterDrivers_state);
2414         NTSTATUS status;
2415         TALLOC_CTX *mem_ctx;
2416
2417         if (state->out_mem_ctx) {
2418                 mem_ctx = state->out_mem_ctx;
2419         } else {
2420                 mem_ctx = state;
2421         }
2422
2423         status = dcerpc_spoolss_EnumPrinterDrivers_r_recv(subreq, mem_ctx);
2424         TALLOC_FREE(subreq);
2425         if (tevent_req_nterror(req, status)) {
2426                 return;
2427         }
2428
2429         /* Copy out parameters */
2430         *state->orig.out.count = *state->tmp.out.count;
2431         *state->orig.out.info = *state->tmp.out.info;
2432         *state->orig.out.needed = *state->tmp.out.needed;
2433
2434         /* Copy result */
2435         state->orig.out.result = state->tmp.out.result;
2436
2437         /* Reset temporary structure */
2438         ZERO_STRUCT(state->tmp);
2439
2440         tevent_req_done(req);
2441 }
2442
2443 NTSTATUS dcerpc_spoolss_EnumPrinterDrivers_recv(struct tevent_req *req,
2444                                                 TALLOC_CTX *mem_ctx,
2445                                                 WERROR *result)
2446 {
2447         struct dcerpc_spoolss_EnumPrinterDrivers_state *state = tevent_req_data(
2448                 req, struct dcerpc_spoolss_EnumPrinterDrivers_state);
2449         NTSTATUS status;
2450
2451         if (tevent_req_is_nterror(req, &status)) {
2452                 tevent_req_received(req);
2453                 return status;
2454         }
2455
2456         /* Steal possible out parameters to the callers context */
2457         talloc_steal(mem_ctx, state->out_mem_ctx);
2458
2459         /* Return result */
2460         *result = state->orig.out.result;
2461
2462         tevent_req_received(req);
2463         return NT_STATUS_OK;
2464 }
2465
2466 NTSTATUS dcerpc_spoolss_EnumPrinterDrivers(struct dcerpc_binding_handle *h,
2467                                            TALLOC_CTX *mem_ctx,
2468                                            const char *_server /* [in] [unique,charset(UTF16)] */,
2469                                            const char *_environment /* [in] [unique,charset(UTF16)] */,
2470                                            uint32_t _level /* [in]  */,
2471                                            DATA_BLOB *_buffer /* [in] [unique] */,
2472                                            uint32_t _offered /* [in]  */,
2473                                            uint32_t *_count /* [out] [ref] */,
2474                                            union spoolss_DriverInfo **_info /* [out] [ref,switch_is(level),size_is(,*count)] */,
2475                                            uint32_t *_needed /* [out] [ref] */,
2476                                            WERROR *result)
2477 {
2478         struct spoolss_EnumPrinterDrivers r;
2479         NTSTATUS status;
2480
2481         /* In parameters */
2482         r.in.server = _server;
2483         r.in.environment = _environment;
2484         r.in.level = _level;
2485         r.in.buffer = _buffer;
2486         r.in.offered = _offered;
2487
2488         status = dcerpc_spoolss_EnumPrinterDrivers_r(h, mem_ctx, &r);
2489         if (!NT_STATUS_IS_OK(status)) {
2490                 return status;
2491         }
2492
2493         /* Return variables */
2494         *_count = *r.out.count;
2495         *_info = *r.out.info;
2496         *_needed = *r.out.needed;
2497
2498         /* Return result */
2499         *result = r.out.result;
2500
2501         return NT_STATUS_OK;
2502 }
2503
2504 struct dcerpc_spoolss_GetPrinterDriver_r_state {
2505         TALLOC_CTX *out_mem_ctx;
2506 };
2507
2508 static void dcerpc_spoolss_GetPrinterDriver_r_done(struct tevent_req *subreq);
2509
2510 struct tevent_req *dcerpc_spoolss_GetPrinterDriver_r_send(TALLOC_CTX *mem_ctx,
2511         struct tevent_context *ev,
2512         struct dcerpc_binding_handle *h,
2513         struct spoolss_GetPrinterDriver *r)
2514 {
2515         struct tevent_req *req;
2516         struct dcerpc_spoolss_GetPrinterDriver_r_state *state;
2517         struct tevent_req *subreq;
2518
2519         req = tevent_req_create(mem_ctx, &state,
2520                                 struct dcerpc_spoolss_GetPrinterDriver_r_state);
2521         if (req == NULL) {
2522                 return NULL;
2523         }
2524
2525         state->out_mem_ctx = talloc_new(state);
2526         if (tevent_req_nomem(state->out_mem_ctx, req)) {
2527                 return tevent_req_post(req, ev);
2528         }
2529
2530         subreq = dcerpc_binding_handle_call_send(state, ev, h,
2531                         NULL, &ndr_table_spoolss,
2532                         NDR_SPOOLSS_GETPRINTERDRIVER, state->out_mem_ctx, r);
2533         if (tevent_req_nomem(subreq, req)) {
2534                 return tevent_req_post(req, ev);
2535         }
2536         tevent_req_set_callback(subreq, dcerpc_spoolss_GetPrinterDriver_r_done, req);
2537
2538         return req;
2539 }
2540
2541 static void dcerpc_spoolss_GetPrinterDriver_r_done(struct tevent_req *subreq)
2542 {
2543         struct tevent_req *req =
2544                 tevent_req_callback_data(subreq,
2545                 struct tevent_req);
2546         NTSTATUS status;
2547
2548         status = dcerpc_binding_handle_call_recv(subreq);
2549         TALLOC_FREE(subreq);
2550         if (tevent_req_nterror(req, status)) {
2551                 return;
2552         }
2553
2554         tevent_req_done(req);
2555 }
2556
2557 NTSTATUS dcerpc_spoolss_GetPrinterDriver_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
2558 {
2559         struct dcerpc_spoolss_GetPrinterDriver_r_state *state =
2560                 tevent_req_data(req,
2561                 struct dcerpc_spoolss_GetPrinterDriver_r_state);
2562         NTSTATUS status;
2563
2564         if (tevent_req_is_nterror(req, &status)) {
2565                 tevent_req_received(req);
2566                 return status;
2567         }
2568
2569         talloc_steal(mem_ctx, state->out_mem_ctx);
2570
2571         tevent_req_received(req);
2572         return NT_STATUS_OK;
2573 }
2574
2575 NTSTATUS dcerpc_spoolss_GetPrinterDriver_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_GetPrinterDriver *r)
2576 {
2577         NTSTATUS status;
2578
2579         status = dcerpc_binding_handle_call(h,
2580                         NULL, &ndr_table_spoolss,
2581                         NDR_SPOOLSS_GETPRINTERDRIVER, mem_ctx, r);
2582
2583         return status;
2584 }
2585
2586 struct dcerpc_spoolss_GetPrinterDriver_state {
2587         struct spoolss_GetPrinterDriver orig;
2588         struct spoolss_GetPrinterDriver tmp;
2589         TALLOC_CTX *out_mem_ctx;
2590 };
2591
2592 static void dcerpc_spoolss_GetPrinterDriver_done(struct tevent_req *subreq);
2593
2594 struct tevent_req *dcerpc_spoolss_GetPrinterDriver_send(TALLOC_CTX *mem_ctx,
2595                                                         struct tevent_context *ev,
2596                                                         struct dcerpc_binding_handle *h,
2597                                                         struct policy_handle *_handle /* [in] [ref] */,
2598                                                         const char *_architecture /* [in] [unique,charset(UTF16)] */,
2599                                                         uint32_t _level /* [in]  */,
2600                                                         DATA_BLOB *_buffer /* [in] [unique] */,
2601                                                         uint32_t _offered /* [in]  */,
2602                                                         union spoolss_DriverInfo *_info /* [out] [unique,subcontext_size(offered),subcontext(4),switch_is(level)] */,
2603                                                         uint32_t *_needed /* [out] [ref] */)
2604 {
2605         struct tevent_req *req;
2606         struct dcerpc_spoolss_GetPrinterDriver_state *state;
2607         struct tevent_req *subreq;
2608
2609         req = tevent_req_create(mem_ctx, &state,
2610                                 struct dcerpc_spoolss_GetPrinterDriver_state);
2611         if (req == NULL) {
2612                 return NULL;
2613         }
2614         state->out_mem_ctx = NULL;
2615
2616         /* In parameters */
2617         state->orig.in.handle = _handle;
2618         state->orig.in.architecture = _architecture;
2619         state->orig.in.level = _level;
2620         state->orig.in.buffer = _buffer;
2621         state->orig.in.offered = _offered;
2622
2623         /* Out parameters */
2624         state->orig.out.info = _info;
2625         state->orig.out.needed = _needed;
2626
2627         /* Result */
2628         ZERO_STRUCT(state->orig.out.result);
2629
2630         state->out_mem_ctx = talloc_named_const(state, 0,
2631                              "dcerpc_spoolss_GetPrinterDriver_out_memory");
2632         if (tevent_req_nomem(state->out_mem_ctx, req)) {
2633                 return tevent_req_post(req, ev);
2634         }
2635
2636         /* make a temporary copy, that we pass to the dispatch function */
2637         state->tmp = state->orig;
2638
2639         subreq = dcerpc_spoolss_GetPrinterDriver_r_send(state, ev, h, &state->tmp);
2640         if (tevent_req_nomem(subreq, req)) {
2641                 return tevent_req_post(req, ev);
2642         }
2643         tevent_req_set_callback(subreq, dcerpc_spoolss_GetPrinterDriver_done, req);
2644         return req;
2645 }
2646
2647 static void dcerpc_spoolss_GetPrinterDriver_done(struct tevent_req *subreq)
2648 {
2649         struct tevent_req *req = tevent_req_callback_data(
2650                 subreq, struct tevent_req);
2651         struct dcerpc_spoolss_GetPrinterDriver_state *state = tevent_req_data(
2652                 req, struct dcerpc_spoolss_GetPrinterDriver_state);
2653         NTSTATUS status;
2654         TALLOC_CTX *mem_ctx;
2655
2656         if (state->out_mem_ctx) {
2657                 mem_ctx = state->out_mem_ctx;
2658         } else {
2659                 mem_ctx = state;
2660         }
2661
2662         status = dcerpc_spoolss_GetPrinterDriver_r_recv(subreq, mem_ctx);
2663         TALLOC_FREE(subreq);
2664         if (tevent_req_nterror(req, status)) {
2665                 return;
2666         }
2667
2668         /* Copy out parameters */
2669         if (state->orig.out.info && state->tmp.out.info) {
2670                 *state->orig.out.info = *state->tmp.out.info;
2671         }
2672         *state->orig.out.needed = *state->tmp.out.needed;
2673
2674         /* Copy result */
2675         state->orig.out.result = state->tmp.out.result;
2676
2677         /* Reset temporary structure */
2678         ZERO_STRUCT(state->tmp);
2679
2680         tevent_req_done(req);
2681 }
2682
2683 NTSTATUS dcerpc_spoolss_GetPrinterDriver_recv(struct tevent_req *req,
2684                                               TALLOC_CTX *mem_ctx,
2685                                               WERROR *result)
2686 {
2687         struct dcerpc_spoolss_GetPrinterDriver_state *state = tevent_req_data(
2688                 req, struct dcerpc_spoolss_GetPrinterDriver_state);
2689         NTSTATUS status;
2690
2691         if (tevent_req_is_nterror(req, &status)) {
2692                 tevent_req_received(req);
2693                 return status;
2694         }
2695
2696         /* Steal possible out parameters to the callers context */
2697         talloc_steal(mem_ctx, state->out_mem_ctx);
2698
2699         /* Return result */
2700         *result = state->orig.out.result;
2701
2702         tevent_req_received(req);
2703         return NT_STATUS_OK;
2704 }
2705
2706 NTSTATUS dcerpc_spoolss_GetPrinterDriver(struct dcerpc_binding_handle *h,
2707                                          TALLOC_CTX *mem_ctx,
2708                                          struct policy_handle *_handle /* [in] [ref] */,
2709                                          const char *_architecture /* [in] [unique,charset(UTF16)] */,
2710                                          uint32_t _level /* [in]  */,
2711                                          DATA_BLOB *_buffer /* [in] [unique] */,
2712                                          uint32_t _offered /* [in]  */,
2713                                          union spoolss_DriverInfo *_info /* [out] [unique,subcontext_size(offered),subcontext(4),switch_is(level)] */,
2714                                          uint32_t *_needed /* [out] [ref] */,
2715                                          WERROR *result)
2716 {
2717         struct spoolss_GetPrinterDriver r;
2718         NTSTATUS status;
2719
2720         /* In parameters */
2721         r.in.handle = _handle;
2722         r.in.architecture = _architecture;
2723         r.in.level = _level;
2724         r.in.buffer = _buffer;
2725         r.in.offered = _offered;
2726
2727         status = dcerpc_spoolss_GetPrinterDriver_r(h, mem_ctx, &r);
2728         if (!NT_STATUS_IS_OK(status)) {
2729                 return status;
2730         }
2731
2732         /* Return variables */
2733         if (_info && r.out.info) {
2734                 *_info = *r.out.info;
2735         }
2736         *_needed = *r.out.needed;
2737
2738         /* Return result */
2739         *result = r.out.result;
2740
2741         return NT_STATUS_OK;
2742 }
2743
2744 struct dcerpc_spoolss_GetPrinterDriverDirectory_r_state {
2745         TALLOC_CTX *out_mem_ctx;
2746 };
2747
2748 static void dcerpc_spoolss_GetPrinterDriverDirectory_r_done(struct tevent_req *subreq);
2749
2750 struct tevent_req *dcerpc_spoolss_GetPrinterDriverDirectory_r_send(TALLOC_CTX *mem_ctx,
2751         struct tevent_context *ev,
2752         struct dcerpc_binding_handle *h,
2753         struct spoolss_GetPrinterDriverDirectory *r)
2754 {
2755         struct tevent_req *req;
2756         struct dcerpc_spoolss_GetPrinterDriverDirectory_r_state *state;
2757         struct tevent_req *subreq;
2758
2759         req = tevent_req_create(mem_ctx, &state,
2760                                 struct dcerpc_spoolss_GetPrinterDriverDirectory_r_state);
2761         if (req == NULL) {
2762                 return NULL;
2763         }
2764
2765         state->out_mem_ctx = talloc_new(state);
2766         if (tevent_req_nomem(state->out_mem_ctx, req)) {
2767                 return tevent_req_post(req, ev);
2768         }
2769
2770         subreq = dcerpc_binding_handle_call_send(state, ev, h,
2771                         NULL, &ndr_table_spoolss,
2772                         NDR_SPOOLSS_GETPRINTERDRIVERDIRECTORY, state->out_mem_ctx, r);
2773         if (tevent_req_nomem(subreq, req)) {
2774                 return tevent_req_post(req, ev);
2775         }
2776         tevent_req_set_callback(subreq, dcerpc_spoolss_GetPrinterDriverDirectory_r_done, req);
2777
2778         return req;
2779 }
2780
2781 static void dcerpc_spoolss_GetPrinterDriverDirectory_r_done(struct tevent_req *subreq)
2782 {
2783         struct tevent_req *req =
2784                 tevent_req_callback_data(subreq,
2785                 struct tevent_req);
2786         NTSTATUS status;
2787
2788         status = dcerpc_binding_handle_call_recv(subreq);
2789         TALLOC_FREE(subreq);
2790         if (tevent_req_nterror(req, status)) {
2791                 return;
2792         }
2793
2794         tevent_req_done(req);
2795 }
2796
2797 NTSTATUS dcerpc_spoolss_GetPrinterDriverDirectory_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
2798 {
2799         struct dcerpc_spoolss_GetPrinterDriverDirectory_r_state *state =
2800                 tevent_req_data(req,
2801                 struct dcerpc_spoolss_GetPrinterDriverDirectory_r_state);
2802         NTSTATUS status;
2803
2804         if (tevent_req_is_nterror(req, &status)) {
2805                 tevent_req_received(req);
2806                 return status;
2807         }
2808
2809         talloc_steal(mem_ctx, state->out_mem_ctx);
2810
2811         tevent_req_received(req);
2812         return NT_STATUS_OK;
2813 }
2814
2815 NTSTATUS dcerpc_spoolss_GetPrinterDriverDirectory_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_GetPrinterDriverDirectory *r)
2816 {
2817         NTSTATUS status;
2818
2819         status = dcerpc_binding_handle_call(h,
2820                         NULL, &ndr_table_spoolss,
2821                         NDR_SPOOLSS_GETPRINTERDRIVERDIRECTORY, mem_ctx, r);
2822
2823         return status;
2824 }
2825
2826 struct dcerpc_spoolss_GetPrinterDriverDirectory_state {
2827         struct spoolss_GetPrinterDriverDirectory orig;
2828         struct spoolss_GetPrinterDriverDirectory tmp;
2829         TALLOC_CTX *out_mem_ctx;
2830 };
2831
2832 static void dcerpc_spoolss_GetPrinterDriverDirectory_done(struct tevent_req *subreq);
2833
2834 struct tevent_req *dcerpc_spoolss_GetPrinterDriverDirectory_send(TALLOC_CTX *mem_ctx,
2835                                                                  struct tevent_context *ev,
2836                                                                  struct dcerpc_binding_handle *h,
2837                                                                  const char *_server /* [in] [unique,charset(UTF16)] */,
2838                                                                  const char *_environment /* [in] [unique,charset(UTF16)] */,
2839                                                                  uint32_t _level /* [in]  */,
2840                                                                  DATA_BLOB *_buffer /* [in] [unique] */,
2841                                                                  uint32_t _offered /* [in]  */,
2842                                                                  union spoolss_DriverDirectoryInfo *_info /* [out] [unique,subcontext_size(offered),subcontext(4),switch_is(level)] */,
2843                                                                  uint32_t *_needed /* [out] [ref] */)
2844 {
2845         struct tevent_req *req;
2846         struct dcerpc_spoolss_GetPrinterDriverDirectory_state *state;
2847         struct tevent_req *subreq;
2848
2849         req = tevent_req_create(mem_ctx, &state,
2850                                 struct dcerpc_spoolss_GetPrinterDriverDirectory_state);
2851         if (req == NULL) {
2852                 return NULL;
2853         }
2854         state->out_mem_ctx = NULL;
2855
2856         /* In parameters */
2857         state->orig.in.server = _server;
2858         state->orig.in.environment = _environment;
2859         state->orig.in.level = _level;
2860         state->orig.in.buffer = _buffer;
2861         state->orig.in.offered = _offered;
2862
2863         /* Out parameters */
2864         state->orig.out.info = _info;
2865         state->orig.out.needed = _needed;
2866
2867         /* Result */
2868         ZERO_STRUCT(state->orig.out.result);
2869
2870         state->out_mem_ctx = talloc_named_const(state, 0,
2871                              "dcerpc_spoolss_GetPrinterDriverDirectory_out_memory");
2872         if (tevent_req_nomem(state->out_mem_ctx, req)) {
2873                 return tevent_req_post(req, ev);
2874         }
2875
2876         /* make a temporary copy, that we pass to the dispatch function */
2877         state->tmp = state->orig;
2878
2879         subreq = dcerpc_spoolss_GetPrinterDriverDirectory_r_send(state, ev, h, &state->tmp);
2880         if (tevent_req_nomem(subreq, req)) {
2881                 return tevent_req_post(req, ev);
2882         }
2883         tevent_req_set_callback(subreq, dcerpc_spoolss_GetPrinterDriverDirectory_done, req);
2884         return req;
2885 }
2886
2887 static void dcerpc_spoolss_GetPrinterDriverDirectory_done(struct tevent_req *subreq)
2888 {
2889         struct tevent_req *req = tevent_req_callback_data(
2890                 subreq, struct tevent_req);
2891         struct dcerpc_spoolss_GetPrinterDriverDirectory_state *state = tevent_req_data(
2892                 req, struct dcerpc_spoolss_GetPrinterDriverDirectory_state);
2893         NTSTATUS status;
2894         TALLOC_CTX *mem_ctx;
2895
2896         if (state->out_mem_ctx) {
2897                 mem_ctx = state->out_mem_ctx;
2898         } else {
2899                 mem_ctx = state;
2900         }
2901
2902         status = dcerpc_spoolss_GetPrinterDriverDirectory_r_recv(subreq, mem_ctx);
2903         TALLOC_FREE(subreq);
2904         if (tevent_req_nterror(req, status)) {
2905                 return;
2906         }
2907
2908         /* Copy out parameters */
2909         if (state->orig.out.info && state->tmp.out.info) {
2910                 *state->orig.out.info = *state->tmp.out.info;
2911         }
2912         *state->orig.out.needed = *state->tmp.out.needed;
2913
2914         /* Copy result */
2915         state->orig.out.result = state->tmp.out.result;
2916
2917         /* Reset temporary structure */
2918         ZERO_STRUCT(state->tmp);
2919
2920         tevent_req_done(req);
2921 }
2922
2923 NTSTATUS dcerpc_spoolss_GetPrinterDriverDirectory_recv(struct tevent_req *req,
2924                                                        TALLOC_CTX *mem_ctx,
2925                                                        WERROR *result)
2926 {
2927         struct dcerpc_spoolss_GetPrinterDriverDirectory_state *state = tevent_req_data(
2928                 req, struct dcerpc_spoolss_GetPrinterDriverDirectory_state);
2929         NTSTATUS status;
2930
2931         if (tevent_req_is_nterror(req, &status)) {
2932                 tevent_req_received(req);
2933                 return status;
2934         }
2935
2936         /* Steal possible out parameters to the callers context */
2937         talloc_steal(mem_ctx, state->out_mem_ctx);
2938
2939         /* Return result */
2940         *result = state->orig.out.result;
2941
2942         tevent_req_received(req);
2943         return NT_STATUS_OK;
2944 }
2945
2946 NTSTATUS dcerpc_spoolss_GetPrinterDriverDirectory(struct dcerpc_binding_handle *h,
2947                                                   TALLOC_CTX *mem_ctx,
2948                                                   const char *_server /* [in] [unique,charset(UTF16)] */,
2949                                                   const char *_environment /* [in] [unique,charset(UTF16)] */,
2950                                                   uint32_t _level /* [in]  */,
2951                                                   DATA_BLOB *_buffer /* [in] [unique] */,
2952                                                   uint32_t _offered /* [in]  */,
2953                                                   union spoolss_DriverDirectoryInfo *_info /* [out] [unique,subcontext_size(offered),subcontext(4),switch_is(level)] */,
2954                                                   uint32_t *_needed /* [out] [ref] */,
2955                                                   WERROR *result)
2956 {
2957         struct spoolss_GetPrinterDriverDirectory r;
2958         NTSTATUS status;
2959
2960         /* In parameters */
2961         r.in.server = _server;
2962         r.in.environment = _environment;
2963         r.in.level = _level;
2964         r.in.buffer = _buffer;
2965         r.in.offered = _offered;
2966
2967         status = dcerpc_spoolss_GetPrinterDriverDirectory_r(h, mem_ctx, &r);
2968         if (!NT_STATUS_IS_OK(status)) {
2969                 return status;
2970         }
2971
2972         /* Return variables */
2973         if (_info && r.out.info) {
2974                 *_info = *r.out.info;
2975         }
2976         *_needed = *r.out.needed;
2977
2978         /* Return result */
2979         *result = r.out.result;
2980
2981         return NT_STATUS_OK;
2982 }
2983
2984 struct dcerpc_spoolss_DeletePrinterDriver_r_state {
2985         TALLOC_CTX *out_mem_ctx;
2986 };
2987
2988 static void dcerpc_spoolss_DeletePrinterDriver_r_done(struct tevent_req *subreq);
2989
2990 struct tevent_req *dcerpc_spoolss_DeletePrinterDriver_r_send(TALLOC_CTX *mem_ctx,
2991         struct tevent_context *ev,
2992         struct dcerpc_binding_handle *h,
2993         struct spoolss_DeletePrinterDriver *r)
2994 {
2995         struct tevent_req *req;
2996         struct dcerpc_spoolss_DeletePrinterDriver_r_state *state;
2997         struct tevent_req *subreq;
2998
2999         req = tevent_req_create(mem_ctx, &state,
3000                                 struct dcerpc_spoolss_DeletePrinterDriver_r_state);
3001         if (req == NULL) {
3002                 return NULL;
3003         }
3004
3005         state->out_mem_ctx = NULL;
3006
3007         subreq = dcerpc_binding_handle_call_send(state, ev, h,
3008                         NULL, &ndr_table_spoolss,
3009                         NDR_SPOOLSS_DELETEPRINTERDRIVER, state, r);
3010         if (tevent_req_nomem(subreq, req)) {
3011                 return tevent_req_post(req, ev);
3012         }
3013         tevent_req_set_callback(subreq, dcerpc_spoolss_DeletePrinterDriver_r_done, req);
3014
3015         return req;
3016 }
3017
3018 static void dcerpc_spoolss_DeletePrinterDriver_r_done(struct tevent_req *subreq)
3019 {
3020         struct tevent_req *req =
3021                 tevent_req_callback_data(subreq,
3022                 struct tevent_req);
3023         NTSTATUS status;
3024
3025         status = dcerpc_binding_handle_call_recv(subreq);
3026         TALLOC_FREE(subreq);
3027         if (tevent_req_nterror(req, status)) {
3028                 return;
3029         }
3030
3031         tevent_req_done(req);
3032 }
3033
3034 NTSTATUS dcerpc_spoolss_DeletePrinterDriver_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
3035 {
3036         struct dcerpc_spoolss_DeletePrinterDriver_r_state *state =
3037                 tevent_req_data(req,
3038                 struct dcerpc_spoolss_DeletePrinterDriver_r_state);
3039         NTSTATUS status;
3040
3041         if (tevent_req_is_nterror(req, &status)) {
3042                 tevent_req_received(req);
3043                 return status;
3044         }
3045
3046         talloc_steal(mem_ctx, state->out_mem_ctx);
3047
3048         tevent_req_received(req);
3049         return NT_STATUS_OK;
3050 }
3051
3052 NTSTATUS dcerpc_spoolss_DeletePrinterDriver_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_DeletePrinterDriver *r)
3053 {
3054         NTSTATUS status;
3055
3056         status = dcerpc_binding_handle_call(h,
3057                         NULL, &ndr_table_spoolss,
3058                         NDR_SPOOLSS_DELETEPRINTERDRIVER, mem_ctx, r);
3059
3060         return status;
3061 }
3062
3063 struct dcerpc_spoolss_DeletePrinterDriver_state {
3064         struct spoolss_DeletePrinterDriver orig;
3065         struct spoolss_DeletePrinterDriver tmp;
3066         TALLOC_CTX *out_mem_ctx;
3067 };
3068
3069 static void dcerpc_spoolss_DeletePrinterDriver_done(struct tevent_req *subreq);
3070
3071 struct tevent_req *dcerpc_spoolss_DeletePrinterDriver_send(TALLOC_CTX *mem_ctx,
3072                                                            struct tevent_context *ev,
3073                                                            struct dcerpc_binding_handle *h,
3074                                                            const char *_server /* [in] [unique,charset(UTF16)] */,
3075                                                            const char *_architecture /* [in] [charset(UTF16)] */,
3076                                                            const char *_driver /* [in] [charset(UTF16)] */)
3077 {
3078         struct tevent_req *req;
3079         struct dcerpc_spoolss_DeletePrinterDriver_state *state;
3080         struct tevent_req *subreq;
3081
3082         req = tevent_req_create(mem_ctx, &state,
3083                                 struct dcerpc_spoolss_DeletePrinterDriver_state);
3084         if (req == NULL) {
3085                 return NULL;
3086         }
3087         state->out_mem_ctx = NULL;
3088
3089         /* In parameters */
3090         state->orig.in.server = _server;
3091         state->orig.in.architecture = _architecture;
3092         state->orig.in.driver = _driver;
3093
3094         /* Out parameters */
3095
3096         /* Result */
3097         ZERO_STRUCT(state->orig.out.result);
3098
3099         /* make a temporary copy, that we pass to the dispatch function */
3100         state->tmp = state->orig;
3101
3102         subreq = dcerpc_spoolss_DeletePrinterDriver_r_send(state, ev, h, &state->tmp);
3103         if (tevent_req_nomem(subreq, req)) {
3104                 return tevent_req_post(req, ev);
3105         }
3106         tevent_req_set_callback(subreq, dcerpc_spoolss_DeletePrinterDriver_done, req);
3107         return req;
3108 }
3109
3110 static void dcerpc_spoolss_DeletePrinterDriver_done(struct tevent_req *subreq)
3111 {
3112         struct tevent_req *req = tevent_req_callback_data(
3113                 subreq, struct tevent_req);
3114         struct dcerpc_spoolss_DeletePrinterDriver_state *state = tevent_req_data(
3115                 req, struct dcerpc_spoolss_DeletePrinterDriver_state);
3116         NTSTATUS status;
3117         TALLOC_CTX *mem_ctx;
3118
3119         if (state->out_mem_ctx) {
3120                 mem_ctx = state->out_mem_ctx;
3121         } else {
3122                 mem_ctx = state;
3123         }
3124
3125         status = dcerpc_spoolss_DeletePrinterDriver_r_recv(subreq, mem_ctx);
3126         TALLOC_FREE(subreq);
3127         if (tevent_req_nterror(req, status)) {
3128                 return;
3129         }
3130
3131         /* Copy out parameters */
3132
3133         /* Copy result */
3134         state->orig.out.result = state->tmp.out.result;
3135
3136         /* Reset temporary structure */
3137         ZERO_STRUCT(state->tmp);
3138
3139         tevent_req_done(req);
3140 }
3141
3142 NTSTATUS dcerpc_spoolss_DeletePrinterDriver_recv(struct tevent_req *req,
3143                                                  TALLOC_CTX *mem_ctx,
3144                                                  WERROR *result)
3145 {
3146         struct dcerpc_spoolss_DeletePrinterDriver_state *state = tevent_req_data(
3147                 req, struct dcerpc_spoolss_DeletePrinterDriver_state);
3148         NTSTATUS status;
3149
3150         if (tevent_req_is_nterror(req, &status)) {
3151                 tevent_req_received(req);
3152                 return status;
3153         }
3154
3155         /* Steal possible out parameters to the callers context */
3156         talloc_steal(mem_ctx, state->out_mem_ctx);
3157
3158         /* Return result */
3159         *result = state->orig.out.result;
3160
3161         tevent_req_received(req);
3162         return NT_STATUS_OK;
3163 }
3164
3165 NTSTATUS dcerpc_spoolss_DeletePrinterDriver(struct dcerpc_binding_handle *h,
3166                                             TALLOC_CTX *mem_ctx,
3167                                             const char *_server /* [in] [unique,charset(UTF16)] */,
3168                                             const char *_architecture /* [in] [charset(UTF16)] */,
3169                                             const char *_driver /* [in] [charset(UTF16)] */,
3170                                             WERROR *result)
3171 {
3172         struct spoolss_DeletePrinterDriver r;
3173         NTSTATUS status;
3174
3175         /* In parameters */
3176         r.in.server = _server;
3177         r.in.architecture = _architecture;
3178         r.in.driver = _driver;
3179
3180         status = dcerpc_spoolss_DeletePrinterDriver_r(h, mem_ctx, &r);
3181         if (!NT_STATUS_IS_OK(status)) {
3182                 return status;
3183         }
3184
3185         /* Return variables */
3186
3187         /* Return result */
3188         *result = r.out.result;
3189
3190         return NT_STATUS_OK;
3191 }
3192
3193 struct dcerpc_spoolss_AddPrintProcessor_r_state {
3194         TALLOC_CTX *out_mem_ctx;
3195 };
3196
3197 static void dcerpc_spoolss_AddPrintProcessor_r_done(struct tevent_req *subreq);
3198
3199 struct tevent_req *dcerpc_spoolss_AddPrintProcessor_r_send(TALLOC_CTX *mem_ctx,
3200         struct tevent_context *ev,
3201         struct dcerpc_binding_handle *h,
3202         struct spoolss_AddPrintProcessor *r)
3203 {
3204         struct tevent_req *req;
3205         struct dcerpc_spoolss_AddPrintProcessor_r_state *state;
3206         struct tevent_req *subreq;
3207
3208         req = tevent_req_create(mem_ctx, &state,
3209                                 struct dcerpc_spoolss_AddPrintProcessor_r_state);
3210         if (req == NULL) {
3211                 return NULL;
3212         }
3213
3214         state->out_mem_ctx = NULL;
3215
3216         subreq = dcerpc_binding_handle_call_send(state, ev, h,
3217                         NULL, &ndr_table_spoolss,
3218                         NDR_SPOOLSS_ADDPRINTPROCESSOR, state, r);
3219         if (tevent_req_nomem(subreq, req)) {
3220                 return tevent_req_post(req, ev);
3221         }
3222         tevent_req_set_callback(subreq, dcerpc_spoolss_AddPrintProcessor_r_done, req);
3223
3224         return req;
3225 }
3226
3227 static void dcerpc_spoolss_AddPrintProcessor_r_done(struct tevent_req *subreq)
3228 {
3229         struct tevent_req *req =
3230                 tevent_req_callback_data(subreq,
3231                 struct tevent_req);
3232         NTSTATUS status;
3233
3234         status = dcerpc_binding_handle_call_recv(subreq);
3235         TALLOC_FREE(subreq);
3236         if (tevent_req_nterror(req, status)) {
3237                 return;
3238         }
3239
3240         tevent_req_done(req);
3241 }
3242
3243 NTSTATUS dcerpc_spoolss_AddPrintProcessor_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
3244 {
3245         struct dcerpc_spoolss_AddPrintProcessor_r_state *state =
3246                 tevent_req_data(req,
3247                 struct dcerpc_spoolss_AddPrintProcessor_r_state);
3248         NTSTATUS status;
3249
3250         if (tevent_req_is_nterror(req, &status)) {
3251                 tevent_req_received(req);
3252                 return status;
3253         }
3254
3255         talloc_steal(mem_ctx, state->out_mem_ctx);
3256
3257         tevent_req_received(req);
3258         return NT_STATUS_OK;
3259 }
3260
3261 NTSTATUS dcerpc_spoolss_AddPrintProcessor_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_AddPrintProcessor *r)
3262 {
3263         NTSTATUS status;
3264
3265         status = dcerpc_binding_handle_call(h,
3266                         NULL, &ndr_table_spoolss,
3267                         NDR_SPOOLSS_ADDPRINTPROCESSOR, mem_ctx, r);
3268
3269         return status;
3270 }
3271
3272 struct dcerpc_spoolss_AddPrintProcessor_state {
3273         struct spoolss_AddPrintProcessor orig;
3274         struct spoolss_AddPrintProcessor tmp;
3275         TALLOC_CTX *out_mem_ctx;
3276 };
3277
3278 static void dcerpc_spoolss_AddPrintProcessor_done(struct tevent_req *subreq);
3279
3280 struct tevent_req *dcerpc_spoolss_AddPrintProcessor_send(TALLOC_CTX *mem_ctx,
3281                                                          struct tevent_context *ev,
3282                                                          struct dcerpc_binding_handle *h,
3283                                                          const char *_server /* [in] [unique,charset(UTF16)] */,
3284                                                          const char *_architecture /* [in] [charset(UTF16)] */,
3285                                                          const char *_path_name /* [in] [charset(UTF16)] */,
3286                                                          const char *_print_processor_name /* [in] [charset(UTF16)] */)
3287 {
3288         struct tevent_req *req;
3289         struct dcerpc_spoolss_AddPrintProcessor_state *state;
3290         struct tevent_req *subreq;
3291
3292         req = tevent_req_create(mem_ctx, &state,
3293                                 struct dcerpc_spoolss_AddPrintProcessor_state);
3294         if (req == NULL) {
3295                 return NULL;
3296         }
3297         state->out_mem_ctx = NULL;
3298
3299         /* In parameters */
3300         state->orig.in.server = _server;
3301         state->orig.in.architecture = _architecture;
3302         state->orig.in.path_name = _path_name;
3303         state->orig.in.print_processor_name = _print_processor_name;
3304
3305         /* Out parameters */
3306
3307         /* Result */
3308         ZERO_STRUCT(state->orig.out.result);
3309
3310         /* make a temporary copy, that we pass to the dispatch function */
3311         state->tmp = state->orig;
3312
3313         subreq = dcerpc_spoolss_AddPrintProcessor_r_send(state, ev, h, &state->tmp);
3314         if (tevent_req_nomem(subreq, req)) {
3315                 return tevent_req_post(req, ev);
3316         }
3317         tevent_req_set_callback(subreq, dcerpc_spoolss_AddPrintProcessor_done, req);
3318         return req;
3319 }
3320
3321 static void dcerpc_spoolss_AddPrintProcessor_done(struct tevent_req *subreq)
3322 {
3323         struct tevent_req *req = tevent_req_callback_data(
3324                 subreq, struct tevent_req);
3325         struct dcerpc_spoolss_AddPrintProcessor_state *state = tevent_req_data(
3326                 req, struct dcerpc_spoolss_AddPrintProcessor_state);
3327         NTSTATUS status;
3328         TALLOC_CTX *mem_ctx;
3329
3330         if (state->out_mem_ctx) {
3331                 mem_ctx = state->out_mem_ctx;
3332         } else {
3333                 mem_ctx = state;
3334         }
3335
3336         status = dcerpc_spoolss_AddPrintProcessor_r_recv(subreq, mem_ctx);
3337         TALLOC_FREE(subreq);
3338         if (tevent_req_nterror(req, status)) {
3339                 return;
3340         }
3341
3342         /* Copy out parameters */
3343
3344         /* Copy result */
3345         state->orig.out.result = state->tmp.out.result;
3346
3347         /* Reset temporary structure */
3348         ZERO_STRUCT(state->tmp);
3349
3350         tevent_req_done(req);
3351 }
3352
3353 NTSTATUS dcerpc_spoolss_AddPrintProcessor_recv(struct tevent_req *req,
3354                                                TALLOC_CTX *mem_ctx,
3355                                                WERROR *result)
3356 {
3357         struct dcerpc_spoolss_AddPrintProcessor_state *state = tevent_req_data(
3358                 req, struct dcerpc_spoolss_AddPrintProcessor_state);
3359         NTSTATUS status;
3360
3361         if (tevent_req_is_nterror(req, &status)) {
3362                 tevent_req_received(req);
3363                 return status;
3364         }
3365
3366         /* Steal possible out parameters to the callers context */
3367         talloc_steal(mem_ctx, state->out_mem_ctx);
3368
3369         /* Return result */
3370         *result = state->orig.out.result;
3371
3372         tevent_req_received(req);
3373         return NT_STATUS_OK;
3374 }
3375
3376 NTSTATUS dcerpc_spoolss_AddPrintProcessor(struct dcerpc_binding_handle *h,
3377                                           TALLOC_CTX *mem_ctx,
3378                                           const char *_server /* [in] [unique,charset(UTF16)] */,
3379                                           const char *_architecture /* [in] [charset(UTF16)] */,
3380                                           const char *_path_name /* [in] [charset(UTF16)] */,
3381                                           const char *_print_processor_name /* [in] [charset(UTF16)] */,
3382                                           WERROR *result)
3383 {
3384         struct spoolss_AddPrintProcessor r;
3385         NTSTATUS status;
3386
3387         /* In parameters */
3388         r.in.server = _server;
3389         r.in.architecture = _architecture;
3390         r.in.path_name = _path_name;
3391         r.in.print_processor_name = _print_processor_name;
3392
3393         status = dcerpc_spoolss_AddPrintProcessor_r(h, mem_ctx, &r);
3394         if (!NT_STATUS_IS_OK(status)) {
3395                 return status;
3396         }
3397
3398         /* Return variables */
3399
3400         /* Return result */
3401         *result = r.out.result;
3402
3403         return NT_STATUS_OK;
3404 }
3405
3406 struct dcerpc_spoolss_EnumPrintProcessors_r_state {
3407         TALLOC_CTX *out_mem_ctx;
3408 };
3409
3410 static void dcerpc_spoolss_EnumPrintProcessors_r_done(struct tevent_req *subreq);
3411
3412 struct tevent_req *dcerpc_spoolss_EnumPrintProcessors_r_send(TALLOC_CTX *mem_ctx,
3413         struct tevent_context *ev,
3414         struct dcerpc_binding_handle *h,
3415         struct spoolss_EnumPrintProcessors *r)
3416 {
3417         struct tevent_req *req;
3418         struct dcerpc_spoolss_EnumPrintProcessors_r_state *state;
3419         struct tevent_req *subreq;
3420
3421         req = tevent_req_create(mem_ctx, &state,
3422                                 struct dcerpc_spoolss_EnumPrintProcessors_r_state);
3423         if (req == NULL) {
3424                 return NULL;
3425         }
3426
3427         state->out_mem_ctx = talloc_new(state);
3428         if (tevent_req_nomem(state->out_mem_ctx, req)) {
3429                 return tevent_req_post(req, ev);
3430         }
3431
3432         subreq = dcerpc_binding_handle_call_send(state, ev, h,
3433                         NULL, &ndr_table_spoolss,
3434                         NDR_SPOOLSS_ENUMPRINTPROCESSORS, state->out_mem_ctx, r);
3435         if (tevent_req_nomem(subreq, req)) {
3436                 return tevent_req_post(req, ev);
3437         }
3438         tevent_req_set_callback(subreq, dcerpc_spoolss_EnumPrintProcessors_r_done, req);
3439
3440         return req;
3441 }
3442
3443 static void dcerpc_spoolss_EnumPrintProcessors_r_done(struct tevent_req *subreq)
3444 {
3445         struct tevent_req *req =
3446                 tevent_req_callback_data(subreq,
3447                 struct tevent_req);
3448         NTSTATUS status;
3449
3450         status = dcerpc_binding_handle_call_recv(subreq);
3451         TALLOC_FREE(subreq);
3452         if (tevent_req_nterror(req, status)) {
3453                 return;
3454         }
3455
3456         tevent_req_done(req);
3457 }
3458
3459 NTSTATUS dcerpc_spoolss_EnumPrintProcessors_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
3460 {
3461         struct dcerpc_spoolss_EnumPrintProcessors_r_state *state =
3462                 tevent_req_data(req,
3463                 struct dcerpc_spoolss_EnumPrintProcessors_r_state);
3464         NTSTATUS status;
3465
3466         if (tevent_req_is_nterror(req, &status)) {
3467                 tevent_req_received(req);
3468                 return status;
3469         }
3470
3471         talloc_steal(mem_ctx, state->out_mem_ctx);
3472
3473         tevent_req_received(req);
3474         return NT_STATUS_OK;
3475 }
3476
3477 NTSTATUS dcerpc_spoolss_EnumPrintProcessors_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_EnumPrintProcessors *r)
3478 {
3479         NTSTATUS status;
3480
3481         status = dcerpc_binding_handle_call(h,
3482                         NULL, &ndr_table_spoolss,
3483                         NDR_SPOOLSS_ENUMPRINTPROCESSORS, mem_ctx, r);
3484
3485         return status;
3486 }
3487
3488 struct dcerpc_spoolss_EnumPrintProcessors_state {
3489         struct spoolss_EnumPrintProcessors orig;
3490         struct spoolss_EnumPrintProcessors tmp;
3491         TALLOC_CTX *out_mem_ctx;
3492 };
3493
3494 static void dcerpc_spoolss_EnumPrintProcessors_done(struct tevent_req *subreq);
3495
3496 struct tevent_req *dcerpc_spoolss_EnumPrintProcessors_send(TALLOC_CTX *mem_ctx,
3497                                                            struct tevent_context *ev,
3498                                                            struct dcerpc_binding_handle *h,
3499                                                            const char *_servername /* [in] [unique,charset(UTF16)] */,
3500                                                            const char *_environment /* [in] [unique,charset(UTF16)] */,
3501                                                            uint32_t _level /* [in]  */,
3502                                                            DATA_BLOB *_buffer /* [in] [unique] */,
3503                                                            uint32_t _offered /* [in]  */,
3504                                                            uint32_t *_count /* [out] [ref] */,
3505                                                            union spoolss_PrintProcessorInfo **_info /* [out] [ref,switch_is(level),size_is(,*count)] */,
3506                                                            uint32_t *_needed /* [out] [ref] */)
3507 {
3508         struct tevent_req *req;
3509         struct dcerpc_spoolss_EnumPrintProcessors_state *state;
3510         struct tevent_req *subreq;
3511
3512         req = tevent_req_create(mem_ctx, &state,
3513                                 struct dcerpc_spoolss_EnumPrintProcessors_state);
3514         if (req == NULL) {
3515                 return NULL;
3516         }
3517         state->out_mem_ctx = NULL;
3518
3519         /* In parameters */
3520         state->orig.in.servername = _servername;
3521         state->orig.in.environment = _environment;
3522         state->orig.in.level = _level;
3523         state->orig.in.buffer = _buffer;
3524         state->orig.in.offered = _offered;
3525
3526         /* Out parameters */
3527         state->orig.out.count = _count;
3528         state->orig.out.info = _info;
3529         state->orig.out.needed = _needed;
3530
3531         /* Result */
3532         ZERO_STRUCT(state->orig.out.result);
3533
3534         state->out_mem_ctx = talloc_named_const(state, 0,
3535                              "dcerpc_spoolss_EnumPrintProcessors_out_memory");
3536         if (tevent_req_nomem(state->out_mem_ctx, req)) {
3537                 return tevent_req_post(req, ev);
3538         }
3539
3540         /* make a temporary copy, that we pass to the dispatch function */
3541         state->tmp = state->orig;
3542
3543         subreq = dcerpc_spoolss_EnumPrintProcessors_r_send(state, ev, h, &state->tmp);
3544         if (tevent_req_nomem(subreq, req)) {
3545                 return tevent_req_post(req, ev);
3546         }
3547         tevent_req_set_callback(subreq, dcerpc_spoolss_EnumPrintProcessors_done, req);
3548         return req;
3549 }
3550
3551 static void dcerpc_spoolss_EnumPrintProcessors_done(struct tevent_req *subreq)
3552 {
3553         struct tevent_req *req = tevent_req_callback_data(
3554                 subreq, struct tevent_req);
3555         struct dcerpc_spoolss_EnumPrintProcessors_state *state = tevent_req_data(
3556                 req, struct dcerpc_spoolss_EnumPrintProcessors_state);
3557         NTSTATUS status;
3558         TALLOC_CTX *mem_ctx;
3559
3560         if (state->out_mem_ctx) {
3561                 mem_ctx = state->out_mem_ctx;
3562         } else {
3563                 mem_ctx = state;
3564         }
3565
3566         status = dcerpc_spoolss_EnumPrintProcessors_r_recv(subreq, mem_ctx);
3567         TALLOC_FREE(subreq);
3568         if (tevent_req_nterror(req, status)) {
3569                 return;
3570         }
3571
3572         /* Copy out parameters */
3573         *state->orig.out.count = *state->tmp.out.count;
3574         *state->orig.out.info = *state->tmp.out.info;
3575         *state->orig.out.needed = *state->tmp.out.needed;
3576
3577         /* Copy result */
3578         state->orig.out.result = state->tmp.out.result;
3579
3580         /* Reset temporary structure */
3581         ZERO_STRUCT(state->tmp);
3582
3583         tevent_req_done(req);
3584 }
3585
3586 NTSTATUS dcerpc_spoolss_EnumPrintProcessors_recv(struct tevent_req *req,
3587                                                  TALLOC_CTX *mem_ctx,
3588                                                  WERROR *result)
3589 {
3590         struct dcerpc_spoolss_EnumPrintProcessors_state *state = tevent_req_data(
3591                 req, struct dcerpc_spoolss_EnumPrintProcessors_state);
3592         NTSTATUS status;
3593
3594         if (tevent_req_is_nterror(req, &status)) {
3595                 tevent_req_received(req);
3596                 return status;
3597         }
3598
3599         /* Steal possible out parameters to the callers context */
3600         talloc_steal(mem_ctx, state->out_mem_ctx);
3601
3602         /* Return result */
3603         *result = state->orig.out.result;
3604
3605         tevent_req_received(req);
3606         return NT_STATUS_OK;
3607 }
3608
3609 NTSTATUS dcerpc_spoolss_EnumPrintProcessors(struct dcerpc_binding_handle *h,
3610                                             TALLOC_CTX *mem_ctx,
3611                                             const char *_servername /* [in] [unique,charset(UTF16)] */,
3612                                             const char *_environment /* [in] [unique,charset(UTF16)] */,
3613                                             uint32_t _level /* [in]  */,
3614                                             DATA_BLOB *_buffer /* [in] [unique] */,
3615                                             uint32_t _offered /* [in]  */,
3616                                             uint32_t *_count /* [out] [ref] */,
3617                                             union spoolss_PrintProcessorInfo **_info /* [out] [ref,switch_is(level),size_is(,*count)] */,
3618                                             uint32_t *_needed /* [out] [ref] */,
3619                                             WERROR *result)
3620 {
3621         struct spoolss_EnumPrintProcessors r;
3622         NTSTATUS status;
3623
3624         /* In parameters */
3625         r.in.servername = _servername;
3626         r.in.environment = _environment;
3627         r.in.level = _level;
3628         r.in.buffer = _buffer;
3629         r.in.offered = _offered;
3630
3631         status = dcerpc_spoolss_EnumPrintProcessors_r(h, mem_ctx, &r);
3632         if (!NT_STATUS_IS_OK(status)) {
3633                 return status;
3634         }
3635
3636         /* Return variables */
3637         *_count = *r.out.count;
3638         *_info = *r.out.info;
3639         *_needed = *r.out.needed;
3640
3641         /* Return result */
3642         *result = r.out.result;
3643
3644         return NT_STATUS_OK;
3645 }
3646
3647 struct dcerpc_spoolss_GetPrintProcessorDirectory_r_state {
3648         TALLOC_CTX *out_mem_ctx;
3649 };
3650
3651 static void dcerpc_spoolss_GetPrintProcessorDirectory_r_done(struct tevent_req *subreq);
3652
3653 struct tevent_req *dcerpc_spoolss_GetPrintProcessorDirectory_r_send(TALLOC_CTX *mem_ctx,
3654         struct tevent_context *ev,
3655         struct dcerpc_binding_handle *h,
3656         struct spoolss_GetPrintProcessorDirectory *r)
3657 {
3658         struct tevent_req *req;
3659         struct dcerpc_spoolss_GetPrintProcessorDirectory_r_state *state;
3660         struct tevent_req *subreq;
3661
3662         req = tevent_req_create(mem_ctx, &state,
3663                                 struct dcerpc_spoolss_GetPrintProcessorDirectory_r_state);
3664         if (req == NULL) {
3665                 return NULL;
3666         }
3667
3668         state->out_mem_ctx = talloc_new(state);
3669         if (tevent_req_nomem(state->out_mem_ctx, req)) {
3670                 return tevent_req_post(req, ev);
3671         }
3672
3673         subreq = dcerpc_binding_handle_call_send(state, ev, h,
3674                         NULL, &ndr_table_spoolss,
3675                         NDR_SPOOLSS_GETPRINTPROCESSORDIRECTORY, state->out_mem_ctx, r);
3676         if (tevent_req_nomem(subreq, req)) {
3677                 return tevent_req_post(req, ev);
3678         }
3679         tevent_req_set_callback(subreq, dcerpc_spoolss_GetPrintProcessorDirectory_r_done, req);
3680
3681         return req;
3682 }
3683
3684 static void dcerpc_spoolss_GetPrintProcessorDirectory_r_done(struct tevent_req *subreq)
3685 {
3686         struct tevent_req *req =
3687                 tevent_req_callback_data(subreq,
3688                 struct tevent_req);
3689         NTSTATUS status;
3690
3691         status = dcerpc_binding_handle_call_recv(subreq);
3692         TALLOC_FREE(subreq);
3693         if (tevent_req_nterror(req, status)) {
3694                 return;
3695         }
3696
3697         tevent_req_done(req);
3698 }
3699
3700 NTSTATUS dcerpc_spoolss_GetPrintProcessorDirectory_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
3701 {
3702         struct dcerpc_spoolss_GetPrintProcessorDirectory_r_state *state =
3703                 tevent_req_data(req,
3704                 struct dcerpc_spoolss_GetPrintProcessorDirectory_r_state);
3705         NTSTATUS status;
3706
3707         if (tevent_req_is_nterror(req, &status)) {
3708                 tevent_req_received(req);
3709                 return status;
3710         }
3711
3712         talloc_steal(mem_ctx, state->out_mem_ctx);
3713
3714         tevent_req_received(req);
3715         return NT_STATUS_OK;
3716 }
3717
3718 NTSTATUS dcerpc_spoolss_GetPrintProcessorDirectory_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_GetPrintProcessorDirectory *r)
3719 {
3720         NTSTATUS status;
3721
3722         status = dcerpc_binding_handle_call(h,
3723                         NULL, &ndr_table_spoolss,
3724                         NDR_SPOOLSS_GETPRINTPROCESSORDIRECTORY, mem_ctx, r);
3725
3726         return status;
3727 }
3728
3729 struct dcerpc_spoolss_GetPrintProcessorDirectory_state {
3730         struct spoolss_GetPrintProcessorDirectory orig;
3731         struct spoolss_GetPrintProcessorDirectory tmp;
3732         TALLOC_CTX *out_mem_ctx;
3733 };
3734
3735 static void dcerpc_spoolss_GetPrintProcessorDirectory_done(struct tevent_req *subreq);
3736
3737 struct tevent_req *dcerpc_spoolss_GetPrintProcessorDirectory_send(TALLOC_CTX *mem_ctx,
3738                                                                   struct tevent_context *ev,
3739                                                                   struct dcerpc_binding_handle *h,
3740                                                                   const char *_server /* [in] [unique,charset(UTF16)] */,
3741                                                                   const char *_environment /* [in] [unique,charset(UTF16)] */,
3742                                                                   uint32_t _level /* [in]  */,
3743                                                                   DATA_BLOB *_buffer /* [in] [unique] */,
3744                                                                   uint32_t _offered /* [in]  */,
3745                                                                   union spoolss_PrintProcessorDirectoryInfo *_info /* [out] [unique,subcontext_size(offered),subcontext(4),switch_is(level)] */,
3746                                                                   uint32_t *_needed /* [out] [ref] */)
3747 {
3748         struct tevent_req *req;
3749         struct dcerpc_spoolss_GetPrintProcessorDirectory_state *state;
3750         struct tevent_req *subreq;
3751
3752         req = tevent_req_create(mem_ctx, &state,
3753                                 struct dcerpc_spoolss_GetPrintProcessorDirectory_state);
3754         if (req == NULL) {
3755                 return NULL;
3756         }
3757         state->out_mem_ctx = NULL;
3758
3759         /* In parameters */
3760         state->orig.in.server = _server;
3761         state->orig.in.environment = _environment;
3762         state->orig.in.level = _level;
3763         state->orig.in.buffer = _buffer;
3764         state->orig.in.offered = _offered;
3765
3766         /* Out parameters */
3767         state->orig.out.info = _info;
3768         state->orig.out.needed = _needed;
3769
3770         /* Result */
3771         ZERO_STRUCT(state->orig.out.result);
3772
3773         state->out_mem_ctx = talloc_named_const(state, 0,
3774                              "dcerpc_spoolss_GetPrintProcessorDirectory_out_memory");
3775         if (tevent_req_nomem(state->out_mem_ctx, req)) {
3776                 return tevent_req_post(req, ev);
3777         }
3778
3779         /* make a temporary copy, that we pass to the dispatch function */
3780         state->tmp = state->orig;
3781
3782         subreq = dcerpc_spoolss_GetPrintProcessorDirectory_r_send(state, ev, h, &state->tmp);
3783         if (tevent_req_nomem(subreq, req)) {
3784                 return tevent_req_post(req, ev);
3785         }
3786         tevent_req_set_callback(subreq, dcerpc_spoolss_GetPrintProcessorDirectory_done, req);
3787         return req;
3788 }
3789
3790 static void dcerpc_spoolss_GetPrintProcessorDirectory_done(struct tevent_req *subreq)
3791 {
3792         struct tevent_req *req = tevent_req_callback_data(
3793                 subreq, struct tevent_req);
3794         struct dcerpc_spoolss_GetPrintProcessorDirectory_state *state = tevent_req_data(
3795                 req, struct dcerpc_spoolss_GetPrintProcessorDirectory_state);
3796         NTSTATUS status;
3797         TALLOC_CTX *mem_ctx;
3798
3799         if (state->out_mem_ctx) {
3800                 mem_ctx = state->out_mem_ctx;
3801         } else {
3802                 mem_ctx = state;
3803         }
3804
3805         status = dcerpc_spoolss_GetPrintProcessorDirectory_r_recv(subreq, mem_ctx);
3806         TALLOC_FREE(subreq);
3807         if (tevent_req_nterror(req, status)) {
3808                 return;
3809         }
3810
3811         /* Copy out parameters */
3812         if (state->orig.out.info && state->tmp.out.info) {
3813                 *state->orig.out.info = *state->tmp.out.info;
3814         }
3815         *state->orig.out.needed = *state->tmp.out.needed;
3816
3817         /* Copy result */
3818         state->orig.out.result = state->tmp.out.result;
3819
3820         /* Reset temporary structure */
3821         ZERO_STRUCT(state->tmp);
3822
3823         tevent_req_done(req);
3824 }
3825
3826 NTSTATUS dcerpc_spoolss_GetPrintProcessorDirectory_recv(struct tevent_req *req,
3827                                                         TALLOC_CTX *mem_ctx,
3828                                                         WERROR *result)
3829 {
3830         struct dcerpc_spoolss_GetPrintProcessorDirectory_state *state = tevent_req_data(
3831                 req, struct dcerpc_spoolss_GetPrintProcessorDirectory_state);
3832         NTSTATUS status;
3833
3834         if (tevent_req_is_nterror(req, &status)) {
3835                 tevent_req_received(req);
3836                 return status;
3837         }
3838
3839         /* Steal possible out parameters to the callers context */
3840         talloc_steal(mem_ctx, state->out_mem_ctx);
3841
3842         /* Return result */
3843         *result = state->orig.out.result;
3844
3845         tevent_req_received(req);
3846         return NT_STATUS_OK;
3847 }
3848
3849 NTSTATUS dcerpc_spoolss_GetPrintProcessorDirectory(struct dcerpc_binding_handle *h,
3850                                                    TALLOC_CTX *mem_ctx,
3851                                                    const char *_server /* [in] [unique,charset(UTF16)] */,
3852                                                    const char *_environment /* [in] [unique,charset(UTF16)] */,
3853                                                    uint32_t _level /* [in]  */,
3854                                                    DATA_BLOB *_buffer /* [in] [unique] */,
3855                                                    uint32_t _offered /* [in]  */,
3856                                                    union spoolss_PrintProcessorDirectoryInfo *_info /* [out] [unique,subcontext_size(offered),subcontext(4),switch_is(level)] */,
3857                                                    uint32_t *_needed /* [out] [ref] */,
3858                                                    WERROR *result)
3859 {
3860         struct spoolss_GetPrintProcessorDirectory r;
3861         NTSTATUS status;
3862
3863         /* In parameters */
3864         r.in.server = _server;
3865         r.in.environment = _environment;
3866         r.in.level = _level;
3867         r.in.buffer = _buffer;
3868         r.in.offered = _offered;
3869
3870         status = dcerpc_spoolss_GetPrintProcessorDirectory_r(h, mem_ctx, &r);
3871         if (!NT_STATUS_IS_OK(status)) {
3872                 return status;
3873         }
3874
3875         /* Return variables */
3876         if (_info && r.out.info) {
3877                 *_info = *r.out.info;
3878         }
3879         *_needed = *r.out.needed;
3880
3881         /* Return result */
3882         *result = r.out.result;
3883
3884         return NT_STATUS_OK;
3885 }
3886
3887 struct dcerpc_spoolss_StartDocPrinter_r_state {
3888         TALLOC_CTX *out_mem_ctx;
3889 };
3890
3891 static void dcerpc_spoolss_StartDocPrinter_r_done(struct tevent_req *subreq);
3892
3893 struct tevent_req *dcerpc_spoolss_StartDocPrinter_r_send(TALLOC_CTX *mem_ctx,
3894         struct tevent_context *ev,
3895         struct dcerpc_binding_handle *h,
3896         struct spoolss_StartDocPrinter *r)
3897 {
3898         struct tevent_req *req;
3899         struct dcerpc_spoolss_StartDocPrinter_r_state *state;
3900         struct tevent_req *subreq;
3901
3902         req = tevent_req_create(mem_ctx, &state,
3903                                 struct dcerpc_spoolss_StartDocPrinter_r_state);
3904         if (req == NULL) {
3905                 return NULL;
3906         }
3907
3908         state->out_mem_ctx = talloc_new(state);
3909         if (tevent_req_nomem(state->out_mem_ctx, req)) {
3910                 return tevent_req_post(req, ev);
3911         }
3912
3913         subreq = dcerpc_binding_handle_call_send(state, ev, h,
3914                         NULL, &ndr_table_spoolss,
3915                         NDR_SPOOLSS_STARTDOCPRINTER, state->out_mem_ctx, r);
3916         if (tevent_req_nomem(subreq, req)) {
3917                 return tevent_req_post(req, ev);
3918         }
3919         tevent_req_set_callback(subreq, dcerpc_spoolss_StartDocPrinter_r_done, req);
3920
3921         return req;
3922 }
3923
3924 static void dcerpc_spoolss_StartDocPrinter_r_done(struct tevent_req *subreq)
3925 {
3926         struct tevent_req *req =
3927                 tevent_req_callback_data(subreq,
3928                 struct tevent_req);
3929         NTSTATUS status;
3930
3931         status = dcerpc_binding_handle_call_recv(subreq);
3932         TALLOC_FREE(subreq);
3933         if (tevent_req_nterror(req, status)) {
3934                 return;
3935         }
3936
3937         tevent_req_done(req);
3938 }
3939
3940 NTSTATUS dcerpc_spoolss_StartDocPrinter_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
3941 {
3942         struct dcerpc_spoolss_StartDocPrinter_r_state *state =
3943                 tevent_req_data(req,
3944                 struct dcerpc_spoolss_StartDocPrinter_r_state);
3945         NTSTATUS status;
3946
3947         if (tevent_req_is_nterror(req, &status)) {
3948                 tevent_req_received(req);
3949                 return status;
3950         }
3951
3952         talloc_steal(mem_ctx, state->out_mem_ctx);
3953
3954         tevent_req_received(req);
3955         return NT_STATUS_OK;
3956 }
3957
3958 NTSTATUS dcerpc_spoolss_StartDocPrinter_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_StartDocPrinter *r)
3959 {
3960         NTSTATUS status;
3961
3962         status = dcerpc_binding_handle_call(h,
3963                         NULL, &ndr_table_spoolss,
3964                         NDR_SPOOLSS_STARTDOCPRINTER, mem_ctx, r);
3965
3966         return status;
3967 }
3968
3969 struct dcerpc_spoolss_StartDocPrinter_state {
3970         struct spoolss_StartDocPrinter orig;
3971         struct spoolss_StartDocPrinter tmp;
3972         TALLOC_CTX *out_mem_ctx;
3973 };
3974
3975 static void dcerpc_spoolss_StartDocPrinter_done(struct tevent_req *subreq);
3976
3977 struct tevent_req *dcerpc_spoolss_StartDocPrinter_send(TALLOC_CTX *mem_ctx,
3978                                                        struct tevent_context *ev,
3979                                                        struct dcerpc_binding_handle *h,
3980                                                        struct policy_handle *_handle /* [in] [ref] */,
3981                                                        struct spoolss_DocumentInfoCtr *_info_ctr /* [in] [ref] */,
3982                                                        uint32_t *_job_id /* [out] [ref] */)
3983 {
3984         struct tevent_req *req;
3985         struct dcerpc_spoolss_StartDocPrinter_state *state;
3986         struct tevent_req *subreq;
3987
3988         req = tevent_req_create(mem_ctx, &state,
3989                                 struct dcerpc_spoolss_StartDocPrinter_state);
3990         if (req == NULL) {
3991                 return NULL;
3992         }
3993         state->out_mem_ctx = NULL;
3994
3995         /* In parameters */
3996         state->orig.in.handle = _handle;
3997         state->orig.in.info_ctr = _info_ctr;
3998
3999         /* Out parameters */
4000         state->orig.out.job_id = _job_id;
4001
4002         /* Result */
4003         ZERO_STRUCT(state->orig.out.result);
4004
4005         state->out_mem_ctx = talloc_named_const(state, 0,
4006                              "dcerpc_spoolss_StartDocPrinter_out_memory");
4007         if (tevent_req_nomem(state->out_mem_ctx, req)) {
4008                 return tevent_req_post(req, ev);
4009         }
4010
4011         /* make a temporary copy, that we pass to the dispatch function */
4012         state->tmp = state->orig;
4013
4014         subreq = dcerpc_spoolss_StartDocPrinter_r_send(state, ev, h, &state->tmp);
4015         if (tevent_req_nomem(subreq, req)) {
4016                 return tevent_req_post(req, ev);
4017         }
4018         tevent_req_set_callback(subreq, dcerpc_spoolss_StartDocPrinter_done, req);
4019         return req;
4020 }
4021
4022 static void dcerpc_spoolss_StartDocPrinter_done(struct tevent_req *subreq)
4023 {
4024         struct tevent_req *req = tevent_req_callback_data(
4025                 subreq, struct tevent_req);
4026         struct dcerpc_spoolss_StartDocPrinter_state *state = tevent_req_data(
4027                 req, struct dcerpc_spoolss_StartDocPrinter_state);
4028         NTSTATUS status;
4029         TALLOC_CTX *mem_ctx;
4030
4031         if (state->out_mem_ctx) {
4032                 mem_ctx = state->out_mem_ctx;
4033         } else {
4034                 mem_ctx = state;
4035         }
4036
4037         status = dcerpc_spoolss_StartDocPrinter_r_recv(subreq, mem_ctx);
4038         TALLOC_FREE(subreq);
4039         if (tevent_req_nterror(req, status)) {
4040                 return;
4041         }
4042
4043         /* Copy out parameters */
4044         *state->orig.out.job_id = *state->tmp.out.job_id;
4045
4046         /* Copy result */
4047         state->orig.out.result = state->tmp.out.result;
4048
4049         /* Reset temporary structure */
4050         ZERO_STRUCT(state->tmp);
4051
4052         tevent_req_done(req);
4053 }
4054
4055 NTSTATUS dcerpc_spoolss_StartDocPrinter_recv(struct tevent_req *req,
4056                                              TALLOC_CTX *mem_ctx,
4057                                              WERROR *result)
4058 {
4059         struct dcerpc_spoolss_StartDocPrinter_state *state = tevent_req_data(
4060                 req, struct dcerpc_spoolss_StartDocPrinter_state);
4061         NTSTATUS status;
4062
4063         if (tevent_req_is_nterror(req, &status)) {
4064                 tevent_req_received(req);
4065                 return status;
4066         }
4067
4068         /* Steal possible out parameters to the callers context */
4069         talloc_steal(mem_ctx, state->out_mem_ctx);
4070
4071         /* Return result */
4072         *result = state->orig.out.result;
4073
4074         tevent_req_received(req);
4075         return NT_STATUS_OK;
4076 }
4077
4078 NTSTATUS dcerpc_spoolss_StartDocPrinter(struct dcerpc_binding_handle *h,
4079                                         TALLOC_CTX *mem_ctx,
4080                                         struct policy_handle *_handle /* [in] [ref] */,
4081                                         struct spoolss_DocumentInfoCtr *_info_ctr /* [in] [ref] */,
4082                                         uint32_t *_job_id /* [out] [ref] */,
4083                                         WERROR *result)
4084 {
4085         struct spoolss_StartDocPrinter r;
4086         NTSTATUS status;
4087
4088         /* In parameters */
4089         r.in.handle = _handle;
4090         r.in.info_ctr = _info_ctr;
4091
4092         status = dcerpc_spoolss_StartDocPrinter_r(h, mem_ctx, &r);
4093         if (!NT_STATUS_IS_OK(status)) {
4094                 return status;
4095         }
4096
4097         /* Return variables */
4098         *_job_id = *r.out.job_id;
4099
4100         /* Return result */
4101         *result = r.out.result;
4102
4103         return NT_STATUS_OK;
4104 }
4105
4106 struct dcerpc_spoolss_StartPagePrinter_r_state {
4107         TALLOC_CTX *out_mem_ctx;
4108 };
4109
4110 static void dcerpc_spoolss_StartPagePrinter_r_done(struct tevent_req *subreq);
4111
4112 struct tevent_req *dcerpc_spoolss_StartPagePrinter_r_send(TALLOC_CTX *mem_ctx,
4113         struct tevent_context *ev,
4114         struct dcerpc_binding_handle *h,
4115         struct spoolss_StartPagePrinter *r)
4116 {
4117         struct tevent_req *req;
4118         struct dcerpc_spoolss_StartPagePrinter_r_state *state;
4119         struct tevent_req *subreq;
4120
4121         req = tevent_req_create(mem_ctx, &state,
4122                                 struct dcerpc_spoolss_StartPagePrinter_r_state);
4123         if (req == NULL) {
4124                 return NULL;
4125         }
4126
4127         state->out_mem_ctx = NULL;
4128
4129         subreq = dcerpc_binding_handle_call_send(state, ev, h,
4130                         NULL, &ndr_table_spoolss,
4131                         NDR_SPOOLSS_STARTPAGEPRINTER, state, r);
4132         if (tevent_req_nomem(subreq, req)) {
4133                 return tevent_req_post(req, ev);
4134         }
4135         tevent_req_set_callback(subreq, dcerpc_spoolss_StartPagePrinter_r_done, req);
4136
4137         return req;
4138 }
4139
4140 static void dcerpc_spoolss_StartPagePrinter_r_done(struct tevent_req *subreq)
4141 {
4142         struct tevent_req *req =
4143                 tevent_req_callback_data(subreq,
4144                 struct tevent_req);
4145         NTSTATUS status;
4146
4147         status = dcerpc_binding_handle_call_recv(subreq);
4148         TALLOC_FREE(subreq);
4149         if (tevent_req_nterror(req, status)) {
4150                 return;
4151         }
4152
4153         tevent_req_done(req);
4154 }
4155
4156 NTSTATUS dcerpc_spoolss_StartPagePrinter_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
4157 {
4158         struct dcerpc_spoolss_StartPagePrinter_r_state *state =
4159                 tevent_req_data(req,
4160                 struct dcerpc_spoolss_StartPagePrinter_r_state);
4161         NTSTATUS status;
4162
4163         if (tevent_req_is_nterror(req, &status)) {
4164                 tevent_req_received(req);
4165                 return status;
4166         }
4167
4168         talloc_steal(mem_ctx, state->out_mem_ctx);
4169
4170         tevent_req_received(req);
4171         return NT_STATUS_OK;
4172 }
4173
4174 NTSTATUS dcerpc_spoolss_StartPagePrinter_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_StartPagePrinter *r)
4175 {
4176         NTSTATUS status;
4177
4178         status = dcerpc_binding_handle_call(h,
4179                         NULL, &ndr_table_spoolss,
4180                         NDR_SPOOLSS_STARTPAGEPRINTER, mem_ctx, r);
4181
4182         return status;
4183 }
4184
4185 struct dcerpc_spoolss_StartPagePrinter_state {
4186         struct spoolss_StartPagePrinter orig;
4187         struct spoolss_StartPagePrinter tmp;
4188         TALLOC_CTX *out_mem_ctx;
4189 };
4190
4191 static void dcerpc_spoolss_StartPagePrinter_done(struct tevent_req *subreq);
4192
4193 struct tevent_req *dcerpc_spoolss_StartPagePrinter_send(TALLOC_CTX *mem_ctx,
4194                                                         struct tevent_context *ev,
4195                                                         struct dcerpc_binding_handle *h,
4196                                                         struct policy_handle *_handle /* [in] [ref] */)
4197 {
4198         struct tevent_req *req;
4199         struct dcerpc_spoolss_StartPagePrinter_state *state;
4200         struct tevent_req *subreq;
4201
4202         req = tevent_req_create(mem_ctx, &state,
4203                                 struct dcerpc_spoolss_StartPagePrinter_state);
4204         if (req == NULL) {
4205                 return NULL;
4206         }
4207         state->out_mem_ctx = NULL;
4208
4209         /* In parameters */
4210         state->orig.in.handle = _handle;
4211
4212         /* Out parameters */
4213
4214         /* Result */
4215         ZERO_STRUCT(state->orig.out.result);
4216
4217         /* make a temporary copy, that we pass to the dispatch function */
4218         state->tmp = state->orig;
4219
4220         subreq = dcerpc_spoolss_StartPagePrinter_r_send(state, ev, h, &state->tmp);
4221         if (tevent_req_nomem(subreq, req)) {
4222                 return tevent_req_post(req, ev);
4223         }
4224         tevent_req_set_callback(subreq, dcerpc_spoolss_StartPagePrinter_done, req);
4225         return req;
4226 }
4227
4228 static void dcerpc_spoolss_StartPagePrinter_done(struct tevent_req *subreq)
4229 {
4230         struct tevent_req *req = tevent_req_callback_data(
4231                 subreq, struct tevent_req);
4232         struct dcerpc_spoolss_StartPagePrinter_state *state = tevent_req_data(
4233                 req, struct dcerpc_spoolss_StartPagePrinter_state);
4234         NTSTATUS status;
4235         TALLOC_CTX *mem_ctx;
4236
4237         if (state->out_mem_ctx) {
4238                 mem_ctx = state->out_mem_ctx;
4239         } else {
4240                 mem_ctx = state;
4241         }
4242
4243         status = dcerpc_spoolss_StartPagePrinter_r_recv(subreq, mem_ctx);
4244         TALLOC_FREE(subreq);
4245         if (tevent_req_nterror(req, status)) {
4246                 return;
4247         }
4248
4249         /* Copy out parameters */
4250
4251         /* Copy result */
4252         state->orig.out.result = state->tmp.out.result;
4253
4254         /* Reset temporary structure */
4255         ZERO_STRUCT(state->tmp);
4256
4257         tevent_req_done(req);
4258 }
4259
4260 NTSTATUS dcerpc_spoolss_StartPagePrinter_recv(struct tevent_req *req,
4261                                               TALLOC_CTX *mem_ctx,
4262                                               WERROR *result)
4263 {
4264         struct dcerpc_spoolss_StartPagePrinter_state *state = tevent_req_data(
4265                 req, struct dcerpc_spoolss_StartPagePrinter_state);
4266         NTSTATUS status;
4267
4268         if (tevent_req_is_nterror(req, &status)) {
4269                 tevent_req_received(req);
4270                 return status;
4271         }
4272
4273         /* Steal possible out parameters to the callers context */
4274         talloc_steal(mem_ctx, state->out_mem_ctx);
4275
4276         /* Return result */
4277         *result = state->orig.out.result;
4278
4279         tevent_req_received(req);
4280         return NT_STATUS_OK;
4281 }
4282
4283 NTSTATUS dcerpc_spoolss_StartPagePrinter(struct dcerpc_binding_handle *h,
4284                                          TALLOC_CTX *mem_ctx,
4285                                          struct policy_handle *_handle /* [in] [ref] */,
4286                                          WERROR *result)
4287 {
4288         struct spoolss_StartPagePrinter r;
4289         NTSTATUS status;
4290
4291         /* In parameters */
4292         r.in.handle = _handle;
4293
4294         status = dcerpc_spoolss_StartPagePrinter_r(h, mem_ctx, &r);
4295         if (!NT_STATUS_IS_OK(status)) {
4296                 return status;
4297         }
4298
4299         /* Return variables */
4300
4301         /* Return result */
4302         *result = r.out.result;
4303
4304         return NT_STATUS_OK;
4305 }
4306
4307 struct dcerpc_spoolss_WritePrinter_r_state {
4308         TALLOC_CTX *out_mem_ctx;
4309 };
4310
4311 static void dcerpc_spoolss_WritePrinter_r_done(struct tevent_req *subreq);
4312
4313 struct tevent_req *dcerpc_spoolss_WritePrinter_r_send(TALLOC_CTX *mem_ctx,
4314         struct tevent_context *ev,
4315         struct dcerpc_binding_handle *h,
4316         struct spoolss_WritePrinter *r)
4317 {
4318         struct tevent_req *req;
4319         struct dcerpc_spoolss_WritePrinter_r_state *state;
4320         struct tevent_req *subreq;
4321
4322         req = tevent_req_create(mem_ctx, &state,
4323                                 struct dcerpc_spoolss_WritePrinter_r_state);
4324         if (req == NULL) {
4325                 return NULL;
4326         }
4327
4328         state->out_mem_ctx = talloc_new(state);
4329         if (tevent_req_nomem(state->out_mem_ctx, req)) {
4330                 return tevent_req_post(req, ev);
4331         }
4332
4333         subreq = dcerpc_binding_handle_call_send(state, ev, h,
4334                         NULL, &ndr_table_spoolss,
4335                         NDR_SPOOLSS_WRITEPRINTER, state->out_mem_ctx, r);
4336         if (tevent_req_nomem(subreq, req)) {
4337                 return tevent_req_post(req, ev);
4338         }
4339         tevent_req_set_callback(subreq, dcerpc_spoolss_WritePrinter_r_done, req);
4340
4341         return req;
4342 }
4343
4344 static void dcerpc_spoolss_WritePrinter_r_done(struct tevent_req *subreq)
4345 {
4346         struct tevent_req *req =
4347                 tevent_req_callback_data(subreq,
4348                 struct tevent_req);
4349         NTSTATUS status;
4350
4351         status = dcerpc_binding_handle_call_recv(subreq);
4352         TALLOC_FREE(subreq);
4353         if (tevent_req_nterror(req, status)) {
4354                 return;
4355         }
4356
4357         tevent_req_done(req);
4358 }
4359
4360 NTSTATUS dcerpc_spoolss_WritePrinter_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
4361 {
4362         struct dcerpc_spoolss_WritePrinter_r_state *state =
4363                 tevent_req_data(req,
4364                 struct dcerpc_spoolss_WritePrinter_r_state);
4365         NTSTATUS status;
4366
4367         if (tevent_req_is_nterror(req, &status)) {
4368                 tevent_req_received(req);
4369                 return status;
4370         }
4371
4372         talloc_steal(mem_ctx, state->out_mem_ctx);
4373
4374         tevent_req_received(req);
4375         return NT_STATUS_OK;
4376 }
4377
4378 NTSTATUS dcerpc_spoolss_WritePrinter_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_WritePrinter *r)
4379 {
4380         NTSTATUS status;
4381
4382         status = dcerpc_binding_handle_call(h,
4383                         NULL, &ndr_table_spoolss,
4384                         NDR_SPOOLSS_WRITEPRINTER, mem_ctx, r);
4385
4386         return status;
4387 }
4388
4389 struct dcerpc_spoolss_WritePrinter_state {
4390         struct spoolss_WritePrinter orig;
4391         struct spoolss_WritePrinter tmp;
4392         TALLOC_CTX *out_mem_ctx;
4393 };
4394
4395 static void dcerpc_spoolss_WritePrinter_done(struct tevent_req *subreq);
4396
4397 struct tevent_req *dcerpc_spoolss_WritePrinter_send(TALLOC_CTX *mem_ctx,
4398                                                     struct tevent_context *ev,
4399                                                     struct dcerpc_binding_handle *h,
4400                                                     struct policy_handle *_handle /* [in] [ref] */,
4401                                                     DATA_BLOB _data /* [in]  */,
4402                                                     uint32_t __data_size /* [in] [value(r->in.data.length)] */,
4403                                                     uint32_t *_num_written /* [out] [ref] */)
4404 {
4405         struct tevent_req *req;
4406         struct dcerpc_spoolss_WritePrinter_state *state;
4407         struct tevent_req *subreq;
4408
4409         req = tevent_req_create(mem_ctx, &state,
4410                                 struct dcerpc_spoolss_WritePrinter_state);
4411         if (req == NULL) {
4412                 return NULL;
4413         }
4414         state->out_mem_ctx = NULL;
4415
4416         /* In parameters */
4417         state->orig.in.handle = _handle;
4418         state->orig.in.data = _data;
4419         state->orig.in._data_size = __data_size;
4420
4421         /* Out parameters */
4422         state->orig.out.num_written = _num_written;
4423
4424         /* Result */
4425         ZERO_STRUCT(state->orig.out.result);
4426
4427         state->out_mem_ctx = talloc_named_const(state, 0,
4428                              "dcerpc_spoolss_WritePrinter_out_memory");
4429         if (tevent_req_nomem(state->out_mem_ctx, req)) {
4430                 return tevent_req_post(req, ev);
4431         }
4432
4433         /* make a temporary copy, that we pass to the dispatch function */
4434         state->tmp = state->orig;
4435
4436         subreq = dcerpc_spoolss_WritePrinter_r_send(state, ev, h, &state->tmp);
4437         if (tevent_req_nomem(subreq, req)) {
4438                 return tevent_req_post(req, ev);
4439         }
4440         tevent_req_set_callback(subreq, dcerpc_spoolss_WritePrinter_done, req);
4441         return req;
4442 }
4443
4444 static void dcerpc_spoolss_WritePrinter_done(struct tevent_req *subreq)
4445 {
4446         struct tevent_req *req = tevent_req_callback_data(
4447                 subreq, struct tevent_req);
4448         struct dcerpc_spoolss_WritePrinter_state *state = tevent_req_data(
4449                 req, struct dcerpc_spoolss_WritePrinter_state);
4450         NTSTATUS status;
4451         TALLOC_CTX *mem_ctx;
4452
4453         if (state->out_mem_ctx) {
4454                 mem_ctx = state->out_mem_ctx;
4455         } else {
4456                 mem_ctx = state;
4457         }
4458
4459         status = dcerpc_spoolss_WritePrinter_r_recv(subreq, mem_ctx);
4460         TALLOC_FREE(subreq);
4461         if (tevent_req_nterror(req, status)) {
4462                 return;
4463         }
4464
4465         /* Copy out parameters */
4466         *state->orig.out.num_written = *state->tmp.out.num_written;
4467
4468         /* Copy result */
4469         state->orig.out.result = state->tmp.out.result;
4470
4471         /* Reset temporary structure */
4472         ZERO_STRUCT(state->tmp);
4473
4474         tevent_req_done(req);
4475 }
4476
4477 NTSTATUS dcerpc_spoolss_WritePrinter_recv(struct tevent_req *req,
4478                                           TALLOC_CTX *mem_ctx,
4479                                           WERROR *result)
4480 {
4481         struct dcerpc_spoolss_WritePrinter_state *state = tevent_req_data(
4482                 req, struct dcerpc_spoolss_WritePrinter_state);
4483         NTSTATUS status;
4484
4485         if (tevent_req_is_nterror(req, &status)) {
4486                 tevent_req_received(req);
4487                 return status;
4488         }
4489
4490         /* Steal possible out parameters to the callers context */
4491         talloc_steal(mem_ctx, state->out_mem_ctx);
4492
4493         /* Return result */
4494         *result = state->orig.out.result;
4495
4496         tevent_req_received(req);
4497         return NT_STATUS_OK;
4498 }
4499
4500 NTSTATUS dcerpc_spoolss_WritePrinter(struct dcerpc_binding_handle *h,
4501                                      TALLOC_CTX *mem_ctx,
4502                                      struct policy_handle *_handle /* [in] [ref] */,
4503                                      DATA_BLOB _data /* [in]  */,
4504                                      uint32_t __data_size /* [in] [value(r->in.data.length)] */,
4505                                      uint32_t *_num_written /* [out] [ref] */,
4506                                      WERROR *result)
4507 {
4508         struct spoolss_WritePrinter r;
4509         NTSTATUS status;
4510
4511         /* In parameters */
4512         r.in.handle = _handle;
4513         r.in.data = _data;
4514         r.in._data_size = __data_size;
4515
4516         status = dcerpc_spoolss_WritePrinter_r(h, mem_ctx, &r);
4517         if (!NT_STATUS_IS_OK(status)) {
4518                 return status;
4519         }
4520
4521         /* Return variables */
4522         *_num_written = *r.out.num_written;
4523
4524         /* Return result */
4525         *result = r.out.result;
4526
4527         return NT_STATUS_OK;
4528 }
4529
4530 struct dcerpc_spoolss_EndPagePrinter_r_state {
4531         TALLOC_CTX *out_mem_ctx;
4532 };
4533
4534 static void dcerpc_spoolss_EndPagePrinter_r_done(struct tevent_req *subreq);
4535
4536 struct tevent_req *dcerpc_spoolss_EndPagePrinter_r_send(TALLOC_CTX *mem_ctx,
4537         struct tevent_context *ev,
4538         struct dcerpc_binding_handle *h,
4539         struct spoolss_EndPagePrinter *r)
4540 {
4541         struct tevent_req *req;
4542         struct dcerpc_spoolss_EndPagePrinter_r_state *state;
4543         struct tevent_req *subreq;
4544
4545         req = tevent_req_create(mem_ctx, &state,
4546                                 struct dcerpc_spoolss_EndPagePrinter_r_state);
4547         if (req == NULL) {
4548                 return NULL;
4549         }
4550
4551         state->out_mem_ctx = NULL;
4552
4553         subreq = dcerpc_binding_handle_call_send(state, ev, h,
4554                         NULL, &ndr_table_spoolss,
4555                         NDR_SPOOLSS_ENDPAGEPRINTER, state, r);
4556         if (tevent_req_nomem(subreq, req)) {
4557                 return tevent_req_post(req, ev);
4558         }
4559         tevent_req_set_callback(subreq, dcerpc_spoolss_EndPagePrinter_r_done, req);
4560
4561         return req;
4562 }
4563
4564 static void dcerpc_spoolss_EndPagePrinter_r_done(struct tevent_req *subreq)
4565 {
4566         struct tevent_req *req =
4567                 tevent_req_callback_data(subreq,
4568                 struct tevent_req);
4569         NTSTATUS status;
4570
4571         status = dcerpc_binding_handle_call_recv(subreq);
4572         TALLOC_FREE(subreq);
4573         if (tevent_req_nterror(req, status)) {
4574                 return;
4575         }
4576
4577         tevent_req_done(req);
4578 }
4579
4580 NTSTATUS dcerpc_spoolss_EndPagePrinter_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
4581 {
4582         struct dcerpc_spoolss_EndPagePrinter_r_state *state =
4583                 tevent_req_data(req,
4584                 struct dcerpc_spoolss_EndPagePrinter_r_state);
4585         NTSTATUS status;
4586
4587         if (tevent_req_is_nterror(req, &status)) {
4588                 tevent_req_received(req);
4589                 return status;
4590         }
4591
4592         talloc_steal(mem_ctx, state->out_mem_ctx);
4593
4594         tevent_req_received(req);
4595         return NT_STATUS_OK;
4596 }
4597
4598 NTSTATUS dcerpc_spoolss_EndPagePrinter_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_EndPagePrinter *r)
4599 {
4600         NTSTATUS status;
4601
4602         status = dcerpc_binding_handle_call(h,
4603                         NULL, &ndr_table_spoolss,
4604                         NDR_SPOOLSS_ENDPAGEPRINTER, mem_ctx, r);
4605
4606         return status;
4607 }
4608
4609 struct dcerpc_spoolss_EndPagePrinter_state {
4610         struct spoolss_EndPagePrinter orig;
4611         struct spoolss_EndPagePrinter tmp;
4612         TALLOC_CTX *out_mem_ctx;
4613 };
4614
4615 static void dcerpc_spoolss_EndPagePrinter_done(struct tevent_req *subreq);
4616
4617 struct tevent_req *dcerpc_spoolss_EndPagePrinter_send(TALLOC_CTX *mem_ctx,
4618                                                       struct tevent_context *ev,
4619                                                       struct dcerpc_binding_handle *h,
4620                                                       struct policy_handle *_handle /* [in] [ref] */)
4621 {
4622         struct tevent_req *req;
4623         struct dcerpc_spoolss_EndPagePrinter_state *state;
4624         struct tevent_req *subreq;
4625
4626         req = tevent_req_create(mem_ctx, &state,
4627                                 struct dcerpc_spoolss_EndPagePrinter_state);
4628         if (req == NULL) {
4629                 return NULL;
4630         }
4631         state->out_mem_ctx = NULL;
4632
4633         /* In parameters */
4634         state->orig.in.handle = _handle;
4635
4636         /* Out parameters */
4637
4638         /* Result */
4639         ZERO_STRUCT(state->orig.out.result);
4640
4641         /* make a temporary copy, that we pass to the dispatch function */
4642         state->tmp = state->orig;
4643
4644         subreq = dcerpc_spoolss_EndPagePrinter_r_send(state, ev, h, &state->tmp);
4645         if (tevent_req_nomem(subreq, req)) {
4646                 return tevent_req_post(req, ev);
4647         }
4648         tevent_req_set_callback(subreq, dcerpc_spoolss_EndPagePrinter_done, req);
4649         return req;
4650 }
4651
4652 static void dcerpc_spoolss_EndPagePrinter_done(struct tevent_req *subreq)
4653 {
4654         struct tevent_req *req = tevent_req_callback_data(
4655                 subreq, struct tevent_req);
4656         struct dcerpc_spoolss_EndPagePrinter_state *state = tevent_req_data(
4657                 req, struct dcerpc_spoolss_EndPagePrinter_state);
4658         NTSTATUS status;
4659         TALLOC_CTX *mem_ctx;
4660
4661         if (state->out_mem_ctx) {
4662                 mem_ctx = state->out_mem_ctx;
4663         } else {
4664                 mem_ctx = state;
4665         }
4666
4667         status = dcerpc_spoolss_EndPagePrinter_r_recv(subreq, mem_ctx);
4668         TALLOC_FREE(subreq);
4669         if (tevent_req_nterror(req, status)) {
4670                 return;
4671         }
4672
4673         /* Copy out parameters */
4674
4675         /* Copy result */
4676         state->orig.out.result = state->tmp.out.result;
4677
4678         /* Reset temporary structure */
4679         ZERO_STRUCT(state->tmp);
4680
4681         tevent_req_done(req);
4682 }
4683
4684 NTSTATUS dcerpc_spoolss_EndPagePrinter_recv(struct tevent_req *req,
4685                                             TALLOC_CTX *mem_ctx,
4686                                             WERROR *result)
4687 {
4688         struct dcerpc_spoolss_EndPagePrinter_state *state = tevent_req_data(
4689                 req, struct dcerpc_spoolss_EndPagePrinter_state);
4690         NTSTATUS status;
4691
4692         if (tevent_req_is_nterror(req, &status)) {
4693                 tevent_req_received(req);
4694                 return status;
4695         }
4696
4697         /* Steal possible out parameters to the callers context */
4698         talloc_steal(mem_ctx, state->out_mem_ctx);
4699
4700         /* Return result */
4701         *result = state->orig.out.result;
4702
4703         tevent_req_received(req);
4704         return NT_STATUS_OK;
4705 }
4706
4707 NTSTATUS dcerpc_spoolss_EndPagePrinter(struct dcerpc_binding_handle *h,
4708                                        TALLOC_CTX *mem_ctx,
4709                                        struct policy_handle *_handle /* [in] [ref] */,
4710                                        WERROR *result)
4711 {
4712         struct spoolss_EndPagePrinter r;
4713         NTSTATUS status;
4714
4715         /* In parameters */
4716         r.in.handle = _handle;
4717
4718         status = dcerpc_spoolss_EndPagePrinter_r(h, mem_ctx, &r);
4719         if (!NT_STATUS_IS_OK(status)) {
4720                 return status;
4721         }
4722
4723         /* Return variables */
4724
4725         /* Return result */
4726         *result = r.out.result;
4727
4728         return NT_STATUS_OK;
4729 }
4730
4731 struct dcerpc_spoolss_AbortPrinter_r_state {
4732         TALLOC_CTX *out_mem_ctx;
4733 };
4734
4735 static void dcerpc_spoolss_AbortPrinter_r_done(struct tevent_req *subreq);
4736
4737 struct tevent_req *dcerpc_spoolss_AbortPrinter_r_send(TALLOC_CTX *mem_ctx,
4738         struct tevent_context *ev,
4739         struct dcerpc_binding_handle *h,
4740         struct spoolss_AbortPrinter *r)
4741 {
4742         struct tevent_req *req;
4743         struct dcerpc_spoolss_AbortPrinter_r_state *state;
4744         struct tevent_req *subreq;
4745
4746         req = tevent_req_create(mem_ctx, &state,
4747                                 struct dcerpc_spoolss_AbortPrinter_r_state);
4748         if (req == NULL) {
4749                 return NULL;
4750         }
4751
4752         state->out_mem_ctx = NULL;
4753
4754         subreq = dcerpc_binding_handle_call_send(state, ev, h,
4755                         NULL, &ndr_table_spoolss,
4756                         NDR_SPOOLSS_ABORTPRINTER, state, r);
4757         if (tevent_req_nomem(subreq, req)) {
4758                 return tevent_req_post(req, ev);
4759         }
4760         tevent_req_set_callback(subreq, dcerpc_spoolss_AbortPrinter_r_done, req);
4761
4762         return req;
4763 }
4764
4765 static void dcerpc_spoolss_AbortPrinter_r_done(struct tevent_req *subreq)
4766 {
4767         struct tevent_req *req =
4768                 tevent_req_callback_data(subreq,
4769                 struct tevent_req);
4770         NTSTATUS status;
4771
4772         status = dcerpc_binding_handle_call_recv(subreq);
4773         TALLOC_FREE(subreq);
4774         if (tevent_req_nterror(req, status)) {
4775                 return;
4776         }
4777
4778         tevent_req_done(req);
4779 }
4780
4781 NTSTATUS dcerpc_spoolss_AbortPrinter_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
4782 {
4783         struct dcerpc_spoolss_AbortPrinter_r_state *state =
4784                 tevent_req_data(req,
4785                 struct dcerpc_spoolss_AbortPrinter_r_state);
4786         NTSTATUS status;
4787
4788         if (tevent_req_is_nterror(req, &status)) {
4789                 tevent_req_received(req);
4790                 return status;
4791         }
4792
4793         talloc_steal(mem_ctx, state->out_mem_ctx);
4794
4795         tevent_req_received(req);
4796         return NT_STATUS_OK;
4797 }
4798
4799 NTSTATUS dcerpc_spoolss_AbortPrinter_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_AbortPrinter *r)
4800 {
4801         NTSTATUS status;
4802
4803         status = dcerpc_binding_handle_call(h,
4804                         NULL, &ndr_table_spoolss,
4805                         NDR_SPOOLSS_ABORTPRINTER, mem_ctx, r);
4806
4807         return status;
4808 }
4809
4810 struct dcerpc_spoolss_AbortPrinter_state {
4811         struct spoolss_AbortPrinter orig;
4812         struct spoolss_AbortPrinter tmp;
4813         TALLOC_CTX *out_mem_ctx;
4814 };
4815
4816 static void dcerpc_spoolss_AbortPrinter_done(struct tevent_req *subreq);
4817
4818 struct tevent_req *dcerpc_spoolss_AbortPrinter_send(TALLOC_CTX *mem_ctx,
4819                                                     struct tevent_context *ev,
4820                                                     struct dcerpc_binding_handle *h,
4821                                                     struct policy_handle *_handle /* [in] [ref] */)
4822 {
4823         struct tevent_req *req;
4824         struct dcerpc_spoolss_AbortPrinter_state *state;
4825         struct tevent_req *subreq;
4826
4827         req = tevent_req_create(mem_ctx, &state,
4828                                 struct dcerpc_spoolss_AbortPrinter_state);
4829         if (req == NULL) {
4830                 return NULL;
4831         }
4832         state->out_mem_ctx = NULL;
4833
4834         /* In parameters */
4835         state->orig.in.handle = _handle;
4836
4837         /* Out parameters */
4838
4839         /* Result */
4840         ZERO_STRUCT(state->orig.out.result);
4841
4842         /* make a temporary copy, that we pass to the dispatch function */
4843         state->tmp = state->orig;
4844
4845         subreq = dcerpc_spoolss_AbortPrinter_r_send(state, ev, h, &state->tmp);
4846         if (tevent_req_nomem(subreq, req)) {
4847                 return tevent_req_post(req, ev);
4848         }
4849         tevent_req_set_callback(subreq, dcerpc_spoolss_AbortPrinter_done, req);
4850         return req;
4851 }
4852
4853 static void dcerpc_spoolss_AbortPrinter_done(struct tevent_req *subreq)
4854 {
4855         struct tevent_req *req = tevent_req_callback_data(
4856                 subreq, struct tevent_req);
4857         struct dcerpc_spoolss_AbortPrinter_state *state = tevent_req_data(
4858                 req, struct dcerpc_spoolss_AbortPrinter_state);
4859         NTSTATUS status;
4860         TALLOC_CTX *mem_ctx;
4861
4862         if (state->out_mem_ctx) {
4863                 mem_ctx = state->out_mem_ctx;
4864         } else {
4865                 mem_ctx = state;
4866         }
4867
4868         status = dcerpc_spoolss_AbortPrinter_r_recv(subreq, mem_ctx);
4869         TALLOC_FREE(subreq);
4870         if (tevent_req_nterror(req, status)) {
4871                 return;
4872         }
4873
4874         /* Copy out parameters */
4875
4876         /* Copy result */
4877         state->orig.out.result = state->tmp.out.result;
4878
4879         /* Reset temporary structure */
4880         ZERO_STRUCT(state->tmp);
4881
4882         tevent_req_done(req);
4883 }
4884
4885 NTSTATUS dcerpc_spoolss_AbortPrinter_recv(struct tevent_req *req,
4886                                           TALLOC_CTX *mem_ctx,
4887                                           WERROR *result)
4888 {
4889         struct dcerpc_spoolss_AbortPrinter_state *state = tevent_req_data(
4890                 req, struct dcerpc_spoolss_AbortPrinter_state);
4891         NTSTATUS status;
4892
4893         if (tevent_req_is_nterror(req, &status)) {
4894                 tevent_req_received(req);
4895                 return status;
4896         }
4897
4898         /* Steal possible out parameters to the callers context */
4899         talloc_steal(mem_ctx, state->out_mem_ctx);
4900
4901         /* Return result */
4902         *result = state->orig.out.result;
4903
4904         tevent_req_received(req);
4905         return NT_STATUS_OK;
4906 }
4907
4908 NTSTATUS dcerpc_spoolss_AbortPrinter(struct dcerpc_binding_handle *h,
4909                                      TALLOC_CTX *mem_ctx,
4910                                      struct policy_handle *_handle /* [in] [ref] */,
4911                                      WERROR *result)
4912 {
4913         struct spoolss_AbortPrinter r;
4914         NTSTATUS status;
4915
4916         /* In parameters */
4917         r.in.handle = _handle;
4918
4919         status = dcerpc_spoolss_AbortPrinter_r(h, mem_ctx, &r);
4920         if (!NT_STATUS_IS_OK(status)) {
4921                 return status;
4922         }
4923
4924         /* Return variables */
4925
4926         /* Return result */
4927         *result = r.out.result;
4928
4929         return NT_STATUS_OK;
4930 }
4931
4932 struct dcerpc_spoolss_ReadPrinter_r_state {
4933         TALLOC_CTX *out_mem_ctx;
4934 };
4935
4936 static void dcerpc_spoolss_ReadPrinter_r_done(struct tevent_req *subreq);
4937
4938 struct tevent_req *dcerpc_spoolss_ReadPrinter_r_send(TALLOC_CTX *mem_ctx,
4939         struct tevent_context *ev,
4940         struct dcerpc_binding_handle *h,
4941         struct spoolss_ReadPrinter *r)
4942 {
4943         struct tevent_req *req;
4944         struct dcerpc_spoolss_ReadPrinter_r_state *state;
4945         struct tevent_req *subreq;
4946
4947         req = tevent_req_create(mem_ctx, &state,
4948                                 struct dcerpc_spoolss_ReadPrinter_r_state);
4949         if (req == NULL) {
4950                 return NULL;
4951         }
4952
4953         state->out_mem_ctx = talloc_new(state);
4954         if (tevent_req_nomem(state->out_mem_ctx, req)) {
4955                 return tevent_req_post(req, ev);
4956         }
4957
4958         subreq = dcerpc_binding_handle_call_send(state, ev, h,
4959                         NULL, &ndr_table_spoolss,
4960                         NDR_SPOOLSS_READPRINTER, state->out_mem_ctx, r);
4961         if (tevent_req_nomem(subreq, req)) {
4962                 return tevent_req_post(req, ev);
4963         }
4964         tevent_req_set_callback(subreq, dcerpc_spoolss_ReadPrinter_r_done, req);
4965
4966         return req;
4967 }
4968
4969 static void dcerpc_spoolss_ReadPrinter_r_done(struct tevent_req *subreq)
4970 {
4971         struct tevent_req *req =
4972                 tevent_req_callback_data(subreq,
4973                 struct tevent_req);
4974         NTSTATUS status;
4975
4976         status = dcerpc_binding_handle_call_recv(subreq);
4977         TALLOC_FREE(subreq);
4978         if (tevent_req_nterror(req, status)) {
4979                 return;
4980         }
4981
4982         tevent_req_done(req);
4983 }
4984
4985 NTSTATUS dcerpc_spoolss_ReadPrinter_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
4986 {
4987         struct dcerpc_spoolss_ReadPrinter_r_state *state =
4988                 tevent_req_data(req,
4989                 struct dcerpc_spoolss_ReadPrinter_r_state);
4990         NTSTATUS status;
4991
4992         if (tevent_req_is_nterror(req, &status)) {
4993                 tevent_req_received(req);
4994                 return status;
4995         }
4996
4997         talloc_steal(mem_ctx, state->out_mem_ctx);
4998
4999         tevent_req_received(req);
5000         return NT_STATUS_OK;
5001 }
5002
5003 NTSTATUS dcerpc_spoolss_ReadPrinter_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_ReadPrinter *r)
5004 {
5005         NTSTATUS status;
5006
5007         status = dcerpc_binding_handle_call(h,
5008                         NULL, &ndr_table_spoolss,
5009                         NDR_SPOOLSS_READPRINTER, mem_ctx, r);
5010
5011         return status;
5012 }
5013
5014 struct dcerpc_spoolss_ReadPrinter_state {
5015         struct spoolss_ReadPrinter orig;
5016         struct spoolss_ReadPrinter tmp;
5017         TALLOC_CTX *out_mem_ctx;
5018 };
5019
5020 static void dcerpc_spoolss_ReadPrinter_done(struct tevent_req *subreq);
5021
5022 struct tevent_req *dcerpc_spoolss_ReadPrinter_send(TALLOC_CTX *mem_ctx,
5023                                                    struct tevent_context *ev,
5024                                                    struct dcerpc_binding_handle *h,
5025                                                    struct policy_handle *_handle /* [in] [ref] */,
5026                                                    uint8_t *_data /* [out] [ref,size_is(data_size)] */,
5027                                                    uint32_t _data_size /* [in]  */,
5028                                                    uint32_t *__data_size /* [out] [ref] */)
5029 {
5030         struct tevent_req *req;
5031         struct dcerpc_spoolss_ReadPrinter_state *state;
5032         struct tevent_req *subreq;
5033
5034         req = tevent_req_create(mem_ctx, &state,
5035                                 struct dcerpc_spoolss_ReadPrinter_state);
5036         if (req == NULL) {
5037                 return NULL;
5038         }
5039         state->out_mem_ctx = NULL;
5040
5041         /* In parameters */
5042         state->orig.in.handle = _handle;
5043         state->orig.in.data_size = _data_size;
5044
5045         /* Out parameters */
5046         state->orig.out.data = _data;
5047         state->orig.out._data_size = __data_size;
5048
5049         /* Result */
5050         ZERO_STRUCT(state->orig.out.result);
5051
5052         state->out_mem_ctx = talloc_named_const(state, 0,
5053                              "dcerpc_spoolss_ReadPrinter_out_memory");
5054         if (tevent_req_nomem(state->out_mem_ctx, req)) {
5055                 return tevent_req_post(req, ev);
5056         }
5057
5058         /* make a temporary copy, that we pass to the dispatch function */
5059         state->tmp = state->orig;
5060
5061         subreq = dcerpc_spoolss_ReadPrinter_r_send(state, ev, h, &state->tmp);
5062         if (tevent_req_nomem(subreq, req)) {
5063                 return tevent_req_post(req, ev);
5064         }
5065         tevent_req_set_callback(subreq, dcerpc_spoolss_ReadPrinter_done, req);
5066         return req;
5067 }
5068
5069 static void dcerpc_spoolss_ReadPrinter_done(struct tevent_req *subreq)
5070 {
5071         struct tevent_req *req = tevent_req_callback_data(
5072                 subreq, struct tevent_req);
5073         struct dcerpc_spoolss_ReadPrinter_state *state = tevent_req_data(
5074                 req, struct dcerpc_spoolss_ReadPrinter_state);
5075         NTSTATUS status;
5076         TALLOC_CTX *mem_ctx;
5077
5078         if (state->out_mem_ctx) {
5079                 mem_ctx = state->out_mem_ctx;
5080         } else {
5081                 mem_ctx = state;
5082         }
5083
5084         status = dcerpc_spoolss_ReadPrinter_r_recv(subreq, mem_ctx);
5085         TALLOC_FREE(subreq);
5086         if (tevent_req_nterror(req, status)) {
5087                 return;
5088         }
5089
5090         /* Copy out parameters */
5091         {
5092                 size_t _copy_len_data;
5093                 _copy_len_data = state->tmp.in.data_size;
5094                 memcpy(state->orig.out.data, state->tmp.out.data, _copy_len_data * sizeof(*state->orig.out.data));
5095         }
5096         *state->orig.out._data_size = *state->tmp.out._data_size;
5097
5098         /* Copy result */
5099         state->orig.out.result = state->tmp.out.result;
5100
5101         /* Reset temporary structure */
5102         ZERO_STRUCT(state->tmp);
5103
5104         tevent_req_done(req);
5105 }
5106
5107 NTSTATUS dcerpc_spoolss_ReadPrinter_recv(struct tevent_req *req,
5108                                          TALLOC_CTX *mem_ctx,
5109                                          WERROR *result)
5110 {
5111         struct dcerpc_spoolss_ReadPrinter_state *state = tevent_req_data(
5112                 req, struct dcerpc_spoolss_ReadPrinter_state);
5113         NTSTATUS status;
5114
5115         if (tevent_req_is_nterror(req, &status)) {
5116                 tevent_req_received(req);
5117                 return status;
5118         }
5119
5120         /* Steal possible out parameters to the callers context */
5121         talloc_steal(mem_ctx, state->out_mem_ctx);
5122
5123         /* Return result */
5124         *result = state->orig.out.result;
5125
5126         tevent_req_received(req);
5127         return NT_STATUS_OK;
5128 }
5129
5130 NTSTATUS dcerpc_spoolss_ReadPrinter(struct dcerpc_binding_handle *h,
5131                                     TALLOC_CTX *mem_ctx,
5132                                     struct policy_handle *_handle /* [in] [ref] */,
5133                                     uint8_t *_data /* [out] [ref,size_is(data_size)] */,
5134                                     uint32_t _data_size /* [in]  */,
5135                                     uint32_t *__data_size /* [out] [ref] */,
5136                                     WERROR *result)
5137 {
5138         struct spoolss_ReadPrinter r;
5139         NTSTATUS status;
5140
5141         /* In parameters */
5142         r.in.handle = _handle;
5143         r.in.data_size = _data_size;
5144
5145         status = dcerpc_spoolss_ReadPrinter_r(h, mem_ctx, &r);
5146         if (!NT_STATUS_IS_OK(status)) {
5147                 return status;
5148         }
5149
5150         /* Return variables */
5151         {
5152                 size_t _copy_len_data;
5153                 _copy_len_data = r.in.data_size;
5154                 memcpy(_data, r.out.data, _copy_len_data * sizeof(*_data));
5155         }
5156         *__data_size = *r.out._data_size;
5157
5158         /* Return result */
5159         *result = r.out.result;
5160
5161         return NT_STATUS_OK;
5162 }
5163
5164 struct dcerpc_spoolss_EndDocPrinter_r_state {
5165         TALLOC_CTX *out_mem_ctx;
5166 };
5167
5168 static void dcerpc_spoolss_EndDocPrinter_r_done(struct tevent_req *subreq);
5169
5170 struct tevent_req *dcerpc_spoolss_EndDocPrinter_r_send(TALLOC_CTX *mem_ctx,
5171         struct tevent_context *ev,
5172         struct dcerpc_binding_handle *h,
5173         struct spoolss_EndDocPrinter *r)
5174 {
5175         struct tevent_req *req;
5176         struct dcerpc_spoolss_EndDocPrinter_r_state *state;
5177         struct tevent_req *subreq;
5178
5179         req = tevent_req_create(mem_ctx, &state,
5180                                 struct dcerpc_spoolss_EndDocPrinter_r_state);
5181         if (req == NULL) {
5182                 return NULL;
5183         }
5184
5185         state->out_mem_ctx = NULL;
5186
5187         subreq = dcerpc_binding_handle_call_send(state, ev, h,
5188                         NULL, &ndr_table_spoolss,
5189                         NDR_SPOOLSS_ENDDOCPRINTER, state, r);
5190         if (tevent_req_nomem(subreq, req)) {
5191                 return tevent_req_post(req, ev);
5192         }
5193         tevent_req_set_callback(subreq, dcerpc_spoolss_EndDocPrinter_r_done, req);
5194
5195         return req;
5196 }
5197
5198 static void dcerpc_spoolss_EndDocPrinter_r_done(struct tevent_req *subreq)
5199 {
5200         struct tevent_req *req =
5201                 tevent_req_callback_data(subreq,
5202                 struct tevent_req);
5203         NTSTATUS status;
5204
5205         status = dcerpc_binding_handle_call_recv(subreq);
5206         TALLOC_FREE(subreq);
5207         if (tevent_req_nterror(req, status)) {
5208                 return;
5209         }
5210
5211         tevent_req_done(req);
5212 }
5213
5214 NTSTATUS dcerpc_spoolss_EndDocPrinter_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
5215 {
5216         struct dcerpc_spoolss_EndDocPrinter_r_state *state =
5217                 tevent_req_data(req,
5218                 struct dcerpc_spoolss_EndDocPrinter_r_state);
5219         NTSTATUS status;
5220
5221         if (tevent_req_is_nterror(req, &status)) {
5222                 tevent_req_received(req);
5223                 return status;
5224         }
5225
5226         talloc_steal(mem_ctx, state->out_mem_ctx);
5227
5228         tevent_req_received(req);
5229         return NT_STATUS_OK;
5230 }
5231
5232 NTSTATUS dcerpc_spoolss_EndDocPrinter_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_EndDocPrinter *r)
5233 {
5234         NTSTATUS status;
5235
5236         status = dcerpc_binding_handle_call(h,
5237                         NULL, &ndr_table_spoolss,
5238                         NDR_SPOOLSS_ENDDOCPRINTER, mem_ctx, r);
5239
5240         return status;
5241 }
5242
5243 struct dcerpc_spoolss_EndDocPrinter_state {
5244         struct spoolss_EndDocPrinter orig;
5245         struct spoolss_EndDocPrinter tmp;
5246         TALLOC_CTX *out_mem_ctx;
5247 };
5248
5249 static void dcerpc_spoolss_EndDocPrinter_done(struct tevent_req *subreq);
5250
5251 struct tevent_req *dcerpc_spoolss_EndDocPrinter_send(TALLOC_CTX *mem_ctx,
5252                                                      struct tevent_context *ev,
5253                                                      struct dcerpc_binding_handle *h,
5254                                                      struct policy_handle *_handle /* [in] [ref] */)
5255 {
5256         struct tevent_req *req;
5257         struct dcerpc_spoolss_EndDocPrinter_state *state;
5258         struct tevent_req *subreq;
5259
5260         req = tevent_req_create(mem_ctx, &state,
5261                                 struct dcerpc_spoolss_EndDocPrinter_state);
5262         if (req == NULL) {
5263                 return NULL;
5264         }
5265         state->out_mem_ctx = NULL;
5266
5267         /* In parameters */
5268         state->orig.in.handle = _handle;
5269
5270         /* Out parameters */
5271
5272         /* Result */
5273         ZERO_STRUCT(state->orig.out.result);
5274
5275         /* make a temporary copy, that we pass to the dispatch function */
5276         state->tmp = state->orig;
5277
5278         subreq = dcerpc_spoolss_EndDocPrinter_r_send(state, ev, h, &state->tmp);
5279         if (tevent_req_nomem(subreq, req)) {
5280                 return tevent_req_post(req, ev);
5281         }
5282         tevent_req_set_callback(subreq, dcerpc_spoolss_EndDocPrinter_done, req);
5283         return req;
5284 }
5285
5286 static void dcerpc_spoolss_EndDocPrinter_done(struct tevent_req *subreq)
5287 {
5288         struct tevent_req *req = tevent_req_callback_data(
5289                 subreq, struct tevent_req);
5290         struct dcerpc_spoolss_EndDocPrinter_state *state = tevent_req_data(
5291                 req, struct dcerpc_spoolss_EndDocPrinter_state);
5292         NTSTATUS status;
5293         TALLOC_CTX *mem_ctx;
5294
5295         if (state->out_mem_ctx) {
5296                 mem_ctx = state->out_mem_ctx;
5297         } else {
5298                 mem_ctx = state;
5299         }
5300
5301         status = dcerpc_spoolss_EndDocPrinter_r_recv(subreq, mem_ctx);
5302         TALLOC_FREE(subreq);
5303         if (tevent_req_nterror(req, status)) {
5304                 return;
5305         }
5306
5307         /* Copy out parameters */
5308
5309         /* Copy result */
5310         state->orig.out.result = state->tmp.out.result;
5311
5312         /* Reset temporary structure */
5313         ZERO_STRUCT(state->tmp);
5314
5315         tevent_req_done(req);
5316 }
5317
5318 NTSTATUS dcerpc_spoolss_EndDocPrinter_recv(struct tevent_req *req,
5319                                            TALLOC_CTX *mem_ctx,
5320                                            WERROR *result)
5321 {
5322         struct dcerpc_spoolss_EndDocPrinter_state *state = tevent_req_data(
5323                 req, struct dcerpc_spoolss_EndDocPrinter_state);
5324         NTSTATUS status;
5325
5326         if (tevent_req_is_nterror(req, &status)) {
5327                 tevent_req_received(req);
5328                 return status;
5329         }
5330
5331         /* Steal possible out parameters to the callers context */
5332         talloc_steal(mem_ctx, state->out_mem_ctx);
5333
5334         /* Return result */
5335         *result = state->orig.out.result;
5336
5337         tevent_req_received(req);
5338         return NT_STATUS_OK;
5339 }
5340
5341 NTSTATUS dcerpc_spoolss_EndDocPrinter(struct dcerpc_binding_handle *h,
5342                                       TALLOC_CTX *mem_ctx,
5343                                       struct policy_handle *_handle /* [in] [ref] */,
5344                                       WERROR *result)
5345 {
5346         struct spoolss_EndDocPrinter r;
5347         NTSTATUS status;
5348
5349         /* In parameters */
5350         r.in.handle = _handle;
5351
5352         status = dcerpc_spoolss_EndDocPrinter_r(h, mem_ctx, &r);
5353         if (!NT_STATUS_IS_OK(status)) {
5354                 return status;
5355         }
5356
5357         /* Return variables */
5358
5359         /* Return result */
5360         *result = r.out.result;
5361
5362         return NT_STATUS_OK;
5363 }
5364
5365 struct dcerpc_spoolss_AddJob_r_state {
5366         TALLOC_CTX *out_mem_ctx;
5367 };
5368
5369 static void dcerpc_spoolss_AddJob_r_done(struct tevent_req *subreq);
5370
5371 struct tevent_req *dcerpc_spoolss_AddJob_r_send(TALLOC_CTX *mem_ctx,
5372         struct tevent_context *ev,
5373         struct dcerpc_binding_handle *h,
5374         struct spoolss_AddJob *r)
5375 {
5376         struct tevent_req *req;
5377         struct dcerpc_spoolss_AddJob_r_state *state;
5378         struct tevent_req *subreq;
5379
5380         req = tevent_req_create(mem_ctx, &state,
5381                                 struct dcerpc_spoolss_AddJob_r_state);
5382         if (req == NULL) {
5383                 return NULL;
5384         }
5385
5386         state->out_mem_ctx = talloc_new(state);
5387         if (tevent_req_nomem(state->out_mem_ctx, req)) {
5388                 return tevent_req_post(req, ev);
5389         }
5390
5391         subreq = dcerpc_binding_handle_call_send(state, ev, h,
5392                         NULL, &ndr_table_spoolss,
5393                         NDR_SPOOLSS_ADDJOB, state->out_mem_ctx, r);
5394         if (tevent_req_nomem(subreq, req)) {
5395                 return tevent_req_post(req, ev);
5396         }
5397         tevent_req_set_callback(subreq, dcerpc_spoolss_AddJob_r_done, req);
5398
5399         return req;
5400 }
5401
5402 static void dcerpc_spoolss_AddJob_r_done(struct tevent_req *subreq)
5403 {
5404         struct tevent_req *req =
5405                 tevent_req_callback_data(subreq,
5406                 struct tevent_req);
5407         NTSTATUS status;
5408
5409         status = dcerpc_binding_handle_call_recv(subreq);
5410         TALLOC_FREE(subreq);
5411         if (tevent_req_nterror(req, status)) {
5412                 return;
5413         }
5414
5415         tevent_req_done(req);
5416 }
5417
5418 NTSTATUS dcerpc_spoolss_AddJob_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
5419 {
5420         struct dcerpc_spoolss_AddJob_r_state *state =
5421                 tevent_req_data(req,
5422                 struct dcerpc_spoolss_AddJob_r_state);
5423         NTSTATUS status;
5424
5425         if (tevent_req_is_nterror(req, &status)) {
5426                 tevent_req_received(req);
5427                 return status;
5428         }
5429
5430         talloc_steal(mem_ctx, state->out_mem_ctx);
5431
5432         tevent_req_received(req);
5433         return NT_STATUS_OK;
5434 }
5435
5436 NTSTATUS dcerpc_spoolss_AddJob_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_AddJob *r)
5437 {
5438         NTSTATUS status;
5439
5440         status = dcerpc_binding_handle_call(h,
5441                         NULL, &ndr_table_spoolss,
5442                         NDR_SPOOLSS_ADDJOB, mem_ctx, r);
5443
5444         return status;
5445 }
5446
5447 struct dcerpc_spoolss_AddJob_state {
5448         struct spoolss_AddJob orig;
5449         struct spoolss_AddJob tmp;
5450         TALLOC_CTX *out_mem_ctx;
5451 };
5452
5453 static void dcerpc_spoolss_AddJob_done(struct tevent_req *subreq);
5454
5455 struct tevent_req *dcerpc_spoolss_AddJob_send(TALLOC_CTX *mem_ctx,
5456                                               struct tevent_context *ev,
5457                                               struct dcerpc_binding_handle *h,
5458                                               struct policy_handle *_handle /* [in] [ref] */,
5459                                               uint32_t _level /* [in]  */,
5460                                               uint8_t *_buffer /* [in,out] [unique,size_is(offered)] */,
5461                                               uint32_t _offered /* [in]  */,
5462                                               uint32_t *_needed /* [out] [ref] */)
5463 {
5464         struct tevent_req *req;
5465         struct dcerpc_spoolss_AddJob_state *state;
5466         struct tevent_req *subreq;
5467
5468         req = tevent_req_create(mem_ctx, &state,
5469                                 struct dcerpc_spoolss_AddJob_state);
5470         if (req == NULL) {
5471                 return NULL;
5472         }
5473         state->out_mem_ctx = NULL;
5474
5475         /* In parameters */
5476         state->orig.in.handle = _handle;
5477         state->orig.in.level = _level;
5478         state->orig.in.buffer = _buffer;
5479         state->orig.in.offered = _offered;
5480
5481         /* Out parameters */
5482         state->orig.out.buffer = _buffer;
5483         state->orig.out.needed = _needed;
5484
5485         /* Result */
5486         ZERO_STRUCT(state->orig.out.result);
5487
5488         state->out_mem_ctx = talloc_named_const(state, 0,
5489                              "dcerpc_spoolss_AddJob_out_memory");
5490         if (tevent_req_nomem(state->out_mem_ctx, req)) {
5491                 return tevent_req_post(req, ev);
5492         }
5493
5494         /* make a temporary copy, that we pass to the dispatch function */
5495         state->tmp = state->orig;
5496
5497         subreq = dcerpc_spoolss_AddJob_r_send(state, ev, h, &state->tmp);
5498         if (tevent_req_nomem(subreq, req)) {
5499                 return tevent_req_post(req, ev);
5500         }
5501         tevent_req_set_callback(subreq, dcerpc_spoolss_AddJob_done, req);
5502         return req;
5503 }
5504
5505 static void dcerpc_spoolss_AddJob_done(struct tevent_req *subreq)
5506 {
5507         struct tevent_req *req = tevent_req_callback_data(
5508                 subreq, struct tevent_req);
5509         struct dcerpc_spoolss_AddJob_state *state = tevent_req_data(
5510                 req, struct dcerpc_spoolss_AddJob_state);
5511         NTSTATUS status;
5512         TALLOC_CTX *mem_ctx;
5513
5514         if (state->out_mem_ctx) {
5515                 mem_ctx = state->out_mem_ctx;
5516         } else {
5517                 mem_ctx = state;
5518         }
5519
5520         status = dcerpc_spoolss_AddJob_r_recv(subreq, mem_ctx);
5521         TALLOC_FREE(subreq);
5522         if (tevent_req_nterror(req, status)) {
5523                 return;
5524         }
5525
5526         /* Copy out parameters */
5527         if (state->orig.out.buffer && state->tmp.out.buffer) {
5528                 {
5529                         size_t _copy_len_buffer;
5530                         _copy_len_buffer = state->tmp.in.offered;
5531                         memcpy(state->orig.out.buffer, state->tmp.out.buffer, _copy_len_buffer * sizeof(*state->orig.out.buffer));
5532                 }
5533         }
5534         *state->orig.out.needed = *state->tmp.out.needed;
5535
5536         /* Copy result */
5537         state->orig.out.result = state->tmp.out.result;
5538
5539         /* Reset temporary structure */
5540         ZERO_STRUCT(state->tmp);
5541
5542         tevent_req_done(req);
5543 }
5544
5545 NTSTATUS dcerpc_spoolss_AddJob_recv(struct tevent_req *req,
5546                                     TALLOC_CTX *mem_ctx,
5547                                     WERROR *result)
5548 {
5549         struct dcerpc_spoolss_AddJob_state *state = tevent_req_data(
5550                 req, struct dcerpc_spoolss_AddJob_state);
5551         NTSTATUS status;
5552
5553         if (tevent_req_is_nterror(req, &status)) {
5554                 tevent_req_received(req);
5555                 return status;
5556         }
5557
5558         /* Steal possible out parameters to the callers context */
5559         talloc_steal(mem_ctx, state->out_mem_ctx);
5560
5561         /* Return result */
5562         *result = state->orig.out.result;
5563
5564         tevent_req_received(req);
5565         return NT_STATUS_OK;
5566 }
5567
5568 NTSTATUS dcerpc_spoolss_AddJob(struct dcerpc_binding_handle *h,
5569                                TALLOC_CTX *mem_ctx,
5570                                struct policy_handle *_handle /* [in] [ref] */,
5571                                uint32_t _level /* [in]  */,
5572                                uint8_t *_buffer /* [in,out] [unique,size_is(offered)] */,
5573                                uint32_t _offered /* [in]  */,
5574                                uint32_t *_needed /* [out] [ref] */,
5575                                WERROR *result)
5576 {
5577         struct spoolss_AddJob r;
5578         NTSTATUS status;
5579
5580         /* In parameters */
5581         r.in.handle = _handle;
5582         r.in.level = _level;
5583         r.in.buffer = _buffer;
5584         r.in.offered = _offered;
5585
5586         status = dcerpc_spoolss_AddJob_r(h, mem_ctx, &r);
5587         if (!NT_STATUS_IS_OK(status)) {
5588                 return status;
5589         }
5590
5591         /* Return variables */
5592         if (_buffer && r.out.buffer) {
5593                 {
5594                         size_t _copy_len_buffer;
5595                         _copy_len_buffer = r.in.offered;
5596                         memcpy(_buffer, r.out.buffer, _copy_len_buffer * sizeof(*_buffer));
5597                 }
5598         }
5599         *_needed = *r.out.needed;
5600
5601         /* Return result */
5602         *result = r.out.result;
5603
5604         return NT_STATUS_OK;
5605 }
5606
5607 struct dcerpc_spoolss_ScheduleJob_r_state {
5608         TALLOC_CTX *out_mem_ctx;
5609 };
5610
5611 static void dcerpc_spoolss_ScheduleJob_r_done(struct tevent_req *subreq);
5612
5613 struct tevent_req *dcerpc_spoolss_ScheduleJob_r_send(TALLOC_CTX *mem_ctx,
5614         struct tevent_context *ev,
5615         struct dcerpc_binding_handle *h,
5616         struct spoolss_ScheduleJob *r)
5617 {
5618         struct tevent_req *req;
5619         struct dcerpc_spoolss_ScheduleJob_r_state *state;
5620         struct tevent_req *subreq;
5621
5622         req = tevent_req_create(mem_ctx, &state,
5623                                 struct dcerpc_spoolss_ScheduleJob_r_state);
5624         if (req == NULL) {
5625                 return NULL;
5626         }
5627
5628         state->out_mem_ctx = NULL;
5629
5630         subreq = dcerpc_binding_handle_call_send(state, ev, h,
5631                         NULL, &ndr_table_spoolss,
5632                         NDR_SPOOLSS_SCHEDULEJOB, state, r);
5633         if (tevent_req_nomem(subreq, req)) {
5634                 return tevent_req_post(req, ev);
5635         }
5636         tevent_req_set_callback(subreq, dcerpc_spoolss_ScheduleJob_r_done, req);
5637
5638         return req;
5639 }
5640
5641 static void dcerpc_spoolss_ScheduleJob_r_done(struct tevent_req *subreq)
5642 {
5643         struct tevent_req *req =
5644                 tevent_req_callback_data(subreq,
5645                 struct tevent_req);
5646         NTSTATUS status;
5647
5648         status = dcerpc_binding_handle_call_recv(subreq);
5649         TALLOC_FREE(subreq);
5650         if (tevent_req_nterror(req, status)) {
5651                 return;
5652         }
5653
5654         tevent_req_done(req);
5655 }
5656
5657 NTSTATUS dcerpc_spoolss_ScheduleJob_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
5658 {
5659         struct dcerpc_spoolss_ScheduleJob_r_state *state =
5660                 tevent_req_data(req,
5661                 struct dcerpc_spoolss_ScheduleJob_r_state);
5662         NTSTATUS status;
5663
5664         if (tevent_req_is_nterror(req, &status)) {
5665                 tevent_req_received(req);
5666                 return status;
5667         }
5668
5669         talloc_steal(mem_ctx, state->out_mem_ctx);
5670
5671         tevent_req_received(req);
5672         return NT_STATUS_OK;
5673 }
5674
5675 NTSTATUS dcerpc_spoolss_ScheduleJob_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_ScheduleJob *r)
5676 {
5677         NTSTATUS status;
5678
5679         status = dcerpc_binding_handle_call(h,
5680                         NULL, &ndr_table_spoolss,
5681                         NDR_SPOOLSS_SCHEDULEJOB, mem_ctx, r);
5682
5683         return status;
5684 }
5685
5686 struct dcerpc_spoolss_ScheduleJob_state {
5687         struct spoolss_ScheduleJob orig;
5688         struct spoolss_ScheduleJob tmp;
5689         TALLOC_CTX *out_mem_ctx;
5690 };
5691
5692 static void dcerpc_spoolss_ScheduleJob_done(struct tevent_req *subreq);
5693
5694 struct tevent_req *dcerpc_spoolss_ScheduleJob_send(TALLOC_CTX *mem_ctx,
5695                                                    struct tevent_context *ev,
5696                                                    struct dcerpc_binding_handle *h,
5697                                                    struct policy_handle *_handle /* [in] [ref] */,
5698                                                    uint32_t _jobid /* [in]  */)
5699 {
5700         struct tevent_req *req;
5701         struct dcerpc_spoolss_ScheduleJob_state *state;
5702         struct tevent_req *subreq;
5703
5704         req = tevent_req_create(mem_ctx, &state,
5705                                 struct dcerpc_spoolss_ScheduleJob_state);
5706         if (req == NULL) {
5707                 return NULL;
5708         }
5709         state->out_mem_ctx = NULL;
5710
5711         /* In parameters */
5712         state->orig.in.handle = _handle;
5713         state->orig.in.jobid = _jobid;
5714
5715         /* Out parameters */
5716
5717         /* Result */
5718         ZERO_STRUCT(state->orig.out.result);
5719
5720         /* make a temporary copy, that we pass to the dispatch function */
5721         state->tmp = state->orig;
5722
5723         subreq = dcerpc_spoolss_ScheduleJob_r_send(state, ev, h, &state->tmp);
5724         if (tevent_req_nomem(subreq, req)) {
5725                 return tevent_req_post(req, ev);
5726         }
5727         tevent_req_set_callback(subreq, dcerpc_spoolss_ScheduleJob_done, req);
5728         return req;
5729 }
5730
5731 static void dcerpc_spoolss_ScheduleJob_done(struct tevent_req *subreq)
5732 {
5733         struct tevent_req *req = tevent_req_callback_data(
5734                 subreq, struct tevent_req);
5735         struct dcerpc_spoolss_ScheduleJob_state *state = tevent_req_data(
5736                 req, struct dcerpc_spoolss_ScheduleJob_state);
5737         NTSTATUS status;
5738         TALLOC_CTX *mem_ctx;
5739
5740         if (state->out_mem_ctx) {
5741                 mem_ctx = state->out_mem_ctx;
5742         } else {
5743                 mem_ctx = state;
5744         }
5745
5746         status = dcerpc_spoolss_ScheduleJob_r_recv(subreq, mem_ctx);
5747         TALLOC_FREE(subreq);
5748         if (tevent_req_nterror(req, status)) {
5749                 return;
5750         }
5751
5752         /* Copy out parameters */
5753
5754         /* Copy result */
5755         state->orig.out.result = state->tmp.out.result;
5756
5757         /* Reset temporary structure */
5758         ZERO_STRUCT(state->tmp);
5759
5760         tevent_req_done(req);
5761 }
5762
5763 NTSTATUS dcerpc_spoolss_ScheduleJob_recv(struct tevent_req *req,
5764                                          TALLOC_CTX *mem_ctx,
5765                                          WERROR *result)
5766 {
5767         struct dcerpc_spoolss_ScheduleJob_state *state = tevent_req_data(
5768                 req, struct dcerpc_spoolss_ScheduleJob_state);
5769         NTSTATUS status;
5770
5771         if (tevent_req_is_nterror(req, &status)) {
5772                 tevent_req_received(req);
5773                 return status;
5774         }
5775
5776         /* Steal possible out parameters to the callers context */
5777         talloc_steal(mem_ctx, state->out_mem_ctx);
5778
5779         /* Return result */
5780         *result = state->orig.out.result;
5781
5782         tevent_req_received(req);
5783         return NT_STATUS_OK;
5784 }
5785
5786 NTSTATUS dcerpc_spoolss_ScheduleJob(struct dcerpc_binding_handle *h,
5787                                     TALLOC_CTX *mem_ctx,
5788                                     struct policy_handle *_handle /* [in] [ref] */,
5789                                     uint32_t _jobid /* [in]  */,
5790                                     WERROR *result)
5791 {
5792         struct spoolss_ScheduleJob r;
5793         NTSTATUS status;
5794
5795         /* In parameters */
5796         r.in.handle = _handle;
5797         r.in.jobid = _jobid;
5798
5799         status = dcerpc_spoolss_ScheduleJob_r(h, mem_ctx, &r);
5800         if (!NT_STATUS_IS_OK(status)) {
5801                 return status;
5802         }
5803
5804         /* Return variables */
5805
5806         /* Return result */
5807         *result = r.out.result;
5808
5809         return NT_STATUS_OK;
5810 }
5811
5812 struct dcerpc_spoolss_GetPrinterData_r_state {
5813         TALLOC_CTX *out_mem_ctx;
5814 };
5815
5816 static void dcerpc_spoolss_GetPrinterData_r_done(struct tevent_req *subreq);
5817
5818 struct tevent_req *dcerpc_spoolss_GetPrinterData_r_send(TALLOC_CTX *mem_ctx,
5819         struct tevent_context *ev,
5820         struct dcerpc_binding_handle *h,
5821         struct spoolss_GetPrinterData *r)
5822 {
5823         struct tevent_req *req;
5824         struct dcerpc_spoolss_GetPrinterData_r_state *state;
5825         struct tevent_req *subreq;
5826
5827         req = tevent_req_create(mem_ctx, &state,
5828                                 struct dcerpc_spoolss_GetPrinterData_r_state);
5829         if (req == NULL) {
5830                 return NULL;
5831         }
5832
5833         state->out_mem_ctx = talloc_new(state);
5834         if (tevent_req_nomem(state->out_mem_ctx, req)) {
5835                 return tevent_req_post(req, ev);
5836         }
5837
5838         subreq = dcerpc_binding_handle_call_send(state, ev, h,
5839                         NULL, &ndr_table_spoolss,
5840                         NDR_SPOOLSS_GETPRINTERDATA, state->out_mem_ctx, r);
5841         if (tevent_req_nomem(subreq, req)) {
5842                 return tevent_req_post(req, ev);
5843         }
5844         tevent_req_set_callback(subreq, dcerpc_spoolss_GetPrinterData_r_done, req);
5845
5846         return req;
5847 }
5848
5849 static void dcerpc_spoolss_GetPrinterData_r_done(struct tevent_req *subreq)
5850 {
5851         struct tevent_req *req =
5852                 tevent_req_callback_data(subreq,
5853                 struct tevent_req);
5854         NTSTATUS status;
5855
5856         status = dcerpc_binding_handle_call_recv(subreq);
5857         TALLOC_FREE(subreq);
5858         if (tevent_req_nterror(req, status)) {
5859                 return;
5860         }
5861
5862         tevent_req_done(req);
5863 }
5864
5865 NTSTATUS dcerpc_spoolss_GetPrinterData_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
5866 {
5867         struct dcerpc_spoolss_GetPrinterData_r_state *state =
5868                 tevent_req_data(req,
5869                 struct dcerpc_spoolss_GetPrinterData_r_state);
5870         NTSTATUS status;
5871
5872         if (tevent_req_is_nterror(req, &status)) {
5873                 tevent_req_received(req);
5874                 return status;
5875         }
5876
5877         talloc_steal(mem_ctx, state->out_mem_ctx);
5878
5879         tevent_req_received(req);
5880         return NT_STATUS_OK;
5881 }
5882
5883 NTSTATUS dcerpc_spoolss_GetPrinterData_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_GetPrinterData *r)
5884 {
5885         NTSTATUS status;
5886
5887         status = dcerpc_binding_handle_call(h,
5888                         NULL, &ndr_table_spoolss,
5889                         NDR_SPOOLSS_GETPRINTERDATA, mem_ctx, r);
5890
5891         return status;
5892 }
5893
5894 struct dcerpc_spoolss_GetPrinterData_state {
5895         struct spoolss_GetPrinterData orig;
5896         struct spoolss_GetPrinterData tmp;
5897         TALLOC_CTX *out_mem_ctx;
5898 };
5899
5900 static void dcerpc_spoolss_GetPrinterData_done(struct tevent_req *subreq);
5901
5902 struct tevent_req *dcerpc_spoolss_GetPrinterData_send(TALLOC_CTX *mem_ctx,
5903                                                       struct tevent_context *ev,
5904                                                       struct dcerpc_binding_handle *h,
5905                                                       struct policy_handle *_handle /* [in] [ref] */,
5906                                                       const char *_value_name /* [in] [charset(UTF16)] */,
5907                                                       enum winreg_Type *_type /* [out] [ref] */,
5908                                                       uint8_t *_data /* [out] [ref,size_is(offered)] */,
5909                                                       uint32_t _offered /* [in]  */,
5910                                                       uint32_t *_needed /* [out] [ref] */)
5911 {
5912         struct tevent_req *req;
5913         struct dcerpc_spoolss_GetPrinterData_state *state;
5914         struct tevent_req *subreq;
5915
5916         req = tevent_req_create(mem_ctx, &state,
5917                                 struct dcerpc_spoolss_GetPrinterData_state);
5918         if (req == NULL) {
5919                 return NULL;
5920         }
5921         state->out_mem_ctx = NULL;
5922
5923         /* In parameters */
5924         state->orig.in.handle = _handle;
5925         state->orig.in.value_name = _value_name;
5926         state->orig.in.offered = _offered;
5927
5928         /* Out parameters */
5929         state->orig.out.type = _type;
5930         state->orig.out.data = _data;
5931         state->orig.out.needed = _needed;
5932
5933         /* Result */
5934         ZERO_STRUCT(state->orig.out.result);
5935
5936         state->out_mem_ctx = talloc_named_const(state, 0,
5937                              "dcerpc_spoolss_GetPrinterData_out_memory");
5938         if (tevent_req_nomem(state->out_mem_ctx, req)) {
5939                 return tevent_req_post(req, ev);
5940         }
5941
5942         /* make a temporary copy, that we pass to the dispatch function */
5943         state->tmp = state->orig;
5944
5945         subreq = dcerpc_spoolss_GetPrinterData_r_send(state, ev, h, &state->tmp);
5946         if (tevent_req_nomem(subreq, req)) {
5947                 return tevent_req_post(req, ev);
5948         }
5949         tevent_req_set_callback(subreq, dcerpc_spoolss_GetPrinterData_done, req);
5950         return req;
5951 }
5952
5953 static void dcerpc_spoolss_GetPrinterData_done(struct tevent_req *subreq)
5954 {
5955         struct tevent_req *req = tevent_req_callback_data(
5956                 subreq, struct tevent_req);
5957         struct dcerpc_spoolss_GetPrinterData_state *state = tevent_req_data(
5958                 req, struct dcerpc_spoolss_GetPrinterData_state);
5959         NTSTATUS status;
5960         TALLOC_CTX *mem_ctx;
5961
5962         if (state->out_mem_ctx) {
5963                 mem_ctx = state->out_mem_ctx;
5964         } else {
5965                 mem_ctx = state;
5966         }
5967
5968         status = dcerpc_spoolss_GetPrinterData_r_recv(subreq, mem_ctx);
5969         TALLOC_FREE(subreq);
5970         if (tevent_req_nterror(req, status)) {
5971                 return;
5972         }
5973
5974         /* Copy out parameters */
5975         *state->orig.out.type = *state->tmp.out.type;
5976         {
5977                 size_t _copy_len_data;
5978                 _copy_len_data = state->tmp.in.offered;
5979                 memcpy(state->orig.out.data, state->tmp.out.data, _copy_len_data * sizeof(*state->orig.out.data));
5980         }
5981         *state->orig.out.needed = *state->tmp.out.needed;
5982
5983         /* Copy result */
5984         state->orig.out.result = state->tmp.out.result;
5985
5986         /* Reset temporary structure */
5987         ZERO_STRUCT(state->tmp);
5988
5989         tevent_req_done(req);
5990 }
5991
5992 NTSTATUS dcerpc_spoolss_GetPrinterData_recv(struct tevent_req *req,
5993                                             TALLOC_CTX *mem_ctx,
5994                                             WERROR *result)
5995 {
5996         struct dcerpc_spoolss_GetPrinterData_state *state = tevent_req_data(
5997                 req, struct dcerpc_spoolss_GetPrinterData_state);
5998         NTSTATUS status;
5999
6000         if (tevent_req_is_nterror(req, &status)) {
6001                 tevent_req_received(req);
6002                 return status;
6003         }
6004
6005         /* Steal possible out parameters to the callers context */
6006         talloc_steal(mem_ctx, state->out_mem_ctx);
6007
6008         /* Return result */
6009         *result = state->orig.out.result;
6010
6011         tevent_req_received(req);
6012         return NT_STATUS_OK;
6013 }
6014
6015 NTSTATUS dcerpc_spoolss_GetPrinterData(struct dcerpc_binding_handle *h,
6016                                        TALLOC_CTX *mem_ctx,
6017                                        struct policy_handle *_handle /* [in] [ref] */,
6018                                        const char *_value_name /* [in] [charset(UTF16)] */,
6019                                        enum winreg_Type *_type /* [out] [ref] */,
6020                                        uint8_t *_data /* [out] [ref,size_is(offered)] */,
6021                                        uint32_t _offered /* [in]  */,
6022                                        uint32_t *_needed /* [out] [ref] */,
6023                                        WERROR *result)
6024 {
6025         struct spoolss_GetPrinterData r;
6026         NTSTATUS status;
6027
6028         /* In parameters */
6029         r.in.handle = _handle;
6030         r.in.value_name = _value_name;
6031         r.in.offered = _offered;
6032
6033         status = dcerpc_spoolss_GetPrinterData_r(h, mem_ctx, &r);
6034         if (!NT_STATUS_IS_OK(status)) {
6035                 return status;
6036         }
6037
6038         /* Return variables */
6039         *_type = *r.out.type;
6040         {
6041                 size_t _copy_len_data;
6042                 _copy_len_data = r.in.offered;
6043                 memcpy(_data, r.out.data, _copy_len_data * sizeof(*_data));
6044         }
6045         *_needed = *r.out.needed;
6046
6047         /* Return result */
6048         *result = r.out.result;
6049
6050         return NT_STATUS_OK;
6051 }
6052
6053 struct dcerpc_spoolss_SetPrinterData_r_state {
6054         TALLOC_CTX *out_mem_ctx;
6055 };
6056
6057 static void dcerpc_spoolss_SetPrinterData_r_done(struct tevent_req *subreq);
6058
6059 struct tevent_req *dcerpc_spoolss_SetPrinterData_r_send(TALLOC_CTX *mem_ctx,
6060         struct tevent_context *ev,
6061         struct dcerpc_binding_handle *h,
6062         struct spoolss_SetPrinterData *r)
6063 {
6064         struct tevent_req *req;
6065         struct dcerpc_spoolss_SetPrinterData_r_state *state;
6066         struct tevent_req *subreq;
6067
6068         req = tevent_req_create(mem_ctx, &state,
6069                                 struct dcerpc_spoolss_SetPrinterData_r_state);
6070         if (req == NULL) {
6071                 return NULL;
6072         }
6073
6074         state->out_mem_ctx = NULL;
6075
6076         subreq = dcerpc_binding_handle_call_send(state, ev, h,
6077                         NULL, &ndr_table_spoolss,
6078                         NDR_SPOOLSS_SETPRINTERDATA, state, r);
6079         if (tevent_req_nomem(subreq, req)) {
6080                 return tevent_req_post(req, ev);
6081         }
6082         tevent_req_set_callback(subreq, dcerpc_spoolss_SetPrinterData_r_done, req);
6083
6084         return req;
6085 }
6086
6087 static void dcerpc_spoolss_SetPrinterData_r_done(struct tevent_req *subreq)
6088 {
6089         struct tevent_req *req =
6090                 tevent_req_callback_data(subreq,
6091                 struct tevent_req);
6092         NTSTATUS status;
6093
6094         status = dcerpc_binding_handle_call_recv(subreq);
6095         TALLOC_FREE(subreq);
6096         if (tevent_req_nterror(req, status)) {
6097                 return;
6098         }
6099
6100         tevent_req_done(req);
6101 }
6102
6103 NTSTATUS dcerpc_spoolss_SetPrinterData_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
6104 {
6105         struct dcerpc_spoolss_SetPrinterData_r_state *state =
6106                 tevent_req_data(req,
6107                 struct dcerpc_spoolss_SetPrinterData_r_state);
6108         NTSTATUS status;
6109
6110         if (tevent_req_is_nterror(req, &status)) {
6111                 tevent_req_received(req);
6112                 return status;
6113         }
6114
6115         talloc_steal(mem_ctx, state->out_mem_ctx);
6116
6117         tevent_req_received(req);
6118         return NT_STATUS_OK;
6119 }
6120
6121 NTSTATUS dcerpc_spoolss_SetPrinterData_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_SetPrinterData *r)
6122 {
6123         NTSTATUS status;
6124
6125         status = dcerpc_binding_handle_call(h,
6126                         NULL, &ndr_table_spoolss,
6127                         NDR_SPOOLSS_SETPRINTERDATA, mem_ctx, r);
6128
6129         return status;
6130 }
6131
6132 struct dcerpc_spoolss_SetPrinterData_state {
6133         struct spoolss_SetPrinterData orig;
6134         struct spoolss_SetPrinterData tmp;
6135         TALLOC_CTX *out_mem_ctx;
6136 };
6137
6138 static void dcerpc_spoolss_SetPrinterData_done(struct tevent_req *subreq);
6139
6140 struct tevent_req *dcerpc_spoolss_SetPrinterData_send(TALLOC_CTX *mem_ctx,
6141                                                       struct tevent_context *ev,
6142                                                       struct dcerpc_binding_handle *h,
6143                                                       struct policy_handle *_handle /* [in] [ref] */,
6144                                                       const char *_value_name /* [in] [charset(UTF16)] */,
6145                                                       enum winreg_Type _type /* [in]  */,
6146                                                       uint8_t *_data /* [in] [ref,size_is(offered)] */,
6147                                                       uint32_t _offered /* [in]  */)
6148 {
6149         struct tevent_req *req;
6150         struct dcerpc_spoolss_SetPrinterData_state *state;
6151         struct tevent_req *subreq;
6152
6153         req = tevent_req_create(mem_ctx, &state,
6154                                 struct dcerpc_spoolss_SetPrinterData_state);
6155         if (req == NULL) {
6156                 return NULL;
6157         }
6158         state->out_mem_ctx = NULL;
6159
6160         /* In parameters */
6161         state->orig.in.handle = _handle;
6162         state->orig.in.value_name = _value_name;
6163         state->orig.in.type = _type;
6164         state->orig.in.data = _data;
6165         state->orig.in.offered = _offered;
6166
6167         /* Out parameters */
6168
6169         /* Result */
6170         ZERO_STRUCT(state->orig.out.result);
6171
6172         /* make a temporary copy, that we pass to the dispatch function */
6173         state->tmp = state->orig;
6174
6175         subreq = dcerpc_spoolss_SetPrinterData_r_send(state, ev, h, &state->tmp);
6176         if (tevent_req_nomem(subreq, req)) {
6177                 return tevent_req_post(req, ev);
6178         }
6179         tevent_req_set_callback(subreq, dcerpc_spoolss_SetPrinterData_done, req);
6180         return req;
6181 }
6182
6183 static void dcerpc_spoolss_SetPrinterData_done(struct tevent_req *subreq)
6184 {
6185         struct tevent_req *req = tevent_req_callback_data(
6186                 subreq, struct tevent_req);
6187         struct dcerpc_spoolss_SetPrinterData_state *state = tevent_req_data(
6188                 req, struct dcerpc_spoolss_SetPrinterData_state);
6189         NTSTATUS status;
6190         TALLOC_CTX *mem_ctx;
6191
6192         if (state->out_mem_ctx) {
6193                 mem_ctx = state->out_mem_ctx;
6194         } else {
6195                 mem_ctx = state;
6196         }
6197
6198         status = dcerpc_spoolss_SetPrinterData_r_recv(subreq, mem_ctx);
6199         TALLOC_FREE(subreq);
6200         if (tevent_req_nterror(req, status)) {
6201                 return;
6202         }
6203
6204         /* Copy out parameters */
6205
6206         /* Copy result */
6207         state->orig.out.result = state->tmp.out.result;
6208
6209         /* Reset temporary structure */
6210         ZERO_STRUCT(state->tmp);
6211
6212         tevent_req_done(req);
6213 }
6214
6215 NTSTATUS dcerpc_spoolss_SetPrinterData_recv(struct tevent_req *req,
6216                                             TALLOC_CTX *mem_ctx,
6217                                             WERROR *result)
6218 {
6219         struct dcerpc_spoolss_SetPrinterData_state *state = tevent_req_data(
6220                 req, struct dcerpc_spoolss_SetPrinterData_state);
6221         NTSTATUS status;
6222
6223         if (tevent_req_is_nterror(req, &status)) {
6224                 tevent_req_received(req);
6225                 return status;
6226         }
6227
6228         /* Steal possible out parameters to the callers context */
6229         talloc_steal(mem_ctx, state->out_mem_ctx);
6230
6231         /* Return result */
6232         *result = state->orig.out.result;
6233
6234         tevent_req_received(req);
6235         return NT_STATUS_OK;
6236 }
6237
6238 NTSTATUS dcerpc_spoolss_SetPrinterData(struct dcerpc_binding_handle *h,
6239                                        TALLOC_CTX *mem_ctx,
6240                                        struct policy_handle *_handle /* [in] [ref] */,
6241                                        const char *_value_name /* [in] [charset(UTF16)] */,
6242                                        enum winreg_Type _type /* [in]  */,
6243                                        uint8_t *_data /* [in] [ref,size_is(offered)] */,
6244                                        uint32_t _offered /* [in]  */,
6245                                        WERROR *result)
6246 {
6247         struct spoolss_SetPrinterData r;
6248         NTSTATUS status;
6249
6250         /* In parameters */
6251         r.in.handle = _handle;
6252         r.in.value_name = _value_name;
6253         r.in.type = _type;
6254         r.in.data = _data;
6255         r.in.offered = _offered;
6256
6257         status = dcerpc_spoolss_SetPrinterData_r(h, mem_ctx, &r);
6258         if (!NT_STATUS_IS_OK(status)) {
6259                 return status;
6260         }
6261
6262         /* Return variables */
6263
6264         /* Return result */
6265         *result = r.out.result;
6266
6267         return NT_STATUS_OK;
6268 }
6269
6270 struct dcerpc_spoolss_ClosePrinter_r_state {
6271         TALLOC_CTX *out_mem_ctx;
6272 };
6273
6274 static void dcerpc_spoolss_ClosePrinter_r_done(struct tevent_req *subreq);
6275
6276 struct tevent_req *dcerpc_spoolss_ClosePrinter_r_send(TALLOC_CTX *mem_ctx,
6277         struct tevent_context *ev,
6278         struct dcerpc_binding_handle *h,
6279         struct spoolss_ClosePrinter *r)
6280 {
6281         struct tevent_req *req;
6282         struct dcerpc_spoolss_ClosePrinter_r_state *state;
6283         struct tevent_req *subreq;
6284
6285         req = tevent_req_create(mem_ctx, &state,
6286                                 struct dcerpc_spoolss_ClosePrinter_r_state);
6287         if (req == NULL) {
6288                 return NULL;
6289         }
6290
6291         state->out_mem_ctx = talloc_new(state);
6292         if (tevent_req_nomem(state->out_mem_ctx, req)) {
6293                 return tevent_req_post(req, ev);
6294         }
6295
6296         subreq = dcerpc_binding_handle_call_send(state, ev, h,
6297                         NULL, &ndr_table_spoolss,
6298                         NDR_SPOOLSS_CLOSEPRINTER, state->out_mem_ctx, r);
6299         if (tevent_req_nomem(subreq, req)) {
6300                 return tevent_req_post(req, ev);
6301         }
6302         tevent_req_set_callback(subreq, dcerpc_spoolss_ClosePrinter_r_done, req);
6303
6304         return req;
6305 }
6306
6307 static void dcerpc_spoolss_ClosePrinter_r_done(struct tevent_req *subreq)
6308 {
6309         struct tevent_req *req =
6310                 tevent_req_callback_data(subreq,
6311                 struct tevent_req);
6312         NTSTATUS status;
6313
6314         status = dcerpc_binding_handle_call_recv(subreq);
6315         TALLOC_FREE(subreq);
6316         if (tevent_req_nterror(req, status)) {
6317                 return;
6318         }
6319
6320         tevent_req_done(req);
6321 }
6322
6323 NTSTATUS dcerpc_spoolss_ClosePrinter_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
6324 {
6325         struct dcerpc_spoolss_ClosePrinter_r_state *state =
6326                 tevent_req_data(req,
6327                 struct dcerpc_spoolss_ClosePrinter_r_state);
6328         NTSTATUS status;
6329
6330         if (tevent_req_is_nterror(req, &status)) {
6331                 tevent_req_received(req);
6332                 return status;
6333         }
6334
6335         talloc_steal(mem_ctx, state->out_mem_ctx);
6336
6337         tevent_req_received(req);
6338         return NT_STATUS_OK;
6339 }
6340
6341 NTSTATUS dcerpc_spoolss_ClosePrinter_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_ClosePrinter *r)
6342 {
6343         NTSTATUS status;
6344
6345         status = dcerpc_binding_handle_call(h,
6346                         NULL, &ndr_table_spoolss,
6347                         NDR_SPOOLSS_CLOSEPRINTER, mem_ctx, r);
6348
6349         return status;
6350 }
6351
6352 struct dcerpc_spoolss_ClosePrinter_state {
6353         struct spoolss_ClosePrinter orig;
6354         struct spoolss_ClosePrinter tmp;
6355         TALLOC_CTX *out_mem_ctx;
6356 };
6357
6358 static void dcerpc_spoolss_ClosePrinter_done(struct tevent_req *subreq);
6359
6360 struct tevent_req *dcerpc_spoolss_ClosePrinter_send(TALLOC_CTX *mem_ctx,
6361                                                     struct tevent_context *ev,
6362                                                     struct dcerpc_binding_handle *h,
6363                                                     struct policy_handle *_handle /* [in,out] [ref] */)
6364 {
6365         struct tevent_req *req;
6366         struct dcerpc_spoolss_ClosePrinter_state *state;
6367         struct tevent_req *subreq;
6368
6369         req = tevent_req_create(mem_ctx, &state,
6370                                 struct dcerpc_spoolss_ClosePrinter_state);
6371         if (req == NULL) {
6372                 return NULL;
6373         }
6374         state->out_mem_ctx = NULL;
6375
6376         /* In parameters */
6377         state->orig.in.handle = _handle;
6378
6379         /* Out parameters */
6380         state->orig.out.handle = _handle;
6381
6382         /* Result */
6383         ZERO_STRUCT(state->orig.out.result);
6384
6385         state->out_mem_ctx = talloc_named_const(state, 0,
6386                              "dcerpc_spoolss_ClosePrinter_out_memory");
6387         if (tevent_req_nomem(state->out_mem_ctx, req)) {
6388                 return tevent_req_post(req, ev);
6389         }
6390
6391         /* make a temporary copy, that we pass to the dispatch function */
6392         state->tmp = state->orig;
6393
6394         subreq = dcerpc_spoolss_ClosePrinter_r_send(state, ev, h, &state->tmp);
6395         if (tevent_req_nomem(subreq, req)) {
6396                 return tevent_req_post(req, ev);
6397         }
6398         tevent_req_set_callback(subreq, dcerpc_spoolss_ClosePrinter_done, req);
6399         return req;
6400 }
6401
6402 static void dcerpc_spoolss_ClosePrinter_done(struct tevent_req *subreq)
6403 {
6404         struct tevent_req *req = tevent_req_callback_data(
6405                 subreq, struct tevent_req);
6406         struct dcerpc_spoolss_ClosePrinter_state *state = tevent_req_data(
6407                 req, struct dcerpc_spoolss_ClosePrinter_state);
6408         NTSTATUS status;
6409         TALLOC_CTX *mem_ctx;
6410
6411         if (state->out_mem_ctx) {
6412                 mem_ctx = state->out_mem_ctx;
6413         } else {
6414                 mem_ctx = state;
6415         }
6416
6417         status = dcerpc_spoolss_ClosePrinter_r_recv(subreq, mem_ctx);
6418         TALLOC_FREE(subreq);
6419         if (tevent_req_nterror(req, status)) {
6420                 return;
6421         }
6422
6423         /* Copy out parameters */
6424         *state->orig.out.handle = *state->tmp.out.handle;
6425
6426         /* Copy result */
6427         state->orig.out.result = state->tmp.out.result;
6428
6429         /* Reset temporary structure */
6430         ZERO_STRUCT(state->tmp);
6431
6432         tevent_req_done(req);
6433 }
6434
6435 NTSTATUS dcerpc_spoolss_ClosePrinter_recv(struct tevent_req *req,
6436                                           TALLOC_CTX *mem_ctx,
6437                                           WERROR *result)
6438 {
6439         struct dcerpc_spoolss_ClosePrinter_state *state = tevent_req_data(
6440                 req, struct dcerpc_spoolss_ClosePrinter_state);
6441         NTSTATUS status;
6442
6443         if (tevent_req_is_nterror(req, &status)) {
6444                 tevent_req_received(req);
6445                 return status;
6446         }
6447
6448         /* Steal possible out parameters to the callers context */
6449         talloc_steal(mem_ctx, state->out_mem_ctx);
6450
6451         /* Return result */
6452         *result = state->orig.out.result;
6453
6454         tevent_req_received(req);
6455         return NT_STATUS_OK;
6456 }
6457
6458 NTSTATUS dcerpc_spoolss_ClosePrinter(struct dcerpc_binding_handle *h,
6459                                      TALLOC_CTX *mem_ctx,
6460                                      struct policy_handle *_handle /* [in,out] [ref] */,
6461                                      WERROR *result)
6462 {
6463         struct spoolss_ClosePrinter r;
6464         NTSTATUS status;
6465
6466         /* In parameters */
6467         r.in.handle = _handle;
6468
6469         status = dcerpc_spoolss_ClosePrinter_r(h, mem_ctx, &r);
6470         if (!NT_STATUS_IS_OK(status)) {
6471                 return status;
6472         }
6473
6474         /* Return variables */
6475         *_handle = *r.out.handle;
6476
6477         /* Return result */
6478         *result = r.out.result;
6479
6480         return NT_STATUS_OK;
6481 }
6482
6483 struct dcerpc_spoolss_AddForm_r_state {
6484         TALLOC_CTX *out_mem_ctx;
6485 };
6486
6487 static void dcerpc_spoolss_AddForm_r_done(struct tevent_req *subreq);
6488
6489 struct tevent_req *dcerpc_spoolss_AddForm_r_send(TALLOC_CTX *mem_ctx,
6490         struct tevent_context *ev,
6491         struct dcerpc_binding_handle *h,
6492         struct spoolss_AddForm *r)
6493 {
6494         struct tevent_req *req;
6495         struct dcerpc_spoolss_AddForm_r_state *state;
6496         struct tevent_req *subreq;
6497
6498         req = tevent_req_create(mem_ctx, &state,
6499                                 struct dcerpc_spoolss_AddForm_r_state);
6500         if (req == NULL) {
6501                 return NULL;
6502         }
6503
6504         state->out_mem_ctx = NULL;
6505
6506         subreq = dcerpc_binding_handle_call_send(state, ev, h,
6507                         NULL, &ndr_table_spoolss,
6508                         NDR_SPOOLSS_ADDFORM, state, r);
6509         if (tevent_req_nomem(subreq, req)) {
6510                 return tevent_req_post(req, ev);
6511         }
6512         tevent_req_set_callback(subreq, dcerpc_spoolss_AddForm_r_done, req);
6513
6514         return req;
6515 }
6516
6517 static void dcerpc_spoolss_AddForm_r_done(struct tevent_req *subreq)
6518 {
6519         struct tevent_req *req =
6520                 tevent_req_callback_data(subreq,
6521                 struct tevent_req);
6522         NTSTATUS status;
6523
6524         status = dcerpc_binding_handle_call_recv(subreq);
6525         TALLOC_FREE(subreq);
6526         if (tevent_req_nterror(req, status)) {
6527                 return;
6528         }
6529
6530         tevent_req_done(req);
6531 }
6532
6533 NTSTATUS dcerpc_spoolss_AddForm_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
6534 {
6535         struct dcerpc_spoolss_AddForm_r_state *state =
6536                 tevent_req_data(req,
6537                 struct dcerpc_spoolss_AddForm_r_state);
6538         NTSTATUS status;
6539
6540         if (tevent_req_is_nterror(req, &status)) {
6541                 tevent_req_received(req);
6542                 return status;
6543         }
6544
6545         talloc_steal(mem_ctx, state->out_mem_ctx);
6546
6547         tevent_req_received(req);
6548         return NT_STATUS_OK;
6549 }
6550
6551 NTSTATUS dcerpc_spoolss_AddForm_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_AddForm *r)
6552 {
6553         NTSTATUS status;
6554
6555         status = dcerpc_binding_handle_call(h,
6556                         NULL, &ndr_table_spoolss,
6557                         NDR_SPOOLSS_ADDFORM, mem_ctx, r);
6558
6559         return status;
6560 }
6561
6562 struct dcerpc_spoolss_AddForm_state {
6563         struct spoolss_AddForm orig;
6564         struct spoolss_AddForm tmp;
6565         TALLOC_CTX *out_mem_ctx;
6566 };
6567
6568 static void dcerpc_spoolss_AddForm_done(struct tevent_req *subreq);
6569
6570 struct tevent_req *dcerpc_spoolss_AddForm_send(TALLOC_CTX *mem_ctx,
6571                                                struct tevent_context *ev,
6572                                                struct dcerpc_binding_handle *h,
6573                                                struct policy_handle *_handle /* [in] [ref] */,
6574                                                struct spoolss_AddFormInfoCtr *_info_ctr /* [in] [ref] */)
6575 {
6576         struct tevent_req *req;
6577         struct dcerpc_spoolss_AddForm_state *state;
6578         struct tevent_req *subreq;
6579
6580         req = tevent_req_create(mem_ctx, &state,
6581                                 struct dcerpc_spoolss_AddForm_state);
6582         if (req == NULL) {
6583                 return NULL;
6584         }
6585         state->out_mem_ctx = NULL;
6586
6587         /* In parameters */
6588         state->orig.in.handle = _handle;
6589         state->orig.in.info_ctr = _info_ctr;
6590
6591         /* Out parameters */
6592
6593         /* Result */
6594         ZERO_STRUCT(state->orig.out.result);
6595
6596         /* make a temporary copy, that we pass to the dispatch function */
6597         state->tmp = state->orig;
6598
6599         subreq = dcerpc_spoolss_AddForm_r_send(state, ev, h, &state->tmp);
6600         if (tevent_req_nomem(subreq, req)) {
6601                 return tevent_req_post(req, ev);
6602         }
6603         tevent_req_set_callback(subreq, dcerpc_spoolss_AddForm_done, req);
6604         return req;
6605 }
6606
6607 static void dcerpc_spoolss_AddForm_done(struct tevent_req *subreq)
6608 {
6609         struct tevent_req *req = tevent_req_callback_data(
6610                 subreq, struct tevent_req);
6611         struct dcerpc_spoolss_AddForm_state *state = tevent_req_data(
6612                 req, struct dcerpc_spoolss_AddForm_state);
6613         NTSTATUS status;
6614         TALLOC_CTX *mem_ctx;
6615
6616         if (state->out_mem_ctx) {
6617                 mem_ctx = state->out_mem_ctx;
6618         } else {
6619                 mem_ctx = state;
6620         }
6621
6622         status = dcerpc_spoolss_AddForm_r_recv(subreq, mem_ctx);
6623         TALLOC_FREE(subreq);
6624         if (tevent_req_nterror(req, status)) {
6625                 return;
6626         }
6627
6628         /* Copy out parameters */
6629
6630         /* Copy result */
6631         state->orig.out.result = state->tmp.out.result;
6632
6633         /* Reset temporary structure */
6634         ZERO_STRUCT(state->tmp);
6635
6636         tevent_req_done(req);
6637 }
6638
6639 NTSTATUS dcerpc_spoolss_AddForm_recv(struct tevent_req *req,
6640                                      TALLOC_CTX *mem_ctx,
6641                                      WERROR *result)
6642 {
6643         struct dcerpc_spoolss_AddForm_state *state = tevent_req_data(
6644                 req, struct dcerpc_spoolss_AddForm_state);
6645         NTSTATUS status;
6646
6647         if (tevent_req_is_nterror(req, &status)) {
6648                 tevent_req_received(req);
6649                 return status;
6650         }
6651
6652         /* Steal possible out parameters to the callers context */
6653         talloc_steal(mem_ctx, state->out_mem_ctx);
6654
6655         /* Return result */
6656         *result = state->orig.out.result;
6657
6658         tevent_req_received(req);
6659         return NT_STATUS_OK;
6660 }
6661
6662 NTSTATUS dcerpc_spoolss_AddForm(struct dcerpc_binding_handle *h,
6663                                 TALLOC_CTX *mem_ctx,
6664                                 struct policy_handle *_handle /* [in] [ref] */,
6665                                 struct spoolss_AddFormInfoCtr *_info_ctr /* [in] [ref] */,
6666                                 WERROR *result)
6667 {
6668         struct spoolss_AddForm r;
6669         NTSTATUS status;
6670
6671         /* In parameters */
6672         r.in.handle = _handle;
6673         r.in.info_ctr = _info_ctr;
6674
6675         status = dcerpc_spoolss_AddForm_r(h, mem_ctx, &r);
6676         if (!NT_STATUS_IS_OK(status)) {
6677                 return status;
6678         }
6679
6680         /* Return variables */
6681
6682         /* Return result */
6683         *result = r.out.result;
6684
6685         return NT_STATUS_OK;
6686 }
6687
6688 struct dcerpc_spoolss_DeleteForm_r_state {
6689         TALLOC_CTX *out_mem_ctx;
6690 };
6691
6692 static void dcerpc_spoolss_DeleteForm_r_done(struct tevent_req *subreq);
6693
6694 struct tevent_req *dcerpc_spoolss_DeleteForm_r_send(TALLOC_CTX *mem_ctx,
6695         struct tevent_context *ev,
6696         struct dcerpc_binding_handle *h,
6697         struct spoolss_DeleteForm *r)
6698 {
6699         struct tevent_req *req;
6700         struct dcerpc_spoolss_DeleteForm_r_state *state;
6701         struct tevent_req *subreq;
6702
6703         req = tevent_req_create(mem_ctx, &state,
6704                                 struct dcerpc_spoolss_DeleteForm_r_state);
6705         if (req == NULL) {
6706                 return NULL;
6707         }
6708
6709         state->out_mem_ctx = NULL;
6710
6711         subreq = dcerpc_binding_handle_call_send(state, ev, h,
6712                         NULL, &ndr_table_spoolss,
6713                         NDR_SPOOLSS_DELETEFORM, state, r);
6714         if (tevent_req_nomem(subreq, req)) {
6715                 return tevent_req_post(req, ev);
6716         }
6717         tevent_req_set_callback(subreq, dcerpc_spoolss_DeleteForm_r_done, req);
6718
6719         return req;
6720 }
6721
6722 static void dcerpc_spoolss_DeleteForm_r_done(struct tevent_req *subreq)
6723 {
6724         struct tevent_req *req =
6725                 tevent_req_callback_data(subreq,
6726                 struct tevent_req);
6727         NTSTATUS status;
6728
6729         status = dcerpc_binding_handle_call_recv(subreq);
6730         TALLOC_FREE(subreq);
6731         if (tevent_req_nterror(req, status)) {
6732                 return;
6733         }
6734
6735         tevent_req_done(req);
6736 }
6737
6738 NTSTATUS dcerpc_spoolss_DeleteForm_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
6739 {
6740         struct dcerpc_spoolss_DeleteForm_r_state *state =
6741                 tevent_req_data(req,
6742                 struct dcerpc_spoolss_DeleteForm_r_state);
6743         NTSTATUS status;
6744
6745         if (tevent_req_is_nterror(req, &status)) {
6746                 tevent_req_received(req);
6747                 return status;
6748         }
6749
6750         talloc_steal(mem_ctx, state->out_mem_ctx);
6751
6752         tevent_req_received(req);
6753         return NT_STATUS_OK;
6754 }
6755
6756 NTSTATUS dcerpc_spoolss_DeleteForm_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_DeleteForm *r)
6757 {
6758         NTSTATUS status;
6759
6760         status = dcerpc_binding_handle_call(h,
6761                         NULL, &ndr_table_spoolss,
6762                         NDR_SPOOLSS_DELETEFORM, mem_ctx, r);
6763
6764         return status;
6765 }
6766
6767 struct dcerpc_spoolss_DeleteForm_state {
6768         struct spoolss_DeleteForm orig;
6769         struct spoolss_DeleteForm tmp;
6770         TALLOC_CTX *out_mem_ctx;
6771 };
6772
6773 static void dcerpc_spoolss_DeleteForm_done(struct tevent_req *subreq);
6774
6775 struct tevent_req *dcerpc_spoolss_DeleteForm_send(TALLOC_CTX *mem_ctx,
6776                                                   struct tevent_context *ev,
6777                                                   struct dcerpc_binding_handle *h,
6778                                                   struct policy_handle *_handle /* [in] [ref] */,
6779                                                   const char *_form_name /* [in] [charset(UTF16)] */)
6780 {
6781         struct tevent_req *req;
6782         struct dcerpc_spoolss_DeleteForm_state *state;
6783         struct tevent_req *subreq;
6784
6785         req = tevent_req_create(mem_ctx, &state,
6786                                 struct dcerpc_spoolss_DeleteForm_state);
6787         if (req == NULL) {
6788                 return NULL;
6789         }
6790         state->out_mem_ctx = NULL;
6791
6792         /* In parameters */
6793         state->orig.in.handle = _handle;
6794         state->orig.in.form_name = _form_name;
6795
6796         /* Out parameters */
6797
6798         /* Result */
6799         ZERO_STRUCT(state->orig.out.result);
6800
6801         /* make a temporary copy, that we pass to the dispatch function */
6802         state->tmp = state->orig;
6803
6804         subreq = dcerpc_spoolss_DeleteForm_r_send(state, ev, h, &state->tmp);
6805         if (tevent_req_nomem(subreq, req)) {
6806                 return tevent_req_post(req, ev);
6807         }
6808         tevent_req_set_callback(subreq, dcerpc_spoolss_DeleteForm_done, req);
6809         return req;
6810 }
6811
6812 static void dcerpc_spoolss_DeleteForm_done(struct tevent_req *subreq)
6813 {
6814         struct tevent_req *req = tevent_req_callback_data(
6815                 subreq, struct tevent_req);
6816         struct dcerpc_spoolss_DeleteForm_state *state = tevent_req_data(
6817                 req, struct dcerpc_spoolss_DeleteForm_state);
6818         NTSTATUS status;
6819         TALLOC_CTX *mem_ctx;
6820
6821         if (state->out_mem_ctx) {
6822                 mem_ctx = state->out_mem_ctx;
6823         } else {
6824                 mem_ctx = state;
6825         }
6826
6827         status = dcerpc_spoolss_DeleteForm_r_recv(subreq, mem_ctx);
6828         TALLOC_FREE(subreq);
6829         if (tevent_req_nterror(req, status)) {
6830                 return;
6831         }
6832
6833         /* Copy out parameters */
6834
6835         /* Copy result */
6836         state->orig.out.result = state->tmp.out.result;
6837
6838         /* Reset temporary structure */
6839         ZERO_STRUCT(state->tmp);
6840
6841         tevent_req_done(req);
6842 }
6843
6844 NTSTATUS dcerpc_spoolss_DeleteForm_recv(struct tevent_req *req,
6845                                         TALLOC_CTX *mem_ctx,
6846                                         WERROR *result)
6847 {
6848         struct dcerpc_spoolss_DeleteForm_state *state = tevent_req_data(
6849                 req, struct dcerpc_spoolss_DeleteForm_state);
6850         NTSTATUS status;
6851
6852         if (tevent_req_is_nterror(req, &status)) {
6853                 tevent_req_received(req);
6854                 return status;
6855         }
6856
6857         /* Steal possible out parameters to the callers context */
6858         talloc_steal(mem_ctx, state->out_mem_ctx);
6859
6860         /* Return result */
6861         *result = state->orig.out.result;
6862
6863         tevent_req_received(req);
6864         return NT_STATUS_OK;
6865 }
6866
6867 NTSTATUS dcerpc_spoolss_DeleteForm(struct dcerpc_binding_handle *h,
6868                                    TALLOC_CTX *mem_ctx,
6869                                    struct policy_handle *_handle /* [in] [ref] */,
6870                                    const char *_form_name /* [in] [charset(UTF16)] */,
6871                                    WERROR *result)
6872 {
6873         struct spoolss_DeleteForm r;
6874         NTSTATUS status;
6875
6876         /* In parameters */
6877         r.in.handle = _handle;
6878         r.in.form_name = _form_name;
6879
6880         status = dcerpc_spoolss_DeleteForm_r(h, mem_ctx, &r);
6881         if (!NT_STATUS_IS_OK(status)) {
6882                 return status;
6883         }
6884
6885         /* Return variables */
6886
6887         /* Return result */
6888         *result = r.out.result;
6889
6890         return NT_STATUS_OK;
6891 }
6892
6893 struct dcerpc_spoolss_GetForm_r_state {
6894         TALLOC_CTX *out_mem_ctx;
6895 };
6896
6897 static void dcerpc_spoolss_GetForm_r_done(struct tevent_req *subreq);
6898
6899 struct tevent_req *dcerpc_spoolss_GetForm_r_send(TALLOC_CTX *mem_ctx,
6900         struct tevent_context *ev,
6901         struct dcerpc_binding_handle *h,
6902         struct spoolss_GetForm *r)
6903 {
6904         struct tevent_req *req;
6905         struct dcerpc_spoolss_GetForm_r_state *state;
6906         struct tevent_req *subreq;
6907
6908         req = tevent_req_create(mem_ctx, &state,
6909                                 struct dcerpc_spoolss_GetForm_r_state);
6910         if (req == NULL) {
6911                 return NULL;
6912         }
6913
6914         state->out_mem_ctx = talloc_new(state);
6915         if (tevent_req_nomem(state->out_mem_ctx, req)) {
6916                 return tevent_req_post(req, ev);
6917         }
6918
6919         subreq = dcerpc_binding_handle_call_send(state, ev, h,
6920                         NULL, &ndr_table_spoolss,
6921                         NDR_SPOOLSS_GETFORM, state->out_mem_ctx, r);
6922         if (tevent_req_nomem(subreq, req)) {
6923                 return tevent_req_post(req, ev);
6924         }
6925         tevent_req_set_callback(subreq, dcerpc_spoolss_GetForm_r_done, req);
6926
6927         return req;
6928 }
6929
6930 static void dcerpc_spoolss_GetForm_r_done(struct tevent_req *subreq)
6931 {
6932         struct tevent_req *req =
6933                 tevent_req_callback_data(subreq,
6934                 struct tevent_req);
6935         NTSTATUS status;
6936
6937         status = dcerpc_binding_handle_call_recv(subreq);
6938         TALLOC_FREE(subreq);
6939         if (tevent_req_nterror(req, status)) {
6940                 return;
6941         }
6942
6943         tevent_req_done(req);
6944 }
6945
6946 NTSTATUS dcerpc_spoolss_GetForm_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
6947 {
6948         struct dcerpc_spoolss_GetForm_r_state *state =
6949                 tevent_req_data(req,
6950                 struct dcerpc_spoolss_GetForm_r_state);
6951         NTSTATUS status;
6952
6953         if (tevent_req_is_nterror(req, &status)) {
6954                 tevent_req_received(req);
6955                 return status;
6956         }
6957
6958         talloc_steal(mem_ctx, state->out_mem_ctx);
6959
6960         tevent_req_received(req);
6961         return NT_STATUS_OK;
6962 }
6963
6964 NTSTATUS dcerpc_spoolss_GetForm_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_GetForm *r)
6965 {
6966         NTSTATUS status;
6967
6968         status = dcerpc_binding_handle_call(h,
6969                         NULL, &ndr_table_spoolss,
6970                         NDR_SPOOLSS_GETFORM, mem_ctx, r);
6971
6972         return status;
6973 }
6974
6975 struct dcerpc_spoolss_GetForm_state {
6976         struct spoolss_GetForm orig;
6977         struct spoolss_GetForm tmp;
6978         TALLOC_CTX *out_mem_ctx;
6979 };
6980
6981 static void dcerpc_spoolss_GetForm_done(struct tevent_req *subreq);
6982
6983 struct tevent_req *dcerpc_spoolss_GetForm_send(TALLOC_CTX *mem_ctx,
6984                                                struct tevent_context *ev,
6985                                                struct dcerpc_binding_handle *h,
6986                                                struct policy_handle *_handle /* [in] [ref] */,
6987                                                const char *_form_name /* [in] [charset(UTF16)] */,
6988                                                uint32_t _level /* [in]  */,
6989                                                DATA_BLOB *_buffer /* [in] [unique] */,
6990                                                uint32_t _offered /* [in]  */,
6991                                                union spoolss_FormInfo *_info /* [out] [unique,subcontext_size(offered),subcontext(4),switch_is(level)] */,
6992                                                uint32_t *_needed /* [out] [ref] */)
6993 {
6994         struct tevent_req *req;
6995         struct dcerpc_spoolss_GetForm_state *state;
6996         struct tevent_req *subreq;
6997
6998         req = tevent_req_create(mem_ctx, &state,
6999                                 struct dcerpc_spoolss_GetForm_state);
7000         if (req == NULL) {
7001                 return NULL;
7002         }
7003         state->out_mem_ctx = NULL;
7004
7005         /* In parameters */
7006         state->orig.in.handle = _handle;
7007         state->orig.in.form_name = _form_name;
7008         state->orig.in.level = _level;
7009         state->orig.in.buffer = _buffer;
7010         state->orig.in.offered = _offered;
7011
7012         /* Out parameters */
7013         state->orig.out.info = _info;
7014         state->orig.out.needed = _needed;
7015
7016         /* Result */
7017         ZERO_STRUCT(state->orig.out.result);
7018
7019         state->out_mem_ctx = talloc_named_const(state, 0,
7020                              "dcerpc_spoolss_GetForm_out_memory");
7021         if (tevent_req_nomem(state->out_mem_ctx, req)) {
7022                 return tevent_req_post(req, ev);
7023         }
7024
7025         /* make a temporary copy, that we pass to the dispatch function */
7026         state->tmp = state->orig;
7027
7028         subreq = dcerpc_spoolss_GetForm_r_send(state, ev, h, &state->tmp);
7029         if (tevent_req_nomem(subreq, req)) {
7030                 return tevent_req_post(req, ev);
7031         }
7032         tevent_req_set_callback(subreq, dcerpc_spoolss_GetForm_done, req);
7033         return req;
7034 }
7035
7036 static void dcerpc_spoolss_GetForm_done(struct tevent_req *subreq)
7037 {
7038         struct tevent_req *req = tevent_req_callback_data(
7039                 subreq, struct tevent_req);
7040         struct dcerpc_spoolss_GetForm_state *state = tevent_req_data(
7041                 req, struct dcerpc_spoolss_GetForm_state);
7042         NTSTATUS status;
7043         TALLOC_CTX *mem_ctx;
7044
7045         if (state->out_mem_ctx) {
7046                 mem_ctx = state->out_mem_ctx;
7047         } else {
7048                 mem_ctx = state;
7049         }
7050
7051         status = dcerpc_spoolss_GetForm_r_recv(subreq, mem_ctx);
7052         TALLOC_FREE(subreq);
7053         if (tevent_req_nterror(req, status)) {
7054                 return;
7055         }
7056
7057         /* Copy out parameters */
7058         if (state->orig.out.info && state->tmp.out.info) {
7059                 *state->orig.out.info = *state->tmp.out.info;
7060         }
7061         *state->orig.out.needed = *state->tmp.out.needed;
7062
7063         /* Copy result */
7064         state->orig.out.result = state->tmp.out.result;
7065
7066         /* Reset temporary structure */
7067         ZERO_STRUCT(state->tmp);
7068
7069         tevent_req_done(req);
7070 }
7071
7072 NTSTATUS dcerpc_spoolss_GetForm_recv(struct tevent_req *req,
7073                                      TALLOC_CTX *mem_ctx,
7074                                      WERROR *result)
7075 {
7076         struct dcerpc_spoolss_GetForm_state *state = tevent_req_data(
7077                 req, struct dcerpc_spoolss_GetForm_state);
7078         NTSTATUS status;
7079
7080         if (tevent_req_is_nterror(req, &status)) {
7081                 tevent_req_received(req);
7082                 return status;
7083         }
7084
7085         /* Steal possible out parameters to the callers context */
7086         talloc_steal(mem_ctx, state->out_mem_ctx);
7087
7088         /* Return result */
7089         *result = state->orig.out.result;
7090
7091         tevent_req_received(req);
7092         return NT_STATUS_OK;
7093 }
7094
7095 NTSTATUS dcerpc_spoolss_GetForm(struct dcerpc_binding_handle *h,
7096                                 TALLOC_CTX *mem_ctx,
7097                                 struct policy_handle *_handle /* [in] [ref] */,
7098                                 const char *_form_name /* [in] [charset(UTF16)] */,
7099                                 uint32_t _level /* [in]  */,
7100                                 DATA_BLOB *_buffer /* [in] [unique] */,
7101                                 uint32_t _offered /* [in]  */,
7102                                 union spoolss_FormInfo *_info /* [out] [unique,subcontext_size(offered),subcontext(4),switch_is(level)] */,
7103                                 uint32_t *_needed /* [out] [ref] */,
7104                                 WERROR *result)
7105 {
7106         struct spoolss_GetForm r;
7107         NTSTATUS status;
7108
7109         /* In parameters */
7110         r.in.handle = _handle;
7111         r.in.form_name = _form_name;
7112         r.in.level = _level;
7113         r.in.buffer = _buffer;
7114         r.in.offered = _offered;
7115
7116         status = dcerpc_spoolss_GetForm_r(h, mem_ctx, &r);
7117         if (!NT_STATUS_IS_OK(status)) {
7118                 return status;
7119         }
7120
7121         /* Return variables */
7122         if (_info && r.out.info) {
7123                 *_info = *r.out.info;
7124         }
7125         *_needed = *r.out.needed;
7126
7127         /* Return result */
7128         *result = r.out.result;
7129
7130         return NT_STATUS_OK;
7131 }
7132
7133 struct dcerpc_spoolss_SetForm_r_state {
7134         TALLOC_CTX *out_mem_ctx;
7135 };
7136
7137 static void dcerpc_spoolss_SetForm_r_done(struct tevent_req *subreq);
7138
7139 struct tevent_req *dcerpc_spoolss_SetForm_r_send(TALLOC_CTX *mem_ctx,
7140         struct tevent_context *ev,
7141         struct dcerpc_binding_handle *h,
7142         struct spoolss_SetForm *r)
7143 {
7144         struct tevent_req *req;
7145         struct dcerpc_spoolss_SetForm_r_state *state;
7146         struct tevent_req *subreq;
7147
7148         req = tevent_req_create(mem_ctx, &state,
7149                                 struct dcerpc_spoolss_SetForm_r_state);
7150         if (req == NULL) {
7151                 return NULL;
7152         }
7153
7154         state->out_mem_ctx = NULL;
7155
7156         subreq = dcerpc_binding_handle_call_send(state, ev, h,
7157                         NULL, &ndr_table_spoolss,
7158                         NDR_SPOOLSS_SETFORM, state, r);
7159         if (tevent_req_nomem(subreq, req)) {
7160                 return tevent_req_post(req, ev);
7161         }
7162         tevent_req_set_callback(subreq, dcerpc_spoolss_SetForm_r_done, req);
7163
7164         return req;
7165 }
7166
7167 static void dcerpc_spoolss_SetForm_r_done(struct tevent_req *subreq)
7168 {
7169         struct tevent_req *req =
7170                 tevent_req_callback_data(subreq,
7171                 struct tevent_req);
7172         NTSTATUS status;
7173
7174         status = dcerpc_binding_handle_call_recv(subreq);
7175         TALLOC_FREE(subreq);
7176         if (tevent_req_nterror(req, status)) {
7177                 return;
7178         }
7179
7180         tevent_req_done(req);
7181 }
7182
7183 NTSTATUS dcerpc_spoolss_SetForm_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
7184 {
7185         struct dcerpc_spoolss_SetForm_r_state *state =
7186                 tevent_req_data(req,
7187                 struct dcerpc_spoolss_SetForm_r_state);
7188         NTSTATUS status;
7189
7190         if (tevent_req_is_nterror(req, &status)) {
7191                 tevent_req_received(req);
7192                 return status;
7193         }
7194
7195         talloc_steal(mem_ctx, state->out_mem_ctx);
7196
7197         tevent_req_received(req);
7198         return NT_STATUS_OK;
7199 }
7200
7201 NTSTATUS dcerpc_spoolss_SetForm_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_SetForm *r)
7202 {
7203         NTSTATUS status;
7204
7205         status = dcerpc_binding_handle_call(h,
7206                         NULL, &ndr_table_spoolss,
7207                         NDR_SPOOLSS_SETFORM, mem_ctx, r);
7208
7209         return status;
7210 }
7211
7212 struct dcerpc_spoolss_SetForm_state {
7213         struct spoolss_SetForm orig;
7214         struct spoolss_SetForm tmp;
7215         TALLOC_CTX *out_mem_ctx;
7216 };
7217
7218 static void dcerpc_spoolss_SetForm_done(struct tevent_req *subreq);
7219
7220 struct tevent_req *dcerpc_spoolss_SetForm_send(TALLOC_CTX *mem_ctx,
7221                                                struct tevent_context *ev,
7222                                                struct dcerpc_binding_handle *h,
7223                                                struct policy_handle *_handle /* [in] [ref] */,
7224                                                const char *_form_name /* [in] [charset(UTF16)] */,
7225                                                struct spoolss_AddFormInfoCtr *_info_ctr /* [in] [ref] */)
7226 {
7227         struct tevent_req *req;
7228         struct dcerpc_spoolss_SetForm_state *state;
7229         struct tevent_req *subreq;
7230
7231         req = tevent_req_create(mem_ctx, &state,
7232                                 struct dcerpc_spoolss_SetForm_state);
7233         if (req == NULL) {
7234                 return NULL;
7235         }
7236         state->out_mem_ctx = NULL;
7237
7238         /* In parameters */
7239         state->orig.in.handle = _handle;
7240         state->orig.in.form_name = _form_name;
7241         state->orig.in.info_ctr = _info_ctr;
7242
7243         /* Out parameters */
7244
7245         /* Result */
7246         ZERO_STRUCT(state->orig.out.result);
7247
7248         /* make a temporary copy, that we pass to the dispatch function */
7249         state->tmp = state->orig;
7250
7251         subreq = dcerpc_spoolss_SetForm_r_send(state, ev, h, &state->tmp);
7252         if (tevent_req_nomem(subreq, req)) {
7253                 return tevent_req_post(req, ev);
7254         }
7255         tevent_req_set_callback(subreq, dcerpc_spoolss_SetForm_done, req);
7256         return req;
7257 }
7258
7259 static void dcerpc_spoolss_SetForm_done(struct tevent_req *subreq)
7260 {
7261         struct tevent_req *req = tevent_req_callback_data(
7262                 subreq, struct tevent_req);
7263         struct dcerpc_spoolss_SetForm_state *state = tevent_req_data(
7264                 req, struct dcerpc_spoolss_SetForm_state);
7265         NTSTATUS status;
7266         TALLOC_CTX *mem_ctx;
7267
7268         if (state->out_mem_ctx) {
7269                 mem_ctx = state->out_mem_ctx;
7270         } else {
7271                 mem_ctx = state;
7272         }
7273
7274         status = dcerpc_spoolss_SetForm_r_recv(subreq, mem_ctx);
7275         TALLOC_FREE(subreq);
7276         if (tevent_req_nterror(req, status)) {
7277                 return;
7278         }
7279
7280         /* Copy out parameters */
7281
7282         /* Copy result */
7283         state->orig.out.result = state->tmp.out.result;
7284
7285         /* Reset temporary structure */
7286         ZERO_STRUCT(state->tmp);
7287
7288         tevent_req_done(req);
7289 }
7290
7291 NTSTATUS dcerpc_spoolss_SetForm_recv(struct tevent_req *req,
7292                                      TALLOC_CTX *mem_ctx,
7293                                      WERROR *result)
7294 {
7295         struct dcerpc_spoolss_SetForm_state *state = tevent_req_data(
7296                 req, struct dcerpc_spoolss_SetForm_state);
7297         NTSTATUS status;
7298
7299         if (tevent_req_is_nterror(req, &status)) {
7300                 tevent_req_received(req);
7301                 return status;
7302         }
7303
7304         /* Steal possible out parameters to the callers context */
7305         talloc_steal(mem_ctx, state->out_mem_ctx);
7306
7307         /* Return result */
7308         *result = state->orig.out.result;
7309
7310         tevent_req_received(req);
7311         return NT_STATUS_OK;
7312 }
7313
7314 NTSTATUS dcerpc_spoolss_SetForm(struct dcerpc_binding_handle *h,
7315                                 TALLOC_CTX *mem_ctx,
7316                                 struct policy_handle *_handle /* [in] [ref] */,
7317                                 const char *_form_name /* [in] [charset(UTF16)] */,
7318                                 struct spoolss_AddFormInfoCtr *_info_ctr /* [in] [ref] */,
7319                                 WERROR *result)
7320 {
7321         struct spoolss_SetForm r;
7322         NTSTATUS status;
7323
7324         /* In parameters */
7325         r.in.handle = _handle;
7326         r.in.form_name = _form_name;
7327         r.in.info_ctr = _info_ctr;
7328
7329         status = dcerpc_spoolss_SetForm_r(h, mem_ctx, &r);
7330         if (!NT_STATUS_IS_OK(status)) {
7331                 return status;
7332         }
7333
7334         /* Return variables */
7335
7336         /* Return result */
7337         *result = r.out.result;
7338
7339         return NT_STATUS_OK;
7340 }
7341
7342 struct dcerpc_spoolss_EnumForms_r_state {
7343         TALLOC_CTX *out_mem_ctx;
7344 };
7345
7346 static void dcerpc_spoolss_EnumForms_r_done(struct tevent_req *subreq);
7347
7348 struct tevent_req *dcerpc_spoolss_EnumForms_r_send(TALLOC_CTX *mem_ctx,
7349         struct tevent_context *ev,
7350         struct dcerpc_binding_handle *h,
7351         struct spoolss_EnumForms *r)
7352 {
7353         struct tevent_req *req;
7354         struct dcerpc_spoolss_EnumForms_r_state *state;
7355         struct tevent_req *subreq;
7356
7357         req = tevent_req_create(mem_ctx, &state,
7358                                 struct dcerpc_spoolss_EnumForms_r_state);
7359         if (req == NULL) {
7360                 return NULL;
7361         }
7362
7363         state->out_mem_ctx = talloc_new(state);
7364         if (tevent_req_nomem(state->out_mem_ctx, req)) {
7365                 return tevent_req_post(req, ev);
7366         }
7367
7368         subreq = dcerpc_binding_handle_call_send(state, ev, h,
7369                         NULL, &ndr_table_spoolss,
7370                         NDR_SPOOLSS_ENUMFORMS, state->out_mem_ctx, r);
7371         if (tevent_req_nomem(subreq, req)) {
7372                 return tevent_req_post(req, ev);
7373         }
7374         tevent_req_set_callback(subreq, dcerpc_spoolss_EnumForms_r_done, req);
7375
7376         return req;
7377 }
7378
7379 static void dcerpc_spoolss_EnumForms_r_done(struct tevent_req *subreq)
7380 {
7381         struct tevent_req *req =
7382                 tevent_req_callback_data(subreq,
7383                 struct tevent_req);
7384         NTSTATUS status;
7385
7386         status = dcerpc_binding_handle_call_recv(subreq);
7387         TALLOC_FREE(subreq);
7388         if (tevent_req_nterror(req, status)) {
7389                 return;
7390         }
7391
7392         tevent_req_done(req);
7393 }
7394
7395 NTSTATUS dcerpc_spoolss_EnumForms_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
7396 {
7397         struct dcerpc_spoolss_EnumForms_r_state *state =
7398                 tevent_req_data(req,
7399                 struct dcerpc_spoolss_EnumForms_r_state);
7400         NTSTATUS status;
7401
7402         if (tevent_req_is_nterror(req, &status)) {
7403                 tevent_req_received(req);
7404                 return status;
7405         }
7406
7407         talloc_steal(mem_ctx, state->out_mem_ctx);
7408
7409         tevent_req_received(req);
7410         return NT_STATUS_OK;
7411 }
7412
7413 NTSTATUS dcerpc_spoolss_EnumForms_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_EnumForms *r)
7414 {
7415         NTSTATUS status;
7416
7417         status = dcerpc_binding_handle_call(h,
7418                         NULL, &ndr_table_spoolss,
7419                         NDR_SPOOLSS_ENUMFORMS, mem_ctx, r);
7420
7421         return status;
7422 }
7423
7424 struct dcerpc_spoolss_EnumForms_state {
7425         struct spoolss_EnumForms orig;
7426         struct spoolss_EnumForms tmp;
7427         TALLOC_CTX *out_mem_ctx;
7428 };
7429
7430 static void dcerpc_spoolss_EnumForms_done(struct tevent_req *subreq);
7431
7432 struct tevent_req *dcerpc_spoolss_EnumForms_send(TALLOC_CTX *mem_ctx,
7433                                                  struct tevent_context *ev,
7434                                                  struct dcerpc_binding_handle *h,
7435                                                  struct policy_handle *_handle /* [in] [ref] */,
7436                                                  uint32_t _level /* [in]  */,
7437                                                  DATA_BLOB *_buffer /* [in] [unique] */,
7438                                                  uint32_t _offered /* [in]  */,
7439                                                  uint32_t *_count /* [out] [ref] */,
7440                                                  union spoolss_FormInfo **_info /* [out] [ref,switch_is(level),size_is(,*count)] */,
7441                                                  uint32_t *_needed /* [out] [ref] */)
7442 {
7443         struct tevent_req *req;
7444         struct dcerpc_spoolss_EnumForms_state *state;
7445         struct tevent_req *subreq;
7446
7447         req = tevent_req_create(mem_ctx, &state,
7448                                 struct dcerpc_spoolss_EnumForms_state);
7449         if (req == NULL) {
7450                 return NULL;
7451         }
7452         state->out_mem_ctx = NULL;
7453
7454         /* In parameters */
7455         state->orig.in.handle = _handle;
7456         state->orig.in.level = _level;
7457         state->orig.in.buffer = _buffer;
7458         state->orig.in.offered = _offered;
7459
7460         /* Out parameters */
7461         state->orig.out.count = _count;
7462         state->orig.out.info = _info;
7463         state->orig.out.needed = _needed;
7464
7465         /* Result */
7466         ZERO_STRUCT(state->orig.out.result);
7467
7468         state->out_mem_ctx = talloc_named_const(state, 0,
7469                              "dcerpc_spoolss_EnumForms_out_memory");
7470         if (tevent_req_nomem(state->out_mem_ctx, req)) {
7471                 return tevent_req_post(req, ev);
7472         }
7473
7474         /* make a temporary copy, that we pass to the dispatch function */
7475         state->tmp = state->orig;
7476
7477         subreq = dcerpc_spoolss_EnumForms_r_send(state, ev, h, &state->tmp);
7478         if (tevent_req_nomem(subreq, req)) {
7479                 return tevent_req_post(req, ev);
7480         }
7481         tevent_req_set_callback(subreq, dcerpc_spoolss_EnumForms_done, req);
7482         return req;
7483 }
7484
7485 static void dcerpc_spoolss_EnumForms_done(struct tevent_req *subreq)
7486 {
7487         struct tevent_req *req = tevent_req_callback_data(
7488                 subreq, struct tevent_req);
7489         struct dcerpc_spoolss_EnumForms_state *state = tevent_req_data(
7490                 req, struct dcerpc_spoolss_EnumForms_state);
7491         NTSTATUS status;
7492         TALLOC_CTX *mem_ctx;
7493
7494         if (state->out_mem_ctx) {
7495                 mem_ctx = state->out_mem_ctx;
7496         } else {
7497                 mem_ctx = state;
7498         }
7499
7500         status = dcerpc_spoolss_EnumForms_r_recv(subreq, mem_ctx);
7501         TALLOC_FREE(subreq);
7502         if (tevent_req_nterror(req, status)) {
7503                 return;
7504         }
7505
7506         /* Copy out parameters */
7507         *state->orig.out.count = *state->tmp.out.count;
7508         *state->orig.out.info = *state->tmp.out.info;
7509         *state->orig.out.needed = *state->tmp.out.needed;
7510
7511         /* Copy result */
7512         state->orig.out.result = state->tmp.out.result;
7513
7514         /* Reset temporary structure */
7515         ZERO_STRUCT(state->tmp);
7516
7517         tevent_req_done(req);
7518 }
7519
7520 NTSTATUS dcerpc_spoolss_EnumForms_recv(struct tevent_req *req,
7521                                        TALLOC_CTX *mem_ctx,
7522                                        WERROR *result)
7523 {
7524         struct dcerpc_spoolss_EnumForms_state *state = tevent_req_data(
7525                 req, struct dcerpc_spoolss_EnumForms_state);
7526         NTSTATUS status;
7527
7528         if (tevent_req_is_nterror(req, &status)) {
7529                 tevent_req_received(req);
7530                 return status;
7531         }
7532
7533         /* Steal possible out parameters to the callers context */
7534         talloc_steal(mem_ctx, state->out_mem_ctx);
7535
7536         /* Return result */
7537         *result = state->orig.out.result;
7538
7539         tevent_req_received(req);
7540         return NT_STATUS_OK;
7541 }
7542
7543 NTSTATUS dcerpc_spoolss_EnumForms(struct dcerpc_binding_handle *h,
7544                                   TALLOC_CTX *mem_ctx,
7545                                   struct policy_handle *_handle /* [in] [ref] */,
7546                                   uint32_t _level /* [in]  */,
7547                                   DATA_BLOB *_buffer /* [in] [unique] */,
7548                                   uint32_t _offered /* [in]  */,
7549                                   uint32_t *_count /* [out] [ref] */,
7550                                   union spoolss_FormInfo **_info /* [out] [ref,switch_is(level),size_is(,*count)] */,
7551                                   uint32_t *_needed /* [out] [ref] */,
7552                                   WERROR *result)
7553 {
7554         struct spoolss_EnumForms r;
7555         NTSTATUS status;
7556
7557         /* In parameters */
7558         r.in.handle = _handle;
7559         r.in.level = _level;
7560         r.in.buffer = _buffer;
7561         r.in.offered = _offered;
7562
7563         status = dcerpc_spoolss_EnumForms_r(h, mem_ctx, &r);
7564         if (!NT_STATUS_IS_OK(status)) {
7565                 return status;
7566         }
7567
7568         /* Return variables */
7569         *_count = *r.out.count;
7570         *_info = *r.out.info;
7571         *_needed = *r.out.needed;
7572
7573         /* Return result */
7574         *result = r.out.result;
7575
7576         return NT_STATUS_OK;
7577 }
7578
7579 struct dcerpc_spoolss_EnumPorts_r_state {
7580         TALLOC_CTX *out_mem_ctx;
7581 };
7582
7583 static void dcerpc_spoolss_EnumPorts_r_done(struct tevent_req *subreq);
7584
7585 struct tevent_req *dcerpc_spoolss_EnumPorts_r_send(TALLOC_CTX *mem_ctx,
7586         struct tevent_context *ev,
7587         struct dcerpc_binding_handle *h,
7588         struct spoolss_EnumPorts *r)
7589 {
7590         struct tevent_req *req;
7591         struct dcerpc_spoolss_EnumPorts_r_state *state;
7592         struct tevent_req *subreq;
7593
7594         req = tevent_req_create(mem_ctx, &state,
7595                                 struct dcerpc_spoolss_EnumPorts_r_state);
7596         if (req == NULL) {
7597                 return NULL;
7598         }
7599
7600         state->out_mem_ctx = talloc_new(state);
7601         if (tevent_req_nomem(state->out_mem_ctx, req)) {
7602                 return tevent_req_post(req, ev);
7603         }
7604
7605         subreq = dcerpc_binding_handle_call_send(state, ev, h,
7606                         NULL, &ndr_table_spoolss,
7607                         NDR_SPOOLSS_ENUMPORTS, state->out_mem_ctx, r);
7608         if (tevent_req_nomem(subreq, req)) {
7609                 return tevent_req_post(req, ev);
7610         }
7611         tevent_req_set_callback(subreq, dcerpc_spoolss_EnumPorts_r_done, req);
7612
7613         return req;
7614 }
7615
7616 static void dcerpc_spoolss_EnumPorts_r_done(struct tevent_req *subreq)
7617 {
7618         struct tevent_req *req =
7619                 tevent_req_callback_data(subreq,
7620                 struct tevent_req);
7621         NTSTATUS status;
7622
7623         status = dcerpc_binding_handle_call_recv(subreq);
7624         TALLOC_FREE(subreq);
7625         if (tevent_req_nterror(req, status)) {
7626                 return;
7627         }
7628
7629         tevent_req_done(req);
7630 }
7631
7632 NTSTATUS dcerpc_spoolss_EnumPorts_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
7633 {
7634         struct dcerpc_spoolss_EnumPorts_r_state *state =
7635                 tevent_req_data(req,
7636                 struct dcerpc_spoolss_EnumPorts_r_state);
7637         NTSTATUS status;
7638
7639         if (tevent_req_is_nterror(req, &status)) {
7640                 tevent_req_received(req);
7641                 return status;
7642         }
7643
7644         talloc_steal(mem_ctx, state->out_mem_ctx);
7645
7646         tevent_req_received(req);
7647         return NT_STATUS_OK;
7648 }
7649
7650 NTSTATUS dcerpc_spoolss_EnumPorts_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_EnumPorts *r)
7651 {
7652         NTSTATUS status;
7653
7654         status = dcerpc_binding_handle_call(h,
7655                         NULL, &ndr_table_spoolss,
7656                         NDR_SPOOLSS_ENUMPORTS, mem_ctx, r);
7657
7658         return status;
7659 }
7660
7661 struct dcerpc_spoolss_EnumPorts_state {
7662         struct spoolss_EnumPorts orig;
7663         struct spoolss_EnumPorts tmp;
7664         TALLOC_CTX *out_mem_ctx;
7665 };
7666
7667 static void dcerpc_spoolss_EnumPorts_done(struct tevent_req *subreq);
7668
7669 struct tevent_req *dcerpc_spoolss_EnumPorts_send(TALLOC_CTX *mem_ctx,
7670                                                  struct tevent_context *ev,
7671                                                  struct dcerpc_binding_handle *h,
7672                                                  const char *_servername /* [in] [unique,charset(UTF16)] */,
7673                                                  uint32_t _level /* [in]  */,
7674                                                  DATA_BLOB *_buffer /* [in] [unique] */,
7675                                                  uint32_t _offered /* [in]  */,
7676                                                  uint32_t *_count /* [out] [ref] */,
7677                                                  union spoolss_PortInfo **_info /* [out] [ref,switch_is(level),size_is(,*count)] */,
7678                                                  uint32_t *_needed /* [out] [ref] */)
7679 {
7680         struct tevent_req *req;
7681         struct dcerpc_spoolss_EnumPorts_state *state;
7682         struct tevent_req *subreq;
7683
7684         req = tevent_req_create(mem_ctx, &state,
7685                                 struct dcerpc_spoolss_EnumPorts_state);
7686         if (req == NULL) {
7687                 return NULL;
7688         }
7689         state->out_mem_ctx = NULL;
7690
7691         /* In parameters */
7692         state->orig.in.servername = _servername;
7693         state->orig.in.level = _level;
7694         state->orig.in.buffer = _buffer;
7695         state->orig.in.offered = _offered;
7696
7697         /* Out parameters */
7698         state->orig.out.count = _count;
7699         state->orig.out.info = _info;
7700         state->orig.out.needed = _needed;
7701
7702         /* Result */
7703         ZERO_STRUCT(state->orig.out.result);
7704
7705         state->out_mem_ctx = talloc_named_const(state, 0,
7706                              "dcerpc_spoolss_EnumPorts_out_memory");
7707         if (tevent_req_nomem(state->out_mem_ctx, req)) {
7708                 return tevent_req_post(req, ev);
7709         }
7710
7711         /* make a temporary copy, that we pass to the dispatch function */
7712         state->tmp = state->orig;
7713
7714         subreq = dcerpc_spoolss_EnumPorts_r_send(state, ev, h, &state->tmp);
7715         if (tevent_req_nomem(subreq, req)) {
7716                 return tevent_req_post(req, ev);
7717         }
7718         tevent_req_set_callback(subreq, dcerpc_spoolss_EnumPorts_done, req);
7719         return req;
7720 }
7721
7722 static void dcerpc_spoolss_EnumPorts_done(struct tevent_req *subreq)
7723 {
7724         struct tevent_req *req = tevent_req_callback_data(
7725                 subreq, struct tevent_req);
7726         struct dcerpc_spoolss_EnumPorts_state *state = tevent_req_data(
7727                 req, struct dcerpc_spoolss_EnumPorts_state);
7728         NTSTATUS status;
7729         TALLOC_CTX *mem_ctx;
7730
7731         if (state->out_mem_ctx) {
7732                 mem_ctx = state->out_mem_ctx;
7733         } else {
7734                 mem_ctx = state;
7735         }
7736
7737         status = dcerpc_spoolss_EnumPorts_r_recv(subreq, mem_ctx);
7738         TALLOC_FREE(subreq);
7739         if (tevent_req_nterror(req, status)) {
7740                 return;
7741         }
7742
7743         /* Copy out parameters */
7744         *state->orig.out.count = *state->tmp.out.count;
7745         *state->orig.out.info = *state->tmp.out.info;
7746         *state->orig.out.needed = *state->tmp.out.needed;
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 dcerpc_spoolss_EnumPorts_recv(struct tevent_req *req,
7758                                        TALLOC_CTX *mem_ctx,
7759                                        WERROR *result)
7760 {
7761         struct dcerpc_spoolss_EnumPorts_state *state = tevent_req_data(
7762                 req, struct dcerpc_spoolss_EnumPorts_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 possible 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 dcerpc_spoolss_EnumPorts(struct dcerpc_binding_handle *h,
7781                                   TALLOC_CTX *mem_ctx,
7782                                   const char *_servername /* [in] [unique,charset(UTF16)] */,
7783                                   uint32_t _level /* [in]  */,
7784                                   DATA_BLOB *_buffer /* [in] [unique] */,
7785                                   uint32_t _offered /* [in]  */,
7786                                   uint32_t *_count /* [out] [ref] */,
7787                                   union spoolss_PortInfo **_info /* [out] [ref,switch_is(level),size_is(,*count)] */,
7788                                   uint32_t *_needed /* [out] [ref] */,
7789                                   WERROR *result)
7790 {
7791         struct spoolss_EnumPorts r;
7792         NTSTATUS status;
7793
7794         /* In parameters */
7795         r.in.servername = _servername;
7796         r.in.level = _level;
7797         r.in.buffer = _buffer;
7798         r.in.offered = _offered;
7799
7800         status = dcerpc_spoolss_EnumPorts_r(h, mem_ctx, &r);
7801         if (!NT_STATUS_IS_OK(status)) {
7802                 return status;
7803         }
7804
7805         /* Return variables */
7806         *_count = *r.out.count;
7807         *_info = *r.out.info;
7808         *_needed = *r.out.needed;
7809
7810         /* Return result */
7811         *result = r.out.result;
7812
7813         return NT_STATUS_OK;
7814 }
7815
7816 struct dcerpc_spoolss_EnumMonitors_r_state {
7817         TALLOC_CTX *out_mem_ctx;
7818 };
7819
7820 static void dcerpc_spoolss_EnumMonitors_r_done(struct tevent_req *subreq);
7821
7822 struct tevent_req *dcerpc_spoolss_EnumMonitors_r_send(TALLOC_CTX *mem_ctx,
7823         struct tevent_context *ev,
7824         struct dcerpc_binding_handle *h,
7825         struct spoolss_EnumMonitors *r)
7826 {
7827         struct tevent_req *req;
7828         struct dcerpc_spoolss_EnumMonitors_r_state *state;
7829         struct tevent_req *subreq;
7830
7831         req = tevent_req_create(mem_ctx, &state,
7832                                 struct dcerpc_spoolss_EnumMonitors_r_state);
7833         if (req == NULL) {
7834                 return NULL;
7835         }
7836
7837         state->out_mem_ctx = talloc_new(state);
7838         if (tevent_req_nomem(state->out_mem_ctx, req)) {
7839                 return tevent_req_post(req, ev);
7840         }
7841
7842         subreq = dcerpc_binding_handle_call_send(state, ev, h,
7843                         NULL, &ndr_table_spoolss,
7844                         NDR_SPOOLSS_ENUMMONITORS, state->out_mem_ctx, r);
7845         if (tevent_req_nomem(subreq, req)) {
7846                 return tevent_req_post(req, ev);
7847         }
7848         tevent_req_set_callback(subreq, dcerpc_spoolss_EnumMonitors_r_done, req);
7849
7850         return req;
7851 }
7852
7853 static void dcerpc_spoolss_EnumMonitors_r_done(struct tevent_req *subreq)
7854 {
7855         struct tevent_req *req =
7856                 tevent_req_callback_data(subreq,
7857                 struct tevent_req);
7858         NTSTATUS status;
7859
7860         status = dcerpc_binding_handle_call_recv(subreq);
7861         TALLOC_FREE(subreq);
7862         if (tevent_req_nterror(req, status)) {
7863                 return;
7864         }
7865
7866         tevent_req_done(req);
7867 }
7868
7869 NTSTATUS dcerpc_spoolss_EnumMonitors_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
7870 {
7871         struct dcerpc_spoolss_EnumMonitors_r_state *state =
7872                 tevent_req_data(req,
7873                 struct dcerpc_spoolss_EnumMonitors_r_state);
7874         NTSTATUS status;
7875
7876         if (tevent_req_is_nterror(req, &status)) {
7877                 tevent_req_received(req);
7878                 return status;
7879         }
7880
7881         talloc_steal(mem_ctx, state->out_mem_ctx);
7882
7883         tevent_req_received(req);
7884         return NT_STATUS_OK;
7885 }
7886
7887 NTSTATUS dcerpc_spoolss_EnumMonitors_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_EnumMonitors *r)
7888 {
7889         NTSTATUS status;
7890
7891         status = dcerpc_binding_handle_call(h,
7892                         NULL, &ndr_table_spoolss,
7893                         NDR_SPOOLSS_ENUMMONITORS, mem_ctx, r);
7894
7895         return status;
7896 }
7897
7898 struct dcerpc_spoolss_EnumMonitors_state {
7899         struct spoolss_EnumMonitors orig;
7900         struct spoolss_EnumMonitors tmp;
7901         TALLOC_CTX *out_mem_ctx;
7902 };
7903
7904 static void dcerpc_spoolss_EnumMonitors_done(struct tevent_req *subreq);
7905
7906 struct tevent_req *dcerpc_spoolss_EnumMonitors_send(TALLOC_CTX *mem_ctx,
7907                                                     struct tevent_context *ev,
7908                                                     struct dcerpc_binding_handle *h,
7909                                                     const char *_servername /* [in] [unique,charset(UTF16)] */,
7910                                                     uint32_t _level /* [in]  */,
7911                                                     DATA_BLOB *_buffer /* [in] [unique] */,
7912                                                     uint32_t _offered /* [in]  */,
7913                                                     uint32_t *_count /* [out] [ref] */,
7914                                                     union spoolss_MonitorInfo **_info /* [out] [ref,switch_is(level),size_is(,*count)] */,
7915                                                     uint32_t *_needed /* [out] [ref] */)
7916 {
7917         struct tevent_req *req;
7918         struct dcerpc_spoolss_EnumMonitors_state *state;
7919         struct tevent_req *subreq;
7920
7921         req = tevent_req_create(mem_ctx, &state,
7922                                 struct dcerpc_spoolss_EnumMonitors_state);
7923         if (req == NULL) {
7924                 return NULL;
7925         }
7926         state->out_mem_ctx = NULL;
7927
7928         /* In parameters */
7929         state->orig.in.servername = _servername;
7930         state->orig.in.level = _level;
7931         state->orig.in.buffer = _buffer;
7932         state->orig.in.offered = _offered;
7933
7934         /* Out parameters */
7935         state->orig.out.count = _count;
7936         state->orig.out.info = _info;
7937         state->orig.out.needed = _needed;
7938
7939         /* Result */
7940         ZERO_STRUCT(state->orig.out.result);
7941
7942         state->out_mem_ctx = talloc_named_const(state, 0,
7943                              "dcerpc_spoolss_EnumMonitors_out_memory");
7944         if (tevent_req_nomem(state->out_mem_ctx, req)) {
7945                 return tevent_req_post(req, ev);
7946         }
7947
7948         /* make a temporary copy, that we pass to the dispatch function */
7949         state->tmp = state->orig;
7950
7951         subreq = dcerpc_spoolss_EnumMonitors_r_send(state, ev, h, &state->tmp);
7952         if (tevent_req_nomem(subreq, req)) {
7953                 return tevent_req_post(req, ev);
7954         }
7955         tevent_req_set_callback(subreq, dcerpc_spoolss_EnumMonitors_done, req);
7956         return req;
7957 }
7958
7959 static void dcerpc_spoolss_EnumMonitors_done(struct tevent_req *subreq)
7960 {
7961         struct tevent_req *req = tevent_req_callback_data(
7962                 subreq, struct tevent_req);
7963         struct dcerpc_spoolss_EnumMonitors_state *state = tevent_req_data(
7964                 req, struct dcerpc_spoolss_EnumMonitors_state);
7965         NTSTATUS status;
7966         TALLOC_CTX *mem_ctx;
7967
7968         if (state->out_mem_ctx) {
7969                 mem_ctx = state->out_mem_ctx;
7970         } else {
7971                 mem_ctx = state;
7972         }
7973
7974         status = dcerpc_spoolss_EnumMonitors_r_recv(subreq, mem_ctx);
7975         TALLOC_FREE(subreq);
7976         if (tevent_req_nterror(req, status)) {
7977                 return;
7978         }
7979
7980         /* Copy out parameters */
7981         *state->orig.out.count = *state->tmp.out.count;
7982         *state->orig.out.info = *state->tmp.out.info;
7983         *state->orig.out.needed = *state->tmp.out.needed;
7984
7985         /* Copy result */
7986         state->orig.out.result = state->tmp.out.result;
7987
7988         /* Reset temporary structure */
7989         ZERO_STRUCT(state->tmp);
7990
7991         tevent_req_done(req);
7992 }
7993
7994 NTSTATUS dcerpc_spoolss_EnumMonitors_recv(struct tevent_req *req,
7995                                           TALLOC_CTX *mem_ctx,
7996                                           WERROR *result)
7997 {
7998         struct dcerpc_spoolss_EnumMonitors_state *state = tevent_req_data(
7999                 req, struct dcerpc_spoolss_EnumMonitors_state);
8000         NTSTATUS status;
8001
8002         if (tevent_req_is_nterror(req, &status)) {
8003                 tevent_req_received(req);
8004                 return status;
8005         }
8006
8007         /* Steal possible out parameters to the callers context */
8008         talloc_steal(mem_ctx, state->out_mem_ctx);
8009
8010         /* Return result */
8011         *result = state->orig.out.result;
8012
8013         tevent_req_received(req);
8014         return NT_STATUS_OK;
8015 }
8016
8017 NTSTATUS dcerpc_spoolss_EnumMonitors(struct dcerpc_binding_handle *h,
8018                                      TALLOC_CTX *mem_ctx,
8019                                      const char *_servername /* [in] [unique,charset(UTF16)] */,
8020                                      uint32_t _level /* [in]  */,
8021                                      DATA_BLOB *_buffer /* [in] [unique] */,
8022                                      uint32_t _offered /* [in]  */,
8023                                      uint32_t *_count /* [out] [ref] */,
8024                                      union spoolss_MonitorInfo **_info /* [out] [ref,switch_is(level),size_is(,*count)] */,
8025                                      uint32_t *_needed /* [out] [ref] */,
8026                                      WERROR *result)
8027 {
8028         struct spoolss_EnumMonitors r;
8029         NTSTATUS status;
8030
8031         /* In parameters */
8032         r.in.servername = _servername;
8033         r.in.level = _level;
8034         r.in.buffer = _buffer;
8035         r.in.offered = _offered;
8036
8037         status = dcerpc_spoolss_EnumMonitors_r(h, mem_ctx, &r);
8038         if (!NT_STATUS_IS_OK(status)) {
8039                 return status;
8040         }
8041
8042         /* Return variables */
8043         *_count = *r.out.count;
8044         *_info = *r.out.info;
8045         *_needed = *r.out.needed;
8046
8047         /* Return result */
8048         *result = r.out.result;
8049
8050         return NT_STATUS_OK;
8051 }
8052
8053 struct dcerpc_spoolss_AddPort_r_state {
8054         TALLOC_CTX *out_mem_ctx;
8055 };
8056
8057 static void dcerpc_spoolss_AddPort_r_done(struct tevent_req *subreq);
8058
8059 struct tevent_req *dcerpc_spoolss_AddPort_r_send(TALLOC_CTX *mem_ctx,
8060         struct tevent_context *ev,
8061         struct dcerpc_binding_handle *h,
8062         struct spoolss_AddPort *r)
8063 {
8064         struct tevent_req *req;
8065         struct dcerpc_spoolss_AddPort_r_state *state;
8066         struct tevent_req *subreq;
8067
8068         req = tevent_req_create(mem_ctx, &state,
8069                                 struct dcerpc_spoolss_AddPort_r_state);
8070         if (req == NULL) {
8071                 return NULL;
8072         }
8073
8074         state->out_mem_ctx = NULL;
8075
8076         subreq = dcerpc_binding_handle_call_send(state, ev, h,
8077                         NULL, &ndr_table_spoolss,
8078                         NDR_SPOOLSS_ADDPORT, state, r);
8079         if (tevent_req_nomem(subreq, req)) {
8080                 return tevent_req_post(req, ev);
8081         }
8082         tevent_req_set_callback(subreq, dcerpc_spoolss_AddPort_r_done, req);
8083
8084         return req;
8085 }
8086
8087 static void dcerpc_spoolss_AddPort_r_done(struct tevent_req *subreq)
8088 {
8089         struct tevent_req *req =
8090                 tevent_req_callback_data(subreq,
8091                 struct tevent_req);
8092         NTSTATUS status;
8093
8094         status = dcerpc_binding_handle_call_recv(subreq);
8095         TALLOC_FREE(subreq);
8096         if (tevent_req_nterror(req, status)) {
8097                 return;
8098         }
8099
8100         tevent_req_done(req);
8101 }
8102
8103 NTSTATUS dcerpc_spoolss_AddPort_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
8104 {
8105         struct dcerpc_spoolss_AddPort_r_state *state =
8106                 tevent_req_data(req,
8107                 struct dcerpc_spoolss_AddPort_r_state);
8108         NTSTATUS status;
8109
8110         if (tevent_req_is_nterror(req, &status)) {
8111                 tevent_req_received(req);
8112                 return status;
8113         }
8114
8115         talloc_steal(mem_ctx, state->out_mem_ctx);
8116
8117         tevent_req_received(req);
8118         return NT_STATUS_OK;
8119 }
8120
8121 NTSTATUS dcerpc_spoolss_AddPort_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_AddPort *r)
8122 {
8123         NTSTATUS status;
8124
8125         status = dcerpc_binding_handle_call(h,
8126                         NULL, &ndr_table_spoolss,
8127                         NDR_SPOOLSS_ADDPORT, mem_ctx, r);
8128
8129         return status;
8130 }
8131
8132 struct dcerpc_spoolss_AddPort_state {
8133         struct spoolss_AddPort orig;
8134         struct spoolss_AddPort tmp;
8135         TALLOC_CTX *out_mem_ctx;
8136 };
8137
8138 static void dcerpc_spoolss_AddPort_done(struct tevent_req *subreq);
8139
8140 struct tevent_req *dcerpc_spoolss_AddPort_send(TALLOC_CTX *mem_ctx,
8141                                                struct tevent_context *ev,
8142                                                struct dcerpc_binding_handle *h,
8143                                                const char *_server_name /* [in] [unique,charset(UTF16)] */,
8144                                                uint32_t _unknown /* [in]  */,
8145                                                const char *_monitor_name /* [in] [charset(UTF16)] */)
8146 {
8147         struct tevent_req *req;
8148         struct dcerpc_spoolss_AddPort_state *state;
8149         struct tevent_req *subreq;
8150
8151         req = tevent_req_create(mem_ctx, &state,
8152                                 struct dcerpc_spoolss_AddPort_state);
8153         if (req == NULL) {
8154                 return NULL;
8155         }
8156         state->out_mem_ctx = NULL;
8157
8158         /* In parameters */
8159         state->orig.in.server_name = _server_name;
8160         state->orig.in.unknown = _unknown;
8161         state->orig.in.monitor_name = _monitor_name;
8162
8163         /* Out parameters */
8164
8165         /* Result */
8166         ZERO_STRUCT(state->orig.out.result);
8167
8168         /* make a temporary copy, that we pass to the dispatch function */
8169         state->tmp = state->orig;
8170
8171         subreq = dcerpc_spoolss_AddPort_r_send(state, ev, h, &state->tmp);
8172         if (tevent_req_nomem(subreq, req)) {
8173                 return tevent_req_post(req, ev);
8174         }
8175         tevent_req_set_callback(subreq, dcerpc_spoolss_AddPort_done, req);
8176         return req;
8177 }
8178
8179 static void dcerpc_spoolss_AddPort_done(struct tevent_req *subreq)
8180 {
8181         struct tevent_req *req = tevent_req_callback_data(
8182                 subreq, struct tevent_req);
8183         struct dcerpc_spoolss_AddPort_state *state = tevent_req_data(
8184                 req, struct dcerpc_spoolss_AddPort_state);
8185         NTSTATUS status;
8186         TALLOC_CTX *mem_ctx;
8187
8188         if (state->out_mem_ctx) {
8189                 mem_ctx = state->out_mem_ctx;
8190         } else {
8191                 mem_ctx = state;
8192         }
8193
8194         status = dcerpc_spoolss_AddPort_r_recv(subreq, mem_ctx);
8195         TALLOC_FREE(subreq);
8196         if (tevent_req_nterror(req, status)) {
8197                 return;
8198         }
8199
8200         /* Copy out parameters */
8201
8202         /* Copy result */
8203         state->orig.out.result = state->tmp.out.result;
8204
8205         /* Reset temporary structure */
8206         ZERO_STRUCT(state->tmp);
8207
8208         tevent_req_done(req);
8209 }
8210
8211 NTSTATUS dcerpc_spoolss_AddPort_recv(struct tevent_req *req,
8212                                      TALLOC_CTX *mem_ctx,
8213                                      WERROR *result)
8214 {
8215         struct dcerpc_spoolss_AddPort_state *state = tevent_req_data(
8216                 req, struct dcerpc_spoolss_AddPort_state);
8217         NTSTATUS status;
8218
8219         if (tevent_req_is_nterror(req, &status)) {
8220                 tevent_req_received(req);
8221                 return status;
8222         }
8223
8224         /* Steal possible out parameters to the callers context */
8225         talloc_steal(mem_ctx, state->out_mem_ctx);
8226
8227         /* Return result */
8228         *result = state->orig.out.result;
8229
8230         tevent_req_received(req);
8231         return NT_STATUS_OK;
8232 }
8233
8234 NTSTATUS dcerpc_spoolss_AddPort(struct dcerpc_binding_handle *h,
8235                                 TALLOC_CTX *mem_ctx,
8236                                 const char *_server_name /* [in] [unique,charset(UTF16)] */,
8237                                 uint32_t _unknown /* [in]  */,
8238                                 const char *_monitor_name /* [in] [charset(UTF16)] */,
8239                                 WERROR *result)
8240 {
8241         struct spoolss_AddPort r;
8242         NTSTATUS status;
8243
8244         /* In parameters */
8245         r.in.server_name = _server_name;
8246         r.in.unknown = _unknown;
8247         r.in.monitor_name = _monitor_name;
8248
8249         status = dcerpc_spoolss_AddPort_r(h, mem_ctx, &r);
8250         if (!NT_STATUS_IS_OK(status)) {
8251                 return status;
8252         }
8253
8254         /* Return variables */
8255
8256         /* Return result */
8257         *result = r.out.result;
8258
8259         return NT_STATUS_OK;
8260 }
8261
8262 struct dcerpc_spoolss_DeletePort_r_state {
8263         TALLOC_CTX *out_mem_ctx;
8264 };
8265
8266 static void dcerpc_spoolss_DeletePort_r_done(struct tevent_req *subreq);
8267
8268 struct tevent_req *dcerpc_spoolss_DeletePort_r_send(TALLOC_CTX *mem_ctx,
8269         struct tevent_context *ev,
8270         struct dcerpc_binding_handle *h,
8271         struct spoolss_DeletePort *r)
8272 {
8273         struct tevent_req *req;
8274         struct dcerpc_spoolss_DeletePort_r_state *state;
8275         struct tevent_req *subreq;
8276
8277         req = tevent_req_create(mem_ctx, &state,
8278                                 struct dcerpc_spoolss_DeletePort_r_state);
8279         if (req == NULL) {
8280                 return NULL;
8281         }
8282
8283         state->out_mem_ctx = NULL;
8284
8285         subreq = dcerpc_binding_handle_call_send(state, ev, h,
8286                         NULL, &ndr_table_spoolss,
8287                         NDR_SPOOLSS_DELETEPORT, state, r);
8288         if (tevent_req_nomem(subreq, req)) {
8289                 return tevent_req_post(req, ev);
8290         }
8291         tevent_req_set_callback(subreq, dcerpc_spoolss_DeletePort_r_done, req);
8292
8293         return req;
8294 }
8295
8296 static void dcerpc_spoolss_DeletePort_r_done(struct tevent_req *subreq)
8297 {
8298         struct tevent_req *req =
8299                 tevent_req_callback_data(subreq,
8300                 struct tevent_req);
8301         NTSTATUS status;
8302
8303         status = dcerpc_binding_handle_call_recv(subreq);
8304         TALLOC_FREE(subreq);
8305         if (tevent_req_nterror(req, status)) {
8306                 return;
8307         }
8308
8309         tevent_req_done(req);
8310 }
8311
8312 NTSTATUS dcerpc_spoolss_DeletePort_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
8313 {
8314         struct dcerpc_spoolss_DeletePort_r_state *state =
8315                 tevent_req_data(req,
8316                 struct dcerpc_spoolss_DeletePort_r_state);
8317         NTSTATUS status;
8318
8319         if (tevent_req_is_nterror(req, &status)) {
8320                 tevent_req_received(req);
8321                 return status;
8322         }
8323
8324         talloc_steal(mem_ctx, state->out_mem_ctx);
8325
8326         tevent_req_received(req);
8327         return NT_STATUS_OK;
8328 }
8329
8330 NTSTATUS dcerpc_spoolss_DeletePort_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_DeletePort *r)
8331 {
8332         NTSTATUS status;
8333
8334         status = dcerpc_binding_handle_call(h,
8335                         NULL, &ndr_table_spoolss,
8336                         NDR_SPOOLSS_DELETEPORT, mem_ctx, r);
8337
8338         return status;
8339 }
8340
8341 struct dcerpc_spoolss_DeletePort_state {
8342         struct spoolss_DeletePort orig;
8343         struct spoolss_DeletePort tmp;
8344         TALLOC_CTX *out_mem_ctx;
8345 };
8346
8347 static void dcerpc_spoolss_DeletePort_done(struct tevent_req *subreq);
8348
8349 struct tevent_req *dcerpc_spoolss_DeletePort_send(TALLOC_CTX *mem_ctx,
8350                                                   struct tevent_context *ev,
8351                                                   struct dcerpc_binding_handle *h,
8352                                                   const char *_server_name /* [in] [unique,charset(UTF16)] */,
8353                                                   uint32_t _ptr /* [in]  */,
8354                                                   const char *_port_name /* [in] [ref,charset(UTF16)] */)
8355 {
8356         struct tevent_req *req;
8357         struct dcerpc_spoolss_DeletePort_state *state;
8358         struct tevent_req *subreq;
8359
8360         req = tevent_req_create(mem_ctx, &state,
8361                                 struct dcerpc_spoolss_DeletePort_state);
8362         if (req == NULL) {
8363                 return NULL;
8364         }
8365         state->out_mem_ctx = NULL;
8366
8367         /* In parameters */
8368         state->orig.in.server_name = _server_name;
8369         state->orig.in.ptr = _ptr;
8370         state->orig.in.port_name = _port_name;
8371
8372         /* Out parameters */
8373
8374         /* Result */
8375         ZERO_STRUCT(state->orig.out.result);
8376
8377         /* make a temporary copy, that we pass to the dispatch function */
8378         state->tmp = state->orig;
8379
8380         subreq = dcerpc_spoolss_DeletePort_r_send(state, ev, h, &state->tmp);
8381         if (tevent_req_nomem(subreq, req)) {
8382                 return tevent_req_post(req, ev);
8383         }
8384         tevent_req_set_callback(subreq, dcerpc_spoolss_DeletePort_done, req);
8385         return req;
8386 }
8387
8388 static void dcerpc_spoolss_DeletePort_done(struct tevent_req *subreq)
8389 {
8390         struct tevent_req *req = tevent_req_callback_data(
8391                 subreq, struct tevent_req);
8392         struct dcerpc_spoolss_DeletePort_state *state = tevent_req_data(
8393                 req, struct dcerpc_spoolss_DeletePort_state);
8394         NTSTATUS status;
8395         TALLOC_CTX *mem_ctx;
8396
8397         if (state->out_mem_ctx) {
8398                 mem_ctx = state->out_mem_ctx;
8399         } else {
8400                 mem_ctx = state;
8401         }
8402
8403         status = dcerpc_spoolss_DeletePort_r_recv(subreq, mem_ctx);
8404         TALLOC_FREE(subreq);
8405         if (tevent_req_nterror(req, status)) {
8406                 return;
8407         }
8408
8409         /* Copy out parameters */
8410
8411         /* Copy result */
8412         state->orig.out.result = state->tmp.out.result;
8413
8414         /* Reset temporary structure */
8415         ZERO_STRUCT(state->tmp);
8416
8417         tevent_req_done(req);
8418 }
8419
8420 NTSTATUS dcerpc_spoolss_DeletePort_recv(struct tevent_req *req,
8421                                         TALLOC_CTX *mem_ctx,
8422                                         WERROR *result)
8423 {
8424         struct dcerpc_spoolss_DeletePort_state *state = tevent_req_data(
8425                 req, struct dcerpc_spoolss_DeletePort_state);
8426         NTSTATUS status;
8427
8428         if (tevent_req_is_nterror(req, &status)) {
8429                 tevent_req_received(req);
8430                 return status;
8431         }
8432
8433         /* Steal possible out parameters to the callers context */
8434         talloc_steal(mem_ctx, state->out_mem_ctx);
8435
8436         /* Return result */
8437         *result = state->orig.out.result;
8438
8439         tevent_req_received(req);
8440         return NT_STATUS_OK;
8441 }
8442
8443 NTSTATUS dcerpc_spoolss_DeletePort(struct dcerpc_binding_handle *h,
8444                                    TALLOC_CTX *mem_ctx,
8445                                    const char *_server_name /* [in] [unique,charset(UTF16)] */,
8446                                    uint32_t _ptr /* [in]  */,
8447                                    const char *_port_name /* [in] [ref,charset(UTF16)] */,
8448                                    WERROR *result)
8449 {
8450         struct spoolss_DeletePort r;
8451         NTSTATUS status;
8452
8453         /* In parameters */
8454         r.in.server_name = _server_name;
8455         r.in.ptr = _ptr;
8456         r.in.port_name = _port_name;
8457
8458         status = dcerpc_spoolss_DeletePort_r(h, mem_ctx, &r);
8459         if (!NT_STATUS_IS_OK(status)) {
8460                 return status;
8461         }
8462
8463         /* Return variables */
8464
8465         /* Return result */
8466         *result = r.out.result;
8467
8468         return NT_STATUS_OK;
8469 }
8470
8471 struct dcerpc_spoolss_CreatePrinterIC_r_state {
8472         TALLOC_CTX *out_mem_ctx;
8473 };
8474
8475 static void dcerpc_spoolss_CreatePrinterIC_r_done(struct tevent_req *subreq);
8476
8477 struct tevent_req *dcerpc_spoolss_CreatePrinterIC_r_send(TALLOC_CTX *mem_ctx,
8478         struct tevent_context *ev,
8479         struct dcerpc_binding_handle *h,
8480         struct spoolss_CreatePrinterIC *r)
8481 {
8482         struct tevent_req *req;
8483         struct dcerpc_spoolss_CreatePrinterIC_r_state *state;
8484         struct tevent_req *subreq;
8485
8486         req = tevent_req_create(mem_ctx, &state,
8487                                 struct dcerpc_spoolss_CreatePrinterIC_r_state);
8488         if (req == NULL) {
8489                 return NULL;
8490         }
8491
8492         state->out_mem_ctx = talloc_new(state);
8493         if (tevent_req_nomem(state->out_mem_ctx, req)) {
8494                 return tevent_req_post(req, ev);
8495         }
8496
8497         subreq = dcerpc_binding_handle_call_send(state, ev, h,
8498                         NULL, &ndr_table_spoolss,
8499                         NDR_SPOOLSS_CREATEPRINTERIC, state->out_mem_ctx, r);
8500         if (tevent_req_nomem(subreq, req)) {
8501                 return tevent_req_post(req, ev);
8502         }
8503         tevent_req_set_callback(subreq, dcerpc_spoolss_CreatePrinterIC_r_done, req);
8504
8505         return req;
8506 }
8507
8508 static void dcerpc_spoolss_CreatePrinterIC_r_done(struct tevent_req *subreq)
8509 {
8510         struct tevent_req *req =
8511                 tevent_req_callback_data(subreq,
8512                 struct tevent_req);
8513         NTSTATUS status;
8514
8515         status = dcerpc_binding_handle_call_recv(subreq);
8516         TALLOC_FREE(subreq);
8517         if (tevent_req_nterror(req, status)) {
8518                 return;
8519         }
8520
8521         tevent_req_done(req);
8522 }
8523
8524 NTSTATUS dcerpc_spoolss_CreatePrinterIC_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
8525 {
8526         struct dcerpc_spoolss_CreatePrinterIC_r_state *state =
8527                 tevent_req_data(req,
8528                 struct dcerpc_spoolss_CreatePrinterIC_r_state);
8529         NTSTATUS status;
8530
8531         if (tevent_req_is_nterror(req, &status)) {
8532                 tevent_req_received(req);
8533                 return status;
8534         }
8535
8536         talloc_steal(mem_ctx, state->out_mem_ctx);
8537
8538         tevent_req_received(req);
8539         return NT_STATUS_OK;
8540 }
8541
8542 NTSTATUS dcerpc_spoolss_CreatePrinterIC_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_CreatePrinterIC *r)
8543 {
8544         NTSTATUS status;
8545
8546         status = dcerpc_binding_handle_call(h,
8547                         NULL, &ndr_table_spoolss,
8548                         NDR_SPOOLSS_CREATEPRINTERIC, mem_ctx, r);
8549
8550         return status;
8551 }
8552
8553 struct dcerpc_spoolss_CreatePrinterIC_state {
8554         struct spoolss_CreatePrinterIC orig;
8555         struct spoolss_CreatePrinterIC tmp;
8556         TALLOC_CTX *out_mem_ctx;
8557 };
8558
8559 static void dcerpc_spoolss_CreatePrinterIC_done(struct tevent_req *subreq);
8560
8561 struct tevent_req *dcerpc_spoolss_CreatePrinterIC_send(TALLOC_CTX *mem_ctx,
8562                                                        struct tevent_context *ev,
8563                                                        struct dcerpc_binding_handle *h,
8564                                                        struct policy_handle *_handle /* [in] [ref] */,
8565                                                        struct policy_handle *_gdi_handle /* [out] [ref] */,
8566                                                        struct spoolss_DevmodeContainer *_devmode_ctr /* [in] [ref] */)
8567 {
8568         struct tevent_req *req;
8569         struct dcerpc_spoolss_CreatePrinterIC_state *state;
8570         struct tevent_req *subreq;
8571
8572         req = tevent_req_create(mem_ctx, &state,
8573                                 struct dcerpc_spoolss_CreatePrinterIC_state);
8574         if (req == NULL) {
8575                 return NULL;
8576         }
8577         state->out_mem_ctx = NULL;
8578
8579         /* In parameters */
8580         state->orig.in.handle = _handle;
8581         state->orig.in.devmode_ctr = _devmode_ctr;
8582
8583         /* Out parameters */
8584         state->orig.out.gdi_handle = _gdi_handle;
8585
8586         /* Result */
8587         ZERO_STRUCT(state->orig.out.result);
8588
8589         state->out_mem_ctx = talloc_named_const(state, 0,
8590                              "dcerpc_spoolss_CreatePrinterIC_out_memory");
8591         if (tevent_req_nomem(state->out_mem_ctx, req)) {
8592                 return tevent_req_post(req, ev);
8593         }
8594
8595         /* make a temporary copy, that we pass to the dispatch function */
8596         state->tmp = state->orig;
8597
8598         subreq = dcerpc_spoolss_CreatePrinterIC_r_send(state, ev, h, &state->tmp);
8599         if (tevent_req_nomem(subreq, req)) {
8600                 return tevent_req_post(req, ev);
8601         }
8602         tevent_req_set_callback(subreq, dcerpc_spoolss_CreatePrinterIC_done, req);
8603         return req;
8604 }
8605
8606 static void dcerpc_spoolss_CreatePrinterIC_done(struct tevent_req *subreq)
8607 {
8608         struct tevent_req *req = tevent_req_callback_data(
8609                 subreq, struct tevent_req);
8610         struct dcerpc_spoolss_CreatePrinterIC_state *state = tevent_req_data(
8611                 req, struct dcerpc_spoolss_CreatePrinterIC_state);
8612         NTSTATUS status;
8613         TALLOC_CTX *mem_ctx;
8614
8615         if (state->out_mem_ctx) {
8616                 mem_ctx = state->out_mem_ctx;
8617         } else {
8618                 mem_ctx = state;
8619         }
8620
8621         status = dcerpc_spoolss_CreatePrinterIC_r_recv(subreq, mem_ctx);
8622         TALLOC_FREE(subreq);
8623         if (tevent_req_nterror(req, status)) {
8624                 return;
8625         }
8626
8627         /* Copy out parameters */
8628         *state->orig.out.gdi_handle = *state->tmp.out.gdi_handle;
8629
8630         /* Copy result */
8631         state->orig.out.result = state->tmp.out.result;
8632
8633         /* Reset temporary structure */
8634         ZERO_STRUCT(state->tmp);
8635
8636         tevent_req_done(req);
8637 }
8638
8639 NTSTATUS dcerpc_spoolss_CreatePrinterIC_recv(struct tevent_req *req,
8640                                              TALLOC_CTX *mem_ctx,
8641                                              WERROR *result)
8642 {
8643         struct dcerpc_spoolss_CreatePrinterIC_state *state = tevent_req_data(
8644                 req, struct dcerpc_spoolss_CreatePrinterIC_state);
8645         NTSTATUS status;
8646
8647         if (tevent_req_is_nterror(req, &status)) {
8648                 tevent_req_received(req);
8649                 return status;
8650         }
8651
8652         /* Steal possible out parameters to the callers context */
8653         talloc_steal(mem_ctx, state->out_mem_ctx);
8654
8655         /* Return result */
8656         *result = state->orig.out.result;
8657
8658         tevent_req_received(req);
8659         return NT_STATUS_OK;
8660 }
8661
8662 NTSTATUS dcerpc_spoolss_CreatePrinterIC(struct dcerpc_binding_handle *h,
8663                                         TALLOC_CTX *mem_ctx,
8664                                         struct policy_handle *_handle /* [in] [ref] */,
8665                                         struct policy_handle *_gdi_handle /* [out] [ref] */,
8666                                         struct spoolss_DevmodeContainer *_devmode_ctr /* [in] [ref] */,
8667                                         WERROR *result)
8668 {
8669         struct spoolss_CreatePrinterIC r;
8670         NTSTATUS status;
8671
8672         /* In parameters */
8673         r.in.handle = _handle;
8674         r.in.devmode_ctr = _devmode_ctr;
8675
8676         status = dcerpc_spoolss_CreatePrinterIC_r(h, mem_ctx, &r);
8677         if (!NT_STATUS_IS_OK(status)) {
8678                 return status;
8679         }
8680
8681         /* Return variables */
8682         *_gdi_handle = *r.out.gdi_handle;
8683
8684         /* Return result */
8685         *result = r.out.result;
8686
8687         return NT_STATUS_OK;
8688 }
8689
8690 struct dcerpc_spoolss_PlayGDIScriptOnPrinterIC_r_state {
8691         TALLOC_CTX *out_mem_ctx;
8692 };
8693
8694 static void dcerpc_spoolss_PlayGDIScriptOnPrinterIC_r_done(struct tevent_req *subreq);
8695
8696 struct tevent_req *dcerpc_spoolss_PlayGDIScriptOnPrinterIC_r_send(TALLOC_CTX *mem_ctx,
8697         struct tevent_context *ev,
8698         struct dcerpc_binding_handle *h,
8699         struct spoolss_PlayGDIScriptOnPrinterIC *r)
8700 {
8701         struct tevent_req *req;
8702         struct dcerpc_spoolss_PlayGDIScriptOnPrinterIC_r_state *state;
8703         struct tevent_req *subreq;
8704
8705         req = tevent_req_create(mem_ctx, &state,
8706                                 struct dcerpc_spoolss_PlayGDIScriptOnPrinterIC_r_state);
8707         if (req == NULL) {
8708                 return NULL;
8709         }
8710
8711         state->out_mem_ctx = talloc_new(state);
8712         if (tevent_req_nomem(state->out_mem_ctx, req)) {
8713                 return tevent_req_post(req, ev);
8714         }
8715
8716         subreq = dcerpc_binding_handle_call_send(state, ev, h,
8717                         NULL, &ndr_table_spoolss,
8718                         NDR_SPOOLSS_PLAYGDISCRIPTONPRINTERIC, state->out_mem_ctx, r);
8719         if (tevent_req_nomem(subreq, req)) {
8720                 return tevent_req_post(req, ev);
8721         }
8722         tevent_req_set_callback(subreq, dcerpc_spoolss_PlayGDIScriptOnPrinterIC_r_done, req);
8723
8724         return req;
8725 }
8726
8727 static void dcerpc_spoolss_PlayGDIScriptOnPrinterIC_r_done(struct tevent_req *subreq)
8728 {
8729         struct tevent_req *req =
8730                 tevent_req_callback_data(subreq,
8731                 struct tevent_req);
8732         NTSTATUS status;
8733
8734         status = dcerpc_binding_handle_call_recv(subreq);
8735         TALLOC_FREE(subreq);
8736         if (tevent_req_nterror(req, status)) {
8737                 return;
8738         }
8739
8740         tevent_req_done(req);
8741 }
8742
8743 NTSTATUS dcerpc_spoolss_PlayGDIScriptOnPrinterIC_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
8744 {
8745         struct dcerpc_spoolss_PlayGDIScriptOnPrinterIC_r_state *state =
8746                 tevent_req_data(req,
8747                 struct dcerpc_spoolss_PlayGDIScriptOnPrinterIC_r_state);
8748         NTSTATUS status;
8749
8750         if (tevent_req_is_nterror(req, &status)) {
8751                 tevent_req_received(req);
8752                 return status;
8753         }
8754
8755         talloc_steal(mem_ctx, state->out_mem_ctx);
8756
8757         tevent_req_received(req);
8758         return NT_STATUS_OK;
8759 }
8760
8761 NTSTATUS dcerpc_spoolss_PlayGDIScriptOnPrinterIC_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_PlayGDIScriptOnPrinterIC *r)
8762 {
8763         NTSTATUS status;
8764
8765         status = dcerpc_binding_handle_call(h,
8766                         NULL, &ndr_table_spoolss,
8767                         NDR_SPOOLSS_PLAYGDISCRIPTONPRINTERIC, mem_ctx, r);
8768
8769         return status;
8770 }
8771
8772 struct dcerpc_spoolss_PlayGDIScriptOnPrinterIC_state {
8773         struct spoolss_PlayGDIScriptOnPrinterIC orig;
8774         struct spoolss_PlayGDIScriptOnPrinterIC tmp;
8775         TALLOC_CTX *out_mem_ctx;
8776 };
8777
8778 static void dcerpc_spoolss_PlayGDIScriptOnPrinterIC_done(struct tevent_req *subreq);
8779
8780 struct tevent_req *dcerpc_spoolss_PlayGDIScriptOnPrinterIC_send(TALLOC_CTX *mem_ctx,
8781                                                                 struct tevent_context *ev,
8782                                                                 struct dcerpc_binding_handle *h,
8783                                                                 struct policy_handle *_gdi_handle /* [in] [ref] */,
8784                                                                 uint8_t *_pIn /* [in] [ref,size_is(cIn)] */,
8785                                                                 uint32_t _cIn /* [in]  */,
8786                                                                 uint8_t *_pOut /* [out] [ref,size_is(cOut)] */,
8787                                                                 uint32_t _cOut /* [in]  */,
8788                                                                 uint32_t _ul /* [in]  */)
8789 {
8790         struct tevent_req *req;
8791         struct dcerpc_spoolss_PlayGDIScriptOnPrinterIC_state *state;
8792         struct tevent_req *subreq;
8793
8794         req = tevent_req_create(mem_ctx, &state,
8795                                 struct dcerpc_spoolss_PlayGDIScriptOnPrinterIC_state);
8796         if (req == NULL) {
8797                 return NULL;
8798         }
8799         state->out_mem_ctx = NULL;
8800
8801         /* In parameters */
8802         state->orig.in.gdi_handle = _gdi_handle;
8803         state->orig.in.pIn = _pIn;
8804         state->orig.in.cIn = _cIn;
8805         state->orig.in.cOut = _cOut;
8806         state->orig.in.ul = _ul;
8807
8808         /* Out parameters */
8809         state->orig.out.pOut = _pOut;
8810
8811         /* Result */
8812         ZERO_STRUCT(state->orig.out.result);
8813
8814         state->out_mem_ctx = talloc_named_const(state, 0,
8815                              "dcerpc_spoolss_PlayGDIScriptOnPrinterIC_out_memory");
8816         if (tevent_req_nomem(state->out_mem_ctx, req)) {
8817                 return tevent_req_post(req, ev);
8818         }
8819
8820         /* make a temporary copy, that we pass to the dispatch function */
8821         state->tmp = state->orig;
8822
8823         subreq = dcerpc_spoolss_PlayGDIScriptOnPrinterIC_r_send(state, ev, h, &state->tmp);
8824         if (tevent_req_nomem(subreq, req)) {
8825                 return tevent_req_post(req, ev);
8826         }
8827         tevent_req_set_callback(subreq, dcerpc_spoolss_PlayGDIScriptOnPrinterIC_done, req);
8828         return req;
8829 }
8830
8831 static void dcerpc_spoolss_PlayGDIScriptOnPrinterIC_done(struct tevent_req *subreq)
8832 {
8833         struct tevent_req *req = tevent_req_callback_data(
8834                 subreq, struct tevent_req);
8835         struct dcerpc_spoolss_PlayGDIScriptOnPrinterIC_state *state = tevent_req_data(
8836                 req, struct dcerpc_spoolss_PlayGDIScriptOnPrinterIC_state);
8837         NTSTATUS status;
8838         TALLOC_CTX *mem_ctx;
8839
8840         if (state->out_mem_ctx) {
8841                 mem_ctx = state->out_mem_ctx;
8842         } else {
8843                 mem_ctx = state;
8844         }
8845
8846         status = dcerpc_spoolss_PlayGDIScriptOnPrinterIC_r_recv(subreq, mem_ctx);
8847         TALLOC_FREE(subreq);
8848         if (tevent_req_nterror(req, status)) {
8849                 return;
8850         }
8851
8852         /* Copy out parameters */
8853         {
8854                 size_t _copy_len_pOut;
8855                 _copy_len_pOut = state->tmp.in.cOut;
8856                 memcpy(state->orig.out.pOut, state->tmp.out.pOut, _copy_len_pOut * sizeof(*state->orig.out.pOut));
8857         }
8858
8859         /* Copy result */
8860         state->orig.out.result = state->tmp.out.result;
8861
8862         /* Reset temporary structure */
8863         ZERO_STRUCT(state->tmp);
8864
8865         tevent_req_done(req);
8866 }
8867
8868 NTSTATUS dcerpc_spoolss_PlayGDIScriptOnPrinterIC_recv(struct tevent_req *req,
8869                                                       TALLOC_CTX *mem_ctx,
8870                                                       WERROR *result)
8871 {
8872         struct dcerpc_spoolss_PlayGDIScriptOnPrinterIC_state *state = tevent_req_data(
8873                 req, struct dcerpc_spoolss_PlayGDIScriptOnPrinterIC_state);
8874         NTSTATUS status;
8875
8876         if (tevent_req_is_nterror(req, &status)) {
8877                 tevent_req_received(req);
8878                 return status;
8879         }
8880
8881         /* Steal possible out parameters to the callers context */
8882         talloc_steal(mem_ctx, state->out_mem_ctx);
8883
8884         /* Return result */
8885         *result = state->orig.out.result;
8886
8887         tevent_req_received(req);
8888         return NT_STATUS_OK;
8889 }
8890
8891 NTSTATUS dcerpc_spoolss_PlayGDIScriptOnPrinterIC(struct dcerpc_binding_handle *h,
8892                                                  TALLOC_CTX *mem_ctx,
8893                                                  struct policy_handle *_gdi_handle /* [in] [ref] */,
8894                                                  uint8_t *_pIn /* [in] [ref,size_is(cIn)] */,
8895                                                  uint32_t _cIn /* [in]  */,
8896                                                  uint8_t *_pOut /* [out] [ref,size_is(cOut)] */,
8897                                                  uint32_t _cOut /* [in]  */,
8898                                                  uint32_t _ul /* [in]  */,
8899                                                  WERROR *result)
8900 {
8901         struct spoolss_PlayGDIScriptOnPrinterIC r;
8902         NTSTATUS status;
8903
8904         /* In parameters */
8905         r.in.gdi_handle = _gdi_handle;
8906         r.in.pIn = _pIn;
8907         r.in.cIn = _cIn;
8908         r.in.cOut = _cOut;
8909         r.in.ul = _ul;
8910
8911         status = dcerpc_spoolss_PlayGDIScriptOnPrinterIC_r(h, mem_ctx, &r);
8912         if (!NT_STATUS_IS_OK(status)) {
8913                 return status;
8914         }
8915
8916         /* Return variables */
8917         {
8918                 size_t _copy_len_pOut;
8919                 _copy_len_pOut = r.in.cOut;
8920                 memcpy(_pOut, r.out.pOut, _copy_len_pOut * sizeof(*_pOut));
8921         }
8922
8923         /* Return result */
8924         *result = r.out.result;
8925
8926         return NT_STATUS_OK;
8927 }
8928
8929 struct dcerpc_spoolss_DeletePrinterIC_r_state {
8930         TALLOC_CTX *out_mem_ctx;
8931 };
8932
8933 static void dcerpc_spoolss_DeletePrinterIC_r_done(struct tevent_req *subreq);
8934
8935 struct tevent_req *dcerpc_spoolss_DeletePrinterIC_r_send(TALLOC_CTX *mem_ctx,
8936         struct tevent_context *ev,
8937         struct dcerpc_binding_handle *h,
8938         struct spoolss_DeletePrinterIC *r)
8939 {
8940         struct tevent_req *req;
8941         struct dcerpc_spoolss_DeletePrinterIC_r_state *state;
8942         struct tevent_req *subreq;
8943
8944         req = tevent_req_create(mem_ctx, &state,
8945                                 struct dcerpc_spoolss_DeletePrinterIC_r_state);
8946         if (req == NULL) {
8947                 return NULL;
8948         }
8949
8950         state->out_mem_ctx = talloc_new(state);
8951         if (tevent_req_nomem(state->out_mem_ctx, req)) {
8952                 return tevent_req_post(req, ev);
8953         }
8954
8955         subreq = dcerpc_binding_handle_call_send(state, ev, h,
8956                         NULL, &ndr_table_spoolss,
8957                         NDR_SPOOLSS_DELETEPRINTERIC, state->out_mem_ctx, r);
8958         if (tevent_req_nomem(subreq, req)) {
8959                 return tevent_req_post(req, ev);
8960         }
8961         tevent_req_set_callback(subreq, dcerpc_spoolss_DeletePrinterIC_r_done, req);
8962
8963         return req;
8964 }
8965
8966 static void dcerpc_spoolss_DeletePrinterIC_r_done(struct tevent_req *subreq)
8967 {
8968         struct tevent_req *req =
8969                 tevent_req_callback_data(subreq,
8970                 struct tevent_req);
8971         NTSTATUS status;
8972
8973         status = dcerpc_binding_handle_call_recv(subreq);
8974         TALLOC_FREE(subreq);
8975         if (tevent_req_nterror(req, status)) {
8976                 return;
8977         }
8978
8979         tevent_req_done(req);
8980 }
8981
8982 NTSTATUS dcerpc_spoolss_DeletePrinterIC_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
8983 {
8984         struct dcerpc_spoolss_DeletePrinterIC_r_state *state =
8985                 tevent_req_data(req,
8986                 struct dcerpc_spoolss_DeletePrinterIC_r_state);
8987         NTSTATUS status;
8988
8989         if (tevent_req_is_nterror(req, &status)) {
8990                 tevent_req_received(req);
8991                 return status;
8992         }
8993
8994         talloc_steal(mem_ctx, state->out_mem_ctx);
8995
8996         tevent_req_received(req);
8997         return NT_STATUS_OK;
8998 }
8999
9000 NTSTATUS dcerpc_spoolss_DeletePrinterIC_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_DeletePrinterIC *r)
9001 {
9002         NTSTATUS status;
9003
9004         status = dcerpc_binding_handle_call(h,
9005                         NULL, &ndr_table_spoolss,
9006                         NDR_SPOOLSS_DELETEPRINTERIC, mem_ctx, r);
9007
9008         return status;
9009 }
9010
9011 struct dcerpc_spoolss_DeletePrinterIC_state {
9012         struct spoolss_DeletePrinterIC orig;
9013         struct spoolss_DeletePrinterIC tmp;
9014         TALLOC_CTX *out_mem_ctx;
9015 };
9016
9017 static void dcerpc_spoolss_DeletePrinterIC_done(struct tevent_req *subreq);
9018
9019 struct tevent_req *dcerpc_spoolss_DeletePrinterIC_send(TALLOC_CTX *mem_ctx,
9020                                                        struct tevent_context *ev,
9021                                                        struct dcerpc_binding_handle *h,
9022                                                        struct policy_handle *_gdi_handle /* [in,out] [ref] */)
9023 {
9024         struct tevent_req *req;
9025         struct dcerpc_spoolss_DeletePrinterIC_state *state;
9026         struct tevent_req *subreq;
9027
9028         req = tevent_req_create(mem_ctx, &state,
9029                                 struct dcerpc_spoolss_DeletePrinterIC_state);
9030         if (req == NULL) {
9031                 return NULL;
9032         }
9033         state->out_mem_ctx = NULL;
9034
9035         /* In parameters */
9036         state->orig.in.gdi_handle = _gdi_handle;
9037
9038         /* Out parameters */
9039         state->orig.out.gdi_handle = _gdi_handle;
9040
9041         /* Result */
9042         ZERO_STRUCT(state->orig.out.result);
9043
9044         state->out_mem_ctx = talloc_named_const(state, 0,
9045                              "dcerpc_spoolss_DeletePrinterIC_out_memory");
9046         if (tevent_req_nomem(state->out_mem_ctx, req)) {
9047                 return tevent_req_post(req, ev);
9048         }
9049
9050         /* make a temporary copy, that we pass to the dispatch function */
9051         state->tmp = state->orig;
9052
9053         subreq = dcerpc_spoolss_DeletePrinterIC_r_send(state, ev, h, &state->tmp);
9054         if (tevent_req_nomem(subreq, req)) {
9055                 return tevent_req_post(req, ev);
9056         }
9057         tevent_req_set_callback(subreq, dcerpc_spoolss_DeletePrinterIC_done, req);
9058         return req;
9059 }
9060
9061 static void dcerpc_spoolss_DeletePrinterIC_done(struct tevent_req *subreq)
9062 {
9063         struct tevent_req *req = tevent_req_callback_data(
9064                 subreq, struct tevent_req);
9065         struct dcerpc_spoolss_DeletePrinterIC_state *state = tevent_req_data(
9066                 req, struct dcerpc_spoolss_DeletePrinterIC_state);
9067         NTSTATUS status;
9068         TALLOC_CTX *mem_ctx;
9069
9070         if (state->out_mem_ctx) {
9071                 mem_ctx = state->out_mem_ctx;
9072         } else {
9073                 mem_ctx = state;
9074         }
9075
9076         status = dcerpc_spoolss_DeletePrinterIC_r_recv(subreq, mem_ctx);
9077         TALLOC_FREE(subreq);
9078         if (tevent_req_nterror(req, status)) {
9079                 return;
9080         }
9081
9082         /* Copy out parameters */
9083         *state->orig.out.gdi_handle = *state->tmp.out.gdi_handle;
9084
9085         /* Copy result */
9086         state->orig.out.result = state->tmp.out.result;
9087
9088         /* Reset temporary structure */
9089         ZERO_STRUCT(state->tmp);
9090
9091         tevent_req_done(req);
9092 }
9093
9094 NTSTATUS dcerpc_spoolss_DeletePrinterIC_recv(struct tevent_req *req,
9095                                              TALLOC_CTX *mem_ctx,
9096                                              WERROR *result)
9097 {
9098         struct dcerpc_spoolss_DeletePrinterIC_state *state = tevent_req_data(
9099                 req, struct dcerpc_spoolss_DeletePrinterIC_state);
9100         NTSTATUS status;
9101
9102         if (tevent_req_is_nterror(req, &status)) {
9103                 tevent_req_received(req);
9104                 return status;
9105         }
9106
9107         /* Steal possible out parameters to the callers context */
9108         talloc_steal(mem_ctx, state->out_mem_ctx);
9109
9110         /* Return result */
9111         *result = state->orig.out.result;
9112
9113         tevent_req_received(req);
9114         return NT_STATUS_OK;
9115 }
9116
9117 NTSTATUS dcerpc_spoolss_DeletePrinterIC(struct dcerpc_binding_handle *h,
9118                                         TALLOC_CTX *mem_ctx,
9119                                         struct policy_handle *_gdi_handle /* [in,out] [ref] */,
9120                                         WERROR *result)
9121 {
9122         struct spoolss_DeletePrinterIC r;
9123         NTSTATUS status;
9124
9125         /* In parameters */
9126         r.in.gdi_handle = _gdi_handle;
9127
9128         status = dcerpc_spoolss_DeletePrinterIC_r(h, mem_ctx, &r);
9129         if (!NT_STATUS_IS_OK(status)) {
9130                 return status;
9131         }
9132
9133         /* Return variables */
9134         *_gdi_handle = *r.out.gdi_handle;
9135
9136         /* Return result */
9137         *result = r.out.result;
9138
9139         return NT_STATUS_OK;
9140 }
9141
9142 struct dcerpc_spoolss_DeletePrintProcessor_r_state {
9143         TALLOC_CTX *out_mem_ctx;
9144 };
9145
9146 static void dcerpc_spoolss_DeletePrintProcessor_r_done(struct tevent_req *subreq);
9147
9148 struct tevent_req *dcerpc_spoolss_DeletePrintProcessor_r_send(TALLOC_CTX *mem_ctx,
9149         struct tevent_context *ev,
9150         struct dcerpc_binding_handle *h,
9151         struct spoolss_DeletePrintProcessor *r)
9152 {
9153         struct tevent_req *req;
9154         struct dcerpc_spoolss_DeletePrintProcessor_r_state *state;
9155         struct tevent_req *subreq;
9156
9157         req = tevent_req_create(mem_ctx, &state,
9158                                 struct dcerpc_spoolss_DeletePrintProcessor_r_state);
9159         if (req == NULL) {
9160                 return NULL;
9161         }
9162
9163         state->out_mem_ctx = NULL;
9164
9165         subreq = dcerpc_binding_handle_call_send(state, ev, h,
9166                         NULL, &ndr_table_spoolss,
9167                         NDR_SPOOLSS_DELETEPRINTPROCESSOR, state, r);
9168         if (tevent_req_nomem(subreq, req)) {
9169                 return tevent_req_post(req, ev);
9170         }
9171         tevent_req_set_callback(subreq, dcerpc_spoolss_DeletePrintProcessor_r_done, req);
9172
9173         return req;
9174 }
9175
9176 static void dcerpc_spoolss_DeletePrintProcessor_r_done(struct tevent_req *subreq)
9177 {
9178         struct tevent_req *req =
9179                 tevent_req_callback_data(subreq,
9180                 struct tevent_req);
9181         NTSTATUS status;
9182
9183         status = dcerpc_binding_handle_call_recv(subreq);
9184         TALLOC_FREE(subreq);
9185         if (tevent_req_nterror(req, status)) {
9186                 return;
9187         }
9188
9189         tevent_req_done(req);
9190 }
9191
9192 NTSTATUS dcerpc_spoolss_DeletePrintProcessor_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
9193 {
9194         struct dcerpc_spoolss_DeletePrintProcessor_r_state *state =
9195                 tevent_req_data(req,
9196                 struct dcerpc_spoolss_DeletePrintProcessor_r_state);
9197         NTSTATUS status;
9198
9199         if (tevent_req_is_nterror(req, &status)) {
9200                 tevent_req_received(req);
9201                 return status;
9202         }
9203
9204         talloc_steal(mem_ctx, state->out_mem_ctx);
9205
9206         tevent_req_received(req);
9207         return NT_STATUS_OK;
9208 }
9209
9210 NTSTATUS dcerpc_spoolss_DeletePrintProcessor_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_DeletePrintProcessor *r)
9211 {
9212         NTSTATUS status;
9213
9214         status = dcerpc_binding_handle_call(h,
9215                         NULL, &ndr_table_spoolss,
9216                         NDR_SPOOLSS_DELETEPRINTPROCESSOR, mem_ctx, r);
9217
9218         return status;
9219 }
9220
9221 struct dcerpc_spoolss_DeletePrintProcessor_state {
9222         struct spoolss_DeletePrintProcessor orig;
9223         struct spoolss_DeletePrintProcessor tmp;
9224         TALLOC_CTX *out_mem_ctx;
9225 };
9226
9227 static void dcerpc_spoolss_DeletePrintProcessor_done(struct tevent_req *subreq);
9228
9229 struct tevent_req *dcerpc_spoolss_DeletePrintProcessor_send(TALLOC_CTX *mem_ctx,
9230                                                             struct tevent_context *ev,
9231                                                             struct dcerpc_binding_handle *h,
9232                                                             const char *_server /* [in] [unique,charset(UTF16)] */,
9233                                                             const char *_architecture /* [in] [unique,charset(UTF16)] */,
9234                                                             const char *_print_processor_name /* [in] [charset(UTF16)] */)
9235 {
9236         struct tevent_req *req;
9237         struct dcerpc_spoolss_DeletePrintProcessor_state *state;
9238         struct tevent_req *subreq;
9239
9240         req = tevent_req_create(mem_ctx, &state,
9241                                 struct dcerpc_spoolss_DeletePrintProcessor_state);
9242         if (req == NULL) {
9243                 return NULL;
9244         }
9245         state->out_mem_ctx = NULL;
9246
9247         /* In parameters */
9248         state->orig.in.server = _server;
9249         state->orig.in.architecture = _architecture;
9250         state->orig.in.print_processor_name = _print_processor_name;
9251
9252         /* Out parameters */
9253
9254         /* Result */
9255         ZERO_STRUCT(state->orig.out.result);
9256
9257         /* make a temporary copy, that we pass to the dispatch function */
9258         state->tmp = state->orig;
9259
9260         subreq = dcerpc_spoolss_DeletePrintProcessor_r_send(state, ev, h, &state->tmp);
9261         if (tevent_req_nomem(subreq, req)) {
9262                 return tevent_req_post(req, ev);
9263         }
9264         tevent_req_set_callback(subreq, dcerpc_spoolss_DeletePrintProcessor_done, req);
9265         return req;
9266 }
9267
9268 static void dcerpc_spoolss_DeletePrintProcessor_done(struct tevent_req *subreq)
9269 {
9270         struct tevent_req *req = tevent_req_callback_data(
9271                 subreq, struct tevent_req);
9272         struct dcerpc_spoolss_DeletePrintProcessor_state *state = tevent_req_data(
9273                 req, struct dcerpc_spoolss_DeletePrintProcessor_state);
9274         NTSTATUS status;
9275         TALLOC_CTX *mem_ctx;
9276
9277         if (state->out_mem_ctx) {
9278                 mem_ctx = state->out_mem_ctx;
9279         } else {
9280                 mem_ctx = state;
9281         }
9282
9283         status = dcerpc_spoolss_DeletePrintProcessor_r_recv(subreq, mem_ctx);
9284         TALLOC_FREE(subreq);
9285         if (tevent_req_nterror(req, status)) {
9286                 return;
9287         }
9288
9289         /* Copy out parameters */
9290
9291         /* Copy result */
9292         state->orig.out.result = state->tmp.out.result;
9293
9294         /* Reset temporary structure */
9295         ZERO_STRUCT(state->tmp);
9296
9297         tevent_req_done(req);
9298 }
9299
9300 NTSTATUS dcerpc_spoolss_DeletePrintProcessor_recv(struct tevent_req *req,
9301                                                   TALLOC_CTX *mem_ctx,
9302                                                   WERROR *result)
9303 {
9304         struct dcerpc_spoolss_DeletePrintProcessor_state *state = tevent_req_data(
9305                 req, struct dcerpc_spoolss_DeletePrintProcessor_state);
9306         NTSTATUS status;
9307
9308         if (tevent_req_is_nterror(req, &status)) {
9309                 tevent_req_received(req);
9310                 return status;
9311         }
9312
9313         /* Steal possible out parameters to the callers context */
9314         talloc_steal(mem_ctx, state->out_mem_ctx);
9315
9316         /* Return result */
9317         *result = state->orig.out.result;
9318
9319         tevent_req_received(req);
9320         return NT_STATUS_OK;
9321 }
9322
9323 NTSTATUS dcerpc_spoolss_DeletePrintProcessor(struct dcerpc_binding_handle *h,
9324                                              TALLOC_CTX *mem_ctx,
9325                                              const char *_server /* [in] [unique,charset(UTF16)] */,
9326                                              const char *_architecture /* [in] [unique,charset(UTF16)] */,
9327                                              const char *_print_processor_name /* [in] [charset(UTF16)] */,
9328                                              WERROR *result)
9329 {
9330         struct spoolss_DeletePrintProcessor r;
9331         NTSTATUS status;
9332
9333         /* In parameters */
9334         r.in.server = _server;
9335         r.in.architecture = _architecture;
9336         r.in.print_processor_name = _print_processor_name;
9337
9338         status = dcerpc_spoolss_DeletePrintProcessor_r(h, mem_ctx, &r);
9339         if (!NT_STATUS_IS_OK(status)) {
9340                 return status;
9341         }
9342
9343         /* Return variables */
9344
9345         /* Return result */
9346         *result = r.out.result;
9347
9348         return NT_STATUS_OK;
9349 }
9350
9351 struct dcerpc_spoolss_EnumPrintProcDataTypes_r_state {
9352         TALLOC_CTX *out_mem_ctx;
9353 };
9354
9355 static void dcerpc_spoolss_EnumPrintProcDataTypes_r_done(struct tevent_req *subreq);
9356
9357 struct tevent_req *dcerpc_spoolss_EnumPrintProcDataTypes_r_send(TALLOC_CTX *mem_ctx,
9358         struct tevent_context *ev,
9359         struct dcerpc_binding_handle *h,
9360         struct spoolss_EnumPrintProcDataTypes *r)
9361 {
9362         struct tevent_req *req;
9363         struct dcerpc_spoolss_EnumPrintProcDataTypes_r_state *state;
9364         struct tevent_req *subreq;
9365
9366         req = tevent_req_create(mem_ctx, &state,
9367                                 struct dcerpc_spoolss_EnumPrintProcDataTypes_r_state);
9368         if (req == NULL) {
9369                 return NULL;
9370         }
9371
9372         state->out_mem_ctx = talloc_new(state);
9373         if (tevent_req_nomem(state->out_mem_ctx, req)) {
9374                 return tevent_req_post(req, ev);
9375         }
9376
9377         subreq = dcerpc_binding_handle_call_send(state, ev, h,
9378                         NULL, &ndr_table_spoolss,
9379                         NDR_SPOOLSS_ENUMPRINTPROCDATATYPES, state->out_mem_ctx, r);
9380         if (tevent_req_nomem(subreq, req)) {
9381                 return tevent_req_post(req, ev);
9382         }
9383         tevent_req_set_callback(subreq, dcerpc_spoolss_EnumPrintProcDataTypes_r_done, req);
9384
9385         return req;
9386 }
9387
9388 static void dcerpc_spoolss_EnumPrintProcDataTypes_r_done(struct tevent_req *subreq)
9389 {
9390         struct tevent_req *req =
9391                 tevent_req_callback_data(subreq,
9392                 struct tevent_req);
9393         NTSTATUS status;
9394
9395         status = dcerpc_binding_handle_call_recv(subreq);
9396         TALLOC_FREE(subreq);
9397         if (tevent_req_nterror(req, status)) {
9398                 return;
9399         }
9400
9401         tevent_req_done(req);
9402 }
9403
9404 NTSTATUS dcerpc_spoolss_EnumPrintProcDataTypes_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
9405 {
9406         struct dcerpc_spoolss_EnumPrintProcDataTypes_r_state *state =
9407                 tevent_req_data(req,
9408                 struct dcerpc_spoolss_EnumPrintProcDataTypes_r_state);
9409         NTSTATUS status;
9410
9411         if (tevent_req_is_nterror(req, &status)) {
9412                 tevent_req_received(req);
9413                 return status;
9414         }
9415
9416         talloc_steal(mem_ctx, state->out_mem_ctx);
9417
9418         tevent_req_received(req);
9419         return NT_STATUS_OK;
9420 }
9421
9422 NTSTATUS dcerpc_spoolss_EnumPrintProcDataTypes_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_EnumPrintProcDataTypes *r)
9423 {
9424         NTSTATUS status;
9425
9426         status = dcerpc_binding_handle_call(h,
9427                         NULL, &ndr_table_spoolss,
9428                         NDR_SPOOLSS_ENUMPRINTPROCDATATYPES, mem_ctx, r);
9429
9430         return status;
9431 }
9432
9433 struct dcerpc_spoolss_EnumPrintProcDataTypes_state {
9434         struct spoolss_EnumPrintProcDataTypes orig;
9435         struct spoolss_EnumPrintProcDataTypes tmp;
9436         TALLOC_CTX *out_mem_ctx;
9437 };
9438
9439 static void dcerpc_spoolss_EnumPrintProcDataTypes_done(struct tevent_req *subreq);
9440
9441 struct tevent_req *dcerpc_spoolss_EnumPrintProcDataTypes_send(TALLOC_CTX *mem_ctx,
9442                                                               struct tevent_context *ev,
9443                                                               struct dcerpc_binding_handle *h,
9444                                                               const char *_servername /* [in] [unique,charset(UTF16)] */,
9445                                                               const char *_print_processor_name /* [in] [unique,charset(UTF16)] */,
9446                                                               uint32_t _level /* [in]  */,
9447                                                               DATA_BLOB *_buffer /* [in] [unique] */,
9448                                                               uint32_t _offered /* [in]  */,
9449                                                               uint32_t *_count /* [out] [ref] */,
9450                                                               union spoolss_PrintProcDataTypesInfo **_info /* [out] [ref,switch_is(level),size_is(,*count)] */,
9451                                                               uint32_t *_needed /* [out] [ref] */)
9452 {
9453         struct tevent_req *req;
9454         struct dcerpc_spoolss_EnumPrintProcDataTypes_state *state;
9455         struct tevent_req *subreq;
9456
9457         req = tevent_req_create(mem_ctx, &state,
9458                                 struct dcerpc_spoolss_EnumPrintProcDataTypes_state);
9459         if (req == NULL) {
9460                 return NULL;
9461         }
9462         state->out_mem_ctx = NULL;
9463
9464         /* In parameters */
9465         state->orig.in.servername = _servername;
9466         state->orig.in.print_processor_name = _print_processor_name;
9467         state->orig.in.level = _level;
9468         state->orig.in.buffer = _buffer;
9469         state->orig.in.offered = _offered;
9470
9471         /* Out parameters */
9472         state->orig.out.count = _count;
9473         state->orig.out.info = _info;
9474         state->orig.out.needed = _needed;
9475
9476         /* Result */
9477         ZERO_STRUCT(state->orig.out.result);
9478
9479         state->out_mem_ctx = talloc_named_const(state, 0,
9480                              "dcerpc_spoolss_EnumPrintProcDataTypes_out_memory");
9481         if (tevent_req_nomem(state->out_mem_ctx, req)) {
9482                 return tevent_req_post(req, ev);
9483         }
9484
9485         /* make a temporary copy, that we pass to the dispatch function */
9486         state->tmp = state->orig;
9487
9488         subreq = dcerpc_spoolss_EnumPrintProcDataTypes_r_send(state, ev, h, &state->tmp);
9489         if (tevent_req_nomem(subreq, req)) {
9490                 return tevent_req_post(req, ev);
9491         }
9492         tevent_req_set_callback(subreq, dcerpc_spoolss_EnumPrintProcDataTypes_done, req);
9493         return req;
9494 }
9495
9496 static void dcerpc_spoolss_EnumPrintProcDataTypes_done(struct tevent_req *subreq)
9497 {
9498         struct tevent_req *req = tevent_req_callback_data(
9499                 subreq, struct tevent_req);
9500         struct dcerpc_spoolss_EnumPrintProcDataTypes_state *state = tevent_req_data(
9501                 req, struct dcerpc_spoolss_EnumPrintProcDataTypes_state);
9502         NTSTATUS status;
9503         TALLOC_CTX *mem_ctx;
9504
9505         if (state->out_mem_ctx) {
9506                 mem_ctx = state->out_mem_ctx;
9507         } else {
9508                 mem_ctx = state;
9509         }
9510
9511         status = dcerpc_spoolss_EnumPrintProcDataTypes_r_recv(subreq, mem_ctx);
9512         TALLOC_FREE(subreq);
9513         if (tevent_req_nterror(req, status)) {
9514                 return;
9515         }
9516
9517         /* Copy out parameters */
9518         *state->orig.out.count = *state->tmp.out.count;
9519         *state->orig.out.info = *state->tmp.out.info;
9520         *state->orig.out.needed = *state->tmp.out.needed;
9521
9522         /* Copy result */
9523         state->orig.out.result = state->tmp.out.result;
9524
9525         /* Reset temporary structure */
9526         ZERO_STRUCT(state->tmp);
9527
9528         tevent_req_done(req);
9529 }
9530
9531 NTSTATUS dcerpc_spoolss_EnumPrintProcDataTypes_recv(struct tevent_req *req,
9532                                                     TALLOC_CTX *mem_ctx,
9533                                                     WERROR *result)
9534 {
9535         struct dcerpc_spoolss_EnumPrintProcDataTypes_state *state = tevent_req_data(
9536                 req, struct dcerpc_spoolss_EnumPrintProcDataTypes_state);
9537         NTSTATUS status;
9538
9539         if (tevent_req_is_nterror(req, &status)) {
9540                 tevent_req_received(req);
9541                 return status;
9542         }
9543
9544         /* Steal possible out parameters to the callers context */
9545         talloc_steal(mem_ctx, state->out_mem_ctx);
9546
9547         /* Return result */
9548         *result = state->orig.out.result;
9549
9550         tevent_req_received(req);
9551         return NT_STATUS_OK;
9552 }
9553
9554 NTSTATUS dcerpc_spoolss_EnumPrintProcDataTypes(struct dcerpc_binding_handle *h,
9555                                                TALLOC_CTX *mem_ctx,
9556                                                const char *_servername /* [in] [unique,charset(UTF16)] */,
9557                                                const char *_print_processor_name /* [in] [unique,charset(UTF16)] */,
9558                                                uint32_t _level /* [in]  */,
9559                                                DATA_BLOB *_buffer /* [in] [unique] */,
9560                                                uint32_t _offered /* [in]  */,
9561                                                uint32_t *_count /* [out] [ref] */,
9562                                                union spoolss_PrintProcDataTypesInfo **_info /* [out] [ref,switch_is(level),size_is(,*count)] */,
9563                                                uint32_t *_needed /* [out] [ref] */,
9564                                                WERROR *result)
9565 {
9566         struct spoolss_EnumPrintProcDataTypes r;
9567         NTSTATUS status;
9568
9569         /* In parameters */
9570         r.in.servername = _servername;
9571         r.in.print_processor_name = _print_processor_name;
9572         r.in.level = _level;
9573         r.in.buffer = _buffer;
9574         r.in.offered = _offered;
9575
9576         status = dcerpc_spoolss_EnumPrintProcDataTypes_r(h, mem_ctx, &r);
9577         if (!NT_STATUS_IS_OK(status)) {
9578                 return status;
9579         }
9580
9581         /* Return variables */
9582         *_count = *r.out.count;
9583         *_info = *r.out.info;
9584         *_needed = *r.out.needed;
9585
9586         /* Return result */
9587         *result = r.out.result;
9588
9589         return NT_STATUS_OK;
9590 }
9591
9592 struct dcerpc_spoolss_ResetPrinter_r_state {
9593         TALLOC_CTX *out_mem_ctx;
9594 };
9595
9596 static void dcerpc_spoolss_ResetPrinter_r_done(struct tevent_req *subreq);
9597
9598 struct tevent_req *dcerpc_spoolss_ResetPrinter_r_send(TALLOC_CTX *mem_ctx,
9599         struct tevent_context *ev,
9600         struct dcerpc_binding_handle *h,
9601         struct spoolss_ResetPrinter *r)
9602 {
9603         struct tevent_req *req;
9604         struct dcerpc_spoolss_ResetPrinter_r_state *state;
9605         struct tevent_req *subreq;
9606
9607         req = tevent_req_create(mem_ctx, &state,
9608                                 struct dcerpc_spoolss_ResetPrinter_r_state);
9609         if (req == NULL) {
9610                 return NULL;
9611         }
9612
9613         state->out_mem_ctx = NULL;
9614
9615         subreq = dcerpc_binding_handle_call_send(state, ev, h,
9616                         NULL, &ndr_table_spoolss,
9617                         NDR_SPOOLSS_RESETPRINTER, state, r);
9618         if (tevent_req_nomem(subreq, req)) {
9619                 return tevent_req_post(req, ev);
9620         }
9621         tevent_req_set_callback(subreq, dcerpc_spoolss_ResetPrinter_r_done, req);
9622
9623         return req;
9624 }
9625
9626 static void dcerpc_spoolss_ResetPrinter_r_done(struct tevent_req *subreq)
9627 {
9628         struct tevent_req *req =
9629                 tevent_req_callback_data(subreq,
9630                 struct tevent_req);
9631         NTSTATUS status;
9632
9633         status = dcerpc_binding_handle_call_recv(subreq);
9634         TALLOC_FREE(subreq);
9635         if (tevent_req_nterror(req, status)) {
9636                 return;
9637         }
9638
9639         tevent_req_done(req);
9640 }
9641
9642 NTSTATUS dcerpc_spoolss_ResetPrinter_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
9643 {
9644         struct dcerpc_spoolss_ResetPrinter_r_state *state =
9645                 tevent_req_data(req,
9646                 struct dcerpc_spoolss_ResetPrinter_r_state);
9647         NTSTATUS status;
9648
9649         if (tevent_req_is_nterror(req, &status)) {
9650                 tevent_req_received(req);
9651                 return status;
9652         }
9653
9654         talloc_steal(mem_ctx, state->out_mem_ctx);
9655
9656         tevent_req_received(req);
9657         return NT_STATUS_OK;
9658 }
9659
9660 NTSTATUS dcerpc_spoolss_ResetPrinter_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_ResetPrinter *r)
9661 {
9662         NTSTATUS status;
9663
9664         status = dcerpc_binding_handle_call(h,
9665                         NULL, &ndr_table_spoolss,
9666                         NDR_SPOOLSS_RESETPRINTER, mem_ctx, r);
9667
9668         return status;
9669 }
9670
9671 struct dcerpc_spoolss_ResetPrinter_state {
9672         struct spoolss_ResetPrinter orig;
9673         struct spoolss_ResetPrinter tmp;
9674         TALLOC_CTX *out_mem_ctx;
9675 };
9676
9677 static void dcerpc_spoolss_ResetPrinter_done(struct tevent_req *subreq);
9678
9679 struct tevent_req *dcerpc_spoolss_ResetPrinter_send(TALLOC_CTX *mem_ctx,
9680                                                     struct tevent_context *ev,
9681                                                     struct dcerpc_binding_handle *h,
9682                                                     struct policy_handle *_handle /* [in] [ref] */,
9683                                                     const char *_data_type /* [in] [unique,charset(UTF16)] */,
9684                                                     struct spoolss_DevmodeContainer *_devmode_ctr /* [in] [ref] */)
9685 {
9686         struct tevent_req *req;
9687         struct dcerpc_spoolss_ResetPrinter_state *state;
9688         struct tevent_req *subreq;
9689
9690         req = tevent_req_create(mem_ctx, &state,
9691                                 struct dcerpc_spoolss_ResetPrinter_state);
9692         if (req == NULL) {
9693                 return NULL;
9694         }
9695         state->out_mem_ctx = NULL;
9696
9697         /* In parameters */
9698         state->orig.in.handle = _handle;
9699         state->orig.in.data_type = _data_type;
9700         state->orig.in.devmode_ctr = _devmode_ctr;
9701
9702         /* Out parameters */
9703
9704         /* Result */
9705         ZERO_STRUCT(state->orig.out.result);
9706
9707         /* make a temporary copy, that we pass to the dispatch function */
9708         state->tmp = state->orig;
9709
9710         subreq = dcerpc_spoolss_ResetPrinter_r_send(state, ev, h, &state->tmp);
9711         if (tevent_req_nomem(subreq, req)) {
9712                 return tevent_req_post(req, ev);
9713         }
9714         tevent_req_set_callback(subreq, dcerpc_spoolss_ResetPrinter_done, req);
9715         return req;
9716 }
9717
9718 static void dcerpc_spoolss_ResetPrinter_done(struct tevent_req *subreq)
9719 {
9720         struct tevent_req *req = tevent_req_callback_data(
9721                 subreq, struct tevent_req);
9722         struct dcerpc_spoolss_ResetPrinter_state *state = tevent_req_data(
9723                 req, struct dcerpc_spoolss_ResetPrinter_state);
9724         NTSTATUS status;
9725         TALLOC_CTX *mem_ctx;
9726
9727         if (state->out_mem_ctx) {
9728                 mem_ctx = state->out_mem_ctx;
9729         } else {
9730                 mem_ctx = state;
9731         }
9732
9733         status = dcerpc_spoolss_ResetPrinter_r_recv(subreq, mem_ctx);
9734         TALLOC_FREE(subreq);
9735         if (tevent_req_nterror(req, status)) {
9736                 return;
9737         }
9738
9739         /* Copy out parameters */
9740
9741         /* Copy result */
9742         state->orig.out.result = state->tmp.out.result;
9743
9744         /* Reset temporary structure */
9745         ZERO_STRUCT(state->tmp);
9746
9747         tevent_req_done(req);
9748 }
9749
9750 NTSTATUS dcerpc_spoolss_ResetPrinter_recv(struct tevent_req *req,
9751                                           TALLOC_CTX *mem_ctx,
9752                                           WERROR *result)
9753 {
9754         struct dcerpc_spoolss_ResetPrinter_state *state = tevent_req_data(
9755                 req, struct dcerpc_spoolss_ResetPrinter_state);
9756         NTSTATUS status;
9757
9758         if (tevent_req_is_nterror(req, &status)) {
9759                 tevent_req_received(req);
9760                 return status;
9761         }
9762
9763         /* Steal possible out parameters to the callers context */
9764         talloc_steal(mem_ctx, state->out_mem_ctx);
9765
9766         /* Return result */
9767         *result = state->orig.out.result;
9768
9769         tevent_req_received(req);
9770         return NT_STATUS_OK;
9771 }
9772
9773 NTSTATUS dcerpc_spoolss_ResetPrinter(struct dcerpc_binding_handle *h,
9774                                      TALLOC_CTX *mem_ctx,
9775                                      struct policy_handle *_handle /* [in] [ref] */,
9776                                      const char *_data_type /* [in] [unique,charset(UTF16)] */,
9777                                      struct spoolss_DevmodeContainer *_devmode_ctr /* [in] [ref] */,
9778                                      WERROR *result)
9779 {
9780         struct spoolss_ResetPrinter r;
9781         NTSTATUS status;
9782
9783         /* In parameters */
9784         r.in.handle = _handle;
9785         r.in.data_type = _data_type;
9786         r.in.devmode_ctr = _devmode_ctr;
9787
9788         status = dcerpc_spoolss_ResetPrinter_r(h, mem_ctx, &r);
9789         if (!NT_STATUS_IS_OK(status)) {
9790                 return status;
9791         }
9792
9793         /* Return variables */
9794
9795         /* Return result */
9796         *result = r.out.result;
9797
9798         return NT_STATUS_OK;
9799 }
9800
9801 struct dcerpc_spoolss_GetPrinterDriver2_r_state {
9802         TALLOC_CTX *out_mem_ctx;
9803 };
9804
9805 static void dcerpc_spoolss_GetPrinterDriver2_r_done(struct tevent_req *subreq);
9806
9807 struct tevent_req *dcerpc_spoolss_GetPrinterDriver2_r_send(TALLOC_CTX *mem_ctx,
9808         struct tevent_context *ev,
9809         struct dcerpc_binding_handle *h,
9810         struct spoolss_GetPrinterDriver2 *r)
9811 {
9812         struct tevent_req *req;
9813         struct dcerpc_spoolss_GetPrinterDriver2_r_state *state;
9814         struct tevent_req *subreq;
9815
9816         req = tevent_req_create(mem_ctx, &state,
9817                                 struct dcerpc_spoolss_GetPrinterDriver2_r_state);
9818         if (req == NULL) {
9819                 return NULL;
9820         }
9821
9822         state->out_mem_ctx = talloc_new(state);
9823         if (tevent_req_nomem(state->out_mem_ctx, req)) {
9824                 return tevent_req_post(req, ev);
9825         }
9826
9827         subreq = dcerpc_binding_handle_call_send(state, ev, h,
9828                         NULL, &ndr_table_spoolss,
9829                         NDR_SPOOLSS_GETPRINTERDRIVER2, state->out_mem_ctx, r);
9830         if (tevent_req_nomem(subreq, req)) {
9831                 return tevent_req_post(req, ev);
9832         }
9833         tevent_req_set_callback(subreq, dcerpc_spoolss_GetPrinterDriver2_r_done, req);
9834
9835         return req;
9836 }
9837
9838 static void dcerpc_spoolss_GetPrinterDriver2_r_done(struct tevent_req *subreq)
9839 {
9840         struct tevent_req *req =
9841                 tevent_req_callback_data(subreq,
9842                 struct tevent_req);
9843         NTSTATUS status;
9844
9845         status = dcerpc_binding_handle_call_recv(subreq);
9846         TALLOC_FREE(subreq);
9847         if (tevent_req_nterror(req, status)) {
9848                 return;
9849         }
9850
9851         tevent_req_done(req);
9852 }
9853
9854 NTSTATUS dcerpc_spoolss_GetPrinterDriver2_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
9855 {
9856         struct dcerpc_spoolss_GetPrinterDriver2_r_state *state =
9857                 tevent_req_data(req,
9858                 struct dcerpc_spoolss_GetPrinterDriver2_r_state);
9859         NTSTATUS status;
9860
9861         if (tevent_req_is_nterror(req, &status)) {
9862                 tevent_req_received(req);
9863                 return status;
9864         }
9865
9866         talloc_steal(mem_ctx, state->out_mem_ctx);
9867
9868         tevent_req_received(req);
9869         return NT_STATUS_OK;
9870 }
9871
9872 NTSTATUS dcerpc_spoolss_GetPrinterDriver2_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_GetPrinterDriver2 *r)
9873 {
9874         NTSTATUS status;
9875
9876         status = dcerpc_binding_handle_call(h,
9877                         NULL, &ndr_table_spoolss,
9878                         NDR_SPOOLSS_GETPRINTERDRIVER2, mem_ctx, r);
9879
9880         return status;
9881 }
9882
9883 struct dcerpc_spoolss_GetPrinterDriver2_state {
9884         struct spoolss_GetPrinterDriver2 orig;
9885         struct spoolss_GetPrinterDriver2 tmp;
9886         TALLOC_CTX *out_mem_ctx;
9887 };
9888
9889 static void dcerpc_spoolss_GetPrinterDriver2_done(struct tevent_req *subreq);
9890
9891 struct tevent_req *dcerpc_spoolss_GetPrinterDriver2_send(TALLOC_CTX *mem_ctx,
9892                                                          struct tevent_context *ev,
9893                                                          struct dcerpc_binding_handle *h,
9894                                                          struct policy_handle *_handle /* [in] [ref] */,
9895                                                          const char *_architecture /* [in] [unique,charset(UTF16)] */,
9896                                                          uint32_t _level /* [in]  */,
9897                                                          DATA_BLOB *_buffer /* [in] [unique] */,
9898                                                          uint32_t _offered /* [in]  */,
9899                                                          uint32_t _client_major_version /* [in]  */,
9900                                                          uint32_t _client_minor_version /* [in]  */,
9901                                                          union spoolss_DriverInfo *_info /* [out] [unique,subcontext_size(offered),subcontext(4),switch_is(level)] */,
9902                                                          uint32_t *_needed /* [out] [ref] */,
9903                                                          uint32_t *_server_major_version /* [out] [ref] */,
9904                                                          uint32_t *_server_minor_version /* [out] [ref] */)
9905 {
9906         struct tevent_req *req;
9907         struct dcerpc_spoolss_GetPrinterDriver2_state *state;
9908         struct tevent_req *subreq;
9909
9910         req = tevent_req_create(mem_ctx, &state,
9911                                 struct dcerpc_spoolss_GetPrinterDriver2_state);
9912         if (req == NULL) {
9913                 return NULL;
9914         }
9915         state->out_mem_ctx = NULL;
9916
9917         /* In parameters */
9918         state->orig.in.handle = _handle;
9919         state->orig.in.architecture = _architecture;
9920         state->orig.in.level = _level;
9921         state->orig.in.buffer = _buffer;
9922         state->orig.in.offered = _offered;
9923         state->orig.in.client_major_version = _client_major_version;
9924         state->orig.in.client_minor_version = _client_minor_version;
9925
9926         /* Out parameters */
9927         state->orig.out.info = _info;
9928         state->orig.out.needed = _needed;
9929         state->orig.out.server_major_version = _server_major_version;
9930         state->orig.out.server_minor_version = _server_minor_version;
9931
9932         /* Result */
9933         ZERO_STRUCT(state->orig.out.result);
9934
9935         state->out_mem_ctx = talloc_named_const(state, 0,
9936                              "dcerpc_spoolss_GetPrinterDriver2_out_memory");
9937         if (tevent_req_nomem(state->out_mem_ctx, req)) {
9938                 return tevent_req_post(req, ev);
9939         }
9940
9941         /* make a temporary copy, that we pass to the dispatch function */
9942         state->tmp = state->orig;
9943
9944         subreq = dcerpc_spoolss_GetPrinterDriver2_r_send(state, ev, h, &state->tmp);
9945         if (tevent_req_nomem(subreq, req)) {
9946                 return tevent_req_post(req, ev);
9947         }
9948         tevent_req_set_callback(subreq, dcerpc_spoolss_GetPrinterDriver2_done, req);
9949         return req;
9950 }
9951
9952 static void dcerpc_spoolss_GetPrinterDriver2_done(struct tevent_req *subreq)
9953 {
9954         struct tevent_req *req = tevent_req_callback_data(
9955                 subreq, struct tevent_req);
9956         struct dcerpc_spoolss_GetPrinterDriver2_state *state = tevent_req_data(
9957                 req, struct dcerpc_spoolss_GetPrinterDriver2_state);
9958         NTSTATUS status;
9959         TALLOC_CTX *mem_ctx;
9960
9961         if (state->out_mem_ctx) {
9962                 mem_ctx = state->out_mem_ctx;
9963         } else {
9964                 mem_ctx = state;
9965         }
9966
9967         status = dcerpc_spoolss_GetPrinterDriver2_r_recv(subreq, mem_ctx);
9968         TALLOC_FREE(subreq);
9969         if (tevent_req_nterror(req, status)) {
9970                 return;
9971         }
9972
9973         /* Copy out parameters */
9974         if (state->orig.out.info && state->tmp.out.info) {
9975                 *state->orig.out.info = *state->tmp.out.info;
9976         }
9977         *state->orig.out.needed = *state->tmp.out.needed;
9978         *state->orig.out.server_major_version = *state->tmp.out.server_major_version;
9979         *state->orig.out.server_minor_version = *state->tmp.out.server_minor_version;
9980
9981         /* Copy result */
9982         state->orig.out.result = state->tmp.out.result;
9983
9984         /* Reset temporary structure */
9985         ZERO_STRUCT(state->tmp);
9986
9987         tevent_req_done(req);
9988 }
9989
9990 NTSTATUS dcerpc_spoolss_GetPrinterDriver2_recv(struct tevent_req *req,
9991                                                TALLOC_CTX *mem_ctx,
9992                                                WERROR *result)
9993 {
9994         struct dcerpc_spoolss_GetPrinterDriver2_state *state = tevent_req_data(
9995                 req, struct dcerpc_spoolss_GetPrinterDriver2_state);
9996         NTSTATUS status;
9997
9998         if (tevent_req_is_nterror(req, &status)) {
9999                 tevent_req_received(req);
10000                 return status;
10001         }
10002
10003         /* Steal possible out parameters to the callers context */
10004         talloc_steal(mem_ctx, state->out_mem_ctx);
10005
10006         /* Return result */
10007         *result = state->orig.out.result;
10008
10009         tevent_req_received(req);
10010         return NT_STATUS_OK;
10011 }
10012
10013 NTSTATUS dcerpc_spoolss_GetPrinterDriver2(struct dcerpc_binding_handle *h,
10014                                           TALLOC_CTX *mem_ctx,
10015                                           struct policy_handle *_handle /* [in] [ref] */,
10016                                           const char *_architecture /* [in] [unique,charset(UTF16)] */,
10017                                           uint32_t _level /* [in]  */,
10018                                           DATA_BLOB *_buffer /* [in] [unique] */,
10019                                           uint32_t _offered /* [in]  */,
10020                                           uint32_t _client_major_version /* [in]  */,
10021                                           uint32_t _client_minor_version /* [in]  */,
10022                                           union spoolss_DriverInfo *_info /* [out] [unique,subcontext_size(offered),subcontext(4),switch_is(level)] */,
10023                                           uint32_t *_needed /* [out] [ref] */,
10024                                           uint32_t *_server_major_version /* [out] [ref] */,
10025                                           uint32_t *_server_minor_version /* [out] [ref] */,
10026                                           WERROR *result)
10027 {
10028         struct spoolss_GetPrinterDriver2 r;
10029         NTSTATUS status;
10030
10031         /* In parameters */
10032         r.in.handle = _handle;
10033         r.in.architecture = _architecture;
10034         r.in.level = _level;
10035         r.in.buffer = _buffer;
10036         r.in.offered = _offered;
10037         r.in.client_major_version = _client_major_version;
10038         r.in.client_minor_version = _client_minor_version;
10039
10040         status = dcerpc_spoolss_GetPrinterDriver2_r(h, mem_ctx, &r);
10041         if (!NT_STATUS_IS_OK(status)) {
10042                 return status;
10043         }
10044
10045         /* Return variables */
10046         if (_info && r.out.info) {
10047                 *_info = *r.out.info;
10048         }
10049         *_needed = *r.out.needed;
10050         *_server_major_version = *r.out.server_major_version;
10051         *_server_minor_version = *r.out.server_minor_version;
10052
10053         /* Return result */
10054         *result = r.out.result;
10055
10056         return NT_STATUS_OK;
10057 }
10058
10059 struct dcerpc_spoolss_FindClosePrinterNotify_r_state {
10060         TALLOC_CTX *out_mem_ctx;
10061 };
10062
10063 static void dcerpc_spoolss_FindClosePrinterNotify_r_done(struct tevent_req *subreq);
10064
10065 struct tevent_req *dcerpc_spoolss_FindClosePrinterNotify_r_send(TALLOC_CTX *mem_ctx,
10066         struct tevent_context *ev,
10067         struct dcerpc_binding_handle *h,
10068         struct spoolss_FindClosePrinterNotify *r)
10069 {
10070         struct tevent_req *req;
10071         struct dcerpc_spoolss_FindClosePrinterNotify_r_state *state;
10072         struct tevent_req *subreq;
10073
10074         req = tevent_req_create(mem_ctx, &state,
10075                                 struct dcerpc_spoolss_FindClosePrinterNotify_r_state);
10076         if (req == NULL) {
10077                 return NULL;
10078         }
10079
10080         state->out_mem_ctx = NULL;
10081
10082         subreq = dcerpc_binding_handle_call_send(state, ev, h,
10083                         NULL, &ndr_table_spoolss,
10084                         NDR_SPOOLSS_FINDCLOSEPRINTERNOTIFY, state, r);
10085         if (tevent_req_nomem(subreq, req)) {
10086                 return tevent_req_post(req, ev);
10087         }
10088         tevent_req_set_callback(subreq, dcerpc_spoolss_FindClosePrinterNotify_r_done, req);
10089
10090         return req;
10091 }
10092
10093 static void dcerpc_spoolss_FindClosePrinterNotify_r_done(struct tevent_req *subreq)
10094 {
10095         struct tevent_req *req =
10096                 tevent_req_callback_data(subreq,
10097                 struct tevent_req);
10098         NTSTATUS status;
10099
10100         status = dcerpc_binding_handle_call_recv(subreq);
10101         TALLOC_FREE(subreq);
10102         if (tevent_req_nterror(req, status)) {
10103                 return;
10104         }
10105
10106         tevent_req_done(req);
10107 }
10108
10109 NTSTATUS dcerpc_spoolss_FindClosePrinterNotify_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
10110 {
10111         struct dcerpc_spoolss_FindClosePrinterNotify_r_state *state =
10112                 tevent_req_data(req,
10113                 struct dcerpc_spoolss_FindClosePrinterNotify_r_state);
10114         NTSTATUS status;
10115
10116         if (tevent_req_is_nterror(req, &status)) {
10117                 tevent_req_received(req);
10118                 return status;
10119         }
10120
10121         talloc_steal(mem_ctx, state->out_mem_ctx);
10122
10123         tevent_req_received(req);
10124         return NT_STATUS_OK;
10125 }
10126
10127 NTSTATUS dcerpc_spoolss_FindClosePrinterNotify_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_FindClosePrinterNotify *r)
10128 {
10129         NTSTATUS status;
10130
10131         status = dcerpc_binding_handle_call(h,
10132                         NULL, &ndr_table_spoolss,
10133                         NDR_SPOOLSS_FINDCLOSEPRINTERNOTIFY, mem_ctx, r);
10134
10135         return status;
10136 }
10137
10138 struct dcerpc_spoolss_FindClosePrinterNotify_state {
10139         struct spoolss_FindClosePrinterNotify orig;
10140         struct spoolss_FindClosePrinterNotify tmp;
10141         TALLOC_CTX *out_mem_ctx;
10142 };
10143
10144 static void dcerpc_spoolss_FindClosePrinterNotify_done(struct tevent_req *subreq);
10145
10146 struct tevent_req *dcerpc_spoolss_FindClosePrinterNotify_send(TALLOC_CTX *mem_ctx,
10147                                                               struct tevent_context *ev,
10148                                                               struct dcerpc_binding_handle *h,
10149                                                               struct policy_handle *_handle /* [in] [ref] */)
10150 {
10151         struct tevent_req *req;
10152         struct dcerpc_spoolss_FindClosePrinterNotify_state *state;
10153         struct tevent_req *subreq;
10154
10155         req = tevent_req_create(mem_ctx, &state,
10156                                 struct dcerpc_spoolss_FindClosePrinterNotify_state);
10157         if (req == NULL) {
10158                 return NULL;
10159         }
10160         state->out_mem_ctx = NULL;
10161
10162         /* In parameters */
10163         state->orig.in.handle = _handle;
10164
10165         /* Out parameters */
10166
10167         /* Result */
10168         ZERO_STRUCT(state->orig.out.result);
10169
10170         /* make a temporary copy, that we pass to the dispatch function */
10171         state->tmp = state->orig;
10172
10173         subreq = dcerpc_spoolss_FindClosePrinterNotify_r_send(state, ev, h, &state->tmp);
10174         if (tevent_req_nomem(subreq, req)) {
10175                 return tevent_req_post(req, ev);
10176         }
10177         tevent_req_set_callback(subreq, dcerpc_spoolss_FindClosePrinterNotify_done, req);
10178         return req;
10179 }
10180
10181 static void dcerpc_spoolss_FindClosePrinterNotify_done(struct tevent_req *subreq)
10182 {
10183         struct tevent_req *req = tevent_req_callback_data(
10184                 subreq, struct tevent_req);
10185         struct dcerpc_spoolss_FindClosePrinterNotify_state *state = tevent_req_data(
10186                 req, struct dcerpc_spoolss_FindClosePrinterNotify_state);
10187         NTSTATUS status;
10188         TALLOC_CTX *mem_ctx;
10189
10190         if (state->out_mem_ctx) {
10191                 mem_ctx = state->out_mem_ctx;
10192         } else {
10193                 mem_ctx = state;
10194         }
10195
10196         status = dcerpc_spoolss_FindClosePrinterNotify_r_recv(subreq, mem_ctx);
10197         TALLOC_FREE(subreq);
10198         if (tevent_req_nterror(req, status)) {
10199                 return;
10200         }
10201
10202         /* Copy out parameters */
10203
10204         /* Copy result */
10205         state->orig.out.result = state->tmp.out.result;
10206
10207         /* Reset temporary structure */
10208         ZERO_STRUCT(state->tmp);
10209
10210         tevent_req_done(req);
10211 }
10212
10213 NTSTATUS dcerpc_spoolss_FindClosePrinterNotify_recv(struct tevent_req *req,
10214                                                     TALLOC_CTX *mem_ctx,
10215                                                     WERROR *result)
10216 {
10217         struct dcerpc_spoolss_FindClosePrinterNotify_state *state = tevent_req_data(
10218                 req, struct dcerpc_spoolss_FindClosePrinterNotify_state);
10219         NTSTATUS status;
10220
10221         if (tevent_req_is_nterror(req, &status)) {
10222                 tevent_req_received(req);
10223                 return status;
10224         }
10225
10226         /* Steal possible out parameters to the callers context */
10227         talloc_steal(mem_ctx, state->out_mem_ctx);
10228
10229         /* Return result */
10230         *result = state->orig.out.result;
10231
10232         tevent_req_received(req);
10233         return NT_STATUS_OK;
10234 }
10235
10236 NTSTATUS dcerpc_spoolss_FindClosePrinterNotify(struct dcerpc_binding_handle *h,
10237                                                TALLOC_CTX *mem_ctx,
10238                                                struct policy_handle *_handle /* [in] [ref] */,
10239                                                WERROR *result)
10240 {
10241         struct spoolss_FindClosePrinterNotify r;
10242         NTSTATUS status;
10243
10244         /* In parameters */
10245         r.in.handle = _handle;
10246
10247         status = dcerpc_spoolss_FindClosePrinterNotify_r(h, mem_ctx, &r);
10248         if (!NT_STATUS_IS_OK(status)) {
10249                 return status;
10250         }
10251
10252         /* Return variables */
10253
10254         /* Return result */
10255         *result = r.out.result;
10256
10257         return NT_STATUS_OK;
10258 }
10259
10260 struct dcerpc_spoolss_ReplyOpenPrinter_r_state {
10261         TALLOC_CTX *out_mem_ctx;
10262 };
10263
10264 static void dcerpc_spoolss_ReplyOpenPrinter_r_done(struct tevent_req *subreq);
10265
10266 struct tevent_req *dcerpc_spoolss_ReplyOpenPrinter_r_send(TALLOC_CTX *mem_ctx,
10267         struct tevent_context *ev,
10268         struct dcerpc_binding_handle *h,
10269         struct spoolss_ReplyOpenPrinter *r)
10270 {
10271         struct tevent_req *req;
10272         struct dcerpc_spoolss_ReplyOpenPrinter_r_state *state;
10273         struct tevent_req *subreq;
10274
10275         req = tevent_req_create(mem_ctx, &state,
10276                                 struct dcerpc_spoolss_ReplyOpenPrinter_r_state);
10277         if (req == NULL) {
10278                 return NULL;
10279         }
10280
10281         state->out_mem_ctx = talloc_new(state);
10282         if (tevent_req_nomem(state->out_mem_ctx, req)) {
10283                 return tevent_req_post(req, ev);
10284         }
10285
10286         subreq = dcerpc_binding_handle_call_send(state, ev, h,
10287                         NULL, &ndr_table_spoolss,
10288                         NDR_SPOOLSS_REPLYOPENPRINTER, state->out_mem_ctx, r);
10289         if (tevent_req_nomem(subreq, req)) {
10290                 return tevent_req_post(req, ev);
10291         }
10292         tevent_req_set_callback(subreq, dcerpc_spoolss_ReplyOpenPrinter_r_done, req);
10293
10294         return req;
10295 }
10296
10297 static void dcerpc_spoolss_ReplyOpenPrinter_r_done(struct tevent_req *subreq)
10298 {
10299         struct tevent_req *req =
10300                 tevent_req_callback_data(subreq,
10301                 struct tevent_req);
10302         NTSTATUS status;
10303
10304         status = dcerpc_binding_handle_call_recv(subreq);
10305         TALLOC_FREE(subreq);
10306         if (tevent_req_nterror(req, status)) {
10307                 return;
10308         }
10309
10310         tevent_req_done(req);
10311 }
10312
10313 NTSTATUS dcerpc_spoolss_ReplyOpenPrinter_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
10314 {
10315         struct dcerpc_spoolss_ReplyOpenPrinter_r_state *state =
10316                 tevent_req_data(req,
10317                 struct dcerpc_spoolss_ReplyOpenPrinter_r_state);
10318         NTSTATUS status;
10319
10320         if (tevent_req_is_nterror(req, &status)) {
10321                 tevent_req_received(req);
10322                 return status;
10323         }
10324
10325         talloc_steal(mem_ctx, state->out_mem_ctx);
10326
10327         tevent_req_received(req);
10328         return NT_STATUS_OK;
10329 }
10330
10331 NTSTATUS dcerpc_spoolss_ReplyOpenPrinter_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_ReplyOpenPrinter *r)
10332 {
10333         NTSTATUS status;
10334
10335         status = dcerpc_binding_handle_call(h,
10336                         NULL, &ndr_table_spoolss,
10337                         NDR_SPOOLSS_REPLYOPENPRINTER, mem_ctx, r);
10338
10339         return status;
10340 }
10341
10342 struct dcerpc_spoolss_ReplyOpenPrinter_state {
10343         struct spoolss_ReplyOpenPrinter orig;
10344         struct spoolss_ReplyOpenPrinter tmp;
10345         TALLOC_CTX *out_mem_ctx;
10346 };
10347
10348 static void dcerpc_spoolss_ReplyOpenPrinter_done(struct tevent_req *subreq);
10349
10350 struct tevent_req *dcerpc_spoolss_ReplyOpenPrinter_send(TALLOC_CTX *mem_ctx,
10351                                                         struct tevent_context *ev,
10352                                                         struct dcerpc_binding_handle *h,
10353                                                         const char *_server_name /* [in] [charset(UTF16)] */,
10354                                                         uint32_t _printer_local /* [in]  */,
10355                                                         enum winreg_Type _type /* [in]  */,
10356                                                         uint32_t _bufsize /* [in] [range(0,512)] */,
10357                                                         uint8_t *_buffer /* [in] [unique,size_is(bufsize)] */,
10358                                                         struct policy_handle *_handle /* [out] [ref] */)
10359 {
10360         struct tevent_req *req;
10361         struct dcerpc_spoolss_ReplyOpenPrinter_state *state;
10362         struct tevent_req *subreq;
10363
10364         req = tevent_req_create(mem_ctx, &state,
10365                                 struct dcerpc_spoolss_ReplyOpenPrinter_state);
10366         if (req == NULL) {
10367                 return NULL;
10368         }
10369         state->out_mem_ctx = NULL;
10370
10371         /* In parameters */
10372         state->orig.in.server_name = _server_name;
10373         state->orig.in.printer_local = _printer_local;
10374         state->orig.in.type = _type;
10375         state->orig.in.bufsize = _bufsize;
10376         state->orig.in.buffer = _buffer;
10377
10378         /* Out parameters */
10379         state->orig.out.handle = _handle;
10380
10381         /* Result */
10382         ZERO_STRUCT(state->orig.out.result);
10383
10384         state->out_mem_ctx = talloc_named_const(state, 0,
10385                              "dcerpc_spoolss_ReplyOpenPrinter_out_memory");
10386         if (tevent_req_nomem(state->out_mem_ctx, req)) {
10387                 return tevent_req_post(req, ev);
10388         }
10389
10390         /* make a temporary copy, that we pass to the dispatch function */
10391         state->tmp = state->orig;
10392
10393         subreq = dcerpc_spoolss_ReplyOpenPrinter_r_send(state, ev, h, &state->tmp);
10394         if (tevent_req_nomem(subreq, req)) {
10395                 return tevent_req_post(req, ev);
10396         }
10397         tevent_req_set_callback(subreq, dcerpc_spoolss_ReplyOpenPrinter_done, req);
10398         return req;
10399 }
10400
10401 static void dcerpc_spoolss_ReplyOpenPrinter_done(struct tevent_req *subreq)
10402 {
10403         struct tevent_req *req = tevent_req_callback_data(
10404                 subreq, struct tevent_req);
10405         struct dcerpc_spoolss_ReplyOpenPrinter_state *state = tevent_req_data(
10406                 req, struct dcerpc_spoolss_ReplyOpenPrinter_state);
10407         NTSTATUS status;
10408         TALLOC_CTX *mem_ctx;
10409
10410         if (state->out_mem_ctx) {
10411                 mem_ctx = state->out_mem_ctx;
10412         } else {
10413                 mem_ctx = state;
10414         }
10415
10416         status = dcerpc_spoolss_ReplyOpenPrinter_r_recv(subreq, mem_ctx);
10417         TALLOC_FREE(subreq);
10418         if (tevent_req_nterror(req, status)) {
10419                 return;
10420         }
10421
10422         /* Copy out parameters */
10423         *state->orig.out.handle = *state->tmp.out.handle;
10424
10425         /* Copy result */
10426         state->orig.out.result = state->tmp.out.result;
10427
10428         /* Reset temporary structure */
10429         ZERO_STRUCT(state->tmp);
10430
10431         tevent_req_done(req);
10432 }
10433
10434 NTSTATUS dcerpc_spoolss_ReplyOpenPrinter_recv(struct tevent_req *req,
10435                                               TALLOC_CTX *mem_ctx,
10436                                               WERROR *result)
10437 {
10438         struct dcerpc_spoolss_ReplyOpenPrinter_state *state = tevent_req_data(
10439                 req, struct dcerpc_spoolss_ReplyOpenPrinter_state);
10440         NTSTATUS status;
10441
10442         if (tevent_req_is_nterror(req, &status)) {
10443                 tevent_req_received(req);
10444                 return status;
10445         }
10446
10447         /* Steal possible out parameters to the callers context */
10448         talloc_steal(mem_ctx, state->out_mem_ctx);
10449
10450         /* Return result */
10451         *result = state->orig.out.result;
10452
10453         tevent_req_received(req);
10454         return NT_STATUS_OK;
10455 }
10456
10457 NTSTATUS dcerpc_spoolss_ReplyOpenPrinter(struct dcerpc_binding_handle *h,
10458                                          TALLOC_CTX *mem_ctx,
10459                                          const char *_server_name /* [in] [charset(UTF16)] */,
10460                                          uint32_t _printer_local /* [in]  */,
10461                                          enum winreg_Type _type /* [in]  */,
10462                                          uint32_t _bufsize /* [in] [range(0,512)] */,
10463                                          uint8_t *_buffer /* [in] [unique,size_is(bufsize)] */,
10464                                          struct policy_handle *_handle /* [out] [ref] */,
10465                                          WERROR *result)
10466 {
10467         struct spoolss_ReplyOpenPrinter r;
10468         NTSTATUS status;
10469
10470         /* In parameters */
10471         r.in.server_name = _server_name;
10472         r.in.printer_local = _printer_local;
10473         r.in.type = _type;
10474         r.in.bufsize = _bufsize;
10475         r.in.buffer = _buffer;
10476
10477         status = dcerpc_spoolss_ReplyOpenPrinter_r(h, mem_ctx, &r);
10478         if (!NT_STATUS_IS_OK(status)) {
10479                 return status;
10480         }
10481
10482         /* Return variables */
10483         *_handle = *r.out.handle;
10484
10485         /* Return result */
10486         *result = r.out.result;
10487
10488         return NT_STATUS_OK;
10489 }
10490
10491 struct dcerpc_spoolss_RouterReplyPrinter_r_state {
10492         TALLOC_CTX *out_mem_ctx;
10493 };
10494
10495 static void dcerpc_spoolss_RouterReplyPrinter_r_done(struct tevent_req *subreq);
10496
10497 struct tevent_req *dcerpc_spoolss_RouterReplyPrinter_r_send(TALLOC_CTX *mem_ctx,
10498         struct tevent_context *ev,
10499         struct dcerpc_binding_handle *h,
10500         struct spoolss_RouterReplyPrinter *r)
10501 {
10502         struct tevent_req *req;
10503         struct dcerpc_spoolss_RouterReplyPrinter_r_state *state;
10504         struct tevent_req *subreq;
10505
10506         req = tevent_req_create(mem_ctx, &state,
10507                                 struct dcerpc_spoolss_RouterReplyPrinter_r_state);
10508         if (req == NULL) {
10509                 return NULL;
10510         }
10511
10512         state->out_mem_ctx = NULL;
10513
10514         subreq = dcerpc_binding_handle_call_send(state, ev, h,
10515                         NULL, &ndr_table_spoolss,
10516                         NDR_SPOOLSS_ROUTERREPLYPRINTER, state, r);
10517         if (tevent_req_nomem(subreq, req)) {
10518                 return tevent_req_post(req, ev);
10519         }
10520         tevent_req_set_callback(subreq, dcerpc_spoolss_RouterReplyPrinter_r_done, req);
10521
10522         return req;
10523 }
10524
10525 static void dcerpc_spoolss_RouterReplyPrinter_r_done(struct tevent_req *subreq)
10526 {
10527         struct tevent_req *req =
10528                 tevent_req_callback_data(subreq,
10529                 struct tevent_req);
10530         NTSTATUS status;
10531
10532         status = dcerpc_binding_handle_call_recv(subreq);
10533         TALLOC_FREE(subreq);
10534         if (tevent_req_nterror(req, status)) {
10535                 return;
10536         }
10537
10538         tevent_req_done(req);
10539 }
10540
10541 NTSTATUS dcerpc_spoolss_RouterReplyPrinter_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
10542 {
10543         struct dcerpc_spoolss_RouterReplyPrinter_r_state *state =
10544                 tevent_req_data(req,
10545                 struct dcerpc_spoolss_RouterReplyPrinter_r_state);
10546         NTSTATUS status;
10547
10548         if (tevent_req_is_nterror(req, &status)) {
10549                 tevent_req_received(req);
10550                 return status;
10551         }
10552
10553         talloc_steal(mem_ctx, state->out_mem_ctx);
10554
10555         tevent_req_received(req);
10556         return NT_STATUS_OK;
10557 }
10558
10559 NTSTATUS dcerpc_spoolss_RouterReplyPrinter_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_RouterReplyPrinter *r)
10560 {
10561         NTSTATUS status;
10562
10563         status = dcerpc_binding_handle_call(h,
10564                         NULL, &ndr_table_spoolss,
10565                         NDR_SPOOLSS_ROUTERREPLYPRINTER, mem_ctx, r);
10566
10567         return status;
10568 }
10569
10570 struct dcerpc_spoolss_RouterReplyPrinter_state {
10571         struct spoolss_RouterReplyPrinter orig;
10572         struct spoolss_RouterReplyPrinter tmp;
10573         TALLOC_CTX *out_mem_ctx;
10574 };
10575
10576 static void dcerpc_spoolss_RouterReplyPrinter_done(struct tevent_req *subreq);
10577
10578 struct tevent_req *dcerpc_spoolss_RouterReplyPrinter_send(TALLOC_CTX *mem_ctx,
10579                                                           struct tevent_context *ev,
10580                                                           struct dcerpc_binding_handle *h,
10581                                                           struct policy_handle *_handle /* [in] [ref] */,
10582                                                           uint32_t _flags /* [in]  */,
10583                                                           uint32_t _bufsize /* [in] [range(0,512)] */,
10584                                                           uint8_t *_buffer /* [in] [unique,size_is(bufsize)] */)
10585 {
10586         struct tevent_req *req;
10587         struct dcerpc_spoolss_RouterReplyPrinter_state *state;
10588         struct tevent_req *subreq;
10589
10590         req = tevent_req_create(mem_ctx, &state,
10591                                 struct dcerpc_spoolss_RouterReplyPrinter_state);
10592         if (req == NULL) {
10593                 return NULL;
10594         }
10595         state->out_mem_ctx = NULL;
10596
10597         /* In parameters */
10598         state->orig.in.handle = _handle;
10599         state->orig.in.flags = _flags;
10600         state->orig.in.bufsize = _bufsize;
10601         state->orig.in.buffer = _buffer;
10602
10603         /* Out parameters */
10604
10605         /* Result */
10606         ZERO_STRUCT(state->orig.out.result);
10607
10608         /* make a temporary copy, that we pass to the dispatch function */
10609         state->tmp = state->orig;
10610
10611         subreq = dcerpc_spoolss_RouterReplyPrinter_r_send(state, ev, h, &state->tmp);
10612         if (tevent_req_nomem(subreq, req)) {
10613                 return tevent_req_post(req, ev);
10614         }
10615         tevent_req_set_callback(subreq, dcerpc_spoolss_RouterReplyPrinter_done, req);
10616         return req;
10617 }
10618
10619 static void dcerpc_spoolss_RouterReplyPrinter_done(struct tevent_req *subreq)
10620 {
10621         struct tevent_req *req = tevent_req_callback_data(
10622                 subreq, struct tevent_req);
10623         struct dcerpc_spoolss_RouterReplyPrinter_state *state = tevent_req_data(
10624                 req, struct dcerpc_spoolss_RouterReplyPrinter_state);
10625         NTSTATUS status;
10626         TALLOC_CTX *mem_ctx;
10627
10628         if (state->out_mem_ctx) {
10629                 mem_ctx = state->out_mem_ctx;
10630         } else {
10631                 mem_ctx = state;
10632         }
10633
10634         status = dcerpc_spoolss_RouterReplyPrinter_r_recv(subreq, mem_ctx);
10635         TALLOC_FREE(subreq);
10636         if (tevent_req_nterror(req, status)) {
10637                 return;
10638         }
10639
10640         /* Copy out parameters */
10641
10642         /* Copy result */
10643         state->orig.out.result = state->tmp.out.result;
10644
10645         /* Reset temporary structure */
10646         ZERO_STRUCT(state->tmp);
10647
10648         tevent_req_done(req);
10649 }
10650
10651 NTSTATUS dcerpc_spoolss_RouterReplyPrinter_recv(struct tevent_req *req,
10652                                                 TALLOC_CTX *mem_ctx,
10653                                                 WERROR *result)
10654 {
10655         struct dcerpc_spoolss_RouterReplyPrinter_state *state = tevent_req_data(
10656                 req, struct dcerpc_spoolss_RouterReplyPrinter_state);
10657         NTSTATUS status;
10658
10659         if (tevent_req_is_nterror(req, &status)) {
10660                 tevent_req_received(req);
10661                 return status;
10662         }
10663
10664         /* Steal possible out parameters to the callers context */
10665         talloc_steal(mem_ctx, state->out_mem_ctx);
10666
10667         /* Return result */
10668         *result = state->orig.out.result;
10669
10670         tevent_req_received(req);
10671         return NT_STATUS_OK;
10672 }
10673
10674 NTSTATUS dcerpc_spoolss_RouterReplyPrinter(struct dcerpc_binding_handle *h,
10675                                            TALLOC_CTX *mem_ctx,
10676                                            struct policy_handle *_handle /* [in] [ref] */,
10677                                            uint32_t _flags /* [in]  */,
10678                                            uint32_t _bufsize /* [in] [range(0,512)] */,
10679                                            uint8_t *_buffer /* [in] [unique,size_is(bufsize)] */,
10680                                            WERROR *result)
10681 {
10682         struct spoolss_RouterReplyPrinter r;
10683         NTSTATUS status;
10684
10685         /* In parameters */
10686         r.in.handle = _handle;
10687         r.in.flags = _flags;
10688         r.in.bufsize = _bufsize;
10689         r.in.buffer = _buffer;
10690
10691         status = dcerpc_spoolss_RouterReplyPrinter_r(h, mem_ctx, &r);
10692         if (!NT_STATUS_IS_OK(status)) {
10693                 return status;
10694         }
10695
10696         /* Return variables */
10697
10698         /* Return result */
10699         *result = r.out.result;
10700
10701         return NT_STATUS_OK;
10702 }
10703
10704 struct dcerpc_spoolss_ReplyClosePrinter_r_state {
10705         TALLOC_CTX *out_mem_ctx;
10706 };
10707
10708 static void dcerpc_spoolss_ReplyClosePrinter_r_done(struct tevent_req *subreq);
10709
10710 struct tevent_req *dcerpc_spoolss_ReplyClosePrinter_r_send(TALLOC_CTX *mem_ctx,
10711         struct tevent_context *ev,
10712         struct dcerpc_binding_handle *h,
10713         struct spoolss_ReplyClosePrinter *r)
10714 {
10715         struct tevent_req *req;
10716         struct dcerpc_spoolss_ReplyClosePrinter_r_state *state;
10717         struct tevent_req *subreq;
10718
10719         req = tevent_req_create(mem_ctx, &state,
10720                                 struct dcerpc_spoolss_ReplyClosePrinter_r_state);
10721         if (req == NULL) {
10722                 return NULL;
10723         }
10724
10725         state->out_mem_ctx = talloc_new(state);
10726         if (tevent_req_nomem(state->out_mem_ctx, req)) {
10727                 return tevent_req_post(req, ev);
10728         }
10729
10730         subreq = dcerpc_binding_handle_call_send(state, ev, h,
10731                         NULL, &ndr_table_spoolss,
10732                         NDR_SPOOLSS_REPLYCLOSEPRINTER, state->out_mem_ctx, r);
10733         if (tevent_req_nomem(subreq, req)) {
10734                 return tevent_req_post(req, ev);
10735         }
10736         tevent_req_set_callback(subreq, dcerpc_spoolss_ReplyClosePrinter_r_done, req);
10737
10738         return req;
10739 }
10740
10741 static void dcerpc_spoolss_ReplyClosePrinter_r_done(struct tevent_req *subreq)
10742 {
10743         struct tevent_req *req =
10744                 tevent_req_callback_data(subreq,
10745                 struct tevent_req);
10746         NTSTATUS status;
10747
10748         status = dcerpc_binding_handle_call_recv(subreq);
10749         TALLOC_FREE(subreq);
10750         if (tevent_req_nterror(req, status)) {
10751                 return;
10752         }
10753
10754         tevent_req_done(req);
10755 }
10756
10757 NTSTATUS dcerpc_spoolss_ReplyClosePrinter_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
10758 {
10759         struct dcerpc_spoolss_ReplyClosePrinter_r_state *state =
10760                 tevent_req_data(req,
10761                 struct dcerpc_spoolss_ReplyClosePrinter_r_state);
10762         NTSTATUS status;
10763
10764         if (tevent_req_is_nterror(req, &status)) {
10765                 tevent_req_received(req);
10766                 return status;
10767         }
10768
10769         talloc_steal(mem_ctx, state->out_mem_ctx);
10770
10771         tevent_req_received(req);
10772         return NT_STATUS_OK;
10773 }
10774
10775 NTSTATUS dcerpc_spoolss_ReplyClosePrinter_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_ReplyClosePrinter *r)
10776 {
10777         NTSTATUS status;
10778
10779         status = dcerpc_binding_handle_call(h,
10780                         NULL, &ndr_table_spoolss,
10781                         NDR_SPOOLSS_REPLYCLOSEPRINTER, mem_ctx, r);
10782
10783         return status;
10784 }
10785
10786 struct dcerpc_spoolss_ReplyClosePrinter_state {
10787         struct spoolss_ReplyClosePrinter orig;
10788         struct spoolss_ReplyClosePrinter tmp;
10789         TALLOC_CTX *out_mem_ctx;
10790 };
10791
10792 static void dcerpc_spoolss_ReplyClosePrinter_done(struct tevent_req *subreq);
10793
10794 struct tevent_req *dcerpc_spoolss_ReplyClosePrinter_send(TALLOC_CTX *mem_ctx,
10795                                                          struct tevent_context *ev,
10796                                                          struct dcerpc_binding_handle *h,
10797                                                          struct policy_handle *_handle /* [in,out] [ref] */)
10798 {
10799         struct tevent_req *req;
10800         struct dcerpc_spoolss_ReplyClosePrinter_state *state;
10801         struct tevent_req *subreq;
10802
10803         req = tevent_req_create(mem_ctx, &state,
10804                                 struct dcerpc_spoolss_ReplyClosePrinter_state);
10805         if (req == NULL) {
10806                 return NULL;
10807         }
10808         state->out_mem_ctx = NULL;
10809
10810         /* In parameters */
10811         state->orig.in.handle = _handle;
10812
10813         /* Out parameters */
10814         state->orig.out.handle = _handle;
10815
10816         /* Result */
10817         ZERO_STRUCT(state->orig.out.result);
10818
10819         state->out_mem_ctx = talloc_named_const(state, 0,
10820                              "dcerpc_spoolss_ReplyClosePrinter_out_memory");
10821         if (tevent_req_nomem(state->out_mem_ctx, req)) {
10822                 return tevent_req_post(req, ev);
10823         }
10824
10825         /* make a temporary copy, that we pass to the dispatch function */
10826         state->tmp = state->orig;
10827
10828         subreq = dcerpc_spoolss_ReplyClosePrinter_r_send(state, ev, h, &state->tmp);
10829         if (tevent_req_nomem(subreq, req)) {
10830                 return tevent_req_post(req, ev);
10831         }
10832         tevent_req_set_callback(subreq, dcerpc_spoolss_ReplyClosePrinter_done, req);
10833         return req;
10834 }
10835
10836 static void dcerpc_spoolss_ReplyClosePrinter_done(struct tevent_req *subreq)
10837 {
10838         struct tevent_req *req = tevent_req_callback_data(
10839                 subreq, struct tevent_req);
10840         struct dcerpc_spoolss_ReplyClosePrinter_state *state = tevent_req_data(
10841                 req, struct dcerpc_spoolss_ReplyClosePrinter_state);
10842         NTSTATUS status;
10843         TALLOC_CTX *mem_ctx;
10844
10845         if (state->out_mem_ctx) {
10846                 mem_ctx = state->out_mem_ctx;
10847         } else {
10848                 mem_ctx = state;
10849         }
10850
10851         status = dcerpc_spoolss_ReplyClosePrinter_r_recv(subreq, mem_ctx);
10852         TALLOC_FREE(subreq);
10853         if (tevent_req_nterror(req, status)) {
10854                 return;
10855         }
10856
10857         /* Copy out parameters */
10858         *state->orig.out.handle = *state->tmp.out.handle;
10859
10860         /* Copy result */
10861         state->orig.out.result = state->tmp.out.result;
10862
10863         /* Reset temporary structure */
10864         ZERO_STRUCT(state->tmp);
10865
10866         tevent_req_done(req);
10867 }
10868
10869 NTSTATUS dcerpc_spoolss_ReplyClosePrinter_recv(struct tevent_req *req,
10870                                                TALLOC_CTX *mem_ctx,
10871                                                WERROR *result)
10872 {
10873         struct dcerpc_spoolss_ReplyClosePrinter_state *state = tevent_req_data(
10874                 req, struct dcerpc_spoolss_ReplyClosePrinter_state);
10875         NTSTATUS status;
10876
10877         if (tevent_req_is_nterror(req, &status)) {
10878                 tevent_req_received(req);
10879                 return status;
10880         }
10881
10882         /* Steal possible out parameters to the callers context */
10883         talloc_steal(mem_ctx, state->out_mem_ctx);
10884
10885         /* Return result */
10886         *result = state->orig.out.result;
10887
10888         tevent_req_received(req);
10889         return NT_STATUS_OK;
10890 }
10891
10892 NTSTATUS dcerpc_spoolss_ReplyClosePrinter(struct dcerpc_binding_handle *h,
10893                                           TALLOC_CTX *mem_ctx,
10894                                           struct policy_handle *_handle /* [in,out] [ref] */,
10895                                           WERROR *result)
10896 {
10897         struct spoolss_ReplyClosePrinter r;
10898         NTSTATUS status;
10899
10900         /* In parameters */
10901         r.in.handle = _handle;
10902
10903         status = dcerpc_spoolss_ReplyClosePrinter_r(h, mem_ctx, &r);
10904         if (!NT_STATUS_IS_OK(status)) {
10905                 return status;
10906         }
10907
10908         /* Return variables */
10909         *_handle = *r.out.handle;
10910
10911         /* Return result */
10912         *result = r.out.result;
10913
10914         return NT_STATUS_OK;
10915 }
10916
10917 struct dcerpc_spoolss_AddPortEx_r_state {
10918         TALLOC_CTX *out_mem_ctx;
10919 };
10920
10921 static void dcerpc_spoolss_AddPortEx_r_done(struct tevent_req *subreq);
10922
10923 struct tevent_req *dcerpc_spoolss_AddPortEx_r_send(TALLOC_CTX *mem_ctx,
10924         struct tevent_context *ev,
10925         struct dcerpc_binding_handle *h,
10926         struct spoolss_AddPortEx *r)
10927 {
10928         struct tevent_req *req;
10929         struct dcerpc_spoolss_AddPortEx_r_state *state;
10930         struct tevent_req *subreq;
10931
10932         req = tevent_req_create(mem_ctx, &state,
10933                                 struct dcerpc_spoolss_AddPortEx_r_state);
10934         if (req == NULL) {
10935                 return NULL;
10936         }
10937
10938         state->out_mem_ctx = NULL;
10939
10940         subreq = dcerpc_binding_handle_call_send(state, ev, h,
10941                         NULL, &ndr_table_spoolss,
10942                         NDR_SPOOLSS_ADDPORTEX, state, r);
10943         if (tevent_req_nomem(subreq, req)) {
10944                 return tevent_req_post(req, ev);
10945         }
10946         tevent_req_set_callback(subreq, dcerpc_spoolss_AddPortEx_r_done, req);
10947
10948         return req;
10949 }
10950
10951 static void dcerpc_spoolss_AddPortEx_r_done(struct tevent_req *subreq)
10952 {
10953         struct tevent_req *req =
10954                 tevent_req_callback_data(subreq,
10955                 struct tevent_req);
10956         NTSTATUS status;
10957
10958         status = dcerpc_binding_handle_call_recv(subreq);
10959         TALLOC_FREE(subreq);
10960         if (tevent_req_nterror(req, status)) {
10961                 return;
10962         }
10963
10964         tevent_req_done(req);
10965 }
10966
10967 NTSTATUS dcerpc_spoolss_AddPortEx_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
10968 {
10969         struct dcerpc_spoolss_AddPortEx_r_state *state =
10970                 tevent_req_data(req,
10971                 struct dcerpc_spoolss_AddPortEx_r_state);
10972         NTSTATUS status;
10973
10974         if (tevent_req_is_nterror(req, &status)) {
10975                 tevent_req_received(req);
10976                 return status;
10977         }
10978
10979         talloc_steal(mem_ctx, state->out_mem_ctx);
10980
10981         tevent_req_received(req);
10982         return NT_STATUS_OK;
10983 }
10984
10985 NTSTATUS dcerpc_spoolss_AddPortEx_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_AddPortEx *r)
10986 {
10987         NTSTATUS status;
10988
10989         status = dcerpc_binding_handle_call(h,
10990                         NULL, &ndr_table_spoolss,
10991                         NDR_SPOOLSS_ADDPORTEX, mem_ctx, r);
10992
10993         return status;
10994 }
10995
10996 struct dcerpc_spoolss_AddPortEx_state {
10997         struct spoolss_AddPortEx orig;
10998         struct spoolss_AddPortEx tmp;
10999         TALLOC_CTX *out_mem_ctx;
11000 };
11001
11002 static void dcerpc_spoolss_AddPortEx_done(struct tevent_req *subreq);
11003
11004 struct tevent_req *dcerpc_spoolss_AddPortEx_send(TALLOC_CTX *mem_ctx,
11005                                                  struct tevent_context *ev,
11006                                                  struct dcerpc_binding_handle *h,
11007                                                  const char *_servername /* [in] [unique,charset(UTF16)] */,
11008                                                  struct spoolss_SetPortInfoContainer *_port_ctr /* [in] [ref] */,
11009                                                  struct spoolss_PortVarContainer *_port_var_ctr /* [in] [ref] */,
11010                                                  const char *_monitor_name /* [in] [unique,charset(UTF16)] */)
11011 {
11012         struct tevent_req *req;
11013         struct dcerpc_spoolss_AddPortEx_state *state;
11014         struct tevent_req *subreq;
11015
11016         req = tevent_req_create(mem_ctx, &state,
11017                                 struct dcerpc_spoolss_AddPortEx_state);
11018         if (req == NULL) {
11019                 return NULL;
11020         }
11021         state->out_mem_ctx = NULL;
11022
11023         /* In parameters */
11024         state->orig.in.servername = _servername;
11025         state->orig.in.port_ctr = _port_ctr;
11026         state->orig.in.port_var_ctr = _port_var_ctr;
11027         state->orig.in.monitor_name = _monitor_name;
11028
11029         /* Out parameters */
11030
11031         /* Result */
11032         ZERO_STRUCT(state->orig.out.result);
11033
11034         /* make a temporary copy, that we pass to the dispatch function */
11035         state->tmp = state->orig;
11036
11037         subreq = dcerpc_spoolss_AddPortEx_r_send(state, ev, h, &state->tmp);
11038         if (tevent_req_nomem(subreq, req)) {
11039                 return tevent_req_post(req, ev);
11040         }
11041         tevent_req_set_callback(subreq, dcerpc_spoolss_AddPortEx_done, req);
11042         return req;
11043 }
11044
11045 static void dcerpc_spoolss_AddPortEx_done(struct tevent_req *subreq)
11046 {
11047         struct tevent_req *req = tevent_req_callback_data(
11048                 subreq, struct tevent_req);
11049         struct dcerpc_spoolss_AddPortEx_state *state = tevent_req_data(
11050                 req, struct dcerpc_spoolss_AddPortEx_state);
11051         NTSTATUS status;
11052         TALLOC_CTX *mem_ctx;
11053
11054         if (state->out_mem_ctx) {
11055                 mem_ctx = state->out_mem_ctx;
11056         } else {
11057                 mem_ctx = state;
11058         }
11059
11060         status = dcerpc_spoolss_AddPortEx_r_recv(subreq, mem_ctx);
11061         TALLOC_FREE(subreq);
11062         if (tevent_req_nterror(req, status)) {
11063                 return;
11064         }
11065
11066         /* Copy out parameters */
11067
11068         /* Copy result */
11069         state->orig.out.result = state->tmp.out.result;
11070
11071         /* Reset temporary structure */
11072         ZERO_STRUCT(state->tmp);
11073
11074         tevent_req_done(req);
11075 }
11076
11077 NTSTATUS dcerpc_spoolss_AddPortEx_recv(struct tevent_req *req,
11078                                        TALLOC_CTX *mem_ctx,
11079                                        WERROR *result)
11080 {
11081         struct dcerpc_spoolss_AddPortEx_state *state = tevent_req_data(
11082                 req, struct dcerpc_spoolss_AddPortEx_state);
11083         NTSTATUS status;
11084
11085         if (tevent_req_is_nterror(req, &status)) {
11086                 tevent_req_received(req);
11087                 return status;
11088         }
11089
11090         /* Steal possible out parameters to the callers context */
11091         talloc_steal(mem_ctx, state->out_mem_ctx);
11092
11093         /* Return result */
11094         *result = state->orig.out.result;
11095
11096         tevent_req_received(req);
11097         return NT_STATUS_OK;
11098 }
11099
11100 NTSTATUS dcerpc_spoolss_AddPortEx(struct dcerpc_binding_handle *h,
11101                                   TALLOC_CTX *mem_ctx,
11102                                   const char *_servername /* [in] [unique,charset(UTF16)] */,
11103                                   struct spoolss_SetPortInfoContainer *_port_ctr /* [in] [ref] */,
11104                                   struct spoolss_PortVarContainer *_port_var_ctr /* [in] [ref] */,
11105                                   const char *_monitor_name /* [in] [unique,charset(UTF16)] */,
11106                                   WERROR *result)
11107 {
11108         struct spoolss_AddPortEx r;
11109         NTSTATUS status;
11110
11111         /* In parameters */
11112         r.in.servername = _servername;
11113         r.in.port_ctr = _port_ctr;
11114         r.in.port_var_ctr = _port_var_ctr;
11115         r.in.monitor_name = _monitor_name;
11116
11117         status = dcerpc_spoolss_AddPortEx_r(h, mem_ctx, &r);
11118         if (!NT_STATUS_IS_OK(status)) {
11119                 return status;
11120         }
11121
11122         /* Return variables */
11123
11124         /* Return result */
11125         *result = r.out.result;
11126
11127         return NT_STATUS_OK;
11128 }
11129
11130 struct dcerpc_spoolss_RemoteFindFirstPrinterChangeNotifyEx_r_state {
11131         TALLOC_CTX *out_mem_ctx;
11132 };
11133
11134 static void dcerpc_spoolss_RemoteFindFirstPrinterChangeNotifyEx_r_done(struct tevent_req *subreq);
11135
11136 struct tevent_req *dcerpc_spoolss_RemoteFindFirstPrinterChangeNotifyEx_r_send(TALLOC_CTX *mem_ctx,
11137         struct tevent_context *ev,
11138         struct dcerpc_binding_handle *h,
11139         struct spoolss_RemoteFindFirstPrinterChangeNotifyEx *r)
11140 {
11141         struct tevent_req *req;
11142         struct dcerpc_spoolss_RemoteFindFirstPrinterChangeNotifyEx_r_state *state;
11143         struct tevent_req *subreq;
11144
11145         req = tevent_req_create(mem_ctx, &state,
11146                                 struct dcerpc_spoolss_RemoteFindFirstPrinterChangeNotifyEx_r_state);
11147         if (req == NULL) {
11148                 return NULL;
11149         }
11150
11151         state->out_mem_ctx = NULL;
11152
11153         subreq = dcerpc_binding_handle_call_send(state, ev, h,
11154                         NULL, &ndr_table_spoolss,
11155                         NDR_SPOOLSS_REMOTEFINDFIRSTPRINTERCHANGENOTIFYEX, state, r);
11156         if (tevent_req_nomem(subreq, req)) {
11157                 return tevent_req_post(req, ev);
11158         }
11159         tevent_req_set_callback(subreq, dcerpc_spoolss_RemoteFindFirstPrinterChangeNotifyEx_r_done, req);
11160
11161         return req;
11162 }
11163
11164 static void dcerpc_spoolss_RemoteFindFirstPrinterChangeNotifyEx_r_done(struct tevent_req *subreq)
11165 {
11166         struct tevent_req *req =
11167                 tevent_req_callback_data(subreq,
11168                 struct tevent_req);
11169         NTSTATUS status;
11170
11171         status = dcerpc_binding_handle_call_recv(subreq);
11172         TALLOC_FREE(subreq);
11173         if (tevent_req_nterror(req, status)) {
11174                 return;
11175         }
11176
11177         tevent_req_done(req);
11178 }
11179
11180 NTSTATUS dcerpc_spoolss_RemoteFindFirstPrinterChangeNotifyEx_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
11181 {
11182         struct dcerpc_spoolss_RemoteFindFirstPrinterChangeNotifyEx_r_state *state =
11183                 tevent_req_data(req,
11184                 struct dcerpc_spoolss_RemoteFindFirstPrinterChangeNotifyEx_r_state);
11185         NTSTATUS status;
11186
11187         if (tevent_req_is_nterror(req, &status)) {
11188                 tevent_req_received(req);
11189                 return status;
11190         }
11191
11192         talloc_steal(mem_ctx, state->out_mem_ctx);
11193
11194         tevent_req_received(req);
11195         return NT_STATUS_OK;
11196 }
11197
11198 NTSTATUS dcerpc_spoolss_RemoteFindFirstPrinterChangeNotifyEx_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_RemoteFindFirstPrinterChangeNotifyEx *r)
11199 {
11200         NTSTATUS status;
11201
11202         status = dcerpc_binding_handle_call(h,
11203                         NULL, &ndr_table_spoolss,
11204                         NDR_SPOOLSS_REMOTEFINDFIRSTPRINTERCHANGENOTIFYEX, mem_ctx, r);
11205
11206         return status;
11207 }
11208
11209 struct dcerpc_spoolss_RemoteFindFirstPrinterChangeNotifyEx_state {
11210         struct spoolss_RemoteFindFirstPrinterChangeNotifyEx orig;
11211         struct spoolss_RemoteFindFirstPrinterChangeNotifyEx tmp;
11212         TALLOC_CTX *out_mem_ctx;
11213 };
11214
11215 static void dcerpc_spoolss_RemoteFindFirstPrinterChangeNotifyEx_done(struct tevent_req *subreq);
11216
11217 struct tevent_req *dcerpc_spoolss_RemoteFindFirstPrinterChangeNotifyEx_send(TALLOC_CTX *mem_ctx,
11218                                                                             struct tevent_context *ev,
11219                                                                             struct dcerpc_binding_handle *h,
11220                                                                             struct policy_handle *_handle /* [in] [ref] */,
11221                                                                             uint32_t _flags /* [in]  */,
11222                                                                             uint32_t _options /* [in]  */,
11223                                                                             const char *_local_machine /* [in] [unique,charset(UTF16)] */,
11224                                                                             uint32_t _printer_local /* [in]  */,
11225                                                                             struct spoolss_NotifyOption *_notify_options /* [in] [unique] */)
11226 {
11227         struct tevent_req *req;
11228         struct dcerpc_spoolss_RemoteFindFirstPrinterChangeNotifyEx_state *state;
11229         struct tevent_req *subreq;
11230
11231         req = tevent_req_create(mem_ctx, &state,
11232                                 struct dcerpc_spoolss_RemoteFindFirstPrinterChangeNotifyEx_state);
11233         if (req == NULL) {
11234                 return NULL;
11235         }
11236         state->out_mem_ctx = NULL;
11237
11238         /* In parameters */
11239         state->orig.in.handle = _handle;
11240         state->orig.in.flags = _flags;
11241         state->orig.in.options = _options;
11242         state->orig.in.local_machine = _local_machine;
11243         state->orig.in.printer_local = _printer_local;
11244         state->orig.in.notify_options = _notify_options;
11245
11246         /* Out parameters */
11247
11248         /* Result */
11249         ZERO_STRUCT(state->orig.out.result);
11250
11251         /* make a temporary copy, that we pass to the dispatch function */
11252         state->tmp = state->orig;
11253
11254         subreq = dcerpc_spoolss_RemoteFindFirstPrinterChangeNotifyEx_r_send(state, ev, h, &state->tmp);
11255         if (tevent_req_nomem(subreq, req)) {
11256                 return tevent_req_post(req, ev);
11257         }
11258         tevent_req_set_callback(subreq, dcerpc_spoolss_RemoteFindFirstPrinterChangeNotifyEx_done, req);
11259         return req;
11260 }
11261
11262 static void dcerpc_spoolss_RemoteFindFirstPrinterChangeNotifyEx_done(struct tevent_req *subreq)
11263 {
11264         struct tevent_req *req = tevent_req_callback_data(
11265                 subreq, struct tevent_req);
11266         struct dcerpc_spoolss_RemoteFindFirstPrinterChangeNotifyEx_state *state = tevent_req_data(
11267                 req, struct dcerpc_spoolss_RemoteFindFirstPrinterChangeNotifyEx_state);
11268         NTSTATUS status;
11269         TALLOC_CTX *mem_ctx;
11270
11271         if (state->out_mem_ctx) {
11272                 mem_ctx = state->out_mem_ctx;
11273         } else {
11274                 mem_ctx = state;
11275         }
11276
11277         status = dcerpc_spoolss_RemoteFindFirstPrinterChangeNotifyEx_r_recv(subreq, mem_ctx);
11278         TALLOC_FREE(subreq);
11279         if (tevent_req_nterror(req, status)) {
11280                 return;
11281         }
11282
11283         /* Copy out parameters */
11284
11285         /* Copy result */
11286         state->orig.out.result = state->tmp.out.result;
11287
11288         /* Reset temporary structure */
11289         ZERO_STRUCT(state->tmp);
11290
11291         tevent_req_done(req);
11292 }
11293
11294 NTSTATUS dcerpc_spoolss_RemoteFindFirstPrinterChangeNotifyEx_recv(struct tevent_req *req,
11295                                                                   TALLOC_CTX *mem_ctx,
11296                                                                   WERROR *result)
11297 {
11298         struct dcerpc_spoolss_RemoteFindFirstPrinterChangeNotifyEx_state *state = tevent_req_data(
11299                 req, struct dcerpc_spoolss_RemoteFindFirstPrinterChangeNotifyEx_state);
11300         NTSTATUS status;
11301
11302         if (tevent_req_is_nterror(req, &status)) {
11303                 tevent_req_received(req);
11304                 return status;
11305         }
11306
11307         /* Steal possible out parameters to the callers context */
11308         talloc_steal(mem_ctx, state->out_mem_ctx);
11309
11310         /* Return result */
11311         *result = state->orig.out.result;
11312
11313         tevent_req_received(req);
11314         return NT_STATUS_OK;
11315 }
11316
11317 NTSTATUS dcerpc_spoolss_RemoteFindFirstPrinterChangeNotifyEx(struct dcerpc_binding_handle *h,
11318                                                              TALLOC_CTX *mem_ctx,
11319                                                              struct policy_handle *_handle /* [in] [ref] */,
11320                                                              uint32_t _flags /* [in]  */,
11321                                                              uint32_t _options /* [in]  */,
11322                                                              const char *_local_machine /* [in] [unique,charset(UTF16)] */,
11323                                                              uint32_t _printer_local /* [in]  */,
11324                                                              struct spoolss_NotifyOption *_notify_options /* [in] [unique] */,
11325                                                              WERROR *result)
11326 {
11327         struct spoolss_RemoteFindFirstPrinterChangeNotifyEx r;
11328         NTSTATUS status;
11329
11330         /* In parameters */
11331         r.in.handle = _handle;
11332         r.in.flags = _flags;
11333         r.in.options = _options;
11334         r.in.local_machine = _local_machine;
11335         r.in.printer_local = _printer_local;
11336         r.in.notify_options = _notify_options;
11337
11338         status = dcerpc_spoolss_RemoteFindFirstPrinterChangeNotifyEx_r(h, mem_ctx, &r);
11339         if (!NT_STATUS_IS_OK(status)) {
11340                 return status;
11341         }
11342
11343         /* Return variables */
11344
11345         /* Return result */
11346         *result = r.out.result;
11347
11348         return NT_STATUS_OK;
11349 }
11350
11351 struct dcerpc_spoolss_RouterReplyPrinterEx_r_state {
11352         TALLOC_CTX *out_mem_ctx;
11353 };
11354
11355 static void dcerpc_spoolss_RouterReplyPrinterEx_r_done(struct tevent_req *subreq);
11356
11357 struct tevent_req *dcerpc_spoolss_RouterReplyPrinterEx_r_send(TALLOC_CTX *mem_ctx,
11358         struct tevent_context *ev,
11359         struct dcerpc_binding_handle *h,
11360         struct spoolss_RouterReplyPrinterEx *r)
11361 {
11362         struct tevent_req *req;
11363         struct dcerpc_spoolss_RouterReplyPrinterEx_r_state *state;
11364         struct tevent_req *subreq;
11365
11366         req = tevent_req_create(mem_ctx, &state,
11367                                 struct dcerpc_spoolss_RouterReplyPrinterEx_r_state);
11368         if (req == NULL) {
11369                 return NULL;
11370         }
11371
11372         state->out_mem_ctx = talloc_new(state);
11373         if (tevent_req_nomem(state->out_mem_ctx, req)) {
11374                 return tevent_req_post(req, ev);
11375         }
11376
11377         subreq = dcerpc_binding_handle_call_send(state, ev, h,
11378                         NULL, &ndr_table_spoolss,
11379                         NDR_SPOOLSS_ROUTERREPLYPRINTEREX, state->out_mem_ctx, r);
11380         if (tevent_req_nomem(subreq, req)) {
11381                 return tevent_req_post(req, ev);
11382         }
11383         tevent_req_set_callback(subreq, dcerpc_spoolss_RouterReplyPrinterEx_r_done, req);
11384
11385         return req;
11386 }
11387
11388 static void dcerpc_spoolss_RouterReplyPrinterEx_r_done(struct tevent_req *subreq)
11389 {
11390         struct tevent_req *req =
11391                 tevent_req_callback_data(subreq,
11392                 struct tevent_req);
11393         NTSTATUS status;
11394
11395         status = dcerpc_binding_handle_call_recv(subreq);
11396         TALLOC_FREE(subreq);
11397         if (tevent_req_nterror(req, status)) {
11398                 return;
11399         }
11400
11401         tevent_req_done(req);
11402 }
11403
11404 NTSTATUS dcerpc_spoolss_RouterReplyPrinterEx_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
11405 {
11406         struct dcerpc_spoolss_RouterReplyPrinterEx_r_state *state =
11407                 tevent_req_data(req,
11408                 struct dcerpc_spoolss_RouterReplyPrinterEx_r_state);
11409         NTSTATUS status;
11410
11411         if (tevent_req_is_nterror(req, &status)) {
11412                 tevent_req_received(req);
11413                 return status;
11414         }
11415
11416         talloc_steal(mem_ctx, state->out_mem_ctx);
11417
11418         tevent_req_received(req);
11419         return NT_STATUS_OK;
11420 }
11421
11422 NTSTATUS dcerpc_spoolss_RouterReplyPrinterEx_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_RouterReplyPrinterEx *r)
11423 {
11424         NTSTATUS status;
11425
11426         status = dcerpc_binding_handle_call(h,
11427                         NULL, &ndr_table_spoolss,
11428                         NDR_SPOOLSS_ROUTERREPLYPRINTEREX, mem_ctx, r);
11429
11430         return status;
11431 }
11432
11433 struct dcerpc_spoolss_RouterReplyPrinterEx_state {
11434         struct spoolss_RouterReplyPrinterEx orig;
11435         struct spoolss_RouterReplyPrinterEx tmp;
11436         TALLOC_CTX *out_mem_ctx;
11437 };
11438
11439 static void dcerpc_spoolss_RouterReplyPrinterEx_done(struct tevent_req *subreq);
11440
11441 struct tevent_req *dcerpc_spoolss_RouterReplyPrinterEx_send(TALLOC_CTX *mem_ctx,
11442                                                             struct tevent_context *ev,
11443                                                             struct dcerpc_binding_handle *h,
11444                                                             struct policy_handle *_handle /* [in] [ref] */,
11445                                                             uint32_t _color /* [in]  */,
11446                                                             uint32_t _flags /* [in]  */,
11447                                                             uint32_t *_reply_result /* [out] [ref] */,
11448                                                             uint32_t _reply_type /* [in]  */,
11449                                                             union spoolss_ReplyPrinterInfo _info /* [in] [switch_is(reply_type)] */)
11450 {
11451         struct tevent_req *req;
11452         struct dcerpc_spoolss_RouterReplyPrinterEx_state *state;
11453         struct tevent_req *subreq;
11454
11455         req = tevent_req_create(mem_ctx, &state,
11456                                 struct dcerpc_spoolss_RouterReplyPrinterEx_state);
11457         if (req == NULL) {
11458                 return NULL;
11459         }
11460         state->out_mem_ctx = NULL;
11461
11462         /* In parameters */
11463         state->orig.in.handle = _handle;
11464         state->orig.in.color = _color;
11465         state->orig.in.flags = _flags;
11466         state->orig.in.reply_type = _reply_type;
11467         state->orig.in.info = _info;
11468
11469         /* Out parameters */
11470         state->orig.out.reply_result = _reply_result;
11471
11472         /* Result */
11473         ZERO_STRUCT(state->orig.out.result);
11474
11475         state->out_mem_ctx = talloc_named_const(state, 0,
11476                              "dcerpc_spoolss_RouterReplyPrinterEx_out_memory");
11477         if (tevent_req_nomem(state->out_mem_ctx, req)) {
11478                 return tevent_req_post(req, ev);
11479         }
11480
11481         /* make a temporary copy, that we pass to the dispatch function */
11482         state->tmp = state->orig;
11483
11484         subreq = dcerpc_spoolss_RouterReplyPrinterEx_r_send(state, ev, h, &state->tmp);
11485         if (tevent_req_nomem(subreq, req)) {
11486                 return tevent_req_post(req, ev);
11487         }
11488         tevent_req_set_callback(subreq, dcerpc_spoolss_RouterReplyPrinterEx_done, req);
11489         return req;
11490 }
11491
11492 static void dcerpc_spoolss_RouterReplyPrinterEx_done(struct tevent_req *subreq)
11493 {
11494         struct tevent_req *req = tevent_req_callback_data(
11495                 subreq, struct tevent_req);
11496         struct dcerpc_spoolss_RouterReplyPrinterEx_state *state = tevent_req_data(
11497                 req, struct dcerpc_spoolss_RouterReplyPrinterEx_state);
11498         NTSTATUS status;
11499         TALLOC_CTX *mem_ctx;
11500
11501         if (state->out_mem_ctx) {
11502                 mem_ctx = state->out_mem_ctx;
11503         } else {
11504                 mem_ctx = state;
11505         }
11506
11507         status = dcerpc_spoolss_RouterReplyPrinterEx_r_recv(subreq, mem_ctx);
11508         TALLOC_FREE(subreq);
11509         if (tevent_req_nterror(req, status)) {
11510                 return;
11511         }
11512
11513         /* Copy out parameters */
11514         *state->orig.out.reply_result = *state->tmp.out.reply_result;
11515
11516         /* Copy result */
11517         state->orig.out.result = state->tmp.out.result;
11518
11519         /* Reset temporary structure */
11520         ZERO_STRUCT(state->tmp);
11521
11522         tevent_req_done(req);
11523 }
11524
11525 NTSTATUS dcerpc_spoolss_RouterReplyPrinterEx_recv(struct tevent_req *req,
11526                                                   TALLOC_CTX *mem_ctx,
11527                                                   WERROR *result)
11528 {
11529         struct dcerpc_spoolss_RouterReplyPrinterEx_state *state = tevent_req_data(
11530                 req, struct dcerpc_spoolss_RouterReplyPrinterEx_state);
11531         NTSTATUS status;
11532
11533         if (tevent_req_is_nterror(req, &status)) {
11534                 tevent_req_received(req);
11535                 return status;
11536         }
11537
11538         /* Steal possible out parameters to the callers context */
11539         talloc_steal(mem_ctx, state->out_mem_ctx);
11540
11541         /* Return result */
11542         *result = state->orig.out.result;
11543
11544         tevent_req_received(req);
11545         return NT_STATUS_OK;
11546 }
11547
11548 NTSTATUS dcerpc_spoolss_RouterReplyPrinterEx(struct dcerpc_binding_handle *h,
11549                                              TALLOC_CTX *mem_ctx,
11550                                              struct policy_handle *_handle /* [in] [ref] */,
11551                                              uint32_t _color /* [in]  */,
11552                                              uint32_t _flags /* [in]  */,
11553                                              uint32_t *_reply_result /* [out] [ref] */,
11554                                              uint32_t _reply_type /* [in]  */,
11555                                              union spoolss_ReplyPrinterInfo _info /* [in] [switch_is(reply_type)] */,
11556                                              WERROR *result)
11557 {
11558         struct spoolss_RouterReplyPrinterEx r;
11559         NTSTATUS status;
11560
11561         /* In parameters */
11562         r.in.handle = _handle;
11563         r.in.color = _color;
11564         r.in.flags = _flags;
11565         r.in.reply_type = _reply_type;
11566         r.in.info = _info;
11567
11568         status = dcerpc_spoolss_RouterReplyPrinterEx_r(h, mem_ctx, &r);
11569         if (!NT_STATUS_IS_OK(status)) {
11570                 return status;
11571         }
11572
11573         /* Return variables */
11574         *_reply_result = *r.out.reply_result;
11575
11576         /* Return result */
11577         *result = r.out.result;
11578
11579         return NT_STATUS_OK;
11580 }
11581
11582 struct dcerpc_spoolss_RouterRefreshPrinterChangeNotify_r_state {
11583         TALLOC_CTX *out_mem_ctx;
11584 };
11585
11586 static void dcerpc_spoolss_RouterRefreshPrinterChangeNotify_r_done(struct tevent_req *subreq);
11587
11588 struct tevent_req *dcerpc_spoolss_RouterRefreshPrinterChangeNotify_r_send(TALLOC_CTX *mem_ctx,
11589         struct tevent_context *ev,
11590         struct dcerpc_binding_handle *h,
11591         struct spoolss_RouterRefreshPrinterChangeNotify *r)
11592 {
11593         struct tevent_req *req;
11594         struct dcerpc_spoolss_RouterRefreshPrinterChangeNotify_r_state *state;
11595         struct tevent_req *subreq;
11596
11597         req = tevent_req_create(mem_ctx, &state,
11598                                 struct dcerpc_spoolss_RouterRefreshPrinterChangeNotify_r_state);
11599         if (req == NULL) {
11600                 return NULL;
11601         }
11602
11603         state->out_mem_ctx = talloc_new(state);
11604         if (tevent_req_nomem(state->out_mem_ctx, req)) {
11605                 return tevent_req_post(req, ev);
11606         }
11607
11608         subreq = dcerpc_binding_handle_call_send(state, ev, h,
11609                         NULL, &ndr_table_spoolss,
11610                         NDR_SPOOLSS_ROUTERREFRESHPRINTERCHANGENOTIFY, state->out_mem_ctx, r);
11611         if (tevent_req_nomem(subreq, req)) {
11612                 return tevent_req_post(req, ev);
11613         }
11614         tevent_req_set_callback(subreq, dcerpc_spoolss_RouterRefreshPrinterChangeNotify_r_done, req);
11615
11616         return req;
11617 }
11618
11619 static void dcerpc_spoolss_RouterRefreshPrinterChangeNotify_r_done(struct tevent_req *subreq)
11620 {
11621         struct tevent_req *req =
11622                 tevent_req_callback_data(subreq,
11623                 struct tevent_req);
11624         NTSTATUS status;
11625
11626         status = dcerpc_binding_handle_call_recv(subreq);
11627         TALLOC_FREE(subreq);
11628         if (tevent_req_nterror(req, status)) {
11629                 return;
11630         }
11631
11632         tevent_req_done(req);
11633 }
11634
11635 NTSTATUS dcerpc_spoolss_RouterRefreshPrinterChangeNotify_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
11636 {
11637         struct dcerpc_spoolss_RouterRefreshPrinterChangeNotify_r_state *state =
11638                 tevent_req_data(req,
11639                 struct dcerpc_spoolss_RouterRefreshPrinterChangeNotify_r_state);
11640         NTSTATUS status;
11641
11642         if (tevent_req_is_nterror(req, &status)) {
11643                 tevent_req_received(req);
11644                 return status;
11645         }
11646
11647         talloc_steal(mem_ctx, state->out_mem_ctx);
11648
11649         tevent_req_received(req);
11650         return NT_STATUS_OK;
11651 }
11652
11653 NTSTATUS dcerpc_spoolss_RouterRefreshPrinterChangeNotify_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_RouterRefreshPrinterChangeNotify *r)
11654 {
11655         NTSTATUS status;
11656
11657         status = dcerpc_binding_handle_call(h,
11658                         NULL, &ndr_table_spoolss,
11659                         NDR_SPOOLSS_ROUTERREFRESHPRINTERCHANGENOTIFY, mem_ctx, r);
11660
11661         return status;
11662 }
11663
11664 struct dcerpc_spoolss_RouterRefreshPrinterChangeNotify_state {
11665         struct spoolss_RouterRefreshPrinterChangeNotify orig;
11666         struct spoolss_RouterRefreshPrinterChangeNotify tmp;
11667         TALLOC_CTX *out_mem_ctx;
11668 };
11669
11670 static void dcerpc_spoolss_RouterRefreshPrinterChangeNotify_done(struct tevent_req *subreq);
11671
11672 struct tevent_req *dcerpc_spoolss_RouterRefreshPrinterChangeNotify_send(TALLOC_CTX *mem_ctx,
11673                                                                         struct tevent_context *ev,
11674                                                                         struct dcerpc_binding_handle *h,
11675                                                                         struct policy_handle *_handle /* [in] [ref] */,
11676                                                                         uint32_t _change_low /* [in]  */,
11677                                                                         struct spoolss_NotifyOption *_options /* [in] [unique] */,
11678                                                                         struct spoolss_NotifyInfo **_info /* [out] [ref] */)
11679 {
11680         struct tevent_req *req;
11681         struct dcerpc_spoolss_RouterRefreshPrinterChangeNotify_state *state;
11682         struct tevent_req *subreq;
11683
11684         req = tevent_req_create(mem_ctx, &state,
11685                                 struct dcerpc_spoolss_RouterRefreshPrinterChangeNotify_state);
11686         if (req == NULL) {
11687                 return NULL;
11688         }
11689         state->out_mem_ctx = NULL;
11690
11691         /* In parameters */
11692         state->orig.in.handle = _handle;
11693         state->orig.in.change_low = _change_low;
11694         state->orig.in.options = _options;
11695
11696         /* Out parameters */
11697         state->orig.out.info = _info;
11698
11699         /* Result */
11700         ZERO_STRUCT(state->orig.out.result);
11701
11702         state->out_mem_ctx = talloc_named_const(state, 0,
11703                              "dcerpc_spoolss_RouterRefreshPrinterChangeNotify_out_memory");
11704         if (tevent_req_nomem(state->out_mem_ctx, req)) {
11705                 return tevent_req_post(req, ev);
11706         }
11707
11708         /* make a temporary copy, that we pass to the dispatch function */
11709         state->tmp = state->orig;
11710
11711         subreq = dcerpc_spoolss_RouterRefreshPrinterChangeNotify_r_send(state, ev, h, &state->tmp);
11712         if (tevent_req_nomem(subreq, req)) {
11713                 return tevent_req_post(req, ev);
11714         }
11715         tevent_req_set_callback(subreq, dcerpc_spoolss_RouterRefreshPrinterChangeNotify_done, req);
11716         return req;
11717 }
11718
11719 static void dcerpc_spoolss_RouterRefreshPrinterChangeNotify_done(struct tevent_req *subreq)
11720 {
11721         struct tevent_req *req = tevent_req_callback_data(
11722                 subreq, struct tevent_req);
11723         struct dcerpc_spoolss_RouterRefreshPrinterChangeNotify_state *state = tevent_req_data(
11724                 req, struct dcerpc_spoolss_RouterRefreshPrinterChangeNotify_state);
11725         NTSTATUS status;
11726         TALLOC_CTX *mem_ctx;
11727
11728         if (state->out_mem_ctx) {
11729                 mem_ctx = state->out_mem_ctx;
11730         } else {
11731                 mem_ctx = state;
11732         }
11733
11734         status = dcerpc_spoolss_RouterRefreshPrinterChangeNotify_r_recv(subreq, mem_ctx);
11735         TALLOC_FREE(subreq);
11736         if (tevent_req_nterror(req, status)) {
11737                 return;
11738         }
11739
11740         /* Copy out parameters */
11741         *state->orig.out.info = *state->tmp.out.info;
11742
11743         /* Copy result */
11744         state->orig.out.result = state->tmp.out.result;
11745
11746         /* Reset temporary structure */
11747         ZERO_STRUCT(state->tmp);
11748
11749         tevent_req_done(req);
11750 }
11751
11752 NTSTATUS dcerpc_spoolss_RouterRefreshPrinterChangeNotify_recv(struct tevent_req *req,
11753                                                               TALLOC_CTX *mem_ctx,
11754                                                               WERROR *result)
11755 {
11756         struct dcerpc_spoolss_RouterRefreshPrinterChangeNotify_state *state = tevent_req_data(
11757                 req, struct dcerpc_spoolss_RouterRefreshPrinterChangeNotify_state);
11758         NTSTATUS status;
11759
11760         if (tevent_req_is_nterror(req, &status)) {
11761                 tevent_req_received(req);
11762                 return status;
11763         }
11764
11765         /* Steal possible out parameters to the callers context */
11766         talloc_steal(mem_ctx, state->out_mem_ctx);
11767
11768         /* Return result */
11769         *result = state->orig.out.result;
11770
11771         tevent_req_received(req);
11772         return NT_STATUS_OK;
11773 }
11774
11775 NTSTATUS dcerpc_spoolss_RouterRefreshPrinterChangeNotify(struct dcerpc_binding_handle *h,
11776                                                          TALLOC_CTX *mem_ctx,
11777                                                          struct policy_handle *_handle /* [in] [ref] */,
11778                                                          uint32_t _change_low /* [in]  */,
11779                                                          struct spoolss_NotifyOption *_options /* [in] [unique] */,
11780                                                          struct spoolss_NotifyInfo **_info /* [out] [ref] */,
11781                                                          WERROR *result)
11782 {
11783         struct spoolss_RouterRefreshPrinterChangeNotify r;
11784         NTSTATUS status;
11785
11786         /* In parameters */
11787         r.in.handle = _handle;
11788         r.in.change_low = _change_low;
11789         r.in.options = _options;
11790
11791         status = dcerpc_spoolss_RouterRefreshPrinterChangeNotify_r(h, mem_ctx, &r);
11792         if (!NT_STATUS_IS_OK(status)) {
11793                 return status;
11794         }
11795
11796         /* Return variables */
11797         *_info = *r.out.info;
11798
11799         /* Return result */
11800         *result = r.out.result;
11801
11802         return NT_STATUS_OK;
11803 }
11804
11805 struct dcerpc_spoolss_OpenPrinterEx_r_state {
11806         TALLOC_CTX *out_mem_ctx;
11807 };
11808
11809 static void dcerpc_spoolss_OpenPrinterEx_r_done(struct tevent_req *subreq);
11810
11811 struct tevent_req *dcerpc_spoolss_OpenPrinterEx_r_send(TALLOC_CTX *mem_ctx,
11812         struct tevent_context *ev,
11813         struct dcerpc_binding_handle *h,
11814         struct spoolss_OpenPrinterEx *r)
11815 {
11816         struct tevent_req *req;
11817         struct dcerpc_spoolss_OpenPrinterEx_r_state *state;
11818         struct tevent_req *subreq;
11819
11820         req = tevent_req_create(mem_ctx, &state,
11821                                 struct dcerpc_spoolss_OpenPrinterEx_r_state);
11822         if (req == NULL) {
11823                 return NULL;
11824         }
11825
11826         state->out_mem_ctx = talloc_new(state);
11827         if (tevent_req_nomem(state->out_mem_ctx, req)) {
11828                 return tevent_req_post(req, ev);
11829         }
11830
11831         subreq = dcerpc_binding_handle_call_send(state, ev, h,
11832                         NULL, &ndr_table_spoolss,
11833                         NDR_SPOOLSS_OPENPRINTEREX, state->out_mem_ctx, r);
11834         if (tevent_req_nomem(subreq, req)) {
11835                 return tevent_req_post(req, ev);
11836         }
11837         tevent_req_set_callback(subreq, dcerpc_spoolss_OpenPrinterEx_r_done, req);
11838
11839         return req;
11840 }
11841
11842 static void dcerpc_spoolss_OpenPrinterEx_r_done(struct tevent_req *subreq)
11843 {
11844         struct tevent_req *req =
11845                 tevent_req_callback_data(subreq,
11846                 struct tevent_req);
11847         NTSTATUS status;
11848
11849         status = dcerpc_binding_handle_call_recv(subreq);
11850         TALLOC_FREE(subreq);
11851         if (tevent_req_nterror(req, status)) {
11852                 return;
11853         }
11854
11855         tevent_req_done(req);
11856 }
11857
11858 NTSTATUS dcerpc_spoolss_OpenPrinterEx_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
11859 {
11860         struct dcerpc_spoolss_OpenPrinterEx_r_state *state =
11861                 tevent_req_data(req,
11862                 struct dcerpc_spoolss_OpenPrinterEx_r_state);
11863         NTSTATUS status;
11864
11865         if (tevent_req_is_nterror(req, &status)) {
11866                 tevent_req_received(req);
11867                 return status;
11868         }
11869
11870         talloc_steal(mem_ctx, state->out_mem_ctx);
11871
11872         tevent_req_received(req);
11873         return NT_STATUS_OK;
11874 }
11875
11876 NTSTATUS dcerpc_spoolss_OpenPrinterEx_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_OpenPrinterEx *r)
11877 {
11878         NTSTATUS status;
11879
11880         status = dcerpc_binding_handle_call(h,
11881                         NULL, &ndr_table_spoolss,
11882                         NDR_SPOOLSS_OPENPRINTEREX, mem_ctx, r);
11883
11884         return status;
11885 }
11886
11887 struct dcerpc_spoolss_OpenPrinterEx_state {
11888         struct spoolss_OpenPrinterEx orig;
11889         struct spoolss_OpenPrinterEx tmp;
11890         TALLOC_CTX *out_mem_ctx;
11891 };
11892
11893 static void dcerpc_spoolss_OpenPrinterEx_done(struct tevent_req *subreq);
11894
11895 struct tevent_req *dcerpc_spoolss_OpenPrinterEx_send(TALLOC_CTX *mem_ctx,
11896                                                      struct tevent_context *ev,
11897                                                      struct dcerpc_binding_handle *h,
11898                                                      const char *_printername /* [in] [unique,charset(UTF16)] */,
11899                                                      const char *_datatype /* [in] [unique,charset(UTF16)] */,
11900                                                      struct spoolss_DevmodeContainer _devmode_ctr /* [in]  */,
11901                                                      uint32_t _access_mask /* [in]  */,
11902                                                      struct spoolss_UserLevelCtr _userlevel_ctr /* [in]  */,
11903                                                      struct policy_handle *_handle /* [out] [ref] */)
11904 {
11905         struct tevent_req *req;
11906         struct dcerpc_spoolss_OpenPrinterEx_state *state;
11907         struct tevent_req *subreq;
11908
11909         req = tevent_req_create(mem_ctx, &state,
11910                                 struct dcerpc_spoolss_OpenPrinterEx_state);
11911         if (req == NULL) {
11912                 return NULL;
11913         }
11914         state->out_mem_ctx = NULL;
11915
11916         /* In parameters */
11917         state->orig.in.printername = _printername;
11918         state->orig.in.datatype = _datatype;
11919         state->orig.in.devmode_ctr = _devmode_ctr;
11920         state->orig.in.access_mask = _access_mask;
11921         state->orig.in.userlevel_ctr = _userlevel_ctr;
11922
11923         /* Out parameters */
11924         state->orig.out.handle = _handle;
11925
11926         /* Result */
11927         ZERO_STRUCT(state->orig.out.result);
11928
11929         state->out_mem_ctx = talloc_named_const(state, 0,
11930                              "dcerpc_spoolss_OpenPrinterEx_out_memory");
11931         if (tevent_req_nomem(state->out_mem_ctx, req)) {
11932                 return tevent_req_post(req, ev);
11933         }
11934
11935         /* make a temporary copy, that we pass to the dispatch function */
11936         state->tmp = state->orig;
11937
11938         subreq = dcerpc_spoolss_OpenPrinterEx_r_send(state, ev, h, &state->tmp);
11939         if (tevent_req_nomem(subreq, req)) {
11940                 return tevent_req_post(req, ev);
11941         }
11942         tevent_req_set_callback(subreq, dcerpc_spoolss_OpenPrinterEx_done, req);
11943         return req;
11944 }
11945
11946 static void dcerpc_spoolss_OpenPrinterEx_done(struct tevent_req *subreq)
11947 {
11948         struct tevent_req *req = tevent_req_callback_data(
11949                 subreq, struct tevent_req);
11950         struct dcerpc_spoolss_OpenPrinterEx_state *state = tevent_req_data(
11951                 req, struct dcerpc_spoolss_OpenPrinterEx_state);
11952         NTSTATUS status;
11953         TALLOC_CTX *mem_ctx;
11954
11955         if (state->out_mem_ctx) {
11956                 mem_ctx = state->out_mem_ctx;
11957         } else {
11958                 mem_ctx = state;
11959         }
11960
11961         status = dcerpc_spoolss_OpenPrinterEx_r_recv(subreq, mem_ctx);
11962         TALLOC_FREE(subreq);
11963         if (tevent_req_nterror(req, status)) {
11964                 return;
11965         }
11966
11967         /* Copy out parameters */
11968         *state->orig.out.handle = *state->tmp.out.handle;
11969
11970         /* Copy result */
11971         state->orig.out.result = state->tmp.out.result;
11972
11973         /* Reset temporary structure */
11974         ZERO_STRUCT(state->tmp);
11975
11976         tevent_req_done(req);
11977 }
11978
11979 NTSTATUS dcerpc_spoolss_OpenPrinterEx_recv(struct tevent_req *req,
11980                                            TALLOC_CTX *mem_ctx,
11981                                            WERROR *result)
11982 {
11983         struct dcerpc_spoolss_OpenPrinterEx_state *state = tevent_req_data(
11984                 req, struct dcerpc_spoolss_OpenPrinterEx_state);
11985         NTSTATUS status;
11986
11987         if (tevent_req_is_nterror(req, &status)) {
11988                 tevent_req_received(req);
11989                 return status;
11990         }
11991
11992         /* Steal possible out parameters to the callers context */
11993         talloc_steal(mem_ctx, state->out_mem_ctx);
11994
11995         /* Return result */
11996         *result = state->orig.out.result;
11997
11998         tevent_req_received(req);
11999         return NT_STATUS_OK;
12000 }
12001
12002 NTSTATUS dcerpc_spoolss_OpenPrinterEx(struct dcerpc_binding_handle *h,
12003                                       TALLOC_CTX *mem_ctx,
12004                                       const char *_printername /* [in] [unique,charset(UTF16)] */,
12005                                       const char *_datatype /* [in] [unique,charset(UTF16)] */,
12006                                       struct spoolss_DevmodeContainer _devmode_ctr /* [in]  */,
12007                                       uint32_t _access_mask /* [in]  */,
12008                                       struct spoolss_UserLevelCtr _userlevel_ctr /* [in]  */,
12009                                       struct policy_handle *_handle /* [out] [ref] */,
12010                                       WERROR *result)
12011 {
12012         struct spoolss_OpenPrinterEx r;
12013         NTSTATUS status;
12014
12015         /* In parameters */
12016         r.in.printername = _printername;
12017         r.in.datatype = _datatype;
12018         r.in.devmode_ctr = _devmode_ctr;
12019         r.in.access_mask = _access_mask;
12020         r.in.userlevel_ctr = _userlevel_ctr;
12021
12022         status = dcerpc_spoolss_OpenPrinterEx_r(h, mem_ctx, &r);
12023         if (!NT_STATUS_IS_OK(status)) {
12024                 return status;
12025         }
12026
12027         /* Return variables */
12028         *_handle = *r.out.handle;
12029
12030         /* Return result */
12031         *result = r.out.result;
12032
12033         return NT_STATUS_OK;
12034 }
12035
12036 struct dcerpc_spoolss_AddPrinterEx_r_state {
12037         TALLOC_CTX *out_mem_ctx;
12038 };
12039
12040 static void dcerpc_spoolss_AddPrinterEx_r_done(struct tevent_req *subreq);
12041
12042 struct tevent_req *dcerpc_spoolss_AddPrinterEx_r_send(TALLOC_CTX *mem_ctx,
12043         struct tevent_context *ev,
12044         struct dcerpc_binding_handle *h,
12045         struct spoolss_AddPrinterEx *r)
12046 {
12047         struct tevent_req *req;
12048         struct dcerpc_spoolss_AddPrinterEx_r_state *state;
12049         struct tevent_req *subreq;
12050
12051         req = tevent_req_create(mem_ctx, &state,
12052                                 struct dcerpc_spoolss_AddPrinterEx_r_state);
12053         if (req == NULL) {
12054                 return NULL;
12055         }
12056
12057         state->out_mem_ctx = talloc_new(state);
12058         if (tevent_req_nomem(state->out_mem_ctx, req)) {
12059                 return tevent_req_post(req, ev);
12060         }
12061
12062         subreq = dcerpc_binding_handle_call_send(state, ev, h,
12063                         NULL, &ndr_table_spoolss,
12064                         NDR_SPOOLSS_ADDPRINTEREX, state->out_mem_ctx, r);
12065         if (tevent_req_nomem(subreq, req)) {
12066                 return tevent_req_post(req, ev);
12067         }
12068         tevent_req_set_callback(subreq, dcerpc_spoolss_AddPrinterEx_r_done, req);
12069
12070         return req;
12071 }
12072
12073 static void dcerpc_spoolss_AddPrinterEx_r_done(struct tevent_req *subreq)
12074 {
12075         struct tevent_req *req =
12076                 tevent_req_callback_data(subreq,
12077                 struct tevent_req);
12078         NTSTATUS status;
12079
12080         status = dcerpc_binding_handle_call_recv(subreq);
12081         TALLOC_FREE(subreq);
12082         if (tevent_req_nterror(req, status)) {
12083                 return;
12084         }
12085
12086         tevent_req_done(req);
12087 }
12088
12089 NTSTATUS dcerpc_spoolss_AddPrinterEx_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
12090 {
12091         struct dcerpc_spoolss_AddPrinterEx_r_state *state =
12092                 tevent_req_data(req,
12093                 struct dcerpc_spoolss_AddPrinterEx_r_state);
12094         NTSTATUS status;
12095
12096         if (tevent_req_is_nterror(req, &status)) {
12097                 tevent_req_received(req);
12098                 return status;
12099         }
12100
12101         talloc_steal(mem_ctx, state->out_mem_ctx);
12102
12103         tevent_req_received(req);
12104         return NT_STATUS_OK;
12105 }
12106
12107 NTSTATUS dcerpc_spoolss_AddPrinterEx_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_AddPrinterEx *r)
12108 {
12109         NTSTATUS status;
12110
12111         status = dcerpc_binding_handle_call(h,
12112                         NULL, &ndr_table_spoolss,
12113                         NDR_SPOOLSS_ADDPRINTEREX, mem_ctx, r);
12114
12115         return status;
12116 }
12117
12118 struct dcerpc_spoolss_AddPrinterEx_state {
12119         struct spoolss_AddPrinterEx orig;
12120         struct spoolss_AddPrinterEx tmp;
12121         TALLOC_CTX *out_mem_ctx;
12122 };
12123
12124 static void dcerpc_spoolss_AddPrinterEx_done(struct tevent_req *subreq);
12125
12126 struct tevent_req *dcerpc_spoolss_AddPrinterEx_send(TALLOC_CTX *mem_ctx,
12127                                                     struct tevent_context *ev,
12128                                                     struct dcerpc_binding_handle *h,
12129                                                     const char *_server /* [in] [unique,charset(UTF16)] */,
12130                                                     struct spoolss_SetPrinterInfoCtr *_info_ctr /* [in] [ref] */,
12131                                                     struct spoolss_DevmodeContainer *_devmode_ctr /* [in] [ref] */,
12132                                                     struct sec_desc_buf *_secdesc_ctr /* [in] [ref] */,
12133                                                     struct spoolss_UserLevelCtr *_userlevel_ctr /* [in] [ref] */,
12134                                                     struct policy_handle *_handle /* [out] [ref] */)
12135 {
12136         struct tevent_req *req;
12137         struct dcerpc_spoolss_AddPrinterEx_state *state;
12138         struct tevent_req *subreq;
12139
12140         req = tevent_req_create(mem_ctx, &state,
12141                                 struct dcerpc_spoolss_AddPrinterEx_state);
12142         if (req == NULL) {
12143                 return NULL;
12144         }
12145         state->out_mem_ctx = NULL;
12146
12147         /* In parameters */
12148         state->orig.in.server = _server;
12149         state->orig.in.info_ctr = _info_ctr;
12150         state->orig.in.devmode_ctr = _devmode_ctr;
12151         state->orig.in.secdesc_ctr = _secdesc_ctr;
12152         state->orig.in.userlevel_ctr = _userlevel_ctr;
12153
12154         /* Out parameters */
12155         state->orig.out.handle = _handle;
12156
12157         /* Result */
12158         ZERO_STRUCT(state->orig.out.result);
12159
12160         state->out_mem_ctx = talloc_named_const(state, 0,
12161                              "dcerpc_spoolss_AddPrinterEx_out_memory");
12162         if (tevent_req_nomem(state->out_mem_ctx, req)) {
12163                 return tevent_req_post(req, ev);
12164         }
12165
12166         /* make a temporary copy, that we pass to the dispatch function */
12167         state->tmp = state->orig;
12168
12169         subreq = dcerpc_spoolss_AddPrinterEx_r_send(state, ev, h, &state->tmp);
12170         if (tevent_req_nomem(subreq, req)) {
12171                 return tevent_req_post(req, ev);
12172         }
12173         tevent_req_set_callback(subreq, dcerpc_spoolss_AddPrinterEx_done, req);
12174         return req;
12175 }
12176
12177 static void dcerpc_spoolss_AddPrinterEx_done(struct tevent_req *subreq)
12178 {
12179         struct tevent_req *req = tevent_req_callback_data(
12180                 subreq, struct tevent_req);
12181         struct dcerpc_spoolss_AddPrinterEx_state *state = tevent_req_data(
12182                 req, struct dcerpc_spoolss_AddPrinterEx_state);
12183         NTSTATUS status;
12184         TALLOC_CTX *mem_ctx;
12185
12186         if (state->out_mem_ctx) {
12187                 mem_ctx = state->out_mem_ctx;
12188         } else {
12189                 mem_ctx = state;
12190         }
12191
12192         status = dcerpc_spoolss_AddPrinterEx_r_recv(subreq, mem_ctx);
12193         TALLOC_FREE(subreq);
12194         if (tevent_req_nterror(req, status)) {
12195                 return;
12196         }
12197
12198         /* Copy out parameters */
12199         *state->orig.out.handle = *state->tmp.out.handle;
12200
12201         /* Copy result */
12202         state->orig.out.result = state->tmp.out.result;
12203
12204         /* Reset temporary structure */
12205         ZERO_STRUCT(state->tmp);
12206
12207         tevent_req_done(req);
12208 }
12209
12210 NTSTATUS dcerpc_spoolss_AddPrinterEx_recv(struct tevent_req *req,
12211                                           TALLOC_CTX *mem_ctx,
12212                                           WERROR *result)
12213 {
12214         struct dcerpc_spoolss_AddPrinterEx_state *state = tevent_req_data(
12215                 req, struct dcerpc_spoolss_AddPrinterEx_state);
12216         NTSTATUS status;
12217
12218         if (tevent_req_is_nterror(req, &status)) {
12219                 tevent_req_received(req);
12220                 return status;
12221         }
12222
12223         /* Steal possible out parameters to the callers context */
12224         talloc_steal(mem_ctx, state->out_mem_ctx);
12225
12226         /* Return result */
12227         *result = state->orig.out.result;
12228
12229         tevent_req_received(req);
12230         return NT_STATUS_OK;
12231 }
12232
12233 NTSTATUS dcerpc_spoolss_AddPrinterEx(struct dcerpc_binding_handle *h,
12234                                      TALLOC_CTX *mem_ctx,
12235                                      const char *_server /* [in] [unique,charset(UTF16)] */,
12236                                      struct spoolss_SetPrinterInfoCtr *_info_ctr /* [in] [ref] */,
12237                                      struct spoolss_DevmodeContainer *_devmode_ctr /* [in] [ref] */,
12238                                      struct sec_desc_buf *_secdesc_ctr /* [in] [ref] */,
12239                                      struct spoolss_UserLevelCtr *_userlevel_ctr /* [in] [ref] */,
12240                                      struct policy_handle *_handle /* [out] [ref] */,
12241                                      WERROR *result)
12242 {
12243         struct spoolss_AddPrinterEx r;
12244         NTSTATUS status;
12245
12246         /* In parameters */
12247         r.in.server = _server;
12248         r.in.info_ctr = _info_ctr;
12249         r.in.devmode_ctr = _devmode_ctr;
12250         r.in.secdesc_ctr = _secdesc_ctr;
12251         r.in.userlevel_ctr = _userlevel_ctr;
12252
12253         status = dcerpc_spoolss_AddPrinterEx_r(h, mem_ctx, &r);
12254         if (!NT_STATUS_IS_OK(status)) {
12255                 return status;
12256         }
12257
12258         /* Return variables */
12259         *_handle = *r.out.handle;
12260
12261         /* Return result */
12262         *result = r.out.result;
12263
12264         return NT_STATUS_OK;
12265 }
12266
12267 struct dcerpc_spoolss_SetPort_r_state {
12268         TALLOC_CTX *out_mem_ctx;
12269 };
12270
12271 static void dcerpc_spoolss_SetPort_r_done(struct tevent_req *subreq);
12272
12273 struct tevent_req *dcerpc_spoolss_SetPort_r_send(TALLOC_CTX *mem_ctx,
12274         struct tevent_context *ev,
12275         struct dcerpc_binding_handle *h,
12276         struct spoolss_SetPort *r)
12277 {
12278         struct tevent_req *req;
12279         struct dcerpc_spoolss_SetPort_r_state *state;
12280         struct tevent_req *subreq;
12281
12282         req = tevent_req_create(mem_ctx, &state,
12283                                 struct dcerpc_spoolss_SetPort_r_state);
12284         if (req == NULL) {
12285                 return NULL;
12286         }
12287
12288         state->out_mem_ctx = NULL;
12289
12290         subreq = dcerpc_binding_handle_call_send(state, ev, h,
12291                         NULL, &ndr_table_spoolss,
12292                         NDR_SPOOLSS_SETPORT, state, r);
12293         if (tevent_req_nomem(subreq, req)) {
12294                 return tevent_req_post(req, ev);
12295         }
12296         tevent_req_set_callback(subreq, dcerpc_spoolss_SetPort_r_done, req);
12297
12298         return req;
12299 }
12300
12301 static void dcerpc_spoolss_SetPort_r_done(struct tevent_req *subreq)
12302 {
12303         struct tevent_req *req =
12304                 tevent_req_callback_data(subreq,
12305                 struct tevent_req);
12306         NTSTATUS status;
12307
12308         status = dcerpc_binding_handle_call_recv(subreq);
12309         TALLOC_FREE(subreq);
12310         if (tevent_req_nterror(req, status)) {
12311                 return;
12312         }
12313
12314         tevent_req_done(req);
12315 }
12316
12317 NTSTATUS dcerpc_spoolss_SetPort_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
12318 {
12319         struct dcerpc_spoolss_SetPort_r_state *state =
12320                 tevent_req_data(req,
12321                 struct dcerpc_spoolss_SetPort_r_state);
12322         NTSTATUS status;
12323
12324         if (tevent_req_is_nterror(req, &status)) {
12325                 tevent_req_received(req);
12326                 return status;
12327         }
12328
12329         talloc_steal(mem_ctx, state->out_mem_ctx);
12330
12331         tevent_req_received(req);
12332         return NT_STATUS_OK;
12333 }
12334
12335 NTSTATUS dcerpc_spoolss_SetPort_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_SetPort *r)
12336 {
12337         NTSTATUS status;
12338
12339         status = dcerpc_binding_handle_call(h,
12340                         NULL, &ndr_table_spoolss,
12341                         NDR_SPOOLSS_SETPORT, mem_ctx, r);
12342
12343         return status;
12344 }
12345
12346 struct dcerpc_spoolss_SetPort_state {
12347         struct spoolss_SetPort orig;
12348         struct spoolss_SetPort tmp;
12349         TALLOC_CTX *out_mem_ctx;
12350 };
12351
12352 static void dcerpc_spoolss_SetPort_done(struct tevent_req *subreq);
12353
12354 struct tevent_req *dcerpc_spoolss_SetPort_send(TALLOC_CTX *mem_ctx,
12355                                                struct tevent_context *ev,
12356                                                struct dcerpc_binding_handle *h,
12357                                                const char *_servername /* [in] [unique,charset(UTF16)] */,
12358                                                const char *_port_name /* [in] [unique,charset(UTF16)] */,
12359                                                struct spoolss_SetPortInfoContainer *_port_ctr /* [in] [ref] */)
12360 {
12361         struct tevent_req *req;
12362         struct dcerpc_spoolss_SetPort_state *state;
12363         struct tevent_req *subreq;
12364
12365         req = tevent_req_create(mem_ctx, &state,
12366                                 struct dcerpc_spoolss_SetPort_state);
12367         if (req == NULL) {
12368                 return NULL;
12369         }
12370         state->out_mem_ctx = NULL;
12371
12372         /* In parameters */
12373         state->orig.in.servername = _servername;
12374         state->orig.in.port_name = _port_name;
12375         state->orig.in.port_ctr = _port_ctr;
12376
12377         /* Out parameters */
12378
12379         /* Result */
12380         ZERO_STRUCT(state->orig.out.result);
12381
12382         /* make a temporary copy, that we pass to the dispatch function */
12383         state->tmp = state->orig;
12384
12385         subreq = dcerpc_spoolss_SetPort_r_send(state, ev, h, &state->tmp);
12386         if (tevent_req_nomem(subreq, req)) {
12387                 return tevent_req_post(req, ev);
12388         }
12389         tevent_req_set_callback(subreq, dcerpc_spoolss_SetPort_done, req);
12390         return req;
12391 }
12392
12393 static void dcerpc_spoolss_SetPort_done(struct tevent_req *subreq)
12394 {
12395         struct tevent_req *req = tevent_req_callback_data(
12396                 subreq, struct tevent_req);
12397         struct dcerpc_spoolss_SetPort_state *state = tevent_req_data(
12398                 req, struct dcerpc_spoolss_SetPort_state);
12399         NTSTATUS status;
12400         TALLOC_CTX *mem_ctx;
12401
12402         if (state->out_mem_ctx) {
12403                 mem_ctx = state->out_mem_ctx;
12404         } else {
12405                 mem_ctx = state;
12406         }
12407
12408         status = dcerpc_spoolss_SetPort_r_recv(subreq, mem_ctx);
12409         TALLOC_FREE(subreq);
12410         if (tevent_req_nterror(req, status)) {
12411                 return;
12412         }
12413
12414         /* Copy out parameters */
12415
12416         /* Copy result */
12417         state->orig.out.result = state->tmp.out.result;
12418
12419         /* Reset temporary structure */
12420         ZERO_STRUCT(state->tmp);
12421
12422         tevent_req_done(req);
12423 }
12424
12425 NTSTATUS dcerpc_spoolss_SetPort_recv(struct tevent_req *req,
12426                                      TALLOC_CTX *mem_ctx,
12427                                      WERROR *result)
12428 {
12429         struct dcerpc_spoolss_SetPort_state *state = tevent_req_data(
12430                 req, struct dcerpc_spoolss_SetPort_state);
12431         NTSTATUS status;
12432
12433         if (tevent_req_is_nterror(req, &status)) {
12434                 tevent_req_received(req);
12435                 return status;
12436         }
12437
12438         /* Steal possible out parameters to the callers context */
12439         talloc_steal(mem_ctx, state->out_mem_ctx);
12440
12441         /* Return result */
12442         *result = state->orig.out.result;
12443
12444         tevent_req_received(req);
12445         return NT_STATUS_OK;
12446 }
12447
12448 NTSTATUS dcerpc_spoolss_SetPort(struct dcerpc_binding_handle *h,
12449                                 TALLOC_CTX *mem_ctx,
12450                                 const char *_servername /* [in] [unique,charset(UTF16)] */,
12451                                 const char *_port_name /* [in] [unique,charset(UTF16)] */,
12452                                 struct spoolss_SetPortInfoContainer *_port_ctr /* [in] [ref] */,
12453                                 WERROR *result)
12454 {
12455         struct spoolss_SetPort r;
12456         NTSTATUS status;
12457
12458         /* In parameters */
12459         r.in.servername = _servername;
12460         r.in.port_name = _port_name;
12461         r.in.port_ctr = _port_ctr;
12462
12463         status = dcerpc_spoolss_SetPort_r(h, mem_ctx, &r);
12464         if (!NT_STATUS_IS_OK(status)) {
12465                 return status;
12466         }
12467
12468         /* Return variables */
12469
12470         /* Return result */
12471         *result = r.out.result;
12472
12473         return NT_STATUS_OK;
12474 }
12475
12476 struct dcerpc_spoolss_EnumPrinterData_r_state {
12477         TALLOC_CTX *out_mem_ctx;
12478 };
12479
12480 static void dcerpc_spoolss_EnumPrinterData_r_done(struct tevent_req *subreq);
12481
12482 struct tevent_req *dcerpc_spoolss_EnumPrinterData_r_send(TALLOC_CTX *mem_ctx,
12483         struct tevent_context *ev,
12484         struct dcerpc_binding_handle *h,
12485         struct spoolss_EnumPrinterData *r)
12486 {
12487         struct tevent_req *req;
12488         struct dcerpc_spoolss_EnumPrinterData_r_state *state;
12489         struct tevent_req *subreq;
12490
12491         req = tevent_req_create(mem_ctx, &state,
12492                                 struct dcerpc_spoolss_EnumPrinterData_r_state);
12493         if (req == NULL) {
12494                 return NULL;
12495         }
12496
12497         state->out_mem_ctx = talloc_new(state);
12498         if (tevent_req_nomem(state->out_mem_ctx, req)) {
12499                 return tevent_req_post(req, ev);
12500         }
12501
12502         subreq = dcerpc_binding_handle_call_send(state, ev, h,
12503                         NULL, &ndr_table_spoolss,
12504                         NDR_SPOOLSS_ENUMPRINTERDATA, state->out_mem_ctx, r);
12505         if (tevent_req_nomem(subreq, req)) {
12506                 return tevent_req_post(req, ev);
12507         }
12508         tevent_req_set_callback(subreq, dcerpc_spoolss_EnumPrinterData_r_done, req);
12509
12510         return req;
12511 }
12512
12513 static void dcerpc_spoolss_EnumPrinterData_r_done(struct tevent_req *subreq)
12514 {
12515         struct tevent_req *req =
12516                 tevent_req_callback_data(subreq,
12517                 struct tevent_req);
12518         NTSTATUS status;
12519
12520         status = dcerpc_binding_handle_call_recv(subreq);
12521         TALLOC_FREE(subreq);
12522         if (tevent_req_nterror(req, status)) {
12523                 return;
12524         }
12525
12526         tevent_req_done(req);
12527 }
12528
12529 NTSTATUS dcerpc_spoolss_EnumPrinterData_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
12530 {
12531         struct dcerpc_spoolss_EnumPrinterData_r_state *state =
12532                 tevent_req_data(req,
12533                 struct dcerpc_spoolss_EnumPrinterData_r_state);
12534         NTSTATUS status;
12535
12536         if (tevent_req_is_nterror(req, &status)) {
12537                 tevent_req_received(req);
12538                 return status;
12539         }
12540
12541         talloc_steal(mem_ctx, state->out_mem_ctx);
12542
12543         tevent_req_received(req);
12544         return NT_STATUS_OK;
12545 }
12546
12547 NTSTATUS dcerpc_spoolss_EnumPrinterData_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_EnumPrinterData *r)
12548 {
12549         NTSTATUS status;
12550
12551         status = dcerpc_binding_handle_call(h,
12552                         NULL, &ndr_table_spoolss,
12553                         NDR_SPOOLSS_ENUMPRINTERDATA, mem_ctx, r);
12554
12555         return status;
12556 }
12557
12558 struct dcerpc_spoolss_EnumPrinterData_state {
12559         struct spoolss_EnumPrinterData orig;
12560         struct spoolss_EnumPrinterData tmp;
12561         TALLOC_CTX *out_mem_ctx;
12562 };
12563
12564 static void dcerpc_spoolss_EnumPrinterData_done(struct tevent_req *subreq);
12565
12566 struct tevent_req *dcerpc_spoolss_EnumPrinterData_send(TALLOC_CTX *mem_ctx,
12567                                                        struct tevent_context *ev,
12568                                                        struct dcerpc_binding_handle *h,
12569                                                        struct policy_handle *_handle /* [in] [ref] */,
12570                                                        uint32_t _enum_index /* [in]  */,
12571                                                        const char *_value_name /* [out] [charset(UTF16),size_is(value_offered/2)] */,
12572                                                        uint32_t _value_offered /* [in]  */,
12573                                                        uint32_t *_value_needed /* [out] [ref] */,
12574                                                        enum winreg_Type *_type /* [out] [ref] */,
12575                                                        uint8_t *_data /* [out] [ref,flag(LIBNDR_PRINT_ARRAY_HEX),size_is(data_offered)] */,
12576                                                        uint32_t _data_offered /* [in]  */,
12577                                                        uint32_t *_data_needed /* [out] [ref] */)
12578 {
12579         struct tevent_req *req;
12580         struct dcerpc_spoolss_EnumPrinterData_state *state;
12581         struct tevent_req *subreq;
12582
12583         req = tevent_req_create(mem_ctx, &state,
12584                                 struct dcerpc_spoolss_EnumPrinterData_state);
12585         if (req == NULL) {
12586                 return NULL;
12587         }
12588         state->out_mem_ctx = NULL;
12589
12590         /* In parameters */
12591         state->orig.in.handle = _handle;
12592         state->orig.in.enum_index = _enum_index;
12593         state->orig.in.value_offered = _value_offered;
12594         state->orig.in.data_offered = _data_offered;
12595
12596         /* Out parameters */
12597         state->orig.out.value_name = _value_name;
12598         state->orig.out.value_needed = _value_needed;
12599         state->orig.out.type = _type;
12600         state->orig.out.data = _data;
12601         state->orig.out.data_needed = _data_needed;
12602
12603         /* Result */
12604         ZERO_STRUCT(state->orig.out.result);
12605
12606         state->out_mem_ctx = talloc_named_const(state, 0,
12607                              "dcerpc_spoolss_EnumPrinterData_out_memory");
12608         if (tevent_req_nomem(state->out_mem_ctx, req)) {
12609                 return tevent_req_post(req, ev);
12610         }
12611
12612         /* make a temporary copy, that we pass to the dispatch function */
12613         state->tmp = state->orig;
12614
12615         subreq = dcerpc_spoolss_EnumPrinterData_r_send(state, ev, h, &state->tmp);
12616         if (tevent_req_nomem(subreq, req)) {
12617                 return tevent_req_post(req, ev);
12618         }
12619         tevent_req_set_callback(subreq, dcerpc_spoolss_EnumPrinterData_done, req);
12620         return req;
12621 }
12622
12623 static void dcerpc_spoolss_EnumPrinterData_done(struct tevent_req *subreq)
12624 {
12625         struct tevent_req *req = tevent_req_callback_data(
12626                 subreq, struct tevent_req);
12627         struct dcerpc_spoolss_EnumPrinterData_state *state = tevent_req_data(
12628                 req, struct dcerpc_spoolss_EnumPrinterData_state);
12629         NTSTATUS status;
12630         TALLOC_CTX *mem_ctx;
12631
12632         if (state->out_mem_ctx) {
12633                 mem_ctx = state->out_mem_ctx;
12634         } else {
12635                 mem_ctx = state;
12636         }
12637
12638         status = dcerpc_spoolss_EnumPrinterData_r_recv(subreq, mem_ctx);
12639         TALLOC_FREE(subreq);
12640         if (tevent_req_nterror(req, status)) {
12641                 return;
12642         }
12643
12644         /* Copy out parameters */
12645         {
12646                 size_t _copy_len_value_name;
12647                 _copy_len_value_name = ndr_charset_length(state->tmp.out.value_name, CH_UNIX);
12648                 if (_copy_len_value_name > state->tmp.in.value_offered / 2) {
12649                         tevent_req_nterror(req, NT_STATUS_INVALID_NETWORK_RESPONSE);
12650                         return;
12651                 }
12652                 memcpy(discard_const_p(uint8_t *, state->orig.out.value_name), state->tmp.out.value_name, _copy_len_value_name * sizeof(*state->orig.out.value_name));
12653         }
12654         *state->orig.out.value_needed = *state->tmp.out.value_needed;
12655         *state->orig.out.type = *state->tmp.out.type;
12656         {
12657                 size_t _copy_len_data;
12658                 _copy_len_data = state->tmp.in.data_offered;
12659                 memcpy(state->orig.out.data, state->tmp.out.data, _copy_len_data * sizeof(*state->orig.out.data));
12660         }
12661         *state->orig.out.data_needed = *state->tmp.out.data_needed;
12662
12663         /* Copy result */
12664         state->orig.out.result = state->tmp.out.result;
12665
12666         /* Reset temporary structure */
12667         ZERO_STRUCT(state->tmp);
12668
12669         tevent_req_done(req);
12670 }
12671
12672 NTSTATUS dcerpc_spoolss_EnumPrinterData_recv(struct tevent_req *req,
12673                                              TALLOC_CTX *mem_ctx,
12674                                              WERROR *result)
12675 {
12676         struct dcerpc_spoolss_EnumPrinterData_state *state = tevent_req_data(
12677                 req, struct dcerpc_spoolss_EnumPrinterData_state);
12678         NTSTATUS status;
12679
12680         if (tevent_req_is_nterror(req, &status)) {
12681                 tevent_req_received(req);
12682                 return status;
12683         }
12684
12685         /* Steal possible out parameters to the callers context */
12686         talloc_steal(mem_ctx, state->out_mem_ctx);
12687
12688         /* Return result */
12689         *result = state->orig.out.result;
12690
12691         tevent_req_received(req);
12692         return NT_STATUS_OK;
12693 }
12694
12695 NTSTATUS dcerpc_spoolss_EnumPrinterData(struct dcerpc_binding_handle *h,
12696                                         TALLOC_CTX *mem_ctx,
12697                                         struct policy_handle *_handle /* [in] [ref] */,
12698                                         uint32_t _enum_index /* [in]  */,
12699                                         const char *_value_name /* [out] [charset(UTF16),size_is(value_offered/2)] */,
12700                                         uint32_t _value_offered /* [in]  */,
12701                                         uint32_t *_value_needed /* [out] [ref] */,
12702                                         enum winreg_Type *_type /* [out] [ref] */,
12703                                         uint8_t *_data /* [out] [ref,flag(LIBNDR_PRINT_ARRAY_HEX),size_is(data_offered)] */,
12704                                         uint32_t _data_offered /* [in]  */,
12705                                         uint32_t *_data_needed /* [out] [ref] */,
12706                                         WERROR *result)
12707 {
12708         struct spoolss_EnumPrinterData r;
12709         NTSTATUS status;
12710
12711         /* In parameters */
12712         r.in.handle = _handle;
12713         r.in.enum_index = _enum_index;
12714         r.in.value_offered = _value_offered;
12715         r.in.data_offered = _data_offered;
12716
12717         status = dcerpc_spoolss_EnumPrinterData_r(h, mem_ctx, &r);
12718         if (!NT_STATUS_IS_OK(status)) {
12719                 return status;
12720         }
12721
12722         /* Return variables */
12723         {
12724                 size_t _copy_len_value_name;
12725                 _copy_len_value_name = ndr_charset_length(r.out.value_name, CH_UNIX);
12726                 if (_copy_len_value_name > r.in.value_offered / 2) {
12727                         return NT_STATUS_INVALID_NETWORK_RESPONSE;
12728                 }
12729                 memcpy(discard_const_p(uint8_t *, _value_name), r.out.value_name, _copy_len_value_name * sizeof(*_value_name));
12730         }
12731         *_value_needed = *r.out.value_needed;
12732         *_type = *r.out.type;
12733         {
12734                 size_t _copy_len_data;
12735                 _copy_len_data = r.in.data_offered;
12736                 memcpy(_data, r.out.data, _copy_len_data * sizeof(*_data));
12737         }
12738         *_data_needed = *r.out.data_needed;
12739
12740         /* Return result */
12741         *result = r.out.result;
12742
12743         return NT_STATUS_OK;
12744 }
12745
12746 struct dcerpc_spoolss_DeletePrinterData_r_state {
12747         TALLOC_CTX *out_mem_ctx;
12748 };
12749
12750 static void dcerpc_spoolss_DeletePrinterData_r_done(struct tevent_req *subreq);
12751
12752 struct tevent_req *dcerpc_spoolss_DeletePrinterData_r_send(TALLOC_CTX *mem_ctx,
12753         struct tevent_context *ev,
12754         struct dcerpc_binding_handle *h,
12755         struct spoolss_DeletePrinterData *r)
12756 {
12757         struct tevent_req *req;
12758         struct dcerpc_spoolss_DeletePrinterData_r_state *state;
12759         struct tevent_req *subreq;
12760
12761         req = tevent_req_create(mem_ctx, &state,
12762                                 struct dcerpc_spoolss_DeletePrinterData_r_state);
12763         if (req == NULL) {
12764                 return NULL;
12765         }
12766
12767         state->out_mem_ctx = NULL;
12768
12769         subreq = dcerpc_binding_handle_call_send(state, ev, h,
12770                         NULL, &ndr_table_spoolss,
12771                         NDR_SPOOLSS_DELETEPRINTERDATA, state, r);
12772         if (tevent_req_nomem(subreq, req)) {
12773                 return tevent_req_post(req, ev);
12774         }
12775         tevent_req_set_callback(subreq, dcerpc_spoolss_DeletePrinterData_r_done, req);
12776
12777         return req;
12778 }
12779
12780 static void dcerpc_spoolss_DeletePrinterData_r_done(struct tevent_req *subreq)
12781 {
12782         struct tevent_req *req =
12783                 tevent_req_callback_data(subreq,
12784                 struct tevent_req);
12785         NTSTATUS status;
12786
12787         status = dcerpc_binding_handle_call_recv(subreq);
12788         TALLOC_FREE(subreq);
12789         if (tevent_req_nterror(req, status)) {
12790                 return;
12791         }
12792
12793         tevent_req_done(req);
12794 }
12795
12796 NTSTATUS dcerpc_spoolss_DeletePrinterData_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
12797 {
12798         struct dcerpc_spoolss_DeletePrinterData_r_state *state =
12799                 tevent_req_data(req,
12800                 struct dcerpc_spoolss_DeletePrinterData_r_state);
12801         NTSTATUS status;
12802
12803         if (tevent_req_is_nterror(req, &status)) {
12804                 tevent_req_received(req);
12805                 return status;
12806         }
12807
12808         talloc_steal(mem_ctx, state->out_mem_ctx);
12809
12810         tevent_req_received(req);
12811         return NT_STATUS_OK;
12812 }
12813
12814 NTSTATUS dcerpc_spoolss_DeletePrinterData_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_DeletePrinterData *r)
12815 {
12816         NTSTATUS status;
12817
12818         status = dcerpc_binding_handle_call(h,
12819                         NULL, &ndr_table_spoolss,
12820                         NDR_SPOOLSS_DELETEPRINTERDATA, mem_ctx, r);
12821
12822         return status;
12823 }
12824
12825 struct dcerpc_spoolss_DeletePrinterData_state {
12826         struct spoolss_DeletePrinterData orig;
12827         struct spoolss_DeletePrinterData tmp;
12828         TALLOC_CTX *out_mem_ctx;
12829 };
12830
12831 static void dcerpc_spoolss_DeletePrinterData_done(struct tevent_req *subreq);
12832
12833 struct tevent_req *dcerpc_spoolss_DeletePrinterData_send(TALLOC_CTX *mem_ctx,
12834                                                          struct tevent_context *ev,
12835                                                          struct dcerpc_binding_handle *h,
12836                                                          struct policy_handle *_handle /* [in] [ref] */,
12837                                                          const char *_value_name /* [in] [charset(UTF16)] */)
12838 {
12839         struct tevent_req *req;
12840         struct dcerpc_spoolss_DeletePrinterData_state *state;
12841         struct tevent_req *subreq;
12842
12843         req = tevent_req_create(mem_ctx, &state,
12844                                 struct dcerpc_spoolss_DeletePrinterData_state);
12845         if (req == NULL) {
12846                 return NULL;
12847         }
12848         state->out_mem_ctx = NULL;
12849
12850         /* In parameters */
12851         state->orig.in.handle = _handle;
12852         state->orig.in.value_name = _value_name;
12853
12854         /* Out parameters */
12855
12856         /* Result */
12857         ZERO_STRUCT(state->orig.out.result);
12858
12859         /* make a temporary copy, that we pass to the dispatch function */
12860         state->tmp = state->orig;
12861
12862         subreq = dcerpc_spoolss_DeletePrinterData_r_send(state, ev, h, &state->tmp);
12863         if (tevent_req_nomem(subreq, req)) {
12864                 return tevent_req_post(req, ev);
12865         }
12866         tevent_req_set_callback(subreq, dcerpc_spoolss_DeletePrinterData_done, req);
12867         return req;
12868 }
12869
12870 static void dcerpc_spoolss_DeletePrinterData_done(struct tevent_req *subreq)
12871 {
12872         struct tevent_req *req = tevent_req_callback_data(
12873                 subreq, struct tevent_req);
12874         struct dcerpc_spoolss_DeletePrinterData_state *state = tevent_req_data(
12875                 req, struct dcerpc_spoolss_DeletePrinterData_state);
12876         NTSTATUS status;
12877         TALLOC_CTX *mem_ctx;
12878
12879         if (state->out_mem_ctx) {
12880                 mem_ctx = state->out_mem_ctx;
12881         } else {
12882                 mem_ctx = state;
12883         }
12884
12885         status = dcerpc_spoolss_DeletePrinterData_r_recv(subreq, mem_ctx);
12886         TALLOC_FREE(subreq);
12887         if (tevent_req_nterror(req, status)) {
12888                 return;
12889         }
12890
12891         /* Copy out parameters */
12892
12893         /* Copy result */
12894         state->orig.out.result = state->tmp.out.result;
12895
12896         /* Reset temporary structure */
12897         ZERO_STRUCT(state->tmp);
12898
12899         tevent_req_done(req);
12900 }
12901
12902 NTSTATUS dcerpc_spoolss_DeletePrinterData_recv(struct tevent_req *req,
12903                                                TALLOC_CTX *mem_ctx,
12904                                                WERROR *result)
12905 {
12906         struct dcerpc_spoolss_DeletePrinterData_state *state = tevent_req_data(
12907                 req, struct dcerpc_spoolss_DeletePrinterData_state);
12908         NTSTATUS status;
12909
12910         if (tevent_req_is_nterror(req, &status)) {
12911                 tevent_req_received(req);
12912                 return status;
12913         }
12914
12915         /* Steal possible out parameters to the callers context */
12916         talloc_steal(mem_ctx, state->out_mem_ctx);
12917
12918         /* Return result */
12919         *result = state->orig.out.result;
12920
12921         tevent_req_received(req);
12922         return NT_STATUS_OK;
12923 }
12924
12925 NTSTATUS dcerpc_spoolss_DeletePrinterData(struct dcerpc_binding_handle *h,
12926                                           TALLOC_CTX *mem_ctx,
12927                                           struct policy_handle *_handle /* [in] [ref] */,
12928                                           const char *_value_name /* [in] [charset(UTF16)] */,
12929                                           WERROR *result)
12930 {
12931         struct spoolss_DeletePrinterData r;
12932         NTSTATUS status;
12933
12934         /* In parameters */
12935         r.in.handle = _handle;
12936         r.in.value_name = _value_name;
12937
12938         status = dcerpc_spoolss_DeletePrinterData_r(h, mem_ctx, &r);
12939         if (!NT_STATUS_IS_OK(status)) {
12940                 return status;
12941         }
12942
12943         /* Return variables */
12944
12945         /* Return result */
12946         *result = r.out.result;
12947
12948         return NT_STATUS_OK;
12949 }
12950
12951 struct dcerpc_spoolss_SetPrinterDataEx_r_state {
12952         TALLOC_CTX *out_mem_ctx;
12953 };
12954
12955 static void dcerpc_spoolss_SetPrinterDataEx_r_done(struct tevent_req *subreq);
12956
12957 struct tevent_req *dcerpc_spoolss_SetPrinterDataEx_r_send(TALLOC_CTX *mem_ctx,
12958         struct tevent_context *ev,
12959         struct dcerpc_binding_handle *h,
12960         struct spoolss_SetPrinterDataEx *r)
12961 {
12962         struct tevent_req *req;
12963         struct dcerpc_spoolss_SetPrinterDataEx_r_state *state;
12964         struct tevent_req *subreq;
12965
12966         req = tevent_req_create(mem_ctx, &state,
12967                                 struct dcerpc_spoolss_SetPrinterDataEx_r_state);
12968         if (req == NULL) {
12969                 return NULL;
12970         }
12971
12972         state->out_mem_ctx = NULL;
12973
12974         subreq = dcerpc_binding_handle_call_send(state, ev, h,
12975                         NULL, &ndr_table_spoolss,
12976                         NDR_SPOOLSS_SETPRINTERDATAEX, state, r);
12977         if (tevent_req_nomem(subreq, req)) {
12978                 return tevent_req_post(req, ev);
12979         }
12980         tevent_req_set_callback(subreq, dcerpc_spoolss_SetPrinterDataEx_r_done, req);
12981
12982         return req;
12983 }
12984
12985 static void dcerpc_spoolss_SetPrinterDataEx_r_done(struct tevent_req *subreq)
12986 {
12987         struct tevent_req *req =
12988                 tevent_req_callback_data(subreq,
12989                 struct tevent_req);
12990         NTSTATUS status;
12991
12992         status = dcerpc_binding_handle_call_recv(subreq);
12993         TALLOC_FREE(subreq);
12994         if (tevent_req_nterror(req, status)) {
12995                 return;
12996         }
12997
12998         tevent_req_done(req);
12999 }
13000
13001 NTSTATUS dcerpc_spoolss_SetPrinterDataEx_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
13002 {
13003         struct dcerpc_spoolss_SetPrinterDataEx_r_state *state =
13004                 tevent_req_data(req,
13005                 struct dcerpc_spoolss_SetPrinterDataEx_r_state);
13006         NTSTATUS status;
13007
13008         if (tevent_req_is_nterror(req, &status)) {
13009                 tevent_req_received(req);
13010                 return status;
13011         }
13012
13013         talloc_steal(mem_ctx, state->out_mem_ctx);
13014
13015         tevent_req_received(req);
13016         return NT_STATUS_OK;
13017 }
13018
13019 NTSTATUS dcerpc_spoolss_SetPrinterDataEx_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_SetPrinterDataEx *r)
13020 {
13021         NTSTATUS status;
13022
13023         status = dcerpc_binding_handle_call(h,
13024                         NULL, &ndr_table_spoolss,
13025                         NDR_SPOOLSS_SETPRINTERDATAEX, mem_ctx, r);
13026
13027         return status;
13028 }
13029
13030 struct dcerpc_spoolss_SetPrinterDataEx_state {
13031         struct spoolss_SetPrinterDataEx orig;
13032         struct spoolss_SetPrinterDataEx tmp;
13033         TALLOC_CTX *out_mem_ctx;
13034 };
13035
13036 static void dcerpc_spoolss_SetPrinterDataEx_done(struct tevent_req *subreq);
13037
13038 struct tevent_req *dcerpc_spoolss_SetPrinterDataEx_send(TALLOC_CTX *mem_ctx,
13039                                                         struct tevent_context *ev,
13040                                                         struct dcerpc_binding_handle *h,
13041                                                         struct policy_handle *_handle /* [in] [ref] */,
13042                                                         const char *_key_name /* [in] [charset(UTF16)] */,
13043                                                         const char *_value_name /* [in] [charset(UTF16)] */,
13044                                                         enum winreg_Type _type /* [in]  */,
13045                                                         uint8_t *_data /* [in] [ref,size_is(offered)] */,
13046                                                         uint32_t _offered /* [in]  */)
13047 {
13048         struct tevent_req *req;
13049         struct dcerpc_spoolss_SetPrinterDataEx_state *state;
13050         struct tevent_req *subreq;
13051
13052         req = tevent_req_create(mem_ctx, &state,
13053                                 struct dcerpc_spoolss_SetPrinterDataEx_state);
13054         if (req == NULL) {
13055                 return NULL;
13056         }
13057         state->out_mem_ctx = NULL;
13058
13059         /* In parameters */
13060         state->orig.in.handle = _handle;
13061         state->orig.in.key_name = _key_name;
13062         state->orig.in.value_name = _value_name;
13063         state->orig.in.type = _type;
13064         state->orig.in.data = _data;
13065         state->orig.in.offered = _offered;
13066
13067         /* Out parameters */
13068
13069         /* Result */
13070         ZERO_STRUCT(state->orig.out.result);
13071
13072         /* make a temporary copy, that we pass to the dispatch function */
13073         state->tmp = state->orig;
13074
13075         subreq = dcerpc_spoolss_SetPrinterDataEx_r_send(state, ev, h, &state->tmp);
13076         if (tevent_req_nomem(subreq, req)) {
13077                 return tevent_req_post(req, ev);
13078         }
13079         tevent_req_set_callback(subreq, dcerpc_spoolss_SetPrinterDataEx_done, req);
13080         return req;
13081 }
13082
13083 static void dcerpc_spoolss_SetPrinterDataEx_done(struct tevent_req *subreq)
13084 {
13085         struct tevent_req *req = tevent_req_callback_data(
13086                 subreq, struct tevent_req);
13087         struct dcerpc_spoolss_SetPrinterDataEx_state *state = tevent_req_data(
13088                 req, struct dcerpc_spoolss_SetPrinterDataEx_state);
13089         NTSTATUS status;
13090         TALLOC_CTX *mem_ctx;
13091
13092         if (state->out_mem_ctx) {
13093                 mem_ctx = state->out_mem_ctx;
13094         } else {
13095                 mem_ctx = state;
13096         }
13097
13098         status = dcerpc_spoolss_SetPrinterDataEx_r_recv(subreq, mem_ctx);
13099         TALLOC_FREE(subreq);
13100         if (tevent_req_nterror(req, status)) {
13101                 return;
13102         }
13103
13104         /* Copy out parameters */
13105
13106         /* Copy result */
13107         state->orig.out.result = state->tmp.out.result;
13108
13109         /* Reset temporary structure */
13110         ZERO_STRUCT(state->tmp);
13111
13112         tevent_req_done(req);
13113 }
13114
13115 NTSTATUS dcerpc_spoolss_SetPrinterDataEx_recv(struct tevent_req *req,
13116                                               TALLOC_CTX *mem_ctx,
13117                                               WERROR *result)
13118 {
13119         struct dcerpc_spoolss_SetPrinterDataEx_state *state = tevent_req_data(
13120                 req, struct dcerpc_spoolss_SetPrinterDataEx_state);
13121         NTSTATUS status;
13122
13123         if (tevent_req_is_nterror(req, &status)) {
13124                 tevent_req_received(req);
13125                 return status;
13126         }
13127
13128         /* Steal possible out parameters to the callers context */
13129         talloc_steal(mem_ctx, state->out_mem_ctx);
13130
13131         /* Return result */
13132         *result = state->orig.out.result;
13133
13134         tevent_req_received(req);
13135         return NT_STATUS_OK;
13136 }
13137
13138 NTSTATUS dcerpc_spoolss_SetPrinterDataEx(struct dcerpc_binding_handle *h,
13139                                          TALLOC_CTX *mem_ctx,
13140                                          struct policy_handle *_handle /* [in] [ref] */,
13141                                          const char *_key_name /* [in] [charset(UTF16)] */,
13142                                          const char *_value_name /* [in] [charset(UTF16)] */,
13143                                          enum winreg_Type _type /* [in]  */,
13144                                          uint8_t *_data /* [in] [ref,size_is(offered)] */,
13145                                          uint32_t _offered /* [in]  */,
13146                                          WERROR *result)
13147 {
13148         struct spoolss_SetPrinterDataEx r;
13149         NTSTATUS status;
13150
13151         /* In parameters */
13152         r.in.handle = _handle;
13153         r.in.key_name = _key_name;
13154         r.in.value_name = _value_name;
13155         r.in.type = _type;
13156         r.in.data = _data;
13157         r.in.offered = _offered;
13158
13159         status = dcerpc_spoolss_SetPrinterDataEx_r(h, mem_ctx, &r);
13160         if (!NT_STATUS_IS_OK(status)) {
13161                 return status;
13162         }
13163
13164         /* Return variables */
13165
13166         /* Return result */
13167         *result = r.out.result;
13168
13169         return NT_STATUS_OK;
13170 }
13171
13172 struct dcerpc_spoolss_GetPrinterDataEx_r_state {
13173         TALLOC_CTX *out_mem_ctx;
13174 };
13175
13176 static void dcerpc_spoolss_GetPrinterDataEx_r_done(struct tevent_req *subreq);
13177
13178 struct tevent_req *dcerpc_spoolss_GetPrinterDataEx_r_send(TALLOC_CTX *mem_ctx,
13179         struct tevent_context *ev,
13180         struct dcerpc_binding_handle *h,
13181         struct spoolss_GetPrinterDataEx *r)
13182 {
13183         struct tevent_req *req;
13184         struct dcerpc_spoolss_GetPrinterDataEx_r_state *state;
13185         struct tevent_req *subreq;
13186
13187         req = tevent_req_create(mem_ctx, &state,
13188                                 struct dcerpc_spoolss_GetPrinterDataEx_r_state);
13189         if (req == NULL) {
13190                 return NULL;
13191         }
13192
13193         state->out_mem_ctx = talloc_new(state);
13194         if (tevent_req_nomem(state->out_mem_ctx, req)) {
13195                 return tevent_req_post(req, ev);
13196         }
13197
13198         subreq = dcerpc_binding_handle_call_send(state, ev, h,
13199                         NULL, &ndr_table_spoolss,
13200                         NDR_SPOOLSS_GETPRINTERDATAEX, state->out_mem_ctx, r);
13201         if (tevent_req_nomem(subreq, req)) {
13202                 return tevent_req_post(req, ev);
13203         }
13204         tevent_req_set_callback(subreq, dcerpc_spoolss_GetPrinterDataEx_r_done, req);
13205
13206         return req;
13207 }
13208
13209 static void dcerpc_spoolss_GetPrinterDataEx_r_done(struct tevent_req *subreq)
13210 {
13211         struct tevent_req *req =
13212                 tevent_req_callback_data(subreq,
13213                 struct tevent_req);
13214         NTSTATUS status;
13215
13216         status = dcerpc_binding_handle_call_recv(subreq);
13217         TALLOC_FREE(subreq);
13218         if (tevent_req_nterror(req, status)) {
13219                 return;
13220         }
13221
13222         tevent_req_done(req);
13223 }
13224
13225 NTSTATUS dcerpc_spoolss_GetPrinterDataEx_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
13226 {
13227         struct dcerpc_spoolss_GetPrinterDataEx_r_state *state =
13228                 tevent_req_data(req,
13229                 struct dcerpc_spoolss_GetPrinterDataEx_r_state);
13230         NTSTATUS status;
13231
13232         if (tevent_req_is_nterror(req, &status)) {
13233                 tevent_req_received(req);
13234                 return status;
13235         }
13236
13237         talloc_steal(mem_ctx, state->out_mem_ctx);
13238
13239         tevent_req_received(req);
13240         return NT_STATUS_OK;
13241 }
13242
13243 NTSTATUS dcerpc_spoolss_GetPrinterDataEx_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_GetPrinterDataEx *r)
13244 {
13245         NTSTATUS status;
13246
13247         status = dcerpc_binding_handle_call(h,
13248                         NULL, &ndr_table_spoolss,
13249                         NDR_SPOOLSS_GETPRINTERDATAEX, mem_ctx, r);
13250
13251         return status;
13252 }
13253
13254 struct dcerpc_spoolss_GetPrinterDataEx_state {
13255         struct spoolss_GetPrinterDataEx orig;
13256         struct spoolss_GetPrinterDataEx tmp;
13257         TALLOC_CTX *out_mem_ctx;
13258 };
13259
13260 static void dcerpc_spoolss_GetPrinterDataEx_done(struct tevent_req *subreq);
13261
13262 struct tevent_req *dcerpc_spoolss_GetPrinterDataEx_send(TALLOC_CTX *mem_ctx,
13263                                                         struct tevent_context *ev,
13264                                                         struct dcerpc_binding_handle *h,
13265                                                         struct policy_handle *_handle /* [in] [ref] */,
13266                                                         const char *_key_name /* [in] [charset(UTF16)] */,
13267                                                         const char *_value_name /* [in] [charset(UTF16)] */,
13268                                                         enum winreg_Type *_type /* [out] [ref] */,
13269                                                         uint8_t *_data /* [out] [ref,size_is(offered)] */,
13270                                                         uint32_t _offered /* [in]  */,
13271                                                         uint32_t *_needed /* [out] [ref] */)
13272 {
13273         struct tevent_req *req;
13274         struct dcerpc_spoolss_GetPrinterDataEx_state *state;
13275         struct tevent_req *subreq;
13276
13277         req = tevent_req_create(mem_ctx, &state,
13278                                 struct dcerpc_spoolss_GetPrinterDataEx_state);
13279         if (req == NULL) {
13280                 return NULL;
13281         }
13282         state->out_mem_ctx = NULL;
13283
13284         /* In parameters */
13285         state->orig.in.handle = _handle;
13286         state->orig.in.key_name = _key_name;
13287         state->orig.in.value_name = _value_name;
13288         state->orig.in.offered = _offered;
13289
13290         /* Out parameters */
13291         state->orig.out.type = _type;
13292         state->orig.out.data = _data;
13293         state->orig.out.needed = _needed;
13294
13295         /* Result */
13296         ZERO_STRUCT(state->orig.out.result);
13297
13298         state->out_mem_ctx = talloc_named_const(state, 0,
13299                              "dcerpc_spoolss_GetPrinterDataEx_out_memory");
13300         if (tevent_req_nomem(state->out_mem_ctx, req)) {
13301                 return tevent_req_post(req, ev);
13302         }
13303
13304         /* make a temporary copy, that we pass to the dispatch function */
13305         state->tmp = state->orig;
13306
13307         subreq = dcerpc_spoolss_GetPrinterDataEx_r_send(state, ev, h, &state->tmp);
13308         if (tevent_req_nomem(subreq, req)) {
13309                 return tevent_req_post(req, ev);
13310         }
13311         tevent_req_set_callback(subreq, dcerpc_spoolss_GetPrinterDataEx_done, req);
13312         return req;
13313 }
13314
13315 static void dcerpc_spoolss_GetPrinterDataEx_done(struct tevent_req *subreq)
13316 {
13317         struct tevent_req *req = tevent_req_callback_data(
13318                 subreq, struct tevent_req);
13319         struct dcerpc_spoolss_GetPrinterDataEx_state *state = tevent_req_data(
13320                 req, struct dcerpc_spoolss_GetPrinterDataEx_state);
13321         NTSTATUS status;
13322         TALLOC_CTX *mem_ctx;
13323
13324         if (state->out_mem_ctx) {
13325                 mem_ctx = state->out_mem_ctx;
13326         } else {
13327                 mem_ctx = state;
13328         }
13329
13330         status = dcerpc_spoolss_GetPrinterDataEx_r_recv(subreq, mem_ctx);
13331         TALLOC_FREE(subreq);
13332         if (tevent_req_nterror(req, status)) {
13333                 return;
13334         }
13335
13336         /* Copy out parameters */
13337         *state->orig.out.type = *state->tmp.out.type;
13338         {
13339                 size_t _copy_len_data;
13340                 _copy_len_data = state->tmp.in.offered;
13341                 memcpy(state->orig.out.data, state->tmp.out.data, _copy_len_data * sizeof(*state->orig.out.data));
13342         }
13343         *state->orig.out.needed = *state->tmp.out.needed;
13344
13345         /* Copy result */
13346         state->orig.out.result = state->tmp.out.result;
13347
13348         /* Reset temporary structure */
13349         ZERO_STRUCT(state->tmp);
13350
13351         tevent_req_done(req);
13352 }
13353
13354 NTSTATUS dcerpc_spoolss_GetPrinterDataEx_recv(struct tevent_req *req,
13355                                               TALLOC_CTX *mem_ctx,
13356                                               WERROR *result)
13357 {
13358         struct dcerpc_spoolss_GetPrinterDataEx_state *state = tevent_req_data(
13359                 req, struct dcerpc_spoolss_GetPrinterDataEx_state);
13360         NTSTATUS status;
13361
13362         if (tevent_req_is_nterror(req, &status)) {
13363                 tevent_req_received(req);
13364                 return status;
13365         }
13366
13367         /* Steal possible out parameters to the callers context */
13368         talloc_steal(mem_ctx, state->out_mem_ctx);
13369
13370         /* Return result */
13371         *result = state->orig.out.result;
13372
13373         tevent_req_received(req);
13374         return NT_STATUS_OK;
13375 }
13376
13377 NTSTATUS dcerpc_spoolss_GetPrinterDataEx(struct dcerpc_binding_handle *h,
13378                                          TALLOC_CTX *mem_ctx,
13379                                          struct policy_handle *_handle /* [in] [ref] */,
13380                                          const char *_key_name /* [in] [charset(UTF16)] */,
13381                                          const char *_value_name /* [in] [charset(UTF16)] */,
13382                                          enum winreg_Type *_type /* [out] [ref] */,
13383                                          uint8_t *_data /* [out] [ref,size_is(offered)] */,
13384                                          uint32_t _offered /* [in]  */,
13385                                          uint32_t *_needed /* [out] [ref] */,
13386                                          WERROR *result)
13387 {
13388         struct spoolss_GetPrinterDataEx r;
13389         NTSTATUS status;
13390
13391         /* In parameters */
13392         r.in.handle = _handle;
13393         r.in.key_name = _key_name;
13394         r.in.value_name = _value_name;
13395         r.in.offered = _offered;
13396
13397         status = dcerpc_spoolss_GetPrinterDataEx_r(h, mem_ctx, &r);
13398         if (!NT_STATUS_IS_OK(status)) {
13399                 return status;
13400         }
13401
13402         /* Return variables */
13403         *_type = *r.out.type;
13404         {
13405                 size_t _copy_len_data;
13406                 _copy_len_data = r.in.offered;
13407                 memcpy(_data, r.out.data, _copy_len_data * sizeof(*_data));
13408         }
13409         *_needed = *r.out.needed;
13410
13411         /* Return result */
13412         *result = r.out.result;
13413
13414         return NT_STATUS_OK;
13415 }
13416
13417 struct dcerpc_spoolss_EnumPrinterDataEx_r_state {
13418         TALLOC_CTX *out_mem_ctx;
13419 };
13420
13421 static void dcerpc_spoolss_EnumPrinterDataEx_r_done(struct tevent_req *subreq);
13422
13423 struct tevent_req *dcerpc_spoolss_EnumPrinterDataEx_r_send(TALLOC_CTX *mem_ctx,
13424         struct tevent_context *ev,
13425         struct dcerpc_binding_handle *h,
13426         struct spoolss_EnumPrinterDataEx *r)
13427 {
13428         struct tevent_req *req;
13429         struct dcerpc_spoolss_EnumPrinterDataEx_r_state *state;
13430         struct tevent_req *subreq;
13431
13432         req = tevent_req_create(mem_ctx, &state,
13433                                 struct dcerpc_spoolss_EnumPrinterDataEx_r_state);
13434         if (req == NULL) {
13435                 return NULL;
13436         }
13437
13438         state->out_mem_ctx = talloc_new(state);
13439         if (tevent_req_nomem(state->out_mem_ctx, req)) {
13440                 return tevent_req_post(req, ev);
13441         }
13442
13443         subreq = dcerpc_binding_handle_call_send(state, ev, h,
13444                         NULL, &ndr_table_spoolss,
13445                         NDR_SPOOLSS_ENUMPRINTERDATAEX, state->out_mem_ctx, r);
13446         if (tevent_req_nomem(subreq, req)) {
13447                 return tevent_req_post(req, ev);
13448         }
13449         tevent_req_set_callback(subreq, dcerpc_spoolss_EnumPrinterDataEx_r_done, req);
13450
13451         return req;
13452 }
13453
13454 static void dcerpc_spoolss_EnumPrinterDataEx_r_done(struct tevent_req *subreq)
13455 {
13456         struct tevent_req *req =
13457                 tevent_req_callback_data(subreq,
13458                 struct tevent_req);
13459         NTSTATUS status;
13460
13461         status = dcerpc_binding_handle_call_recv(subreq);
13462         TALLOC_FREE(subreq);
13463         if (tevent_req_nterror(req, status)) {
13464                 return;
13465         }
13466
13467         tevent_req_done(req);
13468 }
13469
13470 NTSTATUS dcerpc_spoolss_EnumPrinterDataEx_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
13471 {
13472         struct dcerpc_spoolss_EnumPrinterDataEx_r_state *state =
13473                 tevent_req_data(req,
13474                 struct dcerpc_spoolss_EnumPrinterDataEx_r_state);
13475         NTSTATUS status;
13476
13477         if (tevent_req_is_nterror(req, &status)) {
13478                 tevent_req_received(req);
13479                 return status;
13480         }
13481
13482         talloc_steal(mem_ctx, state->out_mem_ctx);
13483
13484         tevent_req_received(req);
13485         return NT_STATUS_OK;
13486 }
13487
13488 NTSTATUS dcerpc_spoolss_EnumPrinterDataEx_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_EnumPrinterDataEx *r)
13489 {
13490         NTSTATUS status;
13491
13492         status = dcerpc_binding_handle_call(h,
13493                         NULL, &ndr_table_spoolss,
13494                         NDR_SPOOLSS_ENUMPRINTERDATAEX, mem_ctx, r);
13495
13496         return status;
13497 }
13498
13499 struct dcerpc_spoolss_EnumPrinterDataEx_state {
13500         struct spoolss_EnumPrinterDataEx orig;
13501         struct spoolss_EnumPrinterDataEx tmp;
13502         TALLOC_CTX *out_mem_ctx;
13503 };
13504
13505 static void dcerpc_spoolss_EnumPrinterDataEx_done(struct tevent_req *subreq);
13506
13507 struct tevent_req *dcerpc_spoolss_EnumPrinterDataEx_send(TALLOC_CTX *mem_ctx,
13508                                                          struct tevent_context *ev,
13509                                                          struct dcerpc_binding_handle *h,
13510                                                          struct policy_handle *_handle /* [in] [ref] */,
13511                                                          const char *_key_name /* [in] [charset(UTF16)] */,
13512                                                          uint32_t _offered /* [in]  */,
13513                                                          uint32_t *_count /* [out] [ref] */,
13514                                                          struct spoolss_PrinterEnumValues **_info /* [out] [ref,size_is(,*count)] */,
13515                                                          uint32_t *_needed /* [out] [ref] */)
13516 {
13517         struct tevent_req *req;
13518         struct dcerpc_spoolss_EnumPrinterDataEx_state *state;
13519         struct tevent_req *subreq;
13520
13521         req = tevent_req_create(mem_ctx, &state,
13522                                 struct dcerpc_spoolss_EnumPrinterDataEx_state);
13523         if (req == NULL) {
13524                 return NULL;
13525         }
13526         state->out_mem_ctx = NULL;
13527
13528         /* In parameters */
13529         state->orig.in.handle = _handle;
13530         state->orig.in.key_name = _key_name;
13531         state->orig.in.offered = _offered;
13532
13533         /* Out parameters */
13534         state->orig.out.count = _count;
13535         state->orig.out.info = _info;
13536         state->orig.out.needed = _needed;
13537
13538         /* Result */
13539         ZERO_STRUCT(state->orig.out.result);
13540
13541         state->out_mem_ctx = talloc_named_const(state, 0,
13542                              "dcerpc_spoolss_EnumPrinterDataEx_out_memory");
13543         if (tevent_req_nomem(state->out_mem_ctx, req)) {
13544                 return tevent_req_post(req, ev);
13545         }
13546
13547         /* make a temporary copy, that we pass to the dispatch function */
13548         state->tmp = state->orig;
13549
13550         subreq = dcerpc_spoolss_EnumPrinterDataEx_r_send(state, ev, h, &state->tmp);
13551         if (tevent_req_nomem(subreq, req)) {
13552                 return tevent_req_post(req, ev);
13553         }
13554         tevent_req_set_callback(subreq, dcerpc_spoolss_EnumPrinterDataEx_done, req);
13555         return req;
13556 }
13557
13558 static void dcerpc_spoolss_EnumPrinterDataEx_done(struct tevent_req *subreq)
13559 {
13560         struct tevent_req *req = tevent_req_callback_data(
13561                 subreq, struct tevent_req);
13562         struct dcerpc_spoolss_EnumPrinterDataEx_state *state = tevent_req_data(
13563                 req, struct dcerpc_spoolss_EnumPrinterDataEx_state);
13564         NTSTATUS status;
13565         TALLOC_CTX *mem_ctx;
13566
13567         if (state->out_mem_ctx) {
13568                 mem_ctx = state->out_mem_ctx;
13569         } else {
13570                 mem_ctx = state;
13571         }
13572
13573         status = dcerpc_spoolss_EnumPrinterDataEx_r_recv(subreq, mem_ctx);
13574         TALLOC_FREE(subreq);
13575         if (tevent_req_nterror(req, status)) {
13576                 return;
13577         }
13578
13579         /* Copy out parameters */
13580         *state->orig.out.count = *state->tmp.out.count;
13581         *state->orig.out.info = *state->tmp.out.info;
13582         *state->orig.out.needed = *state->tmp.out.needed;
13583
13584         /* Copy result */
13585         state->orig.out.result = state->tmp.out.result;
13586
13587         /* Reset temporary structure */
13588         ZERO_STRUCT(state->tmp);
13589
13590         tevent_req_done(req);
13591 }
13592
13593 NTSTATUS dcerpc_spoolss_EnumPrinterDataEx_recv(struct tevent_req *req,
13594                                                TALLOC_CTX *mem_ctx,
13595                                                WERROR *result)
13596 {
13597         struct dcerpc_spoolss_EnumPrinterDataEx_state *state = tevent_req_data(
13598                 req, struct dcerpc_spoolss_EnumPrinterDataEx_state);
13599         NTSTATUS status;
13600
13601         if (tevent_req_is_nterror(req, &status)) {
13602                 tevent_req_received(req);
13603                 return status;
13604         }
13605
13606         /* Steal possible out parameters to the callers context */
13607         talloc_steal(mem_ctx, state->out_mem_ctx);
13608
13609         /* Return result */
13610         *result = state->orig.out.result;
13611
13612         tevent_req_received(req);
13613         return NT_STATUS_OK;
13614 }
13615
13616 NTSTATUS dcerpc_spoolss_EnumPrinterDataEx(struct dcerpc_binding_handle *h,
13617                                           TALLOC_CTX *mem_ctx,
13618                                           struct policy_handle *_handle /* [in] [ref] */,
13619                                           const char *_key_name /* [in] [charset(UTF16)] */,
13620                                           uint32_t _offered /* [in]  */,
13621                                           uint32_t *_count /* [out] [ref] */,
13622                                           struct spoolss_PrinterEnumValues **_info /* [out] [ref,size_is(,*count)] */,
13623                                           uint32_t *_needed /* [out] [ref] */,
13624                                           WERROR *result)
13625 {
13626         struct spoolss_EnumPrinterDataEx r;
13627         NTSTATUS status;
13628
13629         /* In parameters */
13630         r.in.handle = _handle;
13631         r.in.key_name = _key_name;
13632         r.in.offered = _offered;
13633
13634         status = dcerpc_spoolss_EnumPrinterDataEx_r(h, mem_ctx, &r);
13635         if (!NT_STATUS_IS_OK(status)) {
13636                 return status;
13637         }
13638
13639         /* Return variables */
13640         *_count = *r.out.count;
13641         *_info = *r.out.info;
13642         *_needed = *r.out.needed;
13643
13644         /* Return result */
13645         *result = r.out.result;
13646
13647         return NT_STATUS_OK;
13648 }
13649
13650 struct dcerpc_spoolss_EnumPrinterKey_r_state {
13651         TALLOC_CTX *out_mem_ctx;
13652 };
13653
13654 static void dcerpc_spoolss_EnumPrinterKey_r_done(struct tevent_req *subreq);
13655
13656 struct tevent_req *dcerpc_spoolss_EnumPrinterKey_r_send(TALLOC_CTX *mem_ctx,
13657         struct tevent_context *ev,
13658         struct dcerpc_binding_handle *h,
13659         struct spoolss_EnumPrinterKey *r)
13660 {
13661         struct tevent_req *req;
13662         struct dcerpc_spoolss_EnumPrinterKey_r_state *state;
13663         struct tevent_req *subreq;
13664
13665         req = tevent_req_create(mem_ctx, &state,
13666                                 struct dcerpc_spoolss_EnumPrinterKey_r_state);
13667         if (req == NULL) {
13668                 return NULL;
13669         }
13670
13671         state->out_mem_ctx = talloc_new(state);
13672         if (tevent_req_nomem(state->out_mem_ctx, req)) {
13673                 return tevent_req_post(req, ev);
13674         }
13675
13676         subreq = dcerpc_binding_handle_call_send(state, ev, h,
13677                         NULL, &ndr_table_spoolss,
13678                         NDR_SPOOLSS_ENUMPRINTERKEY, state->out_mem_ctx, r);
13679         if (tevent_req_nomem(subreq, req)) {
13680                 return tevent_req_post(req, ev);
13681         }
13682         tevent_req_set_callback(subreq, dcerpc_spoolss_EnumPrinterKey_r_done, req);
13683
13684         return req;
13685 }
13686
13687 static void dcerpc_spoolss_EnumPrinterKey_r_done(struct tevent_req *subreq)
13688 {
13689         struct tevent_req *req =
13690                 tevent_req_callback_data(subreq,
13691                 struct tevent_req);
13692         NTSTATUS status;
13693
13694         status = dcerpc_binding_handle_call_recv(subreq);
13695         TALLOC_FREE(subreq);
13696         if (tevent_req_nterror(req, status)) {
13697                 return;
13698         }
13699
13700         tevent_req_done(req);
13701 }
13702
13703 NTSTATUS dcerpc_spoolss_EnumPrinterKey_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
13704 {
13705         struct dcerpc_spoolss_EnumPrinterKey_r_state *state =
13706                 tevent_req_data(req,
13707                 struct dcerpc_spoolss_EnumPrinterKey_r_state);
13708         NTSTATUS status;
13709
13710         if (tevent_req_is_nterror(req, &status)) {
13711                 tevent_req_received(req);
13712                 return status;
13713         }
13714
13715         talloc_steal(mem_ctx, state->out_mem_ctx);
13716
13717         tevent_req_received(req);
13718         return NT_STATUS_OK;
13719 }
13720
13721 NTSTATUS dcerpc_spoolss_EnumPrinterKey_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_EnumPrinterKey *r)
13722 {
13723         NTSTATUS status;
13724
13725         status = dcerpc_binding_handle_call(h,
13726                         NULL, &ndr_table_spoolss,
13727                         NDR_SPOOLSS_ENUMPRINTERKEY, mem_ctx, r);
13728
13729         return status;
13730 }
13731
13732 struct dcerpc_spoolss_EnumPrinterKey_state {
13733         struct spoolss_EnumPrinterKey orig;
13734         struct spoolss_EnumPrinterKey tmp;
13735         TALLOC_CTX *out_mem_ctx;
13736 };
13737
13738 static void dcerpc_spoolss_EnumPrinterKey_done(struct tevent_req *subreq);
13739
13740 struct tevent_req *dcerpc_spoolss_EnumPrinterKey_send(TALLOC_CTX *mem_ctx,
13741                                                       struct tevent_context *ev,
13742                                                       struct dcerpc_binding_handle *h,
13743                                                       struct policy_handle *_handle /* [in] [ref] */,
13744                                                       const char *_key_name /* [in] [charset(UTF16)] */,
13745                                                       uint32_t *__ndr_size /* [out] [ref] */,
13746                                                       union spoolss_KeyNames *_key_buffer /* [out] [subcontext_size(*_ndr_size*2),ref,subcontext(0),switch_is(*_ndr_size)] */,
13747                                                       uint32_t _offered /* [in]  */,
13748                                                       uint32_t *_needed /* [out] [ref] */)
13749 {
13750         struct tevent_req *req;
13751         struct dcerpc_spoolss_EnumPrinterKey_state *state;
13752         struct tevent_req *subreq;
13753
13754         req = tevent_req_create(mem_ctx, &state,
13755                                 struct dcerpc_spoolss_EnumPrinterKey_state);
13756         if (req == NULL) {
13757                 return NULL;
13758         }
13759         state->out_mem_ctx = NULL;
13760
13761         /* In parameters */
13762         state->orig.in.handle = _handle;
13763         state->orig.in.key_name = _key_name;
13764         state->orig.in.offered = _offered;
13765
13766         /* Out parameters */
13767         state->orig.out._ndr_size = __ndr_size;
13768         state->orig.out.key_buffer = _key_buffer;
13769         state->orig.out.needed = _needed;
13770
13771         /* Result */
13772         ZERO_STRUCT(state->orig.out.result);
13773
13774         state->out_mem_ctx = talloc_named_const(state, 0,
13775                              "dcerpc_spoolss_EnumPrinterKey_out_memory");
13776         if (tevent_req_nomem(state->out_mem_ctx, req)) {
13777                 return tevent_req_post(req, ev);
13778         }
13779
13780         /* make a temporary copy, that we pass to the dispatch function */
13781         state->tmp = state->orig;
13782
13783         subreq = dcerpc_spoolss_EnumPrinterKey_r_send(state, ev, h, &state->tmp);
13784         if (tevent_req_nomem(subreq, req)) {
13785                 return tevent_req_post(req, ev);
13786         }
13787         tevent_req_set_callback(subreq, dcerpc_spoolss_EnumPrinterKey_done, req);
13788         return req;
13789 }
13790
13791 static void dcerpc_spoolss_EnumPrinterKey_done(struct tevent_req *subreq)
13792 {
13793         struct tevent_req *req = tevent_req_callback_data(
13794                 subreq, struct tevent_req);
13795         struct dcerpc_spoolss_EnumPrinterKey_state *state = tevent_req_data(
13796                 req, struct dcerpc_spoolss_EnumPrinterKey_state);
13797         NTSTATUS status;
13798         TALLOC_CTX *mem_ctx;
13799
13800         if (state->out_mem_ctx) {
13801                 mem_ctx = state->out_mem_ctx;
13802         } else {
13803                 mem_ctx = state;
13804         }
13805
13806         status = dcerpc_spoolss_EnumPrinterKey_r_recv(subreq, mem_ctx);
13807         TALLOC_FREE(subreq);
13808         if (tevent_req_nterror(req, status)) {
13809                 return;
13810         }
13811
13812         /* Copy out parameters */
13813         *state->orig.out._ndr_size = *state->tmp.out._ndr_size;
13814         *state->orig.out.key_buffer = *state->tmp.out.key_buffer;
13815         *state->orig.out.needed = *state->tmp.out.needed;
13816
13817         /* Copy result */
13818         state->orig.out.result = state->tmp.out.result;
13819
13820         /* Reset temporary structure */
13821         ZERO_STRUCT(state->tmp);
13822
13823         tevent_req_done(req);
13824 }
13825
13826 NTSTATUS dcerpc_spoolss_EnumPrinterKey_recv(struct tevent_req *req,
13827                                             TALLOC_CTX *mem_ctx,
13828                                             WERROR *result)
13829 {
13830         struct dcerpc_spoolss_EnumPrinterKey_state *state = tevent_req_data(
13831                 req, struct dcerpc_spoolss_EnumPrinterKey_state);
13832         NTSTATUS status;
13833
13834         if (tevent_req_is_nterror(req, &status)) {
13835                 tevent_req_received(req);
13836                 return status;
13837         }
13838
13839         /* Steal possible out parameters to the callers context */
13840         talloc_steal(mem_ctx, state->out_mem_ctx);
13841
13842         /* Return result */
13843         *result = state->orig.out.result;
13844
13845         tevent_req_received(req);
13846         return NT_STATUS_OK;
13847 }
13848
13849 NTSTATUS dcerpc_spoolss_EnumPrinterKey(struct dcerpc_binding_handle *h,
13850                                        TALLOC_CTX *mem_ctx,
13851                                        struct policy_handle *_handle /* [in] [ref] */,
13852                                        const char *_key_name /* [in] [charset(UTF16)] */,
13853                                        uint32_t *__ndr_size /* [out] [ref] */,
13854                                        union spoolss_KeyNames *_key_buffer /* [out] [subcontext_size(*_ndr_size*2),ref,subcontext(0),switch_is(*_ndr_size)] */,
13855                                        uint32_t _offered /* [in]  */,
13856                                        uint32_t *_needed /* [out] [ref] */,
13857                                        WERROR *result)
13858 {
13859         struct spoolss_EnumPrinterKey r;
13860         NTSTATUS status;
13861
13862         /* In parameters */
13863         r.in.handle = _handle;
13864         r.in.key_name = _key_name;
13865         r.in.offered = _offered;
13866
13867         status = dcerpc_spoolss_EnumPrinterKey_r(h, mem_ctx, &r);
13868         if (!NT_STATUS_IS_OK(status)) {
13869                 return status;
13870         }
13871
13872         /* Return variables */
13873         *__ndr_size = *r.out._ndr_size;
13874         *_key_buffer = *r.out.key_buffer;
13875         *_needed = *r.out.needed;
13876
13877         /* Return result */
13878         *result = r.out.result;
13879
13880         return NT_STATUS_OK;
13881 }
13882
13883 struct dcerpc_spoolss_DeletePrinterDataEx_r_state {
13884         TALLOC_CTX *out_mem_ctx;
13885 };
13886
13887 static void dcerpc_spoolss_DeletePrinterDataEx_r_done(struct tevent_req *subreq);
13888
13889 struct tevent_req *dcerpc_spoolss_DeletePrinterDataEx_r_send(TALLOC_CTX *mem_ctx,
13890         struct tevent_context *ev,
13891         struct dcerpc_binding_handle *h,
13892         struct spoolss_DeletePrinterDataEx *r)
13893 {
13894         struct tevent_req *req;
13895         struct dcerpc_spoolss_DeletePrinterDataEx_r_state *state;
13896         struct tevent_req *subreq;
13897
13898         req = tevent_req_create(mem_ctx, &state,
13899                                 struct dcerpc_spoolss_DeletePrinterDataEx_r_state);
13900         if (req == NULL) {
13901                 return NULL;
13902         }
13903
13904         state->out_mem_ctx = NULL;
13905
13906         subreq = dcerpc_binding_handle_call_send(state, ev, h,
13907                         NULL, &ndr_table_spoolss,
13908                         NDR_SPOOLSS_DELETEPRINTERDATAEX, state, r);
13909         if (tevent_req_nomem(subreq, req)) {
13910                 return tevent_req_post(req, ev);
13911         }
13912         tevent_req_set_callback(subreq, dcerpc_spoolss_DeletePrinterDataEx_r_done, req);
13913
13914         return req;
13915 }
13916
13917 static void dcerpc_spoolss_DeletePrinterDataEx_r_done(struct tevent_req *subreq)
13918 {
13919         struct tevent_req *req =
13920                 tevent_req_callback_data(subreq,
13921                 struct tevent_req);
13922         NTSTATUS status;
13923
13924         status = dcerpc_binding_handle_call_recv(subreq);
13925         TALLOC_FREE(subreq);
13926         if (tevent_req_nterror(req, status)) {
13927                 return;
13928         }
13929
13930         tevent_req_done(req);
13931 }
13932
13933 NTSTATUS dcerpc_spoolss_DeletePrinterDataEx_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
13934 {
13935         struct dcerpc_spoolss_DeletePrinterDataEx_r_state *state =
13936                 tevent_req_data(req,
13937                 struct dcerpc_spoolss_DeletePrinterDataEx_r_state);
13938         NTSTATUS status;
13939
13940         if (tevent_req_is_nterror(req, &status)) {
13941                 tevent_req_received(req);
13942                 return status;
13943         }
13944
13945         talloc_steal(mem_ctx, state->out_mem_ctx);
13946
13947         tevent_req_received(req);
13948         return NT_STATUS_OK;
13949 }
13950
13951 NTSTATUS dcerpc_spoolss_DeletePrinterDataEx_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_DeletePrinterDataEx *r)
13952 {
13953         NTSTATUS status;
13954
13955         status = dcerpc_binding_handle_call(h,
13956                         NULL, &ndr_table_spoolss,
13957                         NDR_SPOOLSS_DELETEPRINTERDATAEX, mem_ctx, r);
13958
13959         return status;
13960 }
13961
13962 struct dcerpc_spoolss_DeletePrinterDataEx_state {
13963         struct spoolss_DeletePrinterDataEx orig;
13964         struct spoolss_DeletePrinterDataEx tmp;
13965         TALLOC_CTX *out_mem_ctx;
13966 };
13967
13968 static void dcerpc_spoolss_DeletePrinterDataEx_done(struct tevent_req *subreq);
13969
13970 struct tevent_req *dcerpc_spoolss_DeletePrinterDataEx_send(TALLOC_CTX *mem_ctx,
13971                                                            struct tevent_context *ev,
13972                                                            struct dcerpc_binding_handle *h,
13973                                                            struct policy_handle *_handle /* [in] [ref] */,
13974                                                            const char *_key_name /* [in] [charset(UTF16)] */,
13975                                                            const char *_value_name /* [in] [charset(UTF16)] */)
13976 {
13977         struct tevent_req *req;
13978         struct dcerpc_spoolss_DeletePrinterDataEx_state *state;
13979         struct tevent_req *subreq;
13980
13981         req = tevent_req_create(mem_ctx, &state,
13982                                 struct dcerpc_spoolss_DeletePrinterDataEx_state);
13983         if (req == NULL) {
13984                 return NULL;
13985         }
13986         state->out_mem_ctx = NULL;
13987
13988         /* In parameters */
13989         state->orig.in.handle = _handle;
13990         state->orig.in.key_name = _key_name;
13991         state->orig.in.value_name = _value_name;
13992
13993         /* Out parameters */
13994
13995         /* Result */
13996         ZERO_STRUCT(state->orig.out.result);
13997
13998         /* make a temporary copy, that we pass to the dispatch function */
13999         state->tmp = state->orig;
14000
14001         subreq = dcerpc_spoolss_DeletePrinterDataEx_r_send(state, ev, h, &state->tmp);
14002         if (tevent_req_nomem(subreq, req)) {
14003                 return tevent_req_post(req, ev);
14004         }
14005         tevent_req_set_callback(subreq, dcerpc_spoolss_DeletePrinterDataEx_done, req);
14006         return req;
14007 }
14008
14009 static void dcerpc_spoolss_DeletePrinterDataEx_done(struct tevent_req *subreq)
14010 {
14011         struct tevent_req *req = tevent_req_callback_data(
14012                 subreq, struct tevent_req);
14013         struct dcerpc_spoolss_DeletePrinterDataEx_state *state = tevent_req_data(
14014                 req, struct dcerpc_spoolss_DeletePrinterDataEx_state);
14015         NTSTATUS status;
14016         TALLOC_CTX *mem_ctx;
14017
14018         if (state->out_mem_ctx) {
14019                 mem_ctx = state->out_mem_ctx;
14020         } else {
14021                 mem_ctx = state;
14022         }
14023
14024         status = dcerpc_spoolss_DeletePrinterDataEx_r_recv(subreq, mem_ctx);
14025         TALLOC_FREE(subreq);
14026         if (tevent_req_nterror(req, status)) {
14027                 return;
14028         }
14029
14030         /* Copy out parameters */
14031
14032         /* Copy result */
14033         state->orig.out.result = state->tmp.out.result;
14034
14035         /* Reset temporary structure */
14036         ZERO_STRUCT(state->tmp);
14037
14038         tevent_req_done(req);
14039 }
14040
14041 NTSTATUS dcerpc_spoolss_DeletePrinterDataEx_recv(struct tevent_req *req,
14042                                                  TALLOC_CTX *mem_ctx,
14043                                                  WERROR *result)
14044 {
14045         struct dcerpc_spoolss_DeletePrinterDataEx_state *state = tevent_req_data(
14046                 req, struct dcerpc_spoolss_DeletePrinterDataEx_state);
14047         NTSTATUS status;
14048
14049         if (tevent_req_is_nterror(req, &status)) {
14050                 tevent_req_received(req);
14051                 return status;
14052         }
14053
14054         /* Steal possible out parameters to the callers context */
14055         talloc_steal(mem_ctx, state->out_mem_ctx);
14056
14057         /* Return result */
14058         *result = state->orig.out.result;
14059
14060         tevent_req_received(req);
14061         return NT_STATUS_OK;
14062 }
14063
14064 NTSTATUS dcerpc_spoolss_DeletePrinterDataEx(struct dcerpc_binding_handle *h,
14065                                             TALLOC_CTX *mem_ctx,
14066                                             struct policy_handle *_handle /* [in] [ref] */,
14067                                             const char *_key_name /* [in] [charset(UTF16)] */,
14068                                             const char *_value_name /* [in] [charset(UTF16)] */,
14069                                             WERROR *result)
14070 {
14071         struct spoolss_DeletePrinterDataEx r;
14072         NTSTATUS status;
14073
14074         /* In parameters */
14075         r.in.handle = _handle;
14076         r.in.key_name = _key_name;
14077         r.in.value_name = _value_name;
14078
14079         status = dcerpc_spoolss_DeletePrinterDataEx_r(h, mem_ctx, &r);
14080         if (!NT_STATUS_IS_OK(status)) {
14081                 return status;
14082         }
14083
14084         /* Return variables */
14085
14086         /* Return result */
14087         *result = r.out.result;
14088
14089         return NT_STATUS_OK;
14090 }
14091
14092 struct dcerpc_spoolss_DeletePrinterKey_r_state {
14093         TALLOC_CTX *out_mem_ctx;
14094 };
14095
14096 static void dcerpc_spoolss_DeletePrinterKey_r_done(struct tevent_req *subreq);
14097
14098 struct tevent_req *dcerpc_spoolss_DeletePrinterKey_r_send(TALLOC_CTX *mem_ctx,
14099         struct tevent_context *ev,
14100         struct dcerpc_binding_handle *h,
14101         struct spoolss_DeletePrinterKey *r)
14102 {
14103         struct tevent_req *req;
14104         struct dcerpc_spoolss_DeletePrinterKey_r_state *state;
14105         struct tevent_req *subreq;
14106
14107         req = tevent_req_create(mem_ctx, &state,
14108                                 struct dcerpc_spoolss_DeletePrinterKey_r_state);
14109         if (req == NULL) {
14110                 return NULL;
14111         }
14112
14113         state->out_mem_ctx = NULL;
14114
14115         subreq = dcerpc_binding_handle_call_send(state, ev, h,
14116                         NULL, &ndr_table_spoolss,
14117                         NDR_SPOOLSS_DELETEPRINTERKEY, state, r);
14118         if (tevent_req_nomem(subreq, req)) {
14119                 return tevent_req_post(req, ev);
14120         }
14121         tevent_req_set_callback(subreq, dcerpc_spoolss_DeletePrinterKey_r_done, req);
14122
14123         return req;
14124 }
14125
14126 static void dcerpc_spoolss_DeletePrinterKey_r_done(struct tevent_req *subreq)
14127 {
14128         struct tevent_req *req =
14129                 tevent_req_callback_data(subreq,
14130                 struct tevent_req);
14131         NTSTATUS status;
14132
14133         status = dcerpc_binding_handle_call_recv(subreq);
14134         TALLOC_FREE(subreq);
14135         if (tevent_req_nterror(req, status)) {
14136                 return;
14137         }
14138
14139         tevent_req_done(req);
14140 }
14141
14142 NTSTATUS dcerpc_spoolss_DeletePrinterKey_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
14143 {
14144         struct dcerpc_spoolss_DeletePrinterKey_r_state *state =
14145                 tevent_req_data(req,
14146                 struct dcerpc_spoolss_DeletePrinterKey_r_state);
14147         NTSTATUS status;
14148
14149         if (tevent_req_is_nterror(req, &status)) {
14150                 tevent_req_received(req);
14151                 return status;
14152         }
14153
14154         talloc_steal(mem_ctx, state->out_mem_ctx);
14155
14156         tevent_req_received(req);
14157         return NT_STATUS_OK;
14158 }
14159
14160 NTSTATUS dcerpc_spoolss_DeletePrinterKey_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_DeletePrinterKey *r)
14161 {
14162         NTSTATUS status;
14163
14164         status = dcerpc_binding_handle_call(h,
14165                         NULL, &ndr_table_spoolss,
14166                         NDR_SPOOLSS_DELETEPRINTERKEY, mem_ctx, r);
14167
14168         return status;
14169 }
14170
14171 struct dcerpc_spoolss_DeletePrinterKey_state {
14172         struct spoolss_DeletePrinterKey orig;
14173         struct spoolss_DeletePrinterKey tmp;
14174         TALLOC_CTX *out_mem_ctx;
14175 };
14176
14177 static void dcerpc_spoolss_DeletePrinterKey_done(struct tevent_req *subreq);
14178
14179 struct tevent_req *dcerpc_spoolss_DeletePrinterKey_send(TALLOC_CTX *mem_ctx,
14180                                                         struct tevent_context *ev,
14181                                                         struct dcerpc_binding_handle *h,
14182                                                         struct policy_handle *_handle /* [in] [ref] */,
14183                                                         const char *_key_name /* [in] [charset(UTF16)] */)
14184 {
14185         struct tevent_req *req;
14186         struct dcerpc_spoolss_DeletePrinterKey_state *state;
14187         struct tevent_req *subreq;
14188
14189         req = tevent_req_create(mem_ctx, &state,
14190                                 struct dcerpc_spoolss_DeletePrinterKey_state);
14191         if (req == NULL) {
14192                 return NULL;
14193         }
14194         state->out_mem_ctx = NULL;
14195
14196         /* In parameters */
14197         state->orig.in.handle = _handle;
14198         state->orig.in.key_name = _key_name;
14199
14200         /* Out parameters */
14201
14202         /* Result */
14203         ZERO_STRUCT(state->orig.out.result);
14204
14205         /* make a temporary copy, that we pass to the dispatch function */
14206         state->tmp = state->orig;
14207
14208         subreq = dcerpc_spoolss_DeletePrinterKey_r_send(state, ev, h, &state->tmp);
14209         if (tevent_req_nomem(subreq, req)) {
14210                 return tevent_req_post(req, ev);
14211         }
14212         tevent_req_set_callback(subreq, dcerpc_spoolss_DeletePrinterKey_done, req);
14213         return req;
14214 }
14215
14216 static void dcerpc_spoolss_DeletePrinterKey_done(struct tevent_req *subreq)
14217 {
14218         struct tevent_req *req = tevent_req_callback_data(
14219                 subreq, struct tevent_req);
14220         struct dcerpc_spoolss_DeletePrinterKey_state *state = tevent_req_data(
14221                 req, struct dcerpc_spoolss_DeletePrinterKey_state);
14222         NTSTATUS status;
14223         TALLOC_CTX *mem_ctx;
14224
14225         if (state->out_mem_ctx) {
14226                 mem_ctx = state->out_mem_ctx;
14227         } else {
14228                 mem_ctx = state;
14229         }
14230
14231         status = dcerpc_spoolss_DeletePrinterKey_r_recv(subreq, mem_ctx);
14232         TALLOC_FREE(subreq);
14233         if (tevent_req_nterror(req, status)) {
14234                 return;
14235         }
14236
14237         /* Copy out parameters */
14238
14239         /* Copy result */
14240         state->orig.out.result = state->tmp.out.result;
14241
14242         /* Reset temporary structure */
14243         ZERO_STRUCT(state->tmp);
14244
14245         tevent_req_done(req);
14246 }
14247
14248 NTSTATUS dcerpc_spoolss_DeletePrinterKey_recv(struct tevent_req *req,
14249                                               TALLOC_CTX *mem_ctx,
14250                                               WERROR *result)
14251 {
14252         struct dcerpc_spoolss_DeletePrinterKey_state *state = tevent_req_data(
14253                 req, struct dcerpc_spoolss_DeletePrinterKey_state);
14254         NTSTATUS status;
14255
14256         if (tevent_req_is_nterror(req, &status)) {
14257                 tevent_req_received(req);
14258                 return status;
14259         }
14260
14261         /* Steal possible out parameters to the callers context */
14262         talloc_steal(mem_ctx, state->out_mem_ctx);
14263
14264         /* Return result */
14265         *result = state->orig.out.result;
14266
14267         tevent_req_received(req);
14268         return NT_STATUS_OK;
14269 }
14270
14271 NTSTATUS dcerpc_spoolss_DeletePrinterKey(struct dcerpc_binding_handle *h,
14272                                          TALLOC_CTX *mem_ctx,
14273                                          struct policy_handle *_handle /* [in] [ref] */,
14274                                          const char *_key_name /* [in] [charset(UTF16)] */,
14275                                          WERROR *result)
14276 {
14277         struct spoolss_DeletePrinterKey r;
14278         NTSTATUS status;
14279
14280         /* In parameters */
14281         r.in.handle = _handle;
14282         r.in.key_name = _key_name;
14283
14284         status = dcerpc_spoolss_DeletePrinterKey_r(h, mem_ctx, &r);
14285         if (!NT_STATUS_IS_OK(status)) {
14286                 return status;
14287         }
14288
14289         /* Return variables */
14290
14291         /* Return result */
14292         *result = r.out.result;
14293
14294         return NT_STATUS_OK;
14295 }
14296
14297 struct dcerpc_spoolss_DeletePrinterDriverEx_r_state {
14298         TALLOC_CTX *out_mem_ctx;
14299 };
14300
14301 static void dcerpc_spoolss_DeletePrinterDriverEx_r_done(struct tevent_req *subreq);
14302
14303 struct tevent_req *dcerpc_spoolss_DeletePrinterDriverEx_r_send(TALLOC_CTX *mem_ctx,
14304         struct tevent_context *ev,
14305         struct dcerpc_binding_handle *h,
14306         struct spoolss_DeletePrinterDriverEx *r)
14307 {
14308         struct tevent_req *req;
14309         struct dcerpc_spoolss_DeletePrinterDriverEx_r_state *state;
14310         struct tevent_req *subreq;
14311
14312         req = tevent_req_create(mem_ctx, &state,
14313                                 struct dcerpc_spoolss_DeletePrinterDriverEx_r_state);
14314         if (req == NULL) {
14315                 return NULL;
14316         }
14317
14318         state->out_mem_ctx = NULL;
14319
14320         subreq = dcerpc_binding_handle_call_send(state, ev, h,
14321                         NULL, &ndr_table_spoolss,
14322                         NDR_SPOOLSS_DELETEPRINTERDRIVEREX, state, r);
14323         if (tevent_req_nomem(subreq, req)) {
14324                 return tevent_req_post(req, ev);
14325         }
14326         tevent_req_set_callback(subreq, dcerpc_spoolss_DeletePrinterDriverEx_r_done, req);
14327
14328         return req;
14329 }
14330
14331 static void dcerpc_spoolss_DeletePrinterDriverEx_r_done(struct tevent_req *subreq)
14332 {
14333         struct tevent_req *req =
14334                 tevent_req_callback_data(subreq,
14335                 struct tevent_req);
14336         NTSTATUS status;
14337
14338         status = dcerpc_binding_handle_call_recv(subreq);
14339         TALLOC_FREE(subreq);
14340         if (tevent_req_nterror(req, status)) {
14341                 return;
14342         }
14343
14344         tevent_req_done(req);
14345 }
14346
14347 NTSTATUS dcerpc_spoolss_DeletePrinterDriverEx_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
14348 {
14349         struct dcerpc_spoolss_DeletePrinterDriverEx_r_state *state =
14350                 tevent_req_data(req,
14351                 struct dcerpc_spoolss_DeletePrinterDriverEx_r_state);
14352         NTSTATUS status;
14353
14354         if (tevent_req_is_nterror(req, &status)) {
14355                 tevent_req_received(req);
14356                 return status;
14357         }
14358
14359         talloc_steal(mem_ctx, state->out_mem_ctx);
14360
14361         tevent_req_received(req);
14362         return NT_STATUS_OK;
14363 }
14364
14365 NTSTATUS dcerpc_spoolss_DeletePrinterDriverEx_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_DeletePrinterDriverEx *r)
14366 {
14367         NTSTATUS status;
14368
14369         status = dcerpc_binding_handle_call(h,
14370                         NULL, &ndr_table_spoolss,
14371                         NDR_SPOOLSS_DELETEPRINTERDRIVEREX, mem_ctx, r);
14372
14373         return status;
14374 }
14375
14376 struct dcerpc_spoolss_DeletePrinterDriverEx_state {
14377         struct spoolss_DeletePrinterDriverEx orig;
14378         struct spoolss_DeletePrinterDriverEx tmp;
14379         TALLOC_CTX *out_mem_ctx;
14380 };
14381
14382 static void dcerpc_spoolss_DeletePrinterDriverEx_done(struct tevent_req *subreq);
14383
14384 struct tevent_req *dcerpc_spoolss_DeletePrinterDriverEx_send(TALLOC_CTX *mem_ctx,
14385                                                              struct tevent_context *ev,
14386                                                              struct dcerpc_binding_handle *h,
14387                                                              const char *_server /* [in] [unique,charset(UTF16)] */,
14388                                                              const char *_architecture /* [in] [charset(UTF16)] */,
14389                                                              const char *_driver /* [in] [charset(UTF16)] */,
14390                                                              uint32_t _delete_flags /* [in]  */,
14391                                                              uint32_t _version /* [in]  */)
14392 {
14393         struct tevent_req *req;
14394         struct dcerpc_spoolss_DeletePrinterDriverEx_state *state;
14395         struct tevent_req *subreq;
14396
14397         req = tevent_req_create(mem_ctx, &state,
14398                                 struct dcerpc_spoolss_DeletePrinterDriverEx_state);
14399         if (req == NULL) {
14400                 return NULL;
14401         }
14402         state->out_mem_ctx = NULL;
14403
14404         /* In parameters */
14405         state->orig.in.server = _server;
14406         state->orig.in.architecture = _architecture;
14407         state->orig.in.driver = _driver;
14408         state->orig.in.delete_flags = _delete_flags;
14409         state->orig.in.version = _version;
14410
14411         /* Out parameters */
14412
14413         /* Result */
14414         ZERO_STRUCT(state->orig.out.result);
14415
14416         /* make a temporary copy, that we pass to the dispatch function */
14417         state->tmp = state->orig;
14418
14419         subreq = dcerpc_spoolss_DeletePrinterDriverEx_r_send(state, ev, h, &state->tmp);
14420         if (tevent_req_nomem(subreq, req)) {
14421                 return tevent_req_post(req, ev);
14422         }
14423         tevent_req_set_callback(subreq, dcerpc_spoolss_DeletePrinterDriverEx_done, req);
14424         return req;
14425 }
14426
14427 static void dcerpc_spoolss_DeletePrinterDriverEx_done(struct tevent_req *subreq)
14428 {
14429         struct tevent_req *req = tevent_req_callback_data(
14430                 subreq, struct tevent_req);
14431         struct dcerpc_spoolss_DeletePrinterDriverEx_state *state = tevent_req_data(
14432                 req, struct dcerpc_spoolss_DeletePrinterDriverEx_state);
14433         NTSTATUS status;
14434         TALLOC_CTX *mem_ctx;
14435
14436         if (state->out_mem_ctx) {
14437                 mem_ctx = state->out_mem_ctx;
14438         } else {
14439                 mem_ctx = state;
14440         }
14441
14442         status = dcerpc_spoolss_DeletePrinterDriverEx_r_recv(subreq, mem_ctx);
14443         TALLOC_FREE(subreq);
14444         if (tevent_req_nterror(req, status)) {
14445                 return;
14446         }
14447
14448         /* Copy out parameters */
14449
14450         /* Copy result */
14451         state->orig.out.result = state->tmp.out.result;
14452
14453         /* Reset temporary structure */
14454         ZERO_STRUCT(state->tmp);
14455
14456         tevent_req_done(req);
14457 }
14458
14459 NTSTATUS dcerpc_spoolss_DeletePrinterDriverEx_recv(struct tevent_req *req,
14460                                                    TALLOC_CTX *mem_ctx,
14461                                                    WERROR *result)
14462 {
14463         struct dcerpc_spoolss_DeletePrinterDriverEx_state *state = tevent_req_data(
14464                 req, struct dcerpc_spoolss_DeletePrinterDriverEx_state);
14465         NTSTATUS status;
14466
14467         if (tevent_req_is_nterror(req, &status)) {
14468                 tevent_req_received(req);
14469                 return status;
14470         }
14471
14472         /* Steal possible out parameters to the callers context */
14473         talloc_steal(mem_ctx, state->out_mem_ctx);
14474
14475         /* Return result */
14476         *result = state->orig.out.result;
14477
14478         tevent_req_received(req);
14479         return NT_STATUS_OK;
14480 }
14481
14482 NTSTATUS dcerpc_spoolss_DeletePrinterDriverEx(struct dcerpc_binding_handle *h,
14483                                               TALLOC_CTX *mem_ctx,
14484                                               const char *_server /* [in] [unique,charset(UTF16)] */,
14485                                               const char *_architecture /* [in] [charset(UTF16)] */,
14486                                               const char *_driver /* [in] [charset(UTF16)] */,
14487                                               uint32_t _delete_flags /* [in]  */,
14488                                               uint32_t _version /* [in]  */,
14489                                               WERROR *result)
14490 {
14491         struct spoolss_DeletePrinterDriverEx r;
14492         NTSTATUS status;
14493
14494         /* In parameters */
14495         r.in.server = _server;
14496         r.in.architecture = _architecture;
14497         r.in.driver = _driver;
14498         r.in.delete_flags = _delete_flags;
14499         r.in.version = _version;
14500
14501         status = dcerpc_spoolss_DeletePrinterDriverEx_r(h, mem_ctx, &r);
14502         if (!NT_STATUS_IS_OK(status)) {
14503                 return status;
14504         }
14505
14506         /* Return variables */
14507
14508         /* Return result */
14509         *result = r.out.result;
14510
14511         return NT_STATUS_OK;
14512 }
14513
14514 struct dcerpc_spoolss_AddPerMachineConnection_r_state {
14515         TALLOC_CTX *out_mem_ctx;
14516 };
14517
14518 static void dcerpc_spoolss_AddPerMachineConnection_r_done(struct tevent_req *subreq);
14519
14520 struct tevent_req *dcerpc_spoolss_AddPerMachineConnection_r_send(TALLOC_CTX *mem_ctx,
14521         struct tevent_context *ev,
14522         struct dcerpc_binding_handle *h,
14523         struct spoolss_AddPerMachineConnection *r)
14524 {
14525         struct tevent_req *req;
14526         struct dcerpc_spoolss_AddPerMachineConnection_r_state *state;
14527         struct tevent_req *subreq;
14528
14529         req = tevent_req_create(mem_ctx, &state,
14530                                 struct dcerpc_spoolss_AddPerMachineConnection_r_state);
14531         if (req == NULL) {
14532                 return NULL;
14533         }
14534
14535         state->out_mem_ctx = NULL;
14536
14537         subreq = dcerpc_binding_handle_call_send(state, ev, h,
14538                         NULL, &ndr_table_spoolss,
14539                         NDR_SPOOLSS_ADDPERMACHINECONNECTION, state, r);
14540         if (tevent_req_nomem(subreq, req)) {
14541                 return tevent_req_post(req, ev);
14542         }
14543         tevent_req_set_callback(subreq, dcerpc_spoolss_AddPerMachineConnection_r_done, req);
14544
14545         return req;
14546 }
14547
14548 static void dcerpc_spoolss_AddPerMachineConnection_r_done(struct tevent_req *subreq)
14549 {
14550         struct tevent_req *req =
14551                 tevent_req_callback_data(subreq,
14552                 struct tevent_req);
14553         NTSTATUS status;
14554
14555         status = dcerpc_binding_handle_call_recv(subreq);
14556         TALLOC_FREE(subreq);
14557         if (tevent_req_nterror(req, status)) {
14558                 return;
14559         }
14560
14561         tevent_req_done(req);
14562 }
14563
14564 NTSTATUS dcerpc_spoolss_AddPerMachineConnection_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
14565 {
14566         struct dcerpc_spoolss_AddPerMachineConnection_r_state *state =
14567                 tevent_req_data(req,
14568                 struct dcerpc_spoolss_AddPerMachineConnection_r_state);
14569         NTSTATUS status;
14570
14571         if (tevent_req_is_nterror(req, &status)) {
14572                 tevent_req_received(req);
14573                 return status;
14574         }
14575
14576         talloc_steal(mem_ctx, state->out_mem_ctx);
14577
14578         tevent_req_received(req);
14579         return NT_STATUS_OK;
14580 }
14581
14582 NTSTATUS dcerpc_spoolss_AddPerMachineConnection_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_AddPerMachineConnection *r)
14583 {
14584         NTSTATUS status;
14585
14586         status = dcerpc_binding_handle_call(h,
14587                         NULL, &ndr_table_spoolss,
14588                         NDR_SPOOLSS_ADDPERMACHINECONNECTION, mem_ctx, r);
14589
14590         return status;
14591 }
14592
14593 struct dcerpc_spoolss_AddPerMachineConnection_state {
14594         struct spoolss_AddPerMachineConnection orig;
14595         struct spoolss_AddPerMachineConnection tmp;
14596         TALLOC_CTX *out_mem_ctx;
14597 };
14598
14599 static void dcerpc_spoolss_AddPerMachineConnection_done(struct tevent_req *subreq);
14600
14601 struct tevent_req *dcerpc_spoolss_AddPerMachineConnection_send(TALLOC_CTX *mem_ctx,
14602                                                                struct tevent_context *ev,
14603                                                                struct dcerpc_binding_handle *h,
14604                                                                const char *_server /* [in] [unique,charset(UTF16)] */,
14605                                                                const char *_printername /* [in] [ref,charset(UTF16)] */,
14606                                                                const char *_printserver /* [in] [ref,charset(UTF16)] */,
14607                                                                const char *_provider /* [in] [ref,charset(UTF16)] */)
14608 {
14609         struct tevent_req *req;
14610         struct dcerpc_spoolss_AddPerMachineConnection_state *state;
14611         struct tevent_req *subreq;
14612
14613         req = tevent_req_create(mem_ctx, &state,
14614                                 struct dcerpc_spoolss_AddPerMachineConnection_state);
14615         if (req == NULL) {
14616                 return NULL;
14617         }
14618         state->out_mem_ctx = NULL;
14619
14620         /* In parameters */
14621         state->orig.in.server = _server;
14622         state->orig.in.printername = _printername;
14623         state->orig.in.printserver = _printserver;
14624         state->orig.in.provider = _provider;
14625
14626         /* Out parameters */
14627
14628         /* Result */
14629         ZERO_STRUCT(state->orig.out.result);
14630
14631         /* make a temporary copy, that we pass to the dispatch function */
14632         state->tmp = state->orig;
14633
14634         subreq = dcerpc_spoolss_AddPerMachineConnection_r_send(state, ev, h, &state->tmp);
14635         if (tevent_req_nomem(subreq, req)) {
14636                 return tevent_req_post(req, ev);
14637         }
14638         tevent_req_set_callback(subreq, dcerpc_spoolss_AddPerMachineConnection_done, req);
14639         return req;
14640 }
14641
14642 static void dcerpc_spoolss_AddPerMachineConnection_done(struct tevent_req *subreq)
14643 {
14644         struct tevent_req *req = tevent_req_callback_data(
14645                 subreq, struct tevent_req);
14646         struct dcerpc_spoolss_AddPerMachineConnection_state *state = tevent_req_data(
14647                 req, struct dcerpc_spoolss_AddPerMachineConnection_state);
14648         NTSTATUS status;
14649         TALLOC_CTX *mem_ctx;
14650
14651         if (state->out_mem_ctx) {
14652                 mem_ctx = state->out_mem_ctx;
14653         } else {
14654                 mem_ctx = state;
14655         }
14656
14657         status = dcerpc_spoolss_AddPerMachineConnection_r_recv(subreq, mem_ctx);
14658         TALLOC_FREE(subreq);
14659         if (tevent_req_nterror(req, status)) {
14660                 return;
14661         }
14662
14663         /* Copy out parameters */
14664
14665         /* Copy result */
14666         state->orig.out.result = state->tmp.out.result;
14667
14668         /* Reset temporary structure */
14669         ZERO_STRUCT(state->tmp);
14670
14671         tevent_req_done(req);
14672 }
14673
14674 NTSTATUS dcerpc_spoolss_AddPerMachineConnection_recv(struct tevent_req *req,
14675                                                      TALLOC_CTX *mem_ctx,
14676                                                      WERROR *result)
14677 {
14678         struct dcerpc_spoolss_AddPerMachineConnection_state *state = tevent_req_data(
14679                 req, struct dcerpc_spoolss_AddPerMachineConnection_state);
14680         NTSTATUS status;
14681
14682         if (tevent_req_is_nterror(req, &status)) {
14683                 tevent_req_received(req);
14684                 return status;
14685         }
14686
14687         /* Steal possible out parameters to the callers context */
14688         talloc_steal(mem_ctx, state->out_mem_ctx);
14689
14690         /* Return result */
14691         *result = state->orig.out.result;
14692
14693         tevent_req_received(req);
14694         return NT_STATUS_OK;
14695 }
14696
14697 NTSTATUS dcerpc_spoolss_AddPerMachineConnection(struct dcerpc_binding_handle *h,
14698                                                 TALLOC_CTX *mem_ctx,
14699                                                 const char *_server /* [in] [unique,charset(UTF16)] */,
14700                                                 const char *_printername /* [in] [ref,charset(UTF16)] */,
14701                                                 const char *_printserver /* [in] [ref,charset(UTF16)] */,
14702                                                 const char *_provider /* [in] [ref,charset(UTF16)] */,
14703                                                 WERROR *result)
14704 {
14705         struct spoolss_AddPerMachineConnection r;
14706         NTSTATUS status;
14707
14708         /* In parameters */
14709         r.in.server = _server;
14710         r.in.printername = _printername;
14711         r.in.printserver = _printserver;
14712         r.in.provider = _provider;
14713
14714         status = dcerpc_spoolss_AddPerMachineConnection_r(h, mem_ctx, &r);
14715         if (!NT_STATUS_IS_OK(status)) {
14716                 return status;
14717         }
14718
14719         /* Return variables */
14720
14721         /* Return result */
14722         *result = r.out.result;
14723
14724         return NT_STATUS_OK;
14725 }
14726
14727 struct dcerpc_spoolss_DeletePerMachineConnection_r_state {
14728         TALLOC_CTX *out_mem_ctx;
14729 };
14730
14731 static void dcerpc_spoolss_DeletePerMachineConnection_r_done(struct tevent_req *subreq);
14732
14733 struct tevent_req *dcerpc_spoolss_DeletePerMachineConnection_r_send(TALLOC_CTX *mem_ctx,
14734         struct tevent_context *ev,
14735         struct dcerpc_binding_handle *h,
14736         struct spoolss_DeletePerMachineConnection *r)
14737 {
14738         struct tevent_req *req;
14739         struct dcerpc_spoolss_DeletePerMachineConnection_r_state *state;
14740         struct tevent_req *subreq;
14741
14742         req = tevent_req_create(mem_ctx, &state,
14743                                 struct dcerpc_spoolss_DeletePerMachineConnection_r_state);
14744         if (req == NULL) {
14745                 return NULL;
14746         }
14747
14748         state->out_mem_ctx = NULL;
14749
14750         subreq = dcerpc_binding_handle_call_send(state, ev, h,
14751                         NULL, &ndr_table_spoolss,
14752                         NDR_SPOOLSS_DELETEPERMACHINECONNECTION, state, r);
14753         if (tevent_req_nomem(subreq, req)) {
14754                 return tevent_req_post(req, ev);
14755         }
14756         tevent_req_set_callback(subreq, dcerpc_spoolss_DeletePerMachineConnection_r_done, req);
14757
14758         return req;
14759 }
14760
14761 static void dcerpc_spoolss_DeletePerMachineConnection_r_done(struct tevent_req *subreq)
14762 {
14763         struct tevent_req *req =
14764                 tevent_req_callback_data(subreq,
14765                 struct tevent_req);
14766         NTSTATUS status;
14767
14768         status = dcerpc_binding_handle_call_recv(subreq);
14769         TALLOC_FREE(subreq);
14770         if (tevent_req_nterror(req, status)) {
14771                 return;
14772         }
14773
14774         tevent_req_done(req);
14775 }
14776
14777 NTSTATUS dcerpc_spoolss_DeletePerMachineConnection_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
14778 {
14779         struct dcerpc_spoolss_DeletePerMachineConnection_r_state *state =
14780                 tevent_req_data(req,
14781                 struct dcerpc_spoolss_DeletePerMachineConnection_r_state);
14782         NTSTATUS status;
14783
14784         if (tevent_req_is_nterror(req, &status)) {
14785                 tevent_req_received(req);
14786                 return status;
14787         }
14788
14789         talloc_steal(mem_ctx, state->out_mem_ctx);
14790
14791         tevent_req_received(req);
14792         return NT_STATUS_OK;
14793 }
14794
14795 NTSTATUS dcerpc_spoolss_DeletePerMachineConnection_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_DeletePerMachineConnection *r)
14796 {
14797         NTSTATUS status;
14798
14799         status = dcerpc_binding_handle_call(h,
14800                         NULL, &ndr_table_spoolss,
14801                         NDR_SPOOLSS_DELETEPERMACHINECONNECTION, mem_ctx, r);
14802
14803         return status;
14804 }
14805
14806 struct dcerpc_spoolss_DeletePerMachineConnection_state {
14807         struct spoolss_DeletePerMachineConnection orig;
14808         struct spoolss_DeletePerMachineConnection tmp;
14809         TALLOC_CTX *out_mem_ctx;
14810 };
14811
14812 static void dcerpc_spoolss_DeletePerMachineConnection_done(struct tevent_req *subreq);
14813
14814 struct tevent_req *dcerpc_spoolss_DeletePerMachineConnection_send(TALLOC_CTX *mem_ctx,
14815                                                                   struct tevent_context *ev,
14816                                                                   struct dcerpc_binding_handle *h,
14817                                                                   const char *_server /* [in] [unique,charset(UTF16)] */,
14818                                                                   const char *_printername /* [in] [ref,charset(UTF16)] */)
14819 {
14820         struct tevent_req *req;
14821         struct dcerpc_spoolss_DeletePerMachineConnection_state *state;
14822         struct tevent_req *subreq;
14823
14824         req = tevent_req_create(mem_ctx, &state,
14825                                 struct dcerpc_spoolss_DeletePerMachineConnection_state);
14826         if (req == NULL) {
14827                 return NULL;
14828         }
14829         state->out_mem_ctx = NULL;
14830
14831         /* In parameters */
14832         state->orig.in.server = _server;
14833         state->orig.in.printername = _printername;
14834
14835         /* Out parameters */
14836
14837         /* Result */
14838         ZERO_STRUCT(state->orig.out.result);
14839
14840         /* make a temporary copy, that we pass to the dispatch function */
14841         state->tmp = state->orig;
14842
14843         subreq = dcerpc_spoolss_DeletePerMachineConnection_r_send(state, ev, h, &state->tmp);
14844         if (tevent_req_nomem(subreq, req)) {
14845                 return tevent_req_post(req, ev);
14846         }
14847         tevent_req_set_callback(subreq, dcerpc_spoolss_DeletePerMachineConnection_done, req);
14848         return req;
14849 }
14850
14851 static void dcerpc_spoolss_DeletePerMachineConnection_done(struct tevent_req *subreq)
14852 {
14853         struct tevent_req *req = tevent_req_callback_data(
14854                 subreq, struct tevent_req);
14855         struct dcerpc_spoolss_DeletePerMachineConnection_state *state = tevent_req_data(
14856                 req, struct dcerpc_spoolss_DeletePerMachineConnection_state);
14857         NTSTATUS status;
14858         TALLOC_CTX *mem_ctx;
14859
14860         if (state->out_mem_ctx) {
14861                 mem_ctx = state->out_mem_ctx;
14862         } else {
14863                 mem_ctx = state;
14864         }
14865
14866         status = dcerpc_spoolss_DeletePerMachineConnection_r_recv(subreq, mem_ctx);
14867         TALLOC_FREE(subreq);
14868         if (tevent_req_nterror(req, status)) {
14869                 return;
14870         }
14871
14872         /* Copy out parameters */
14873
14874         /* Copy result */
14875         state->orig.out.result = state->tmp.out.result;
14876
14877         /* Reset temporary structure */
14878         ZERO_STRUCT(state->tmp);
14879
14880         tevent_req_done(req);
14881 }
14882
14883 NTSTATUS dcerpc_spoolss_DeletePerMachineConnection_recv(struct tevent_req *req,
14884                                                         TALLOC_CTX *mem_ctx,
14885                                                         WERROR *result)
14886 {
14887         struct dcerpc_spoolss_DeletePerMachineConnection_state *state = tevent_req_data(
14888                 req, struct dcerpc_spoolss_DeletePerMachineConnection_state);
14889         NTSTATUS status;
14890
14891         if (tevent_req_is_nterror(req, &status)) {
14892                 tevent_req_received(req);
14893                 return status;
14894         }
14895
14896         /* Steal possible out parameters to the callers context */
14897         talloc_steal(mem_ctx, state->out_mem_ctx);
14898
14899         /* Return result */
14900         *result = state->orig.out.result;
14901
14902         tevent_req_received(req);
14903         return NT_STATUS_OK;
14904 }
14905
14906 NTSTATUS dcerpc_spoolss_DeletePerMachineConnection(struct dcerpc_binding_handle *h,
14907                                                    TALLOC_CTX *mem_ctx,
14908                                                    const char *_server /* [in] [unique,charset(UTF16)] */,
14909                                                    const char *_printername /* [in] [ref,charset(UTF16)] */,
14910                                                    WERROR *result)
14911 {
14912         struct spoolss_DeletePerMachineConnection r;
14913         NTSTATUS status;
14914
14915         /* In parameters */
14916         r.in.server = _server;
14917         r.in.printername = _printername;
14918
14919         status = dcerpc_spoolss_DeletePerMachineConnection_r(h, mem_ctx, &r);
14920         if (!NT_STATUS_IS_OK(status)) {
14921                 return status;
14922         }
14923
14924         /* Return variables */
14925
14926         /* Return result */
14927         *result = r.out.result;
14928
14929         return NT_STATUS_OK;
14930 }
14931
14932 struct dcerpc_spoolss_XcvData_r_state {
14933         TALLOC_CTX *out_mem_ctx;
14934 };
14935
14936 static void dcerpc_spoolss_XcvData_r_done(struct tevent_req *subreq);
14937
14938 struct tevent_req *dcerpc_spoolss_XcvData_r_send(TALLOC_CTX *mem_ctx,
14939         struct tevent_context *ev,
14940         struct dcerpc_binding_handle *h,
14941         struct spoolss_XcvData *r)
14942 {
14943         struct tevent_req *req;
14944         struct dcerpc_spoolss_XcvData_r_state *state;
14945         struct tevent_req *subreq;
14946
14947         req = tevent_req_create(mem_ctx, &state,
14948                                 struct dcerpc_spoolss_XcvData_r_state);
14949         if (req == NULL) {
14950                 return NULL;
14951         }
14952
14953         state->out_mem_ctx = talloc_new(state);
14954         if (tevent_req_nomem(state->out_mem_ctx, req)) {
14955                 return tevent_req_post(req, ev);
14956         }
14957
14958         subreq = dcerpc_binding_handle_call_send(state, ev, h,
14959                         NULL, &ndr_table_spoolss,
14960                         NDR_SPOOLSS_XCVDATA, state->out_mem_ctx, r);
14961         if (tevent_req_nomem(subreq, req)) {
14962                 return tevent_req_post(req, ev);
14963         }
14964         tevent_req_set_callback(subreq, dcerpc_spoolss_XcvData_r_done, req);
14965
14966         return req;
14967 }
14968
14969 static void dcerpc_spoolss_XcvData_r_done(struct tevent_req *subreq)
14970 {
14971         struct tevent_req *req =
14972                 tevent_req_callback_data(subreq,
14973                 struct tevent_req);
14974         NTSTATUS status;
14975
14976         status = dcerpc_binding_handle_call_recv(subreq);
14977         TALLOC_FREE(subreq);
14978         if (tevent_req_nterror(req, status)) {
14979                 return;
14980         }
14981
14982         tevent_req_done(req);
14983 }
14984
14985 NTSTATUS dcerpc_spoolss_XcvData_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
14986 {
14987         struct dcerpc_spoolss_XcvData_r_state *state =
14988                 tevent_req_data(req,
14989                 struct dcerpc_spoolss_XcvData_r_state);
14990         NTSTATUS status;
14991
14992         if (tevent_req_is_nterror(req, &status)) {
14993                 tevent_req_received(req);
14994                 return status;
14995         }
14996
14997         talloc_steal(mem_ctx, state->out_mem_ctx);
14998
14999         tevent_req_received(req);
15000         return NT_STATUS_OK;
15001 }
15002
15003 NTSTATUS dcerpc_spoolss_XcvData_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_XcvData *r)
15004 {
15005         NTSTATUS status;
15006
15007         status = dcerpc_binding_handle_call(h,
15008                         NULL, &ndr_table_spoolss,
15009                         NDR_SPOOLSS_XCVDATA, mem_ctx, r);
15010
15011         return status;
15012 }
15013
15014 struct dcerpc_spoolss_XcvData_state {
15015         struct spoolss_XcvData orig;
15016         struct spoolss_XcvData tmp;
15017         TALLOC_CTX *out_mem_ctx;
15018 };
15019
15020 static void dcerpc_spoolss_XcvData_done(struct tevent_req *subreq);
15021
15022 struct tevent_req *dcerpc_spoolss_XcvData_send(TALLOC_CTX *mem_ctx,
15023                                                struct tevent_context *ev,
15024                                                struct dcerpc_binding_handle *h,
15025                                                struct policy_handle *_handle /* [in] [ref] */,
15026                                                const char *_function_name /* [in] [charset(UTF16)] */,
15027                                                DATA_BLOB _in_data /* [in]  */,
15028                                                uint32_t __in_data_length /* [in] [value(r->in.in_data.length)] */,
15029                                                uint8_t *_out_data /* [out] [ref,size_is(out_data_size)] */,
15030                                                uint32_t _out_data_size /* [in]  */,
15031                                                uint32_t *_needed /* [out] [ref] */,
15032                                                uint32_t *_status_code /* [in,out] [ref] */)
15033 {
15034         struct tevent_req *req;
15035         struct dcerpc_spoolss_XcvData_state *state;
15036         struct tevent_req *subreq;
15037
15038         req = tevent_req_create(mem_ctx, &state,
15039                                 struct dcerpc_spoolss_XcvData_state);
15040         if (req == NULL) {
15041                 return NULL;
15042         }
15043         state->out_mem_ctx = NULL;
15044
15045         /* In parameters */
15046         state->orig.in.handle = _handle;
15047         state->orig.in.function_name = _function_name;
15048         state->orig.in.in_data = _in_data;
15049         state->orig.in._in_data_length = __in_data_length;
15050         state->orig.in.out_data_size = _out_data_size;
15051         state->orig.in.status_code = _status_code;
15052
15053         /* Out parameters */
15054         state->orig.out.out_data = _out_data;
15055         state->orig.out.needed = _needed;
15056         state->orig.out.status_code = _status_code;
15057
15058         /* Result */
15059         ZERO_STRUCT(state->orig.out.result);
15060
15061         state->out_mem_ctx = talloc_named_const(state, 0,
15062                              "dcerpc_spoolss_XcvData_out_memory");
15063         if (tevent_req_nomem(state->out_mem_ctx, req)) {
15064                 return tevent_req_post(req, ev);
15065         }
15066
15067         /* make a temporary copy, that we pass to the dispatch function */
15068         state->tmp = state->orig;
15069
15070         subreq = dcerpc_spoolss_XcvData_r_send(state, ev, h, &state->tmp);
15071         if (tevent_req_nomem(subreq, req)) {
15072                 return tevent_req_post(req, ev);
15073         }
15074         tevent_req_set_callback(subreq, dcerpc_spoolss_XcvData_done, req);
15075         return req;
15076 }
15077
15078 static void dcerpc_spoolss_XcvData_done(struct tevent_req *subreq)
15079 {
15080         struct tevent_req *req = tevent_req_callback_data(
15081                 subreq, struct tevent_req);
15082         struct dcerpc_spoolss_XcvData_state *state = tevent_req_data(
15083                 req, struct dcerpc_spoolss_XcvData_state);
15084         NTSTATUS status;
15085         TALLOC_CTX *mem_ctx;
15086
15087         if (state->out_mem_ctx) {
15088                 mem_ctx = state->out_mem_ctx;
15089         } else {
15090                 mem_ctx = state;
15091         }
15092
15093         status = dcerpc_spoolss_XcvData_r_recv(subreq, mem_ctx);
15094         TALLOC_FREE(subreq);
15095         if (tevent_req_nterror(req, status)) {
15096                 return;
15097         }
15098
15099         /* Copy out parameters */
15100         {
15101                 size_t _copy_len_out_data;
15102                 _copy_len_out_data = state->tmp.in.out_data_size;
15103                 memcpy(state->orig.out.out_data, state->tmp.out.out_data, _copy_len_out_data * sizeof(*state->orig.out.out_data));
15104         }
15105         *state->orig.out.needed = *state->tmp.out.needed;
15106         *state->orig.out.status_code = *state->tmp.out.status_code;
15107
15108         /* Copy result */
15109         state->orig.out.result = state->tmp.out.result;
15110
15111         /* Reset temporary structure */
15112         ZERO_STRUCT(state->tmp);
15113
15114         tevent_req_done(req);
15115 }
15116
15117 NTSTATUS dcerpc_spoolss_XcvData_recv(struct tevent_req *req,
15118                                      TALLOC_CTX *mem_ctx,
15119                                      WERROR *result)
15120 {
15121         struct dcerpc_spoolss_XcvData_state *state = tevent_req_data(
15122                 req, struct dcerpc_spoolss_XcvData_state);
15123         NTSTATUS status;
15124
15125         if (tevent_req_is_nterror(req, &status)) {
15126                 tevent_req_received(req);
15127                 return status;
15128         }
15129
15130         /* Steal possible out parameters to the callers context */
15131         talloc_steal(mem_ctx, state->out_mem_ctx);
15132
15133         /* Return result */
15134         *result = state->orig.out.result;
15135
15136         tevent_req_received(req);
15137         return NT_STATUS_OK;
15138 }
15139
15140 NTSTATUS dcerpc_spoolss_XcvData(struct dcerpc_binding_handle *h,
15141                                 TALLOC_CTX *mem_ctx,
15142                                 struct policy_handle *_handle /* [in] [ref] */,
15143                                 const char *_function_name /* [in] [charset(UTF16)] */,
15144                                 DATA_BLOB _in_data /* [in]  */,
15145                                 uint32_t __in_data_length /* [in] [value(r->in.in_data.length)] */,
15146                                 uint8_t *_out_data /* [out] [ref,size_is(out_data_size)] */,
15147                                 uint32_t _out_data_size /* [in]  */,
15148                                 uint32_t *_needed /* [out] [ref] */,
15149                                 uint32_t *_status_code /* [in,out] [ref] */,
15150                                 WERROR *result)
15151 {
15152         struct spoolss_XcvData r;
15153         NTSTATUS status;
15154
15155         /* In parameters */
15156         r.in.handle = _handle;
15157         r.in.function_name = _function_name;
15158         r.in.in_data = _in_data;
15159         r.in._in_data_length = __in_data_length;
15160         r.in.out_data_size = _out_data_size;
15161         r.in.status_code = _status_code;
15162
15163         status = dcerpc_spoolss_XcvData_r(h, mem_ctx, &r);
15164         if (!NT_STATUS_IS_OK(status)) {
15165                 return status;
15166         }
15167
15168         /* Return variables */
15169         {
15170                 size_t _copy_len_out_data;
15171                 _copy_len_out_data = r.in.out_data_size;
15172                 memcpy(_out_data, r.out.out_data, _copy_len_out_data * sizeof(*_out_data));
15173         }
15174         *_needed = *r.out.needed;
15175         *_status_code = *r.out.status_code;
15176
15177         /* Return result */
15178         *result = r.out.result;
15179
15180         return NT_STATUS_OK;
15181 }
15182
15183 struct dcerpc_spoolss_AddPrinterDriverEx_r_state {
15184         TALLOC_CTX *out_mem_ctx;
15185 };
15186
15187 static void dcerpc_spoolss_AddPrinterDriverEx_r_done(struct tevent_req *subreq);
15188
15189 struct tevent_req *dcerpc_spoolss_AddPrinterDriverEx_r_send(TALLOC_CTX *mem_ctx,
15190         struct tevent_context *ev,
15191         struct dcerpc_binding_handle *h,
15192         struct spoolss_AddPrinterDriverEx *r)
15193 {
15194         struct tevent_req *req;
15195         struct dcerpc_spoolss_AddPrinterDriverEx_r_state *state;
15196         struct tevent_req *subreq;
15197
15198         req = tevent_req_create(mem_ctx, &state,
15199                                 struct dcerpc_spoolss_AddPrinterDriverEx_r_state);
15200         if (req == NULL) {
15201                 return NULL;
15202         }
15203
15204         state->out_mem_ctx = NULL;
15205
15206         subreq = dcerpc_binding_handle_call_send(state, ev, h,
15207                         NULL, &ndr_table_spoolss,
15208                         NDR_SPOOLSS_ADDPRINTERDRIVEREX, state, r);
15209         if (tevent_req_nomem(subreq, req)) {
15210                 return tevent_req_post(req, ev);
15211         }
15212         tevent_req_set_callback(subreq, dcerpc_spoolss_AddPrinterDriverEx_r_done, req);
15213
15214         return req;
15215 }
15216
15217 static void dcerpc_spoolss_AddPrinterDriverEx_r_done(struct tevent_req *subreq)
15218 {
15219         struct tevent_req *req =
15220                 tevent_req_callback_data(subreq,
15221                 struct tevent_req);
15222         NTSTATUS status;
15223
15224         status = dcerpc_binding_handle_call_recv(subreq);
15225         TALLOC_FREE(subreq);
15226         if (tevent_req_nterror(req, status)) {
15227                 return;
15228         }
15229
15230         tevent_req_done(req);
15231 }
15232
15233 NTSTATUS dcerpc_spoolss_AddPrinterDriverEx_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
15234 {
15235         struct dcerpc_spoolss_AddPrinterDriverEx_r_state *state =
15236                 tevent_req_data(req,
15237                 struct dcerpc_spoolss_AddPrinterDriverEx_r_state);
15238         NTSTATUS status;
15239
15240         if (tevent_req_is_nterror(req, &status)) {
15241                 tevent_req_received(req);
15242                 return status;
15243         }
15244
15245         talloc_steal(mem_ctx, state->out_mem_ctx);
15246
15247         tevent_req_received(req);
15248         return NT_STATUS_OK;
15249 }
15250
15251 NTSTATUS dcerpc_spoolss_AddPrinterDriverEx_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_AddPrinterDriverEx *r)
15252 {
15253         NTSTATUS status;
15254
15255         status = dcerpc_binding_handle_call(h,
15256                         NULL, &ndr_table_spoolss,
15257                         NDR_SPOOLSS_ADDPRINTERDRIVEREX, mem_ctx, r);
15258
15259         return status;
15260 }
15261
15262 struct dcerpc_spoolss_AddPrinterDriverEx_state {
15263         struct spoolss_AddPrinterDriverEx orig;
15264         struct spoolss_AddPrinterDriverEx tmp;
15265         TALLOC_CTX *out_mem_ctx;
15266 };
15267
15268 static void dcerpc_spoolss_AddPrinterDriverEx_done(struct tevent_req *subreq);
15269
15270 struct tevent_req *dcerpc_spoolss_AddPrinterDriverEx_send(TALLOC_CTX *mem_ctx,
15271                                                           struct tevent_context *ev,
15272                                                           struct dcerpc_binding_handle *h,
15273                                                           const char *_servername /* [in] [unique,charset(UTF16)] */,
15274                                                           struct spoolss_AddDriverInfoCtr *_info_ctr /* [in] [ref] */,
15275                                                           uint32_t _flags /* [in]  */)
15276 {
15277         struct tevent_req *req;
15278         struct dcerpc_spoolss_AddPrinterDriverEx_state *state;
15279         struct tevent_req *subreq;
15280
15281         req = tevent_req_create(mem_ctx, &state,
15282                                 struct dcerpc_spoolss_AddPrinterDriverEx_state);
15283         if (req == NULL) {
15284                 return NULL;
15285         }
15286         state->out_mem_ctx = NULL;
15287
15288         /* In parameters */
15289         state->orig.in.servername = _servername;
15290         state->orig.in.info_ctr = _info_ctr;
15291         state->orig.in.flags = _flags;
15292
15293         /* Out parameters */
15294
15295         /* Result */
15296         ZERO_STRUCT(state->orig.out.result);
15297
15298         /* make a temporary copy, that we pass to the dispatch function */
15299         state->tmp = state->orig;
15300
15301         subreq = dcerpc_spoolss_AddPrinterDriverEx_r_send(state, ev, h, &state->tmp);
15302         if (tevent_req_nomem(subreq, req)) {
15303                 return tevent_req_post(req, ev);
15304         }
15305         tevent_req_set_callback(subreq, dcerpc_spoolss_AddPrinterDriverEx_done, req);
15306         return req;
15307 }
15308
15309 static void dcerpc_spoolss_AddPrinterDriverEx_done(struct tevent_req *subreq)
15310 {
15311         struct tevent_req *req = tevent_req_callback_data(
15312                 subreq, struct tevent_req);
15313         struct dcerpc_spoolss_AddPrinterDriverEx_state *state = tevent_req_data(
15314                 req, struct dcerpc_spoolss_AddPrinterDriverEx_state);
15315         NTSTATUS status;
15316         TALLOC_CTX *mem_ctx;
15317
15318         if (state->out_mem_ctx) {
15319                 mem_ctx = state->out_mem_ctx;
15320         } else {
15321                 mem_ctx = state;
15322         }
15323
15324         status = dcerpc_spoolss_AddPrinterDriverEx_r_recv(subreq, mem_ctx);
15325         TALLOC_FREE(subreq);
15326         if (tevent_req_nterror(req, status)) {
15327                 return;
15328         }
15329
15330         /* Copy out parameters */
15331
15332         /* Copy result */
15333         state->orig.out.result = state->tmp.out.result;
15334
15335         /* Reset temporary structure */
15336         ZERO_STRUCT(state->tmp);
15337
15338         tevent_req_done(req);
15339 }
15340
15341 NTSTATUS dcerpc_spoolss_AddPrinterDriverEx_recv(struct tevent_req *req,
15342                                                 TALLOC_CTX *mem_ctx,
15343                                                 WERROR *result)
15344 {
15345         struct dcerpc_spoolss_AddPrinterDriverEx_state *state = tevent_req_data(
15346                 req, struct dcerpc_spoolss_AddPrinterDriverEx_state);
15347         NTSTATUS status;
15348
15349         if (tevent_req_is_nterror(req, &status)) {
15350                 tevent_req_received(req);
15351                 return status;
15352         }
15353
15354         /* Steal possible out parameters to the callers context */
15355         talloc_steal(mem_ctx, state->out_mem_ctx);
15356
15357         /* Return result */
15358         *result = state->orig.out.result;
15359
15360         tevent_req_received(req);
15361         return NT_STATUS_OK;
15362 }
15363
15364 NTSTATUS dcerpc_spoolss_AddPrinterDriverEx(struct dcerpc_binding_handle *h,
15365                                            TALLOC_CTX *mem_ctx,
15366                                            const char *_servername /* [in] [unique,charset(UTF16)] */,
15367                                            struct spoolss_AddDriverInfoCtr *_info_ctr /* [in] [ref] */,
15368                                            uint32_t _flags /* [in]  */,
15369                                            WERROR *result)
15370 {
15371         struct spoolss_AddPrinterDriverEx r;
15372         NTSTATUS status;
15373
15374         /* In parameters */
15375         r.in.servername = _servername;
15376         r.in.info_ctr = _info_ctr;
15377         r.in.flags = _flags;
15378
15379         status = dcerpc_spoolss_AddPrinterDriverEx_r(h, mem_ctx, &r);
15380         if (!NT_STATUS_IS_OK(status)) {
15381                 return status;
15382         }
15383
15384         /* Return variables */
15385
15386         /* Return result */
15387         *result = r.out.result;
15388
15389         return NT_STATUS_OK;
15390 }
15391
15392 struct dcerpc_spoolss_RpcSendRecvBidiData_r_state {
15393         TALLOC_CTX *out_mem_ctx;
15394 };
15395
15396 static void dcerpc_spoolss_RpcSendRecvBidiData_r_done(struct tevent_req *subreq);
15397
15398 struct tevent_req *dcerpc_spoolss_RpcSendRecvBidiData_r_send(TALLOC_CTX *mem_ctx,
15399         struct tevent_context *ev,
15400         struct dcerpc_binding_handle *h,
15401         struct spoolss_RpcSendRecvBidiData *r)
15402 {
15403         struct tevent_req *req;
15404         struct dcerpc_spoolss_RpcSendRecvBidiData_r_state *state;
15405         struct tevent_req *subreq;
15406
15407         req = tevent_req_create(mem_ctx, &state,
15408                                 struct dcerpc_spoolss_RpcSendRecvBidiData_r_state);
15409         if (req == NULL) {
15410                 return NULL;
15411         }
15412
15413         state->out_mem_ctx = talloc_new(state);
15414         if (tevent_req_nomem(state->out_mem_ctx, req)) {
15415                 return tevent_req_post(req, ev);
15416         }
15417
15418         subreq = dcerpc_binding_handle_call_send(state, ev, h,
15419                         NULL, &ndr_table_spoolss,
15420                         NDR_SPOOLSS_RPCSENDRECVBIDIDATA, state->out_mem_ctx, r);
15421         if (tevent_req_nomem(subreq, req)) {
15422                 return tevent_req_post(req, ev);
15423         }
15424         tevent_req_set_callback(subreq, dcerpc_spoolss_RpcSendRecvBidiData_r_done, req);
15425
15426         return req;
15427 }
15428
15429 static void dcerpc_spoolss_RpcSendRecvBidiData_r_done(struct tevent_req *subreq)
15430 {
15431         struct tevent_req *req =
15432                 tevent_req_callback_data(subreq,
15433                 struct tevent_req);
15434         NTSTATUS status;
15435
15436         status = dcerpc_binding_handle_call_recv(subreq);
15437         TALLOC_FREE(subreq);
15438         if (tevent_req_nterror(req, status)) {
15439                 return;
15440         }
15441
15442         tevent_req_done(req);
15443 }
15444
15445 NTSTATUS dcerpc_spoolss_RpcSendRecvBidiData_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
15446 {
15447         struct dcerpc_spoolss_RpcSendRecvBidiData_r_state *state =
15448                 tevent_req_data(req,
15449                 struct dcerpc_spoolss_RpcSendRecvBidiData_r_state);
15450         NTSTATUS status;
15451
15452         if (tevent_req_is_nterror(req, &status)) {
15453                 tevent_req_received(req);
15454                 return status;
15455         }
15456
15457         talloc_steal(mem_ctx, state->out_mem_ctx);
15458
15459         tevent_req_received(req);
15460         return NT_STATUS_OK;
15461 }
15462
15463 NTSTATUS dcerpc_spoolss_RpcSendRecvBidiData_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_RpcSendRecvBidiData *r)
15464 {
15465         NTSTATUS status;
15466
15467         status = dcerpc_binding_handle_call(h,
15468                         NULL, &ndr_table_spoolss,
15469                         NDR_SPOOLSS_RPCSENDRECVBIDIDATA, mem_ctx, r);
15470
15471         return status;
15472 }
15473
15474 struct dcerpc_spoolss_RpcSendRecvBidiData_state {
15475         struct spoolss_RpcSendRecvBidiData orig;
15476         struct spoolss_RpcSendRecvBidiData tmp;
15477         TALLOC_CTX *out_mem_ctx;
15478 };
15479
15480 static void dcerpc_spoolss_RpcSendRecvBidiData_done(struct tevent_req *subreq);
15481
15482 struct tevent_req *dcerpc_spoolss_RpcSendRecvBidiData_send(TALLOC_CTX *mem_ctx,
15483                                                            struct tevent_context *ev,
15484                                                            struct dcerpc_binding_handle *h,
15485                                                            struct policy_handle _hPrinter /* [in]  */,
15486                                                            const char *_pAction /* [in] [unique,charset(UTF16)] */,
15487                                                            struct RPC_BIDI_REQUEST_CONTAINER *_pReqData /* [in] [ref] */,
15488                                                            struct RPC_BIDI_RESPONSE_CONTAINER **_ppRespData /* [out] [ref] */)
15489 {
15490         struct tevent_req *req;
15491         struct dcerpc_spoolss_RpcSendRecvBidiData_state *state;
15492         struct tevent_req *subreq;
15493
15494         req = tevent_req_create(mem_ctx, &state,
15495                                 struct dcerpc_spoolss_RpcSendRecvBidiData_state);
15496         if (req == NULL) {
15497                 return NULL;
15498         }
15499         state->out_mem_ctx = NULL;
15500
15501         /* In parameters */
15502         state->orig.in.hPrinter = _hPrinter;
15503         state->orig.in.pAction = _pAction;
15504         state->orig.in.pReqData = _pReqData;
15505
15506         /* Out parameters */
15507         state->orig.out.ppRespData = _ppRespData;
15508
15509         /* Result */
15510         ZERO_STRUCT(state->orig.out.result);
15511
15512         state->out_mem_ctx = talloc_named_const(state, 0,
15513                              "dcerpc_spoolss_RpcSendRecvBidiData_out_memory");
15514         if (tevent_req_nomem(state->out_mem_ctx, req)) {
15515                 return tevent_req_post(req, ev);
15516         }
15517
15518         /* make a temporary copy, that we pass to the dispatch function */
15519         state->tmp = state->orig;
15520
15521         subreq = dcerpc_spoolss_RpcSendRecvBidiData_r_send(state, ev, h, &state->tmp);
15522         if (tevent_req_nomem(subreq, req)) {
15523                 return tevent_req_post(req, ev);
15524         }
15525         tevent_req_set_callback(subreq, dcerpc_spoolss_RpcSendRecvBidiData_done, req);
15526         return req;
15527 }
15528
15529 static void dcerpc_spoolss_RpcSendRecvBidiData_done(struct tevent_req *subreq)
15530 {
15531         struct tevent_req *req = tevent_req_callback_data(
15532                 subreq, struct tevent_req);
15533         struct dcerpc_spoolss_RpcSendRecvBidiData_state *state = tevent_req_data(
15534                 req, struct dcerpc_spoolss_RpcSendRecvBidiData_state);
15535         NTSTATUS status;
15536         TALLOC_CTX *mem_ctx;
15537
15538         if (state->out_mem_ctx) {
15539                 mem_ctx = state->out_mem_ctx;
15540         } else {
15541                 mem_ctx = state;
15542         }
15543
15544         status = dcerpc_spoolss_RpcSendRecvBidiData_r_recv(subreq, mem_ctx);
15545         TALLOC_FREE(subreq);
15546         if (tevent_req_nterror(req, status)) {
15547                 return;
15548         }
15549
15550         /* Copy out parameters */
15551         *state->orig.out.ppRespData = *state->tmp.out.ppRespData;
15552
15553         /* Copy result */
15554         state->orig.out.result = state->tmp.out.result;
15555
15556         /* Reset temporary structure */
15557         ZERO_STRUCT(state->tmp);
15558
15559         tevent_req_done(req);
15560 }
15561
15562 NTSTATUS dcerpc_spoolss_RpcSendRecvBidiData_recv(struct tevent_req *req,
15563                                                  TALLOC_CTX *mem_ctx,
15564                                                  WERROR *result)
15565 {
15566         struct dcerpc_spoolss_RpcSendRecvBidiData_state *state = tevent_req_data(
15567                 req, struct dcerpc_spoolss_RpcSendRecvBidiData_state);
15568         NTSTATUS status;
15569
15570         if (tevent_req_is_nterror(req, &status)) {
15571                 tevent_req_received(req);
15572                 return status;
15573         }
15574
15575         /* Steal possible out parameters to the callers context */
15576         talloc_steal(mem_ctx, state->out_mem_ctx);
15577
15578         /* Return result */
15579         *result = state->orig.out.result;
15580
15581         tevent_req_received(req);
15582         return NT_STATUS_OK;
15583 }
15584
15585 NTSTATUS dcerpc_spoolss_RpcSendRecvBidiData(struct dcerpc_binding_handle *h,
15586                                             TALLOC_CTX *mem_ctx,
15587                                             struct policy_handle _hPrinter /* [in]  */,
15588                                             const char *_pAction /* [in] [unique,charset(UTF16)] */,
15589                                             struct RPC_BIDI_REQUEST_CONTAINER *_pReqData /* [in] [ref] */,
15590                                             struct RPC_BIDI_RESPONSE_CONTAINER **_ppRespData /* [out] [ref] */,
15591                                             WERROR *result)
15592 {
15593         struct spoolss_RpcSendRecvBidiData r;
15594         NTSTATUS status;
15595
15596         /* In parameters */
15597         r.in.hPrinter = _hPrinter;
15598         r.in.pAction = _pAction;
15599         r.in.pReqData = _pReqData;
15600
15601         status = dcerpc_spoolss_RpcSendRecvBidiData_r(h, mem_ctx, &r);
15602         if (!NT_STATUS_IS_OK(status)) {
15603                 return status;
15604         }
15605
15606         /* Return variables */
15607         *_ppRespData = *r.out.ppRespData;
15608
15609         /* Return result */
15610         *result = r.out.result;
15611
15612         return NT_STATUS_OK;
15613 }
15614
15615 struct dcerpc_spoolss_GetCorePrinterDrivers_r_state {
15616         TALLOC_CTX *out_mem_ctx;
15617 };
15618
15619 static void dcerpc_spoolss_GetCorePrinterDrivers_r_done(struct tevent_req *subreq);
15620
15621 struct tevent_req *dcerpc_spoolss_GetCorePrinterDrivers_r_send(TALLOC_CTX *mem_ctx,
15622         struct tevent_context *ev,
15623         struct dcerpc_binding_handle *h,
15624         struct spoolss_GetCorePrinterDrivers *r)
15625 {
15626         struct tevent_req *req;
15627         struct dcerpc_spoolss_GetCorePrinterDrivers_r_state *state;
15628         struct tevent_req *subreq;
15629
15630         req = tevent_req_create(mem_ctx, &state,
15631                                 struct dcerpc_spoolss_GetCorePrinterDrivers_r_state);
15632         if (req == NULL) {
15633                 return NULL;
15634         }
15635
15636         state->out_mem_ctx = talloc_new(state);
15637         if (tevent_req_nomem(state->out_mem_ctx, req)) {
15638                 return tevent_req_post(req, ev);
15639         }
15640
15641         subreq = dcerpc_binding_handle_call_send(state, ev, h,
15642                         NULL, &ndr_table_spoolss,
15643                         NDR_SPOOLSS_GETCOREPRINTERDRIVERS, state->out_mem_ctx, r);
15644         if (tevent_req_nomem(subreq, req)) {
15645                 return tevent_req_post(req, ev);
15646         }
15647         tevent_req_set_callback(subreq, dcerpc_spoolss_GetCorePrinterDrivers_r_done, req);
15648
15649         return req;
15650 }
15651
15652 static void dcerpc_spoolss_GetCorePrinterDrivers_r_done(struct tevent_req *subreq)
15653 {
15654         struct tevent_req *req =
15655                 tevent_req_callback_data(subreq,
15656                 struct tevent_req);
15657         NTSTATUS status;
15658
15659         status = dcerpc_binding_handle_call_recv(subreq);
15660         TALLOC_FREE(subreq);
15661         if (tevent_req_nterror(req, status)) {
15662                 return;
15663         }
15664
15665         tevent_req_done(req);
15666 }
15667
15668 NTSTATUS dcerpc_spoolss_GetCorePrinterDrivers_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
15669 {
15670         struct dcerpc_spoolss_GetCorePrinterDrivers_r_state *state =
15671                 tevent_req_data(req,
15672                 struct dcerpc_spoolss_GetCorePrinterDrivers_r_state);
15673         NTSTATUS status;
15674
15675         if (tevent_req_is_nterror(req, &status)) {
15676                 tevent_req_received(req);
15677                 return status;
15678         }
15679
15680         talloc_steal(mem_ctx, state->out_mem_ctx);
15681
15682         tevent_req_received(req);
15683         return NT_STATUS_OK;
15684 }
15685
15686 NTSTATUS dcerpc_spoolss_GetCorePrinterDrivers_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_GetCorePrinterDrivers *r)
15687 {
15688         NTSTATUS status;
15689
15690         status = dcerpc_binding_handle_call(h,
15691                         NULL, &ndr_table_spoolss,
15692                         NDR_SPOOLSS_GETCOREPRINTERDRIVERS, mem_ctx, r);
15693
15694         return status;
15695 }
15696
15697 struct dcerpc_spoolss_GetCorePrinterDrivers_state {
15698         struct spoolss_GetCorePrinterDrivers orig;
15699         struct spoolss_GetCorePrinterDrivers tmp;
15700         TALLOC_CTX *out_mem_ctx;
15701 };
15702
15703 static void dcerpc_spoolss_GetCorePrinterDrivers_done(struct tevent_req *subreq);
15704
15705 struct tevent_req *dcerpc_spoolss_GetCorePrinterDrivers_send(TALLOC_CTX *mem_ctx,
15706                                                              struct tevent_context *ev,
15707                                                              struct dcerpc_binding_handle *h,
15708                                                              const char *_servername /* [in] [unique,charset(UTF16)] */,
15709                                                              const char *_architecture /* [in] [ref,charset(UTF16)] */,
15710                                                              uint32_t _core_driver_size /* [in]  */,
15711                                                              const char *_core_driver_dependencies /* [in] [ref,charset(UTF16),size_is(core_driver_size)] */,
15712                                                              uint32_t _core_printer_driver_count /* [in]  */,
15713                                                              struct spoolss_CorePrinterDriver *_core_printer_drivers /* [out] [ref,size_is(core_printer_driver_count)] */)
15714 {
15715         struct tevent_req *req;
15716         struct dcerpc_spoolss_GetCorePrinterDrivers_state *state;
15717         struct tevent_req *subreq;
15718
15719         req = tevent_req_create(mem_ctx, &state,
15720                                 struct dcerpc_spoolss_GetCorePrinterDrivers_state);
15721         if (req == NULL) {
15722                 return NULL;
15723         }
15724         state->out_mem_ctx = NULL;
15725
15726         /* In parameters */
15727         state->orig.in.servername = _servername;
15728         state->orig.in.architecture = _architecture;
15729         state->orig.in.core_driver_size = _core_driver_size;
15730         state->orig.in.core_driver_dependencies = _core_driver_dependencies;
15731         state->orig.in.core_printer_driver_count = _core_printer_driver_count;
15732
15733         /* Out parameters */
15734         state->orig.out.core_printer_drivers = _core_printer_drivers;
15735
15736         /* Result */
15737         ZERO_STRUCT(state->orig.out.result);
15738
15739         state->out_mem_ctx = talloc_named_const(state, 0,
15740                              "dcerpc_spoolss_GetCorePrinterDrivers_out_memory");
15741         if (tevent_req_nomem(state->out_mem_ctx, req)) {
15742                 return tevent_req_post(req, ev);
15743         }
15744
15745         /* make a temporary copy, that we pass to the dispatch function */
15746         state->tmp = state->orig;
15747
15748         subreq = dcerpc_spoolss_GetCorePrinterDrivers_r_send(state, ev, h, &state->tmp);
15749         if (tevent_req_nomem(subreq, req)) {
15750                 return tevent_req_post(req, ev);
15751         }
15752         tevent_req_set_callback(subreq, dcerpc_spoolss_GetCorePrinterDrivers_done, req);
15753         return req;
15754 }
15755
15756 static void dcerpc_spoolss_GetCorePrinterDrivers_done(struct tevent_req *subreq)
15757 {
15758         struct tevent_req *req = tevent_req_callback_data(
15759                 subreq, struct tevent_req);
15760         struct dcerpc_spoolss_GetCorePrinterDrivers_state *state = tevent_req_data(
15761                 req, struct dcerpc_spoolss_GetCorePrinterDrivers_state);
15762         NTSTATUS status;
15763         TALLOC_CTX *mem_ctx;
15764
15765         if (state->out_mem_ctx) {
15766                 mem_ctx = state->out_mem_ctx;
15767         } else {
15768                 mem_ctx = state;
15769         }
15770
15771         status = dcerpc_spoolss_GetCorePrinterDrivers_r_recv(subreq, mem_ctx);
15772         TALLOC_FREE(subreq);
15773         if (tevent_req_nterror(req, status)) {
15774                 return;
15775         }
15776
15777         /* Copy out parameters */
15778         {
15779                 size_t _copy_len_core_printer_drivers;
15780                 _copy_len_core_printer_drivers = state->tmp.in.core_printer_driver_count;
15781                 memcpy(state->orig.out.core_printer_drivers, state->tmp.out.core_printer_drivers, _copy_len_core_printer_drivers * sizeof(*state->orig.out.core_printer_drivers));
15782         }
15783
15784         /* Copy result */
15785         state->orig.out.result = state->tmp.out.result;
15786
15787         /* Reset temporary structure */
15788         ZERO_STRUCT(state->tmp);
15789
15790         tevent_req_done(req);
15791 }
15792
15793 NTSTATUS dcerpc_spoolss_GetCorePrinterDrivers_recv(struct tevent_req *req,
15794                                                    TALLOC_CTX *mem_ctx,
15795                                                    WERROR *result)
15796 {
15797         struct dcerpc_spoolss_GetCorePrinterDrivers_state *state = tevent_req_data(
15798                 req, struct dcerpc_spoolss_GetCorePrinterDrivers_state);
15799         NTSTATUS status;
15800
15801         if (tevent_req_is_nterror(req, &status)) {
15802                 tevent_req_received(req);
15803                 return status;
15804         }
15805
15806         /* Steal possible out parameters to the callers context */
15807         talloc_steal(mem_ctx, state->out_mem_ctx);
15808
15809         /* Return result */
15810         *result = state->orig.out.result;
15811
15812         tevent_req_received(req);
15813         return NT_STATUS_OK;
15814 }
15815
15816 NTSTATUS dcerpc_spoolss_GetCorePrinterDrivers(struct dcerpc_binding_handle *h,
15817                                               TALLOC_CTX *mem_ctx,
15818                                               const char *_servername /* [in] [unique,charset(UTF16)] */,
15819                                               const char *_architecture /* [in] [ref,charset(UTF16)] */,
15820                                               uint32_t _core_driver_size /* [in]  */,
15821                                               const char *_core_driver_dependencies /* [in] [ref,charset(UTF16),size_is(core_driver_size)] */,
15822                                               uint32_t _core_printer_driver_count /* [in]  */,
15823                                               struct spoolss_CorePrinterDriver *_core_printer_drivers /* [out] [ref,size_is(core_printer_driver_count)] */,
15824                                               WERROR *result)
15825 {
15826         struct spoolss_GetCorePrinterDrivers r;
15827         NTSTATUS status;
15828
15829         /* In parameters */
15830         r.in.servername = _servername;
15831         r.in.architecture = _architecture;
15832         r.in.core_driver_size = _core_driver_size;
15833         r.in.core_driver_dependencies = _core_driver_dependencies;
15834         r.in.core_printer_driver_count = _core_printer_driver_count;
15835
15836         status = dcerpc_spoolss_GetCorePrinterDrivers_r(h, mem_ctx, &r);
15837         if (!NT_STATUS_IS_OK(status)) {
15838                 return status;
15839         }
15840
15841         /* Return variables */
15842         {
15843                 size_t _copy_len_core_printer_drivers;
15844                 _copy_len_core_printer_drivers = r.in.core_printer_driver_count;
15845                 memcpy(_core_printer_drivers, r.out.core_printer_drivers, _copy_len_core_printer_drivers * sizeof(*_core_printer_drivers));
15846         }
15847
15848         /* Return result */
15849         *result = r.out.result;
15850
15851         return NT_STATUS_OK;
15852 }
15853
15854 struct dcerpc_spoolss_GetPrinterDriverPackagePath_r_state {
15855         TALLOC_CTX *out_mem_ctx;
15856 };
15857
15858 static void dcerpc_spoolss_GetPrinterDriverPackagePath_r_done(struct tevent_req *subreq);
15859
15860 struct tevent_req *dcerpc_spoolss_GetPrinterDriverPackagePath_r_send(TALLOC_CTX *mem_ctx,
15861         struct tevent_context *ev,
15862         struct dcerpc_binding_handle *h,
15863         struct spoolss_GetPrinterDriverPackagePath *r)
15864 {
15865         struct tevent_req *req;
15866         struct dcerpc_spoolss_GetPrinterDriverPackagePath_r_state *state;
15867         struct tevent_req *subreq;
15868
15869         req = tevent_req_create(mem_ctx, &state,
15870                                 struct dcerpc_spoolss_GetPrinterDriverPackagePath_r_state);
15871         if (req == NULL) {
15872                 return NULL;
15873         }
15874
15875         state->out_mem_ctx = talloc_new(state);
15876         if (tevent_req_nomem(state->out_mem_ctx, req)) {
15877                 return tevent_req_post(req, ev);
15878         }
15879
15880         subreq = dcerpc_binding_handle_call_send(state, ev, h,
15881                         NULL, &ndr_table_spoolss,
15882                         NDR_SPOOLSS_GETPRINTERDRIVERPACKAGEPATH, state->out_mem_ctx, r);
15883         if (tevent_req_nomem(subreq, req)) {
15884                 return tevent_req_post(req, ev);
15885         }
15886         tevent_req_set_callback(subreq, dcerpc_spoolss_GetPrinterDriverPackagePath_r_done, req);
15887
15888         return req;
15889 }
15890
15891 static void dcerpc_spoolss_GetPrinterDriverPackagePath_r_done(struct tevent_req *subreq)
15892 {
15893         struct tevent_req *req =
15894                 tevent_req_callback_data(subreq,
15895                 struct tevent_req);
15896         NTSTATUS status;
15897
15898         status = dcerpc_binding_handle_call_recv(subreq);
15899         TALLOC_FREE(subreq);
15900         if (tevent_req_nterror(req, status)) {
15901                 return;
15902         }
15903
15904         tevent_req_done(req);
15905 }
15906
15907 NTSTATUS dcerpc_spoolss_GetPrinterDriverPackagePath_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
15908 {
15909         struct dcerpc_spoolss_GetPrinterDriverPackagePath_r_state *state =
15910                 tevent_req_data(req,
15911                 struct dcerpc_spoolss_GetPrinterDriverPackagePath_r_state);
15912         NTSTATUS status;
15913
15914         if (tevent_req_is_nterror(req, &status)) {
15915                 tevent_req_received(req);
15916                 return status;
15917         }
15918
15919         talloc_steal(mem_ctx, state->out_mem_ctx);
15920
15921         tevent_req_received(req);
15922         return NT_STATUS_OK;
15923 }
15924
15925 NTSTATUS dcerpc_spoolss_GetPrinterDriverPackagePath_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_GetPrinterDriverPackagePath *r)
15926 {
15927         NTSTATUS status;
15928
15929         status = dcerpc_binding_handle_call(h,
15930                         NULL, &ndr_table_spoolss,
15931                         NDR_SPOOLSS_GETPRINTERDRIVERPACKAGEPATH, mem_ctx, r);
15932
15933         return status;
15934 }
15935
15936 struct dcerpc_spoolss_GetPrinterDriverPackagePath_state {
15937         struct spoolss_GetPrinterDriverPackagePath orig;
15938         struct spoolss_GetPrinterDriverPackagePath tmp;
15939         TALLOC_CTX *out_mem_ctx;
15940 };
15941
15942 static void dcerpc_spoolss_GetPrinterDriverPackagePath_done(struct tevent_req *subreq);
15943
15944 struct tevent_req *dcerpc_spoolss_GetPrinterDriverPackagePath_send(TALLOC_CTX *mem_ctx,
15945                                                                    struct tevent_context *ev,
15946                                                                    struct dcerpc_binding_handle *h,
15947                                                                    const char *_servername /* [in] [unique,charset(UTF16)] */,
15948                                                                    const char *_architecture /* [in] [ref,charset(UTF16)] */,
15949                                                                    const char *_language /* [in] [unique,charset(UTF16)] */,
15950                                                                    const char *_package_id /* [in] [ref,charset(UTF16)] */,
15951                                                                    const char *_driver_package_cab /* [in,out] [unique,charset(UTF16),size_is(driver_package_cab_size)] */,
15952                                                                    uint32_t _driver_package_cab_size /* [in]  */,
15953                                                                    uint32_t *_required /* [out] [ref] */)
15954 {
15955         struct tevent_req *req;
15956         struct dcerpc_spoolss_GetPrinterDriverPackagePath_state *state;
15957         struct tevent_req *subreq;
15958
15959         req = tevent_req_create(mem_ctx, &state,
15960                                 struct dcerpc_spoolss_GetPrinterDriverPackagePath_state);
15961         if (req == NULL) {
15962                 return NULL;
15963         }
15964         state->out_mem_ctx = NULL;
15965
15966         /* In parameters */
15967         state->orig.in.servername = _servername;
15968         state->orig.in.architecture = _architecture;
15969         state->orig.in.language = _language;
15970         state->orig.in.package_id = _package_id;
15971         state->orig.in.driver_package_cab = _driver_package_cab;
15972         state->orig.in.driver_package_cab_size = _driver_package_cab_size;
15973
15974         /* Out parameters */
15975         state->orig.out.driver_package_cab = _driver_package_cab;
15976         state->orig.out.required = _required;
15977
15978         /* Result */
15979         ZERO_STRUCT(state->orig.out.result);
15980
15981         state->out_mem_ctx = talloc_named_const(state, 0,
15982                              "dcerpc_spoolss_GetPrinterDriverPackagePath_out_memory");
15983         if (tevent_req_nomem(state->out_mem_ctx, req)) {
15984                 return tevent_req_post(req, ev);
15985         }
15986
15987         /* make a temporary copy, that we pass to the dispatch function */
15988         state->tmp = state->orig;
15989
15990         subreq = dcerpc_spoolss_GetPrinterDriverPackagePath_r_send(state, ev, h, &state->tmp);
15991         if (tevent_req_nomem(subreq, req)) {
15992                 return tevent_req_post(req, ev);
15993         }
15994         tevent_req_set_callback(subreq, dcerpc_spoolss_GetPrinterDriverPackagePath_done, req);
15995         return req;
15996 }
15997
15998 static void dcerpc_spoolss_GetPrinterDriverPackagePath_done(struct tevent_req *subreq)
15999 {
16000         struct tevent_req *req = tevent_req_callback_data(
16001                 subreq, struct tevent_req);
16002         struct dcerpc_spoolss_GetPrinterDriverPackagePath_state *state = tevent_req_data(
16003                 req, struct dcerpc_spoolss_GetPrinterDriverPackagePath_state);
16004         NTSTATUS status;
16005         TALLOC_CTX *mem_ctx;
16006
16007         if (state->out_mem_ctx) {
16008                 mem_ctx = state->out_mem_ctx;
16009         } else {
16010                 mem_ctx = state;
16011         }
16012
16013         status = dcerpc_spoolss_GetPrinterDriverPackagePath_r_recv(subreq, mem_ctx);
16014         TALLOC_FREE(subreq);
16015         if (tevent_req_nterror(req, status)) {
16016                 return;
16017         }
16018
16019         /* Copy out parameters */
16020         if (state->orig.out.driver_package_cab && state->tmp.out.driver_package_cab) {
16021                 {
16022                         size_t _copy_len_driver_package_cab;
16023                         _copy_len_driver_package_cab = ndr_charset_length(state->tmp.out.driver_package_cab, CH_UNIX);
16024                         if (_copy_len_driver_package_cab > ndr_charset_length(state->tmp.in.driver_package_cab, CH_UNIX)) {
16025                                 tevent_req_nterror(req, NT_STATUS_INVALID_NETWORK_RESPONSE);
16026                                 return;
16027                         }
16028                         memcpy(discard_const_p(uint8_t *, state->orig.out.driver_package_cab), state->tmp.out.driver_package_cab, _copy_len_driver_package_cab * sizeof(*state->orig.out.driver_package_cab));
16029                 }
16030         }
16031         *state->orig.out.required = *state->tmp.out.required;
16032
16033         /* Copy result */
16034         state->orig.out.result = state->tmp.out.result;
16035
16036         /* Reset temporary structure */
16037         ZERO_STRUCT(state->tmp);
16038
16039         tevent_req_done(req);
16040 }
16041
16042 NTSTATUS dcerpc_spoolss_GetPrinterDriverPackagePath_recv(struct tevent_req *req,
16043                                                          TALLOC_CTX *mem_ctx,
16044                                                          WERROR *result)
16045 {
16046         struct dcerpc_spoolss_GetPrinterDriverPackagePath_state *state = tevent_req_data(
16047                 req, struct dcerpc_spoolss_GetPrinterDriverPackagePath_state);
16048         NTSTATUS status;
16049
16050         if (tevent_req_is_nterror(req, &status)) {
16051                 tevent_req_received(req);
16052                 return status;
16053         }
16054
16055         /* Steal possible out parameters to the callers context */
16056         talloc_steal(mem_ctx, state->out_mem_ctx);
16057
16058         /* Return result */
16059         *result = state->orig.out.result;
16060
16061         tevent_req_received(req);
16062         return NT_STATUS_OK;
16063 }
16064
16065 NTSTATUS dcerpc_spoolss_GetPrinterDriverPackagePath(struct dcerpc_binding_handle *h,
16066                                                     TALLOC_CTX *mem_ctx,
16067                                                     const char *_servername /* [in] [unique,charset(UTF16)] */,
16068                                                     const char *_architecture /* [in] [ref,charset(UTF16)] */,
16069                                                     const char *_language /* [in] [unique,charset(UTF16)] */,
16070                                                     const char *_package_id /* [in] [ref,charset(UTF16)] */,
16071                                                     const char *_driver_package_cab /* [in,out] [unique,charset(UTF16),size_is(driver_package_cab_size)] */,
16072                                                     uint32_t _driver_package_cab_size /* [in]  */,
16073                                                     uint32_t *_required /* [out] [ref] */,
16074                                                     WERROR *result)
16075 {
16076         struct spoolss_GetPrinterDriverPackagePath r;
16077         NTSTATUS status;
16078
16079         /* In parameters */
16080         r.in.servername = _servername;
16081         r.in.architecture = _architecture;
16082         r.in.language = _language;
16083         r.in.package_id = _package_id;
16084         r.in.driver_package_cab = _driver_package_cab;
16085         r.in.driver_package_cab_size = _driver_package_cab_size;
16086
16087         status = dcerpc_spoolss_GetPrinterDriverPackagePath_r(h, mem_ctx, &r);
16088         if (!NT_STATUS_IS_OK(status)) {
16089                 return status;
16090         }
16091
16092         /* Return variables */
16093         if (_driver_package_cab && r.out.driver_package_cab) {
16094                 {
16095                         size_t _copy_len_driver_package_cab;
16096                         _copy_len_driver_package_cab = ndr_charset_length(r.out.driver_package_cab, CH_UNIX);
16097                         if (_copy_len_driver_package_cab > ndr_charset_length(r.in.driver_package_cab, CH_UNIX)) {
16098                                 return NT_STATUS_INVALID_NETWORK_RESPONSE;
16099                         }
16100                         memcpy(discard_const_p(uint8_t *, _driver_package_cab), r.out.driver_package_cab, _copy_len_driver_package_cab * sizeof(*_driver_package_cab));
16101                 }
16102         }
16103         *_required = *r.out.required;
16104
16105         /* Return result */
16106         *result = r.out.result;
16107
16108         return NT_STATUS_OK;
16109 }
16110
16111 struct dcerpc_spoolss_RpcGetJobNamedPropertyValue_r_state {
16112         TALLOC_CTX *out_mem_ctx;
16113 };
16114
16115 static void dcerpc_spoolss_RpcGetJobNamedPropertyValue_r_done(struct tevent_req *subreq);
16116
16117 struct tevent_req *dcerpc_spoolss_RpcGetJobNamedPropertyValue_r_send(TALLOC_CTX *mem_ctx,
16118         struct tevent_context *ev,
16119         struct dcerpc_binding_handle *h,
16120         struct spoolss_RpcGetJobNamedPropertyValue *r)
16121 {
16122         struct tevent_req *req;
16123         struct dcerpc_spoolss_RpcGetJobNamedPropertyValue_r_state *state;
16124         struct tevent_req *subreq;
16125
16126         req = tevent_req_create(mem_ctx, &state,
16127                                 struct dcerpc_spoolss_RpcGetJobNamedPropertyValue_r_state);
16128         if (req == NULL) {
16129                 return NULL;
16130         }
16131
16132         state->out_mem_ctx = talloc_new(state);
16133         if (tevent_req_nomem(state->out_mem_ctx, req)) {
16134                 return tevent_req_post(req, ev);
16135         }
16136
16137         subreq = dcerpc_binding_handle_call_send(state, ev, h,
16138                         NULL, &ndr_table_spoolss,
16139                         NDR_SPOOLSS_RPCGETJOBNAMEDPROPERTYVALUE, state->out_mem_ctx, r);
16140         if (tevent_req_nomem(subreq, req)) {
16141                 return tevent_req_post(req, ev);
16142         }
16143         tevent_req_set_callback(subreq, dcerpc_spoolss_RpcGetJobNamedPropertyValue_r_done, req);
16144
16145         return req;
16146 }
16147
16148 static void dcerpc_spoolss_RpcGetJobNamedPropertyValue_r_done(struct tevent_req *subreq)
16149 {
16150         struct tevent_req *req =
16151                 tevent_req_callback_data(subreq,
16152                 struct tevent_req);
16153         NTSTATUS status;
16154
16155         status = dcerpc_binding_handle_call_recv(subreq);
16156         TALLOC_FREE(subreq);
16157         if (tevent_req_nterror(req, status)) {
16158                 return;
16159         }
16160
16161         tevent_req_done(req);
16162 }
16163
16164 NTSTATUS dcerpc_spoolss_RpcGetJobNamedPropertyValue_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
16165 {
16166         struct dcerpc_spoolss_RpcGetJobNamedPropertyValue_r_state *state =
16167                 tevent_req_data(req,
16168                 struct dcerpc_spoolss_RpcGetJobNamedPropertyValue_r_state);
16169         NTSTATUS status;
16170
16171         if (tevent_req_is_nterror(req, &status)) {
16172                 tevent_req_received(req);
16173                 return status;
16174         }
16175
16176         talloc_steal(mem_ctx, state->out_mem_ctx);
16177
16178         tevent_req_received(req);
16179         return NT_STATUS_OK;
16180 }
16181
16182 NTSTATUS dcerpc_spoolss_RpcGetJobNamedPropertyValue_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_RpcGetJobNamedPropertyValue *r)
16183 {
16184         NTSTATUS status;
16185
16186         status = dcerpc_binding_handle_call(h,
16187                         NULL, &ndr_table_spoolss,
16188                         NDR_SPOOLSS_RPCGETJOBNAMEDPROPERTYVALUE, mem_ctx, r);
16189
16190         return status;
16191 }
16192
16193 struct dcerpc_spoolss_RpcGetJobNamedPropertyValue_state {
16194         struct spoolss_RpcGetJobNamedPropertyValue orig;
16195         struct spoolss_RpcGetJobNamedPropertyValue tmp;
16196         TALLOC_CTX *out_mem_ctx;
16197 };
16198
16199 static void dcerpc_spoolss_RpcGetJobNamedPropertyValue_done(struct tevent_req *subreq);
16200
16201 struct tevent_req *dcerpc_spoolss_RpcGetJobNamedPropertyValue_send(TALLOC_CTX *mem_ctx,
16202                                                                    struct tevent_context *ev,
16203                                                                    struct dcerpc_binding_handle *h,
16204                                                                    struct policy_handle *_hPrinter /* [in] [ref] */,
16205                                                                    uint32_t _JobId /* [in]  */,
16206                                                                    const char *_pszName /* [in] [ref,charset(UTF16)] */,
16207                                                                    struct RPC_PrintPropertyValue *_pValue /* [out] [ref] */)
16208 {
16209         struct tevent_req *req;
16210         struct dcerpc_spoolss_RpcGetJobNamedPropertyValue_state *state;
16211         struct tevent_req *subreq;
16212
16213         req = tevent_req_create(mem_ctx, &state,
16214                                 struct dcerpc_spoolss_RpcGetJobNamedPropertyValue_state);
16215         if (req == NULL) {
16216                 return NULL;
16217         }
16218         state->out_mem_ctx = NULL;
16219
16220         /* In parameters */
16221         state->orig.in.hPrinter = _hPrinter;
16222         state->orig.in.JobId = _JobId;
16223         state->orig.in.pszName = _pszName;
16224
16225         /* Out parameters */
16226         state->orig.out.pValue = _pValue;
16227
16228         /* Result */
16229         ZERO_STRUCT(state->orig.out.result);
16230
16231         state->out_mem_ctx = talloc_named_const(state, 0,
16232                              "dcerpc_spoolss_RpcGetJobNamedPropertyValue_out_memory");
16233         if (tevent_req_nomem(state->out_mem_ctx, req)) {
16234                 return tevent_req_post(req, ev);
16235         }
16236
16237         /* make a temporary copy, that we pass to the dispatch function */
16238         state->tmp = state->orig;
16239
16240         subreq = dcerpc_spoolss_RpcGetJobNamedPropertyValue_r_send(state, ev, h, &state->tmp);
16241         if (tevent_req_nomem(subreq, req)) {
16242                 return tevent_req_post(req, ev);
16243         }
16244         tevent_req_set_callback(subreq, dcerpc_spoolss_RpcGetJobNamedPropertyValue_done, req);
16245         return req;
16246 }
16247
16248 static void dcerpc_spoolss_RpcGetJobNamedPropertyValue_done(struct tevent_req *subreq)
16249 {
16250         struct tevent_req *req = tevent_req_callback_data(
16251                 subreq, struct tevent_req);
16252         struct dcerpc_spoolss_RpcGetJobNamedPropertyValue_state *state = tevent_req_data(
16253                 req, struct dcerpc_spoolss_RpcGetJobNamedPropertyValue_state);
16254         NTSTATUS status;
16255         TALLOC_CTX *mem_ctx;
16256
16257         if (state->out_mem_ctx) {
16258                 mem_ctx = state->out_mem_ctx;
16259         } else {
16260                 mem_ctx = state;
16261         }
16262
16263         status = dcerpc_spoolss_RpcGetJobNamedPropertyValue_r_recv(subreq, mem_ctx);
16264         TALLOC_FREE(subreq);
16265         if (tevent_req_nterror(req, status)) {
16266                 return;
16267         }
16268
16269         /* Copy out parameters */
16270         *state->orig.out.pValue = *state->tmp.out.pValue;
16271
16272         /* Copy result */
16273         state->orig.out.result = state->tmp.out.result;
16274
16275         /* Reset temporary structure */
16276         ZERO_STRUCT(state->tmp);
16277
16278         tevent_req_done(req);
16279 }
16280
16281 NTSTATUS dcerpc_spoolss_RpcGetJobNamedPropertyValue_recv(struct tevent_req *req,
16282                                                          TALLOC_CTX *mem_ctx,
16283                                                          WERROR *result)
16284 {
16285         struct dcerpc_spoolss_RpcGetJobNamedPropertyValue_state *state = tevent_req_data(
16286                 req, struct dcerpc_spoolss_RpcGetJobNamedPropertyValue_state);
16287         NTSTATUS status;
16288
16289         if (tevent_req_is_nterror(req, &status)) {
16290                 tevent_req_received(req);
16291                 return status;
16292         }
16293
16294         /* Steal possible out parameters to the callers context */
16295         talloc_steal(mem_ctx, state->out_mem_ctx);
16296
16297         /* Return result */
16298         *result = state->orig.out.result;
16299
16300         tevent_req_received(req);
16301         return NT_STATUS_OK;
16302 }
16303
16304 NTSTATUS dcerpc_spoolss_RpcGetJobNamedPropertyValue(struct dcerpc_binding_handle *h,
16305                                                     TALLOC_CTX *mem_ctx,
16306                                                     struct policy_handle *_hPrinter /* [in] [ref] */,
16307                                                     uint32_t _JobId /* [in]  */,
16308                                                     const char *_pszName /* [in] [ref,charset(UTF16)] */,
16309                                                     struct RPC_PrintPropertyValue *_pValue /* [out] [ref] */,
16310                                                     WERROR *result)
16311 {
16312         struct spoolss_RpcGetJobNamedPropertyValue r;
16313         NTSTATUS status;
16314
16315         /* In parameters */
16316         r.in.hPrinter = _hPrinter;
16317         r.in.JobId = _JobId;
16318         r.in.pszName = _pszName;
16319
16320         status = dcerpc_spoolss_RpcGetJobNamedPropertyValue_r(h, mem_ctx, &r);
16321         if (!NT_STATUS_IS_OK(status)) {
16322                 return status;
16323         }
16324
16325         /* Return variables */
16326         *_pValue = *r.out.pValue;
16327
16328         /* Return result */
16329         *result = r.out.result;
16330
16331         return NT_STATUS_OK;
16332 }
16333
16334 struct dcerpc_spoolss_RpcSetJobNamedProperty_r_state {
16335         TALLOC_CTX *out_mem_ctx;
16336 };
16337
16338 static void dcerpc_spoolss_RpcSetJobNamedProperty_r_done(struct tevent_req *subreq);
16339
16340 struct tevent_req *dcerpc_spoolss_RpcSetJobNamedProperty_r_send(TALLOC_CTX *mem_ctx,
16341         struct tevent_context *ev,
16342         struct dcerpc_binding_handle *h,
16343         struct spoolss_RpcSetJobNamedProperty *r)
16344 {
16345         struct tevent_req *req;
16346         struct dcerpc_spoolss_RpcSetJobNamedProperty_r_state *state;
16347         struct tevent_req *subreq;
16348
16349         req = tevent_req_create(mem_ctx, &state,
16350                                 struct dcerpc_spoolss_RpcSetJobNamedProperty_r_state);
16351         if (req == NULL) {
16352                 return NULL;
16353         }
16354
16355         state->out_mem_ctx = NULL;
16356
16357         subreq = dcerpc_binding_handle_call_send(state, ev, h,
16358                         NULL, &ndr_table_spoolss,
16359                         NDR_SPOOLSS_RPCSETJOBNAMEDPROPERTY, state, r);
16360         if (tevent_req_nomem(subreq, req)) {
16361                 return tevent_req_post(req, ev);
16362         }
16363         tevent_req_set_callback(subreq, dcerpc_spoolss_RpcSetJobNamedProperty_r_done, req);
16364
16365         return req;
16366 }
16367
16368 static void dcerpc_spoolss_RpcSetJobNamedProperty_r_done(struct tevent_req *subreq)
16369 {
16370         struct tevent_req *req =
16371                 tevent_req_callback_data(subreq,
16372                 struct tevent_req);
16373         NTSTATUS status;
16374
16375         status = dcerpc_binding_handle_call_recv(subreq);
16376         TALLOC_FREE(subreq);
16377         if (tevent_req_nterror(req, status)) {
16378                 return;
16379         }
16380
16381         tevent_req_done(req);
16382 }
16383
16384 NTSTATUS dcerpc_spoolss_RpcSetJobNamedProperty_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
16385 {
16386         struct dcerpc_spoolss_RpcSetJobNamedProperty_r_state *state =
16387                 tevent_req_data(req,
16388                 struct dcerpc_spoolss_RpcSetJobNamedProperty_r_state);
16389         NTSTATUS status;
16390
16391         if (tevent_req_is_nterror(req, &status)) {
16392                 tevent_req_received(req);
16393                 return status;
16394         }
16395
16396         talloc_steal(mem_ctx, state->out_mem_ctx);
16397
16398         tevent_req_received(req);
16399         return NT_STATUS_OK;
16400 }
16401
16402 NTSTATUS dcerpc_spoolss_RpcSetJobNamedProperty_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_RpcSetJobNamedProperty *r)
16403 {
16404         NTSTATUS status;
16405
16406         status = dcerpc_binding_handle_call(h,
16407                         NULL, &ndr_table_spoolss,
16408                         NDR_SPOOLSS_RPCSETJOBNAMEDPROPERTY, mem_ctx, r);
16409
16410         return status;
16411 }
16412
16413 struct dcerpc_spoolss_RpcSetJobNamedProperty_state {
16414         struct spoolss_RpcSetJobNamedProperty orig;
16415         struct spoolss_RpcSetJobNamedProperty tmp;
16416         TALLOC_CTX *out_mem_ctx;
16417 };
16418
16419 static void dcerpc_spoolss_RpcSetJobNamedProperty_done(struct tevent_req *subreq);
16420
16421 struct tevent_req *dcerpc_spoolss_RpcSetJobNamedProperty_send(TALLOC_CTX *mem_ctx,
16422                                                               struct tevent_context *ev,
16423                                                               struct dcerpc_binding_handle *h,
16424                                                               struct policy_handle *_hPrinter /* [in] [ref] */,
16425                                                               uint32_t _JobId /* [in]  */,
16426                                                               struct RPC_PrintNamedProperty *_pProperty /* [in] [ref] */)
16427 {
16428         struct tevent_req *req;
16429         struct dcerpc_spoolss_RpcSetJobNamedProperty_state *state;
16430         struct tevent_req *subreq;
16431
16432         req = tevent_req_create(mem_ctx, &state,
16433                                 struct dcerpc_spoolss_RpcSetJobNamedProperty_state);
16434         if (req == NULL) {
16435                 return NULL;
16436         }
16437         state->out_mem_ctx = NULL;
16438
16439         /* In parameters */
16440         state->orig.in.hPrinter = _hPrinter;
16441         state->orig.in.JobId = _JobId;
16442         state->orig.in.pProperty = _pProperty;
16443
16444         /* Out parameters */
16445
16446         /* Result */
16447         ZERO_STRUCT(state->orig.out.result);
16448
16449         /* make a temporary copy, that we pass to the dispatch function */
16450         state->tmp = state->orig;
16451
16452         subreq = dcerpc_spoolss_RpcSetJobNamedProperty_r_send(state, ev, h, &state->tmp);
16453         if (tevent_req_nomem(subreq, req)) {
16454                 return tevent_req_post(req, ev);
16455         }
16456         tevent_req_set_callback(subreq, dcerpc_spoolss_RpcSetJobNamedProperty_done, req);
16457         return req;
16458 }
16459
16460 static void dcerpc_spoolss_RpcSetJobNamedProperty_done(struct tevent_req *subreq)
16461 {
16462         struct tevent_req *req = tevent_req_callback_data(
16463                 subreq, struct tevent_req);
16464         struct dcerpc_spoolss_RpcSetJobNamedProperty_state *state = tevent_req_data(
16465                 req, struct dcerpc_spoolss_RpcSetJobNamedProperty_state);
16466         NTSTATUS status;
16467         TALLOC_CTX *mem_ctx;
16468
16469         if (state->out_mem_ctx) {
16470                 mem_ctx = state->out_mem_ctx;
16471         } else {
16472                 mem_ctx = state;
16473         }
16474
16475         status = dcerpc_spoolss_RpcSetJobNamedProperty_r_recv(subreq, mem_ctx);
16476         TALLOC_FREE(subreq);
16477         if (tevent_req_nterror(req, status)) {
16478                 return;
16479         }
16480
16481         /* Copy out parameters */
16482
16483         /* Copy result */
16484         state->orig.out.result = state->tmp.out.result;
16485
16486         /* Reset temporary structure */
16487         ZERO_STRUCT(state->tmp);
16488
16489         tevent_req_done(req);
16490 }
16491
16492 NTSTATUS dcerpc_spoolss_RpcSetJobNamedProperty_recv(struct tevent_req *req,
16493                                                     TALLOC_CTX *mem_ctx,
16494                                                     WERROR *result)
16495 {
16496         struct dcerpc_spoolss_RpcSetJobNamedProperty_state *state = tevent_req_data(
16497                 req, struct dcerpc_spoolss_RpcSetJobNamedProperty_state);
16498         NTSTATUS status;
16499
16500         if (tevent_req_is_nterror(req, &status)) {
16501                 tevent_req_received(req);
16502                 return status;
16503         }
16504
16505         /* Steal possible out parameters to the callers context */
16506         talloc_steal(mem_ctx, state->out_mem_ctx);
16507
16508         /* Return result */
16509         *result = state->orig.out.result;
16510
16511         tevent_req_received(req);
16512         return NT_STATUS_OK;
16513 }
16514
16515 NTSTATUS dcerpc_spoolss_RpcSetJobNamedProperty(struct dcerpc_binding_handle *h,
16516                                                TALLOC_CTX *mem_ctx,
16517                                                struct policy_handle *_hPrinter /* [in] [ref] */,
16518                                                uint32_t _JobId /* [in]  */,
16519                                                struct RPC_PrintNamedProperty *_pProperty /* [in] [ref] */,
16520                                                WERROR *result)
16521 {
16522         struct spoolss_RpcSetJobNamedProperty r;
16523         NTSTATUS status;
16524
16525         /* In parameters */
16526         r.in.hPrinter = _hPrinter;
16527         r.in.JobId = _JobId;
16528         r.in.pProperty = _pProperty;
16529
16530         status = dcerpc_spoolss_RpcSetJobNamedProperty_r(h, mem_ctx, &r);
16531         if (!NT_STATUS_IS_OK(status)) {
16532                 return status;
16533         }
16534
16535         /* Return variables */
16536
16537         /* Return result */
16538         *result = r.out.result;
16539
16540         return NT_STATUS_OK;
16541 }
16542
16543 struct dcerpc_spoolss_RpcDeleteJobNamedProperty_r_state {
16544         TALLOC_CTX *out_mem_ctx;
16545 };
16546
16547 static void dcerpc_spoolss_RpcDeleteJobNamedProperty_r_done(struct tevent_req *subreq);
16548
16549 struct tevent_req *dcerpc_spoolss_RpcDeleteJobNamedProperty_r_send(TALLOC_CTX *mem_ctx,
16550         struct tevent_context *ev,
16551         struct dcerpc_binding_handle *h,
16552         struct spoolss_RpcDeleteJobNamedProperty *r)
16553 {
16554         struct tevent_req *req;
16555         struct dcerpc_spoolss_RpcDeleteJobNamedProperty_r_state *state;
16556         struct tevent_req *subreq;
16557
16558         req = tevent_req_create(mem_ctx, &state,
16559                                 struct dcerpc_spoolss_RpcDeleteJobNamedProperty_r_state);
16560         if (req == NULL) {
16561                 return NULL;
16562         }
16563
16564         state->out_mem_ctx = NULL;
16565
16566         subreq = dcerpc_binding_handle_call_send(state, ev, h,
16567                         NULL, &ndr_table_spoolss,
16568                         NDR_SPOOLSS_RPCDELETEJOBNAMEDPROPERTY, state, r);
16569         if (tevent_req_nomem(subreq, req)) {
16570                 return tevent_req_post(req, ev);
16571         }
16572         tevent_req_set_callback(subreq, dcerpc_spoolss_RpcDeleteJobNamedProperty_r_done, req);
16573
16574         return req;
16575 }
16576
16577 static void dcerpc_spoolss_RpcDeleteJobNamedProperty_r_done(struct tevent_req *subreq)
16578 {
16579         struct tevent_req *req =
16580                 tevent_req_callback_data(subreq,
16581                 struct tevent_req);
16582         NTSTATUS status;
16583
16584         status = dcerpc_binding_handle_call_recv(subreq);
16585         TALLOC_FREE(subreq);
16586         if (tevent_req_nterror(req, status)) {
16587                 return;
16588         }
16589
16590         tevent_req_done(req);
16591 }
16592
16593 NTSTATUS dcerpc_spoolss_RpcDeleteJobNamedProperty_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
16594 {
16595         struct dcerpc_spoolss_RpcDeleteJobNamedProperty_r_state *state =
16596                 tevent_req_data(req,
16597                 struct dcerpc_spoolss_RpcDeleteJobNamedProperty_r_state);
16598         NTSTATUS status;
16599
16600         if (tevent_req_is_nterror(req, &status)) {
16601                 tevent_req_received(req);
16602                 return status;
16603         }
16604
16605         talloc_steal(mem_ctx, state->out_mem_ctx);
16606
16607         tevent_req_received(req);
16608         return NT_STATUS_OK;
16609 }
16610
16611 NTSTATUS dcerpc_spoolss_RpcDeleteJobNamedProperty_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_RpcDeleteJobNamedProperty *r)
16612 {
16613         NTSTATUS status;
16614
16615         status = dcerpc_binding_handle_call(h,
16616                         NULL, &ndr_table_spoolss,
16617                         NDR_SPOOLSS_RPCDELETEJOBNAMEDPROPERTY, mem_ctx, r);
16618
16619         return status;
16620 }
16621
16622 struct dcerpc_spoolss_RpcDeleteJobNamedProperty_state {
16623         struct spoolss_RpcDeleteJobNamedProperty orig;
16624         struct spoolss_RpcDeleteJobNamedProperty tmp;
16625         TALLOC_CTX *out_mem_ctx;
16626 };
16627
16628 static void dcerpc_spoolss_RpcDeleteJobNamedProperty_done(struct tevent_req *subreq);
16629
16630 struct tevent_req *dcerpc_spoolss_RpcDeleteJobNamedProperty_send(TALLOC_CTX *mem_ctx,
16631                                                                  struct tevent_context *ev,
16632                                                                  struct dcerpc_binding_handle *h,
16633                                                                  struct policy_handle *_hPrinter /* [in] [ref] */,
16634                                                                  uint32_t _JobId /* [in]  */,
16635                                                                  const char *_pszName /* [in] [ref,charset(UTF16)] */)
16636 {
16637         struct tevent_req *req;
16638         struct dcerpc_spoolss_RpcDeleteJobNamedProperty_state *state;
16639         struct tevent_req *subreq;
16640
16641         req = tevent_req_create(mem_ctx, &state,
16642                                 struct dcerpc_spoolss_RpcDeleteJobNamedProperty_state);
16643         if (req == NULL) {
16644                 return NULL;
16645         }
16646         state->out_mem_ctx = NULL;
16647
16648         /* In parameters */
16649         state->orig.in.hPrinter = _hPrinter;
16650         state->orig.in.JobId = _JobId;
16651         state->orig.in.pszName = _pszName;
16652
16653         /* Out parameters */
16654
16655         /* Result */
16656         ZERO_STRUCT(state->orig.out.result);
16657
16658         /* make a temporary copy, that we pass to the dispatch function */
16659         state->tmp = state->orig;
16660
16661         subreq = dcerpc_spoolss_RpcDeleteJobNamedProperty_r_send(state, ev, h, &state->tmp);
16662         if (tevent_req_nomem(subreq, req)) {
16663                 return tevent_req_post(req, ev);
16664         }
16665         tevent_req_set_callback(subreq, dcerpc_spoolss_RpcDeleteJobNamedProperty_done, req);
16666         return req;
16667 }
16668
16669 static void dcerpc_spoolss_RpcDeleteJobNamedProperty_done(struct tevent_req *subreq)
16670 {
16671         struct tevent_req *req = tevent_req_callback_data(
16672                 subreq, struct tevent_req);
16673         struct dcerpc_spoolss_RpcDeleteJobNamedProperty_state *state = tevent_req_data(
16674                 req, struct dcerpc_spoolss_RpcDeleteJobNamedProperty_state);
16675         NTSTATUS status;
16676         TALLOC_CTX *mem_ctx;
16677
16678         if (state->out_mem_ctx) {
16679                 mem_ctx = state->out_mem_ctx;
16680         } else {
16681                 mem_ctx = state;
16682         }
16683
16684         status = dcerpc_spoolss_RpcDeleteJobNamedProperty_r_recv(subreq, mem_ctx);
16685         TALLOC_FREE(subreq);
16686         if (tevent_req_nterror(req, status)) {
16687                 return;
16688         }
16689
16690         /* Copy out parameters */
16691
16692         /* Copy result */
16693         state->orig.out.result = state->tmp.out.result;
16694
16695         /* Reset temporary structure */
16696         ZERO_STRUCT(state->tmp);
16697
16698         tevent_req_done(req);
16699 }
16700
16701 NTSTATUS dcerpc_spoolss_RpcDeleteJobNamedProperty_recv(struct tevent_req *req,
16702                                                        TALLOC_CTX *mem_ctx,
16703                                                        WERROR *result)
16704 {
16705         struct dcerpc_spoolss_RpcDeleteJobNamedProperty_state *state = tevent_req_data(
16706                 req, struct dcerpc_spoolss_RpcDeleteJobNamedProperty_state);
16707         NTSTATUS status;
16708
16709         if (tevent_req_is_nterror(req, &status)) {
16710                 tevent_req_received(req);
16711                 return status;
16712         }
16713
16714         /* Steal possible out parameters to the callers context */
16715         talloc_steal(mem_ctx, state->out_mem_ctx);
16716
16717         /* Return result */
16718         *result = state->orig.out.result;
16719
16720         tevent_req_received(req);
16721         return NT_STATUS_OK;
16722 }
16723
16724 NTSTATUS dcerpc_spoolss_RpcDeleteJobNamedProperty(struct dcerpc_binding_handle *h,
16725                                                   TALLOC_CTX *mem_ctx,
16726                                                   struct policy_handle *_hPrinter /* [in] [ref] */,
16727                                                   uint32_t _JobId /* [in]  */,
16728                                                   const char *_pszName /* [in] [ref,charset(UTF16)] */,
16729                                                   WERROR *result)
16730 {
16731         struct spoolss_RpcDeleteJobNamedProperty r;
16732         NTSTATUS status;
16733
16734         /* In parameters */
16735         r.in.hPrinter = _hPrinter;
16736         r.in.JobId = _JobId;
16737         r.in.pszName = _pszName;
16738
16739         status = dcerpc_spoolss_RpcDeleteJobNamedProperty_r(h, mem_ctx, &r);
16740         if (!NT_STATUS_IS_OK(status)) {
16741                 return status;
16742         }
16743
16744         /* Return variables */
16745
16746         /* Return result */
16747         *result = r.out.result;
16748
16749         return NT_STATUS_OK;
16750 }
16751
16752 struct dcerpc_spoolss_RpcEnumJobNamedProperties_r_state {
16753         TALLOC_CTX *out_mem_ctx;
16754 };
16755
16756 static void dcerpc_spoolss_RpcEnumJobNamedProperties_r_done(struct tevent_req *subreq);
16757
16758 struct tevent_req *dcerpc_spoolss_RpcEnumJobNamedProperties_r_send(TALLOC_CTX *mem_ctx,
16759         struct tevent_context *ev,
16760         struct dcerpc_binding_handle *h,
16761         struct spoolss_RpcEnumJobNamedProperties *r)
16762 {
16763         struct tevent_req *req;
16764         struct dcerpc_spoolss_RpcEnumJobNamedProperties_r_state *state;
16765         struct tevent_req *subreq;
16766
16767         req = tevent_req_create(mem_ctx, &state,
16768                                 struct dcerpc_spoolss_RpcEnumJobNamedProperties_r_state);
16769         if (req == NULL) {
16770                 return NULL;
16771         }
16772
16773         state->out_mem_ctx = talloc_new(state);
16774         if (tevent_req_nomem(state->out_mem_ctx, req)) {
16775                 return tevent_req_post(req, ev);
16776         }
16777
16778         subreq = dcerpc_binding_handle_call_send(state, ev, h,
16779                         NULL, &ndr_table_spoolss,
16780                         NDR_SPOOLSS_RPCENUMJOBNAMEDPROPERTIES, state->out_mem_ctx, r);
16781         if (tevent_req_nomem(subreq, req)) {
16782                 return tevent_req_post(req, ev);
16783         }
16784         tevent_req_set_callback(subreq, dcerpc_spoolss_RpcEnumJobNamedProperties_r_done, req);
16785
16786         return req;
16787 }
16788
16789 static void dcerpc_spoolss_RpcEnumJobNamedProperties_r_done(struct tevent_req *subreq)
16790 {
16791         struct tevent_req *req =
16792                 tevent_req_callback_data(subreq,
16793                 struct tevent_req);
16794         NTSTATUS status;
16795
16796         status = dcerpc_binding_handle_call_recv(subreq);
16797         TALLOC_FREE(subreq);
16798         if (tevent_req_nterror(req, status)) {
16799                 return;
16800         }
16801
16802         tevent_req_done(req);
16803 }
16804
16805 NTSTATUS dcerpc_spoolss_RpcEnumJobNamedProperties_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
16806 {
16807         struct dcerpc_spoolss_RpcEnumJobNamedProperties_r_state *state =
16808                 tevent_req_data(req,
16809                 struct dcerpc_spoolss_RpcEnumJobNamedProperties_r_state);
16810         NTSTATUS status;
16811
16812         if (tevent_req_is_nterror(req, &status)) {
16813                 tevent_req_received(req);
16814                 return status;
16815         }
16816
16817         talloc_steal(mem_ctx, state->out_mem_ctx);
16818
16819         tevent_req_received(req);
16820         return NT_STATUS_OK;
16821 }
16822
16823 NTSTATUS dcerpc_spoolss_RpcEnumJobNamedProperties_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct spoolss_RpcEnumJobNamedProperties *r)
16824 {
16825         NTSTATUS status;
16826
16827         status = dcerpc_binding_handle_call(h,
16828                         NULL, &ndr_table_spoolss,
16829                         NDR_SPOOLSS_RPCENUMJOBNAMEDPROPERTIES, mem_ctx, r);
16830
16831         return status;
16832 }
16833
16834 struct dcerpc_spoolss_RpcEnumJobNamedProperties_state {
16835         struct spoolss_RpcEnumJobNamedProperties orig;
16836         struct spoolss_RpcEnumJobNamedProperties tmp;
16837         TALLOC_CTX *out_mem_ctx;
16838 };
16839
16840 static void dcerpc_spoolss_RpcEnumJobNamedProperties_done(struct tevent_req *subreq);
16841
16842 struct tevent_req *dcerpc_spoolss_RpcEnumJobNamedProperties_send(TALLOC_CTX *mem_ctx,
16843                                                                  struct tevent_context *ev,
16844                                                                  struct dcerpc_binding_handle *h,
16845                                                                  struct policy_handle *_hPrinter /* [in] [ref] */,
16846                                                                  uint32_t _JobId /* [in]  */,
16847                                                                  uint32_t *_pcProperties /* [out] [ref] */,
16848                                                                  struct RPC_PrintNamedProperty **_ppProperties /* [out] [ref,size_is(,*pcProperties)] */)
16849 {
16850         struct tevent_req *req;
16851         struct dcerpc_spoolss_RpcEnumJobNamedProperties_state *state;
16852         struct tevent_req *subreq;
16853
16854         req = tevent_req_create(mem_ctx, &state,
16855                                 struct dcerpc_spoolss_RpcEnumJobNamedProperties_state);
16856         if (req == NULL) {
16857                 return NULL;
16858         }
16859         state->out_mem_ctx = NULL;
16860
16861         /* In parameters */
16862         state->orig.in.hPrinter = _hPrinter;
16863         state->orig.in.JobId = _JobId;
16864
16865         /* Out parameters */
16866         state->orig.out.pcProperties = _pcProperties;
16867         state->orig.out.ppProperties = _ppProperties;
16868
16869         /* Result */
16870         ZERO_STRUCT(state->orig.out.result);
16871
16872         state->out_mem_ctx = talloc_named_const(state, 0,
16873                              "dcerpc_spoolss_RpcEnumJobNamedProperties_out_memory");
16874         if (tevent_req_nomem(state->out_mem_ctx, req)) {
16875                 return tevent_req_post(req, ev);
16876         }
16877
16878         /* make a temporary copy, that we pass to the dispatch function */
16879         state->tmp = state->orig;
16880
16881         subreq = dcerpc_spoolss_RpcEnumJobNamedProperties_r_send(state, ev, h, &state->tmp);
16882         if (tevent_req_nomem(subreq, req)) {
16883                 return tevent_req_post(req, ev);
16884         }
16885         tevent_req_set_callback(subreq, dcerpc_spoolss_RpcEnumJobNamedProperties_done, req);
16886         return req;
16887 }
16888
16889 static void dcerpc_spoolss_RpcEnumJobNamedProperties_done(struct tevent_req *subreq)
16890 {
16891         struct tevent_req *req = tevent_req_callback_data(
16892                 subreq, struct tevent_req);
16893         struct dcerpc_spoolss_RpcEnumJobNamedProperties_state *state = tevent_req_data(
16894                 req, struct dcerpc_spoolss_RpcEnumJobNamedProperties_state);
16895         NTSTATUS status;
16896         TALLOC_CTX *mem_ctx;
16897
16898         if (state->out_mem_ctx) {
16899                 mem_ctx = state->out_mem_ctx;
16900         } else {
16901                 mem_ctx = state;
16902         }
16903
16904         status = dcerpc_spoolss_RpcEnumJobNamedProperties_r_recv(subreq, mem_ctx);
16905         TALLOC_FREE(subreq);
16906         if (tevent_req_nterror(req, status)) {
16907                 return;
16908         }
16909
16910         /* Copy out parameters */
16911         *state->orig.out.pcProperties = *state->tmp.out.pcProperties;
16912         *state->orig.out.ppProperties = *state->tmp.out.ppProperties;
16913
16914         /* Copy result */
16915         state->orig.out.result = state->tmp.out.result;
16916
16917         /* Reset temporary structure */
16918         ZERO_STRUCT(state->tmp);
16919
16920         tevent_req_done(req);
16921 }
16922
16923 NTSTATUS dcerpc_spoolss_RpcEnumJobNamedProperties_recv(struct tevent_req *req,
16924                                                        TALLOC_CTX *mem_ctx,
16925                                                        WERROR *result)
16926 {
16927         struct dcerpc_spoolss_RpcEnumJobNamedProperties_state *state = tevent_req_data(
16928                 req, struct dcerpc_spoolss_RpcEnumJobNamedProperties_state);
16929         NTSTATUS status;
16930
16931         if (tevent_req_is_nterror(req, &status)) {
16932                 tevent_req_received(req);
16933                 return status;
16934         }
16935
16936         /* Steal possible out parameters to the callers context */
16937         talloc_steal(mem_ctx, state->out_mem_ctx);
16938
16939         /* Return result */
16940         *result = state->orig.out.result;
16941
16942         tevent_req_received(req);
16943         return NT_STATUS_OK;
16944 }
16945
16946 NTSTATUS dcerpc_spoolss_RpcEnumJobNamedProperties(struct dcerpc_binding_handle *h,
16947                                                   TALLOC_CTX *mem_ctx,
16948                                                   struct policy_handle *_hPrinter /* [in] [ref] */,
16949                                                   uint32_t _JobId /* [in]  */,
16950                                                   uint32_t *_pcProperties /* [out] [ref] */,
16951                                                   struct RPC_PrintNamedProperty **_ppProperties /* [out] [ref,size_is(,*pcProperties)] */,
16952                                                   WERROR *result)
16953 {
16954         struct spoolss_RpcEnumJobNamedProperties r;
16955         NTSTATUS status;
16956
16957         /* In parameters */
16958         r.in.hPrinter = _hPrinter;
16959         r.in.JobId = _JobId;
16960
16961         status = dcerpc_spoolss_RpcEnumJobNamedProperties_r(h, mem_ctx, &r);
16962         if (!NT_STATUS_IS_OK(status)) {
16963                 return status;
16964         }
16965
16966         /* Return variables */
16967         *_pcProperties = *r.out.pcProperties;
16968         *_ppProperties = *r.out.ppProperties;
16969
16970         /* Return result */
16971         *result = r.out.result;
16972
16973         return NT_STATUS_OK;
16974 }
16975