librpc: rerun "make idl"
[samba.git] / librpc / gen_ndr / cli_svcctl.c
1 /*
2  * Unix SMB/CIFS implementation.
3  * client auto-generated by pidl. DO NOT MODIFY!
4  */
5
6 #include "includes.h"
7 #include "../librpc/gen_ndr/cli_svcctl.h"
8
9 struct rpccli_svcctl_CloseServiceHandle_state {
10         struct svcctl_CloseServiceHandle orig;
11         struct svcctl_CloseServiceHandle tmp;
12         TALLOC_CTX *out_mem_ctx;
13         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
14 };
15
16 static void rpccli_svcctl_CloseServiceHandle_done(struct tevent_req *subreq);
17
18 struct tevent_req *rpccli_svcctl_CloseServiceHandle_send(TALLOC_CTX *mem_ctx,
19                                                          struct tevent_context *ev,
20                                                          struct rpc_pipe_client *cli,
21                                                          struct policy_handle *_handle /* [in,out] [ref] */)
22 {
23         struct tevent_req *req;
24         struct rpccli_svcctl_CloseServiceHandle_state *state;
25         struct tevent_req *subreq;
26
27         req = tevent_req_create(mem_ctx, &state,
28                                 struct rpccli_svcctl_CloseServiceHandle_state);
29         if (req == NULL) {
30                 return NULL;
31         }
32         state->out_mem_ctx = NULL;
33         state->dispatch_recv = cli->dispatch_recv;
34
35         /* In parameters */
36         state->orig.in.handle = _handle;
37
38         /* Out parameters */
39         state->orig.out.handle = _handle;
40
41         /* Result */
42         ZERO_STRUCT(state->orig.out.result);
43
44         if (DEBUGLEVEL >= 10) {
45                 NDR_PRINT_IN_DEBUG(svcctl_CloseServiceHandle, &state->orig);
46         }
47
48         state->out_mem_ctx = talloc_named_const(state, 0,
49                              "rpccli_svcctl_CloseServiceHandle_out_memory");
50         if (tevent_req_nomem(state->out_mem_ctx, req)) {
51                 return tevent_req_post(req, ev);
52         }
53
54         /* make a temporary copy, that we pass to the dispatch function */
55         state->tmp = state->orig;
56
57         subreq = cli->dispatch_send(state, ev, cli,
58                                     &ndr_table_svcctl,
59                                     NDR_SVCCTL_CLOSESERVICEHANDLE,
60                                     &state->tmp);
61         if (tevent_req_nomem(subreq, req)) {
62                 return tevent_req_post(req, ev);
63         }
64         tevent_req_set_callback(subreq, rpccli_svcctl_CloseServiceHandle_done, req);
65         return req;
66 }
67
68 static void rpccli_svcctl_CloseServiceHandle_done(struct tevent_req *subreq)
69 {
70         struct tevent_req *req = tevent_req_callback_data(
71                 subreq, struct tevent_req);
72         struct rpccli_svcctl_CloseServiceHandle_state *state = tevent_req_data(
73                 req, struct rpccli_svcctl_CloseServiceHandle_state);
74         NTSTATUS status;
75         TALLOC_CTX *mem_ctx;
76
77         if (state->out_mem_ctx) {
78                 mem_ctx = state->out_mem_ctx;
79         } else {
80                 mem_ctx = state;
81         }
82
83         status = state->dispatch_recv(subreq, mem_ctx);
84         TALLOC_FREE(subreq);
85         if (!NT_STATUS_IS_OK(status)) {
86                 tevent_req_nterror(req, status);
87                 return;
88         }
89
90         /* Copy out parameters */
91         *state->orig.out.handle = *state->tmp.out.handle;
92
93         /* Copy result */
94         state->orig.out.result = state->tmp.out.result;
95
96         /* Reset temporary structure */
97         ZERO_STRUCT(state->tmp);
98
99         if (DEBUGLEVEL >= 10) {
100                 NDR_PRINT_OUT_DEBUG(svcctl_CloseServiceHandle, &state->orig);
101         }
102
103         tevent_req_done(req);
104 }
105
106 NTSTATUS rpccli_svcctl_CloseServiceHandle_recv(struct tevent_req *req,
107                                                TALLOC_CTX *mem_ctx,
108                                                WERROR *result)
109 {
110         struct rpccli_svcctl_CloseServiceHandle_state *state = tevent_req_data(
111                 req, struct rpccli_svcctl_CloseServiceHandle_state);
112         NTSTATUS status;
113
114         if (tevent_req_is_nterror(req, &status)) {
115                 tevent_req_received(req);
116                 return status;
117         }
118
119         /* Steal possbile out parameters to the callers context */
120         talloc_steal(mem_ctx, state->out_mem_ctx);
121
122         /* Return result */
123         *result = state->orig.out.result;
124
125         tevent_req_received(req);
126         return NT_STATUS_OK;
127 }
128
129 NTSTATUS rpccli_svcctl_CloseServiceHandle(struct rpc_pipe_client *cli,
130                                           TALLOC_CTX *mem_ctx,
131                                           struct policy_handle *handle /* [in,out] [ref] */,
132                                           WERROR *werror)
133 {
134         struct svcctl_CloseServiceHandle r;
135         NTSTATUS status;
136
137         /* In parameters */
138         r.in.handle = handle;
139
140         if (DEBUGLEVEL >= 10) {
141                 NDR_PRINT_IN_DEBUG(svcctl_CloseServiceHandle, &r);
142         }
143
144         status = cli->dispatch(cli,
145                                 mem_ctx,
146                                 &ndr_table_svcctl,
147                                 NDR_SVCCTL_CLOSESERVICEHANDLE,
148                                 &r);
149
150         if (!NT_STATUS_IS_OK(status)) {
151                 return status;
152         }
153
154         if (DEBUGLEVEL >= 10) {
155                 NDR_PRINT_OUT_DEBUG(svcctl_CloseServiceHandle, &r);
156         }
157
158         if (NT_STATUS_IS_ERR(status)) {
159                 return status;
160         }
161
162         /* Return variables */
163         *handle = *r.out.handle;
164
165         /* Return result */
166         if (werror) {
167                 *werror = r.out.result;
168         }
169
170         return werror_to_ntstatus(r.out.result);
171 }
172
173 struct rpccli_svcctl_ControlService_state {
174         struct svcctl_ControlService orig;
175         struct svcctl_ControlService tmp;
176         TALLOC_CTX *out_mem_ctx;
177         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
178 };
179
180 static void rpccli_svcctl_ControlService_done(struct tevent_req *subreq);
181
182 struct tevent_req *rpccli_svcctl_ControlService_send(TALLOC_CTX *mem_ctx,
183                                                      struct tevent_context *ev,
184                                                      struct rpc_pipe_client *cli,
185                                                      struct policy_handle *_handle /* [in] [ref] */,
186                                                      enum SERVICE_CONTROL _control /* [in]  */,
187                                                      struct SERVICE_STATUS *_service_status /* [out] [ref] */)
188 {
189         struct tevent_req *req;
190         struct rpccli_svcctl_ControlService_state *state;
191         struct tevent_req *subreq;
192
193         req = tevent_req_create(mem_ctx, &state,
194                                 struct rpccli_svcctl_ControlService_state);
195         if (req == NULL) {
196                 return NULL;
197         }
198         state->out_mem_ctx = NULL;
199         state->dispatch_recv = cli->dispatch_recv;
200
201         /* In parameters */
202         state->orig.in.handle = _handle;
203         state->orig.in.control = _control;
204
205         /* Out parameters */
206         state->orig.out.service_status = _service_status;
207
208         /* Result */
209         ZERO_STRUCT(state->orig.out.result);
210
211         if (DEBUGLEVEL >= 10) {
212                 NDR_PRINT_IN_DEBUG(svcctl_ControlService, &state->orig);
213         }
214
215         state->out_mem_ctx = talloc_named_const(state, 0,
216                              "rpccli_svcctl_ControlService_out_memory");
217         if (tevent_req_nomem(state->out_mem_ctx, req)) {
218                 return tevent_req_post(req, ev);
219         }
220
221         /* make a temporary copy, that we pass to the dispatch function */
222         state->tmp = state->orig;
223
224         subreq = cli->dispatch_send(state, ev, cli,
225                                     &ndr_table_svcctl,
226                                     NDR_SVCCTL_CONTROLSERVICE,
227                                     &state->tmp);
228         if (tevent_req_nomem(subreq, req)) {
229                 return tevent_req_post(req, ev);
230         }
231         tevent_req_set_callback(subreq, rpccli_svcctl_ControlService_done, req);
232         return req;
233 }
234
235 static void rpccli_svcctl_ControlService_done(struct tevent_req *subreq)
236 {
237         struct tevent_req *req = tevent_req_callback_data(
238                 subreq, struct tevent_req);
239         struct rpccli_svcctl_ControlService_state *state = tevent_req_data(
240                 req, struct rpccli_svcctl_ControlService_state);
241         NTSTATUS status;
242         TALLOC_CTX *mem_ctx;
243
244         if (state->out_mem_ctx) {
245                 mem_ctx = state->out_mem_ctx;
246         } else {
247                 mem_ctx = state;
248         }
249
250         status = state->dispatch_recv(subreq, mem_ctx);
251         TALLOC_FREE(subreq);
252         if (!NT_STATUS_IS_OK(status)) {
253                 tevent_req_nterror(req, status);
254                 return;
255         }
256
257         /* Copy out parameters */
258         *state->orig.out.service_status = *state->tmp.out.service_status;
259
260         /* Copy result */
261         state->orig.out.result = state->tmp.out.result;
262
263         /* Reset temporary structure */
264         ZERO_STRUCT(state->tmp);
265
266         if (DEBUGLEVEL >= 10) {
267                 NDR_PRINT_OUT_DEBUG(svcctl_ControlService, &state->orig);
268         }
269
270         tevent_req_done(req);
271 }
272
273 NTSTATUS rpccli_svcctl_ControlService_recv(struct tevent_req *req,
274                                            TALLOC_CTX *mem_ctx,
275                                            WERROR *result)
276 {
277         struct rpccli_svcctl_ControlService_state *state = tevent_req_data(
278                 req, struct rpccli_svcctl_ControlService_state);
279         NTSTATUS status;
280
281         if (tevent_req_is_nterror(req, &status)) {
282                 tevent_req_received(req);
283                 return status;
284         }
285
286         /* Steal possbile out parameters to the callers context */
287         talloc_steal(mem_ctx, state->out_mem_ctx);
288
289         /* Return result */
290         *result = state->orig.out.result;
291
292         tevent_req_received(req);
293         return NT_STATUS_OK;
294 }
295
296 NTSTATUS rpccli_svcctl_ControlService(struct rpc_pipe_client *cli,
297                                       TALLOC_CTX *mem_ctx,
298                                       struct policy_handle *handle /* [in] [ref] */,
299                                       enum SERVICE_CONTROL control /* [in]  */,
300                                       struct SERVICE_STATUS *service_status /* [out] [ref] */,
301                                       WERROR *werror)
302 {
303         struct svcctl_ControlService r;
304         NTSTATUS status;
305
306         /* In parameters */
307         r.in.handle = handle;
308         r.in.control = control;
309
310         if (DEBUGLEVEL >= 10) {
311                 NDR_PRINT_IN_DEBUG(svcctl_ControlService, &r);
312         }
313
314         status = cli->dispatch(cli,
315                                 mem_ctx,
316                                 &ndr_table_svcctl,
317                                 NDR_SVCCTL_CONTROLSERVICE,
318                                 &r);
319
320         if (!NT_STATUS_IS_OK(status)) {
321                 return status;
322         }
323
324         if (DEBUGLEVEL >= 10) {
325                 NDR_PRINT_OUT_DEBUG(svcctl_ControlService, &r);
326         }
327
328         if (NT_STATUS_IS_ERR(status)) {
329                 return status;
330         }
331
332         /* Return variables */
333         *service_status = *r.out.service_status;
334
335         /* Return result */
336         if (werror) {
337                 *werror = r.out.result;
338         }
339
340         return werror_to_ntstatus(r.out.result);
341 }
342
343 struct rpccli_svcctl_DeleteService_state {
344         struct svcctl_DeleteService orig;
345         struct svcctl_DeleteService tmp;
346         TALLOC_CTX *out_mem_ctx;
347         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
348 };
349
350 static void rpccli_svcctl_DeleteService_done(struct tevent_req *subreq);
351
352 struct tevent_req *rpccli_svcctl_DeleteService_send(TALLOC_CTX *mem_ctx,
353                                                     struct tevent_context *ev,
354                                                     struct rpc_pipe_client *cli,
355                                                     struct policy_handle *_handle /* [in] [ref] */)
356 {
357         struct tevent_req *req;
358         struct rpccli_svcctl_DeleteService_state *state;
359         struct tevent_req *subreq;
360
361         req = tevent_req_create(mem_ctx, &state,
362                                 struct rpccli_svcctl_DeleteService_state);
363         if (req == NULL) {
364                 return NULL;
365         }
366         state->out_mem_ctx = NULL;
367         state->dispatch_recv = cli->dispatch_recv;
368
369         /* In parameters */
370         state->orig.in.handle = _handle;
371
372         /* Out parameters */
373
374         /* Result */
375         ZERO_STRUCT(state->orig.out.result);
376
377         if (DEBUGLEVEL >= 10) {
378                 NDR_PRINT_IN_DEBUG(svcctl_DeleteService, &state->orig);
379         }
380
381         /* make a temporary copy, that we pass to the dispatch function */
382         state->tmp = state->orig;
383
384         subreq = cli->dispatch_send(state, ev, cli,
385                                     &ndr_table_svcctl,
386                                     NDR_SVCCTL_DELETESERVICE,
387                                     &state->tmp);
388         if (tevent_req_nomem(subreq, req)) {
389                 return tevent_req_post(req, ev);
390         }
391         tevent_req_set_callback(subreq, rpccli_svcctl_DeleteService_done, req);
392         return req;
393 }
394
395 static void rpccli_svcctl_DeleteService_done(struct tevent_req *subreq)
396 {
397         struct tevent_req *req = tevent_req_callback_data(
398                 subreq, struct tevent_req);
399         struct rpccli_svcctl_DeleteService_state *state = tevent_req_data(
400                 req, struct rpccli_svcctl_DeleteService_state);
401         NTSTATUS status;
402         TALLOC_CTX *mem_ctx;
403
404         if (state->out_mem_ctx) {
405                 mem_ctx = state->out_mem_ctx;
406         } else {
407                 mem_ctx = state;
408         }
409
410         status = state->dispatch_recv(subreq, mem_ctx);
411         TALLOC_FREE(subreq);
412         if (!NT_STATUS_IS_OK(status)) {
413                 tevent_req_nterror(req, status);
414                 return;
415         }
416
417         /* Copy out parameters */
418
419         /* Copy result */
420         state->orig.out.result = state->tmp.out.result;
421
422         /* Reset temporary structure */
423         ZERO_STRUCT(state->tmp);
424
425         if (DEBUGLEVEL >= 10) {
426                 NDR_PRINT_OUT_DEBUG(svcctl_DeleteService, &state->orig);
427         }
428
429         tevent_req_done(req);
430 }
431
432 NTSTATUS rpccli_svcctl_DeleteService_recv(struct tevent_req *req,
433                                           TALLOC_CTX *mem_ctx,
434                                           WERROR *result)
435 {
436         struct rpccli_svcctl_DeleteService_state *state = tevent_req_data(
437                 req, struct rpccli_svcctl_DeleteService_state);
438         NTSTATUS status;
439
440         if (tevent_req_is_nterror(req, &status)) {
441                 tevent_req_received(req);
442                 return status;
443         }
444
445         /* Steal possbile out parameters to the callers context */
446         talloc_steal(mem_ctx, state->out_mem_ctx);
447
448         /* Return result */
449         *result = state->orig.out.result;
450
451         tevent_req_received(req);
452         return NT_STATUS_OK;
453 }
454
455 NTSTATUS rpccli_svcctl_DeleteService(struct rpc_pipe_client *cli,
456                                      TALLOC_CTX *mem_ctx,
457                                      struct policy_handle *handle /* [in] [ref] */,
458                                      WERROR *werror)
459 {
460         struct svcctl_DeleteService r;
461         NTSTATUS status;
462
463         /* In parameters */
464         r.in.handle = handle;
465
466         if (DEBUGLEVEL >= 10) {
467                 NDR_PRINT_IN_DEBUG(svcctl_DeleteService, &r);
468         }
469
470         status = cli->dispatch(cli,
471                                 mem_ctx,
472                                 &ndr_table_svcctl,
473                                 NDR_SVCCTL_DELETESERVICE,
474                                 &r);
475
476         if (!NT_STATUS_IS_OK(status)) {
477                 return status;
478         }
479
480         if (DEBUGLEVEL >= 10) {
481                 NDR_PRINT_OUT_DEBUG(svcctl_DeleteService, &r);
482         }
483
484         if (NT_STATUS_IS_ERR(status)) {
485                 return status;
486         }
487
488         /* Return variables */
489
490         /* Return result */
491         if (werror) {
492                 *werror = r.out.result;
493         }
494
495         return werror_to_ntstatus(r.out.result);
496 }
497
498 struct rpccli_svcctl_LockServiceDatabase_state {
499         struct svcctl_LockServiceDatabase orig;
500         struct svcctl_LockServiceDatabase tmp;
501         TALLOC_CTX *out_mem_ctx;
502         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
503 };
504
505 static void rpccli_svcctl_LockServiceDatabase_done(struct tevent_req *subreq);
506
507 struct tevent_req *rpccli_svcctl_LockServiceDatabase_send(TALLOC_CTX *mem_ctx,
508                                                           struct tevent_context *ev,
509                                                           struct rpc_pipe_client *cli,
510                                                           struct policy_handle *_handle /* [in] [ref] */,
511                                                           struct policy_handle *_lock /* [out] [ref] */)
512 {
513         struct tevent_req *req;
514         struct rpccli_svcctl_LockServiceDatabase_state *state;
515         struct tevent_req *subreq;
516
517         req = tevent_req_create(mem_ctx, &state,
518                                 struct rpccli_svcctl_LockServiceDatabase_state);
519         if (req == NULL) {
520                 return NULL;
521         }
522         state->out_mem_ctx = NULL;
523         state->dispatch_recv = cli->dispatch_recv;
524
525         /* In parameters */
526         state->orig.in.handle = _handle;
527
528         /* Out parameters */
529         state->orig.out.lock = _lock;
530
531         /* Result */
532         ZERO_STRUCT(state->orig.out.result);
533
534         if (DEBUGLEVEL >= 10) {
535                 NDR_PRINT_IN_DEBUG(svcctl_LockServiceDatabase, &state->orig);
536         }
537
538         state->out_mem_ctx = talloc_named_const(state, 0,
539                              "rpccli_svcctl_LockServiceDatabase_out_memory");
540         if (tevent_req_nomem(state->out_mem_ctx, req)) {
541                 return tevent_req_post(req, ev);
542         }
543
544         /* make a temporary copy, that we pass to the dispatch function */
545         state->tmp = state->orig;
546
547         subreq = cli->dispatch_send(state, ev, cli,
548                                     &ndr_table_svcctl,
549                                     NDR_SVCCTL_LOCKSERVICEDATABASE,
550                                     &state->tmp);
551         if (tevent_req_nomem(subreq, req)) {
552                 return tevent_req_post(req, ev);
553         }
554         tevent_req_set_callback(subreq, rpccli_svcctl_LockServiceDatabase_done, req);
555         return req;
556 }
557
558 static void rpccli_svcctl_LockServiceDatabase_done(struct tevent_req *subreq)
559 {
560         struct tevent_req *req = tevent_req_callback_data(
561                 subreq, struct tevent_req);
562         struct rpccli_svcctl_LockServiceDatabase_state *state = tevent_req_data(
563                 req, struct rpccli_svcctl_LockServiceDatabase_state);
564         NTSTATUS status;
565         TALLOC_CTX *mem_ctx;
566
567         if (state->out_mem_ctx) {
568                 mem_ctx = state->out_mem_ctx;
569         } else {
570                 mem_ctx = state;
571         }
572
573         status = state->dispatch_recv(subreq, mem_ctx);
574         TALLOC_FREE(subreq);
575         if (!NT_STATUS_IS_OK(status)) {
576                 tevent_req_nterror(req, status);
577                 return;
578         }
579
580         /* Copy out parameters */
581         *state->orig.out.lock = *state->tmp.out.lock;
582
583         /* Copy result */
584         state->orig.out.result = state->tmp.out.result;
585
586         /* Reset temporary structure */
587         ZERO_STRUCT(state->tmp);
588
589         if (DEBUGLEVEL >= 10) {
590                 NDR_PRINT_OUT_DEBUG(svcctl_LockServiceDatabase, &state->orig);
591         }
592
593         tevent_req_done(req);
594 }
595
596 NTSTATUS rpccli_svcctl_LockServiceDatabase_recv(struct tevent_req *req,
597                                                 TALLOC_CTX *mem_ctx,
598                                                 WERROR *result)
599 {
600         struct rpccli_svcctl_LockServiceDatabase_state *state = tevent_req_data(
601                 req, struct rpccli_svcctl_LockServiceDatabase_state);
602         NTSTATUS status;
603
604         if (tevent_req_is_nterror(req, &status)) {
605                 tevent_req_received(req);
606                 return status;
607         }
608
609         /* Steal possbile out parameters to the callers context */
610         talloc_steal(mem_ctx, state->out_mem_ctx);
611
612         /* Return result */
613         *result = state->orig.out.result;
614
615         tevent_req_received(req);
616         return NT_STATUS_OK;
617 }
618
619 NTSTATUS rpccli_svcctl_LockServiceDatabase(struct rpc_pipe_client *cli,
620                                            TALLOC_CTX *mem_ctx,
621                                            struct policy_handle *handle /* [in] [ref] */,
622                                            struct policy_handle *lock /* [out] [ref] */,
623                                            WERROR *werror)
624 {
625         struct svcctl_LockServiceDatabase r;
626         NTSTATUS status;
627
628         /* In parameters */
629         r.in.handle = handle;
630
631         if (DEBUGLEVEL >= 10) {
632                 NDR_PRINT_IN_DEBUG(svcctl_LockServiceDatabase, &r);
633         }
634
635         status = cli->dispatch(cli,
636                                 mem_ctx,
637                                 &ndr_table_svcctl,
638                                 NDR_SVCCTL_LOCKSERVICEDATABASE,
639                                 &r);
640
641         if (!NT_STATUS_IS_OK(status)) {
642                 return status;
643         }
644
645         if (DEBUGLEVEL >= 10) {
646                 NDR_PRINT_OUT_DEBUG(svcctl_LockServiceDatabase, &r);
647         }
648
649         if (NT_STATUS_IS_ERR(status)) {
650                 return status;
651         }
652
653         /* Return variables */
654         *lock = *r.out.lock;
655
656         /* Return result */
657         if (werror) {
658                 *werror = r.out.result;
659         }
660
661         return werror_to_ntstatus(r.out.result);
662 }
663
664 struct rpccli_svcctl_QueryServiceObjectSecurity_state {
665         struct svcctl_QueryServiceObjectSecurity orig;
666         struct svcctl_QueryServiceObjectSecurity tmp;
667         TALLOC_CTX *out_mem_ctx;
668         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
669 };
670
671 static void rpccli_svcctl_QueryServiceObjectSecurity_done(struct tevent_req *subreq);
672
673 struct tevent_req *rpccli_svcctl_QueryServiceObjectSecurity_send(TALLOC_CTX *mem_ctx,
674                                                                  struct tevent_context *ev,
675                                                                  struct rpc_pipe_client *cli,
676                                                                  struct policy_handle *_handle /* [in] [ref] */,
677                                                                  uint32_t _security_flags /* [in]  */,
678                                                                  uint8_t *_buffer /* [out] [ref,size_is(offered)] */,
679                                                                  uint32_t _offered /* [in] [range(0,0x40000)] */,
680                                                                  uint32_t *_needed /* [out] [ref,range(0,0x40000)] */)
681 {
682         struct tevent_req *req;
683         struct rpccli_svcctl_QueryServiceObjectSecurity_state *state;
684         struct tevent_req *subreq;
685
686         req = tevent_req_create(mem_ctx, &state,
687                                 struct rpccli_svcctl_QueryServiceObjectSecurity_state);
688         if (req == NULL) {
689                 return NULL;
690         }
691         state->out_mem_ctx = NULL;
692         state->dispatch_recv = cli->dispatch_recv;
693
694         /* In parameters */
695         state->orig.in.handle = _handle;
696         state->orig.in.security_flags = _security_flags;
697         state->orig.in.offered = _offered;
698
699         /* Out parameters */
700         state->orig.out.buffer = _buffer;
701         state->orig.out.needed = _needed;
702
703         /* Result */
704         ZERO_STRUCT(state->orig.out.result);
705
706         if (DEBUGLEVEL >= 10) {
707                 NDR_PRINT_IN_DEBUG(svcctl_QueryServiceObjectSecurity, &state->orig);
708         }
709
710         state->out_mem_ctx = talloc_named_const(state, 0,
711                              "rpccli_svcctl_QueryServiceObjectSecurity_out_memory");
712         if (tevent_req_nomem(state->out_mem_ctx, req)) {
713                 return tevent_req_post(req, ev);
714         }
715
716         /* make a temporary copy, that we pass to the dispatch function */
717         state->tmp = state->orig;
718
719         subreq = cli->dispatch_send(state, ev, cli,
720                                     &ndr_table_svcctl,
721                                     NDR_SVCCTL_QUERYSERVICEOBJECTSECURITY,
722                                     &state->tmp);
723         if (tevent_req_nomem(subreq, req)) {
724                 return tevent_req_post(req, ev);
725         }
726         tevent_req_set_callback(subreq, rpccli_svcctl_QueryServiceObjectSecurity_done, req);
727         return req;
728 }
729
730 static void rpccli_svcctl_QueryServiceObjectSecurity_done(struct tevent_req *subreq)
731 {
732         struct tevent_req *req = tevent_req_callback_data(
733                 subreq, struct tevent_req);
734         struct rpccli_svcctl_QueryServiceObjectSecurity_state *state = tevent_req_data(
735                 req, struct rpccli_svcctl_QueryServiceObjectSecurity_state);
736         NTSTATUS status;
737         TALLOC_CTX *mem_ctx;
738
739         if (state->out_mem_ctx) {
740                 mem_ctx = state->out_mem_ctx;
741         } else {
742                 mem_ctx = state;
743         }
744
745         status = state->dispatch_recv(subreq, mem_ctx);
746         TALLOC_FREE(subreq);
747         if (!NT_STATUS_IS_OK(status)) {
748                 tevent_req_nterror(req, status);
749                 return;
750         }
751
752         /* Copy out parameters */
753         memcpy(state->orig.out.buffer, state->tmp.out.buffer, state->tmp.in.offered * sizeof(*state->orig.out.buffer));
754         *state->orig.out.needed = *state->tmp.out.needed;
755
756         /* Copy result */
757         state->orig.out.result = state->tmp.out.result;
758
759         /* Reset temporary structure */
760         ZERO_STRUCT(state->tmp);
761
762         if (DEBUGLEVEL >= 10) {
763                 NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceObjectSecurity, &state->orig);
764         }
765
766         tevent_req_done(req);
767 }
768
769 NTSTATUS rpccli_svcctl_QueryServiceObjectSecurity_recv(struct tevent_req *req,
770                                                        TALLOC_CTX *mem_ctx,
771                                                        WERROR *result)
772 {
773         struct rpccli_svcctl_QueryServiceObjectSecurity_state *state = tevent_req_data(
774                 req, struct rpccli_svcctl_QueryServiceObjectSecurity_state);
775         NTSTATUS status;
776
777         if (tevent_req_is_nterror(req, &status)) {
778                 tevent_req_received(req);
779                 return status;
780         }
781
782         /* Steal possbile out parameters to the callers context */
783         talloc_steal(mem_ctx, state->out_mem_ctx);
784
785         /* Return result */
786         *result = state->orig.out.result;
787
788         tevent_req_received(req);
789         return NT_STATUS_OK;
790 }
791
792 NTSTATUS rpccli_svcctl_QueryServiceObjectSecurity(struct rpc_pipe_client *cli,
793                                                   TALLOC_CTX *mem_ctx,
794                                                   struct policy_handle *handle /* [in] [ref] */,
795                                                   uint32_t security_flags /* [in]  */,
796                                                   uint8_t *buffer /* [out] [ref,size_is(offered)] */,
797                                                   uint32_t offered /* [in] [range(0,0x40000)] */,
798                                                   uint32_t *needed /* [out] [ref,range(0,0x40000)] */,
799                                                   WERROR *werror)
800 {
801         struct svcctl_QueryServiceObjectSecurity r;
802         NTSTATUS status;
803
804         /* In parameters */
805         r.in.handle = handle;
806         r.in.security_flags = security_flags;
807         r.in.offered = offered;
808
809         if (DEBUGLEVEL >= 10) {
810                 NDR_PRINT_IN_DEBUG(svcctl_QueryServiceObjectSecurity, &r);
811         }
812
813         status = cli->dispatch(cli,
814                                 mem_ctx,
815                                 &ndr_table_svcctl,
816                                 NDR_SVCCTL_QUERYSERVICEOBJECTSECURITY,
817                                 &r);
818
819         if (!NT_STATUS_IS_OK(status)) {
820                 return status;
821         }
822
823         if (DEBUGLEVEL >= 10) {
824                 NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceObjectSecurity, &r);
825         }
826
827         if (NT_STATUS_IS_ERR(status)) {
828                 return status;
829         }
830
831         /* Return variables */
832         memcpy(buffer, r.out.buffer, r.in.offered * sizeof(*buffer));
833         *needed = *r.out.needed;
834
835         /* Return result */
836         if (werror) {
837                 *werror = r.out.result;
838         }
839
840         return werror_to_ntstatus(r.out.result);
841 }
842
843 struct rpccli_svcctl_SetServiceObjectSecurity_state {
844         struct svcctl_SetServiceObjectSecurity orig;
845         struct svcctl_SetServiceObjectSecurity tmp;
846         TALLOC_CTX *out_mem_ctx;
847         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
848 };
849
850 static void rpccli_svcctl_SetServiceObjectSecurity_done(struct tevent_req *subreq);
851
852 struct tevent_req *rpccli_svcctl_SetServiceObjectSecurity_send(TALLOC_CTX *mem_ctx,
853                                                                struct tevent_context *ev,
854                                                                struct rpc_pipe_client *cli,
855                                                                struct policy_handle *_handle /* [in] [ref] */,
856                                                                uint32_t _security_flags /* [in]  */,
857                                                                uint8_t *_buffer /* [in] [ref,size_is(offered)] */,
858                                                                uint32_t _offered /* [in]  */)
859 {
860         struct tevent_req *req;
861         struct rpccli_svcctl_SetServiceObjectSecurity_state *state;
862         struct tevent_req *subreq;
863
864         req = tevent_req_create(mem_ctx, &state,
865                                 struct rpccli_svcctl_SetServiceObjectSecurity_state);
866         if (req == NULL) {
867                 return NULL;
868         }
869         state->out_mem_ctx = NULL;
870         state->dispatch_recv = cli->dispatch_recv;
871
872         /* In parameters */
873         state->orig.in.handle = _handle;
874         state->orig.in.security_flags = _security_flags;
875         state->orig.in.buffer = _buffer;
876         state->orig.in.offered = _offered;
877
878         /* Out parameters */
879
880         /* Result */
881         ZERO_STRUCT(state->orig.out.result);
882
883         if (DEBUGLEVEL >= 10) {
884                 NDR_PRINT_IN_DEBUG(svcctl_SetServiceObjectSecurity, &state->orig);
885         }
886
887         /* make a temporary copy, that we pass to the dispatch function */
888         state->tmp = state->orig;
889
890         subreq = cli->dispatch_send(state, ev, cli,
891                                     &ndr_table_svcctl,
892                                     NDR_SVCCTL_SETSERVICEOBJECTSECURITY,
893                                     &state->tmp);
894         if (tevent_req_nomem(subreq, req)) {
895                 return tevent_req_post(req, ev);
896         }
897         tevent_req_set_callback(subreq, rpccli_svcctl_SetServiceObjectSecurity_done, req);
898         return req;
899 }
900
901 static void rpccli_svcctl_SetServiceObjectSecurity_done(struct tevent_req *subreq)
902 {
903         struct tevent_req *req = tevent_req_callback_data(
904                 subreq, struct tevent_req);
905         struct rpccli_svcctl_SetServiceObjectSecurity_state *state = tevent_req_data(
906                 req, struct rpccli_svcctl_SetServiceObjectSecurity_state);
907         NTSTATUS status;
908         TALLOC_CTX *mem_ctx;
909
910         if (state->out_mem_ctx) {
911                 mem_ctx = state->out_mem_ctx;
912         } else {
913                 mem_ctx = state;
914         }
915
916         status = state->dispatch_recv(subreq, mem_ctx);
917         TALLOC_FREE(subreq);
918         if (!NT_STATUS_IS_OK(status)) {
919                 tevent_req_nterror(req, status);
920                 return;
921         }
922
923         /* Copy out parameters */
924
925         /* Copy result */
926         state->orig.out.result = state->tmp.out.result;
927
928         /* Reset temporary structure */
929         ZERO_STRUCT(state->tmp);
930
931         if (DEBUGLEVEL >= 10) {
932                 NDR_PRINT_OUT_DEBUG(svcctl_SetServiceObjectSecurity, &state->orig);
933         }
934
935         tevent_req_done(req);
936 }
937
938 NTSTATUS rpccli_svcctl_SetServiceObjectSecurity_recv(struct tevent_req *req,
939                                                      TALLOC_CTX *mem_ctx,
940                                                      WERROR *result)
941 {
942         struct rpccli_svcctl_SetServiceObjectSecurity_state *state = tevent_req_data(
943                 req, struct rpccli_svcctl_SetServiceObjectSecurity_state);
944         NTSTATUS status;
945
946         if (tevent_req_is_nterror(req, &status)) {
947                 tevent_req_received(req);
948                 return status;
949         }
950
951         /* Steal possbile out parameters to the callers context */
952         talloc_steal(mem_ctx, state->out_mem_ctx);
953
954         /* Return result */
955         *result = state->orig.out.result;
956
957         tevent_req_received(req);
958         return NT_STATUS_OK;
959 }
960
961 NTSTATUS rpccli_svcctl_SetServiceObjectSecurity(struct rpc_pipe_client *cli,
962                                                 TALLOC_CTX *mem_ctx,
963                                                 struct policy_handle *handle /* [in] [ref] */,
964                                                 uint32_t security_flags /* [in]  */,
965                                                 uint8_t *buffer /* [in] [ref,size_is(offered)] */,
966                                                 uint32_t offered /* [in]  */,
967                                                 WERROR *werror)
968 {
969         struct svcctl_SetServiceObjectSecurity r;
970         NTSTATUS status;
971
972         /* In parameters */
973         r.in.handle = handle;
974         r.in.security_flags = security_flags;
975         r.in.buffer = buffer;
976         r.in.offered = offered;
977
978         if (DEBUGLEVEL >= 10) {
979                 NDR_PRINT_IN_DEBUG(svcctl_SetServiceObjectSecurity, &r);
980         }
981
982         status = cli->dispatch(cli,
983                                 mem_ctx,
984                                 &ndr_table_svcctl,
985                                 NDR_SVCCTL_SETSERVICEOBJECTSECURITY,
986                                 &r);
987
988         if (!NT_STATUS_IS_OK(status)) {
989                 return status;
990         }
991
992         if (DEBUGLEVEL >= 10) {
993                 NDR_PRINT_OUT_DEBUG(svcctl_SetServiceObjectSecurity, &r);
994         }
995
996         if (NT_STATUS_IS_ERR(status)) {
997                 return status;
998         }
999
1000         /* Return variables */
1001
1002         /* Return result */
1003         if (werror) {
1004                 *werror = r.out.result;
1005         }
1006
1007         return werror_to_ntstatus(r.out.result);
1008 }
1009
1010 struct rpccli_svcctl_QueryServiceStatus_state {
1011         struct svcctl_QueryServiceStatus orig;
1012         struct svcctl_QueryServiceStatus tmp;
1013         TALLOC_CTX *out_mem_ctx;
1014         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1015 };
1016
1017 static void rpccli_svcctl_QueryServiceStatus_done(struct tevent_req *subreq);
1018
1019 struct tevent_req *rpccli_svcctl_QueryServiceStatus_send(TALLOC_CTX *mem_ctx,
1020                                                          struct tevent_context *ev,
1021                                                          struct rpc_pipe_client *cli,
1022                                                          struct policy_handle *_handle /* [in] [ref] */,
1023                                                          struct SERVICE_STATUS *_service_status /* [out] [ref] */)
1024 {
1025         struct tevent_req *req;
1026         struct rpccli_svcctl_QueryServiceStatus_state *state;
1027         struct tevent_req *subreq;
1028
1029         req = tevent_req_create(mem_ctx, &state,
1030                                 struct rpccli_svcctl_QueryServiceStatus_state);
1031         if (req == NULL) {
1032                 return NULL;
1033         }
1034         state->out_mem_ctx = NULL;
1035         state->dispatch_recv = cli->dispatch_recv;
1036
1037         /* In parameters */
1038         state->orig.in.handle = _handle;
1039
1040         /* Out parameters */
1041         state->orig.out.service_status = _service_status;
1042
1043         /* Result */
1044         ZERO_STRUCT(state->orig.out.result);
1045
1046         if (DEBUGLEVEL >= 10) {
1047                 NDR_PRINT_IN_DEBUG(svcctl_QueryServiceStatus, &state->orig);
1048         }
1049
1050         state->out_mem_ctx = talloc_named_const(state, 0,
1051                              "rpccli_svcctl_QueryServiceStatus_out_memory");
1052         if (tevent_req_nomem(state->out_mem_ctx, req)) {
1053                 return tevent_req_post(req, ev);
1054         }
1055
1056         /* make a temporary copy, that we pass to the dispatch function */
1057         state->tmp = state->orig;
1058
1059         subreq = cli->dispatch_send(state, ev, cli,
1060                                     &ndr_table_svcctl,
1061                                     NDR_SVCCTL_QUERYSERVICESTATUS,
1062                                     &state->tmp);
1063         if (tevent_req_nomem(subreq, req)) {
1064                 return tevent_req_post(req, ev);
1065         }
1066         tevent_req_set_callback(subreq, rpccli_svcctl_QueryServiceStatus_done, req);
1067         return req;
1068 }
1069
1070 static void rpccli_svcctl_QueryServiceStatus_done(struct tevent_req *subreq)
1071 {
1072         struct tevent_req *req = tevent_req_callback_data(
1073                 subreq, struct tevent_req);
1074         struct rpccli_svcctl_QueryServiceStatus_state *state = tevent_req_data(
1075                 req, struct rpccli_svcctl_QueryServiceStatus_state);
1076         NTSTATUS status;
1077         TALLOC_CTX *mem_ctx;
1078
1079         if (state->out_mem_ctx) {
1080                 mem_ctx = state->out_mem_ctx;
1081         } else {
1082                 mem_ctx = state;
1083         }
1084
1085         status = state->dispatch_recv(subreq, mem_ctx);
1086         TALLOC_FREE(subreq);
1087         if (!NT_STATUS_IS_OK(status)) {
1088                 tevent_req_nterror(req, status);
1089                 return;
1090         }
1091
1092         /* Copy out parameters */
1093         *state->orig.out.service_status = *state->tmp.out.service_status;
1094
1095         /* Copy result */
1096         state->orig.out.result = state->tmp.out.result;
1097
1098         /* Reset temporary structure */
1099         ZERO_STRUCT(state->tmp);
1100
1101         if (DEBUGLEVEL >= 10) {
1102                 NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceStatus, &state->orig);
1103         }
1104
1105         tevent_req_done(req);
1106 }
1107
1108 NTSTATUS rpccli_svcctl_QueryServiceStatus_recv(struct tevent_req *req,
1109                                                TALLOC_CTX *mem_ctx,
1110                                                WERROR *result)
1111 {
1112         struct rpccli_svcctl_QueryServiceStatus_state *state = tevent_req_data(
1113                 req, struct rpccli_svcctl_QueryServiceStatus_state);
1114         NTSTATUS status;
1115
1116         if (tevent_req_is_nterror(req, &status)) {
1117                 tevent_req_received(req);
1118                 return status;
1119         }
1120
1121         /* Steal possbile out parameters to the callers context */
1122         talloc_steal(mem_ctx, state->out_mem_ctx);
1123
1124         /* Return result */
1125         *result = state->orig.out.result;
1126
1127         tevent_req_received(req);
1128         return NT_STATUS_OK;
1129 }
1130
1131 NTSTATUS rpccli_svcctl_QueryServiceStatus(struct rpc_pipe_client *cli,
1132                                           TALLOC_CTX *mem_ctx,
1133                                           struct policy_handle *handle /* [in] [ref] */,
1134                                           struct SERVICE_STATUS *service_status /* [out] [ref] */,
1135                                           WERROR *werror)
1136 {
1137         struct svcctl_QueryServiceStatus r;
1138         NTSTATUS status;
1139
1140         /* In parameters */
1141         r.in.handle = handle;
1142
1143         if (DEBUGLEVEL >= 10) {
1144                 NDR_PRINT_IN_DEBUG(svcctl_QueryServiceStatus, &r);
1145         }
1146
1147         status = cli->dispatch(cli,
1148                                 mem_ctx,
1149                                 &ndr_table_svcctl,
1150                                 NDR_SVCCTL_QUERYSERVICESTATUS,
1151                                 &r);
1152
1153         if (!NT_STATUS_IS_OK(status)) {
1154                 return status;
1155         }
1156
1157         if (DEBUGLEVEL >= 10) {
1158                 NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceStatus, &r);
1159         }
1160
1161         if (NT_STATUS_IS_ERR(status)) {
1162                 return status;
1163         }
1164
1165         /* Return variables */
1166         *service_status = *r.out.service_status;
1167
1168         /* Return result */
1169         if (werror) {
1170                 *werror = r.out.result;
1171         }
1172
1173         return werror_to_ntstatus(r.out.result);
1174 }
1175
1176 struct rpccli_svcctl_SetServiceStatus_state {
1177         struct svcctl_SetServiceStatus orig;
1178         struct svcctl_SetServiceStatus tmp;
1179         TALLOC_CTX *out_mem_ctx;
1180         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1181 };
1182
1183 static void rpccli_svcctl_SetServiceStatus_done(struct tevent_req *subreq);
1184
1185 struct tevent_req *rpccli_svcctl_SetServiceStatus_send(TALLOC_CTX *mem_ctx,
1186                                                        struct tevent_context *ev,
1187                                                        struct rpc_pipe_client *cli)
1188 {
1189         struct tevent_req *req;
1190         struct rpccli_svcctl_SetServiceStatus_state *state;
1191         struct tevent_req *subreq;
1192
1193         req = tevent_req_create(mem_ctx, &state,
1194                                 struct rpccli_svcctl_SetServiceStatus_state);
1195         if (req == NULL) {
1196                 return NULL;
1197         }
1198         state->out_mem_ctx = NULL;
1199         state->dispatch_recv = cli->dispatch_recv;
1200
1201         /* In parameters */
1202
1203         /* Out parameters */
1204
1205         /* Result */
1206         ZERO_STRUCT(state->orig.out.result);
1207
1208         if (DEBUGLEVEL >= 10) {
1209                 NDR_PRINT_IN_DEBUG(svcctl_SetServiceStatus, &state->orig);
1210         }
1211
1212         /* make a temporary copy, that we pass to the dispatch function */
1213         state->tmp = state->orig;
1214
1215         subreq = cli->dispatch_send(state, ev, cli,
1216                                     &ndr_table_svcctl,
1217                                     NDR_SVCCTL_SETSERVICESTATUS,
1218                                     &state->tmp);
1219         if (tevent_req_nomem(subreq, req)) {
1220                 return tevent_req_post(req, ev);
1221         }
1222         tevent_req_set_callback(subreq, rpccli_svcctl_SetServiceStatus_done, req);
1223         return req;
1224 }
1225
1226 static void rpccli_svcctl_SetServiceStatus_done(struct tevent_req *subreq)
1227 {
1228         struct tevent_req *req = tevent_req_callback_data(
1229                 subreq, struct tevent_req);
1230         struct rpccli_svcctl_SetServiceStatus_state *state = tevent_req_data(
1231                 req, struct rpccli_svcctl_SetServiceStatus_state);
1232         NTSTATUS status;
1233         TALLOC_CTX *mem_ctx;
1234
1235         if (state->out_mem_ctx) {
1236                 mem_ctx = state->out_mem_ctx;
1237         } else {
1238                 mem_ctx = state;
1239         }
1240
1241         status = state->dispatch_recv(subreq, mem_ctx);
1242         TALLOC_FREE(subreq);
1243         if (!NT_STATUS_IS_OK(status)) {
1244                 tevent_req_nterror(req, status);
1245                 return;
1246         }
1247
1248         /* Copy out parameters */
1249
1250         /* Copy result */
1251         state->orig.out.result = state->tmp.out.result;
1252
1253         /* Reset temporary structure */
1254         ZERO_STRUCT(state->tmp);
1255
1256         if (DEBUGLEVEL >= 10) {
1257                 NDR_PRINT_OUT_DEBUG(svcctl_SetServiceStatus, &state->orig);
1258         }
1259
1260         tevent_req_done(req);
1261 }
1262
1263 NTSTATUS rpccli_svcctl_SetServiceStatus_recv(struct tevent_req *req,
1264                                              TALLOC_CTX *mem_ctx,
1265                                              WERROR *result)
1266 {
1267         struct rpccli_svcctl_SetServiceStatus_state *state = tevent_req_data(
1268                 req, struct rpccli_svcctl_SetServiceStatus_state);
1269         NTSTATUS status;
1270
1271         if (tevent_req_is_nterror(req, &status)) {
1272                 tevent_req_received(req);
1273                 return status;
1274         }
1275
1276         /* Steal possbile out parameters to the callers context */
1277         talloc_steal(mem_ctx, state->out_mem_ctx);
1278
1279         /* Return result */
1280         *result = state->orig.out.result;
1281
1282         tevent_req_received(req);
1283         return NT_STATUS_OK;
1284 }
1285
1286 NTSTATUS rpccli_svcctl_SetServiceStatus(struct rpc_pipe_client *cli,
1287                                         TALLOC_CTX *mem_ctx,
1288                                         WERROR *werror)
1289 {
1290         struct svcctl_SetServiceStatus r;
1291         NTSTATUS status;
1292
1293         /* In parameters */
1294
1295         if (DEBUGLEVEL >= 10) {
1296                 NDR_PRINT_IN_DEBUG(svcctl_SetServiceStatus, &r);
1297         }
1298
1299         status = cli->dispatch(cli,
1300                                 mem_ctx,
1301                                 &ndr_table_svcctl,
1302                                 NDR_SVCCTL_SETSERVICESTATUS,
1303                                 &r);
1304
1305         if (!NT_STATUS_IS_OK(status)) {
1306                 return status;
1307         }
1308
1309         if (DEBUGLEVEL >= 10) {
1310                 NDR_PRINT_OUT_DEBUG(svcctl_SetServiceStatus, &r);
1311         }
1312
1313         if (NT_STATUS_IS_ERR(status)) {
1314                 return status;
1315         }
1316
1317         /* Return variables */
1318
1319         /* Return result */
1320         if (werror) {
1321                 *werror = r.out.result;
1322         }
1323
1324         return werror_to_ntstatus(r.out.result);
1325 }
1326
1327 struct rpccli_svcctl_UnlockServiceDatabase_state {
1328         struct svcctl_UnlockServiceDatabase orig;
1329         struct svcctl_UnlockServiceDatabase tmp;
1330         TALLOC_CTX *out_mem_ctx;
1331         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1332 };
1333
1334 static void rpccli_svcctl_UnlockServiceDatabase_done(struct tevent_req *subreq);
1335
1336 struct tevent_req *rpccli_svcctl_UnlockServiceDatabase_send(TALLOC_CTX *mem_ctx,
1337                                                             struct tevent_context *ev,
1338                                                             struct rpc_pipe_client *cli,
1339                                                             struct policy_handle *_lock /* [in,out] [ref] */)
1340 {
1341         struct tevent_req *req;
1342         struct rpccli_svcctl_UnlockServiceDatabase_state *state;
1343         struct tevent_req *subreq;
1344
1345         req = tevent_req_create(mem_ctx, &state,
1346                                 struct rpccli_svcctl_UnlockServiceDatabase_state);
1347         if (req == NULL) {
1348                 return NULL;
1349         }
1350         state->out_mem_ctx = NULL;
1351         state->dispatch_recv = cli->dispatch_recv;
1352
1353         /* In parameters */
1354         state->orig.in.lock = _lock;
1355
1356         /* Out parameters */
1357         state->orig.out.lock = _lock;
1358
1359         /* Result */
1360         ZERO_STRUCT(state->orig.out.result);
1361
1362         if (DEBUGLEVEL >= 10) {
1363                 NDR_PRINT_IN_DEBUG(svcctl_UnlockServiceDatabase, &state->orig);
1364         }
1365
1366         state->out_mem_ctx = talloc_named_const(state, 0,
1367                              "rpccli_svcctl_UnlockServiceDatabase_out_memory");
1368         if (tevent_req_nomem(state->out_mem_ctx, req)) {
1369                 return tevent_req_post(req, ev);
1370         }
1371
1372         /* make a temporary copy, that we pass to the dispatch function */
1373         state->tmp = state->orig;
1374
1375         subreq = cli->dispatch_send(state, ev, cli,
1376                                     &ndr_table_svcctl,
1377                                     NDR_SVCCTL_UNLOCKSERVICEDATABASE,
1378                                     &state->tmp);
1379         if (tevent_req_nomem(subreq, req)) {
1380                 return tevent_req_post(req, ev);
1381         }
1382         tevent_req_set_callback(subreq, rpccli_svcctl_UnlockServiceDatabase_done, req);
1383         return req;
1384 }
1385
1386 static void rpccli_svcctl_UnlockServiceDatabase_done(struct tevent_req *subreq)
1387 {
1388         struct tevent_req *req = tevent_req_callback_data(
1389                 subreq, struct tevent_req);
1390         struct rpccli_svcctl_UnlockServiceDatabase_state *state = tevent_req_data(
1391                 req, struct rpccli_svcctl_UnlockServiceDatabase_state);
1392         NTSTATUS status;
1393         TALLOC_CTX *mem_ctx;
1394
1395         if (state->out_mem_ctx) {
1396                 mem_ctx = state->out_mem_ctx;
1397         } else {
1398                 mem_ctx = state;
1399         }
1400
1401         status = state->dispatch_recv(subreq, mem_ctx);
1402         TALLOC_FREE(subreq);
1403         if (!NT_STATUS_IS_OK(status)) {
1404                 tevent_req_nterror(req, status);
1405                 return;
1406         }
1407
1408         /* Copy out parameters */
1409         *state->orig.out.lock = *state->tmp.out.lock;
1410
1411         /* Copy result */
1412         state->orig.out.result = state->tmp.out.result;
1413
1414         /* Reset temporary structure */
1415         ZERO_STRUCT(state->tmp);
1416
1417         if (DEBUGLEVEL >= 10) {
1418                 NDR_PRINT_OUT_DEBUG(svcctl_UnlockServiceDatabase, &state->orig);
1419         }
1420
1421         tevent_req_done(req);
1422 }
1423
1424 NTSTATUS rpccli_svcctl_UnlockServiceDatabase_recv(struct tevent_req *req,
1425                                                   TALLOC_CTX *mem_ctx,
1426                                                   WERROR *result)
1427 {
1428         struct rpccli_svcctl_UnlockServiceDatabase_state *state = tevent_req_data(
1429                 req, struct rpccli_svcctl_UnlockServiceDatabase_state);
1430         NTSTATUS status;
1431
1432         if (tevent_req_is_nterror(req, &status)) {
1433                 tevent_req_received(req);
1434                 return status;
1435         }
1436
1437         /* Steal possbile out parameters to the callers context */
1438         talloc_steal(mem_ctx, state->out_mem_ctx);
1439
1440         /* Return result */
1441         *result = state->orig.out.result;
1442
1443         tevent_req_received(req);
1444         return NT_STATUS_OK;
1445 }
1446
1447 NTSTATUS rpccli_svcctl_UnlockServiceDatabase(struct rpc_pipe_client *cli,
1448                                              TALLOC_CTX *mem_ctx,
1449                                              struct policy_handle *lock /* [in,out] [ref] */,
1450                                              WERROR *werror)
1451 {
1452         struct svcctl_UnlockServiceDatabase r;
1453         NTSTATUS status;
1454
1455         /* In parameters */
1456         r.in.lock = lock;
1457
1458         if (DEBUGLEVEL >= 10) {
1459                 NDR_PRINT_IN_DEBUG(svcctl_UnlockServiceDatabase, &r);
1460         }
1461
1462         status = cli->dispatch(cli,
1463                                 mem_ctx,
1464                                 &ndr_table_svcctl,
1465                                 NDR_SVCCTL_UNLOCKSERVICEDATABASE,
1466                                 &r);
1467
1468         if (!NT_STATUS_IS_OK(status)) {
1469                 return status;
1470         }
1471
1472         if (DEBUGLEVEL >= 10) {
1473                 NDR_PRINT_OUT_DEBUG(svcctl_UnlockServiceDatabase, &r);
1474         }
1475
1476         if (NT_STATUS_IS_ERR(status)) {
1477                 return status;
1478         }
1479
1480         /* Return variables */
1481         *lock = *r.out.lock;
1482
1483         /* Return result */
1484         if (werror) {
1485                 *werror = r.out.result;
1486         }
1487
1488         return werror_to_ntstatus(r.out.result);
1489 }
1490
1491 struct rpccli_svcctl_NotifyBootConfigStatus_state {
1492         struct svcctl_NotifyBootConfigStatus orig;
1493         struct svcctl_NotifyBootConfigStatus tmp;
1494         TALLOC_CTX *out_mem_ctx;
1495         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1496 };
1497
1498 static void rpccli_svcctl_NotifyBootConfigStatus_done(struct tevent_req *subreq);
1499
1500 struct tevent_req *rpccli_svcctl_NotifyBootConfigStatus_send(TALLOC_CTX *mem_ctx,
1501                                                              struct tevent_context *ev,
1502                                                              struct rpc_pipe_client *cli)
1503 {
1504         struct tevent_req *req;
1505         struct rpccli_svcctl_NotifyBootConfigStatus_state *state;
1506         struct tevent_req *subreq;
1507
1508         req = tevent_req_create(mem_ctx, &state,
1509                                 struct rpccli_svcctl_NotifyBootConfigStatus_state);
1510         if (req == NULL) {
1511                 return NULL;
1512         }
1513         state->out_mem_ctx = NULL;
1514         state->dispatch_recv = cli->dispatch_recv;
1515
1516         /* In parameters */
1517
1518         /* Out parameters */
1519
1520         /* Result */
1521         ZERO_STRUCT(state->orig.out.result);
1522
1523         if (DEBUGLEVEL >= 10) {
1524                 NDR_PRINT_IN_DEBUG(svcctl_NotifyBootConfigStatus, &state->orig);
1525         }
1526
1527         /* make a temporary copy, that we pass to the dispatch function */
1528         state->tmp = state->orig;
1529
1530         subreq = cli->dispatch_send(state, ev, cli,
1531                                     &ndr_table_svcctl,
1532                                     NDR_SVCCTL_NOTIFYBOOTCONFIGSTATUS,
1533                                     &state->tmp);
1534         if (tevent_req_nomem(subreq, req)) {
1535                 return tevent_req_post(req, ev);
1536         }
1537         tevent_req_set_callback(subreq, rpccli_svcctl_NotifyBootConfigStatus_done, req);
1538         return req;
1539 }
1540
1541 static void rpccli_svcctl_NotifyBootConfigStatus_done(struct tevent_req *subreq)
1542 {
1543         struct tevent_req *req = tevent_req_callback_data(
1544                 subreq, struct tevent_req);
1545         struct rpccli_svcctl_NotifyBootConfigStatus_state *state = tevent_req_data(
1546                 req, struct rpccli_svcctl_NotifyBootConfigStatus_state);
1547         NTSTATUS status;
1548         TALLOC_CTX *mem_ctx;
1549
1550         if (state->out_mem_ctx) {
1551                 mem_ctx = state->out_mem_ctx;
1552         } else {
1553                 mem_ctx = state;
1554         }
1555
1556         status = state->dispatch_recv(subreq, mem_ctx);
1557         TALLOC_FREE(subreq);
1558         if (!NT_STATUS_IS_OK(status)) {
1559                 tevent_req_nterror(req, status);
1560                 return;
1561         }
1562
1563         /* Copy out parameters */
1564
1565         /* Copy result */
1566         state->orig.out.result = state->tmp.out.result;
1567
1568         /* Reset temporary structure */
1569         ZERO_STRUCT(state->tmp);
1570
1571         if (DEBUGLEVEL >= 10) {
1572                 NDR_PRINT_OUT_DEBUG(svcctl_NotifyBootConfigStatus, &state->orig);
1573         }
1574
1575         tevent_req_done(req);
1576 }
1577
1578 NTSTATUS rpccli_svcctl_NotifyBootConfigStatus_recv(struct tevent_req *req,
1579                                                    TALLOC_CTX *mem_ctx,
1580                                                    WERROR *result)
1581 {
1582         struct rpccli_svcctl_NotifyBootConfigStatus_state *state = tevent_req_data(
1583                 req, struct rpccli_svcctl_NotifyBootConfigStatus_state);
1584         NTSTATUS status;
1585
1586         if (tevent_req_is_nterror(req, &status)) {
1587                 tevent_req_received(req);
1588                 return status;
1589         }
1590
1591         /* Steal possbile out parameters to the callers context */
1592         talloc_steal(mem_ctx, state->out_mem_ctx);
1593
1594         /* Return result */
1595         *result = state->orig.out.result;
1596
1597         tevent_req_received(req);
1598         return NT_STATUS_OK;
1599 }
1600
1601 NTSTATUS rpccli_svcctl_NotifyBootConfigStatus(struct rpc_pipe_client *cli,
1602                                               TALLOC_CTX *mem_ctx,
1603                                               WERROR *werror)
1604 {
1605         struct svcctl_NotifyBootConfigStatus r;
1606         NTSTATUS status;
1607
1608         /* In parameters */
1609
1610         if (DEBUGLEVEL >= 10) {
1611                 NDR_PRINT_IN_DEBUG(svcctl_NotifyBootConfigStatus, &r);
1612         }
1613
1614         status = cli->dispatch(cli,
1615                                 mem_ctx,
1616                                 &ndr_table_svcctl,
1617                                 NDR_SVCCTL_NOTIFYBOOTCONFIGSTATUS,
1618                                 &r);
1619
1620         if (!NT_STATUS_IS_OK(status)) {
1621                 return status;
1622         }
1623
1624         if (DEBUGLEVEL >= 10) {
1625                 NDR_PRINT_OUT_DEBUG(svcctl_NotifyBootConfigStatus, &r);
1626         }
1627
1628         if (NT_STATUS_IS_ERR(status)) {
1629                 return status;
1630         }
1631
1632         /* Return variables */
1633
1634         /* Return result */
1635         if (werror) {
1636                 *werror = r.out.result;
1637         }
1638
1639         return werror_to_ntstatus(r.out.result);
1640 }
1641
1642 struct rpccli_svcctl_SCSetServiceBitsW_state {
1643         struct svcctl_SCSetServiceBitsW orig;
1644         struct svcctl_SCSetServiceBitsW tmp;
1645         TALLOC_CTX *out_mem_ctx;
1646         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1647 };
1648
1649 static void rpccli_svcctl_SCSetServiceBitsW_done(struct tevent_req *subreq);
1650
1651 struct tevent_req *rpccli_svcctl_SCSetServiceBitsW_send(TALLOC_CTX *mem_ctx,
1652                                                         struct tevent_context *ev,
1653                                                         struct rpc_pipe_client *cli,
1654                                                         struct policy_handle *_handle /* [in] [ref] */,
1655                                                         uint32_t _bits /* [in]  */,
1656                                                         uint32_t _bitson /* [in]  */,
1657                                                         uint32_t _immediate /* [in]  */)
1658 {
1659         struct tevent_req *req;
1660         struct rpccli_svcctl_SCSetServiceBitsW_state *state;
1661         struct tevent_req *subreq;
1662
1663         req = tevent_req_create(mem_ctx, &state,
1664                                 struct rpccli_svcctl_SCSetServiceBitsW_state);
1665         if (req == NULL) {
1666                 return NULL;
1667         }
1668         state->out_mem_ctx = NULL;
1669         state->dispatch_recv = cli->dispatch_recv;
1670
1671         /* In parameters */
1672         state->orig.in.handle = _handle;
1673         state->orig.in.bits = _bits;
1674         state->orig.in.bitson = _bitson;
1675         state->orig.in.immediate = _immediate;
1676
1677         /* Out parameters */
1678
1679         /* Result */
1680         ZERO_STRUCT(state->orig.out.result);
1681
1682         if (DEBUGLEVEL >= 10) {
1683                 NDR_PRINT_IN_DEBUG(svcctl_SCSetServiceBitsW, &state->orig);
1684         }
1685
1686         /* make a temporary copy, that we pass to the dispatch function */
1687         state->tmp = state->orig;
1688
1689         subreq = cli->dispatch_send(state, ev, cli,
1690                                     &ndr_table_svcctl,
1691                                     NDR_SVCCTL_SCSETSERVICEBITSW,
1692                                     &state->tmp);
1693         if (tevent_req_nomem(subreq, req)) {
1694                 return tevent_req_post(req, ev);
1695         }
1696         tevent_req_set_callback(subreq, rpccli_svcctl_SCSetServiceBitsW_done, req);
1697         return req;
1698 }
1699
1700 static void rpccli_svcctl_SCSetServiceBitsW_done(struct tevent_req *subreq)
1701 {
1702         struct tevent_req *req = tevent_req_callback_data(
1703                 subreq, struct tevent_req);
1704         struct rpccli_svcctl_SCSetServiceBitsW_state *state = tevent_req_data(
1705                 req, struct rpccli_svcctl_SCSetServiceBitsW_state);
1706         NTSTATUS status;
1707         TALLOC_CTX *mem_ctx;
1708
1709         if (state->out_mem_ctx) {
1710                 mem_ctx = state->out_mem_ctx;
1711         } else {
1712                 mem_ctx = state;
1713         }
1714
1715         status = state->dispatch_recv(subreq, mem_ctx);
1716         TALLOC_FREE(subreq);
1717         if (!NT_STATUS_IS_OK(status)) {
1718                 tevent_req_nterror(req, status);
1719                 return;
1720         }
1721
1722         /* Copy out parameters */
1723
1724         /* Copy result */
1725         state->orig.out.result = state->tmp.out.result;
1726
1727         /* Reset temporary structure */
1728         ZERO_STRUCT(state->tmp);
1729
1730         if (DEBUGLEVEL >= 10) {
1731                 NDR_PRINT_OUT_DEBUG(svcctl_SCSetServiceBitsW, &state->orig);
1732         }
1733
1734         tevent_req_done(req);
1735 }
1736
1737 NTSTATUS rpccli_svcctl_SCSetServiceBitsW_recv(struct tevent_req *req,
1738                                               TALLOC_CTX *mem_ctx,
1739                                               WERROR *result)
1740 {
1741         struct rpccli_svcctl_SCSetServiceBitsW_state *state = tevent_req_data(
1742                 req, struct rpccli_svcctl_SCSetServiceBitsW_state);
1743         NTSTATUS status;
1744
1745         if (tevent_req_is_nterror(req, &status)) {
1746                 tevent_req_received(req);
1747                 return status;
1748         }
1749
1750         /* Steal possbile out parameters to the callers context */
1751         talloc_steal(mem_ctx, state->out_mem_ctx);
1752
1753         /* Return result */
1754         *result = state->orig.out.result;
1755
1756         tevent_req_received(req);
1757         return NT_STATUS_OK;
1758 }
1759
1760 NTSTATUS rpccli_svcctl_SCSetServiceBitsW(struct rpc_pipe_client *cli,
1761                                          TALLOC_CTX *mem_ctx,
1762                                          struct policy_handle *handle /* [in] [ref] */,
1763                                          uint32_t bits /* [in]  */,
1764                                          uint32_t bitson /* [in]  */,
1765                                          uint32_t immediate /* [in]  */,
1766                                          WERROR *werror)
1767 {
1768         struct svcctl_SCSetServiceBitsW r;
1769         NTSTATUS status;
1770
1771         /* In parameters */
1772         r.in.handle = handle;
1773         r.in.bits = bits;
1774         r.in.bitson = bitson;
1775         r.in.immediate = immediate;
1776
1777         if (DEBUGLEVEL >= 10) {
1778                 NDR_PRINT_IN_DEBUG(svcctl_SCSetServiceBitsW, &r);
1779         }
1780
1781         status = cli->dispatch(cli,
1782                                 mem_ctx,
1783                                 &ndr_table_svcctl,
1784                                 NDR_SVCCTL_SCSETSERVICEBITSW,
1785                                 &r);
1786
1787         if (!NT_STATUS_IS_OK(status)) {
1788                 return status;
1789         }
1790
1791         if (DEBUGLEVEL >= 10) {
1792                 NDR_PRINT_OUT_DEBUG(svcctl_SCSetServiceBitsW, &r);
1793         }
1794
1795         if (NT_STATUS_IS_ERR(status)) {
1796                 return status;
1797         }
1798
1799         /* Return variables */
1800
1801         /* Return result */
1802         if (werror) {
1803                 *werror = r.out.result;
1804         }
1805
1806         return werror_to_ntstatus(r.out.result);
1807 }
1808
1809 struct rpccli_svcctl_ChangeServiceConfigW_state {
1810         struct svcctl_ChangeServiceConfigW orig;
1811         struct svcctl_ChangeServiceConfigW tmp;
1812         TALLOC_CTX *out_mem_ctx;
1813         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1814 };
1815
1816 static void rpccli_svcctl_ChangeServiceConfigW_done(struct tevent_req *subreq);
1817
1818 struct tevent_req *rpccli_svcctl_ChangeServiceConfigW_send(TALLOC_CTX *mem_ctx,
1819                                                            struct tevent_context *ev,
1820                                                            struct rpc_pipe_client *cli,
1821                                                            struct policy_handle *_handle /* [in] [ref] */,
1822                                                            uint32_t _type /* [in]  */,
1823                                                            enum svcctl_StartType _start_type /* [in]  */,
1824                                                            enum svcctl_ErrorControl _error_control /* [in]  */,
1825                                                            const char *_binary_path /* [in] [unique,charset(UTF16)] */,
1826                                                            const char *_load_order_group /* [in] [unique,charset(UTF16)] */,
1827                                                            uint32_t *_tag_id /* [out] [ref] */,
1828                                                            const char *_dependencies /* [in] [unique,charset(UTF16)] */,
1829                                                            const char *_service_start_name /* [in] [unique,charset(UTF16)] */,
1830                                                            const char *_password /* [in] [unique,charset(UTF16)] */,
1831                                                            const char *_display_name /* [in] [unique,charset(UTF16)] */)
1832 {
1833         struct tevent_req *req;
1834         struct rpccli_svcctl_ChangeServiceConfigW_state *state;
1835         struct tevent_req *subreq;
1836
1837         req = tevent_req_create(mem_ctx, &state,
1838                                 struct rpccli_svcctl_ChangeServiceConfigW_state);
1839         if (req == NULL) {
1840                 return NULL;
1841         }
1842         state->out_mem_ctx = NULL;
1843         state->dispatch_recv = cli->dispatch_recv;
1844
1845         /* In parameters */
1846         state->orig.in.handle = _handle;
1847         state->orig.in.type = _type;
1848         state->orig.in.start_type = _start_type;
1849         state->orig.in.error_control = _error_control;
1850         state->orig.in.binary_path = _binary_path;
1851         state->orig.in.load_order_group = _load_order_group;
1852         state->orig.in.dependencies = _dependencies;
1853         state->orig.in.service_start_name = _service_start_name;
1854         state->orig.in.password = _password;
1855         state->orig.in.display_name = _display_name;
1856
1857         /* Out parameters */
1858         state->orig.out.tag_id = _tag_id;
1859
1860         /* Result */
1861         ZERO_STRUCT(state->orig.out.result);
1862
1863         if (DEBUGLEVEL >= 10) {
1864                 NDR_PRINT_IN_DEBUG(svcctl_ChangeServiceConfigW, &state->orig);
1865         }
1866
1867         state->out_mem_ctx = talloc_named_const(state, 0,
1868                              "rpccli_svcctl_ChangeServiceConfigW_out_memory");
1869         if (tevent_req_nomem(state->out_mem_ctx, req)) {
1870                 return tevent_req_post(req, ev);
1871         }
1872
1873         /* make a temporary copy, that we pass to the dispatch function */
1874         state->tmp = state->orig;
1875
1876         subreq = cli->dispatch_send(state, ev, cli,
1877                                     &ndr_table_svcctl,
1878                                     NDR_SVCCTL_CHANGESERVICECONFIGW,
1879                                     &state->tmp);
1880         if (tevent_req_nomem(subreq, req)) {
1881                 return tevent_req_post(req, ev);
1882         }
1883         tevent_req_set_callback(subreq, rpccli_svcctl_ChangeServiceConfigW_done, req);
1884         return req;
1885 }
1886
1887 static void rpccli_svcctl_ChangeServiceConfigW_done(struct tevent_req *subreq)
1888 {
1889         struct tevent_req *req = tevent_req_callback_data(
1890                 subreq, struct tevent_req);
1891         struct rpccli_svcctl_ChangeServiceConfigW_state *state = tevent_req_data(
1892                 req, struct rpccli_svcctl_ChangeServiceConfigW_state);
1893         NTSTATUS status;
1894         TALLOC_CTX *mem_ctx;
1895
1896         if (state->out_mem_ctx) {
1897                 mem_ctx = state->out_mem_ctx;
1898         } else {
1899                 mem_ctx = state;
1900         }
1901
1902         status = state->dispatch_recv(subreq, mem_ctx);
1903         TALLOC_FREE(subreq);
1904         if (!NT_STATUS_IS_OK(status)) {
1905                 tevent_req_nterror(req, status);
1906                 return;
1907         }
1908
1909         /* Copy out parameters */
1910         *state->orig.out.tag_id = *state->tmp.out.tag_id;
1911
1912         /* Copy result */
1913         state->orig.out.result = state->tmp.out.result;
1914
1915         /* Reset temporary structure */
1916         ZERO_STRUCT(state->tmp);
1917
1918         if (DEBUGLEVEL >= 10) {
1919                 NDR_PRINT_OUT_DEBUG(svcctl_ChangeServiceConfigW, &state->orig);
1920         }
1921
1922         tevent_req_done(req);
1923 }
1924
1925 NTSTATUS rpccli_svcctl_ChangeServiceConfigW_recv(struct tevent_req *req,
1926                                                  TALLOC_CTX *mem_ctx,
1927                                                  WERROR *result)
1928 {
1929         struct rpccli_svcctl_ChangeServiceConfigW_state *state = tevent_req_data(
1930                 req, struct rpccli_svcctl_ChangeServiceConfigW_state);
1931         NTSTATUS status;
1932
1933         if (tevent_req_is_nterror(req, &status)) {
1934                 tevent_req_received(req);
1935                 return status;
1936         }
1937
1938         /* Steal possbile out parameters to the callers context */
1939         talloc_steal(mem_ctx, state->out_mem_ctx);
1940
1941         /* Return result */
1942         *result = state->orig.out.result;
1943
1944         tevent_req_received(req);
1945         return NT_STATUS_OK;
1946 }
1947
1948 NTSTATUS rpccli_svcctl_ChangeServiceConfigW(struct rpc_pipe_client *cli,
1949                                             TALLOC_CTX *mem_ctx,
1950                                             struct policy_handle *handle /* [in] [ref] */,
1951                                             uint32_t type /* [in]  */,
1952                                             enum svcctl_StartType start_type /* [in]  */,
1953                                             enum svcctl_ErrorControl error_control /* [in]  */,
1954                                             const char *binary_path /* [in] [unique,charset(UTF16)] */,
1955                                             const char *load_order_group /* [in] [unique,charset(UTF16)] */,
1956                                             uint32_t *tag_id /* [out] [ref] */,
1957                                             const char *dependencies /* [in] [unique,charset(UTF16)] */,
1958                                             const char *service_start_name /* [in] [unique,charset(UTF16)] */,
1959                                             const char *password /* [in] [unique,charset(UTF16)] */,
1960                                             const char *display_name /* [in] [unique,charset(UTF16)] */,
1961                                             WERROR *werror)
1962 {
1963         struct svcctl_ChangeServiceConfigW r;
1964         NTSTATUS status;
1965
1966         /* In parameters */
1967         r.in.handle = handle;
1968         r.in.type = type;
1969         r.in.start_type = start_type;
1970         r.in.error_control = error_control;
1971         r.in.binary_path = binary_path;
1972         r.in.load_order_group = load_order_group;
1973         r.in.dependencies = dependencies;
1974         r.in.service_start_name = service_start_name;
1975         r.in.password = password;
1976         r.in.display_name = display_name;
1977
1978         if (DEBUGLEVEL >= 10) {
1979                 NDR_PRINT_IN_DEBUG(svcctl_ChangeServiceConfigW, &r);
1980         }
1981
1982         status = cli->dispatch(cli,
1983                                 mem_ctx,
1984                                 &ndr_table_svcctl,
1985                                 NDR_SVCCTL_CHANGESERVICECONFIGW,
1986                                 &r);
1987
1988         if (!NT_STATUS_IS_OK(status)) {
1989                 return status;
1990         }
1991
1992         if (DEBUGLEVEL >= 10) {
1993                 NDR_PRINT_OUT_DEBUG(svcctl_ChangeServiceConfigW, &r);
1994         }
1995
1996         if (NT_STATUS_IS_ERR(status)) {
1997                 return status;
1998         }
1999
2000         /* Return variables */
2001         *tag_id = *r.out.tag_id;
2002
2003         /* Return result */
2004         if (werror) {
2005                 *werror = r.out.result;
2006         }
2007
2008         return werror_to_ntstatus(r.out.result);
2009 }
2010
2011 struct rpccli_svcctl_CreateServiceW_state {
2012         struct svcctl_CreateServiceW orig;
2013         struct svcctl_CreateServiceW tmp;
2014         TALLOC_CTX *out_mem_ctx;
2015         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2016 };
2017
2018 static void rpccli_svcctl_CreateServiceW_done(struct tevent_req *subreq);
2019
2020 struct tevent_req *rpccli_svcctl_CreateServiceW_send(TALLOC_CTX *mem_ctx,
2021                                                      struct tevent_context *ev,
2022                                                      struct rpc_pipe_client *cli,
2023                                                      struct policy_handle *_scmanager_handle /* [in] [ref] */,
2024                                                      const char *_ServiceName /* [in] [charset(UTF16)] */,
2025                                                      const char *_DisplayName /* [in] [unique,charset(UTF16)] */,
2026                                                      uint32_t _desired_access /* [in]  */,
2027                                                      uint32_t _type /* [in]  */,
2028                                                      enum svcctl_StartType _start_type /* [in]  */,
2029                                                      enum svcctl_ErrorControl _error_control /* [in]  */,
2030                                                      const char *_binary_path /* [in] [charset(UTF16)] */,
2031                                                      const char *_LoadOrderGroupKey /* [in] [unique,charset(UTF16)] */,
2032                                                      uint32_t *_TagId /* [in,out] [unique] */,
2033                                                      uint8_t *_dependencies /* [in] [unique,size_is(dependencies_size)] */,
2034                                                      uint32_t _dependencies_size /* [in]  */,
2035                                                      const char *_service_start_name /* [in] [unique,charset(UTF16)] */,
2036                                                      uint8_t *_password /* [in] [unique,size_is(password_size)] */,
2037                                                      uint32_t _password_size /* [in]  */,
2038                                                      struct policy_handle *_handle /* [out] [ref] */)
2039 {
2040         struct tevent_req *req;
2041         struct rpccli_svcctl_CreateServiceW_state *state;
2042         struct tevent_req *subreq;
2043
2044         req = tevent_req_create(mem_ctx, &state,
2045                                 struct rpccli_svcctl_CreateServiceW_state);
2046         if (req == NULL) {
2047                 return NULL;
2048         }
2049         state->out_mem_ctx = NULL;
2050         state->dispatch_recv = cli->dispatch_recv;
2051
2052         /* In parameters */
2053         state->orig.in.scmanager_handle = _scmanager_handle;
2054         state->orig.in.ServiceName = _ServiceName;
2055         state->orig.in.DisplayName = _DisplayName;
2056         state->orig.in.desired_access = _desired_access;
2057         state->orig.in.type = _type;
2058         state->orig.in.start_type = _start_type;
2059         state->orig.in.error_control = _error_control;
2060         state->orig.in.binary_path = _binary_path;
2061         state->orig.in.LoadOrderGroupKey = _LoadOrderGroupKey;
2062         state->orig.in.TagId = _TagId;
2063         state->orig.in.dependencies = _dependencies;
2064         state->orig.in.dependencies_size = _dependencies_size;
2065         state->orig.in.service_start_name = _service_start_name;
2066         state->orig.in.password = _password;
2067         state->orig.in.password_size = _password_size;
2068
2069         /* Out parameters */
2070         state->orig.out.TagId = _TagId;
2071         state->orig.out.handle = _handle;
2072
2073         /* Result */
2074         ZERO_STRUCT(state->orig.out.result);
2075
2076         if (DEBUGLEVEL >= 10) {
2077                 NDR_PRINT_IN_DEBUG(svcctl_CreateServiceW, &state->orig);
2078         }
2079
2080         state->out_mem_ctx = talloc_named_const(state, 0,
2081                              "rpccli_svcctl_CreateServiceW_out_memory");
2082         if (tevent_req_nomem(state->out_mem_ctx, req)) {
2083                 return tevent_req_post(req, ev);
2084         }
2085
2086         /* make a temporary copy, that we pass to the dispatch function */
2087         state->tmp = state->orig;
2088
2089         subreq = cli->dispatch_send(state, ev, cli,
2090                                     &ndr_table_svcctl,
2091                                     NDR_SVCCTL_CREATESERVICEW,
2092                                     &state->tmp);
2093         if (tevent_req_nomem(subreq, req)) {
2094                 return tevent_req_post(req, ev);
2095         }
2096         tevent_req_set_callback(subreq, rpccli_svcctl_CreateServiceW_done, req);
2097         return req;
2098 }
2099
2100 static void rpccli_svcctl_CreateServiceW_done(struct tevent_req *subreq)
2101 {
2102         struct tevent_req *req = tevent_req_callback_data(
2103                 subreq, struct tevent_req);
2104         struct rpccli_svcctl_CreateServiceW_state *state = tevent_req_data(
2105                 req, struct rpccli_svcctl_CreateServiceW_state);
2106         NTSTATUS status;
2107         TALLOC_CTX *mem_ctx;
2108
2109         if (state->out_mem_ctx) {
2110                 mem_ctx = state->out_mem_ctx;
2111         } else {
2112                 mem_ctx = state;
2113         }
2114
2115         status = state->dispatch_recv(subreq, mem_ctx);
2116         TALLOC_FREE(subreq);
2117         if (!NT_STATUS_IS_OK(status)) {
2118                 tevent_req_nterror(req, status);
2119                 return;
2120         }
2121
2122         /* Copy out parameters */
2123         if (state->orig.out.TagId && state->tmp.out.TagId) {
2124                 *state->orig.out.TagId = *state->tmp.out.TagId;
2125         }
2126         *state->orig.out.handle = *state->tmp.out.handle;
2127
2128         /* Copy result */
2129         state->orig.out.result = state->tmp.out.result;
2130
2131         /* Reset temporary structure */
2132         ZERO_STRUCT(state->tmp);
2133
2134         if (DEBUGLEVEL >= 10) {
2135                 NDR_PRINT_OUT_DEBUG(svcctl_CreateServiceW, &state->orig);
2136         }
2137
2138         tevent_req_done(req);
2139 }
2140
2141 NTSTATUS rpccli_svcctl_CreateServiceW_recv(struct tevent_req *req,
2142                                            TALLOC_CTX *mem_ctx,
2143                                            WERROR *result)
2144 {
2145         struct rpccli_svcctl_CreateServiceW_state *state = tevent_req_data(
2146                 req, struct rpccli_svcctl_CreateServiceW_state);
2147         NTSTATUS status;
2148
2149         if (tevent_req_is_nterror(req, &status)) {
2150                 tevent_req_received(req);
2151                 return status;
2152         }
2153
2154         /* Steal possbile out parameters to the callers context */
2155         talloc_steal(mem_ctx, state->out_mem_ctx);
2156
2157         /* Return result */
2158         *result = state->orig.out.result;
2159
2160         tevent_req_received(req);
2161         return NT_STATUS_OK;
2162 }
2163
2164 NTSTATUS rpccli_svcctl_CreateServiceW(struct rpc_pipe_client *cli,
2165                                       TALLOC_CTX *mem_ctx,
2166                                       struct policy_handle *scmanager_handle /* [in] [ref] */,
2167                                       const char *ServiceName /* [in] [charset(UTF16)] */,
2168                                       const char *DisplayName /* [in] [unique,charset(UTF16)] */,
2169                                       uint32_t desired_access /* [in]  */,
2170                                       uint32_t type /* [in]  */,
2171                                       enum svcctl_StartType start_type /* [in]  */,
2172                                       enum svcctl_ErrorControl error_control /* [in]  */,
2173                                       const char *binary_path /* [in] [charset(UTF16)] */,
2174                                       const char *LoadOrderGroupKey /* [in] [unique,charset(UTF16)] */,
2175                                       uint32_t *TagId /* [in,out] [unique] */,
2176                                       uint8_t *dependencies /* [in] [unique,size_is(dependencies_size)] */,
2177                                       uint32_t dependencies_size /* [in]  */,
2178                                       const char *service_start_name /* [in] [unique,charset(UTF16)] */,
2179                                       uint8_t *password /* [in] [unique,size_is(password_size)] */,
2180                                       uint32_t password_size /* [in]  */,
2181                                       struct policy_handle *handle /* [out] [ref] */,
2182                                       WERROR *werror)
2183 {
2184         struct svcctl_CreateServiceW r;
2185         NTSTATUS status;
2186
2187         /* In parameters */
2188         r.in.scmanager_handle = scmanager_handle;
2189         r.in.ServiceName = ServiceName;
2190         r.in.DisplayName = DisplayName;
2191         r.in.desired_access = desired_access;
2192         r.in.type = type;
2193         r.in.start_type = start_type;
2194         r.in.error_control = error_control;
2195         r.in.binary_path = binary_path;
2196         r.in.LoadOrderGroupKey = LoadOrderGroupKey;
2197         r.in.TagId = TagId;
2198         r.in.dependencies = dependencies;
2199         r.in.dependencies_size = dependencies_size;
2200         r.in.service_start_name = service_start_name;
2201         r.in.password = password;
2202         r.in.password_size = password_size;
2203
2204         if (DEBUGLEVEL >= 10) {
2205                 NDR_PRINT_IN_DEBUG(svcctl_CreateServiceW, &r);
2206         }
2207
2208         status = cli->dispatch(cli,
2209                                 mem_ctx,
2210                                 &ndr_table_svcctl,
2211                                 NDR_SVCCTL_CREATESERVICEW,
2212                                 &r);
2213
2214         if (!NT_STATUS_IS_OK(status)) {
2215                 return status;
2216         }
2217
2218         if (DEBUGLEVEL >= 10) {
2219                 NDR_PRINT_OUT_DEBUG(svcctl_CreateServiceW, &r);
2220         }
2221
2222         if (NT_STATUS_IS_ERR(status)) {
2223                 return status;
2224         }
2225
2226         /* Return variables */
2227         if (TagId && r.out.TagId) {
2228                 *TagId = *r.out.TagId;
2229         }
2230         *handle = *r.out.handle;
2231
2232         /* Return result */
2233         if (werror) {
2234                 *werror = r.out.result;
2235         }
2236
2237         return werror_to_ntstatus(r.out.result);
2238 }
2239
2240 struct rpccli_svcctl_EnumDependentServicesW_state {
2241         struct svcctl_EnumDependentServicesW orig;
2242         struct svcctl_EnumDependentServicesW tmp;
2243         TALLOC_CTX *out_mem_ctx;
2244         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2245 };
2246
2247 static void rpccli_svcctl_EnumDependentServicesW_done(struct tevent_req *subreq);
2248
2249 struct tevent_req *rpccli_svcctl_EnumDependentServicesW_send(TALLOC_CTX *mem_ctx,
2250                                                              struct tevent_context *ev,
2251                                                              struct rpc_pipe_client *cli,
2252                                                              struct policy_handle *_service /* [in] [ref] */,
2253                                                              enum svcctl_ServiceState _state /* [in]  */,
2254                                                              uint8_t *_service_status /* [out] [ref,size_is(offered)] */,
2255                                                              uint32_t _offered /* [in] [range(0,0x40000)] */,
2256                                                              uint32_t *_needed /* [out] [ref,range(0,0x40000)] */,
2257                                                              uint32_t *_services_returned /* [out] [ref,range(0,0x40000)] */)
2258 {
2259         struct tevent_req *req;
2260         struct rpccli_svcctl_EnumDependentServicesW_state *state;
2261         struct tevent_req *subreq;
2262
2263         req = tevent_req_create(mem_ctx, &state,
2264                                 struct rpccli_svcctl_EnumDependentServicesW_state);
2265         if (req == NULL) {
2266                 return NULL;
2267         }
2268         state->out_mem_ctx = NULL;
2269         state->dispatch_recv = cli->dispatch_recv;
2270
2271         /* In parameters */
2272         state->orig.in.service = _service;
2273         state->orig.in.state = _state;
2274         state->orig.in.offered = _offered;
2275
2276         /* Out parameters */
2277         state->orig.out.service_status = _service_status;
2278         state->orig.out.needed = _needed;
2279         state->orig.out.services_returned = _services_returned;
2280
2281         /* Result */
2282         ZERO_STRUCT(state->orig.out.result);
2283
2284         if (DEBUGLEVEL >= 10) {
2285                 NDR_PRINT_IN_DEBUG(svcctl_EnumDependentServicesW, &state->orig);
2286         }
2287
2288         state->out_mem_ctx = talloc_named_const(state, 0,
2289                              "rpccli_svcctl_EnumDependentServicesW_out_memory");
2290         if (tevent_req_nomem(state->out_mem_ctx, req)) {
2291                 return tevent_req_post(req, ev);
2292         }
2293
2294         /* make a temporary copy, that we pass to the dispatch function */
2295         state->tmp = state->orig;
2296
2297         subreq = cli->dispatch_send(state, ev, cli,
2298                                     &ndr_table_svcctl,
2299                                     NDR_SVCCTL_ENUMDEPENDENTSERVICESW,
2300                                     &state->tmp);
2301         if (tevent_req_nomem(subreq, req)) {
2302                 return tevent_req_post(req, ev);
2303         }
2304         tevent_req_set_callback(subreq, rpccli_svcctl_EnumDependentServicesW_done, req);
2305         return req;
2306 }
2307
2308 static void rpccli_svcctl_EnumDependentServicesW_done(struct tevent_req *subreq)
2309 {
2310         struct tevent_req *req = tevent_req_callback_data(
2311                 subreq, struct tevent_req);
2312         struct rpccli_svcctl_EnumDependentServicesW_state *state = tevent_req_data(
2313                 req, struct rpccli_svcctl_EnumDependentServicesW_state);
2314         NTSTATUS status;
2315         TALLOC_CTX *mem_ctx;
2316
2317         if (state->out_mem_ctx) {
2318                 mem_ctx = state->out_mem_ctx;
2319         } else {
2320                 mem_ctx = state;
2321         }
2322
2323         status = state->dispatch_recv(subreq, mem_ctx);
2324         TALLOC_FREE(subreq);
2325         if (!NT_STATUS_IS_OK(status)) {
2326                 tevent_req_nterror(req, status);
2327                 return;
2328         }
2329
2330         /* Copy out parameters */
2331         memcpy(state->orig.out.service_status, state->tmp.out.service_status, state->tmp.in.offered * sizeof(*state->orig.out.service_status));
2332         *state->orig.out.needed = *state->tmp.out.needed;
2333         *state->orig.out.services_returned = *state->tmp.out.services_returned;
2334
2335         /* Copy result */
2336         state->orig.out.result = state->tmp.out.result;
2337
2338         /* Reset temporary structure */
2339         ZERO_STRUCT(state->tmp);
2340
2341         if (DEBUGLEVEL >= 10) {
2342                 NDR_PRINT_OUT_DEBUG(svcctl_EnumDependentServicesW, &state->orig);
2343         }
2344
2345         tevent_req_done(req);
2346 }
2347
2348 NTSTATUS rpccli_svcctl_EnumDependentServicesW_recv(struct tevent_req *req,
2349                                                    TALLOC_CTX *mem_ctx,
2350                                                    WERROR *result)
2351 {
2352         struct rpccli_svcctl_EnumDependentServicesW_state *state = tevent_req_data(
2353                 req, struct rpccli_svcctl_EnumDependentServicesW_state);
2354         NTSTATUS status;
2355
2356         if (tevent_req_is_nterror(req, &status)) {
2357                 tevent_req_received(req);
2358                 return status;
2359         }
2360
2361         /* Steal possbile out parameters to the callers context */
2362         talloc_steal(mem_ctx, state->out_mem_ctx);
2363
2364         /* Return result */
2365         *result = state->orig.out.result;
2366
2367         tevent_req_received(req);
2368         return NT_STATUS_OK;
2369 }
2370
2371 NTSTATUS rpccli_svcctl_EnumDependentServicesW(struct rpc_pipe_client *cli,
2372                                               TALLOC_CTX *mem_ctx,
2373                                               struct policy_handle *service /* [in] [ref] */,
2374                                               enum svcctl_ServiceState state /* [in]  */,
2375                                               uint8_t *service_status /* [out] [ref,size_is(offered)] */,
2376                                               uint32_t offered /* [in] [range(0,0x40000)] */,
2377                                               uint32_t *needed /* [out] [ref,range(0,0x40000)] */,
2378                                               uint32_t *services_returned /* [out] [ref,range(0,0x40000)] */,
2379                                               WERROR *werror)
2380 {
2381         struct svcctl_EnumDependentServicesW r;
2382         NTSTATUS status;
2383
2384         /* In parameters */
2385         r.in.service = service;
2386         r.in.state = state;
2387         r.in.offered = offered;
2388
2389         if (DEBUGLEVEL >= 10) {
2390                 NDR_PRINT_IN_DEBUG(svcctl_EnumDependentServicesW, &r);
2391         }
2392
2393         status = cli->dispatch(cli,
2394                                 mem_ctx,
2395                                 &ndr_table_svcctl,
2396                                 NDR_SVCCTL_ENUMDEPENDENTSERVICESW,
2397                                 &r);
2398
2399         if (!NT_STATUS_IS_OK(status)) {
2400                 return status;
2401         }
2402
2403         if (DEBUGLEVEL >= 10) {
2404                 NDR_PRINT_OUT_DEBUG(svcctl_EnumDependentServicesW, &r);
2405         }
2406
2407         if (NT_STATUS_IS_ERR(status)) {
2408                 return status;
2409         }
2410
2411         /* Return variables */
2412         memcpy(service_status, r.out.service_status, r.in.offered * sizeof(*service_status));
2413         *needed = *r.out.needed;
2414         *services_returned = *r.out.services_returned;
2415
2416         /* Return result */
2417         if (werror) {
2418                 *werror = r.out.result;
2419         }
2420
2421         return werror_to_ntstatus(r.out.result);
2422 }
2423
2424 struct rpccli_svcctl_EnumServicesStatusW_state {
2425         struct svcctl_EnumServicesStatusW orig;
2426         struct svcctl_EnumServicesStatusW tmp;
2427         TALLOC_CTX *out_mem_ctx;
2428         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2429 };
2430
2431 static void rpccli_svcctl_EnumServicesStatusW_done(struct tevent_req *subreq);
2432
2433 struct tevent_req *rpccli_svcctl_EnumServicesStatusW_send(TALLOC_CTX *mem_ctx,
2434                                                           struct tevent_context *ev,
2435                                                           struct rpc_pipe_client *cli,
2436                                                           struct policy_handle *_handle /* [in] [ref] */,
2437                                                           uint32_t _type /* [in]  */,
2438                                                           enum svcctl_ServiceState _state /* [in]  */,
2439                                                           uint8_t *_service /* [out] [ref,size_is(offered)] */,
2440                                                           uint32_t _offered /* [in] [range(0,0x40000)] */,
2441                                                           uint32_t *_needed /* [out] [ref,range(0,0x40000)] */,
2442                                                           uint32_t *_services_returned /* [out] [ref,range(0,0x40000)] */,
2443                                                           uint32_t *_resume_handle /* [in,out] [unique] */)
2444 {
2445         struct tevent_req *req;
2446         struct rpccli_svcctl_EnumServicesStatusW_state *state;
2447         struct tevent_req *subreq;
2448
2449         req = tevent_req_create(mem_ctx, &state,
2450                                 struct rpccli_svcctl_EnumServicesStatusW_state);
2451         if (req == NULL) {
2452                 return NULL;
2453         }
2454         state->out_mem_ctx = NULL;
2455         state->dispatch_recv = cli->dispatch_recv;
2456
2457         /* In parameters */
2458         state->orig.in.handle = _handle;
2459         state->orig.in.type = _type;
2460         state->orig.in.state = _state;
2461         state->orig.in.offered = _offered;
2462         state->orig.in.resume_handle = _resume_handle;
2463
2464         /* Out parameters */
2465         state->orig.out.service = _service;
2466         state->orig.out.needed = _needed;
2467         state->orig.out.services_returned = _services_returned;
2468         state->orig.out.resume_handle = _resume_handle;
2469
2470         /* Result */
2471         ZERO_STRUCT(state->orig.out.result);
2472
2473         if (DEBUGLEVEL >= 10) {
2474                 NDR_PRINT_IN_DEBUG(svcctl_EnumServicesStatusW, &state->orig);
2475         }
2476
2477         state->out_mem_ctx = talloc_named_const(state, 0,
2478                              "rpccli_svcctl_EnumServicesStatusW_out_memory");
2479         if (tevent_req_nomem(state->out_mem_ctx, req)) {
2480                 return tevent_req_post(req, ev);
2481         }
2482
2483         /* make a temporary copy, that we pass to the dispatch function */
2484         state->tmp = state->orig;
2485
2486         subreq = cli->dispatch_send(state, ev, cli,
2487                                     &ndr_table_svcctl,
2488                                     NDR_SVCCTL_ENUMSERVICESSTATUSW,
2489                                     &state->tmp);
2490         if (tevent_req_nomem(subreq, req)) {
2491                 return tevent_req_post(req, ev);
2492         }
2493         tevent_req_set_callback(subreq, rpccli_svcctl_EnumServicesStatusW_done, req);
2494         return req;
2495 }
2496
2497 static void rpccli_svcctl_EnumServicesStatusW_done(struct tevent_req *subreq)
2498 {
2499         struct tevent_req *req = tevent_req_callback_data(
2500                 subreq, struct tevent_req);
2501         struct rpccli_svcctl_EnumServicesStatusW_state *state = tevent_req_data(
2502                 req, struct rpccli_svcctl_EnumServicesStatusW_state);
2503         NTSTATUS status;
2504         TALLOC_CTX *mem_ctx;
2505
2506         if (state->out_mem_ctx) {
2507                 mem_ctx = state->out_mem_ctx;
2508         } else {
2509                 mem_ctx = state;
2510         }
2511
2512         status = state->dispatch_recv(subreq, mem_ctx);
2513         TALLOC_FREE(subreq);
2514         if (!NT_STATUS_IS_OK(status)) {
2515                 tevent_req_nterror(req, status);
2516                 return;
2517         }
2518
2519         /* Copy out parameters */
2520         memcpy(state->orig.out.service, state->tmp.out.service, state->tmp.in.offered * sizeof(*state->orig.out.service));
2521         *state->orig.out.needed = *state->tmp.out.needed;
2522         *state->orig.out.services_returned = *state->tmp.out.services_returned;
2523         if (state->orig.out.resume_handle && state->tmp.out.resume_handle) {
2524                 *state->orig.out.resume_handle = *state->tmp.out.resume_handle;
2525         }
2526
2527         /* Copy result */
2528         state->orig.out.result = state->tmp.out.result;
2529
2530         /* Reset temporary structure */
2531         ZERO_STRUCT(state->tmp);
2532
2533         if (DEBUGLEVEL >= 10) {
2534                 NDR_PRINT_OUT_DEBUG(svcctl_EnumServicesStatusW, &state->orig);
2535         }
2536
2537         tevent_req_done(req);
2538 }
2539
2540 NTSTATUS rpccli_svcctl_EnumServicesStatusW_recv(struct tevent_req *req,
2541                                                 TALLOC_CTX *mem_ctx,
2542                                                 WERROR *result)
2543 {
2544         struct rpccli_svcctl_EnumServicesStatusW_state *state = tevent_req_data(
2545                 req, struct rpccli_svcctl_EnumServicesStatusW_state);
2546         NTSTATUS status;
2547
2548         if (tevent_req_is_nterror(req, &status)) {
2549                 tevent_req_received(req);
2550                 return status;
2551         }
2552
2553         /* Steal possbile out parameters to the callers context */
2554         talloc_steal(mem_ctx, state->out_mem_ctx);
2555
2556         /* Return result */
2557         *result = state->orig.out.result;
2558
2559         tevent_req_received(req);
2560         return NT_STATUS_OK;
2561 }
2562
2563 NTSTATUS rpccli_svcctl_EnumServicesStatusW(struct rpc_pipe_client *cli,
2564                                            TALLOC_CTX *mem_ctx,
2565                                            struct policy_handle *handle /* [in] [ref] */,
2566                                            uint32_t type /* [in]  */,
2567                                            enum svcctl_ServiceState state /* [in]  */,
2568                                            uint8_t *service /* [out] [ref,size_is(offered)] */,
2569                                            uint32_t offered /* [in] [range(0,0x40000)] */,
2570                                            uint32_t *needed /* [out] [ref,range(0,0x40000)] */,
2571                                            uint32_t *services_returned /* [out] [ref,range(0,0x40000)] */,
2572                                            uint32_t *resume_handle /* [in,out] [unique] */,
2573                                            WERROR *werror)
2574 {
2575         struct svcctl_EnumServicesStatusW r;
2576         NTSTATUS status;
2577
2578         /* In parameters */
2579         r.in.handle = handle;
2580         r.in.type = type;
2581         r.in.state = state;
2582         r.in.offered = offered;
2583         r.in.resume_handle = resume_handle;
2584
2585         if (DEBUGLEVEL >= 10) {
2586                 NDR_PRINT_IN_DEBUG(svcctl_EnumServicesStatusW, &r);
2587         }
2588
2589         status = cli->dispatch(cli,
2590                                 mem_ctx,
2591                                 &ndr_table_svcctl,
2592                                 NDR_SVCCTL_ENUMSERVICESSTATUSW,
2593                                 &r);
2594
2595         if (!NT_STATUS_IS_OK(status)) {
2596                 return status;
2597         }
2598
2599         if (DEBUGLEVEL >= 10) {
2600                 NDR_PRINT_OUT_DEBUG(svcctl_EnumServicesStatusW, &r);
2601         }
2602
2603         if (NT_STATUS_IS_ERR(status)) {
2604                 return status;
2605         }
2606
2607         /* Return variables */
2608         memcpy(service, r.out.service, r.in.offered * sizeof(*service));
2609         *needed = *r.out.needed;
2610         *services_returned = *r.out.services_returned;
2611         if (resume_handle && r.out.resume_handle) {
2612                 *resume_handle = *r.out.resume_handle;
2613         }
2614
2615         /* Return result */
2616         if (werror) {
2617                 *werror = r.out.result;
2618         }
2619
2620         return werror_to_ntstatus(r.out.result);
2621 }
2622
2623 struct rpccli_svcctl_OpenSCManagerW_state {
2624         struct svcctl_OpenSCManagerW orig;
2625         struct svcctl_OpenSCManagerW tmp;
2626         TALLOC_CTX *out_mem_ctx;
2627         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2628 };
2629
2630 static void rpccli_svcctl_OpenSCManagerW_done(struct tevent_req *subreq);
2631
2632 struct tevent_req *rpccli_svcctl_OpenSCManagerW_send(TALLOC_CTX *mem_ctx,
2633                                                      struct tevent_context *ev,
2634                                                      struct rpc_pipe_client *cli,
2635                                                      const char *_MachineName /* [in] [unique,charset(UTF16)] */,
2636                                                      const char *_DatabaseName /* [in] [unique,charset(UTF16)] */,
2637                                                      uint32_t _access_mask /* [in]  */,
2638                                                      struct policy_handle *_handle /* [out] [ref] */)
2639 {
2640         struct tevent_req *req;
2641         struct rpccli_svcctl_OpenSCManagerW_state *state;
2642         struct tevent_req *subreq;
2643
2644         req = tevent_req_create(mem_ctx, &state,
2645                                 struct rpccli_svcctl_OpenSCManagerW_state);
2646         if (req == NULL) {
2647                 return NULL;
2648         }
2649         state->out_mem_ctx = NULL;
2650         state->dispatch_recv = cli->dispatch_recv;
2651
2652         /* In parameters */
2653         state->orig.in.MachineName = _MachineName;
2654         state->orig.in.DatabaseName = _DatabaseName;
2655         state->orig.in.access_mask = _access_mask;
2656
2657         /* Out parameters */
2658         state->orig.out.handle = _handle;
2659
2660         /* Result */
2661         ZERO_STRUCT(state->orig.out.result);
2662
2663         if (DEBUGLEVEL >= 10) {
2664                 NDR_PRINT_IN_DEBUG(svcctl_OpenSCManagerW, &state->orig);
2665         }
2666
2667         state->out_mem_ctx = talloc_named_const(state, 0,
2668                              "rpccli_svcctl_OpenSCManagerW_out_memory");
2669         if (tevent_req_nomem(state->out_mem_ctx, req)) {
2670                 return tevent_req_post(req, ev);
2671         }
2672
2673         /* make a temporary copy, that we pass to the dispatch function */
2674         state->tmp = state->orig;
2675
2676         subreq = cli->dispatch_send(state, ev, cli,
2677                                     &ndr_table_svcctl,
2678                                     NDR_SVCCTL_OPENSCMANAGERW,
2679                                     &state->tmp);
2680         if (tevent_req_nomem(subreq, req)) {
2681                 return tevent_req_post(req, ev);
2682         }
2683         tevent_req_set_callback(subreq, rpccli_svcctl_OpenSCManagerW_done, req);
2684         return req;
2685 }
2686
2687 static void rpccli_svcctl_OpenSCManagerW_done(struct tevent_req *subreq)
2688 {
2689         struct tevent_req *req = tevent_req_callback_data(
2690                 subreq, struct tevent_req);
2691         struct rpccli_svcctl_OpenSCManagerW_state *state = tevent_req_data(
2692                 req, struct rpccli_svcctl_OpenSCManagerW_state);
2693         NTSTATUS status;
2694         TALLOC_CTX *mem_ctx;
2695
2696         if (state->out_mem_ctx) {
2697                 mem_ctx = state->out_mem_ctx;
2698         } else {
2699                 mem_ctx = state;
2700         }
2701
2702         status = state->dispatch_recv(subreq, mem_ctx);
2703         TALLOC_FREE(subreq);
2704         if (!NT_STATUS_IS_OK(status)) {
2705                 tevent_req_nterror(req, status);
2706                 return;
2707         }
2708
2709         /* Copy out parameters */
2710         *state->orig.out.handle = *state->tmp.out.handle;
2711
2712         /* Copy result */
2713         state->orig.out.result = state->tmp.out.result;
2714
2715         /* Reset temporary structure */
2716         ZERO_STRUCT(state->tmp);
2717
2718         if (DEBUGLEVEL >= 10) {
2719                 NDR_PRINT_OUT_DEBUG(svcctl_OpenSCManagerW, &state->orig);
2720         }
2721
2722         tevent_req_done(req);
2723 }
2724
2725 NTSTATUS rpccli_svcctl_OpenSCManagerW_recv(struct tevent_req *req,
2726                                            TALLOC_CTX *mem_ctx,
2727                                            WERROR *result)
2728 {
2729         struct rpccli_svcctl_OpenSCManagerW_state *state = tevent_req_data(
2730                 req, struct rpccli_svcctl_OpenSCManagerW_state);
2731         NTSTATUS status;
2732
2733         if (tevent_req_is_nterror(req, &status)) {
2734                 tevent_req_received(req);
2735                 return status;
2736         }
2737
2738         /* Steal possbile out parameters to the callers context */
2739         talloc_steal(mem_ctx, state->out_mem_ctx);
2740
2741         /* Return result */
2742         *result = state->orig.out.result;
2743
2744         tevent_req_received(req);
2745         return NT_STATUS_OK;
2746 }
2747
2748 NTSTATUS rpccli_svcctl_OpenSCManagerW(struct rpc_pipe_client *cli,
2749                                       TALLOC_CTX *mem_ctx,
2750                                       const char *MachineName /* [in] [unique,charset(UTF16)] */,
2751                                       const char *DatabaseName /* [in] [unique,charset(UTF16)] */,
2752                                       uint32_t access_mask /* [in]  */,
2753                                       struct policy_handle *handle /* [out] [ref] */,
2754                                       WERROR *werror)
2755 {
2756         struct svcctl_OpenSCManagerW r;
2757         NTSTATUS status;
2758
2759         /* In parameters */
2760         r.in.MachineName = MachineName;
2761         r.in.DatabaseName = DatabaseName;
2762         r.in.access_mask = access_mask;
2763
2764         if (DEBUGLEVEL >= 10) {
2765                 NDR_PRINT_IN_DEBUG(svcctl_OpenSCManagerW, &r);
2766         }
2767
2768         status = cli->dispatch(cli,
2769                                 mem_ctx,
2770                                 &ndr_table_svcctl,
2771                                 NDR_SVCCTL_OPENSCMANAGERW,
2772                                 &r);
2773
2774         if (!NT_STATUS_IS_OK(status)) {
2775                 return status;
2776         }
2777
2778         if (DEBUGLEVEL >= 10) {
2779                 NDR_PRINT_OUT_DEBUG(svcctl_OpenSCManagerW, &r);
2780         }
2781
2782         if (NT_STATUS_IS_ERR(status)) {
2783                 return status;
2784         }
2785
2786         /* Return variables */
2787         *handle = *r.out.handle;
2788
2789         /* Return result */
2790         if (werror) {
2791                 *werror = r.out.result;
2792         }
2793
2794         return werror_to_ntstatus(r.out.result);
2795 }
2796
2797 struct rpccli_svcctl_OpenServiceW_state {
2798         struct svcctl_OpenServiceW orig;
2799         struct svcctl_OpenServiceW tmp;
2800         TALLOC_CTX *out_mem_ctx;
2801         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2802 };
2803
2804 static void rpccli_svcctl_OpenServiceW_done(struct tevent_req *subreq);
2805
2806 struct tevent_req *rpccli_svcctl_OpenServiceW_send(TALLOC_CTX *mem_ctx,
2807                                                    struct tevent_context *ev,
2808                                                    struct rpc_pipe_client *cli,
2809                                                    struct policy_handle *_scmanager_handle /* [in] [ref] */,
2810                                                    const char *_ServiceName /* [in] [charset(UTF16)] */,
2811                                                    uint32_t _access_mask /* [in]  */,
2812                                                    struct policy_handle *_handle /* [out] [ref] */)
2813 {
2814         struct tevent_req *req;
2815         struct rpccli_svcctl_OpenServiceW_state *state;
2816         struct tevent_req *subreq;
2817
2818         req = tevent_req_create(mem_ctx, &state,
2819                                 struct rpccli_svcctl_OpenServiceW_state);
2820         if (req == NULL) {
2821                 return NULL;
2822         }
2823         state->out_mem_ctx = NULL;
2824         state->dispatch_recv = cli->dispatch_recv;
2825
2826         /* In parameters */
2827         state->orig.in.scmanager_handle = _scmanager_handle;
2828         state->orig.in.ServiceName = _ServiceName;
2829         state->orig.in.access_mask = _access_mask;
2830
2831         /* Out parameters */
2832         state->orig.out.handle = _handle;
2833
2834         /* Result */
2835         ZERO_STRUCT(state->orig.out.result);
2836
2837         if (DEBUGLEVEL >= 10) {
2838                 NDR_PRINT_IN_DEBUG(svcctl_OpenServiceW, &state->orig);
2839         }
2840
2841         state->out_mem_ctx = talloc_named_const(state, 0,
2842                              "rpccli_svcctl_OpenServiceW_out_memory");
2843         if (tevent_req_nomem(state->out_mem_ctx, req)) {
2844                 return tevent_req_post(req, ev);
2845         }
2846
2847         /* make a temporary copy, that we pass to the dispatch function */
2848         state->tmp = state->orig;
2849
2850         subreq = cli->dispatch_send(state, ev, cli,
2851                                     &ndr_table_svcctl,
2852                                     NDR_SVCCTL_OPENSERVICEW,
2853                                     &state->tmp);
2854         if (tevent_req_nomem(subreq, req)) {
2855                 return tevent_req_post(req, ev);
2856         }
2857         tevent_req_set_callback(subreq, rpccli_svcctl_OpenServiceW_done, req);
2858         return req;
2859 }
2860
2861 static void rpccli_svcctl_OpenServiceW_done(struct tevent_req *subreq)
2862 {
2863         struct tevent_req *req = tevent_req_callback_data(
2864                 subreq, struct tevent_req);
2865         struct rpccli_svcctl_OpenServiceW_state *state = tevent_req_data(
2866                 req, struct rpccli_svcctl_OpenServiceW_state);
2867         NTSTATUS status;
2868         TALLOC_CTX *mem_ctx;
2869
2870         if (state->out_mem_ctx) {
2871                 mem_ctx = state->out_mem_ctx;
2872         } else {
2873                 mem_ctx = state;
2874         }
2875
2876         status = state->dispatch_recv(subreq, mem_ctx);
2877         TALLOC_FREE(subreq);
2878         if (!NT_STATUS_IS_OK(status)) {
2879                 tevent_req_nterror(req, status);
2880                 return;
2881         }
2882
2883         /* Copy out parameters */
2884         *state->orig.out.handle = *state->tmp.out.handle;
2885
2886         /* Copy result */
2887         state->orig.out.result = state->tmp.out.result;
2888
2889         /* Reset temporary structure */
2890         ZERO_STRUCT(state->tmp);
2891
2892         if (DEBUGLEVEL >= 10) {
2893                 NDR_PRINT_OUT_DEBUG(svcctl_OpenServiceW, &state->orig);
2894         }
2895
2896         tevent_req_done(req);
2897 }
2898
2899 NTSTATUS rpccli_svcctl_OpenServiceW_recv(struct tevent_req *req,
2900                                          TALLOC_CTX *mem_ctx,
2901                                          WERROR *result)
2902 {
2903         struct rpccli_svcctl_OpenServiceW_state *state = tevent_req_data(
2904                 req, struct rpccli_svcctl_OpenServiceW_state);
2905         NTSTATUS status;
2906
2907         if (tevent_req_is_nterror(req, &status)) {
2908                 tevent_req_received(req);
2909                 return status;
2910         }
2911
2912         /* Steal possbile out parameters to the callers context */
2913         talloc_steal(mem_ctx, state->out_mem_ctx);
2914
2915         /* Return result */
2916         *result = state->orig.out.result;
2917
2918         tevent_req_received(req);
2919         return NT_STATUS_OK;
2920 }
2921
2922 NTSTATUS rpccli_svcctl_OpenServiceW(struct rpc_pipe_client *cli,
2923                                     TALLOC_CTX *mem_ctx,
2924                                     struct policy_handle *scmanager_handle /* [in] [ref] */,
2925                                     const char *ServiceName /* [in] [charset(UTF16)] */,
2926                                     uint32_t access_mask /* [in]  */,
2927                                     struct policy_handle *handle /* [out] [ref] */,
2928                                     WERROR *werror)
2929 {
2930         struct svcctl_OpenServiceW r;
2931         NTSTATUS status;
2932
2933         /* In parameters */
2934         r.in.scmanager_handle = scmanager_handle;
2935         r.in.ServiceName = ServiceName;
2936         r.in.access_mask = access_mask;
2937
2938         if (DEBUGLEVEL >= 10) {
2939                 NDR_PRINT_IN_DEBUG(svcctl_OpenServiceW, &r);
2940         }
2941
2942         status = cli->dispatch(cli,
2943                                 mem_ctx,
2944                                 &ndr_table_svcctl,
2945                                 NDR_SVCCTL_OPENSERVICEW,
2946                                 &r);
2947
2948         if (!NT_STATUS_IS_OK(status)) {
2949                 return status;
2950         }
2951
2952         if (DEBUGLEVEL >= 10) {
2953                 NDR_PRINT_OUT_DEBUG(svcctl_OpenServiceW, &r);
2954         }
2955
2956         if (NT_STATUS_IS_ERR(status)) {
2957                 return status;
2958         }
2959
2960         /* Return variables */
2961         *handle = *r.out.handle;
2962
2963         /* Return result */
2964         if (werror) {
2965                 *werror = r.out.result;
2966         }
2967
2968         return werror_to_ntstatus(r.out.result);
2969 }
2970
2971 struct rpccli_svcctl_QueryServiceConfigW_state {
2972         struct svcctl_QueryServiceConfigW orig;
2973         struct svcctl_QueryServiceConfigW tmp;
2974         TALLOC_CTX *out_mem_ctx;
2975         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2976 };
2977
2978 static void rpccli_svcctl_QueryServiceConfigW_done(struct tevent_req *subreq);
2979
2980 struct tevent_req *rpccli_svcctl_QueryServiceConfigW_send(TALLOC_CTX *mem_ctx,
2981                                                           struct tevent_context *ev,
2982                                                           struct rpc_pipe_client *cli,
2983                                                           struct policy_handle *_handle /* [in] [ref] */,
2984                                                           struct QUERY_SERVICE_CONFIG *_query /* [out] [ref] */,
2985                                                           uint32_t _offered /* [in] [range(0,8192)] */,
2986                                                           uint32_t *_needed /* [out] [ref,range(0,8192)] */)
2987 {
2988         struct tevent_req *req;
2989         struct rpccli_svcctl_QueryServiceConfigW_state *state;
2990         struct tevent_req *subreq;
2991
2992         req = tevent_req_create(mem_ctx, &state,
2993                                 struct rpccli_svcctl_QueryServiceConfigW_state);
2994         if (req == NULL) {
2995                 return NULL;
2996         }
2997         state->out_mem_ctx = NULL;
2998         state->dispatch_recv = cli->dispatch_recv;
2999
3000         /* In parameters */
3001         state->orig.in.handle = _handle;
3002         state->orig.in.offered = _offered;
3003
3004         /* Out parameters */
3005         state->orig.out.query = _query;
3006         state->orig.out.needed = _needed;
3007
3008         /* Result */
3009         ZERO_STRUCT(state->orig.out.result);
3010
3011         if (DEBUGLEVEL >= 10) {
3012                 NDR_PRINT_IN_DEBUG(svcctl_QueryServiceConfigW, &state->orig);
3013         }
3014
3015         state->out_mem_ctx = talloc_named_const(state, 0,
3016                              "rpccli_svcctl_QueryServiceConfigW_out_memory");
3017         if (tevent_req_nomem(state->out_mem_ctx, req)) {
3018                 return tevent_req_post(req, ev);
3019         }
3020
3021         /* make a temporary copy, that we pass to the dispatch function */
3022         state->tmp = state->orig;
3023
3024         subreq = cli->dispatch_send(state, ev, cli,
3025                                     &ndr_table_svcctl,
3026                                     NDR_SVCCTL_QUERYSERVICECONFIGW,
3027                                     &state->tmp);
3028         if (tevent_req_nomem(subreq, req)) {
3029                 return tevent_req_post(req, ev);
3030         }
3031         tevent_req_set_callback(subreq, rpccli_svcctl_QueryServiceConfigW_done, req);
3032         return req;
3033 }
3034
3035 static void rpccli_svcctl_QueryServiceConfigW_done(struct tevent_req *subreq)
3036 {
3037         struct tevent_req *req = tevent_req_callback_data(
3038                 subreq, struct tevent_req);
3039         struct rpccli_svcctl_QueryServiceConfigW_state *state = tevent_req_data(
3040                 req, struct rpccli_svcctl_QueryServiceConfigW_state);
3041         NTSTATUS status;
3042         TALLOC_CTX *mem_ctx;
3043
3044         if (state->out_mem_ctx) {
3045                 mem_ctx = state->out_mem_ctx;
3046         } else {
3047                 mem_ctx = state;
3048         }
3049
3050         status = state->dispatch_recv(subreq, mem_ctx);
3051         TALLOC_FREE(subreq);
3052         if (!NT_STATUS_IS_OK(status)) {
3053                 tevent_req_nterror(req, status);
3054                 return;
3055         }
3056
3057         /* Copy out parameters */
3058         *state->orig.out.query = *state->tmp.out.query;
3059         *state->orig.out.needed = *state->tmp.out.needed;
3060
3061         /* Copy result */
3062         state->orig.out.result = state->tmp.out.result;
3063
3064         /* Reset temporary structure */
3065         ZERO_STRUCT(state->tmp);
3066
3067         if (DEBUGLEVEL >= 10) {
3068                 NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceConfigW, &state->orig);
3069         }
3070
3071         tevent_req_done(req);
3072 }
3073
3074 NTSTATUS rpccli_svcctl_QueryServiceConfigW_recv(struct tevent_req *req,
3075                                                 TALLOC_CTX *mem_ctx,
3076                                                 WERROR *result)
3077 {
3078         struct rpccli_svcctl_QueryServiceConfigW_state *state = tevent_req_data(
3079                 req, struct rpccli_svcctl_QueryServiceConfigW_state);
3080         NTSTATUS status;
3081
3082         if (tevent_req_is_nterror(req, &status)) {
3083                 tevent_req_received(req);
3084                 return status;
3085         }
3086
3087         /* Steal possbile out parameters to the callers context */
3088         talloc_steal(mem_ctx, state->out_mem_ctx);
3089
3090         /* Return result */
3091         *result = state->orig.out.result;
3092
3093         tevent_req_received(req);
3094         return NT_STATUS_OK;
3095 }
3096
3097 NTSTATUS rpccli_svcctl_QueryServiceConfigW(struct rpc_pipe_client *cli,
3098                                            TALLOC_CTX *mem_ctx,
3099                                            struct policy_handle *handle /* [in] [ref] */,
3100                                            struct QUERY_SERVICE_CONFIG *query /* [out] [ref] */,
3101                                            uint32_t offered /* [in] [range(0,8192)] */,
3102                                            uint32_t *needed /* [out] [ref,range(0,8192)] */,
3103                                            WERROR *werror)
3104 {
3105         struct svcctl_QueryServiceConfigW r;
3106         NTSTATUS status;
3107
3108         /* In parameters */
3109         r.in.handle = handle;
3110         r.in.offered = offered;
3111
3112         if (DEBUGLEVEL >= 10) {
3113                 NDR_PRINT_IN_DEBUG(svcctl_QueryServiceConfigW, &r);
3114         }
3115
3116         status = cli->dispatch(cli,
3117                                 mem_ctx,
3118                                 &ndr_table_svcctl,
3119                                 NDR_SVCCTL_QUERYSERVICECONFIGW,
3120                                 &r);
3121
3122         if (!NT_STATUS_IS_OK(status)) {
3123                 return status;
3124         }
3125
3126         if (DEBUGLEVEL >= 10) {
3127                 NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceConfigW, &r);
3128         }
3129
3130         if (NT_STATUS_IS_ERR(status)) {
3131                 return status;
3132         }
3133
3134         /* Return variables */
3135         *query = *r.out.query;
3136         *needed = *r.out.needed;
3137
3138         /* Return result */
3139         if (werror) {
3140                 *werror = r.out.result;
3141         }
3142
3143         return werror_to_ntstatus(r.out.result);
3144 }
3145
3146 struct rpccli_svcctl_QueryServiceLockStatusW_state {
3147         struct svcctl_QueryServiceLockStatusW orig;
3148         struct svcctl_QueryServiceLockStatusW tmp;
3149         TALLOC_CTX *out_mem_ctx;
3150         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
3151 };
3152
3153 static void rpccli_svcctl_QueryServiceLockStatusW_done(struct tevent_req *subreq);
3154
3155 struct tevent_req *rpccli_svcctl_QueryServiceLockStatusW_send(TALLOC_CTX *mem_ctx,
3156                                                               struct tevent_context *ev,
3157                                                               struct rpc_pipe_client *cli,
3158                                                               struct policy_handle *_handle /* [in] [ref] */,
3159                                                               uint32_t _offered /* [in]  */,
3160                                                               struct SERVICE_LOCK_STATUS *_lock_status /* [out] [ref] */,
3161                                                               uint32_t *_needed /* [out] [ref] */)
3162 {
3163         struct tevent_req *req;
3164         struct rpccli_svcctl_QueryServiceLockStatusW_state *state;
3165         struct tevent_req *subreq;
3166
3167         req = tevent_req_create(mem_ctx, &state,
3168                                 struct rpccli_svcctl_QueryServiceLockStatusW_state);
3169         if (req == NULL) {
3170                 return NULL;
3171         }
3172         state->out_mem_ctx = NULL;
3173         state->dispatch_recv = cli->dispatch_recv;
3174
3175         /* In parameters */
3176         state->orig.in.handle = _handle;
3177         state->orig.in.offered = _offered;
3178
3179         /* Out parameters */
3180         state->orig.out.lock_status = _lock_status;
3181         state->orig.out.needed = _needed;
3182
3183         /* Result */
3184         ZERO_STRUCT(state->orig.out.result);
3185
3186         if (DEBUGLEVEL >= 10) {
3187                 NDR_PRINT_IN_DEBUG(svcctl_QueryServiceLockStatusW, &state->orig);
3188         }
3189
3190         state->out_mem_ctx = talloc_named_const(state, 0,
3191                              "rpccli_svcctl_QueryServiceLockStatusW_out_memory");
3192         if (tevent_req_nomem(state->out_mem_ctx, req)) {
3193                 return tevent_req_post(req, ev);
3194         }
3195
3196         /* make a temporary copy, that we pass to the dispatch function */
3197         state->tmp = state->orig;
3198
3199         subreq = cli->dispatch_send(state, ev, cli,
3200                                     &ndr_table_svcctl,
3201                                     NDR_SVCCTL_QUERYSERVICELOCKSTATUSW,
3202                                     &state->tmp);
3203         if (tevent_req_nomem(subreq, req)) {
3204                 return tevent_req_post(req, ev);
3205         }
3206         tevent_req_set_callback(subreq, rpccli_svcctl_QueryServiceLockStatusW_done, req);
3207         return req;
3208 }
3209
3210 static void rpccli_svcctl_QueryServiceLockStatusW_done(struct tevent_req *subreq)
3211 {
3212         struct tevent_req *req = tevent_req_callback_data(
3213                 subreq, struct tevent_req);
3214         struct rpccli_svcctl_QueryServiceLockStatusW_state *state = tevent_req_data(
3215                 req, struct rpccli_svcctl_QueryServiceLockStatusW_state);
3216         NTSTATUS status;
3217         TALLOC_CTX *mem_ctx;
3218
3219         if (state->out_mem_ctx) {
3220                 mem_ctx = state->out_mem_ctx;
3221         } else {
3222                 mem_ctx = state;
3223         }
3224
3225         status = state->dispatch_recv(subreq, mem_ctx);
3226         TALLOC_FREE(subreq);
3227         if (!NT_STATUS_IS_OK(status)) {
3228                 tevent_req_nterror(req, status);
3229                 return;
3230         }
3231
3232         /* Copy out parameters */
3233         *state->orig.out.lock_status = *state->tmp.out.lock_status;
3234         *state->orig.out.needed = *state->tmp.out.needed;
3235
3236         /* Copy result */
3237         state->orig.out.result = state->tmp.out.result;
3238
3239         /* Reset temporary structure */
3240         ZERO_STRUCT(state->tmp);
3241
3242         if (DEBUGLEVEL >= 10) {
3243                 NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceLockStatusW, &state->orig);
3244         }
3245
3246         tevent_req_done(req);
3247 }
3248
3249 NTSTATUS rpccli_svcctl_QueryServiceLockStatusW_recv(struct tevent_req *req,
3250                                                     TALLOC_CTX *mem_ctx,
3251                                                     WERROR *result)
3252 {
3253         struct rpccli_svcctl_QueryServiceLockStatusW_state *state = tevent_req_data(
3254                 req, struct rpccli_svcctl_QueryServiceLockStatusW_state);
3255         NTSTATUS status;
3256
3257         if (tevent_req_is_nterror(req, &status)) {
3258                 tevent_req_received(req);
3259                 return status;
3260         }
3261
3262         /* Steal possbile out parameters to the callers context */
3263         talloc_steal(mem_ctx, state->out_mem_ctx);
3264
3265         /* Return result */
3266         *result = state->orig.out.result;
3267
3268         tevent_req_received(req);
3269         return NT_STATUS_OK;
3270 }
3271
3272 NTSTATUS rpccli_svcctl_QueryServiceLockStatusW(struct rpc_pipe_client *cli,
3273                                                TALLOC_CTX *mem_ctx,
3274                                                struct policy_handle *handle /* [in] [ref] */,
3275                                                uint32_t offered /* [in]  */,
3276                                                struct SERVICE_LOCK_STATUS *lock_status /* [out] [ref] */,
3277                                                uint32_t *needed /* [out] [ref] */,
3278                                                WERROR *werror)
3279 {
3280         struct svcctl_QueryServiceLockStatusW r;
3281         NTSTATUS status;
3282
3283         /* In parameters */
3284         r.in.handle = handle;
3285         r.in.offered = offered;
3286
3287         if (DEBUGLEVEL >= 10) {
3288                 NDR_PRINT_IN_DEBUG(svcctl_QueryServiceLockStatusW, &r);
3289         }
3290
3291         status = cli->dispatch(cli,
3292                                 mem_ctx,
3293                                 &ndr_table_svcctl,
3294                                 NDR_SVCCTL_QUERYSERVICELOCKSTATUSW,
3295                                 &r);
3296
3297         if (!NT_STATUS_IS_OK(status)) {
3298                 return status;
3299         }
3300
3301         if (DEBUGLEVEL >= 10) {
3302                 NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceLockStatusW, &r);
3303         }
3304
3305         if (NT_STATUS_IS_ERR(status)) {
3306                 return status;
3307         }
3308
3309         /* Return variables */
3310         *lock_status = *r.out.lock_status;
3311         *needed = *r.out.needed;
3312
3313         /* Return result */
3314         if (werror) {
3315                 *werror = r.out.result;
3316         }
3317
3318         return werror_to_ntstatus(r.out.result);
3319 }
3320
3321 struct rpccli_svcctl_StartServiceW_state {
3322         struct svcctl_StartServiceW orig;
3323         struct svcctl_StartServiceW tmp;
3324         TALLOC_CTX *out_mem_ctx;
3325         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
3326 };
3327
3328 static void rpccli_svcctl_StartServiceW_done(struct tevent_req *subreq);
3329
3330 struct tevent_req *rpccli_svcctl_StartServiceW_send(TALLOC_CTX *mem_ctx,
3331                                                     struct tevent_context *ev,
3332                                                     struct rpc_pipe_client *cli,
3333                                                     struct policy_handle *_handle /* [in] [ref] */,
3334                                                     uint32_t _NumArgs /* [in] [range(0,SC_MAX_ARGUMENTS)] */,
3335                                                     struct svcctl_ArgumentString *_Arguments /* [in] [unique,size_is(NumArgs)] */)
3336 {
3337         struct tevent_req *req;
3338         struct rpccli_svcctl_StartServiceW_state *state;
3339         struct tevent_req *subreq;
3340
3341         req = tevent_req_create(mem_ctx, &state,
3342                                 struct rpccli_svcctl_StartServiceW_state);
3343         if (req == NULL) {
3344                 return NULL;
3345         }
3346         state->out_mem_ctx = NULL;
3347         state->dispatch_recv = cli->dispatch_recv;
3348
3349         /* In parameters */
3350         state->orig.in.handle = _handle;
3351         state->orig.in.NumArgs = _NumArgs;
3352         state->orig.in.Arguments = _Arguments;
3353
3354         /* Out parameters */
3355
3356         /* Result */
3357         ZERO_STRUCT(state->orig.out.result);
3358
3359         if (DEBUGLEVEL >= 10) {
3360                 NDR_PRINT_IN_DEBUG(svcctl_StartServiceW, &state->orig);
3361         }
3362
3363         /* make a temporary copy, that we pass to the dispatch function */
3364         state->tmp = state->orig;
3365
3366         subreq = cli->dispatch_send(state, ev, cli,
3367                                     &ndr_table_svcctl,
3368                                     NDR_SVCCTL_STARTSERVICEW,
3369                                     &state->tmp);
3370         if (tevent_req_nomem(subreq, req)) {
3371                 return tevent_req_post(req, ev);
3372         }
3373         tevent_req_set_callback(subreq, rpccli_svcctl_StartServiceW_done, req);
3374         return req;
3375 }
3376
3377 static void rpccli_svcctl_StartServiceW_done(struct tevent_req *subreq)
3378 {
3379         struct tevent_req *req = tevent_req_callback_data(
3380                 subreq, struct tevent_req);
3381         struct rpccli_svcctl_StartServiceW_state *state = tevent_req_data(
3382                 req, struct rpccli_svcctl_StartServiceW_state);
3383         NTSTATUS status;
3384         TALLOC_CTX *mem_ctx;
3385
3386         if (state->out_mem_ctx) {
3387                 mem_ctx = state->out_mem_ctx;
3388         } else {
3389                 mem_ctx = state;
3390         }
3391
3392         status = state->dispatch_recv(subreq, mem_ctx);
3393         TALLOC_FREE(subreq);
3394         if (!NT_STATUS_IS_OK(status)) {
3395                 tevent_req_nterror(req, status);
3396                 return;
3397         }
3398
3399         /* Copy out parameters */
3400
3401         /* Copy result */
3402         state->orig.out.result = state->tmp.out.result;
3403
3404         /* Reset temporary structure */
3405         ZERO_STRUCT(state->tmp);
3406
3407         if (DEBUGLEVEL >= 10) {
3408                 NDR_PRINT_OUT_DEBUG(svcctl_StartServiceW, &state->orig);
3409         }
3410
3411         tevent_req_done(req);
3412 }
3413
3414 NTSTATUS rpccli_svcctl_StartServiceW_recv(struct tevent_req *req,
3415                                           TALLOC_CTX *mem_ctx,
3416                                           WERROR *result)
3417 {
3418         struct rpccli_svcctl_StartServiceW_state *state = tevent_req_data(
3419                 req, struct rpccli_svcctl_StartServiceW_state);
3420         NTSTATUS status;
3421
3422         if (tevent_req_is_nterror(req, &status)) {
3423                 tevent_req_received(req);
3424                 return status;
3425         }
3426
3427         /* Steal possbile out parameters to the callers context */
3428         talloc_steal(mem_ctx, state->out_mem_ctx);
3429
3430         /* Return result */
3431         *result = state->orig.out.result;
3432
3433         tevent_req_received(req);
3434         return NT_STATUS_OK;
3435 }
3436
3437 NTSTATUS rpccli_svcctl_StartServiceW(struct rpc_pipe_client *cli,
3438                                      TALLOC_CTX *mem_ctx,
3439                                      struct policy_handle *handle /* [in] [ref] */,
3440                                      uint32_t NumArgs /* [in] [range(0,SC_MAX_ARGUMENTS)] */,
3441                                      struct svcctl_ArgumentString *Arguments /* [in] [unique,size_is(NumArgs)] */,
3442                                      WERROR *werror)
3443 {
3444         struct svcctl_StartServiceW r;
3445         NTSTATUS status;
3446
3447         /* In parameters */
3448         r.in.handle = handle;
3449         r.in.NumArgs = NumArgs;
3450         r.in.Arguments = Arguments;
3451
3452         if (DEBUGLEVEL >= 10) {
3453                 NDR_PRINT_IN_DEBUG(svcctl_StartServiceW, &r);
3454         }
3455
3456         status = cli->dispatch(cli,
3457                                 mem_ctx,
3458                                 &ndr_table_svcctl,
3459                                 NDR_SVCCTL_STARTSERVICEW,
3460                                 &r);
3461
3462         if (!NT_STATUS_IS_OK(status)) {
3463                 return status;
3464         }
3465
3466         if (DEBUGLEVEL >= 10) {
3467                 NDR_PRINT_OUT_DEBUG(svcctl_StartServiceW, &r);
3468         }
3469
3470         if (NT_STATUS_IS_ERR(status)) {
3471                 return status;
3472         }
3473
3474         /* Return variables */
3475
3476         /* Return result */
3477         if (werror) {
3478                 *werror = r.out.result;
3479         }
3480
3481         return werror_to_ntstatus(r.out.result);
3482 }
3483
3484 struct rpccli_svcctl_GetServiceDisplayNameW_state {
3485         struct svcctl_GetServiceDisplayNameW orig;
3486         struct svcctl_GetServiceDisplayNameW tmp;
3487         TALLOC_CTX *out_mem_ctx;
3488         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
3489 };
3490
3491 static void rpccli_svcctl_GetServiceDisplayNameW_done(struct tevent_req *subreq);
3492
3493 struct tevent_req *rpccli_svcctl_GetServiceDisplayNameW_send(TALLOC_CTX *mem_ctx,
3494                                                              struct tevent_context *ev,
3495                                                              struct rpc_pipe_client *cli,
3496                                                              struct policy_handle *_handle /* [in] [ref] */,
3497                                                              const char *_service_name /* [in] [unique,charset(UTF16)] */,
3498                                                              const char **_display_name /* [out] [ref,charset(UTF16)] */,
3499                                                              uint32_t *_display_name_length /* [in,out] [unique] */)
3500 {
3501         struct tevent_req *req;
3502         struct rpccli_svcctl_GetServiceDisplayNameW_state *state;
3503         struct tevent_req *subreq;
3504
3505         req = tevent_req_create(mem_ctx, &state,
3506                                 struct rpccli_svcctl_GetServiceDisplayNameW_state);
3507         if (req == NULL) {
3508                 return NULL;
3509         }
3510         state->out_mem_ctx = NULL;
3511         state->dispatch_recv = cli->dispatch_recv;
3512
3513         /* In parameters */
3514         state->orig.in.handle = _handle;
3515         state->orig.in.service_name = _service_name;
3516         state->orig.in.display_name_length = _display_name_length;
3517
3518         /* Out parameters */
3519         state->orig.out.display_name = _display_name;
3520         state->orig.out.display_name_length = _display_name_length;
3521
3522         /* Result */
3523         ZERO_STRUCT(state->orig.out.result);
3524
3525         if (DEBUGLEVEL >= 10) {
3526                 NDR_PRINT_IN_DEBUG(svcctl_GetServiceDisplayNameW, &state->orig);
3527         }
3528
3529         state->out_mem_ctx = talloc_named_const(state, 0,
3530                              "rpccli_svcctl_GetServiceDisplayNameW_out_memory");
3531         if (tevent_req_nomem(state->out_mem_ctx, req)) {
3532                 return tevent_req_post(req, ev);
3533         }
3534
3535         /* make a temporary copy, that we pass to the dispatch function */
3536         state->tmp = state->orig;
3537
3538         subreq = cli->dispatch_send(state, ev, cli,
3539                                     &ndr_table_svcctl,
3540                                     NDR_SVCCTL_GETSERVICEDISPLAYNAMEW,
3541                                     &state->tmp);
3542         if (tevent_req_nomem(subreq, req)) {
3543                 return tevent_req_post(req, ev);
3544         }
3545         tevent_req_set_callback(subreq, rpccli_svcctl_GetServiceDisplayNameW_done, req);
3546         return req;
3547 }
3548
3549 static void rpccli_svcctl_GetServiceDisplayNameW_done(struct tevent_req *subreq)
3550 {
3551         struct tevent_req *req = tevent_req_callback_data(
3552                 subreq, struct tevent_req);
3553         struct rpccli_svcctl_GetServiceDisplayNameW_state *state = tevent_req_data(
3554                 req, struct rpccli_svcctl_GetServiceDisplayNameW_state);
3555         NTSTATUS status;
3556         TALLOC_CTX *mem_ctx;
3557
3558         if (state->out_mem_ctx) {
3559                 mem_ctx = state->out_mem_ctx;
3560         } else {
3561                 mem_ctx = state;
3562         }
3563
3564         status = state->dispatch_recv(subreq, mem_ctx);
3565         TALLOC_FREE(subreq);
3566         if (!NT_STATUS_IS_OK(status)) {
3567                 tevent_req_nterror(req, status);
3568                 return;
3569         }
3570
3571         /* Copy out parameters */
3572         *state->orig.out.display_name = *state->tmp.out.display_name;
3573         if (state->orig.out.display_name_length && state->tmp.out.display_name_length) {
3574                 *state->orig.out.display_name_length = *state->tmp.out.display_name_length;
3575         }
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         if (DEBUGLEVEL >= 10) {
3584                 NDR_PRINT_OUT_DEBUG(svcctl_GetServiceDisplayNameW, &state->orig);
3585         }
3586
3587         tevent_req_done(req);
3588 }
3589
3590 NTSTATUS rpccli_svcctl_GetServiceDisplayNameW_recv(struct tevent_req *req,
3591                                                    TALLOC_CTX *mem_ctx,
3592                                                    WERROR *result)
3593 {
3594         struct rpccli_svcctl_GetServiceDisplayNameW_state *state = tevent_req_data(
3595                 req, struct rpccli_svcctl_GetServiceDisplayNameW_state);
3596         NTSTATUS status;
3597
3598         if (tevent_req_is_nterror(req, &status)) {
3599                 tevent_req_received(req);
3600                 return status;
3601         }
3602
3603         /* Steal possbile out parameters to the callers context */
3604         talloc_steal(mem_ctx, state->out_mem_ctx);
3605
3606         /* Return result */
3607         *result = state->orig.out.result;
3608
3609         tevent_req_received(req);
3610         return NT_STATUS_OK;
3611 }
3612
3613 NTSTATUS rpccli_svcctl_GetServiceDisplayNameW(struct rpc_pipe_client *cli,
3614                                               TALLOC_CTX *mem_ctx,
3615                                               struct policy_handle *handle /* [in] [ref] */,
3616                                               const char *service_name /* [in] [unique,charset(UTF16)] */,
3617                                               const char **display_name /* [out] [ref,charset(UTF16)] */,
3618                                               uint32_t *display_name_length /* [in,out] [unique] */,
3619                                               WERROR *werror)
3620 {
3621         struct svcctl_GetServiceDisplayNameW r;
3622         NTSTATUS status;
3623
3624         /* In parameters */
3625         r.in.handle = handle;
3626         r.in.service_name = service_name;
3627         r.in.display_name_length = display_name_length;
3628
3629         if (DEBUGLEVEL >= 10) {
3630                 NDR_PRINT_IN_DEBUG(svcctl_GetServiceDisplayNameW, &r);
3631         }
3632
3633         status = cli->dispatch(cli,
3634                                 mem_ctx,
3635                                 &ndr_table_svcctl,
3636                                 NDR_SVCCTL_GETSERVICEDISPLAYNAMEW,
3637                                 &r);
3638
3639         if (!NT_STATUS_IS_OK(status)) {
3640                 return status;
3641         }
3642
3643         if (DEBUGLEVEL >= 10) {
3644                 NDR_PRINT_OUT_DEBUG(svcctl_GetServiceDisplayNameW, &r);
3645         }
3646
3647         if (NT_STATUS_IS_ERR(status)) {
3648                 return status;
3649         }
3650
3651         /* Return variables */
3652         *display_name = *r.out.display_name;
3653         if (display_name_length && r.out.display_name_length) {
3654                 *display_name_length = *r.out.display_name_length;
3655         }
3656
3657         /* Return result */
3658         if (werror) {
3659                 *werror = r.out.result;
3660         }
3661
3662         return werror_to_ntstatus(r.out.result);
3663 }
3664
3665 struct rpccli_svcctl_GetServiceKeyNameW_state {
3666         struct svcctl_GetServiceKeyNameW orig;
3667         struct svcctl_GetServiceKeyNameW tmp;
3668         TALLOC_CTX *out_mem_ctx;
3669         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
3670 };
3671
3672 static void rpccli_svcctl_GetServiceKeyNameW_done(struct tevent_req *subreq);
3673
3674 struct tevent_req *rpccli_svcctl_GetServiceKeyNameW_send(TALLOC_CTX *mem_ctx,
3675                                                          struct tevent_context *ev,
3676                                                          struct rpc_pipe_client *cli,
3677                                                          struct policy_handle *_handle /* [in] [ref] */,
3678                                                          const char *_service_name /* [in] [unique,charset(UTF16)] */,
3679                                                          const char **_key_name /* [out] [ref,charset(UTF16)] */,
3680                                                          uint32_t *_display_name_length /* [in,out] [unique] */)
3681 {
3682         struct tevent_req *req;
3683         struct rpccli_svcctl_GetServiceKeyNameW_state *state;
3684         struct tevent_req *subreq;
3685
3686         req = tevent_req_create(mem_ctx, &state,
3687                                 struct rpccli_svcctl_GetServiceKeyNameW_state);
3688         if (req == NULL) {
3689                 return NULL;
3690         }
3691         state->out_mem_ctx = NULL;
3692         state->dispatch_recv = cli->dispatch_recv;
3693
3694         /* In parameters */
3695         state->orig.in.handle = _handle;
3696         state->orig.in.service_name = _service_name;
3697         state->orig.in.display_name_length = _display_name_length;
3698
3699         /* Out parameters */
3700         state->orig.out.key_name = _key_name;
3701         state->orig.out.display_name_length = _display_name_length;
3702
3703         /* Result */
3704         ZERO_STRUCT(state->orig.out.result);
3705
3706         if (DEBUGLEVEL >= 10) {
3707                 NDR_PRINT_IN_DEBUG(svcctl_GetServiceKeyNameW, &state->orig);
3708         }
3709
3710         state->out_mem_ctx = talloc_named_const(state, 0,
3711                              "rpccli_svcctl_GetServiceKeyNameW_out_memory");
3712         if (tevent_req_nomem(state->out_mem_ctx, req)) {
3713                 return tevent_req_post(req, ev);
3714         }
3715
3716         /* make a temporary copy, that we pass to the dispatch function */
3717         state->tmp = state->orig;
3718
3719         subreq = cli->dispatch_send(state, ev, cli,
3720                                     &ndr_table_svcctl,
3721                                     NDR_SVCCTL_GETSERVICEKEYNAMEW,
3722                                     &state->tmp);
3723         if (tevent_req_nomem(subreq, req)) {
3724                 return tevent_req_post(req, ev);
3725         }
3726         tevent_req_set_callback(subreq, rpccli_svcctl_GetServiceKeyNameW_done, req);
3727         return req;
3728 }
3729
3730 static void rpccli_svcctl_GetServiceKeyNameW_done(struct tevent_req *subreq)
3731 {
3732         struct tevent_req *req = tevent_req_callback_data(
3733                 subreq, struct tevent_req);
3734         struct rpccli_svcctl_GetServiceKeyNameW_state *state = tevent_req_data(
3735                 req, struct rpccli_svcctl_GetServiceKeyNameW_state);
3736         NTSTATUS status;
3737         TALLOC_CTX *mem_ctx;
3738
3739         if (state->out_mem_ctx) {
3740                 mem_ctx = state->out_mem_ctx;
3741         } else {
3742                 mem_ctx = state;
3743         }
3744
3745         status = state->dispatch_recv(subreq, mem_ctx);
3746         TALLOC_FREE(subreq);
3747         if (!NT_STATUS_IS_OK(status)) {
3748                 tevent_req_nterror(req, status);
3749                 return;
3750         }
3751
3752         /* Copy out parameters */
3753         *state->orig.out.key_name = *state->tmp.out.key_name;
3754         if (state->orig.out.display_name_length && state->tmp.out.display_name_length) {
3755                 *state->orig.out.display_name_length = *state->tmp.out.display_name_length;
3756         }
3757
3758         /* Copy result */
3759         state->orig.out.result = state->tmp.out.result;
3760
3761         /* Reset temporary structure */
3762         ZERO_STRUCT(state->tmp);
3763
3764         if (DEBUGLEVEL >= 10) {
3765                 NDR_PRINT_OUT_DEBUG(svcctl_GetServiceKeyNameW, &state->orig);
3766         }
3767
3768         tevent_req_done(req);
3769 }
3770
3771 NTSTATUS rpccli_svcctl_GetServiceKeyNameW_recv(struct tevent_req *req,
3772                                                TALLOC_CTX *mem_ctx,
3773                                                WERROR *result)
3774 {
3775         struct rpccli_svcctl_GetServiceKeyNameW_state *state = tevent_req_data(
3776                 req, struct rpccli_svcctl_GetServiceKeyNameW_state);
3777         NTSTATUS status;
3778
3779         if (tevent_req_is_nterror(req, &status)) {
3780                 tevent_req_received(req);
3781                 return status;
3782         }
3783
3784         /* Steal possbile out parameters to the callers context */
3785         talloc_steal(mem_ctx, state->out_mem_ctx);
3786
3787         /* Return result */
3788         *result = state->orig.out.result;
3789
3790         tevent_req_received(req);
3791         return NT_STATUS_OK;
3792 }
3793
3794 NTSTATUS rpccli_svcctl_GetServiceKeyNameW(struct rpc_pipe_client *cli,
3795                                           TALLOC_CTX *mem_ctx,
3796                                           struct policy_handle *handle /* [in] [ref] */,
3797                                           const char *service_name /* [in] [unique,charset(UTF16)] */,
3798                                           const char **key_name /* [out] [ref,charset(UTF16)] */,
3799                                           uint32_t *display_name_length /* [in,out] [unique] */,
3800                                           WERROR *werror)
3801 {
3802         struct svcctl_GetServiceKeyNameW r;
3803         NTSTATUS status;
3804
3805         /* In parameters */
3806         r.in.handle = handle;
3807         r.in.service_name = service_name;
3808         r.in.display_name_length = display_name_length;
3809
3810         if (DEBUGLEVEL >= 10) {
3811                 NDR_PRINT_IN_DEBUG(svcctl_GetServiceKeyNameW, &r);
3812         }
3813
3814         status = cli->dispatch(cli,
3815                                 mem_ctx,
3816                                 &ndr_table_svcctl,
3817                                 NDR_SVCCTL_GETSERVICEKEYNAMEW,
3818                                 &r);
3819
3820         if (!NT_STATUS_IS_OK(status)) {
3821                 return status;
3822         }
3823
3824         if (DEBUGLEVEL >= 10) {
3825                 NDR_PRINT_OUT_DEBUG(svcctl_GetServiceKeyNameW, &r);
3826         }
3827
3828         if (NT_STATUS_IS_ERR(status)) {
3829                 return status;
3830         }
3831
3832         /* Return variables */
3833         *key_name = *r.out.key_name;
3834         if (display_name_length && r.out.display_name_length) {
3835                 *display_name_length = *r.out.display_name_length;
3836         }
3837
3838         /* Return result */
3839         if (werror) {
3840                 *werror = r.out.result;
3841         }
3842
3843         return werror_to_ntstatus(r.out.result);
3844 }
3845
3846 struct rpccli_svcctl_SCSetServiceBitsA_state {
3847         struct svcctl_SCSetServiceBitsA orig;
3848         struct svcctl_SCSetServiceBitsA tmp;
3849         TALLOC_CTX *out_mem_ctx;
3850         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
3851 };
3852
3853 static void rpccli_svcctl_SCSetServiceBitsA_done(struct tevent_req *subreq);
3854
3855 struct tevent_req *rpccli_svcctl_SCSetServiceBitsA_send(TALLOC_CTX *mem_ctx,
3856                                                         struct tevent_context *ev,
3857                                                         struct rpc_pipe_client *cli,
3858                                                         struct policy_handle *_handle /* [in] [ref] */,
3859                                                         uint32_t _bits /* [in]  */,
3860                                                         uint32_t _bitson /* [in]  */,
3861                                                         uint32_t _immediate /* [in]  */)
3862 {
3863         struct tevent_req *req;
3864         struct rpccli_svcctl_SCSetServiceBitsA_state *state;
3865         struct tevent_req *subreq;
3866
3867         req = tevent_req_create(mem_ctx, &state,
3868                                 struct rpccli_svcctl_SCSetServiceBitsA_state);
3869         if (req == NULL) {
3870                 return NULL;
3871         }
3872         state->out_mem_ctx = NULL;
3873         state->dispatch_recv = cli->dispatch_recv;
3874
3875         /* In parameters */
3876         state->orig.in.handle = _handle;
3877         state->orig.in.bits = _bits;
3878         state->orig.in.bitson = _bitson;
3879         state->orig.in.immediate = _immediate;
3880
3881         /* Out parameters */
3882
3883         /* Result */
3884         ZERO_STRUCT(state->orig.out.result);
3885
3886         if (DEBUGLEVEL >= 10) {
3887                 NDR_PRINT_IN_DEBUG(svcctl_SCSetServiceBitsA, &state->orig);
3888         }
3889
3890         /* make a temporary copy, that we pass to the dispatch function */
3891         state->tmp = state->orig;
3892
3893         subreq = cli->dispatch_send(state, ev, cli,
3894                                     &ndr_table_svcctl,
3895                                     NDR_SVCCTL_SCSETSERVICEBITSA,
3896                                     &state->tmp);
3897         if (tevent_req_nomem(subreq, req)) {
3898                 return tevent_req_post(req, ev);
3899         }
3900         tevent_req_set_callback(subreq, rpccli_svcctl_SCSetServiceBitsA_done, req);
3901         return req;
3902 }
3903
3904 static void rpccli_svcctl_SCSetServiceBitsA_done(struct tevent_req *subreq)
3905 {
3906         struct tevent_req *req = tevent_req_callback_data(
3907                 subreq, struct tevent_req);
3908         struct rpccli_svcctl_SCSetServiceBitsA_state *state = tevent_req_data(
3909                 req, struct rpccli_svcctl_SCSetServiceBitsA_state);
3910         NTSTATUS status;
3911         TALLOC_CTX *mem_ctx;
3912
3913         if (state->out_mem_ctx) {
3914                 mem_ctx = state->out_mem_ctx;
3915         } else {
3916                 mem_ctx = state;
3917         }
3918
3919         status = state->dispatch_recv(subreq, mem_ctx);
3920         TALLOC_FREE(subreq);
3921         if (!NT_STATUS_IS_OK(status)) {
3922                 tevent_req_nterror(req, status);
3923                 return;
3924         }
3925
3926         /* Copy out parameters */
3927
3928         /* Copy result */
3929         state->orig.out.result = state->tmp.out.result;
3930
3931         /* Reset temporary structure */
3932         ZERO_STRUCT(state->tmp);
3933
3934         if (DEBUGLEVEL >= 10) {
3935                 NDR_PRINT_OUT_DEBUG(svcctl_SCSetServiceBitsA, &state->orig);
3936         }
3937
3938         tevent_req_done(req);
3939 }
3940
3941 NTSTATUS rpccli_svcctl_SCSetServiceBitsA_recv(struct tevent_req *req,
3942                                               TALLOC_CTX *mem_ctx,
3943                                               WERROR *result)
3944 {
3945         struct rpccli_svcctl_SCSetServiceBitsA_state *state = tevent_req_data(
3946                 req, struct rpccli_svcctl_SCSetServiceBitsA_state);
3947         NTSTATUS status;
3948
3949         if (tevent_req_is_nterror(req, &status)) {
3950                 tevent_req_received(req);
3951                 return status;
3952         }
3953
3954         /* Steal possbile out parameters to the callers context */
3955         talloc_steal(mem_ctx, state->out_mem_ctx);
3956
3957         /* Return result */
3958         *result = state->orig.out.result;
3959
3960         tevent_req_received(req);
3961         return NT_STATUS_OK;
3962 }
3963
3964 NTSTATUS rpccli_svcctl_SCSetServiceBitsA(struct rpc_pipe_client *cli,
3965                                          TALLOC_CTX *mem_ctx,
3966                                          struct policy_handle *handle /* [in] [ref] */,
3967                                          uint32_t bits /* [in]  */,
3968                                          uint32_t bitson /* [in]  */,
3969                                          uint32_t immediate /* [in]  */,
3970                                          WERROR *werror)
3971 {
3972         struct svcctl_SCSetServiceBitsA r;
3973         NTSTATUS status;
3974
3975         /* In parameters */
3976         r.in.handle = handle;
3977         r.in.bits = bits;
3978         r.in.bitson = bitson;
3979         r.in.immediate = immediate;
3980
3981         if (DEBUGLEVEL >= 10) {
3982                 NDR_PRINT_IN_DEBUG(svcctl_SCSetServiceBitsA, &r);
3983         }
3984
3985         status = cli->dispatch(cli,
3986                                 mem_ctx,
3987                                 &ndr_table_svcctl,
3988                                 NDR_SVCCTL_SCSETSERVICEBITSA,
3989                                 &r);
3990
3991         if (!NT_STATUS_IS_OK(status)) {
3992                 return status;
3993         }
3994
3995         if (DEBUGLEVEL >= 10) {
3996                 NDR_PRINT_OUT_DEBUG(svcctl_SCSetServiceBitsA, &r);
3997         }
3998
3999         if (NT_STATUS_IS_ERR(status)) {
4000                 return status;
4001         }
4002
4003         /* Return variables */
4004
4005         /* Return result */
4006         if (werror) {
4007                 *werror = r.out.result;
4008         }
4009
4010         return werror_to_ntstatus(r.out.result);
4011 }
4012
4013 struct rpccli_svcctl_ChangeServiceConfigA_state {
4014         struct svcctl_ChangeServiceConfigA orig;
4015         struct svcctl_ChangeServiceConfigA tmp;
4016         TALLOC_CTX *out_mem_ctx;
4017         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
4018 };
4019
4020 static void rpccli_svcctl_ChangeServiceConfigA_done(struct tevent_req *subreq);
4021
4022 struct tevent_req *rpccli_svcctl_ChangeServiceConfigA_send(TALLOC_CTX *mem_ctx,
4023                                                            struct tevent_context *ev,
4024                                                            struct rpc_pipe_client *cli,
4025                                                            struct policy_handle *_handle /* [in] [ref] */,
4026                                                            uint32_t _type /* [in]  */,
4027                                                            enum svcctl_StartType _start_type /* [in]  */,
4028                                                            enum svcctl_ErrorControl _error_control /* [in]  */,
4029                                                            const char *_binary_path /* [in] [unique,charset(UTF16)] */,
4030                                                            const char *_load_order_group /* [in] [unique,charset(UTF16)] */,
4031                                                            uint32_t *_tag_id /* [out] [ref] */,
4032                                                            const char *_dependencies /* [in] [unique,charset(UTF16)] */,
4033                                                            const char *_service_start_name /* [in] [unique,charset(UTF16)] */,
4034                                                            const char *_password /* [in] [unique,charset(UTF16)] */,
4035                                                            const char *_display_name /* [in] [unique,charset(UTF16)] */)
4036 {
4037         struct tevent_req *req;
4038         struct rpccli_svcctl_ChangeServiceConfigA_state *state;
4039         struct tevent_req *subreq;
4040
4041         req = tevent_req_create(mem_ctx, &state,
4042                                 struct rpccli_svcctl_ChangeServiceConfigA_state);
4043         if (req == NULL) {
4044                 return NULL;
4045         }
4046         state->out_mem_ctx = NULL;
4047         state->dispatch_recv = cli->dispatch_recv;
4048
4049         /* In parameters */
4050         state->orig.in.handle = _handle;
4051         state->orig.in.type = _type;
4052         state->orig.in.start_type = _start_type;
4053         state->orig.in.error_control = _error_control;
4054         state->orig.in.binary_path = _binary_path;
4055         state->orig.in.load_order_group = _load_order_group;
4056         state->orig.in.dependencies = _dependencies;
4057         state->orig.in.service_start_name = _service_start_name;
4058         state->orig.in.password = _password;
4059         state->orig.in.display_name = _display_name;
4060
4061         /* Out parameters */
4062         state->orig.out.tag_id = _tag_id;
4063
4064         /* Result */
4065         ZERO_STRUCT(state->orig.out.result);
4066
4067         if (DEBUGLEVEL >= 10) {
4068                 NDR_PRINT_IN_DEBUG(svcctl_ChangeServiceConfigA, &state->orig);
4069         }
4070
4071         state->out_mem_ctx = talloc_named_const(state, 0,
4072                              "rpccli_svcctl_ChangeServiceConfigA_out_memory");
4073         if (tevent_req_nomem(state->out_mem_ctx, req)) {
4074                 return tevent_req_post(req, ev);
4075         }
4076
4077         /* make a temporary copy, that we pass to the dispatch function */
4078         state->tmp = state->orig;
4079
4080         subreq = cli->dispatch_send(state, ev, cli,
4081                                     &ndr_table_svcctl,
4082                                     NDR_SVCCTL_CHANGESERVICECONFIGA,
4083                                     &state->tmp);
4084         if (tevent_req_nomem(subreq, req)) {
4085                 return tevent_req_post(req, ev);
4086         }
4087         tevent_req_set_callback(subreq, rpccli_svcctl_ChangeServiceConfigA_done, req);
4088         return req;
4089 }
4090
4091 static void rpccli_svcctl_ChangeServiceConfigA_done(struct tevent_req *subreq)
4092 {
4093         struct tevent_req *req = tevent_req_callback_data(
4094                 subreq, struct tevent_req);
4095         struct rpccli_svcctl_ChangeServiceConfigA_state *state = tevent_req_data(
4096                 req, struct rpccli_svcctl_ChangeServiceConfigA_state);
4097         NTSTATUS status;
4098         TALLOC_CTX *mem_ctx;
4099
4100         if (state->out_mem_ctx) {
4101                 mem_ctx = state->out_mem_ctx;
4102         } else {
4103                 mem_ctx = state;
4104         }
4105
4106         status = state->dispatch_recv(subreq, mem_ctx);
4107         TALLOC_FREE(subreq);
4108         if (!NT_STATUS_IS_OK(status)) {
4109                 tevent_req_nterror(req, status);
4110                 return;
4111         }
4112
4113         /* Copy out parameters */
4114         *state->orig.out.tag_id = *state->tmp.out.tag_id;
4115
4116         /* Copy result */
4117         state->orig.out.result = state->tmp.out.result;
4118
4119         /* Reset temporary structure */
4120         ZERO_STRUCT(state->tmp);
4121
4122         if (DEBUGLEVEL >= 10) {
4123                 NDR_PRINT_OUT_DEBUG(svcctl_ChangeServiceConfigA, &state->orig);
4124         }
4125
4126         tevent_req_done(req);
4127 }
4128
4129 NTSTATUS rpccli_svcctl_ChangeServiceConfigA_recv(struct tevent_req *req,
4130                                                  TALLOC_CTX *mem_ctx,
4131                                                  WERROR *result)
4132 {
4133         struct rpccli_svcctl_ChangeServiceConfigA_state *state = tevent_req_data(
4134                 req, struct rpccli_svcctl_ChangeServiceConfigA_state);
4135         NTSTATUS status;
4136
4137         if (tevent_req_is_nterror(req, &status)) {
4138                 tevent_req_received(req);
4139                 return status;
4140         }
4141
4142         /* Steal possbile out parameters to the callers context */
4143         talloc_steal(mem_ctx, state->out_mem_ctx);
4144
4145         /* Return result */
4146         *result = state->orig.out.result;
4147
4148         tevent_req_received(req);
4149         return NT_STATUS_OK;
4150 }
4151
4152 NTSTATUS rpccli_svcctl_ChangeServiceConfigA(struct rpc_pipe_client *cli,
4153                                             TALLOC_CTX *mem_ctx,
4154                                             struct policy_handle *handle /* [in] [ref] */,
4155                                             uint32_t type /* [in]  */,
4156                                             enum svcctl_StartType start_type /* [in]  */,
4157                                             enum svcctl_ErrorControl error_control /* [in]  */,
4158                                             const char *binary_path /* [in] [unique,charset(UTF16)] */,
4159                                             const char *load_order_group /* [in] [unique,charset(UTF16)] */,
4160                                             uint32_t *tag_id /* [out] [ref] */,
4161                                             const char *dependencies /* [in] [unique,charset(UTF16)] */,
4162                                             const char *service_start_name /* [in] [unique,charset(UTF16)] */,
4163                                             const char *password /* [in] [unique,charset(UTF16)] */,
4164                                             const char *display_name /* [in] [unique,charset(UTF16)] */,
4165                                             WERROR *werror)
4166 {
4167         struct svcctl_ChangeServiceConfigA r;
4168         NTSTATUS status;
4169
4170         /* In parameters */
4171         r.in.handle = handle;
4172         r.in.type = type;
4173         r.in.start_type = start_type;
4174         r.in.error_control = error_control;
4175         r.in.binary_path = binary_path;
4176         r.in.load_order_group = load_order_group;
4177         r.in.dependencies = dependencies;
4178         r.in.service_start_name = service_start_name;
4179         r.in.password = password;
4180         r.in.display_name = display_name;
4181
4182         if (DEBUGLEVEL >= 10) {
4183                 NDR_PRINT_IN_DEBUG(svcctl_ChangeServiceConfigA, &r);
4184         }
4185
4186         status = cli->dispatch(cli,
4187                                 mem_ctx,
4188                                 &ndr_table_svcctl,
4189                                 NDR_SVCCTL_CHANGESERVICECONFIGA,
4190                                 &r);
4191
4192         if (!NT_STATUS_IS_OK(status)) {
4193                 return status;
4194         }
4195
4196         if (DEBUGLEVEL >= 10) {
4197                 NDR_PRINT_OUT_DEBUG(svcctl_ChangeServiceConfigA, &r);
4198         }
4199
4200         if (NT_STATUS_IS_ERR(status)) {
4201                 return status;
4202         }
4203
4204         /* Return variables */
4205         *tag_id = *r.out.tag_id;
4206
4207         /* Return result */
4208         if (werror) {
4209                 *werror = r.out.result;
4210         }
4211
4212         return werror_to_ntstatus(r.out.result);
4213 }
4214
4215 struct rpccli_svcctl_CreateServiceA_state {
4216         struct svcctl_CreateServiceA orig;
4217         struct svcctl_CreateServiceA tmp;
4218         TALLOC_CTX *out_mem_ctx;
4219         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
4220 };
4221
4222 static void rpccli_svcctl_CreateServiceA_done(struct tevent_req *subreq);
4223
4224 struct tevent_req *rpccli_svcctl_CreateServiceA_send(TALLOC_CTX *mem_ctx,
4225                                                      struct tevent_context *ev,
4226                                                      struct rpc_pipe_client *cli,
4227                                                      struct policy_handle *_handle /* [in] [ref] */,
4228                                                      const char *_ServiceName /* [in] [unique,charset(UTF16)] */,
4229                                                      const char *_DisplayName /* [in] [unique,charset(UTF16)] */,
4230                                                      uint32_t _desired_access /* [in]  */,
4231                                                      uint32_t _type /* [in]  */,
4232                                                      enum svcctl_StartType _start_type /* [in]  */,
4233                                                      enum svcctl_ErrorControl _error_control /* [in]  */,
4234                                                      const char *_binary_path /* [in] [unique,charset(UTF16)] */,
4235                                                      const char *_LoadOrderGroupKey /* [in] [unique,charset(UTF16)] */,
4236                                                      uint32_t *_TagId /* [out] [unique] */,
4237                                                      const char *_dependencies /* [in] [unique,charset(UTF16)] */,
4238                                                      const char *_service_start_name /* [in] [unique,charset(UTF16)] */,
4239                                                      const char *_password /* [in] [unique,charset(UTF16)] */)
4240 {
4241         struct tevent_req *req;
4242         struct rpccli_svcctl_CreateServiceA_state *state;
4243         struct tevent_req *subreq;
4244
4245         req = tevent_req_create(mem_ctx, &state,
4246                                 struct rpccli_svcctl_CreateServiceA_state);
4247         if (req == NULL) {
4248                 return NULL;
4249         }
4250         state->out_mem_ctx = NULL;
4251         state->dispatch_recv = cli->dispatch_recv;
4252
4253         /* In parameters */
4254         state->orig.in.handle = _handle;
4255         state->orig.in.ServiceName = _ServiceName;
4256         state->orig.in.DisplayName = _DisplayName;
4257         state->orig.in.desired_access = _desired_access;
4258         state->orig.in.type = _type;
4259         state->orig.in.start_type = _start_type;
4260         state->orig.in.error_control = _error_control;
4261         state->orig.in.binary_path = _binary_path;
4262         state->orig.in.LoadOrderGroupKey = _LoadOrderGroupKey;
4263         state->orig.in.dependencies = _dependencies;
4264         state->orig.in.service_start_name = _service_start_name;
4265         state->orig.in.password = _password;
4266
4267         /* Out parameters */
4268         state->orig.out.TagId = _TagId;
4269
4270         /* Result */
4271         ZERO_STRUCT(state->orig.out.result);
4272
4273         if (DEBUGLEVEL >= 10) {
4274                 NDR_PRINT_IN_DEBUG(svcctl_CreateServiceA, &state->orig);
4275         }
4276
4277         state->out_mem_ctx = talloc_named_const(state, 0,
4278                              "rpccli_svcctl_CreateServiceA_out_memory");
4279         if (tevent_req_nomem(state->out_mem_ctx, req)) {
4280                 return tevent_req_post(req, ev);
4281         }
4282
4283         /* make a temporary copy, that we pass to the dispatch function */
4284         state->tmp = state->orig;
4285
4286         subreq = cli->dispatch_send(state, ev, cli,
4287                                     &ndr_table_svcctl,
4288                                     NDR_SVCCTL_CREATESERVICEA,
4289                                     &state->tmp);
4290         if (tevent_req_nomem(subreq, req)) {
4291                 return tevent_req_post(req, ev);
4292         }
4293         tevent_req_set_callback(subreq, rpccli_svcctl_CreateServiceA_done, req);
4294         return req;
4295 }
4296
4297 static void rpccli_svcctl_CreateServiceA_done(struct tevent_req *subreq)
4298 {
4299         struct tevent_req *req = tevent_req_callback_data(
4300                 subreq, struct tevent_req);
4301         struct rpccli_svcctl_CreateServiceA_state *state = tevent_req_data(
4302                 req, struct rpccli_svcctl_CreateServiceA_state);
4303         NTSTATUS status;
4304         TALLOC_CTX *mem_ctx;
4305
4306         if (state->out_mem_ctx) {
4307                 mem_ctx = state->out_mem_ctx;
4308         } else {
4309                 mem_ctx = state;
4310         }
4311
4312         status = state->dispatch_recv(subreq, mem_ctx);
4313         TALLOC_FREE(subreq);
4314         if (!NT_STATUS_IS_OK(status)) {
4315                 tevent_req_nterror(req, status);
4316                 return;
4317         }
4318
4319         /* Copy out parameters */
4320         if (state->orig.out.TagId && state->tmp.out.TagId) {
4321                 *state->orig.out.TagId = *state->tmp.out.TagId;
4322         }
4323
4324         /* Copy result */
4325         state->orig.out.result = state->tmp.out.result;
4326
4327         /* Reset temporary structure */
4328         ZERO_STRUCT(state->tmp);
4329
4330         if (DEBUGLEVEL >= 10) {
4331                 NDR_PRINT_OUT_DEBUG(svcctl_CreateServiceA, &state->orig);
4332         }
4333
4334         tevent_req_done(req);
4335 }
4336
4337 NTSTATUS rpccli_svcctl_CreateServiceA_recv(struct tevent_req *req,
4338                                            TALLOC_CTX *mem_ctx,
4339                                            WERROR *result)
4340 {
4341         struct rpccli_svcctl_CreateServiceA_state *state = tevent_req_data(
4342                 req, struct rpccli_svcctl_CreateServiceA_state);
4343         NTSTATUS status;
4344
4345         if (tevent_req_is_nterror(req, &status)) {
4346                 tevent_req_received(req);
4347                 return status;
4348         }
4349
4350         /* Steal possbile out parameters to the callers context */
4351         talloc_steal(mem_ctx, state->out_mem_ctx);
4352
4353         /* Return result */
4354         *result = state->orig.out.result;
4355
4356         tevent_req_received(req);
4357         return NT_STATUS_OK;
4358 }
4359
4360 NTSTATUS rpccli_svcctl_CreateServiceA(struct rpc_pipe_client *cli,
4361                                       TALLOC_CTX *mem_ctx,
4362                                       struct policy_handle *handle /* [in] [ref] */,
4363                                       const char *ServiceName /* [in] [unique,charset(UTF16)] */,
4364                                       const char *DisplayName /* [in] [unique,charset(UTF16)] */,
4365                                       uint32_t desired_access /* [in]  */,
4366                                       uint32_t type /* [in]  */,
4367                                       enum svcctl_StartType start_type /* [in]  */,
4368                                       enum svcctl_ErrorControl error_control /* [in]  */,
4369                                       const char *binary_path /* [in] [unique,charset(UTF16)] */,
4370                                       const char *LoadOrderGroupKey /* [in] [unique,charset(UTF16)] */,
4371                                       uint32_t *TagId /* [out] [unique] */,
4372                                       const char *dependencies /* [in] [unique,charset(UTF16)] */,
4373                                       const char *service_start_name /* [in] [unique,charset(UTF16)] */,
4374                                       const char *password /* [in] [unique,charset(UTF16)] */,
4375                                       WERROR *werror)
4376 {
4377         struct svcctl_CreateServiceA r;
4378         NTSTATUS status;
4379
4380         /* In parameters */
4381         r.in.handle = handle;
4382         r.in.ServiceName = ServiceName;
4383         r.in.DisplayName = DisplayName;
4384         r.in.desired_access = desired_access;
4385         r.in.type = type;
4386         r.in.start_type = start_type;
4387         r.in.error_control = error_control;
4388         r.in.binary_path = binary_path;
4389         r.in.LoadOrderGroupKey = LoadOrderGroupKey;
4390         r.in.dependencies = dependencies;
4391         r.in.service_start_name = service_start_name;
4392         r.in.password = password;
4393
4394         if (DEBUGLEVEL >= 10) {
4395                 NDR_PRINT_IN_DEBUG(svcctl_CreateServiceA, &r);
4396         }
4397
4398         status = cli->dispatch(cli,
4399                                 mem_ctx,
4400                                 &ndr_table_svcctl,
4401                                 NDR_SVCCTL_CREATESERVICEA,
4402                                 &r);
4403
4404         if (!NT_STATUS_IS_OK(status)) {
4405                 return status;
4406         }
4407
4408         if (DEBUGLEVEL >= 10) {
4409                 NDR_PRINT_OUT_DEBUG(svcctl_CreateServiceA, &r);
4410         }
4411
4412         if (NT_STATUS_IS_ERR(status)) {
4413                 return status;
4414         }
4415
4416         /* Return variables */
4417         if (TagId && r.out.TagId) {
4418                 *TagId = *r.out.TagId;
4419         }
4420
4421         /* Return result */
4422         if (werror) {
4423                 *werror = r.out.result;
4424         }
4425
4426         return werror_to_ntstatus(r.out.result);
4427 }
4428
4429 struct rpccli_svcctl_EnumDependentServicesA_state {
4430         struct svcctl_EnumDependentServicesA orig;
4431         struct svcctl_EnumDependentServicesA tmp;
4432         TALLOC_CTX *out_mem_ctx;
4433         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
4434 };
4435
4436 static void rpccli_svcctl_EnumDependentServicesA_done(struct tevent_req *subreq);
4437
4438 struct tevent_req *rpccli_svcctl_EnumDependentServicesA_send(TALLOC_CTX *mem_ctx,
4439                                                              struct tevent_context *ev,
4440                                                              struct rpc_pipe_client *cli,
4441                                                              struct policy_handle *_service /* [in] [ref] */,
4442                                                              enum svcctl_ServiceState _state /* [in]  */,
4443                                                              struct ENUM_SERVICE_STATUSA *_service_status /* [out] [unique] */,
4444                                                              uint32_t _offered /* [in]  */,
4445                                                              uint32_t *_needed /* [out] [ref] */,
4446                                                              uint32_t *_services_returned /* [out] [ref] */)
4447 {
4448         struct tevent_req *req;
4449         struct rpccli_svcctl_EnumDependentServicesA_state *state;
4450         struct tevent_req *subreq;
4451
4452         req = tevent_req_create(mem_ctx, &state,
4453                                 struct rpccli_svcctl_EnumDependentServicesA_state);
4454         if (req == NULL) {
4455                 return NULL;
4456         }
4457         state->out_mem_ctx = NULL;
4458         state->dispatch_recv = cli->dispatch_recv;
4459
4460         /* In parameters */
4461         state->orig.in.service = _service;
4462         state->orig.in.state = _state;
4463         state->orig.in.offered = _offered;
4464
4465         /* Out parameters */
4466         state->orig.out.service_status = _service_status;
4467         state->orig.out.needed = _needed;
4468         state->orig.out.services_returned = _services_returned;
4469
4470         /* Result */
4471         ZERO_STRUCT(state->orig.out.result);
4472
4473         if (DEBUGLEVEL >= 10) {
4474                 NDR_PRINT_IN_DEBUG(svcctl_EnumDependentServicesA, &state->orig);
4475         }
4476
4477         state->out_mem_ctx = talloc_named_const(state, 0,
4478                              "rpccli_svcctl_EnumDependentServicesA_out_memory");
4479         if (tevent_req_nomem(state->out_mem_ctx, req)) {
4480                 return tevent_req_post(req, ev);
4481         }
4482
4483         /* make a temporary copy, that we pass to the dispatch function */
4484         state->tmp = state->orig;
4485
4486         subreq = cli->dispatch_send(state, ev, cli,
4487                                     &ndr_table_svcctl,
4488                                     NDR_SVCCTL_ENUMDEPENDENTSERVICESA,
4489                                     &state->tmp);
4490         if (tevent_req_nomem(subreq, req)) {
4491                 return tevent_req_post(req, ev);
4492         }
4493         tevent_req_set_callback(subreq, rpccli_svcctl_EnumDependentServicesA_done, req);
4494         return req;
4495 }
4496
4497 static void rpccli_svcctl_EnumDependentServicesA_done(struct tevent_req *subreq)
4498 {
4499         struct tevent_req *req = tevent_req_callback_data(
4500                 subreq, struct tevent_req);
4501         struct rpccli_svcctl_EnumDependentServicesA_state *state = tevent_req_data(
4502                 req, struct rpccli_svcctl_EnumDependentServicesA_state);
4503         NTSTATUS status;
4504         TALLOC_CTX *mem_ctx;
4505
4506         if (state->out_mem_ctx) {
4507                 mem_ctx = state->out_mem_ctx;
4508         } else {
4509                 mem_ctx = state;
4510         }
4511
4512         status = state->dispatch_recv(subreq, mem_ctx);
4513         TALLOC_FREE(subreq);
4514         if (!NT_STATUS_IS_OK(status)) {
4515                 tevent_req_nterror(req, status);
4516                 return;
4517         }
4518
4519         /* Copy out parameters */
4520         if (state->orig.out.service_status && state->tmp.out.service_status) {
4521                 *state->orig.out.service_status = *state->tmp.out.service_status;
4522         }
4523         *state->orig.out.needed = *state->tmp.out.needed;
4524         *state->orig.out.services_returned = *state->tmp.out.services_returned;
4525
4526         /* Copy result */
4527         state->orig.out.result = state->tmp.out.result;
4528
4529         /* Reset temporary structure */
4530         ZERO_STRUCT(state->tmp);
4531
4532         if (DEBUGLEVEL >= 10) {
4533                 NDR_PRINT_OUT_DEBUG(svcctl_EnumDependentServicesA, &state->orig);
4534         }
4535
4536         tevent_req_done(req);
4537 }
4538
4539 NTSTATUS rpccli_svcctl_EnumDependentServicesA_recv(struct tevent_req *req,
4540                                                    TALLOC_CTX *mem_ctx,
4541                                                    WERROR *result)
4542 {
4543         struct rpccli_svcctl_EnumDependentServicesA_state *state = tevent_req_data(
4544                 req, struct rpccli_svcctl_EnumDependentServicesA_state);
4545         NTSTATUS status;
4546
4547         if (tevent_req_is_nterror(req, &status)) {
4548                 tevent_req_received(req);
4549                 return status;
4550         }
4551
4552         /* Steal possbile out parameters to the callers context */
4553         talloc_steal(mem_ctx, state->out_mem_ctx);
4554
4555         /* Return result */
4556         *result = state->orig.out.result;
4557
4558         tevent_req_received(req);
4559         return NT_STATUS_OK;
4560 }
4561
4562 NTSTATUS rpccli_svcctl_EnumDependentServicesA(struct rpc_pipe_client *cli,
4563                                               TALLOC_CTX *mem_ctx,
4564                                               struct policy_handle *service /* [in] [ref] */,
4565                                               enum svcctl_ServiceState state /* [in]  */,
4566                                               struct ENUM_SERVICE_STATUSA *service_status /* [out] [unique] */,
4567                                               uint32_t offered /* [in]  */,
4568                                               uint32_t *needed /* [out] [ref] */,
4569                                               uint32_t *services_returned /* [out] [ref] */,
4570                                               WERROR *werror)
4571 {
4572         struct svcctl_EnumDependentServicesA r;
4573         NTSTATUS status;
4574
4575         /* In parameters */
4576         r.in.service = service;
4577         r.in.state = state;
4578         r.in.offered = offered;
4579
4580         if (DEBUGLEVEL >= 10) {
4581                 NDR_PRINT_IN_DEBUG(svcctl_EnumDependentServicesA, &r);
4582         }
4583
4584         status = cli->dispatch(cli,
4585                                 mem_ctx,
4586                                 &ndr_table_svcctl,
4587                                 NDR_SVCCTL_ENUMDEPENDENTSERVICESA,
4588                                 &r);
4589
4590         if (!NT_STATUS_IS_OK(status)) {
4591                 return status;
4592         }
4593
4594         if (DEBUGLEVEL >= 10) {
4595                 NDR_PRINT_OUT_DEBUG(svcctl_EnumDependentServicesA, &r);
4596         }
4597
4598         if (NT_STATUS_IS_ERR(status)) {
4599                 return status;
4600         }
4601
4602         /* Return variables */
4603         if (service_status && r.out.service_status) {
4604                 *service_status = *r.out.service_status;
4605         }
4606         *needed = *r.out.needed;
4607         *services_returned = *r.out.services_returned;
4608
4609         /* Return result */
4610         if (werror) {
4611                 *werror = r.out.result;
4612         }
4613
4614         return werror_to_ntstatus(r.out.result);
4615 }
4616
4617 struct rpccli_svcctl_EnumServicesStatusA_state {
4618         struct svcctl_EnumServicesStatusA orig;
4619         struct svcctl_EnumServicesStatusA tmp;
4620         TALLOC_CTX *out_mem_ctx;
4621         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
4622 };
4623
4624 static void rpccli_svcctl_EnumServicesStatusA_done(struct tevent_req *subreq);
4625
4626 struct tevent_req *rpccli_svcctl_EnumServicesStatusA_send(TALLOC_CTX *mem_ctx,
4627                                                           struct tevent_context *ev,
4628                                                           struct rpc_pipe_client *cli,
4629                                                           struct policy_handle *_handle /* [in] [ref] */,
4630                                                           uint32_t _type /* [in]  */,
4631                                                           enum svcctl_ServiceState _state /* [in]  */,
4632                                                           uint32_t _offered /* [in]  */,
4633                                                           uint8_t *_service /* [out] [size_is(offered)] */,
4634                                                           uint32_t *_needed /* [out] [ref] */,
4635                                                           uint32_t *_services_returned /* [out] [ref] */,
4636                                                           uint32_t *_resume_handle /* [in,out] [unique] */)
4637 {
4638         struct tevent_req *req;
4639         struct rpccli_svcctl_EnumServicesStatusA_state *state;
4640         struct tevent_req *subreq;
4641
4642         req = tevent_req_create(mem_ctx, &state,
4643                                 struct rpccli_svcctl_EnumServicesStatusA_state);
4644         if (req == NULL) {
4645                 return NULL;
4646         }
4647         state->out_mem_ctx = NULL;
4648         state->dispatch_recv = cli->dispatch_recv;
4649
4650         /* In parameters */
4651         state->orig.in.handle = _handle;
4652         state->orig.in.type = _type;
4653         state->orig.in.state = _state;
4654         state->orig.in.offered = _offered;
4655         state->orig.in.resume_handle = _resume_handle;
4656
4657         /* Out parameters */
4658         state->orig.out.service = _service;
4659         state->orig.out.needed = _needed;
4660         state->orig.out.services_returned = _services_returned;
4661         state->orig.out.resume_handle = _resume_handle;
4662
4663         /* Result */
4664         ZERO_STRUCT(state->orig.out.result);
4665
4666         if (DEBUGLEVEL >= 10) {
4667                 NDR_PRINT_IN_DEBUG(svcctl_EnumServicesStatusA, &state->orig);
4668         }
4669
4670         state->out_mem_ctx = talloc_named_const(state, 0,
4671                              "rpccli_svcctl_EnumServicesStatusA_out_memory");
4672         if (tevent_req_nomem(state->out_mem_ctx, req)) {
4673                 return tevent_req_post(req, ev);
4674         }
4675
4676         /* make a temporary copy, that we pass to the dispatch function */
4677         state->tmp = state->orig;
4678
4679         subreq = cli->dispatch_send(state, ev, cli,
4680                                     &ndr_table_svcctl,
4681                                     NDR_SVCCTL_ENUMSERVICESSTATUSA,
4682                                     &state->tmp);
4683         if (tevent_req_nomem(subreq, req)) {
4684                 return tevent_req_post(req, ev);
4685         }
4686         tevent_req_set_callback(subreq, rpccli_svcctl_EnumServicesStatusA_done, req);
4687         return req;
4688 }
4689
4690 static void rpccli_svcctl_EnumServicesStatusA_done(struct tevent_req *subreq)
4691 {
4692         struct tevent_req *req = tevent_req_callback_data(
4693                 subreq, struct tevent_req);
4694         struct rpccli_svcctl_EnumServicesStatusA_state *state = tevent_req_data(
4695                 req, struct rpccli_svcctl_EnumServicesStatusA_state);
4696         NTSTATUS status;
4697         TALLOC_CTX *mem_ctx;
4698
4699         if (state->out_mem_ctx) {
4700                 mem_ctx = state->out_mem_ctx;
4701         } else {
4702                 mem_ctx = state;
4703         }
4704
4705         status = state->dispatch_recv(subreq, mem_ctx);
4706         TALLOC_FREE(subreq);
4707         if (!NT_STATUS_IS_OK(status)) {
4708                 tevent_req_nterror(req, status);
4709                 return;
4710         }
4711
4712         /* Copy out parameters */
4713         memcpy(state->orig.out.service, state->tmp.out.service, state->tmp.in.offered * sizeof(*state->orig.out.service));
4714         *state->orig.out.needed = *state->tmp.out.needed;
4715         *state->orig.out.services_returned = *state->tmp.out.services_returned;
4716         if (state->orig.out.resume_handle && state->tmp.out.resume_handle) {
4717                 *state->orig.out.resume_handle = *state->tmp.out.resume_handle;
4718         }
4719
4720         /* Copy result */
4721         state->orig.out.result = state->tmp.out.result;
4722
4723         /* Reset temporary structure */
4724         ZERO_STRUCT(state->tmp);
4725
4726         if (DEBUGLEVEL >= 10) {
4727                 NDR_PRINT_OUT_DEBUG(svcctl_EnumServicesStatusA, &state->orig);
4728         }
4729
4730         tevent_req_done(req);
4731 }
4732
4733 NTSTATUS rpccli_svcctl_EnumServicesStatusA_recv(struct tevent_req *req,
4734                                                 TALLOC_CTX *mem_ctx,
4735                                                 WERROR *result)
4736 {
4737         struct rpccli_svcctl_EnumServicesStatusA_state *state = tevent_req_data(
4738                 req, struct rpccli_svcctl_EnumServicesStatusA_state);
4739         NTSTATUS status;
4740
4741         if (tevent_req_is_nterror(req, &status)) {
4742                 tevent_req_received(req);
4743                 return status;
4744         }
4745
4746         /* Steal possbile out parameters to the callers context */
4747         talloc_steal(mem_ctx, state->out_mem_ctx);
4748
4749         /* Return result */
4750         *result = state->orig.out.result;
4751
4752         tevent_req_received(req);
4753         return NT_STATUS_OK;
4754 }
4755
4756 NTSTATUS rpccli_svcctl_EnumServicesStatusA(struct rpc_pipe_client *cli,
4757                                            TALLOC_CTX *mem_ctx,
4758                                            struct policy_handle *handle /* [in] [ref] */,
4759                                            uint32_t type /* [in]  */,
4760                                            enum svcctl_ServiceState state /* [in]  */,
4761                                            uint32_t offered /* [in]  */,
4762                                            uint8_t *service /* [out] [size_is(offered)] */,
4763                                            uint32_t *needed /* [out] [ref] */,
4764                                            uint32_t *services_returned /* [out] [ref] */,
4765                                            uint32_t *resume_handle /* [in,out] [unique] */,
4766                                            WERROR *werror)
4767 {
4768         struct svcctl_EnumServicesStatusA r;
4769         NTSTATUS status;
4770
4771         /* In parameters */
4772         r.in.handle = handle;
4773         r.in.type = type;
4774         r.in.state = state;
4775         r.in.offered = offered;
4776         r.in.resume_handle = resume_handle;
4777
4778         if (DEBUGLEVEL >= 10) {
4779                 NDR_PRINT_IN_DEBUG(svcctl_EnumServicesStatusA, &r);
4780         }
4781
4782         status = cli->dispatch(cli,
4783                                 mem_ctx,
4784                                 &ndr_table_svcctl,
4785                                 NDR_SVCCTL_ENUMSERVICESSTATUSA,
4786                                 &r);
4787
4788         if (!NT_STATUS_IS_OK(status)) {
4789                 return status;
4790         }
4791
4792         if (DEBUGLEVEL >= 10) {
4793                 NDR_PRINT_OUT_DEBUG(svcctl_EnumServicesStatusA, &r);
4794         }
4795
4796         if (NT_STATUS_IS_ERR(status)) {
4797                 return status;
4798         }
4799
4800         /* Return variables */
4801         memcpy(service, r.out.service, r.in.offered * sizeof(*service));
4802         *needed = *r.out.needed;
4803         *services_returned = *r.out.services_returned;
4804         if (resume_handle && r.out.resume_handle) {
4805                 *resume_handle = *r.out.resume_handle;
4806         }
4807
4808         /* Return result */
4809         if (werror) {
4810                 *werror = r.out.result;
4811         }
4812
4813         return werror_to_ntstatus(r.out.result);
4814 }
4815
4816 struct rpccli_svcctl_OpenSCManagerA_state {
4817         struct svcctl_OpenSCManagerA orig;
4818         struct svcctl_OpenSCManagerA tmp;
4819         TALLOC_CTX *out_mem_ctx;
4820         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
4821 };
4822
4823 static void rpccli_svcctl_OpenSCManagerA_done(struct tevent_req *subreq);
4824
4825 struct tevent_req *rpccli_svcctl_OpenSCManagerA_send(TALLOC_CTX *mem_ctx,
4826                                                      struct tevent_context *ev,
4827                                                      struct rpc_pipe_client *cli,
4828                                                      const char *_MachineName /* [in] [unique,charset(UTF16)] */,
4829                                                      const char *_DatabaseName /* [in] [unique,charset(UTF16)] */,
4830                                                      uint32_t _access_mask /* [in]  */,
4831                                                      struct policy_handle *_handle /* [out] [ref] */)
4832 {
4833         struct tevent_req *req;
4834         struct rpccli_svcctl_OpenSCManagerA_state *state;
4835         struct tevent_req *subreq;
4836
4837         req = tevent_req_create(mem_ctx, &state,
4838                                 struct rpccli_svcctl_OpenSCManagerA_state);
4839         if (req == NULL) {
4840                 return NULL;
4841         }
4842         state->out_mem_ctx = NULL;
4843         state->dispatch_recv = cli->dispatch_recv;
4844
4845         /* In parameters */
4846         state->orig.in.MachineName = _MachineName;
4847         state->orig.in.DatabaseName = _DatabaseName;
4848         state->orig.in.access_mask = _access_mask;
4849
4850         /* Out parameters */
4851         state->orig.out.handle = _handle;
4852
4853         /* Result */
4854         ZERO_STRUCT(state->orig.out.result);
4855
4856         if (DEBUGLEVEL >= 10) {
4857                 NDR_PRINT_IN_DEBUG(svcctl_OpenSCManagerA, &state->orig);
4858         }
4859
4860         state->out_mem_ctx = talloc_named_const(state, 0,
4861                              "rpccli_svcctl_OpenSCManagerA_out_memory");
4862         if (tevent_req_nomem(state->out_mem_ctx, req)) {
4863                 return tevent_req_post(req, ev);
4864         }
4865
4866         /* make a temporary copy, that we pass to the dispatch function */
4867         state->tmp = state->orig;
4868
4869         subreq = cli->dispatch_send(state, ev, cli,
4870                                     &ndr_table_svcctl,
4871                                     NDR_SVCCTL_OPENSCMANAGERA,
4872                                     &state->tmp);
4873         if (tevent_req_nomem(subreq, req)) {
4874                 return tevent_req_post(req, ev);
4875         }
4876         tevent_req_set_callback(subreq, rpccli_svcctl_OpenSCManagerA_done, req);
4877         return req;
4878 }
4879
4880 static void rpccli_svcctl_OpenSCManagerA_done(struct tevent_req *subreq)
4881 {
4882         struct tevent_req *req = tevent_req_callback_data(
4883                 subreq, struct tevent_req);
4884         struct rpccli_svcctl_OpenSCManagerA_state *state = tevent_req_data(
4885                 req, struct rpccli_svcctl_OpenSCManagerA_state);
4886         NTSTATUS status;
4887         TALLOC_CTX *mem_ctx;
4888
4889         if (state->out_mem_ctx) {
4890                 mem_ctx = state->out_mem_ctx;
4891         } else {
4892                 mem_ctx = state;
4893         }
4894
4895         status = state->dispatch_recv(subreq, mem_ctx);
4896         TALLOC_FREE(subreq);
4897         if (!NT_STATUS_IS_OK(status)) {
4898                 tevent_req_nterror(req, status);
4899                 return;
4900         }
4901
4902         /* Copy out parameters */
4903         *state->orig.out.handle = *state->tmp.out.handle;
4904
4905         /* Copy result */
4906         state->orig.out.result = state->tmp.out.result;
4907
4908         /* Reset temporary structure */
4909         ZERO_STRUCT(state->tmp);
4910
4911         if (DEBUGLEVEL >= 10) {
4912                 NDR_PRINT_OUT_DEBUG(svcctl_OpenSCManagerA, &state->orig);
4913         }
4914
4915         tevent_req_done(req);
4916 }
4917
4918 NTSTATUS rpccli_svcctl_OpenSCManagerA_recv(struct tevent_req *req,
4919                                            TALLOC_CTX *mem_ctx,
4920                                            WERROR *result)
4921 {
4922         struct rpccli_svcctl_OpenSCManagerA_state *state = tevent_req_data(
4923                 req, struct rpccli_svcctl_OpenSCManagerA_state);
4924         NTSTATUS status;
4925
4926         if (tevent_req_is_nterror(req, &status)) {
4927                 tevent_req_received(req);
4928                 return status;
4929         }
4930
4931         /* Steal possbile out parameters to the callers context */
4932         talloc_steal(mem_ctx, state->out_mem_ctx);
4933
4934         /* Return result */
4935         *result = state->orig.out.result;
4936
4937         tevent_req_received(req);
4938         return NT_STATUS_OK;
4939 }
4940
4941 NTSTATUS rpccli_svcctl_OpenSCManagerA(struct rpc_pipe_client *cli,
4942                                       TALLOC_CTX *mem_ctx,
4943                                       const char *MachineName /* [in] [unique,charset(UTF16)] */,
4944                                       const char *DatabaseName /* [in] [unique,charset(UTF16)] */,
4945                                       uint32_t access_mask /* [in]  */,
4946                                       struct policy_handle *handle /* [out] [ref] */,
4947                                       WERROR *werror)
4948 {
4949         struct svcctl_OpenSCManagerA r;
4950         NTSTATUS status;
4951
4952         /* In parameters */
4953         r.in.MachineName = MachineName;
4954         r.in.DatabaseName = DatabaseName;
4955         r.in.access_mask = access_mask;
4956
4957         if (DEBUGLEVEL >= 10) {
4958                 NDR_PRINT_IN_DEBUG(svcctl_OpenSCManagerA, &r);
4959         }
4960
4961         status = cli->dispatch(cli,
4962                                 mem_ctx,
4963                                 &ndr_table_svcctl,
4964                                 NDR_SVCCTL_OPENSCMANAGERA,
4965                                 &r);
4966
4967         if (!NT_STATUS_IS_OK(status)) {
4968                 return status;
4969         }
4970
4971         if (DEBUGLEVEL >= 10) {
4972                 NDR_PRINT_OUT_DEBUG(svcctl_OpenSCManagerA, &r);
4973         }
4974
4975         if (NT_STATUS_IS_ERR(status)) {
4976                 return status;
4977         }
4978
4979         /* Return variables */
4980         *handle = *r.out.handle;
4981
4982         /* Return result */
4983         if (werror) {
4984                 *werror = r.out.result;
4985         }
4986
4987         return werror_to_ntstatus(r.out.result);
4988 }
4989
4990 struct rpccli_svcctl_OpenServiceA_state {
4991         struct svcctl_OpenServiceA orig;
4992         struct svcctl_OpenServiceA tmp;
4993         TALLOC_CTX *out_mem_ctx;
4994         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
4995 };
4996
4997 static void rpccli_svcctl_OpenServiceA_done(struct tevent_req *subreq);
4998
4999 struct tevent_req *rpccli_svcctl_OpenServiceA_send(TALLOC_CTX *mem_ctx,
5000                                                    struct tevent_context *ev,
5001                                                    struct rpc_pipe_client *cli,
5002                                                    struct policy_handle *_scmanager_handle /* [in] [ref] */,
5003                                                    const char *_ServiceName /* [in] [unique,charset(UTF16)] */,
5004                                                    uint32_t _access_mask /* [in]  */)
5005 {
5006         struct tevent_req *req;
5007         struct rpccli_svcctl_OpenServiceA_state *state;
5008         struct tevent_req *subreq;
5009
5010         req = tevent_req_create(mem_ctx, &state,
5011                                 struct rpccli_svcctl_OpenServiceA_state);
5012         if (req == NULL) {
5013                 return NULL;
5014         }
5015         state->out_mem_ctx = NULL;
5016         state->dispatch_recv = cli->dispatch_recv;
5017
5018         /* In parameters */
5019         state->orig.in.scmanager_handle = _scmanager_handle;
5020         state->orig.in.ServiceName = _ServiceName;
5021         state->orig.in.access_mask = _access_mask;
5022
5023         /* Out parameters */
5024
5025         /* Result */
5026         ZERO_STRUCT(state->orig.out.result);
5027
5028         if (DEBUGLEVEL >= 10) {
5029                 NDR_PRINT_IN_DEBUG(svcctl_OpenServiceA, &state->orig);
5030         }
5031
5032         /* make a temporary copy, that we pass to the dispatch function */
5033         state->tmp = state->orig;
5034
5035         subreq = cli->dispatch_send(state, ev, cli,
5036                                     &ndr_table_svcctl,
5037                                     NDR_SVCCTL_OPENSERVICEA,
5038                                     &state->tmp);
5039         if (tevent_req_nomem(subreq, req)) {
5040                 return tevent_req_post(req, ev);
5041         }
5042         tevent_req_set_callback(subreq, rpccli_svcctl_OpenServiceA_done, req);
5043         return req;
5044 }
5045
5046 static void rpccli_svcctl_OpenServiceA_done(struct tevent_req *subreq)
5047 {
5048         struct tevent_req *req = tevent_req_callback_data(
5049                 subreq, struct tevent_req);
5050         struct rpccli_svcctl_OpenServiceA_state *state = tevent_req_data(
5051                 req, struct rpccli_svcctl_OpenServiceA_state);
5052         NTSTATUS status;
5053         TALLOC_CTX *mem_ctx;
5054
5055         if (state->out_mem_ctx) {
5056                 mem_ctx = state->out_mem_ctx;
5057         } else {
5058                 mem_ctx = state;
5059         }
5060
5061         status = state->dispatch_recv(subreq, mem_ctx);
5062         TALLOC_FREE(subreq);
5063         if (!NT_STATUS_IS_OK(status)) {
5064                 tevent_req_nterror(req, status);
5065                 return;
5066         }
5067
5068         /* Copy out parameters */
5069
5070         /* Copy result */
5071         state->orig.out.result = state->tmp.out.result;
5072
5073         /* Reset temporary structure */
5074         ZERO_STRUCT(state->tmp);
5075
5076         if (DEBUGLEVEL >= 10) {
5077                 NDR_PRINT_OUT_DEBUG(svcctl_OpenServiceA, &state->orig);
5078         }
5079
5080         tevent_req_done(req);
5081 }
5082
5083 NTSTATUS rpccli_svcctl_OpenServiceA_recv(struct tevent_req *req,
5084                                          TALLOC_CTX *mem_ctx,
5085                                          WERROR *result)
5086 {
5087         struct rpccli_svcctl_OpenServiceA_state *state = tevent_req_data(
5088                 req, struct rpccli_svcctl_OpenServiceA_state);
5089         NTSTATUS status;
5090
5091         if (tevent_req_is_nterror(req, &status)) {
5092                 tevent_req_received(req);
5093                 return status;
5094         }
5095
5096         /* Steal possbile out parameters to the callers context */
5097         talloc_steal(mem_ctx, state->out_mem_ctx);
5098
5099         /* Return result */
5100         *result = state->orig.out.result;
5101
5102         tevent_req_received(req);
5103         return NT_STATUS_OK;
5104 }
5105
5106 NTSTATUS rpccli_svcctl_OpenServiceA(struct rpc_pipe_client *cli,
5107                                     TALLOC_CTX *mem_ctx,
5108                                     struct policy_handle *scmanager_handle /* [in] [ref] */,
5109                                     const char *ServiceName /* [in] [unique,charset(UTF16)] */,
5110                                     uint32_t access_mask /* [in]  */,
5111                                     WERROR *werror)
5112 {
5113         struct svcctl_OpenServiceA r;
5114         NTSTATUS status;
5115
5116         /* In parameters */
5117         r.in.scmanager_handle = scmanager_handle;
5118         r.in.ServiceName = ServiceName;
5119         r.in.access_mask = access_mask;
5120
5121         if (DEBUGLEVEL >= 10) {
5122                 NDR_PRINT_IN_DEBUG(svcctl_OpenServiceA, &r);
5123         }
5124
5125         status = cli->dispatch(cli,
5126                                 mem_ctx,
5127                                 &ndr_table_svcctl,
5128                                 NDR_SVCCTL_OPENSERVICEA,
5129                                 &r);
5130
5131         if (!NT_STATUS_IS_OK(status)) {
5132                 return status;
5133         }
5134
5135         if (DEBUGLEVEL >= 10) {
5136                 NDR_PRINT_OUT_DEBUG(svcctl_OpenServiceA, &r);
5137         }
5138
5139         if (NT_STATUS_IS_ERR(status)) {
5140                 return status;
5141         }
5142
5143         /* Return variables */
5144
5145         /* Return result */
5146         if (werror) {
5147                 *werror = r.out.result;
5148         }
5149
5150         return werror_to_ntstatus(r.out.result);
5151 }
5152
5153 struct rpccli_svcctl_QueryServiceConfigA_state {
5154         struct svcctl_QueryServiceConfigA orig;
5155         struct svcctl_QueryServiceConfigA tmp;
5156         TALLOC_CTX *out_mem_ctx;
5157         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
5158 };
5159
5160 static void rpccli_svcctl_QueryServiceConfigA_done(struct tevent_req *subreq);
5161
5162 struct tevent_req *rpccli_svcctl_QueryServiceConfigA_send(TALLOC_CTX *mem_ctx,
5163                                                           struct tevent_context *ev,
5164                                                           struct rpc_pipe_client *cli,
5165                                                           struct policy_handle *_handle /* [in] [ref] */,
5166                                                           uint8_t *_query /* [out]  */,
5167                                                           uint32_t _offered /* [in]  */,
5168                                                           uint32_t *_needed /* [out] [ref] */)
5169 {
5170         struct tevent_req *req;
5171         struct rpccli_svcctl_QueryServiceConfigA_state *state;
5172         struct tevent_req *subreq;
5173
5174         req = tevent_req_create(mem_ctx, &state,
5175                                 struct rpccli_svcctl_QueryServiceConfigA_state);
5176         if (req == NULL) {
5177                 return NULL;
5178         }
5179         state->out_mem_ctx = NULL;
5180         state->dispatch_recv = cli->dispatch_recv;
5181
5182         /* In parameters */
5183         state->orig.in.handle = _handle;
5184         state->orig.in.offered = _offered;
5185
5186         /* Out parameters */
5187         state->orig.out.query = _query;
5188         state->orig.out.needed = _needed;
5189
5190         /* Result */
5191         ZERO_STRUCT(state->orig.out.result);
5192
5193         if (DEBUGLEVEL >= 10) {
5194                 NDR_PRINT_IN_DEBUG(svcctl_QueryServiceConfigA, &state->orig);
5195         }
5196
5197         state->out_mem_ctx = talloc_named_const(state, 0,
5198                              "rpccli_svcctl_QueryServiceConfigA_out_memory");
5199         if (tevent_req_nomem(state->out_mem_ctx, req)) {
5200                 return tevent_req_post(req, ev);
5201         }
5202
5203         /* make a temporary copy, that we pass to the dispatch function */
5204         state->tmp = state->orig;
5205
5206         subreq = cli->dispatch_send(state, ev, cli,
5207                                     &ndr_table_svcctl,
5208                                     NDR_SVCCTL_QUERYSERVICECONFIGA,
5209                                     &state->tmp);
5210         if (tevent_req_nomem(subreq, req)) {
5211                 return tevent_req_post(req, ev);
5212         }
5213         tevent_req_set_callback(subreq, rpccli_svcctl_QueryServiceConfigA_done, req);
5214         return req;
5215 }
5216
5217 static void rpccli_svcctl_QueryServiceConfigA_done(struct tevent_req *subreq)
5218 {
5219         struct tevent_req *req = tevent_req_callback_data(
5220                 subreq, struct tevent_req);
5221         struct rpccli_svcctl_QueryServiceConfigA_state *state = tevent_req_data(
5222                 req, struct rpccli_svcctl_QueryServiceConfigA_state);
5223         NTSTATUS status;
5224         TALLOC_CTX *mem_ctx;
5225
5226         if (state->out_mem_ctx) {
5227                 mem_ctx = state->out_mem_ctx;
5228         } else {
5229                 mem_ctx = state;
5230         }
5231
5232         status = state->dispatch_recv(subreq, mem_ctx);
5233         TALLOC_FREE(subreq);
5234         if (!NT_STATUS_IS_OK(status)) {
5235                 tevent_req_nterror(req, status);
5236                 return;
5237         }
5238
5239         /* Copy out parameters */
5240         memcpy(state->orig.out.query, state->tmp.out.query, state->tmp.in.offered * sizeof(*state->orig.out.query));
5241         *state->orig.out.needed = *state->tmp.out.needed;
5242
5243         /* Copy result */
5244         state->orig.out.result = state->tmp.out.result;
5245
5246         /* Reset temporary structure */
5247         ZERO_STRUCT(state->tmp);
5248
5249         if (DEBUGLEVEL >= 10) {
5250                 NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceConfigA, &state->orig);
5251         }
5252
5253         tevent_req_done(req);
5254 }
5255
5256 NTSTATUS rpccli_svcctl_QueryServiceConfigA_recv(struct tevent_req *req,
5257                                                 TALLOC_CTX *mem_ctx,
5258                                                 WERROR *result)
5259 {
5260         struct rpccli_svcctl_QueryServiceConfigA_state *state = tevent_req_data(
5261                 req, struct rpccli_svcctl_QueryServiceConfigA_state);
5262         NTSTATUS status;
5263
5264         if (tevent_req_is_nterror(req, &status)) {
5265                 tevent_req_received(req);
5266                 return status;
5267         }
5268
5269         /* Steal possbile out parameters to the callers context */
5270         talloc_steal(mem_ctx, state->out_mem_ctx);
5271
5272         /* Return result */
5273         *result = state->orig.out.result;
5274
5275         tevent_req_received(req);
5276         return NT_STATUS_OK;
5277 }
5278
5279 NTSTATUS rpccli_svcctl_QueryServiceConfigA(struct rpc_pipe_client *cli,
5280                                            TALLOC_CTX *mem_ctx,
5281                                            struct policy_handle *handle /* [in] [ref] */,
5282                                            uint8_t *query /* [out]  */,
5283                                            uint32_t offered /* [in]  */,
5284                                            uint32_t *needed /* [out] [ref] */,
5285                                            WERROR *werror)
5286 {
5287         struct svcctl_QueryServiceConfigA r;
5288         NTSTATUS status;
5289
5290         /* In parameters */
5291         r.in.handle = handle;
5292         r.in.offered = offered;
5293
5294         if (DEBUGLEVEL >= 10) {
5295                 NDR_PRINT_IN_DEBUG(svcctl_QueryServiceConfigA, &r);
5296         }
5297
5298         status = cli->dispatch(cli,
5299                                 mem_ctx,
5300                                 &ndr_table_svcctl,
5301                                 NDR_SVCCTL_QUERYSERVICECONFIGA,
5302                                 &r);
5303
5304         if (!NT_STATUS_IS_OK(status)) {
5305                 return status;
5306         }
5307
5308         if (DEBUGLEVEL >= 10) {
5309                 NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceConfigA, &r);
5310         }
5311
5312         if (NT_STATUS_IS_ERR(status)) {
5313                 return status;
5314         }
5315
5316         /* Return variables */
5317         memcpy(query, r.out.query, r.in.offered * sizeof(*query));
5318         *needed = *r.out.needed;
5319
5320         /* Return result */
5321         if (werror) {
5322                 *werror = r.out.result;
5323         }
5324
5325         return werror_to_ntstatus(r.out.result);
5326 }
5327
5328 struct rpccli_svcctl_QueryServiceLockStatusA_state {
5329         struct svcctl_QueryServiceLockStatusA orig;
5330         struct svcctl_QueryServiceLockStatusA tmp;
5331         TALLOC_CTX *out_mem_ctx;
5332         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
5333 };
5334
5335 static void rpccli_svcctl_QueryServiceLockStatusA_done(struct tevent_req *subreq);
5336
5337 struct tevent_req *rpccli_svcctl_QueryServiceLockStatusA_send(TALLOC_CTX *mem_ctx,
5338                                                               struct tevent_context *ev,
5339                                                               struct rpc_pipe_client *cli,
5340                                                               struct policy_handle *_handle /* [in] [ref] */,
5341                                                               uint32_t _offered /* [in]  */,
5342                                                               struct SERVICE_LOCK_STATUS *_lock_status /* [out] [ref] */,
5343                                                               uint32_t *_needed /* [out] [ref] */)
5344 {
5345         struct tevent_req *req;
5346         struct rpccli_svcctl_QueryServiceLockStatusA_state *state;
5347         struct tevent_req *subreq;
5348
5349         req = tevent_req_create(mem_ctx, &state,
5350                                 struct rpccli_svcctl_QueryServiceLockStatusA_state);
5351         if (req == NULL) {
5352                 return NULL;
5353         }
5354         state->out_mem_ctx = NULL;
5355         state->dispatch_recv = cli->dispatch_recv;
5356
5357         /* In parameters */
5358         state->orig.in.handle = _handle;
5359         state->orig.in.offered = _offered;
5360
5361         /* Out parameters */
5362         state->orig.out.lock_status = _lock_status;
5363         state->orig.out.needed = _needed;
5364
5365         /* Result */
5366         ZERO_STRUCT(state->orig.out.result);
5367
5368         if (DEBUGLEVEL >= 10) {
5369                 NDR_PRINT_IN_DEBUG(svcctl_QueryServiceLockStatusA, &state->orig);
5370         }
5371
5372         state->out_mem_ctx = talloc_named_const(state, 0,
5373                              "rpccli_svcctl_QueryServiceLockStatusA_out_memory");
5374         if (tevent_req_nomem(state->out_mem_ctx, req)) {
5375                 return tevent_req_post(req, ev);
5376         }
5377
5378         /* make a temporary copy, that we pass to the dispatch function */
5379         state->tmp = state->orig;
5380
5381         subreq = cli->dispatch_send(state, ev, cli,
5382                                     &ndr_table_svcctl,
5383                                     NDR_SVCCTL_QUERYSERVICELOCKSTATUSA,
5384                                     &state->tmp);
5385         if (tevent_req_nomem(subreq, req)) {
5386                 return tevent_req_post(req, ev);
5387         }
5388         tevent_req_set_callback(subreq, rpccli_svcctl_QueryServiceLockStatusA_done, req);
5389         return req;
5390 }
5391
5392 static void rpccli_svcctl_QueryServiceLockStatusA_done(struct tevent_req *subreq)
5393 {
5394         struct tevent_req *req = tevent_req_callback_data(
5395                 subreq, struct tevent_req);
5396         struct rpccli_svcctl_QueryServiceLockStatusA_state *state = tevent_req_data(
5397                 req, struct rpccli_svcctl_QueryServiceLockStatusA_state);
5398         NTSTATUS status;
5399         TALLOC_CTX *mem_ctx;
5400
5401         if (state->out_mem_ctx) {
5402                 mem_ctx = state->out_mem_ctx;
5403         } else {
5404                 mem_ctx = state;
5405         }
5406
5407         status = state->dispatch_recv(subreq, mem_ctx);
5408         TALLOC_FREE(subreq);
5409         if (!NT_STATUS_IS_OK(status)) {
5410                 tevent_req_nterror(req, status);
5411                 return;
5412         }
5413
5414         /* Copy out parameters */
5415         *state->orig.out.lock_status = *state->tmp.out.lock_status;
5416         *state->orig.out.needed = *state->tmp.out.needed;
5417
5418         /* Copy result */
5419         state->orig.out.result = state->tmp.out.result;
5420
5421         /* Reset temporary structure */
5422         ZERO_STRUCT(state->tmp);
5423
5424         if (DEBUGLEVEL >= 10) {
5425                 NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceLockStatusA, &state->orig);
5426         }
5427
5428         tevent_req_done(req);
5429 }
5430
5431 NTSTATUS rpccli_svcctl_QueryServiceLockStatusA_recv(struct tevent_req *req,
5432                                                     TALLOC_CTX *mem_ctx,
5433                                                     WERROR *result)
5434 {
5435         struct rpccli_svcctl_QueryServiceLockStatusA_state *state = tevent_req_data(
5436                 req, struct rpccli_svcctl_QueryServiceLockStatusA_state);
5437         NTSTATUS status;
5438
5439         if (tevent_req_is_nterror(req, &status)) {
5440                 tevent_req_received(req);
5441                 return status;
5442         }
5443
5444         /* Steal possbile out parameters to the callers context */
5445         talloc_steal(mem_ctx, state->out_mem_ctx);
5446
5447         /* Return result */
5448         *result = state->orig.out.result;
5449
5450         tevent_req_received(req);
5451         return NT_STATUS_OK;
5452 }
5453
5454 NTSTATUS rpccli_svcctl_QueryServiceLockStatusA(struct rpc_pipe_client *cli,
5455                                                TALLOC_CTX *mem_ctx,
5456                                                struct policy_handle *handle /* [in] [ref] */,
5457                                                uint32_t offered /* [in]  */,
5458                                                struct SERVICE_LOCK_STATUS *lock_status /* [out] [ref] */,
5459                                                uint32_t *needed /* [out] [ref] */,
5460                                                WERROR *werror)
5461 {
5462         struct svcctl_QueryServiceLockStatusA r;
5463         NTSTATUS status;
5464
5465         /* In parameters */
5466         r.in.handle = handle;
5467         r.in.offered = offered;
5468
5469         if (DEBUGLEVEL >= 10) {
5470                 NDR_PRINT_IN_DEBUG(svcctl_QueryServiceLockStatusA, &r);
5471         }
5472
5473         status = cli->dispatch(cli,
5474                                 mem_ctx,
5475                                 &ndr_table_svcctl,
5476                                 NDR_SVCCTL_QUERYSERVICELOCKSTATUSA,
5477                                 &r);
5478
5479         if (!NT_STATUS_IS_OK(status)) {
5480                 return status;
5481         }
5482
5483         if (DEBUGLEVEL >= 10) {
5484                 NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceLockStatusA, &r);
5485         }
5486
5487         if (NT_STATUS_IS_ERR(status)) {
5488                 return status;
5489         }
5490
5491         /* Return variables */
5492         *lock_status = *r.out.lock_status;
5493         *needed = *r.out.needed;
5494
5495         /* Return result */
5496         if (werror) {
5497                 *werror = r.out.result;
5498         }
5499
5500         return werror_to_ntstatus(r.out.result);
5501 }
5502
5503 struct rpccli_svcctl_StartServiceA_state {
5504         struct svcctl_StartServiceA orig;
5505         struct svcctl_StartServiceA tmp;
5506         TALLOC_CTX *out_mem_ctx;
5507         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
5508 };
5509
5510 static void rpccli_svcctl_StartServiceA_done(struct tevent_req *subreq);
5511
5512 struct tevent_req *rpccli_svcctl_StartServiceA_send(TALLOC_CTX *mem_ctx,
5513                                                     struct tevent_context *ev,
5514                                                     struct rpc_pipe_client *cli,
5515                                                     struct policy_handle *_handle /* [in] [ref] */,
5516                                                     uint32_t _NumArgs /* [in]  */,
5517                                                     const char *_Arguments /* [in] [unique,charset(UTF16)] */)
5518 {
5519         struct tevent_req *req;
5520         struct rpccli_svcctl_StartServiceA_state *state;
5521         struct tevent_req *subreq;
5522
5523         req = tevent_req_create(mem_ctx, &state,
5524                                 struct rpccli_svcctl_StartServiceA_state);
5525         if (req == NULL) {
5526                 return NULL;
5527         }
5528         state->out_mem_ctx = NULL;
5529         state->dispatch_recv = cli->dispatch_recv;
5530
5531         /* In parameters */
5532         state->orig.in.handle = _handle;
5533         state->orig.in.NumArgs = _NumArgs;
5534         state->orig.in.Arguments = _Arguments;
5535
5536         /* Out parameters */
5537
5538         /* Result */
5539         ZERO_STRUCT(state->orig.out.result);
5540
5541         if (DEBUGLEVEL >= 10) {
5542                 NDR_PRINT_IN_DEBUG(svcctl_StartServiceA, &state->orig);
5543         }
5544
5545         /* make a temporary copy, that we pass to the dispatch function */
5546         state->tmp = state->orig;
5547
5548         subreq = cli->dispatch_send(state, ev, cli,
5549                                     &ndr_table_svcctl,
5550                                     NDR_SVCCTL_STARTSERVICEA,
5551                                     &state->tmp);
5552         if (tevent_req_nomem(subreq, req)) {
5553                 return tevent_req_post(req, ev);
5554         }
5555         tevent_req_set_callback(subreq, rpccli_svcctl_StartServiceA_done, req);
5556         return req;
5557 }
5558
5559 static void rpccli_svcctl_StartServiceA_done(struct tevent_req *subreq)
5560 {
5561         struct tevent_req *req = tevent_req_callback_data(
5562                 subreq, struct tevent_req);
5563         struct rpccli_svcctl_StartServiceA_state *state = tevent_req_data(
5564                 req, struct rpccli_svcctl_StartServiceA_state);
5565         NTSTATUS status;
5566         TALLOC_CTX *mem_ctx;
5567
5568         if (state->out_mem_ctx) {
5569                 mem_ctx = state->out_mem_ctx;
5570         } else {
5571                 mem_ctx = state;
5572         }
5573
5574         status = state->dispatch_recv(subreq, mem_ctx);
5575         TALLOC_FREE(subreq);
5576         if (!NT_STATUS_IS_OK(status)) {
5577                 tevent_req_nterror(req, status);
5578                 return;
5579         }
5580
5581         /* Copy out parameters */
5582
5583         /* Copy result */
5584         state->orig.out.result = state->tmp.out.result;
5585
5586         /* Reset temporary structure */
5587         ZERO_STRUCT(state->tmp);
5588
5589         if (DEBUGLEVEL >= 10) {
5590                 NDR_PRINT_OUT_DEBUG(svcctl_StartServiceA, &state->orig);
5591         }
5592
5593         tevent_req_done(req);
5594 }
5595
5596 NTSTATUS rpccli_svcctl_StartServiceA_recv(struct tevent_req *req,
5597                                           TALLOC_CTX *mem_ctx,
5598                                           WERROR *result)
5599 {
5600         struct rpccli_svcctl_StartServiceA_state *state = tevent_req_data(
5601                 req, struct rpccli_svcctl_StartServiceA_state);
5602         NTSTATUS status;
5603
5604         if (tevent_req_is_nterror(req, &status)) {
5605                 tevent_req_received(req);
5606                 return status;
5607         }
5608
5609         /* Steal possbile out parameters to the callers context */
5610         talloc_steal(mem_ctx, state->out_mem_ctx);
5611
5612         /* Return result */
5613         *result = state->orig.out.result;
5614
5615         tevent_req_received(req);
5616         return NT_STATUS_OK;
5617 }
5618
5619 NTSTATUS rpccli_svcctl_StartServiceA(struct rpc_pipe_client *cli,
5620                                      TALLOC_CTX *mem_ctx,
5621                                      struct policy_handle *handle /* [in] [ref] */,
5622                                      uint32_t NumArgs /* [in]  */,
5623                                      const char *Arguments /* [in] [unique,charset(UTF16)] */,
5624                                      WERROR *werror)
5625 {
5626         struct svcctl_StartServiceA r;
5627         NTSTATUS status;
5628
5629         /* In parameters */
5630         r.in.handle = handle;
5631         r.in.NumArgs = NumArgs;
5632         r.in.Arguments = Arguments;
5633
5634         if (DEBUGLEVEL >= 10) {
5635                 NDR_PRINT_IN_DEBUG(svcctl_StartServiceA, &r);
5636         }
5637
5638         status = cli->dispatch(cli,
5639                                 mem_ctx,
5640                                 &ndr_table_svcctl,
5641                                 NDR_SVCCTL_STARTSERVICEA,
5642                                 &r);
5643
5644         if (!NT_STATUS_IS_OK(status)) {
5645                 return status;
5646         }
5647
5648         if (DEBUGLEVEL >= 10) {
5649                 NDR_PRINT_OUT_DEBUG(svcctl_StartServiceA, &r);
5650         }
5651
5652         if (NT_STATUS_IS_ERR(status)) {
5653                 return status;
5654         }
5655
5656         /* Return variables */
5657
5658         /* Return result */
5659         if (werror) {
5660                 *werror = r.out.result;
5661         }
5662
5663         return werror_to_ntstatus(r.out.result);
5664 }
5665
5666 struct rpccli_svcctl_GetServiceDisplayNameA_state {
5667         struct svcctl_GetServiceDisplayNameA orig;
5668         struct svcctl_GetServiceDisplayNameA tmp;
5669         TALLOC_CTX *out_mem_ctx;
5670         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
5671 };
5672
5673 static void rpccli_svcctl_GetServiceDisplayNameA_done(struct tevent_req *subreq);
5674
5675 struct tevent_req *rpccli_svcctl_GetServiceDisplayNameA_send(TALLOC_CTX *mem_ctx,
5676                                                              struct tevent_context *ev,
5677                                                              struct rpc_pipe_client *cli,
5678                                                              struct policy_handle *_handle /* [in] [ref] */,
5679                                                              const char *_service_name /* [in] [unique,charset(UTF16)] */,
5680                                                              const char **_display_name /* [out] [ref,charset(UTF16)] */,
5681                                                              uint32_t *_display_name_length /* [in,out] [unique] */)
5682 {
5683         struct tevent_req *req;
5684         struct rpccli_svcctl_GetServiceDisplayNameA_state *state;
5685         struct tevent_req *subreq;
5686
5687         req = tevent_req_create(mem_ctx, &state,
5688                                 struct rpccli_svcctl_GetServiceDisplayNameA_state);
5689         if (req == NULL) {
5690                 return NULL;
5691         }
5692         state->out_mem_ctx = NULL;
5693         state->dispatch_recv = cli->dispatch_recv;
5694
5695         /* In parameters */
5696         state->orig.in.handle = _handle;
5697         state->orig.in.service_name = _service_name;
5698         state->orig.in.display_name_length = _display_name_length;
5699
5700         /* Out parameters */
5701         state->orig.out.display_name = _display_name;
5702         state->orig.out.display_name_length = _display_name_length;
5703
5704         /* Result */
5705         ZERO_STRUCT(state->orig.out.result);
5706
5707         if (DEBUGLEVEL >= 10) {
5708                 NDR_PRINT_IN_DEBUG(svcctl_GetServiceDisplayNameA, &state->orig);
5709         }
5710
5711         state->out_mem_ctx = talloc_named_const(state, 0,
5712                              "rpccli_svcctl_GetServiceDisplayNameA_out_memory");
5713         if (tevent_req_nomem(state->out_mem_ctx, req)) {
5714                 return tevent_req_post(req, ev);
5715         }
5716
5717         /* make a temporary copy, that we pass to the dispatch function */
5718         state->tmp = state->orig;
5719
5720         subreq = cli->dispatch_send(state, ev, cli,
5721                                     &ndr_table_svcctl,
5722                                     NDR_SVCCTL_GETSERVICEDISPLAYNAMEA,
5723                                     &state->tmp);
5724         if (tevent_req_nomem(subreq, req)) {
5725                 return tevent_req_post(req, ev);
5726         }
5727         tevent_req_set_callback(subreq, rpccli_svcctl_GetServiceDisplayNameA_done, req);
5728         return req;
5729 }
5730
5731 static void rpccli_svcctl_GetServiceDisplayNameA_done(struct tevent_req *subreq)
5732 {
5733         struct tevent_req *req = tevent_req_callback_data(
5734                 subreq, struct tevent_req);
5735         struct rpccli_svcctl_GetServiceDisplayNameA_state *state = tevent_req_data(
5736                 req, struct rpccli_svcctl_GetServiceDisplayNameA_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 = state->dispatch_recv(subreq, mem_ctx);
5747         TALLOC_FREE(subreq);
5748         if (!NT_STATUS_IS_OK(status)) {
5749                 tevent_req_nterror(req, status);
5750                 return;
5751         }
5752
5753         /* Copy out parameters */
5754         *state->orig.out.display_name = *state->tmp.out.display_name;
5755         if (state->orig.out.display_name_length && state->tmp.out.display_name_length) {
5756                 *state->orig.out.display_name_length = *state->tmp.out.display_name_length;
5757         }
5758
5759         /* Copy result */
5760         state->orig.out.result = state->tmp.out.result;
5761
5762         /* Reset temporary structure */
5763         ZERO_STRUCT(state->tmp);
5764
5765         if (DEBUGLEVEL >= 10) {
5766                 NDR_PRINT_OUT_DEBUG(svcctl_GetServiceDisplayNameA, &state->orig);
5767         }
5768
5769         tevent_req_done(req);
5770 }
5771
5772 NTSTATUS rpccli_svcctl_GetServiceDisplayNameA_recv(struct tevent_req *req,
5773                                                    TALLOC_CTX *mem_ctx,
5774                                                    WERROR *result)
5775 {
5776         struct rpccli_svcctl_GetServiceDisplayNameA_state *state = tevent_req_data(
5777                 req, struct rpccli_svcctl_GetServiceDisplayNameA_state);
5778         NTSTATUS status;
5779
5780         if (tevent_req_is_nterror(req, &status)) {
5781                 tevent_req_received(req);
5782                 return status;
5783         }
5784
5785         /* Steal possbile out parameters to the callers context */
5786         talloc_steal(mem_ctx, state->out_mem_ctx);
5787
5788         /* Return result */
5789         *result = state->orig.out.result;
5790
5791         tevent_req_received(req);
5792         return NT_STATUS_OK;
5793 }
5794
5795 NTSTATUS rpccli_svcctl_GetServiceDisplayNameA(struct rpc_pipe_client *cli,
5796                                               TALLOC_CTX *mem_ctx,
5797                                               struct policy_handle *handle /* [in] [ref] */,
5798                                               const char *service_name /* [in] [unique,charset(UTF16)] */,
5799                                               const char **display_name /* [out] [ref,charset(UTF16)] */,
5800                                               uint32_t *display_name_length /* [in,out] [unique] */,
5801                                               WERROR *werror)
5802 {
5803         struct svcctl_GetServiceDisplayNameA r;
5804         NTSTATUS status;
5805
5806         /* In parameters */
5807         r.in.handle = handle;
5808         r.in.service_name = service_name;
5809         r.in.display_name_length = display_name_length;
5810
5811         if (DEBUGLEVEL >= 10) {
5812                 NDR_PRINT_IN_DEBUG(svcctl_GetServiceDisplayNameA, &r);
5813         }
5814
5815         status = cli->dispatch(cli,
5816                                 mem_ctx,
5817                                 &ndr_table_svcctl,
5818                                 NDR_SVCCTL_GETSERVICEDISPLAYNAMEA,
5819                                 &r);
5820
5821         if (!NT_STATUS_IS_OK(status)) {
5822                 return status;
5823         }
5824
5825         if (DEBUGLEVEL >= 10) {
5826                 NDR_PRINT_OUT_DEBUG(svcctl_GetServiceDisplayNameA, &r);
5827         }
5828
5829         if (NT_STATUS_IS_ERR(status)) {
5830                 return status;
5831         }
5832
5833         /* Return variables */
5834         *display_name = *r.out.display_name;
5835         if (display_name_length && r.out.display_name_length) {
5836                 *display_name_length = *r.out.display_name_length;
5837         }
5838
5839         /* Return result */
5840         if (werror) {
5841                 *werror = r.out.result;
5842         }
5843
5844         return werror_to_ntstatus(r.out.result);
5845 }
5846
5847 struct rpccli_svcctl_GetServiceKeyNameA_state {
5848         struct svcctl_GetServiceKeyNameA orig;
5849         struct svcctl_GetServiceKeyNameA tmp;
5850         TALLOC_CTX *out_mem_ctx;
5851         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
5852 };
5853
5854 static void rpccli_svcctl_GetServiceKeyNameA_done(struct tevent_req *subreq);
5855
5856 struct tevent_req *rpccli_svcctl_GetServiceKeyNameA_send(TALLOC_CTX *mem_ctx,
5857                                                          struct tevent_context *ev,
5858                                                          struct rpc_pipe_client *cli,
5859                                                          struct policy_handle *_handle /* [in] [ref] */,
5860                                                          const char *_service_name /* [in] [unique,charset(UTF16)] */,
5861                                                          const char **_key_name /* [out] [ref,charset(UTF16)] */,
5862                                                          uint32_t *_display_name_length /* [in,out] [unique] */)
5863 {
5864         struct tevent_req *req;
5865         struct rpccli_svcctl_GetServiceKeyNameA_state *state;
5866         struct tevent_req *subreq;
5867
5868         req = tevent_req_create(mem_ctx, &state,
5869                                 struct rpccli_svcctl_GetServiceKeyNameA_state);
5870         if (req == NULL) {
5871                 return NULL;
5872         }
5873         state->out_mem_ctx = NULL;
5874         state->dispatch_recv = cli->dispatch_recv;
5875
5876         /* In parameters */
5877         state->orig.in.handle = _handle;
5878         state->orig.in.service_name = _service_name;
5879         state->orig.in.display_name_length = _display_name_length;
5880
5881         /* Out parameters */
5882         state->orig.out.key_name = _key_name;
5883         state->orig.out.display_name_length = _display_name_length;
5884
5885         /* Result */
5886         ZERO_STRUCT(state->orig.out.result);
5887
5888         if (DEBUGLEVEL >= 10) {
5889                 NDR_PRINT_IN_DEBUG(svcctl_GetServiceKeyNameA, &state->orig);
5890         }
5891
5892         state->out_mem_ctx = talloc_named_const(state, 0,
5893                              "rpccli_svcctl_GetServiceKeyNameA_out_memory");
5894         if (tevent_req_nomem(state->out_mem_ctx, req)) {
5895                 return tevent_req_post(req, ev);
5896         }
5897
5898         /* make a temporary copy, that we pass to the dispatch function */
5899         state->tmp = state->orig;
5900
5901         subreq = cli->dispatch_send(state, ev, cli,
5902                                     &ndr_table_svcctl,
5903                                     NDR_SVCCTL_GETSERVICEKEYNAMEA,
5904                                     &state->tmp);
5905         if (tevent_req_nomem(subreq, req)) {
5906                 return tevent_req_post(req, ev);
5907         }
5908         tevent_req_set_callback(subreq, rpccli_svcctl_GetServiceKeyNameA_done, req);
5909         return req;
5910 }
5911
5912 static void rpccli_svcctl_GetServiceKeyNameA_done(struct tevent_req *subreq)
5913 {
5914         struct tevent_req *req = tevent_req_callback_data(
5915                 subreq, struct tevent_req);
5916         struct rpccli_svcctl_GetServiceKeyNameA_state *state = tevent_req_data(
5917                 req, struct rpccli_svcctl_GetServiceKeyNameA_state);
5918         NTSTATUS status;
5919         TALLOC_CTX *mem_ctx;
5920
5921         if (state->out_mem_ctx) {
5922                 mem_ctx = state->out_mem_ctx;
5923         } else {
5924                 mem_ctx = state;
5925         }
5926
5927         status = state->dispatch_recv(subreq, mem_ctx);
5928         TALLOC_FREE(subreq);
5929         if (!NT_STATUS_IS_OK(status)) {
5930                 tevent_req_nterror(req, status);
5931                 return;
5932         }
5933
5934         /* Copy out parameters */
5935         *state->orig.out.key_name = *state->tmp.out.key_name;
5936         if (state->orig.out.display_name_length && state->tmp.out.display_name_length) {
5937                 *state->orig.out.display_name_length = *state->tmp.out.display_name_length;
5938         }
5939
5940         /* Copy result */
5941         state->orig.out.result = state->tmp.out.result;
5942
5943         /* Reset temporary structure */
5944         ZERO_STRUCT(state->tmp);
5945
5946         if (DEBUGLEVEL >= 10) {
5947                 NDR_PRINT_OUT_DEBUG(svcctl_GetServiceKeyNameA, &state->orig);
5948         }
5949
5950         tevent_req_done(req);
5951 }
5952
5953 NTSTATUS rpccli_svcctl_GetServiceKeyNameA_recv(struct tevent_req *req,
5954                                                TALLOC_CTX *mem_ctx,
5955                                                WERROR *result)
5956 {
5957         struct rpccli_svcctl_GetServiceKeyNameA_state *state = tevent_req_data(
5958                 req, struct rpccli_svcctl_GetServiceKeyNameA_state);
5959         NTSTATUS status;
5960
5961         if (tevent_req_is_nterror(req, &status)) {
5962                 tevent_req_received(req);
5963                 return status;
5964         }
5965
5966         /* Steal possbile out parameters to the callers context */
5967         talloc_steal(mem_ctx, state->out_mem_ctx);
5968
5969         /* Return result */
5970         *result = state->orig.out.result;
5971
5972         tevent_req_received(req);
5973         return NT_STATUS_OK;
5974 }
5975
5976 NTSTATUS rpccli_svcctl_GetServiceKeyNameA(struct rpc_pipe_client *cli,
5977                                           TALLOC_CTX *mem_ctx,
5978                                           struct policy_handle *handle /* [in] [ref] */,
5979                                           const char *service_name /* [in] [unique,charset(UTF16)] */,
5980                                           const char **key_name /* [out] [ref,charset(UTF16)] */,
5981                                           uint32_t *display_name_length /* [in,out] [unique] */,
5982                                           WERROR *werror)
5983 {
5984         struct svcctl_GetServiceKeyNameA r;
5985         NTSTATUS status;
5986
5987         /* In parameters */
5988         r.in.handle = handle;
5989         r.in.service_name = service_name;
5990         r.in.display_name_length = display_name_length;
5991
5992         if (DEBUGLEVEL >= 10) {
5993                 NDR_PRINT_IN_DEBUG(svcctl_GetServiceKeyNameA, &r);
5994         }
5995
5996         status = cli->dispatch(cli,
5997                                 mem_ctx,
5998                                 &ndr_table_svcctl,
5999                                 NDR_SVCCTL_GETSERVICEKEYNAMEA,
6000                                 &r);
6001
6002         if (!NT_STATUS_IS_OK(status)) {
6003                 return status;
6004         }
6005
6006         if (DEBUGLEVEL >= 10) {
6007                 NDR_PRINT_OUT_DEBUG(svcctl_GetServiceKeyNameA, &r);
6008         }
6009
6010         if (NT_STATUS_IS_ERR(status)) {
6011                 return status;
6012         }
6013
6014         /* Return variables */
6015         *key_name = *r.out.key_name;
6016         if (display_name_length && r.out.display_name_length) {
6017                 *display_name_length = *r.out.display_name_length;
6018         }
6019
6020         /* Return result */
6021         if (werror) {
6022                 *werror = r.out.result;
6023         }
6024
6025         return werror_to_ntstatus(r.out.result);
6026 }
6027
6028 struct rpccli_svcctl_GetCurrentGroupeStateW_state {
6029         struct svcctl_GetCurrentGroupeStateW orig;
6030         struct svcctl_GetCurrentGroupeStateW tmp;
6031         TALLOC_CTX *out_mem_ctx;
6032         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
6033 };
6034
6035 static void rpccli_svcctl_GetCurrentGroupeStateW_done(struct tevent_req *subreq);
6036
6037 struct tevent_req *rpccli_svcctl_GetCurrentGroupeStateW_send(TALLOC_CTX *mem_ctx,
6038                                                              struct tevent_context *ev,
6039                                                              struct rpc_pipe_client *cli)
6040 {
6041         struct tevent_req *req;
6042         struct rpccli_svcctl_GetCurrentGroupeStateW_state *state;
6043         struct tevent_req *subreq;
6044
6045         req = tevent_req_create(mem_ctx, &state,
6046                                 struct rpccli_svcctl_GetCurrentGroupeStateW_state);
6047         if (req == NULL) {
6048                 return NULL;
6049         }
6050         state->out_mem_ctx = NULL;
6051         state->dispatch_recv = cli->dispatch_recv;
6052
6053         /* In parameters */
6054
6055         /* Out parameters */
6056
6057         /* Result */
6058         ZERO_STRUCT(state->orig.out.result);
6059
6060         if (DEBUGLEVEL >= 10) {
6061                 NDR_PRINT_IN_DEBUG(svcctl_GetCurrentGroupeStateW, &state->orig);
6062         }
6063
6064         /* make a temporary copy, that we pass to the dispatch function */
6065         state->tmp = state->orig;
6066
6067         subreq = cli->dispatch_send(state, ev, cli,
6068                                     &ndr_table_svcctl,
6069                                     NDR_SVCCTL_GETCURRENTGROUPESTATEW,
6070                                     &state->tmp);
6071         if (tevent_req_nomem(subreq, req)) {
6072                 return tevent_req_post(req, ev);
6073         }
6074         tevent_req_set_callback(subreq, rpccli_svcctl_GetCurrentGroupeStateW_done, req);
6075         return req;
6076 }
6077
6078 static void rpccli_svcctl_GetCurrentGroupeStateW_done(struct tevent_req *subreq)
6079 {
6080         struct tevent_req *req = tevent_req_callback_data(
6081                 subreq, struct tevent_req);
6082         struct rpccli_svcctl_GetCurrentGroupeStateW_state *state = tevent_req_data(
6083                 req, struct rpccli_svcctl_GetCurrentGroupeStateW_state);
6084         NTSTATUS status;
6085         TALLOC_CTX *mem_ctx;
6086
6087         if (state->out_mem_ctx) {
6088                 mem_ctx = state->out_mem_ctx;
6089         } else {
6090                 mem_ctx = state;
6091         }
6092
6093         status = state->dispatch_recv(subreq, mem_ctx);
6094         TALLOC_FREE(subreq);
6095         if (!NT_STATUS_IS_OK(status)) {
6096                 tevent_req_nterror(req, status);
6097                 return;
6098         }
6099
6100         /* Copy out parameters */
6101
6102         /* Copy result */
6103         state->orig.out.result = state->tmp.out.result;
6104
6105         /* Reset temporary structure */
6106         ZERO_STRUCT(state->tmp);
6107
6108         if (DEBUGLEVEL >= 10) {
6109                 NDR_PRINT_OUT_DEBUG(svcctl_GetCurrentGroupeStateW, &state->orig);
6110         }
6111
6112         tevent_req_done(req);
6113 }
6114
6115 NTSTATUS rpccli_svcctl_GetCurrentGroupeStateW_recv(struct tevent_req *req,
6116                                                    TALLOC_CTX *mem_ctx,
6117                                                    WERROR *result)
6118 {
6119         struct rpccli_svcctl_GetCurrentGroupeStateW_state *state = tevent_req_data(
6120                 req, struct rpccli_svcctl_GetCurrentGroupeStateW_state);
6121         NTSTATUS status;
6122
6123         if (tevent_req_is_nterror(req, &status)) {
6124                 tevent_req_received(req);
6125                 return status;
6126         }
6127
6128         /* Steal possbile out parameters to the callers context */
6129         talloc_steal(mem_ctx, state->out_mem_ctx);
6130
6131         /* Return result */
6132         *result = state->orig.out.result;
6133
6134         tevent_req_received(req);
6135         return NT_STATUS_OK;
6136 }
6137
6138 NTSTATUS rpccli_svcctl_GetCurrentGroupeStateW(struct rpc_pipe_client *cli,
6139                                               TALLOC_CTX *mem_ctx,
6140                                               WERROR *werror)
6141 {
6142         struct svcctl_GetCurrentGroupeStateW r;
6143         NTSTATUS status;
6144
6145         /* In parameters */
6146
6147         if (DEBUGLEVEL >= 10) {
6148                 NDR_PRINT_IN_DEBUG(svcctl_GetCurrentGroupeStateW, &r);
6149         }
6150
6151         status = cli->dispatch(cli,
6152                                 mem_ctx,
6153                                 &ndr_table_svcctl,
6154                                 NDR_SVCCTL_GETCURRENTGROUPESTATEW,
6155                                 &r);
6156
6157         if (!NT_STATUS_IS_OK(status)) {
6158                 return status;
6159         }
6160
6161         if (DEBUGLEVEL >= 10) {
6162                 NDR_PRINT_OUT_DEBUG(svcctl_GetCurrentGroupeStateW, &r);
6163         }
6164
6165         if (NT_STATUS_IS_ERR(status)) {
6166                 return status;
6167         }
6168
6169         /* Return variables */
6170
6171         /* Return result */
6172         if (werror) {
6173                 *werror = r.out.result;
6174         }
6175
6176         return werror_to_ntstatus(r.out.result);
6177 }
6178
6179 struct rpccli_svcctl_EnumServiceGroupW_state {
6180         struct svcctl_EnumServiceGroupW orig;
6181         struct svcctl_EnumServiceGroupW tmp;
6182         TALLOC_CTX *out_mem_ctx;
6183         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
6184 };
6185
6186 static void rpccli_svcctl_EnumServiceGroupW_done(struct tevent_req *subreq);
6187
6188 struct tevent_req *rpccli_svcctl_EnumServiceGroupW_send(TALLOC_CTX *mem_ctx,
6189                                                         struct tevent_context *ev,
6190                                                         struct rpc_pipe_client *cli)
6191 {
6192         struct tevent_req *req;
6193         struct rpccli_svcctl_EnumServiceGroupW_state *state;
6194         struct tevent_req *subreq;
6195
6196         req = tevent_req_create(mem_ctx, &state,
6197                                 struct rpccli_svcctl_EnumServiceGroupW_state);
6198         if (req == NULL) {
6199                 return NULL;
6200         }
6201         state->out_mem_ctx = NULL;
6202         state->dispatch_recv = cli->dispatch_recv;
6203
6204         /* In parameters */
6205
6206         /* Out parameters */
6207
6208         /* Result */
6209         ZERO_STRUCT(state->orig.out.result);
6210
6211         if (DEBUGLEVEL >= 10) {
6212                 NDR_PRINT_IN_DEBUG(svcctl_EnumServiceGroupW, &state->orig);
6213         }
6214
6215         /* make a temporary copy, that we pass to the dispatch function */
6216         state->tmp = state->orig;
6217
6218         subreq = cli->dispatch_send(state, ev, cli,
6219                                     &ndr_table_svcctl,
6220                                     NDR_SVCCTL_ENUMSERVICEGROUPW,
6221                                     &state->tmp);
6222         if (tevent_req_nomem(subreq, req)) {
6223                 return tevent_req_post(req, ev);
6224         }
6225         tevent_req_set_callback(subreq, rpccli_svcctl_EnumServiceGroupW_done, req);
6226         return req;
6227 }
6228
6229 static void rpccli_svcctl_EnumServiceGroupW_done(struct tevent_req *subreq)
6230 {
6231         struct tevent_req *req = tevent_req_callback_data(
6232                 subreq, struct tevent_req);
6233         struct rpccli_svcctl_EnumServiceGroupW_state *state = tevent_req_data(
6234                 req, struct rpccli_svcctl_EnumServiceGroupW_state);
6235         NTSTATUS status;
6236         TALLOC_CTX *mem_ctx;
6237
6238         if (state->out_mem_ctx) {
6239                 mem_ctx = state->out_mem_ctx;
6240         } else {
6241                 mem_ctx = state;
6242         }
6243
6244         status = state->dispatch_recv(subreq, mem_ctx);
6245         TALLOC_FREE(subreq);
6246         if (!NT_STATUS_IS_OK(status)) {
6247                 tevent_req_nterror(req, status);
6248                 return;
6249         }
6250
6251         /* Copy out parameters */
6252
6253         /* Copy result */
6254         state->orig.out.result = state->tmp.out.result;
6255
6256         /* Reset temporary structure */
6257         ZERO_STRUCT(state->tmp);
6258
6259         if (DEBUGLEVEL >= 10) {
6260                 NDR_PRINT_OUT_DEBUG(svcctl_EnumServiceGroupW, &state->orig);
6261         }
6262
6263         tevent_req_done(req);
6264 }
6265
6266 NTSTATUS rpccli_svcctl_EnumServiceGroupW_recv(struct tevent_req *req,
6267                                               TALLOC_CTX *mem_ctx,
6268                                               WERROR *result)
6269 {
6270         struct rpccli_svcctl_EnumServiceGroupW_state *state = tevent_req_data(
6271                 req, struct rpccli_svcctl_EnumServiceGroupW_state);
6272         NTSTATUS status;
6273
6274         if (tevent_req_is_nterror(req, &status)) {
6275                 tevent_req_received(req);
6276                 return status;
6277         }
6278
6279         /* Steal possbile out parameters to the callers context */
6280         talloc_steal(mem_ctx, state->out_mem_ctx);
6281
6282         /* Return result */
6283         *result = state->orig.out.result;
6284
6285         tevent_req_received(req);
6286         return NT_STATUS_OK;
6287 }
6288
6289 NTSTATUS rpccli_svcctl_EnumServiceGroupW(struct rpc_pipe_client *cli,
6290                                          TALLOC_CTX *mem_ctx,
6291                                          WERROR *werror)
6292 {
6293         struct svcctl_EnumServiceGroupW r;
6294         NTSTATUS status;
6295
6296         /* In parameters */
6297
6298         if (DEBUGLEVEL >= 10) {
6299                 NDR_PRINT_IN_DEBUG(svcctl_EnumServiceGroupW, &r);
6300         }
6301
6302         status = cli->dispatch(cli,
6303                                 mem_ctx,
6304                                 &ndr_table_svcctl,
6305                                 NDR_SVCCTL_ENUMSERVICEGROUPW,
6306                                 &r);
6307
6308         if (!NT_STATUS_IS_OK(status)) {
6309                 return status;
6310         }
6311
6312         if (DEBUGLEVEL >= 10) {
6313                 NDR_PRINT_OUT_DEBUG(svcctl_EnumServiceGroupW, &r);
6314         }
6315
6316         if (NT_STATUS_IS_ERR(status)) {
6317                 return status;
6318         }
6319
6320         /* Return variables */
6321
6322         /* Return result */
6323         if (werror) {
6324                 *werror = r.out.result;
6325         }
6326
6327         return werror_to_ntstatus(r.out.result);
6328 }
6329
6330 struct rpccli_svcctl_ChangeServiceConfig2A_state {
6331         struct svcctl_ChangeServiceConfig2A orig;
6332         struct svcctl_ChangeServiceConfig2A tmp;
6333         TALLOC_CTX *out_mem_ctx;
6334         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
6335 };
6336
6337 static void rpccli_svcctl_ChangeServiceConfig2A_done(struct tevent_req *subreq);
6338
6339 struct tevent_req *rpccli_svcctl_ChangeServiceConfig2A_send(TALLOC_CTX *mem_ctx,
6340                                                             struct tevent_context *ev,
6341                                                             struct rpc_pipe_client *cli,
6342                                                             struct policy_handle *_handle /* [in] [ref] */,
6343                                                             uint32_t _info_level /* [in]  */,
6344                                                             uint8_t *_info /* [in] [unique] */)
6345 {
6346         struct tevent_req *req;
6347         struct rpccli_svcctl_ChangeServiceConfig2A_state *state;
6348         struct tevent_req *subreq;
6349
6350         req = tevent_req_create(mem_ctx, &state,
6351                                 struct rpccli_svcctl_ChangeServiceConfig2A_state);
6352         if (req == NULL) {
6353                 return NULL;
6354         }
6355         state->out_mem_ctx = NULL;
6356         state->dispatch_recv = cli->dispatch_recv;
6357
6358         /* In parameters */
6359         state->orig.in.handle = _handle;
6360         state->orig.in.info_level = _info_level;
6361         state->orig.in.info = _info;
6362
6363         /* Out parameters */
6364
6365         /* Result */
6366         ZERO_STRUCT(state->orig.out.result);
6367
6368         if (DEBUGLEVEL >= 10) {
6369                 NDR_PRINT_IN_DEBUG(svcctl_ChangeServiceConfig2A, &state->orig);
6370         }
6371
6372         /* make a temporary copy, that we pass to the dispatch function */
6373         state->tmp = state->orig;
6374
6375         subreq = cli->dispatch_send(state, ev, cli,
6376                                     &ndr_table_svcctl,
6377                                     NDR_SVCCTL_CHANGESERVICECONFIG2A,
6378                                     &state->tmp);
6379         if (tevent_req_nomem(subreq, req)) {
6380                 return tevent_req_post(req, ev);
6381         }
6382         tevent_req_set_callback(subreq, rpccli_svcctl_ChangeServiceConfig2A_done, req);
6383         return req;
6384 }
6385
6386 static void rpccli_svcctl_ChangeServiceConfig2A_done(struct tevent_req *subreq)
6387 {
6388         struct tevent_req *req = tevent_req_callback_data(
6389                 subreq, struct tevent_req);
6390         struct rpccli_svcctl_ChangeServiceConfig2A_state *state = tevent_req_data(
6391                 req, struct rpccli_svcctl_ChangeServiceConfig2A_state);
6392         NTSTATUS status;
6393         TALLOC_CTX *mem_ctx;
6394
6395         if (state->out_mem_ctx) {
6396                 mem_ctx = state->out_mem_ctx;
6397         } else {
6398                 mem_ctx = state;
6399         }
6400
6401         status = state->dispatch_recv(subreq, mem_ctx);
6402         TALLOC_FREE(subreq);
6403         if (!NT_STATUS_IS_OK(status)) {
6404                 tevent_req_nterror(req, status);
6405                 return;
6406         }
6407
6408         /* Copy out parameters */
6409
6410         /* Copy result */
6411         state->orig.out.result = state->tmp.out.result;
6412
6413         /* Reset temporary structure */
6414         ZERO_STRUCT(state->tmp);
6415
6416         if (DEBUGLEVEL >= 10) {
6417                 NDR_PRINT_OUT_DEBUG(svcctl_ChangeServiceConfig2A, &state->orig);
6418         }
6419
6420         tevent_req_done(req);
6421 }
6422
6423 NTSTATUS rpccli_svcctl_ChangeServiceConfig2A_recv(struct tevent_req *req,
6424                                                   TALLOC_CTX *mem_ctx,
6425                                                   WERROR *result)
6426 {
6427         struct rpccli_svcctl_ChangeServiceConfig2A_state *state = tevent_req_data(
6428                 req, struct rpccli_svcctl_ChangeServiceConfig2A_state);
6429         NTSTATUS status;
6430
6431         if (tevent_req_is_nterror(req, &status)) {
6432                 tevent_req_received(req);
6433                 return status;
6434         }
6435
6436         /* Steal possbile out parameters to the callers context */
6437         talloc_steal(mem_ctx, state->out_mem_ctx);
6438
6439         /* Return result */
6440         *result = state->orig.out.result;
6441
6442         tevent_req_received(req);
6443         return NT_STATUS_OK;
6444 }
6445
6446 NTSTATUS rpccli_svcctl_ChangeServiceConfig2A(struct rpc_pipe_client *cli,
6447                                              TALLOC_CTX *mem_ctx,
6448                                              struct policy_handle *handle /* [in] [ref] */,
6449                                              uint32_t info_level /* [in]  */,
6450                                              uint8_t *info /* [in] [unique] */,
6451                                              WERROR *werror)
6452 {
6453         struct svcctl_ChangeServiceConfig2A r;
6454         NTSTATUS status;
6455
6456         /* In parameters */
6457         r.in.handle = handle;
6458         r.in.info_level = info_level;
6459         r.in.info = info;
6460
6461         if (DEBUGLEVEL >= 10) {
6462                 NDR_PRINT_IN_DEBUG(svcctl_ChangeServiceConfig2A, &r);
6463         }
6464
6465         status = cli->dispatch(cli,
6466                                 mem_ctx,
6467                                 &ndr_table_svcctl,
6468                                 NDR_SVCCTL_CHANGESERVICECONFIG2A,
6469                                 &r);
6470
6471         if (!NT_STATUS_IS_OK(status)) {
6472                 return status;
6473         }
6474
6475         if (DEBUGLEVEL >= 10) {
6476                 NDR_PRINT_OUT_DEBUG(svcctl_ChangeServiceConfig2A, &r);
6477         }
6478
6479         if (NT_STATUS_IS_ERR(status)) {
6480                 return status;
6481         }
6482
6483         /* Return variables */
6484
6485         /* Return result */
6486         if (werror) {
6487                 *werror = r.out.result;
6488         }
6489
6490         return werror_to_ntstatus(r.out.result);
6491 }
6492
6493 struct rpccli_svcctl_ChangeServiceConfig2W_state {
6494         struct svcctl_ChangeServiceConfig2W orig;
6495         struct svcctl_ChangeServiceConfig2W tmp;
6496         TALLOC_CTX *out_mem_ctx;
6497         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
6498 };
6499
6500 static void rpccli_svcctl_ChangeServiceConfig2W_done(struct tevent_req *subreq);
6501
6502 struct tevent_req *rpccli_svcctl_ChangeServiceConfig2W_send(TALLOC_CTX *mem_ctx,
6503                                                             struct tevent_context *ev,
6504                                                             struct rpc_pipe_client *cli,
6505                                                             struct policy_handle *_handle /* [in] [ref] */,
6506                                                             uint32_t _info_level /* [in]  */,
6507                                                             uint8_t *_info /* [in] [unique] */)
6508 {
6509         struct tevent_req *req;
6510         struct rpccli_svcctl_ChangeServiceConfig2W_state *state;
6511         struct tevent_req *subreq;
6512
6513         req = tevent_req_create(mem_ctx, &state,
6514                                 struct rpccli_svcctl_ChangeServiceConfig2W_state);
6515         if (req == NULL) {
6516                 return NULL;
6517         }
6518         state->out_mem_ctx = NULL;
6519         state->dispatch_recv = cli->dispatch_recv;
6520
6521         /* In parameters */
6522         state->orig.in.handle = _handle;
6523         state->orig.in.info_level = _info_level;
6524         state->orig.in.info = _info;
6525
6526         /* Out parameters */
6527
6528         /* Result */
6529         ZERO_STRUCT(state->orig.out.result);
6530
6531         if (DEBUGLEVEL >= 10) {
6532                 NDR_PRINT_IN_DEBUG(svcctl_ChangeServiceConfig2W, &state->orig);
6533         }
6534
6535         /* make a temporary copy, that we pass to the dispatch function */
6536         state->tmp = state->orig;
6537
6538         subreq = cli->dispatch_send(state, ev, cli,
6539                                     &ndr_table_svcctl,
6540                                     NDR_SVCCTL_CHANGESERVICECONFIG2W,
6541                                     &state->tmp);
6542         if (tevent_req_nomem(subreq, req)) {
6543                 return tevent_req_post(req, ev);
6544         }
6545         tevent_req_set_callback(subreq, rpccli_svcctl_ChangeServiceConfig2W_done, req);
6546         return req;
6547 }
6548
6549 static void rpccli_svcctl_ChangeServiceConfig2W_done(struct tevent_req *subreq)
6550 {
6551         struct tevent_req *req = tevent_req_callback_data(
6552                 subreq, struct tevent_req);
6553         struct rpccli_svcctl_ChangeServiceConfig2W_state *state = tevent_req_data(
6554                 req, struct rpccli_svcctl_ChangeServiceConfig2W_state);
6555         NTSTATUS status;
6556         TALLOC_CTX *mem_ctx;
6557
6558         if (state->out_mem_ctx) {
6559                 mem_ctx = state->out_mem_ctx;
6560         } else {
6561                 mem_ctx = state;
6562         }
6563
6564         status = state->dispatch_recv(subreq, mem_ctx);
6565         TALLOC_FREE(subreq);
6566         if (!NT_STATUS_IS_OK(status)) {
6567                 tevent_req_nterror(req, status);
6568                 return;
6569         }
6570
6571         /* Copy out parameters */
6572
6573         /* Copy result */
6574         state->orig.out.result = state->tmp.out.result;
6575
6576         /* Reset temporary structure */
6577         ZERO_STRUCT(state->tmp);
6578
6579         if (DEBUGLEVEL >= 10) {
6580                 NDR_PRINT_OUT_DEBUG(svcctl_ChangeServiceConfig2W, &state->orig);
6581         }
6582
6583         tevent_req_done(req);
6584 }
6585
6586 NTSTATUS rpccli_svcctl_ChangeServiceConfig2W_recv(struct tevent_req *req,
6587                                                   TALLOC_CTX *mem_ctx,
6588                                                   WERROR *result)
6589 {
6590         struct rpccli_svcctl_ChangeServiceConfig2W_state *state = tevent_req_data(
6591                 req, struct rpccli_svcctl_ChangeServiceConfig2W_state);
6592         NTSTATUS status;
6593
6594         if (tevent_req_is_nterror(req, &status)) {
6595                 tevent_req_received(req);
6596                 return status;
6597         }
6598
6599         /* Steal possbile out parameters to the callers context */
6600         talloc_steal(mem_ctx, state->out_mem_ctx);
6601
6602         /* Return result */
6603         *result = state->orig.out.result;
6604
6605         tevent_req_received(req);
6606         return NT_STATUS_OK;
6607 }
6608
6609 NTSTATUS rpccli_svcctl_ChangeServiceConfig2W(struct rpc_pipe_client *cli,
6610                                              TALLOC_CTX *mem_ctx,
6611                                              struct policy_handle *handle /* [in] [ref] */,
6612                                              uint32_t info_level /* [in]  */,
6613                                              uint8_t *info /* [in] [unique] */,
6614                                              WERROR *werror)
6615 {
6616         struct svcctl_ChangeServiceConfig2W r;
6617         NTSTATUS status;
6618
6619         /* In parameters */
6620         r.in.handle = handle;
6621         r.in.info_level = info_level;
6622         r.in.info = info;
6623
6624         if (DEBUGLEVEL >= 10) {
6625                 NDR_PRINT_IN_DEBUG(svcctl_ChangeServiceConfig2W, &r);
6626         }
6627
6628         status = cli->dispatch(cli,
6629                                 mem_ctx,
6630                                 &ndr_table_svcctl,
6631                                 NDR_SVCCTL_CHANGESERVICECONFIG2W,
6632                                 &r);
6633
6634         if (!NT_STATUS_IS_OK(status)) {
6635                 return status;
6636         }
6637
6638         if (DEBUGLEVEL >= 10) {
6639                 NDR_PRINT_OUT_DEBUG(svcctl_ChangeServiceConfig2W, &r);
6640         }
6641
6642         if (NT_STATUS_IS_ERR(status)) {
6643                 return status;
6644         }
6645
6646         /* Return variables */
6647
6648         /* Return result */
6649         if (werror) {
6650                 *werror = r.out.result;
6651         }
6652
6653         return werror_to_ntstatus(r.out.result);
6654 }
6655
6656 struct rpccli_svcctl_QueryServiceConfig2A_state {
6657         struct svcctl_QueryServiceConfig2A orig;
6658         struct svcctl_QueryServiceConfig2A tmp;
6659         TALLOC_CTX *out_mem_ctx;
6660         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
6661 };
6662
6663 static void rpccli_svcctl_QueryServiceConfig2A_done(struct tevent_req *subreq);
6664
6665 struct tevent_req *rpccli_svcctl_QueryServiceConfig2A_send(TALLOC_CTX *mem_ctx,
6666                                                            struct tevent_context *ev,
6667                                                            struct rpc_pipe_client *cli,
6668                                                            struct policy_handle *_handle /* [in] [ref] */,
6669                                                            enum svcctl_ConfigLevel _info_level /* [in]  */,
6670                                                            uint8_t *_buffer /* [out]  */,
6671                                                            uint32_t _offered /* [in]  */,
6672                                                            uint32_t *_needed /* [out] [ref] */)
6673 {
6674         struct tevent_req *req;
6675         struct rpccli_svcctl_QueryServiceConfig2A_state *state;
6676         struct tevent_req *subreq;
6677
6678         req = tevent_req_create(mem_ctx, &state,
6679                                 struct rpccli_svcctl_QueryServiceConfig2A_state);
6680         if (req == NULL) {
6681                 return NULL;
6682         }
6683         state->out_mem_ctx = NULL;
6684         state->dispatch_recv = cli->dispatch_recv;
6685
6686         /* In parameters */
6687         state->orig.in.handle = _handle;
6688         state->orig.in.info_level = _info_level;
6689         state->orig.in.offered = _offered;
6690
6691         /* Out parameters */
6692         state->orig.out.buffer = _buffer;
6693         state->orig.out.needed = _needed;
6694
6695         /* Result */
6696         ZERO_STRUCT(state->orig.out.result);
6697
6698         if (DEBUGLEVEL >= 10) {
6699                 NDR_PRINT_IN_DEBUG(svcctl_QueryServiceConfig2A, &state->orig);
6700         }
6701
6702         state->out_mem_ctx = talloc_named_const(state, 0,
6703                              "rpccli_svcctl_QueryServiceConfig2A_out_memory");
6704         if (tevent_req_nomem(state->out_mem_ctx, req)) {
6705                 return tevent_req_post(req, ev);
6706         }
6707
6708         /* make a temporary copy, that we pass to the dispatch function */
6709         state->tmp = state->orig;
6710
6711         subreq = cli->dispatch_send(state, ev, cli,
6712                                     &ndr_table_svcctl,
6713                                     NDR_SVCCTL_QUERYSERVICECONFIG2A,
6714                                     &state->tmp);
6715         if (tevent_req_nomem(subreq, req)) {
6716                 return tevent_req_post(req, ev);
6717         }
6718         tevent_req_set_callback(subreq, rpccli_svcctl_QueryServiceConfig2A_done, req);
6719         return req;
6720 }
6721
6722 static void rpccli_svcctl_QueryServiceConfig2A_done(struct tevent_req *subreq)
6723 {
6724         struct tevent_req *req = tevent_req_callback_data(
6725                 subreq, struct tevent_req);
6726         struct rpccli_svcctl_QueryServiceConfig2A_state *state = tevent_req_data(
6727                 req, struct rpccli_svcctl_QueryServiceConfig2A_state);
6728         NTSTATUS status;
6729         TALLOC_CTX *mem_ctx;
6730
6731         if (state->out_mem_ctx) {
6732                 mem_ctx = state->out_mem_ctx;
6733         } else {
6734                 mem_ctx = state;
6735         }
6736
6737         status = state->dispatch_recv(subreq, mem_ctx);
6738         TALLOC_FREE(subreq);
6739         if (!NT_STATUS_IS_OK(status)) {
6740                 tevent_req_nterror(req, status);
6741                 return;
6742         }
6743
6744         /* Copy out parameters */
6745         memcpy(state->orig.out.buffer, state->tmp.out.buffer, state->tmp.in.offered * sizeof(*state->orig.out.buffer));
6746         *state->orig.out.needed = *state->tmp.out.needed;
6747
6748         /* Copy result */
6749         state->orig.out.result = state->tmp.out.result;
6750
6751         /* Reset temporary structure */
6752         ZERO_STRUCT(state->tmp);
6753
6754         if (DEBUGLEVEL >= 10) {
6755                 NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceConfig2A, &state->orig);
6756         }
6757
6758         tevent_req_done(req);
6759 }
6760
6761 NTSTATUS rpccli_svcctl_QueryServiceConfig2A_recv(struct tevent_req *req,
6762                                                  TALLOC_CTX *mem_ctx,
6763                                                  WERROR *result)
6764 {
6765         struct rpccli_svcctl_QueryServiceConfig2A_state *state = tevent_req_data(
6766                 req, struct rpccli_svcctl_QueryServiceConfig2A_state);
6767         NTSTATUS status;
6768
6769         if (tevent_req_is_nterror(req, &status)) {
6770                 tevent_req_received(req);
6771                 return status;
6772         }
6773
6774         /* Steal possbile out parameters to the callers context */
6775         talloc_steal(mem_ctx, state->out_mem_ctx);
6776
6777         /* Return result */
6778         *result = state->orig.out.result;
6779
6780         tevent_req_received(req);
6781         return NT_STATUS_OK;
6782 }
6783
6784 NTSTATUS rpccli_svcctl_QueryServiceConfig2A(struct rpc_pipe_client *cli,
6785                                             TALLOC_CTX *mem_ctx,
6786                                             struct policy_handle *handle /* [in] [ref] */,
6787                                             enum svcctl_ConfigLevel info_level /* [in]  */,
6788                                             uint8_t *buffer /* [out]  */,
6789                                             uint32_t offered /* [in]  */,
6790                                             uint32_t *needed /* [out] [ref] */,
6791                                             WERROR *werror)
6792 {
6793         struct svcctl_QueryServiceConfig2A r;
6794         NTSTATUS status;
6795
6796         /* In parameters */
6797         r.in.handle = handle;
6798         r.in.info_level = info_level;
6799         r.in.offered = offered;
6800
6801         if (DEBUGLEVEL >= 10) {
6802                 NDR_PRINT_IN_DEBUG(svcctl_QueryServiceConfig2A, &r);
6803         }
6804
6805         status = cli->dispatch(cli,
6806                                 mem_ctx,
6807                                 &ndr_table_svcctl,
6808                                 NDR_SVCCTL_QUERYSERVICECONFIG2A,
6809                                 &r);
6810
6811         if (!NT_STATUS_IS_OK(status)) {
6812                 return status;
6813         }
6814
6815         if (DEBUGLEVEL >= 10) {
6816                 NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceConfig2A, &r);
6817         }
6818
6819         if (NT_STATUS_IS_ERR(status)) {
6820                 return status;
6821         }
6822
6823         /* Return variables */
6824         memcpy(buffer, r.out.buffer, r.in.offered * sizeof(*buffer));
6825         *needed = *r.out.needed;
6826
6827         /* Return result */
6828         if (werror) {
6829                 *werror = r.out.result;
6830         }
6831
6832         return werror_to_ntstatus(r.out.result);
6833 }
6834
6835 struct rpccli_svcctl_QueryServiceConfig2W_state {
6836         struct svcctl_QueryServiceConfig2W orig;
6837         struct svcctl_QueryServiceConfig2W tmp;
6838         TALLOC_CTX *out_mem_ctx;
6839         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
6840 };
6841
6842 static void rpccli_svcctl_QueryServiceConfig2W_done(struct tevent_req *subreq);
6843
6844 struct tevent_req *rpccli_svcctl_QueryServiceConfig2W_send(TALLOC_CTX *mem_ctx,
6845                                                            struct tevent_context *ev,
6846                                                            struct rpc_pipe_client *cli,
6847                                                            struct policy_handle *_handle /* [in] [ref] */,
6848                                                            enum svcctl_ConfigLevel _info_level /* [in]  */,
6849                                                            uint8_t *_buffer /* [out] [ref,size_is(offered)] */,
6850                                                            uint32_t _offered /* [in] [range(0,8192)] */,
6851                                                            uint32_t *_needed /* [out] [ref,range(0,8192)] */)
6852 {
6853         struct tevent_req *req;
6854         struct rpccli_svcctl_QueryServiceConfig2W_state *state;
6855         struct tevent_req *subreq;
6856
6857         req = tevent_req_create(mem_ctx, &state,
6858                                 struct rpccli_svcctl_QueryServiceConfig2W_state);
6859         if (req == NULL) {
6860                 return NULL;
6861         }
6862         state->out_mem_ctx = NULL;
6863         state->dispatch_recv = cli->dispatch_recv;
6864
6865         /* In parameters */
6866         state->orig.in.handle = _handle;
6867         state->orig.in.info_level = _info_level;
6868         state->orig.in.offered = _offered;
6869
6870         /* Out parameters */
6871         state->orig.out.buffer = _buffer;
6872         state->orig.out.needed = _needed;
6873
6874         /* Result */
6875         ZERO_STRUCT(state->orig.out.result);
6876
6877         if (DEBUGLEVEL >= 10) {
6878                 NDR_PRINT_IN_DEBUG(svcctl_QueryServiceConfig2W, &state->orig);
6879         }
6880
6881         state->out_mem_ctx = talloc_named_const(state, 0,
6882                              "rpccli_svcctl_QueryServiceConfig2W_out_memory");
6883         if (tevent_req_nomem(state->out_mem_ctx, req)) {
6884                 return tevent_req_post(req, ev);
6885         }
6886
6887         /* make a temporary copy, that we pass to the dispatch function */
6888         state->tmp = state->orig;
6889
6890         subreq = cli->dispatch_send(state, ev, cli,
6891                                     &ndr_table_svcctl,
6892                                     NDR_SVCCTL_QUERYSERVICECONFIG2W,
6893                                     &state->tmp);
6894         if (tevent_req_nomem(subreq, req)) {
6895                 return tevent_req_post(req, ev);
6896         }
6897         tevent_req_set_callback(subreq, rpccli_svcctl_QueryServiceConfig2W_done, req);
6898         return req;
6899 }
6900
6901 static void rpccli_svcctl_QueryServiceConfig2W_done(struct tevent_req *subreq)
6902 {
6903         struct tevent_req *req = tevent_req_callback_data(
6904                 subreq, struct tevent_req);
6905         struct rpccli_svcctl_QueryServiceConfig2W_state *state = tevent_req_data(
6906                 req, struct rpccli_svcctl_QueryServiceConfig2W_state);
6907         NTSTATUS status;
6908         TALLOC_CTX *mem_ctx;
6909
6910         if (state->out_mem_ctx) {
6911                 mem_ctx = state->out_mem_ctx;
6912         } else {
6913                 mem_ctx = state;
6914         }
6915
6916         status = state->dispatch_recv(subreq, mem_ctx);
6917         TALLOC_FREE(subreq);
6918         if (!NT_STATUS_IS_OK(status)) {
6919                 tevent_req_nterror(req, status);
6920                 return;
6921         }
6922
6923         /* Copy out parameters */
6924         memcpy(state->orig.out.buffer, state->tmp.out.buffer, state->tmp.in.offered * sizeof(*state->orig.out.buffer));
6925         *state->orig.out.needed = *state->tmp.out.needed;
6926
6927         /* Copy result */
6928         state->orig.out.result = state->tmp.out.result;
6929
6930         /* Reset temporary structure */
6931         ZERO_STRUCT(state->tmp);
6932
6933         if (DEBUGLEVEL >= 10) {
6934                 NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceConfig2W, &state->orig);
6935         }
6936
6937         tevent_req_done(req);
6938 }
6939
6940 NTSTATUS rpccli_svcctl_QueryServiceConfig2W_recv(struct tevent_req *req,
6941                                                  TALLOC_CTX *mem_ctx,
6942                                                  WERROR *result)
6943 {
6944         struct rpccli_svcctl_QueryServiceConfig2W_state *state = tevent_req_data(
6945                 req, struct rpccli_svcctl_QueryServiceConfig2W_state);
6946         NTSTATUS status;
6947
6948         if (tevent_req_is_nterror(req, &status)) {
6949                 tevent_req_received(req);
6950                 return status;
6951         }
6952
6953         /* Steal possbile out parameters to the callers context */
6954         talloc_steal(mem_ctx, state->out_mem_ctx);
6955
6956         /* Return result */
6957         *result = state->orig.out.result;
6958
6959         tevent_req_received(req);
6960         return NT_STATUS_OK;
6961 }
6962
6963 NTSTATUS rpccli_svcctl_QueryServiceConfig2W(struct rpc_pipe_client *cli,
6964                                             TALLOC_CTX *mem_ctx,
6965                                             struct policy_handle *handle /* [in] [ref] */,
6966                                             enum svcctl_ConfigLevel info_level /* [in]  */,
6967                                             uint8_t *buffer /* [out] [ref,size_is(offered)] */,
6968                                             uint32_t offered /* [in] [range(0,8192)] */,
6969                                             uint32_t *needed /* [out] [ref,range(0,8192)] */,
6970                                             WERROR *werror)
6971 {
6972         struct svcctl_QueryServiceConfig2W r;
6973         NTSTATUS status;
6974
6975         /* In parameters */
6976         r.in.handle = handle;
6977         r.in.info_level = info_level;
6978         r.in.offered = offered;
6979
6980         if (DEBUGLEVEL >= 10) {
6981                 NDR_PRINT_IN_DEBUG(svcctl_QueryServiceConfig2W, &r);
6982         }
6983
6984         status = cli->dispatch(cli,
6985                                 mem_ctx,
6986                                 &ndr_table_svcctl,
6987                                 NDR_SVCCTL_QUERYSERVICECONFIG2W,
6988                                 &r);
6989
6990         if (!NT_STATUS_IS_OK(status)) {
6991                 return status;
6992         }
6993
6994         if (DEBUGLEVEL >= 10) {
6995                 NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceConfig2W, &r);
6996         }
6997
6998         if (NT_STATUS_IS_ERR(status)) {
6999                 return status;
7000         }
7001
7002         /* Return variables */
7003         memcpy(buffer, r.out.buffer, r.in.offered * sizeof(*buffer));
7004         *needed = *r.out.needed;
7005
7006         /* Return result */
7007         if (werror) {
7008                 *werror = r.out.result;
7009         }
7010
7011         return werror_to_ntstatus(r.out.result);
7012 }
7013
7014 struct rpccli_svcctl_QueryServiceStatusEx_state {
7015         struct svcctl_QueryServiceStatusEx orig;
7016         struct svcctl_QueryServiceStatusEx tmp;
7017         TALLOC_CTX *out_mem_ctx;
7018         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
7019 };
7020
7021 static void rpccli_svcctl_QueryServiceStatusEx_done(struct tevent_req *subreq);
7022
7023 struct tevent_req *rpccli_svcctl_QueryServiceStatusEx_send(TALLOC_CTX *mem_ctx,
7024                                                            struct tevent_context *ev,
7025                                                            struct rpc_pipe_client *cli,
7026                                                            struct policy_handle *_handle /* [in] [ref] */,
7027                                                            enum svcctl_StatusLevel _info_level /* [in]  */,
7028                                                            uint8_t *_buffer /* [out] [ref,size_is(offered)] */,
7029                                                            uint32_t _offered /* [in] [range(0,8192)] */,
7030                                                            uint32_t *_needed /* [out] [ref,range(0,8192)] */)
7031 {
7032         struct tevent_req *req;
7033         struct rpccli_svcctl_QueryServiceStatusEx_state *state;
7034         struct tevent_req *subreq;
7035
7036         req = tevent_req_create(mem_ctx, &state,
7037                                 struct rpccli_svcctl_QueryServiceStatusEx_state);
7038         if (req == NULL) {
7039                 return NULL;
7040         }
7041         state->out_mem_ctx = NULL;
7042         state->dispatch_recv = cli->dispatch_recv;
7043
7044         /* In parameters */
7045         state->orig.in.handle = _handle;
7046         state->orig.in.info_level = _info_level;
7047         state->orig.in.offered = _offered;
7048
7049         /* Out parameters */
7050         state->orig.out.buffer = _buffer;
7051         state->orig.out.needed = _needed;
7052
7053         /* Result */
7054         ZERO_STRUCT(state->orig.out.result);
7055
7056         if (DEBUGLEVEL >= 10) {
7057                 NDR_PRINT_IN_DEBUG(svcctl_QueryServiceStatusEx, &state->orig);
7058         }
7059
7060         state->out_mem_ctx = talloc_named_const(state, 0,
7061                              "rpccli_svcctl_QueryServiceStatusEx_out_memory");
7062         if (tevent_req_nomem(state->out_mem_ctx, req)) {
7063                 return tevent_req_post(req, ev);
7064         }
7065
7066         /* make a temporary copy, that we pass to the dispatch function */
7067         state->tmp = state->orig;
7068
7069         subreq = cli->dispatch_send(state, ev, cli,
7070                                     &ndr_table_svcctl,
7071                                     NDR_SVCCTL_QUERYSERVICESTATUSEX,
7072                                     &state->tmp);
7073         if (tevent_req_nomem(subreq, req)) {
7074                 return tevent_req_post(req, ev);
7075         }
7076         tevent_req_set_callback(subreq, rpccli_svcctl_QueryServiceStatusEx_done, req);
7077         return req;
7078 }
7079
7080 static void rpccli_svcctl_QueryServiceStatusEx_done(struct tevent_req *subreq)
7081 {
7082         struct tevent_req *req = tevent_req_callback_data(
7083                 subreq, struct tevent_req);
7084         struct rpccli_svcctl_QueryServiceStatusEx_state *state = tevent_req_data(
7085                 req, struct rpccli_svcctl_QueryServiceStatusEx_state);
7086         NTSTATUS status;
7087         TALLOC_CTX *mem_ctx;
7088
7089         if (state->out_mem_ctx) {
7090                 mem_ctx = state->out_mem_ctx;
7091         } else {
7092                 mem_ctx = state;
7093         }
7094
7095         status = state->dispatch_recv(subreq, mem_ctx);
7096         TALLOC_FREE(subreq);
7097         if (!NT_STATUS_IS_OK(status)) {
7098                 tevent_req_nterror(req, status);
7099                 return;
7100         }
7101
7102         /* Copy out parameters */
7103         memcpy(state->orig.out.buffer, state->tmp.out.buffer, state->tmp.in.offered * sizeof(*state->orig.out.buffer));
7104         *state->orig.out.needed = *state->tmp.out.needed;
7105
7106         /* Copy result */
7107         state->orig.out.result = state->tmp.out.result;
7108
7109         /* Reset temporary structure */
7110         ZERO_STRUCT(state->tmp);
7111
7112         if (DEBUGLEVEL >= 10) {
7113                 NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceStatusEx, &state->orig);
7114         }
7115
7116         tevent_req_done(req);
7117 }
7118
7119 NTSTATUS rpccli_svcctl_QueryServiceStatusEx_recv(struct tevent_req *req,
7120                                                  TALLOC_CTX *mem_ctx,
7121                                                  WERROR *result)
7122 {
7123         struct rpccli_svcctl_QueryServiceStatusEx_state *state = tevent_req_data(
7124                 req, struct rpccli_svcctl_QueryServiceStatusEx_state);
7125         NTSTATUS status;
7126
7127         if (tevent_req_is_nterror(req, &status)) {
7128                 tevent_req_received(req);
7129                 return status;
7130         }
7131
7132         /* Steal possbile out parameters to the callers context */
7133         talloc_steal(mem_ctx, state->out_mem_ctx);
7134
7135         /* Return result */
7136         *result = state->orig.out.result;
7137
7138         tevent_req_received(req);
7139         return NT_STATUS_OK;
7140 }
7141
7142 NTSTATUS rpccli_svcctl_QueryServiceStatusEx(struct rpc_pipe_client *cli,
7143                                             TALLOC_CTX *mem_ctx,
7144                                             struct policy_handle *handle /* [in] [ref] */,
7145                                             enum svcctl_StatusLevel info_level /* [in]  */,
7146                                             uint8_t *buffer /* [out] [ref,size_is(offered)] */,
7147                                             uint32_t offered /* [in] [range(0,8192)] */,
7148                                             uint32_t *needed /* [out] [ref,range(0,8192)] */,
7149                                             WERROR *werror)
7150 {
7151         struct svcctl_QueryServiceStatusEx r;
7152         NTSTATUS status;
7153
7154         /* In parameters */
7155         r.in.handle = handle;
7156         r.in.info_level = info_level;
7157         r.in.offered = offered;
7158
7159         if (DEBUGLEVEL >= 10) {
7160                 NDR_PRINT_IN_DEBUG(svcctl_QueryServiceStatusEx, &r);
7161         }
7162
7163         status = cli->dispatch(cli,
7164                                 mem_ctx,
7165                                 &ndr_table_svcctl,
7166                                 NDR_SVCCTL_QUERYSERVICESTATUSEX,
7167                                 &r);
7168
7169         if (!NT_STATUS_IS_OK(status)) {
7170                 return status;
7171         }
7172
7173         if (DEBUGLEVEL >= 10) {
7174                 NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceStatusEx, &r);
7175         }
7176
7177         if (NT_STATUS_IS_ERR(status)) {
7178                 return status;
7179         }
7180
7181         /* Return variables */
7182         memcpy(buffer, r.out.buffer, r.in.offered * sizeof(*buffer));
7183         *needed = *r.out.needed;
7184
7185         /* Return result */
7186         if (werror) {
7187                 *werror = r.out.result;
7188         }
7189
7190         return werror_to_ntstatus(r.out.result);
7191 }
7192
7193 struct rpccli_EnumServicesStatusExA_state {
7194         struct EnumServicesStatusExA orig;
7195         struct EnumServicesStatusExA tmp;
7196         TALLOC_CTX *out_mem_ctx;
7197         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
7198 };
7199
7200 static void rpccli_EnumServicesStatusExA_done(struct tevent_req *subreq);
7201
7202 struct tevent_req *rpccli_EnumServicesStatusExA_send(TALLOC_CTX *mem_ctx,
7203                                                      struct tevent_context *ev,
7204                                                      struct rpc_pipe_client *cli,
7205                                                      struct policy_handle *_scmanager /* [in] [ref] */,
7206                                                      uint32_t _info_level /* [in]  */,
7207                                                      uint32_t _type /* [in]  */,
7208                                                      enum svcctl_ServiceState _state /* [in]  */,
7209                                                      uint8_t *_services /* [out]  */,
7210                                                      uint32_t _offered /* [in]  */,
7211                                                      uint32_t *_needed /* [out] [ref] */,
7212                                                      uint32_t *_service_returned /* [out] [ref] */,
7213                                                      uint32_t *_resume_handle /* [in,out] [unique] */,
7214                                                      const char **_group_name /* [out] [ref,charset(UTF16)] */)
7215 {
7216         struct tevent_req *req;
7217         struct rpccli_EnumServicesStatusExA_state *state;
7218         struct tevent_req *subreq;
7219
7220         req = tevent_req_create(mem_ctx, &state,
7221                                 struct rpccli_EnumServicesStatusExA_state);
7222         if (req == NULL) {
7223                 return NULL;
7224         }
7225         state->out_mem_ctx = NULL;
7226         state->dispatch_recv = cli->dispatch_recv;
7227
7228         /* In parameters */
7229         state->orig.in.scmanager = _scmanager;
7230         state->orig.in.info_level = _info_level;
7231         state->orig.in.type = _type;
7232         state->orig.in.state = _state;
7233         state->orig.in.offered = _offered;
7234         state->orig.in.resume_handle = _resume_handle;
7235
7236         /* Out parameters */
7237         state->orig.out.services = _services;
7238         state->orig.out.needed = _needed;
7239         state->orig.out.service_returned = _service_returned;
7240         state->orig.out.resume_handle = _resume_handle;
7241         state->orig.out.group_name = _group_name;
7242
7243         /* Result */
7244         ZERO_STRUCT(state->orig.out.result);
7245
7246         if (DEBUGLEVEL >= 10) {
7247                 NDR_PRINT_IN_DEBUG(EnumServicesStatusExA, &state->orig);
7248         }
7249
7250         state->out_mem_ctx = talloc_named_const(state, 0,
7251                              "rpccli_EnumServicesStatusExA_out_memory");
7252         if (tevent_req_nomem(state->out_mem_ctx, req)) {
7253                 return tevent_req_post(req, ev);
7254         }
7255
7256         /* make a temporary copy, that we pass to the dispatch function */
7257         state->tmp = state->orig;
7258
7259         subreq = cli->dispatch_send(state, ev, cli,
7260                                     &ndr_table_svcctl,
7261                                     NDR_ENUMSERVICESSTATUSEXA,
7262                                     &state->tmp);
7263         if (tevent_req_nomem(subreq, req)) {
7264                 return tevent_req_post(req, ev);
7265         }
7266         tevent_req_set_callback(subreq, rpccli_EnumServicesStatusExA_done, req);
7267         return req;
7268 }
7269
7270 static void rpccli_EnumServicesStatusExA_done(struct tevent_req *subreq)
7271 {
7272         struct tevent_req *req = tevent_req_callback_data(
7273                 subreq, struct tevent_req);
7274         struct rpccli_EnumServicesStatusExA_state *state = tevent_req_data(
7275                 req, struct rpccli_EnumServicesStatusExA_state);
7276         NTSTATUS status;
7277         TALLOC_CTX *mem_ctx;
7278
7279         if (state->out_mem_ctx) {
7280                 mem_ctx = state->out_mem_ctx;
7281         } else {
7282                 mem_ctx = state;
7283         }
7284
7285         status = state->dispatch_recv(subreq, mem_ctx);
7286         TALLOC_FREE(subreq);
7287         if (!NT_STATUS_IS_OK(status)) {
7288                 tevent_req_nterror(req, status);
7289                 return;
7290         }
7291
7292         /* Copy out parameters */
7293         memcpy(state->orig.out.services, state->tmp.out.services, state->tmp.in.offered * sizeof(*state->orig.out.services));
7294         *state->orig.out.needed = *state->tmp.out.needed;
7295         *state->orig.out.service_returned = *state->tmp.out.service_returned;
7296         if (state->orig.out.resume_handle && state->tmp.out.resume_handle) {
7297                 *state->orig.out.resume_handle = *state->tmp.out.resume_handle;
7298         }
7299         *state->orig.out.group_name = *state->tmp.out.group_name;
7300
7301         /* Copy result */
7302         state->orig.out.result = state->tmp.out.result;
7303
7304         /* Reset temporary structure */
7305         ZERO_STRUCT(state->tmp);
7306
7307         if (DEBUGLEVEL >= 10) {
7308                 NDR_PRINT_OUT_DEBUG(EnumServicesStatusExA, &state->orig);
7309         }
7310
7311         tevent_req_done(req);
7312 }
7313
7314 NTSTATUS rpccli_EnumServicesStatusExA_recv(struct tevent_req *req,
7315                                            TALLOC_CTX *mem_ctx,
7316                                            WERROR *result)
7317 {
7318         struct rpccli_EnumServicesStatusExA_state *state = tevent_req_data(
7319                 req, struct rpccli_EnumServicesStatusExA_state);
7320         NTSTATUS status;
7321
7322         if (tevent_req_is_nterror(req, &status)) {
7323                 tevent_req_received(req);
7324                 return status;
7325         }
7326
7327         /* Steal possbile out parameters to the callers context */
7328         talloc_steal(mem_ctx, state->out_mem_ctx);
7329
7330         /* Return result */
7331         *result = state->orig.out.result;
7332
7333         tevent_req_received(req);
7334         return NT_STATUS_OK;
7335 }
7336
7337 NTSTATUS rpccli_EnumServicesStatusExA(struct rpc_pipe_client *cli,
7338                                       TALLOC_CTX *mem_ctx,
7339                                       struct policy_handle *scmanager /* [in] [ref] */,
7340                                       uint32_t info_level /* [in]  */,
7341                                       uint32_t type /* [in]  */,
7342                                       enum svcctl_ServiceState state /* [in]  */,
7343                                       uint8_t *services /* [out]  */,
7344                                       uint32_t offered /* [in]  */,
7345                                       uint32_t *needed /* [out] [ref] */,
7346                                       uint32_t *service_returned /* [out] [ref] */,
7347                                       uint32_t *resume_handle /* [in,out] [unique] */,
7348                                       const char **group_name /* [out] [ref,charset(UTF16)] */,
7349                                       WERROR *werror)
7350 {
7351         struct EnumServicesStatusExA r;
7352         NTSTATUS status;
7353
7354         /* In parameters */
7355         r.in.scmanager = scmanager;
7356         r.in.info_level = info_level;
7357         r.in.type = type;
7358         r.in.state = state;
7359         r.in.offered = offered;
7360         r.in.resume_handle = resume_handle;
7361
7362         if (DEBUGLEVEL >= 10) {
7363                 NDR_PRINT_IN_DEBUG(EnumServicesStatusExA, &r);
7364         }
7365
7366         status = cli->dispatch(cli,
7367                                 mem_ctx,
7368                                 &ndr_table_svcctl,
7369                                 NDR_ENUMSERVICESSTATUSEXA,
7370                                 &r);
7371
7372         if (!NT_STATUS_IS_OK(status)) {
7373                 return status;
7374         }
7375
7376         if (DEBUGLEVEL >= 10) {
7377                 NDR_PRINT_OUT_DEBUG(EnumServicesStatusExA, &r);
7378         }
7379
7380         if (NT_STATUS_IS_ERR(status)) {
7381                 return status;
7382         }
7383
7384         /* Return variables */
7385         memcpy(services, r.out.services, r.in.offered * sizeof(*services));
7386         *needed = *r.out.needed;
7387         *service_returned = *r.out.service_returned;
7388         if (resume_handle && r.out.resume_handle) {
7389                 *resume_handle = *r.out.resume_handle;
7390         }
7391         *group_name = *r.out.group_name;
7392
7393         /* Return result */
7394         if (werror) {
7395                 *werror = r.out.result;
7396         }
7397
7398         return werror_to_ntstatus(r.out.result);
7399 }
7400
7401 struct rpccli_EnumServicesStatusExW_state {
7402         struct EnumServicesStatusExW orig;
7403         struct EnumServicesStatusExW tmp;
7404         TALLOC_CTX *out_mem_ctx;
7405         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
7406 };
7407
7408 static void rpccli_EnumServicesStatusExW_done(struct tevent_req *subreq);
7409
7410 struct tevent_req *rpccli_EnumServicesStatusExW_send(TALLOC_CTX *mem_ctx,
7411                                                      struct tevent_context *ev,
7412                                                      struct rpc_pipe_client *cli,
7413                                                      struct policy_handle *_scmanager /* [in] [ref] */,
7414                                                      uint32_t _info_level /* [in]  */,
7415                                                      uint32_t _type /* [in]  */,
7416                                                      enum svcctl_ServiceState _state /* [in]  */,
7417                                                      uint8_t *_services /* [out] [ref,size_is(offered)] */,
7418                                                      uint32_t _offered /* [in] [range(0,0x40000)] */,
7419                                                      uint32_t *_needed /* [out] [ref,range(0,0x40000)] */,
7420                                                      uint32_t *_service_returned /* [out] [ref,range(0,0x40000)] */,
7421                                                      uint32_t *_resume_handle /* [in,out] [unique,range(0,0x40000)] */,
7422                                                      const char *_group_name /* [in] [unique,charset(UTF16)] */)
7423 {
7424         struct tevent_req *req;
7425         struct rpccli_EnumServicesStatusExW_state *state;
7426         struct tevent_req *subreq;
7427
7428         req = tevent_req_create(mem_ctx, &state,
7429                                 struct rpccli_EnumServicesStatusExW_state);
7430         if (req == NULL) {
7431                 return NULL;
7432         }
7433         state->out_mem_ctx = NULL;
7434         state->dispatch_recv = cli->dispatch_recv;
7435
7436         /* In parameters */
7437         state->orig.in.scmanager = _scmanager;
7438         state->orig.in.info_level = _info_level;
7439         state->orig.in.type = _type;
7440         state->orig.in.state = _state;
7441         state->orig.in.offered = _offered;
7442         state->orig.in.resume_handle = _resume_handle;
7443         state->orig.in.group_name = _group_name;
7444
7445         /* Out parameters */
7446         state->orig.out.services = _services;
7447         state->orig.out.needed = _needed;
7448         state->orig.out.service_returned = _service_returned;
7449         state->orig.out.resume_handle = _resume_handle;
7450
7451         /* Result */
7452         ZERO_STRUCT(state->orig.out.result);
7453
7454         if (DEBUGLEVEL >= 10) {
7455                 NDR_PRINT_IN_DEBUG(EnumServicesStatusExW, &state->orig);
7456         }
7457
7458         state->out_mem_ctx = talloc_named_const(state, 0,
7459                              "rpccli_EnumServicesStatusExW_out_memory");
7460         if (tevent_req_nomem(state->out_mem_ctx, req)) {
7461                 return tevent_req_post(req, ev);
7462         }
7463
7464         /* make a temporary copy, that we pass to the dispatch function */
7465         state->tmp = state->orig;
7466
7467         subreq = cli->dispatch_send(state, ev, cli,
7468                                     &ndr_table_svcctl,
7469                                     NDR_ENUMSERVICESSTATUSEXW,
7470                                     &state->tmp);
7471         if (tevent_req_nomem(subreq, req)) {
7472                 return tevent_req_post(req, ev);
7473         }
7474         tevent_req_set_callback(subreq, rpccli_EnumServicesStatusExW_done, req);
7475         return req;
7476 }
7477
7478 static void rpccli_EnumServicesStatusExW_done(struct tevent_req *subreq)
7479 {
7480         struct tevent_req *req = tevent_req_callback_data(
7481                 subreq, struct tevent_req);
7482         struct rpccli_EnumServicesStatusExW_state *state = tevent_req_data(
7483                 req, struct rpccli_EnumServicesStatusExW_state);
7484         NTSTATUS status;
7485         TALLOC_CTX *mem_ctx;
7486
7487         if (state->out_mem_ctx) {
7488                 mem_ctx = state->out_mem_ctx;
7489         } else {
7490                 mem_ctx = state;
7491         }
7492
7493         status = state->dispatch_recv(subreq, mem_ctx);
7494         TALLOC_FREE(subreq);
7495         if (!NT_STATUS_IS_OK(status)) {
7496                 tevent_req_nterror(req, status);
7497                 return;
7498         }
7499
7500         /* Copy out parameters */
7501         memcpy(state->orig.out.services, state->tmp.out.services, state->tmp.in.offered * sizeof(*state->orig.out.services));
7502         *state->orig.out.needed = *state->tmp.out.needed;
7503         *state->orig.out.service_returned = *state->tmp.out.service_returned;
7504         if (state->orig.out.resume_handle && state->tmp.out.resume_handle) {
7505                 *state->orig.out.resume_handle = *state->tmp.out.resume_handle;
7506         }
7507
7508         /* Copy result */
7509         state->orig.out.result = state->tmp.out.result;
7510
7511         /* Reset temporary structure */
7512         ZERO_STRUCT(state->tmp);
7513
7514         if (DEBUGLEVEL >= 10) {
7515                 NDR_PRINT_OUT_DEBUG(EnumServicesStatusExW, &state->orig);
7516         }
7517
7518         tevent_req_done(req);
7519 }
7520
7521 NTSTATUS rpccli_EnumServicesStatusExW_recv(struct tevent_req *req,
7522                                            TALLOC_CTX *mem_ctx,
7523                                            WERROR *result)
7524 {
7525         struct rpccli_EnumServicesStatusExW_state *state = tevent_req_data(
7526                 req, struct rpccli_EnumServicesStatusExW_state);
7527         NTSTATUS status;
7528
7529         if (tevent_req_is_nterror(req, &status)) {
7530                 tevent_req_received(req);
7531                 return status;
7532         }
7533
7534         /* Steal possbile out parameters to the callers context */
7535         talloc_steal(mem_ctx, state->out_mem_ctx);
7536
7537         /* Return result */
7538         *result = state->orig.out.result;
7539
7540         tevent_req_received(req);
7541         return NT_STATUS_OK;
7542 }
7543
7544 NTSTATUS rpccli_EnumServicesStatusExW(struct rpc_pipe_client *cli,
7545                                       TALLOC_CTX *mem_ctx,
7546                                       struct policy_handle *scmanager /* [in] [ref] */,
7547                                       uint32_t info_level /* [in]  */,
7548                                       uint32_t type /* [in]  */,
7549                                       enum svcctl_ServiceState state /* [in]  */,
7550                                       uint8_t *services /* [out] [ref,size_is(offered)] */,
7551                                       uint32_t offered /* [in] [range(0,0x40000)] */,
7552                                       uint32_t *needed /* [out] [ref,range(0,0x40000)] */,
7553                                       uint32_t *service_returned /* [out] [ref,range(0,0x40000)] */,
7554                                       uint32_t *resume_handle /* [in,out] [unique,range(0,0x40000)] */,
7555                                       const char *group_name /* [in] [unique,charset(UTF16)] */,
7556                                       WERROR *werror)
7557 {
7558         struct EnumServicesStatusExW r;
7559         NTSTATUS status;
7560
7561         /* In parameters */
7562         r.in.scmanager = scmanager;
7563         r.in.info_level = info_level;
7564         r.in.type = type;
7565         r.in.state = state;
7566         r.in.offered = offered;
7567         r.in.resume_handle = resume_handle;
7568         r.in.group_name = group_name;
7569
7570         if (DEBUGLEVEL >= 10) {
7571                 NDR_PRINT_IN_DEBUG(EnumServicesStatusExW, &r);
7572         }
7573
7574         status = cli->dispatch(cli,
7575                                 mem_ctx,
7576                                 &ndr_table_svcctl,
7577                                 NDR_ENUMSERVICESSTATUSEXW,
7578                                 &r);
7579
7580         if (!NT_STATUS_IS_OK(status)) {
7581                 return status;
7582         }
7583
7584         if (DEBUGLEVEL >= 10) {
7585                 NDR_PRINT_OUT_DEBUG(EnumServicesStatusExW, &r);
7586         }
7587
7588         if (NT_STATUS_IS_ERR(status)) {
7589                 return status;
7590         }
7591
7592         /* Return variables */
7593         memcpy(services, r.out.services, r.in.offered * sizeof(*services));
7594         *needed = *r.out.needed;
7595         *service_returned = *r.out.service_returned;
7596         if (resume_handle && r.out.resume_handle) {
7597                 *resume_handle = *r.out.resume_handle;
7598         }
7599
7600         /* Return result */
7601         if (werror) {
7602                 *werror = r.out.result;
7603         }
7604
7605         return werror_to_ntstatus(r.out.result);
7606 }
7607
7608 struct rpccli_svcctl_SCSendTSMessage_state {
7609         struct svcctl_SCSendTSMessage orig;
7610         struct svcctl_SCSendTSMessage tmp;
7611         TALLOC_CTX *out_mem_ctx;
7612         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
7613 };
7614
7615 static void rpccli_svcctl_SCSendTSMessage_done(struct tevent_req *subreq);
7616
7617 struct tevent_req *rpccli_svcctl_SCSendTSMessage_send(TALLOC_CTX *mem_ctx,
7618                                                       struct tevent_context *ev,
7619                                                       struct rpc_pipe_client *cli)
7620 {
7621         struct tevent_req *req;
7622         struct rpccli_svcctl_SCSendTSMessage_state *state;
7623         struct tevent_req *subreq;
7624
7625         req = tevent_req_create(mem_ctx, &state,
7626                                 struct rpccli_svcctl_SCSendTSMessage_state);
7627         if (req == NULL) {
7628                 return NULL;
7629         }
7630         state->out_mem_ctx = NULL;
7631         state->dispatch_recv = cli->dispatch_recv;
7632
7633         /* In parameters */
7634
7635         /* Out parameters */
7636
7637         /* Result */
7638         ZERO_STRUCT(state->orig.out.result);
7639
7640         if (DEBUGLEVEL >= 10) {
7641                 NDR_PRINT_IN_DEBUG(svcctl_SCSendTSMessage, &state->orig);
7642         }
7643
7644         /* make a temporary copy, that we pass to the dispatch function */
7645         state->tmp = state->orig;
7646
7647         subreq = cli->dispatch_send(state, ev, cli,
7648                                     &ndr_table_svcctl,
7649                                     NDR_SVCCTL_SCSENDTSMESSAGE,
7650                                     &state->tmp);
7651         if (tevent_req_nomem(subreq, req)) {
7652                 return tevent_req_post(req, ev);
7653         }
7654         tevent_req_set_callback(subreq, rpccli_svcctl_SCSendTSMessage_done, req);
7655         return req;
7656 }
7657
7658 static void rpccli_svcctl_SCSendTSMessage_done(struct tevent_req *subreq)
7659 {
7660         struct tevent_req *req = tevent_req_callback_data(
7661                 subreq, struct tevent_req);
7662         struct rpccli_svcctl_SCSendTSMessage_state *state = tevent_req_data(
7663                 req, struct rpccli_svcctl_SCSendTSMessage_state);
7664         NTSTATUS status;
7665         TALLOC_CTX *mem_ctx;
7666
7667         if (state->out_mem_ctx) {
7668                 mem_ctx = state->out_mem_ctx;
7669         } else {
7670                 mem_ctx = state;
7671         }
7672
7673         status = state->dispatch_recv(subreq, mem_ctx);
7674         TALLOC_FREE(subreq);
7675         if (!NT_STATUS_IS_OK(status)) {
7676                 tevent_req_nterror(req, status);
7677                 return;
7678         }
7679
7680         /* Copy out parameters */
7681
7682         /* Copy result */
7683         state->orig.out.result = state->tmp.out.result;
7684
7685         /* Reset temporary structure */
7686         ZERO_STRUCT(state->tmp);
7687
7688         if (DEBUGLEVEL >= 10) {
7689                 NDR_PRINT_OUT_DEBUG(svcctl_SCSendTSMessage, &state->orig);
7690         }
7691
7692         tevent_req_done(req);
7693 }
7694
7695 NTSTATUS rpccli_svcctl_SCSendTSMessage_recv(struct tevent_req *req,
7696                                             TALLOC_CTX *mem_ctx,
7697                                             WERROR *result)
7698 {
7699         struct rpccli_svcctl_SCSendTSMessage_state *state = tevent_req_data(
7700                 req, struct rpccli_svcctl_SCSendTSMessage_state);
7701         NTSTATUS status;
7702
7703         if (tevent_req_is_nterror(req, &status)) {
7704                 tevent_req_received(req);
7705                 return status;
7706         }
7707
7708         /* Steal possbile out parameters to the callers context */
7709         talloc_steal(mem_ctx, state->out_mem_ctx);
7710
7711         /* Return result */
7712         *result = state->orig.out.result;
7713
7714         tevent_req_received(req);
7715         return NT_STATUS_OK;
7716 }
7717
7718 NTSTATUS rpccli_svcctl_SCSendTSMessage(struct rpc_pipe_client *cli,
7719                                        TALLOC_CTX *mem_ctx,
7720                                        WERROR *werror)
7721 {
7722         struct svcctl_SCSendTSMessage r;
7723         NTSTATUS status;
7724
7725         /* In parameters */
7726
7727         if (DEBUGLEVEL >= 10) {
7728                 NDR_PRINT_IN_DEBUG(svcctl_SCSendTSMessage, &r);
7729         }
7730
7731         status = cli->dispatch(cli,
7732                                 mem_ctx,
7733                                 &ndr_table_svcctl,
7734                                 NDR_SVCCTL_SCSENDTSMESSAGE,
7735                                 &r);
7736
7737         if (!NT_STATUS_IS_OK(status)) {
7738                 return status;
7739         }
7740
7741         if (DEBUGLEVEL >= 10) {
7742                 NDR_PRINT_OUT_DEBUG(svcctl_SCSendTSMessage, &r);
7743         }
7744
7745         if (NT_STATUS_IS_ERR(status)) {
7746                 return status;
7747         }
7748
7749         /* Return variables */
7750
7751         /* Return result */
7752         if (werror) {
7753                 *werror = r.out.result;
7754         }
7755
7756         return werror_to_ntstatus(r.out.result);
7757 }
7758