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