9f11a40d7edaf4276ea618add7c519eb6a52d959
[sfrench/samba-autobuild/.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 NTSTATUS rpccli_svcctl_CloseServiceHandle(struct rpc_pipe_client *cli,
10                                           TALLOC_CTX *mem_ctx,
11                                           struct policy_handle *handle /* [in,out] [ref] */,
12                                           WERROR *werror)
13 {
14         struct svcctl_CloseServiceHandle r;
15         NTSTATUS status;
16
17         /* In parameters */
18         r.in.handle = handle;
19
20         if (DEBUGLEVEL >= 10) {
21                 NDR_PRINT_IN_DEBUG(svcctl_CloseServiceHandle, &r);
22         }
23
24         status = cli_do_rpc_ndr(cli,
25                                 mem_ctx,
26                                 &ndr_table_svcctl,
27                                 NDR_SVCCTL_CLOSESERVICEHANDLE,
28                                 &r);
29
30         if (!NT_STATUS_IS_OK(status)) {
31                 return status;
32         }
33
34         if (DEBUGLEVEL >= 10) {
35                 NDR_PRINT_OUT_DEBUG(svcctl_CloseServiceHandle, &r);
36         }
37
38         if (NT_STATUS_IS_ERR(status)) {
39                 return status;
40         }
41
42         /* Return variables */
43         *handle = *r.out.handle;
44
45         /* Return result */
46         if (werror) {
47                 *werror = r.out.result;
48         }
49
50         return werror_to_ntstatus(r.out.result);
51 }
52
53 NTSTATUS rpccli_svcctl_ControlService(struct rpc_pipe_client *cli,
54                                       TALLOC_CTX *mem_ctx,
55                                       struct policy_handle *handle /* [in] [ref] */,
56                                       enum SERVICE_CONTROL control /* [in]  */,
57                                       struct SERVICE_STATUS *service_status /* [out] [ref] */,
58                                       WERROR *werror)
59 {
60         struct svcctl_ControlService r;
61         NTSTATUS status;
62
63         /* In parameters */
64         r.in.handle = handle;
65         r.in.control = control;
66
67         if (DEBUGLEVEL >= 10) {
68                 NDR_PRINT_IN_DEBUG(svcctl_ControlService, &r);
69         }
70
71         status = cli_do_rpc_ndr(cli,
72                                 mem_ctx,
73                                 &ndr_table_svcctl,
74                                 NDR_SVCCTL_CONTROLSERVICE,
75                                 &r);
76
77         if (!NT_STATUS_IS_OK(status)) {
78                 return status;
79         }
80
81         if (DEBUGLEVEL >= 10) {
82                 NDR_PRINT_OUT_DEBUG(svcctl_ControlService, &r);
83         }
84
85         if (NT_STATUS_IS_ERR(status)) {
86                 return status;
87         }
88
89         /* Return variables */
90         *service_status = *r.out.service_status;
91
92         /* Return result */
93         if (werror) {
94                 *werror = r.out.result;
95         }
96
97         return werror_to_ntstatus(r.out.result);
98 }
99
100 NTSTATUS rpccli_svcctl_DeleteService(struct rpc_pipe_client *cli,
101                                      TALLOC_CTX *mem_ctx,
102                                      struct policy_handle *handle /* [in] [ref] */,
103                                      WERROR *werror)
104 {
105         struct svcctl_DeleteService r;
106         NTSTATUS status;
107
108         /* In parameters */
109         r.in.handle = handle;
110
111         if (DEBUGLEVEL >= 10) {
112                 NDR_PRINT_IN_DEBUG(svcctl_DeleteService, &r);
113         }
114
115         status = cli_do_rpc_ndr(cli,
116                                 mem_ctx,
117                                 &ndr_table_svcctl,
118                                 NDR_SVCCTL_DELETESERVICE,
119                                 &r);
120
121         if (!NT_STATUS_IS_OK(status)) {
122                 return status;
123         }
124
125         if (DEBUGLEVEL >= 10) {
126                 NDR_PRINT_OUT_DEBUG(svcctl_DeleteService, &r);
127         }
128
129         if (NT_STATUS_IS_ERR(status)) {
130                 return status;
131         }
132
133         /* Return variables */
134
135         /* Return result */
136         if (werror) {
137                 *werror = r.out.result;
138         }
139
140         return werror_to_ntstatus(r.out.result);
141 }
142
143 NTSTATUS rpccli_svcctl_LockServiceDatabase(struct rpc_pipe_client *cli,
144                                            TALLOC_CTX *mem_ctx,
145                                            struct policy_handle *handle /* [in] [ref] */,
146                                            struct policy_handle *lock /* [out] [ref] */,
147                                            WERROR *werror)
148 {
149         struct svcctl_LockServiceDatabase r;
150         NTSTATUS status;
151
152         /* In parameters */
153         r.in.handle = handle;
154
155         if (DEBUGLEVEL >= 10) {
156                 NDR_PRINT_IN_DEBUG(svcctl_LockServiceDatabase, &r);
157         }
158
159         status = cli_do_rpc_ndr(cli,
160                                 mem_ctx,
161                                 &ndr_table_svcctl,
162                                 NDR_SVCCTL_LOCKSERVICEDATABASE,
163                                 &r);
164
165         if (!NT_STATUS_IS_OK(status)) {
166                 return status;
167         }
168
169         if (DEBUGLEVEL >= 10) {
170                 NDR_PRINT_OUT_DEBUG(svcctl_LockServiceDatabase, &r);
171         }
172
173         if (NT_STATUS_IS_ERR(status)) {
174                 return status;
175         }
176
177         /* Return variables */
178         *lock = *r.out.lock;
179
180         /* Return result */
181         if (werror) {
182                 *werror = r.out.result;
183         }
184
185         return werror_to_ntstatus(r.out.result);
186 }
187
188 NTSTATUS rpccli_svcctl_QueryServiceObjectSecurity(struct rpc_pipe_client *cli,
189                                                   TALLOC_CTX *mem_ctx,
190                                                   struct policy_handle *handle /* [in] [ref] */,
191                                                   uint32_t security_flags /* [in]  */,
192                                                   uint8_t *buffer /* [out] [ref,size_is(buffer_size)] */,
193                                                   uint32_t buffer_size /* [in] [range(0,0x40000)] */,
194                                                   uint32_t *needed /* [out] [ref,range(0,0x40000)] */,
195                                                   WERROR *werror)
196 {
197         struct svcctl_QueryServiceObjectSecurity r;
198         NTSTATUS status;
199
200         /* In parameters */
201         r.in.handle = handle;
202         r.in.security_flags = security_flags;
203         r.in.buffer_size = buffer_size;
204
205         if (DEBUGLEVEL >= 10) {
206                 NDR_PRINT_IN_DEBUG(svcctl_QueryServiceObjectSecurity, &r);
207         }
208
209         status = cli_do_rpc_ndr(cli,
210                                 mem_ctx,
211                                 &ndr_table_svcctl,
212                                 NDR_SVCCTL_QUERYSERVICEOBJECTSECURITY,
213                                 &r);
214
215         if (!NT_STATUS_IS_OK(status)) {
216                 return status;
217         }
218
219         if (DEBUGLEVEL >= 10) {
220                 NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceObjectSecurity, &r);
221         }
222
223         if (NT_STATUS_IS_ERR(status)) {
224                 return status;
225         }
226
227         /* Return variables */
228         memcpy(buffer, r.out.buffer, r.in.buffer_size * sizeof(*buffer));
229         *needed = *r.out.needed;
230
231         /* Return result */
232         if (werror) {
233                 *werror = r.out.result;
234         }
235
236         return werror_to_ntstatus(r.out.result);
237 }
238
239 NTSTATUS rpccli_svcctl_SetServiceObjectSecurity(struct rpc_pipe_client *cli,
240                                                 TALLOC_CTX *mem_ctx,
241                                                 struct policy_handle *handle /* [in] [ref] */,
242                                                 uint32_t security_flags /* [in]  */,
243                                                 uint8_t *buffer /* [in] [ref,size_is(buffer_size)] */,
244                                                 uint32_t buffer_size /* [in]  */,
245                                                 WERROR *werror)
246 {
247         struct svcctl_SetServiceObjectSecurity r;
248         NTSTATUS status;
249
250         /* In parameters */
251         r.in.handle = handle;
252         r.in.security_flags = security_flags;
253         r.in.buffer = buffer;
254         r.in.buffer_size = buffer_size;
255
256         if (DEBUGLEVEL >= 10) {
257                 NDR_PRINT_IN_DEBUG(svcctl_SetServiceObjectSecurity, &r);
258         }
259
260         status = cli_do_rpc_ndr(cli,
261                                 mem_ctx,
262                                 &ndr_table_svcctl,
263                                 NDR_SVCCTL_SETSERVICEOBJECTSECURITY,
264                                 &r);
265
266         if (!NT_STATUS_IS_OK(status)) {
267                 return status;
268         }
269
270         if (DEBUGLEVEL >= 10) {
271                 NDR_PRINT_OUT_DEBUG(svcctl_SetServiceObjectSecurity, &r);
272         }
273
274         if (NT_STATUS_IS_ERR(status)) {
275                 return status;
276         }
277
278         /* Return variables */
279
280         /* Return result */
281         if (werror) {
282                 *werror = r.out.result;
283         }
284
285         return werror_to_ntstatus(r.out.result);
286 }
287
288 NTSTATUS rpccli_svcctl_QueryServiceStatus(struct rpc_pipe_client *cli,
289                                           TALLOC_CTX *mem_ctx,
290                                           struct policy_handle *handle /* [in] [ref] */,
291                                           struct SERVICE_STATUS *service_status /* [out] [ref] */,
292                                           WERROR *werror)
293 {
294         struct svcctl_QueryServiceStatus r;
295         NTSTATUS status;
296
297         /* In parameters */
298         r.in.handle = handle;
299
300         if (DEBUGLEVEL >= 10) {
301                 NDR_PRINT_IN_DEBUG(svcctl_QueryServiceStatus, &r);
302         }
303
304         status = cli_do_rpc_ndr(cli,
305                                 mem_ctx,
306                                 &ndr_table_svcctl,
307                                 NDR_SVCCTL_QUERYSERVICESTATUS,
308                                 &r);
309
310         if (!NT_STATUS_IS_OK(status)) {
311                 return status;
312         }
313
314         if (DEBUGLEVEL >= 10) {
315                 NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceStatus, &r);
316         }
317
318         if (NT_STATUS_IS_ERR(status)) {
319                 return status;
320         }
321
322         /* Return variables */
323         *service_status = *r.out.service_status;
324
325         /* Return result */
326         if (werror) {
327                 *werror = r.out.result;
328         }
329
330         return werror_to_ntstatus(r.out.result);
331 }
332
333 NTSTATUS rpccli_svcctl_SetServiceStatus(struct rpc_pipe_client *cli,
334                                         TALLOC_CTX *mem_ctx,
335                                         WERROR *werror)
336 {
337         struct svcctl_SetServiceStatus r;
338         NTSTATUS status;
339
340         /* In parameters */
341
342         if (DEBUGLEVEL >= 10) {
343                 NDR_PRINT_IN_DEBUG(svcctl_SetServiceStatus, &r);
344         }
345
346         status = cli_do_rpc_ndr(cli,
347                                 mem_ctx,
348                                 &ndr_table_svcctl,
349                                 NDR_SVCCTL_SETSERVICESTATUS,
350                                 &r);
351
352         if (!NT_STATUS_IS_OK(status)) {
353                 return status;
354         }
355
356         if (DEBUGLEVEL >= 10) {
357                 NDR_PRINT_OUT_DEBUG(svcctl_SetServiceStatus, &r);
358         }
359
360         if (NT_STATUS_IS_ERR(status)) {
361                 return status;
362         }
363
364         /* Return variables */
365
366         /* Return result */
367         if (werror) {
368                 *werror = r.out.result;
369         }
370
371         return werror_to_ntstatus(r.out.result);
372 }
373
374 NTSTATUS rpccli_svcctl_UnlockServiceDatabase(struct rpc_pipe_client *cli,
375                                              TALLOC_CTX *mem_ctx,
376                                              struct policy_handle *lock /* [in,out] [ref] */,
377                                              WERROR *werror)
378 {
379         struct svcctl_UnlockServiceDatabase r;
380         NTSTATUS status;
381
382         /* In parameters */
383         r.in.lock = lock;
384
385         if (DEBUGLEVEL >= 10) {
386                 NDR_PRINT_IN_DEBUG(svcctl_UnlockServiceDatabase, &r);
387         }
388
389         status = cli_do_rpc_ndr(cli,
390                                 mem_ctx,
391                                 &ndr_table_svcctl,
392                                 NDR_SVCCTL_UNLOCKSERVICEDATABASE,
393                                 &r);
394
395         if (!NT_STATUS_IS_OK(status)) {
396                 return status;
397         }
398
399         if (DEBUGLEVEL >= 10) {
400                 NDR_PRINT_OUT_DEBUG(svcctl_UnlockServiceDatabase, &r);
401         }
402
403         if (NT_STATUS_IS_ERR(status)) {
404                 return status;
405         }
406
407         /* Return variables */
408         *lock = *r.out.lock;
409
410         /* Return result */
411         if (werror) {
412                 *werror = r.out.result;
413         }
414
415         return werror_to_ntstatus(r.out.result);
416 }
417
418 NTSTATUS rpccli_svcctl_NotifyBootConfigStatus(struct rpc_pipe_client *cli,
419                                               TALLOC_CTX *mem_ctx,
420                                               WERROR *werror)
421 {
422         struct svcctl_NotifyBootConfigStatus r;
423         NTSTATUS status;
424
425         /* In parameters */
426
427         if (DEBUGLEVEL >= 10) {
428                 NDR_PRINT_IN_DEBUG(svcctl_NotifyBootConfigStatus, &r);
429         }
430
431         status = cli_do_rpc_ndr(cli,
432                                 mem_ctx,
433                                 &ndr_table_svcctl,
434                                 NDR_SVCCTL_NOTIFYBOOTCONFIGSTATUS,
435                                 &r);
436
437         if (!NT_STATUS_IS_OK(status)) {
438                 return status;
439         }
440
441         if (DEBUGLEVEL >= 10) {
442                 NDR_PRINT_OUT_DEBUG(svcctl_NotifyBootConfigStatus, &r);
443         }
444
445         if (NT_STATUS_IS_ERR(status)) {
446                 return status;
447         }
448
449         /* Return variables */
450
451         /* Return result */
452         if (werror) {
453                 *werror = r.out.result;
454         }
455
456         return werror_to_ntstatus(r.out.result);
457 }
458
459 NTSTATUS rpccli_svcctl_SCSetServiceBitsW(struct rpc_pipe_client *cli,
460                                          TALLOC_CTX *mem_ctx,
461                                          struct policy_handle *handle /* [in] [ref] */,
462                                          uint32_t bits /* [in]  */,
463                                          uint32_t bitson /* [in]  */,
464                                          uint32_t immediate /* [in]  */,
465                                          WERROR *werror)
466 {
467         struct svcctl_SCSetServiceBitsW r;
468         NTSTATUS status;
469
470         /* In parameters */
471         r.in.handle = handle;
472         r.in.bits = bits;
473         r.in.bitson = bitson;
474         r.in.immediate = immediate;
475
476         if (DEBUGLEVEL >= 10) {
477                 NDR_PRINT_IN_DEBUG(svcctl_SCSetServiceBitsW, &r);
478         }
479
480         status = cli_do_rpc_ndr(cli,
481                                 mem_ctx,
482                                 &ndr_table_svcctl,
483                                 NDR_SVCCTL_SCSETSERVICEBITSW,
484                                 &r);
485
486         if (!NT_STATUS_IS_OK(status)) {
487                 return status;
488         }
489
490         if (DEBUGLEVEL >= 10) {
491                 NDR_PRINT_OUT_DEBUG(svcctl_SCSetServiceBitsW, &r);
492         }
493
494         if (NT_STATUS_IS_ERR(status)) {
495                 return status;
496         }
497
498         /* Return variables */
499
500         /* Return result */
501         if (werror) {
502                 *werror = r.out.result;
503         }
504
505         return werror_to_ntstatus(r.out.result);
506 }
507
508 NTSTATUS rpccli_svcctl_ChangeServiceConfigW(struct rpc_pipe_client *cli,
509                                             TALLOC_CTX *mem_ctx,
510                                             struct policy_handle *handle /* [in] [ref] */,
511                                             uint32_t type /* [in]  */,
512                                             uint32_t start /* [in]  */,
513                                             uint32_t error /* [in]  */,
514                                             const char *binary_path /* [in] [unique,charset(UTF16)] */,
515                                             const char *load_order_group /* [in] [unique,charset(UTF16)] */,
516                                             uint32_t *tag_id /* [out] [ref] */,
517                                             const char *dependencies /* [in] [unique,charset(UTF16)] */,
518                                             const char *service_start_name /* [in] [unique,charset(UTF16)] */,
519                                             const char *password /* [in] [unique,charset(UTF16)] */,
520                                             const char *display_name /* [in] [unique,charset(UTF16)] */,
521                                             WERROR *werror)
522 {
523         struct svcctl_ChangeServiceConfigW r;
524         NTSTATUS status;
525
526         /* In parameters */
527         r.in.handle = handle;
528         r.in.type = type;
529         r.in.start = start;
530         r.in.error = error;
531         r.in.binary_path = binary_path;
532         r.in.load_order_group = load_order_group;
533         r.in.dependencies = dependencies;
534         r.in.service_start_name = service_start_name;
535         r.in.password = password;
536         r.in.display_name = display_name;
537
538         if (DEBUGLEVEL >= 10) {
539                 NDR_PRINT_IN_DEBUG(svcctl_ChangeServiceConfigW, &r);
540         }
541
542         status = cli_do_rpc_ndr(cli,
543                                 mem_ctx,
544                                 &ndr_table_svcctl,
545                                 NDR_SVCCTL_CHANGESERVICECONFIGW,
546                                 &r);
547
548         if (!NT_STATUS_IS_OK(status)) {
549                 return status;
550         }
551
552         if (DEBUGLEVEL >= 10) {
553                 NDR_PRINT_OUT_DEBUG(svcctl_ChangeServiceConfigW, &r);
554         }
555
556         if (NT_STATUS_IS_ERR(status)) {
557                 return status;
558         }
559
560         /* Return variables */
561         *tag_id = *r.out.tag_id;
562
563         /* Return result */
564         if (werror) {
565                 *werror = r.out.result;
566         }
567
568         return werror_to_ntstatus(r.out.result);
569 }
570
571 NTSTATUS rpccli_svcctl_CreateServiceW(struct rpc_pipe_client *cli,
572                                       TALLOC_CTX *mem_ctx,
573                                       struct policy_handle *scmanager_handle /* [in] [ref] */,
574                                       const char *ServiceName /* [in] [charset(UTF16)] */,
575                                       const char *DisplayName /* [in] [unique,charset(UTF16)] */,
576                                       uint32_t desired_access /* [in]  */,
577                                       uint32_t type /* [in]  */,
578                                       uint32_t start_type /* [in]  */,
579                                       uint32_t error_control /* [in]  */,
580                                       const char *binary_path /* [in] [charset(UTF16)] */,
581                                       const char *LoadOrderGroupKey /* [in] [unique,charset(UTF16)] */,
582                                       uint32_t *TagId /* [in,out] [unique] */,
583                                       uint8_t *dependencies /* [in] [unique,size_is(dependencies_size)] */,
584                                       uint32_t dependencies_size /* [in]  */,
585                                       const char *service_start_name /* [in] [unique,charset(UTF16)] */,
586                                       uint8_t *password /* [in] [unique,size_is(password_size)] */,
587                                       uint32_t password_size /* [in]  */,
588                                       struct policy_handle *handle /* [out] [ref] */,
589                                       WERROR *werror)
590 {
591         struct svcctl_CreateServiceW r;
592         NTSTATUS status;
593
594         /* In parameters */
595         r.in.scmanager_handle = scmanager_handle;
596         r.in.ServiceName = ServiceName;
597         r.in.DisplayName = DisplayName;
598         r.in.desired_access = desired_access;
599         r.in.type = type;
600         r.in.start_type = start_type;
601         r.in.error_control = error_control;
602         r.in.binary_path = binary_path;
603         r.in.LoadOrderGroupKey = LoadOrderGroupKey;
604         r.in.TagId = TagId;
605         r.in.dependencies = dependencies;
606         r.in.dependencies_size = dependencies_size;
607         r.in.service_start_name = service_start_name;
608         r.in.password = password;
609         r.in.password_size = password_size;
610
611         if (DEBUGLEVEL >= 10) {
612                 NDR_PRINT_IN_DEBUG(svcctl_CreateServiceW, &r);
613         }
614
615         status = cli_do_rpc_ndr(cli,
616                                 mem_ctx,
617                                 &ndr_table_svcctl,
618                                 NDR_SVCCTL_CREATESERVICEW,
619                                 &r);
620
621         if (!NT_STATUS_IS_OK(status)) {
622                 return status;
623         }
624
625         if (DEBUGLEVEL >= 10) {
626                 NDR_PRINT_OUT_DEBUG(svcctl_CreateServiceW, &r);
627         }
628
629         if (NT_STATUS_IS_ERR(status)) {
630                 return status;
631         }
632
633         /* Return variables */
634         if (TagId && r.out.TagId) {
635                 *TagId = *r.out.TagId;
636         }
637         *handle = *r.out.handle;
638
639         /* Return result */
640         if (werror) {
641                 *werror = r.out.result;
642         }
643
644         return werror_to_ntstatus(r.out.result);
645 }
646
647 NTSTATUS rpccli_svcctl_EnumDependentServicesW(struct rpc_pipe_client *cli,
648                                               TALLOC_CTX *mem_ctx,
649                                               struct policy_handle *service /* [in] [ref] */,
650                                               uint32_t state /* [in]  */,
651                                               uint8_t *service_status /* [out] [ref,size_is(buf_size)] */,
652                                               uint32_t buf_size /* [in] [range(0,0x40000)] */,
653                                               uint32_t *bytes_needed /* [out] [ref,range(0,0x40000)] */,
654                                               uint32_t *services_returned /* [out] [ref,range(0,0x40000)] */,
655                                               WERROR *werror)
656 {
657         struct svcctl_EnumDependentServicesW r;
658         NTSTATUS status;
659
660         /* In parameters */
661         r.in.service = service;
662         r.in.state = state;
663         r.in.buf_size = buf_size;
664
665         if (DEBUGLEVEL >= 10) {
666                 NDR_PRINT_IN_DEBUG(svcctl_EnumDependentServicesW, &r);
667         }
668
669         status = cli_do_rpc_ndr(cli,
670                                 mem_ctx,
671                                 &ndr_table_svcctl,
672                                 NDR_SVCCTL_ENUMDEPENDENTSERVICESW,
673                                 &r);
674
675         if (!NT_STATUS_IS_OK(status)) {
676                 return status;
677         }
678
679         if (DEBUGLEVEL >= 10) {
680                 NDR_PRINT_OUT_DEBUG(svcctl_EnumDependentServicesW, &r);
681         }
682
683         if (NT_STATUS_IS_ERR(status)) {
684                 return status;
685         }
686
687         /* Return variables */
688         memcpy(service_status, r.out.service_status, r.in.buf_size * sizeof(*service_status));
689         *bytes_needed = *r.out.bytes_needed;
690         *services_returned = *r.out.services_returned;
691
692         /* Return result */
693         if (werror) {
694                 *werror = r.out.result;
695         }
696
697         return werror_to_ntstatus(r.out.result);
698 }
699
700 NTSTATUS rpccli_svcctl_EnumServicesStatusW(struct rpc_pipe_client *cli,
701                                            TALLOC_CTX *mem_ctx,
702                                            struct policy_handle *handle /* [in] [ref] */,
703                                            uint32_t type /* [in]  */,
704                                            uint32_t state /* [in]  */,
705                                            uint8_t *service /* [out] [ref,size_is(buf_size)] */,
706                                            uint32_t buf_size /* [in] [range(0,262144)] */,
707                                            uint32_t *bytes_needed /* [out] [ref,range(0,262144)] */,
708                                            uint32_t *services_returned /* [out] [ref,range(0,262144)] */,
709                                            uint32_t *resume_handle /* [in,out] [unique] */,
710                                            WERROR *werror)
711 {
712         struct svcctl_EnumServicesStatusW r;
713         NTSTATUS status;
714
715         /* In parameters */
716         r.in.handle = handle;
717         r.in.type = type;
718         r.in.state = state;
719         r.in.buf_size = buf_size;
720         r.in.resume_handle = resume_handle;
721
722         if (DEBUGLEVEL >= 10) {
723                 NDR_PRINT_IN_DEBUG(svcctl_EnumServicesStatusW, &r);
724         }
725
726         status = cli_do_rpc_ndr(cli,
727                                 mem_ctx,
728                                 &ndr_table_svcctl,
729                                 NDR_SVCCTL_ENUMSERVICESSTATUSW,
730                                 &r);
731
732         if (!NT_STATUS_IS_OK(status)) {
733                 return status;
734         }
735
736         if (DEBUGLEVEL >= 10) {
737                 NDR_PRINT_OUT_DEBUG(svcctl_EnumServicesStatusW, &r);
738         }
739
740         if (NT_STATUS_IS_ERR(status)) {
741                 return status;
742         }
743
744         /* Return variables */
745         memcpy(service, r.out.service, r.in.buf_size * sizeof(*service));
746         *bytes_needed = *r.out.bytes_needed;
747         *services_returned = *r.out.services_returned;
748         if (resume_handle && r.out.resume_handle) {
749                 *resume_handle = *r.out.resume_handle;
750         }
751
752         /* Return result */
753         if (werror) {
754                 *werror = r.out.result;
755         }
756
757         return werror_to_ntstatus(r.out.result);
758 }
759
760 NTSTATUS rpccli_svcctl_OpenSCManagerW(struct rpc_pipe_client *cli,
761                                       TALLOC_CTX *mem_ctx,
762                                       const char *MachineName /* [in] [unique,charset(UTF16)] */,
763                                       const char *DatabaseName /* [in] [unique,charset(UTF16)] */,
764                                       uint32_t access_mask /* [in]  */,
765                                       struct policy_handle *handle /* [out] [ref] */,
766                                       WERROR *werror)
767 {
768         struct svcctl_OpenSCManagerW r;
769         NTSTATUS status;
770
771         /* In parameters */
772         r.in.MachineName = MachineName;
773         r.in.DatabaseName = DatabaseName;
774         r.in.access_mask = access_mask;
775
776         if (DEBUGLEVEL >= 10) {
777                 NDR_PRINT_IN_DEBUG(svcctl_OpenSCManagerW, &r);
778         }
779
780         status = cli_do_rpc_ndr(cli,
781                                 mem_ctx,
782                                 &ndr_table_svcctl,
783                                 NDR_SVCCTL_OPENSCMANAGERW,
784                                 &r);
785
786         if (!NT_STATUS_IS_OK(status)) {
787                 return status;
788         }
789
790         if (DEBUGLEVEL >= 10) {
791                 NDR_PRINT_OUT_DEBUG(svcctl_OpenSCManagerW, &r);
792         }
793
794         if (NT_STATUS_IS_ERR(status)) {
795                 return status;
796         }
797
798         /* Return variables */
799         *handle = *r.out.handle;
800
801         /* Return result */
802         if (werror) {
803                 *werror = r.out.result;
804         }
805
806         return werror_to_ntstatus(r.out.result);
807 }
808
809 NTSTATUS rpccli_svcctl_OpenServiceW(struct rpc_pipe_client *cli,
810                                     TALLOC_CTX *mem_ctx,
811                                     struct policy_handle *scmanager_handle /* [in] [ref] */,
812                                     const char *ServiceName /* [in] [charset(UTF16)] */,
813                                     uint32_t access_mask /* [in]  */,
814                                     struct policy_handle *handle /* [out] [ref] */,
815                                     WERROR *werror)
816 {
817         struct svcctl_OpenServiceW r;
818         NTSTATUS status;
819
820         /* In parameters */
821         r.in.scmanager_handle = scmanager_handle;
822         r.in.ServiceName = ServiceName;
823         r.in.access_mask = access_mask;
824
825         if (DEBUGLEVEL >= 10) {
826                 NDR_PRINT_IN_DEBUG(svcctl_OpenServiceW, &r);
827         }
828
829         status = cli_do_rpc_ndr(cli,
830                                 mem_ctx,
831                                 &ndr_table_svcctl,
832                                 NDR_SVCCTL_OPENSERVICEW,
833                                 &r);
834
835         if (!NT_STATUS_IS_OK(status)) {
836                 return status;
837         }
838
839         if (DEBUGLEVEL >= 10) {
840                 NDR_PRINT_OUT_DEBUG(svcctl_OpenServiceW, &r);
841         }
842
843         if (NT_STATUS_IS_ERR(status)) {
844                 return status;
845         }
846
847         /* Return variables */
848         *handle = *r.out.handle;
849
850         /* Return result */
851         if (werror) {
852                 *werror = r.out.result;
853         }
854
855         return werror_to_ntstatus(r.out.result);
856 }
857
858 NTSTATUS rpccli_svcctl_QueryServiceConfigW(struct rpc_pipe_client *cli,
859                                            TALLOC_CTX *mem_ctx,
860                                            struct policy_handle *handle /* [in] [ref] */,
861                                            struct QUERY_SERVICE_CONFIG *query /* [out] [ref] */,
862                                            uint32_t buf_size /* [in] [range(0,8192)] */,
863                                            uint32_t *bytes_needed /* [out] [ref,range(0,8192)] */,
864                                            WERROR *werror)
865 {
866         struct svcctl_QueryServiceConfigW r;
867         NTSTATUS status;
868
869         /* In parameters */
870         r.in.handle = handle;
871         r.in.buf_size = buf_size;
872
873         if (DEBUGLEVEL >= 10) {
874                 NDR_PRINT_IN_DEBUG(svcctl_QueryServiceConfigW, &r);
875         }
876
877         status = cli_do_rpc_ndr(cli,
878                                 mem_ctx,
879                                 &ndr_table_svcctl,
880                                 NDR_SVCCTL_QUERYSERVICECONFIGW,
881                                 &r);
882
883         if (!NT_STATUS_IS_OK(status)) {
884                 return status;
885         }
886
887         if (DEBUGLEVEL >= 10) {
888                 NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceConfigW, &r);
889         }
890
891         if (NT_STATUS_IS_ERR(status)) {
892                 return status;
893         }
894
895         /* Return variables */
896         *query = *r.out.query;
897         *bytes_needed = *r.out.bytes_needed;
898
899         /* Return result */
900         if (werror) {
901                 *werror = r.out.result;
902         }
903
904         return werror_to_ntstatus(r.out.result);
905 }
906
907 NTSTATUS rpccli_svcctl_QueryServiceLockStatusW(struct rpc_pipe_client *cli,
908                                                TALLOC_CTX *mem_ctx,
909                                                struct policy_handle *handle /* [in] [ref] */,
910                                                uint32_t buf_size /* [in]  */,
911                                                struct SERVICE_LOCK_STATUS *lock_status /* [out] [ref] */,
912                                                uint32_t *required_buf_size /* [out] [ref] */,
913                                                WERROR *werror)
914 {
915         struct svcctl_QueryServiceLockStatusW r;
916         NTSTATUS status;
917
918         /* In parameters */
919         r.in.handle = handle;
920         r.in.buf_size = buf_size;
921
922         if (DEBUGLEVEL >= 10) {
923                 NDR_PRINT_IN_DEBUG(svcctl_QueryServiceLockStatusW, &r);
924         }
925
926         status = cli_do_rpc_ndr(cli,
927                                 mem_ctx,
928                                 &ndr_table_svcctl,
929                                 NDR_SVCCTL_QUERYSERVICELOCKSTATUSW,
930                                 &r);
931
932         if (!NT_STATUS_IS_OK(status)) {
933                 return status;
934         }
935
936         if (DEBUGLEVEL >= 10) {
937                 NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceLockStatusW, &r);
938         }
939
940         if (NT_STATUS_IS_ERR(status)) {
941                 return status;
942         }
943
944         /* Return variables */
945         *lock_status = *r.out.lock_status;
946         *required_buf_size = *r.out.required_buf_size;
947
948         /* Return result */
949         if (werror) {
950                 *werror = r.out.result;
951         }
952
953         return werror_to_ntstatus(r.out.result);
954 }
955
956 NTSTATUS rpccli_svcctl_StartServiceW(struct rpc_pipe_client *cli,
957                                      TALLOC_CTX *mem_ctx,
958                                      struct policy_handle *handle /* [in] [ref] */,
959                                      uint32_t NumArgs /* [in]  */,
960                                      const char *Arguments /* [in] [unique,charset(UTF16)] */,
961                                      WERROR *werror)
962 {
963         struct svcctl_StartServiceW r;
964         NTSTATUS status;
965
966         /* In parameters */
967         r.in.handle = handle;
968         r.in.NumArgs = NumArgs;
969         r.in.Arguments = Arguments;
970
971         if (DEBUGLEVEL >= 10) {
972                 NDR_PRINT_IN_DEBUG(svcctl_StartServiceW, &r);
973         }
974
975         status = cli_do_rpc_ndr(cli,
976                                 mem_ctx,
977                                 &ndr_table_svcctl,
978                                 NDR_SVCCTL_STARTSERVICEW,
979                                 &r);
980
981         if (!NT_STATUS_IS_OK(status)) {
982                 return status;
983         }
984
985         if (DEBUGLEVEL >= 10) {
986                 NDR_PRINT_OUT_DEBUG(svcctl_StartServiceW, &r);
987         }
988
989         if (NT_STATUS_IS_ERR(status)) {
990                 return status;
991         }
992
993         /* Return variables */
994
995         /* Return result */
996         if (werror) {
997                 *werror = r.out.result;
998         }
999
1000         return werror_to_ntstatus(r.out.result);
1001 }
1002
1003 NTSTATUS rpccli_svcctl_GetServiceDisplayNameW(struct rpc_pipe_client *cli,
1004                                               TALLOC_CTX *mem_ctx,
1005                                               struct policy_handle *handle /* [in] [ref] */,
1006                                               const char *service_name /* [in] [unique,charset(UTF16)] */,
1007                                               const char **display_name /* [out] [ref,charset(UTF16)] */,
1008                                               uint32_t *display_name_length /* [in,out] [unique] */,
1009                                               WERROR *werror)
1010 {
1011         struct svcctl_GetServiceDisplayNameW r;
1012         NTSTATUS status;
1013
1014         /* In parameters */
1015         r.in.handle = handle;
1016         r.in.service_name = service_name;
1017         r.in.display_name_length = display_name_length;
1018
1019         if (DEBUGLEVEL >= 10) {
1020                 NDR_PRINT_IN_DEBUG(svcctl_GetServiceDisplayNameW, &r);
1021         }
1022
1023         status = cli_do_rpc_ndr(cli,
1024                                 mem_ctx,
1025                                 &ndr_table_svcctl,
1026                                 NDR_SVCCTL_GETSERVICEDISPLAYNAMEW,
1027                                 &r);
1028
1029         if (!NT_STATUS_IS_OK(status)) {
1030                 return status;
1031         }
1032
1033         if (DEBUGLEVEL >= 10) {
1034                 NDR_PRINT_OUT_DEBUG(svcctl_GetServiceDisplayNameW, &r);
1035         }
1036
1037         if (NT_STATUS_IS_ERR(status)) {
1038                 return status;
1039         }
1040
1041         /* Return variables */
1042         *display_name = *r.out.display_name;
1043         if (display_name_length && r.out.display_name_length) {
1044                 *display_name_length = *r.out.display_name_length;
1045         }
1046
1047         /* Return result */
1048         if (werror) {
1049                 *werror = r.out.result;
1050         }
1051
1052         return werror_to_ntstatus(r.out.result);
1053 }
1054
1055 NTSTATUS rpccli_svcctl_GetServiceKeyNameW(struct rpc_pipe_client *cli,
1056                                           TALLOC_CTX *mem_ctx,
1057                                           struct policy_handle *handle /* [in] [ref] */,
1058                                           const char *service_name /* [in] [unique,charset(UTF16)] */,
1059                                           const char **key_name /* [out] [ref,charset(UTF16)] */,
1060                                           uint32_t *display_name_length /* [in,out] [unique] */,
1061                                           WERROR *werror)
1062 {
1063         struct svcctl_GetServiceKeyNameW r;
1064         NTSTATUS status;
1065
1066         /* In parameters */
1067         r.in.handle = handle;
1068         r.in.service_name = service_name;
1069         r.in.display_name_length = display_name_length;
1070
1071         if (DEBUGLEVEL >= 10) {
1072                 NDR_PRINT_IN_DEBUG(svcctl_GetServiceKeyNameW, &r);
1073         }
1074
1075         status = cli_do_rpc_ndr(cli,
1076                                 mem_ctx,
1077                                 &ndr_table_svcctl,
1078                                 NDR_SVCCTL_GETSERVICEKEYNAMEW,
1079                                 &r);
1080
1081         if (!NT_STATUS_IS_OK(status)) {
1082                 return status;
1083         }
1084
1085         if (DEBUGLEVEL >= 10) {
1086                 NDR_PRINT_OUT_DEBUG(svcctl_GetServiceKeyNameW, &r);
1087         }
1088
1089         if (NT_STATUS_IS_ERR(status)) {
1090                 return status;
1091         }
1092
1093         /* Return variables */
1094         *key_name = *r.out.key_name;
1095         if (display_name_length && r.out.display_name_length) {
1096                 *display_name_length = *r.out.display_name_length;
1097         }
1098
1099         /* Return result */
1100         if (werror) {
1101                 *werror = r.out.result;
1102         }
1103
1104         return werror_to_ntstatus(r.out.result);
1105 }
1106
1107 NTSTATUS rpccli_svcctl_SCSetServiceBitsA(struct rpc_pipe_client *cli,
1108                                          TALLOC_CTX *mem_ctx,
1109                                          struct policy_handle *handle /* [in] [ref] */,
1110                                          uint32_t bits /* [in]  */,
1111                                          uint32_t bitson /* [in]  */,
1112                                          uint32_t immediate /* [in]  */,
1113                                          WERROR *werror)
1114 {
1115         struct svcctl_SCSetServiceBitsA r;
1116         NTSTATUS status;
1117
1118         /* In parameters */
1119         r.in.handle = handle;
1120         r.in.bits = bits;
1121         r.in.bitson = bitson;
1122         r.in.immediate = immediate;
1123
1124         if (DEBUGLEVEL >= 10) {
1125                 NDR_PRINT_IN_DEBUG(svcctl_SCSetServiceBitsA, &r);
1126         }
1127
1128         status = cli_do_rpc_ndr(cli,
1129                                 mem_ctx,
1130                                 &ndr_table_svcctl,
1131                                 NDR_SVCCTL_SCSETSERVICEBITSA,
1132                                 &r);
1133
1134         if (!NT_STATUS_IS_OK(status)) {
1135                 return status;
1136         }
1137
1138         if (DEBUGLEVEL >= 10) {
1139                 NDR_PRINT_OUT_DEBUG(svcctl_SCSetServiceBitsA, &r);
1140         }
1141
1142         if (NT_STATUS_IS_ERR(status)) {
1143                 return status;
1144         }
1145
1146         /* Return variables */
1147
1148         /* Return result */
1149         if (werror) {
1150                 *werror = r.out.result;
1151         }
1152
1153         return werror_to_ntstatus(r.out.result);
1154 }
1155
1156 NTSTATUS rpccli_svcctl_ChangeServiceConfigA(struct rpc_pipe_client *cli,
1157                                             TALLOC_CTX *mem_ctx,
1158                                             struct policy_handle *handle /* [in] [ref] */,
1159                                             uint32_t type /* [in]  */,
1160                                             uint32_t start /* [in]  */,
1161                                             uint32_t error /* [in]  */,
1162                                             const char *binary_path /* [in] [unique,charset(UTF16)] */,
1163                                             const char *load_order_group /* [in] [unique,charset(UTF16)] */,
1164                                             uint32_t *tag_id /* [out] [ref] */,
1165                                             const char *dependencies /* [in] [unique,charset(UTF16)] */,
1166                                             const char *service_start_name /* [in] [unique,charset(UTF16)] */,
1167                                             const char *password /* [in] [unique,charset(UTF16)] */,
1168                                             const char *display_name /* [in] [unique,charset(UTF16)] */,
1169                                             WERROR *werror)
1170 {
1171         struct svcctl_ChangeServiceConfigA r;
1172         NTSTATUS status;
1173
1174         /* In parameters */
1175         r.in.handle = handle;
1176         r.in.type = type;
1177         r.in.start = start;
1178         r.in.error = error;
1179         r.in.binary_path = binary_path;
1180         r.in.load_order_group = load_order_group;
1181         r.in.dependencies = dependencies;
1182         r.in.service_start_name = service_start_name;
1183         r.in.password = password;
1184         r.in.display_name = display_name;
1185
1186         if (DEBUGLEVEL >= 10) {
1187                 NDR_PRINT_IN_DEBUG(svcctl_ChangeServiceConfigA, &r);
1188         }
1189
1190         status = cli_do_rpc_ndr(cli,
1191                                 mem_ctx,
1192                                 &ndr_table_svcctl,
1193                                 NDR_SVCCTL_CHANGESERVICECONFIGA,
1194                                 &r);
1195
1196         if (!NT_STATUS_IS_OK(status)) {
1197                 return status;
1198         }
1199
1200         if (DEBUGLEVEL >= 10) {
1201                 NDR_PRINT_OUT_DEBUG(svcctl_ChangeServiceConfigA, &r);
1202         }
1203
1204         if (NT_STATUS_IS_ERR(status)) {
1205                 return status;
1206         }
1207
1208         /* Return variables */
1209         *tag_id = *r.out.tag_id;
1210
1211         /* Return result */
1212         if (werror) {
1213                 *werror = r.out.result;
1214         }
1215
1216         return werror_to_ntstatus(r.out.result);
1217 }
1218
1219 NTSTATUS rpccli_svcctl_CreateServiceA(struct rpc_pipe_client *cli,
1220                                       TALLOC_CTX *mem_ctx,
1221                                       struct policy_handle *handle /* [in] [ref] */,
1222                                       const char *ServiceName /* [in] [unique,charset(UTF16)] */,
1223                                       const char *DisplayName /* [in] [unique,charset(UTF16)] */,
1224                                       uint32_t desired_access /* [in]  */,
1225                                       uint32_t type /* [in]  */,
1226                                       uint32_t start_type /* [in]  */,
1227                                       uint32_t error_control /* [in]  */,
1228                                       const char *binary_path /* [in] [unique,charset(UTF16)] */,
1229                                       const char *LoadOrderGroupKey /* [in] [unique,charset(UTF16)] */,
1230                                       uint32_t *TagId /* [out] [unique] */,
1231                                       const char *dependencies /* [in] [unique,charset(UTF16)] */,
1232                                       const char *service_start_name /* [in] [unique,charset(UTF16)] */,
1233                                       const char *password /* [in] [unique,charset(UTF16)] */,
1234                                       WERROR *werror)
1235 {
1236         struct svcctl_CreateServiceA r;
1237         NTSTATUS status;
1238
1239         /* In parameters */
1240         r.in.handle = handle;
1241         r.in.ServiceName = ServiceName;
1242         r.in.DisplayName = DisplayName;
1243         r.in.desired_access = desired_access;
1244         r.in.type = type;
1245         r.in.start_type = start_type;
1246         r.in.error_control = error_control;
1247         r.in.binary_path = binary_path;
1248         r.in.LoadOrderGroupKey = LoadOrderGroupKey;
1249         r.in.dependencies = dependencies;
1250         r.in.service_start_name = service_start_name;
1251         r.in.password = password;
1252
1253         if (DEBUGLEVEL >= 10) {
1254                 NDR_PRINT_IN_DEBUG(svcctl_CreateServiceA, &r);
1255         }
1256
1257         status = cli_do_rpc_ndr(cli,
1258                                 mem_ctx,
1259                                 &ndr_table_svcctl,
1260                                 NDR_SVCCTL_CREATESERVICEA,
1261                                 &r);
1262
1263         if (!NT_STATUS_IS_OK(status)) {
1264                 return status;
1265         }
1266
1267         if (DEBUGLEVEL >= 10) {
1268                 NDR_PRINT_OUT_DEBUG(svcctl_CreateServiceA, &r);
1269         }
1270
1271         if (NT_STATUS_IS_ERR(status)) {
1272                 return status;
1273         }
1274
1275         /* Return variables */
1276         if (TagId && r.out.TagId) {
1277                 *TagId = *r.out.TagId;
1278         }
1279
1280         /* Return result */
1281         if (werror) {
1282                 *werror = r.out.result;
1283         }
1284
1285         return werror_to_ntstatus(r.out.result);
1286 }
1287
1288 NTSTATUS rpccli_svcctl_EnumDependentServicesA(struct rpc_pipe_client *cli,
1289                                               TALLOC_CTX *mem_ctx,
1290                                               struct policy_handle *service /* [in] [ref] */,
1291                                               uint32_t state /* [in]  */,
1292                                               struct ENUM_SERVICE_STATUS *service_status /* [out] [unique] */,
1293                                               uint32_t buf_size /* [in]  */,
1294                                               uint32_t *bytes_needed /* [out] [ref] */,
1295                                               uint32_t *services_returned /* [out] [ref] */,
1296                                               WERROR *werror)
1297 {
1298         struct svcctl_EnumDependentServicesA r;
1299         NTSTATUS status;
1300
1301         /* In parameters */
1302         r.in.service = service;
1303         r.in.state = state;
1304         r.in.buf_size = buf_size;
1305
1306         if (DEBUGLEVEL >= 10) {
1307                 NDR_PRINT_IN_DEBUG(svcctl_EnumDependentServicesA, &r);
1308         }
1309
1310         status = cli_do_rpc_ndr(cli,
1311                                 mem_ctx,
1312                                 &ndr_table_svcctl,
1313                                 NDR_SVCCTL_ENUMDEPENDENTSERVICESA,
1314                                 &r);
1315
1316         if (!NT_STATUS_IS_OK(status)) {
1317                 return status;
1318         }
1319
1320         if (DEBUGLEVEL >= 10) {
1321                 NDR_PRINT_OUT_DEBUG(svcctl_EnumDependentServicesA, &r);
1322         }
1323
1324         if (NT_STATUS_IS_ERR(status)) {
1325                 return status;
1326         }
1327
1328         /* Return variables */
1329         if (service_status && r.out.service_status) {
1330                 *service_status = *r.out.service_status;
1331         }
1332         *bytes_needed = *r.out.bytes_needed;
1333         *services_returned = *r.out.services_returned;
1334
1335         /* Return result */
1336         if (werror) {
1337                 *werror = r.out.result;
1338         }
1339
1340         return werror_to_ntstatus(r.out.result);
1341 }
1342
1343 NTSTATUS rpccli_svcctl_EnumServicesStatusA(struct rpc_pipe_client *cli,
1344                                            TALLOC_CTX *mem_ctx,
1345                                            struct policy_handle *handle /* [in] [ref] */,
1346                                            uint32_t type /* [in]  */,
1347                                            uint32_t state /* [in]  */,
1348                                            uint32_t buf_size /* [in]  */,
1349                                            uint8_t *service /* [out] [size_is(buf_size)] */,
1350                                            uint32_t *bytes_needed /* [out] [ref] */,
1351                                            uint32_t *services_returned /* [out] [ref] */,
1352                                            uint32_t *resume_handle /* [in,out] [unique] */,
1353                                            WERROR *werror)
1354 {
1355         struct svcctl_EnumServicesStatusA r;
1356         NTSTATUS status;
1357
1358         /* In parameters */
1359         r.in.handle = handle;
1360         r.in.type = type;
1361         r.in.state = state;
1362         r.in.buf_size = buf_size;
1363         r.in.resume_handle = resume_handle;
1364
1365         if (DEBUGLEVEL >= 10) {
1366                 NDR_PRINT_IN_DEBUG(svcctl_EnumServicesStatusA, &r);
1367         }
1368
1369         status = cli_do_rpc_ndr(cli,
1370                                 mem_ctx,
1371                                 &ndr_table_svcctl,
1372                                 NDR_SVCCTL_ENUMSERVICESSTATUSA,
1373                                 &r);
1374
1375         if (!NT_STATUS_IS_OK(status)) {
1376                 return status;
1377         }
1378
1379         if (DEBUGLEVEL >= 10) {
1380                 NDR_PRINT_OUT_DEBUG(svcctl_EnumServicesStatusA, &r);
1381         }
1382
1383         if (NT_STATUS_IS_ERR(status)) {
1384                 return status;
1385         }
1386
1387         /* Return variables */
1388         memcpy(service, r.out.service, r.in.buf_size * sizeof(*service));
1389         *bytes_needed = *r.out.bytes_needed;
1390         *services_returned = *r.out.services_returned;
1391         if (resume_handle && r.out.resume_handle) {
1392                 *resume_handle = *r.out.resume_handle;
1393         }
1394
1395         /* Return result */
1396         if (werror) {
1397                 *werror = r.out.result;
1398         }
1399
1400         return werror_to_ntstatus(r.out.result);
1401 }
1402
1403 NTSTATUS rpccli_svcctl_OpenSCManagerA(struct rpc_pipe_client *cli,
1404                                       TALLOC_CTX *mem_ctx,
1405                                       const char *MachineName /* [in] [unique,charset(UTF16)] */,
1406                                       const char *DatabaseName /* [in] [unique,charset(UTF16)] */,
1407                                       uint32_t access_mask /* [in]  */,
1408                                       struct policy_handle *handle /* [out] [ref] */,
1409                                       WERROR *werror)
1410 {
1411         struct svcctl_OpenSCManagerA r;
1412         NTSTATUS status;
1413
1414         /* In parameters */
1415         r.in.MachineName = MachineName;
1416         r.in.DatabaseName = DatabaseName;
1417         r.in.access_mask = access_mask;
1418
1419         if (DEBUGLEVEL >= 10) {
1420                 NDR_PRINT_IN_DEBUG(svcctl_OpenSCManagerA, &r);
1421         }
1422
1423         status = cli_do_rpc_ndr(cli,
1424                                 mem_ctx,
1425                                 &ndr_table_svcctl,
1426                                 NDR_SVCCTL_OPENSCMANAGERA,
1427                                 &r);
1428
1429         if (!NT_STATUS_IS_OK(status)) {
1430                 return status;
1431         }
1432
1433         if (DEBUGLEVEL >= 10) {
1434                 NDR_PRINT_OUT_DEBUG(svcctl_OpenSCManagerA, &r);
1435         }
1436
1437         if (NT_STATUS_IS_ERR(status)) {
1438                 return status;
1439         }
1440
1441         /* Return variables */
1442         *handle = *r.out.handle;
1443
1444         /* Return result */
1445         if (werror) {
1446                 *werror = r.out.result;
1447         }
1448
1449         return werror_to_ntstatus(r.out.result);
1450 }
1451
1452 NTSTATUS rpccli_svcctl_OpenServiceA(struct rpc_pipe_client *cli,
1453                                     TALLOC_CTX *mem_ctx,
1454                                     struct policy_handle *scmanager_handle /* [in] [ref] */,
1455                                     const char *ServiceName /* [in] [unique,charset(UTF16)] */,
1456                                     uint32_t access_mask /* [in]  */,
1457                                     WERROR *werror)
1458 {
1459         struct svcctl_OpenServiceA r;
1460         NTSTATUS status;
1461
1462         /* In parameters */
1463         r.in.scmanager_handle = scmanager_handle;
1464         r.in.ServiceName = ServiceName;
1465         r.in.access_mask = access_mask;
1466
1467         if (DEBUGLEVEL >= 10) {
1468                 NDR_PRINT_IN_DEBUG(svcctl_OpenServiceA, &r);
1469         }
1470
1471         status = cli_do_rpc_ndr(cli,
1472                                 mem_ctx,
1473                                 &ndr_table_svcctl,
1474                                 NDR_SVCCTL_OPENSERVICEA,
1475                                 &r);
1476
1477         if (!NT_STATUS_IS_OK(status)) {
1478                 return status;
1479         }
1480
1481         if (DEBUGLEVEL >= 10) {
1482                 NDR_PRINT_OUT_DEBUG(svcctl_OpenServiceA, &r);
1483         }
1484
1485         if (NT_STATUS_IS_ERR(status)) {
1486                 return status;
1487         }
1488
1489         /* Return variables */
1490
1491         /* Return result */
1492         if (werror) {
1493                 *werror = r.out.result;
1494         }
1495
1496         return werror_to_ntstatus(r.out.result);
1497 }
1498
1499 NTSTATUS rpccli_svcctl_QueryServiceConfigA(struct rpc_pipe_client *cli,
1500                                            TALLOC_CTX *mem_ctx,
1501                                            struct policy_handle *handle /* [in] [ref] */,
1502                                            uint8_t *query /* [out]  */,
1503                                            uint32_t buf_size /* [in]  */,
1504                                            uint32_t *bytes_needed /* [out] [ref] */,
1505                                            WERROR *werror)
1506 {
1507         struct svcctl_QueryServiceConfigA r;
1508         NTSTATUS status;
1509
1510         /* In parameters */
1511         r.in.handle = handle;
1512         r.in.buf_size = buf_size;
1513
1514         if (DEBUGLEVEL >= 10) {
1515                 NDR_PRINT_IN_DEBUG(svcctl_QueryServiceConfigA, &r);
1516         }
1517
1518         status = cli_do_rpc_ndr(cli,
1519                                 mem_ctx,
1520                                 &ndr_table_svcctl,
1521                                 NDR_SVCCTL_QUERYSERVICECONFIGA,
1522                                 &r);
1523
1524         if (!NT_STATUS_IS_OK(status)) {
1525                 return status;
1526         }
1527
1528         if (DEBUGLEVEL >= 10) {
1529                 NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceConfigA, &r);
1530         }
1531
1532         if (NT_STATUS_IS_ERR(status)) {
1533                 return status;
1534         }
1535
1536         /* Return variables */
1537         memcpy(query, r.out.query, r.in.buf_size * sizeof(*query));
1538         *bytes_needed = *r.out.bytes_needed;
1539
1540         /* Return result */
1541         if (werror) {
1542                 *werror = r.out.result;
1543         }
1544
1545         return werror_to_ntstatus(r.out.result);
1546 }
1547
1548 NTSTATUS rpccli_svcctl_QueryServiceLockStatusA(struct rpc_pipe_client *cli,
1549                                                TALLOC_CTX *mem_ctx,
1550                                                struct policy_handle *handle /* [in] [ref] */,
1551                                                uint32_t buf_size /* [in]  */,
1552                                                struct SERVICE_LOCK_STATUS *lock_status /* [out] [ref] */,
1553                                                uint32_t *required_buf_size /* [out] [ref] */,
1554                                                WERROR *werror)
1555 {
1556         struct svcctl_QueryServiceLockStatusA r;
1557         NTSTATUS status;
1558
1559         /* In parameters */
1560         r.in.handle = handle;
1561         r.in.buf_size = buf_size;
1562
1563         if (DEBUGLEVEL >= 10) {
1564                 NDR_PRINT_IN_DEBUG(svcctl_QueryServiceLockStatusA, &r);
1565         }
1566
1567         status = cli_do_rpc_ndr(cli,
1568                                 mem_ctx,
1569                                 &ndr_table_svcctl,
1570                                 NDR_SVCCTL_QUERYSERVICELOCKSTATUSA,
1571                                 &r);
1572
1573         if (!NT_STATUS_IS_OK(status)) {
1574                 return status;
1575         }
1576
1577         if (DEBUGLEVEL >= 10) {
1578                 NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceLockStatusA, &r);
1579         }
1580
1581         if (NT_STATUS_IS_ERR(status)) {
1582                 return status;
1583         }
1584
1585         /* Return variables */
1586         *lock_status = *r.out.lock_status;
1587         *required_buf_size = *r.out.required_buf_size;
1588
1589         /* Return result */
1590         if (werror) {
1591                 *werror = r.out.result;
1592         }
1593
1594         return werror_to_ntstatus(r.out.result);
1595 }
1596
1597 NTSTATUS rpccli_svcctl_StartServiceA(struct rpc_pipe_client *cli,
1598                                      TALLOC_CTX *mem_ctx,
1599                                      struct policy_handle *handle /* [in] [ref] */,
1600                                      uint32_t NumArgs /* [in]  */,
1601                                      const char *Arguments /* [in] [unique,charset(UTF16)] */,
1602                                      WERROR *werror)
1603 {
1604         struct svcctl_StartServiceA r;
1605         NTSTATUS status;
1606
1607         /* In parameters */
1608         r.in.handle = handle;
1609         r.in.NumArgs = NumArgs;
1610         r.in.Arguments = Arguments;
1611
1612         if (DEBUGLEVEL >= 10) {
1613                 NDR_PRINT_IN_DEBUG(svcctl_StartServiceA, &r);
1614         }
1615
1616         status = cli_do_rpc_ndr(cli,
1617                                 mem_ctx,
1618                                 &ndr_table_svcctl,
1619                                 NDR_SVCCTL_STARTSERVICEA,
1620                                 &r);
1621
1622         if (!NT_STATUS_IS_OK(status)) {
1623                 return status;
1624         }
1625
1626         if (DEBUGLEVEL >= 10) {
1627                 NDR_PRINT_OUT_DEBUG(svcctl_StartServiceA, &r);
1628         }
1629
1630         if (NT_STATUS_IS_ERR(status)) {
1631                 return status;
1632         }
1633
1634         /* Return variables */
1635
1636         /* Return result */
1637         if (werror) {
1638                 *werror = r.out.result;
1639         }
1640
1641         return werror_to_ntstatus(r.out.result);
1642 }
1643
1644 NTSTATUS rpccli_svcctl_GetServiceDisplayNameA(struct rpc_pipe_client *cli,
1645                                               TALLOC_CTX *mem_ctx,
1646                                               struct policy_handle *handle /* [in] [ref] */,
1647                                               const char *service_name /* [in] [unique,charset(UTF16)] */,
1648                                               const char **display_name /* [out] [ref,charset(UTF16)] */,
1649                                               uint32_t *display_name_length /* [in,out] [unique] */,
1650                                               WERROR *werror)
1651 {
1652         struct svcctl_GetServiceDisplayNameA r;
1653         NTSTATUS status;
1654
1655         /* In parameters */
1656         r.in.handle = handle;
1657         r.in.service_name = service_name;
1658         r.in.display_name_length = display_name_length;
1659
1660         if (DEBUGLEVEL >= 10) {
1661                 NDR_PRINT_IN_DEBUG(svcctl_GetServiceDisplayNameA, &r);
1662         }
1663
1664         status = cli_do_rpc_ndr(cli,
1665                                 mem_ctx,
1666                                 &ndr_table_svcctl,
1667                                 NDR_SVCCTL_GETSERVICEDISPLAYNAMEA,
1668                                 &r);
1669
1670         if (!NT_STATUS_IS_OK(status)) {
1671                 return status;
1672         }
1673
1674         if (DEBUGLEVEL >= 10) {
1675                 NDR_PRINT_OUT_DEBUG(svcctl_GetServiceDisplayNameA, &r);
1676         }
1677
1678         if (NT_STATUS_IS_ERR(status)) {
1679                 return status;
1680         }
1681
1682         /* Return variables */
1683         *display_name = *r.out.display_name;
1684         if (display_name_length && r.out.display_name_length) {
1685                 *display_name_length = *r.out.display_name_length;
1686         }
1687
1688         /* Return result */
1689         if (werror) {
1690                 *werror = r.out.result;
1691         }
1692
1693         return werror_to_ntstatus(r.out.result);
1694 }
1695
1696 NTSTATUS rpccli_svcctl_GetServiceKeyNameA(struct rpc_pipe_client *cli,
1697                                           TALLOC_CTX *mem_ctx,
1698                                           struct policy_handle *handle /* [in] [ref] */,
1699                                           const char *service_name /* [in] [unique,charset(UTF16)] */,
1700                                           const char **key_name /* [out] [ref,charset(UTF16)] */,
1701                                           uint32_t *display_name_length /* [in,out] [unique] */,
1702                                           WERROR *werror)
1703 {
1704         struct svcctl_GetServiceKeyNameA r;
1705         NTSTATUS status;
1706
1707         /* In parameters */
1708         r.in.handle = handle;
1709         r.in.service_name = service_name;
1710         r.in.display_name_length = display_name_length;
1711
1712         if (DEBUGLEVEL >= 10) {
1713                 NDR_PRINT_IN_DEBUG(svcctl_GetServiceKeyNameA, &r);
1714         }
1715
1716         status = cli_do_rpc_ndr(cli,
1717                                 mem_ctx,
1718                                 &ndr_table_svcctl,
1719                                 NDR_SVCCTL_GETSERVICEKEYNAMEA,
1720                                 &r);
1721
1722         if (!NT_STATUS_IS_OK(status)) {
1723                 return status;
1724         }
1725
1726         if (DEBUGLEVEL >= 10) {
1727                 NDR_PRINT_OUT_DEBUG(svcctl_GetServiceKeyNameA, &r);
1728         }
1729
1730         if (NT_STATUS_IS_ERR(status)) {
1731                 return status;
1732         }
1733
1734         /* Return variables */
1735         *key_name = *r.out.key_name;
1736         if (display_name_length && r.out.display_name_length) {
1737                 *display_name_length = *r.out.display_name_length;
1738         }
1739
1740         /* Return result */
1741         if (werror) {
1742                 *werror = r.out.result;
1743         }
1744
1745         return werror_to_ntstatus(r.out.result);
1746 }
1747
1748 NTSTATUS rpccli_svcctl_GetCurrentGroupeStateW(struct rpc_pipe_client *cli,
1749                                               TALLOC_CTX *mem_ctx,
1750                                               WERROR *werror)
1751 {
1752         struct svcctl_GetCurrentGroupeStateW r;
1753         NTSTATUS status;
1754
1755         /* In parameters */
1756
1757         if (DEBUGLEVEL >= 10) {
1758                 NDR_PRINT_IN_DEBUG(svcctl_GetCurrentGroupeStateW, &r);
1759         }
1760
1761         status = cli_do_rpc_ndr(cli,
1762                                 mem_ctx,
1763                                 &ndr_table_svcctl,
1764                                 NDR_SVCCTL_GETCURRENTGROUPESTATEW,
1765                                 &r);
1766
1767         if (!NT_STATUS_IS_OK(status)) {
1768                 return status;
1769         }
1770
1771         if (DEBUGLEVEL >= 10) {
1772                 NDR_PRINT_OUT_DEBUG(svcctl_GetCurrentGroupeStateW, &r);
1773         }
1774
1775         if (NT_STATUS_IS_ERR(status)) {
1776                 return status;
1777         }
1778
1779         /* Return variables */
1780
1781         /* Return result */
1782         if (werror) {
1783                 *werror = r.out.result;
1784         }
1785
1786         return werror_to_ntstatus(r.out.result);
1787 }
1788
1789 NTSTATUS rpccli_svcctl_EnumServiceGroupW(struct rpc_pipe_client *cli,
1790                                          TALLOC_CTX *mem_ctx,
1791                                          WERROR *werror)
1792 {
1793         struct svcctl_EnumServiceGroupW r;
1794         NTSTATUS status;
1795
1796         /* In parameters */
1797
1798         if (DEBUGLEVEL >= 10) {
1799                 NDR_PRINT_IN_DEBUG(svcctl_EnumServiceGroupW, &r);
1800         }
1801
1802         status = cli_do_rpc_ndr(cli,
1803                                 mem_ctx,
1804                                 &ndr_table_svcctl,
1805                                 NDR_SVCCTL_ENUMSERVICEGROUPW,
1806                                 &r);
1807
1808         if (!NT_STATUS_IS_OK(status)) {
1809                 return status;
1810         }
1811
1812         if (DEBUGLEVEL >= 10) {
1813                 NDR_PRINT_OUT_DEBUG(svcctl_EnumServiceGroupW, &r);
1814         }
1815
1816         if (NT_STATUS_IS_ERR(status)) {
1817                 return status;
1818         }
1819
1820         /* Return variables */
1821
1822         /* Return result */
1823         if (werror) {
1824                 *werror = r.out.result;
1825         }
1826
1827         return werror_to_ntstatus(r.out.result);
1828 }
1829
1830 NTSTATUS rpccli_svcctl_ChangeServiceConfig2A(struct rpc_pipe_client *cli,
1831                                              TALLOC_CTX *mem_ctx,
1832                                              struct policy_handle *handle /* [in] [ref] */,
1833                                              uint32_t info_level /* [in]  */,
1834                                              uint8_t *info /* [in] [unique] */,
1835                                              WERROR *werror)
1836 {
1837         struct svcctl_ChangeServiceConfig2A r;
1838         NTSTATUS status;
1839
1840         /* In parameters */
1841         r.in.handle = handle;
1842         r.in.info_level = info_level;
1843         r.in.info = info;
1844
1845         if (DEBUGLEVEL >= 10) {
1846                 NDR_PRINT_IN_DEBUG(svcctl_ChangeServiceConfig2A, &r);
1847         }
1848
1849         status = cli_do_rpc_ndr(cli,
1850                                 mem_ctx,
1851                                 &ndr_table_svcctl,
1852                                 NDR_SVCCTL_CHANGESERVICECONFIG2A,
1853                                 &r);
1854
1855         if (!NT_STATUS_IS_OK(status)) {
1856                 return status;
1857         }
1858
1859         if (DEBUGLEVEL >= 10) {
1860                 NDR_PRINT_OUT_DEBUG(svcctl_ChangeServiceConfig2A, &r);
1861         }
1862
1863         if (NT_STATUS_IS_ERR(status)) {
1864                 return status;
1865         }
1866
1867         /* Return variables */
1868
1869         /* Return result */
1870         if (werror) {
1871                 *werror = r.out.result;
1872         }
1873
1874         return werror_to_ntstatus(r.out.result);
1875 }
1876
1877 NTSTATUS rpccli_svcctl_ChangeServiceConfig2W(struct rpc_pipe_client *cli,
1878                                              TALLOC_CTX *mem_ctx,
1879                                              struct policy_handle *handle /* [in] [ref] */,
1880                                              uint32_t info_level /* [in]  */,
1881                                              uint8_t *info /* [in] [unique] */,
1882                                              WERROR *werror)
1883 {
1884         struct svcctl_ChangeServiceConfig2W r;
1885         NTSTATUS status;
1886
1887         /* In parameters */
1888         r.in.handle = handle;
1889         r.in.info_level = info_level;
1890         r.in.info = info;
1891
1892         if (DEBUGLEVEL >= 10) {
1893                 NDR_PRINT_IN_DEBUG(svcctl_ChangeServiceConfig2W, &r);
1894         }
1895
1896         status = cli_do_rpc_ndr(cli,
1897                                 mem_ctx,
1898                                 &ndr_table_svcctl,
1899                                 NDR_SVCCTL_CHANGESERVICECONFIG2W,
1900                                 &r);
1901
1902         if (!NT_STATUS_IS_OK(status)) {
1903                 return status;
1904         }
1905
1906         if (DEBUGLEVEL >= 10) {
1907                 NDR_PRINT_OUT_DEBUG(svcctl_ChangeServiceConfig2W, &r);
1908         }
1909
1910         if (NT_STATUS_IS_ERR(status)) {
1911                 return status;
1912         }
1913
1914         /* Return variables */
1915
1916         /* Return result */
1917         if (werror) {
1918                 *werror = r.out.result;
1919         }
1920
1921         return werror_to_ntstatus(r.out.result);
1922 }
1923
1924 NTSTATUS rpccli_svcctl_QueryServiceConfig2A(struct rpc_pipe_client *cli,
1925                                             TALLOC_CTX *mem_ctx,
1926                                             struct policy_handle *handle /* [in] [ref] */,
1927                                             uint32_t info_level /* [in]  */,
1928                                             uint8_t *buffer /* [out]  */,
1929                                             uint32_t buf_size /* [in]  */,
1930                                             uint32_t *bytes_needed /* [out] [ref] */,
1931                                             WERROR *werror)
1932 {
1933         struct svcctl_QueryServiceConfig2A r;
1934         NTSTATUS status;
1935
1936         /* In parameters */
1937         r.in.handle = handle;
1938         r.in.info_level = info_level;
1939         r.in.buf_size = buf_size;
1940
1941         if (DEBUGLEVEL >= 10) {
1942                 NDR_PRINT_IN_DEBUG(svcctl_QueryServiceConfig2A, &r);
1943         }
1944
1945         status = cli_do_rpc_ndr(cli,
1946                                 mem_ctx,
1947                                 &ndr_table_svcctl,
1948                                 NDR_SVCCTL_QUERYSERVICECONFIG2A,
1949                                 &r);
1950
1951         if (!NT_STATUS_IS_OK(status)) {
1952                 return status;
1953         }
1954
1955         if (DEBUGLEVEL >= 10) {
1956                 NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceConfig2A, &r);
1957         }
1958
1959         if (NT_STATUS_IS_ERR(status)) {
1960                 return status;
1961         }
1962
1963         /* Return variables */
1964         memcpy(buffer, r.out.buffer, r.in.buf_size * sizeof(*buffer));
1965         *bytes_needed = *r.out.bytes_needed;
1966
1967         /* Return result */
1968         if (werror) {
1969                 *werror = r.out.result;
1970         }
1971
1972         return werror_to_ntstatus(r.out.result);
1973 }
1974
1975 NTSTATUS rpccli_svcctl_QueryServiceConfig2W(struct rpc_pipe_client *cli,
1976                                             TALLOC_CTX *mem_ctx,
1977                                             struct policy_handle *handle /* [in] [ref] */,
1978                                             uint32_t info_level /* [in]  */,
1979                                             uint8_t *buffer /* [out] [ref,size_is(buf_size)] */,
1980                                             uint32_t buf_size /* [in] [range(0,8192)] */,
1981                                             uint32_t *bytes_needed /* [out] [ref,range(0,8192)] */,
1982                                             WERROR *werror)
1983 {
1984         struct svcctl_QueryServiceConfig2W r;
1985         NTSTATUS status;
1986
1987         /* In parameters */
1988         r.in.handle = handle;
1989         r.in.info_level = info_level;
1990         r.in.buf_size = buf_size;
1991
1992         if (DEBUGLEVEL >= 10) {
1993                 NDR_PRINT_IN_DEBUG(svcctl_QueryServiceConfig2W, &r);
1994         }
1995
1996         status = cli_do_rpc_ndr(cli,
1997                                 mem_ctx,
1998                                 &ndr_table_svcctl,
1999                                 NDR_SVCCTL_QUERYSERVICECONFIG2W,
2000                                 &r);
2001
2002         if (!NT_STATUS_IS_OK(status)) {
2003                 return status;
2004         }
2005
2006         if (DEBUGLEVEL >= 10) {
2007                 NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceConfig2W, &r);
2008         }
2009
2010         if (NT_STATUS_IS_ERR(status)) {
2011                 return status;
2012         }
2013
2014         /* Return variables */
2015         memcpy(buffer, r.out.buffer, r.in.buf_size * sizeof(*buffer));
2016         *bytes_needed = *r.out.bytes_needed;
2017
2018         /* Return result */
2019         if (werror) {
2020                 *werror = r.out.result;
2021         }
2022
2023         return werror_to_ntstatus(r.out.result);
2024 }
2025
2026 NTSTATUS rpccli_svcctl_QueryServiceStatusEx(struct rpc_pipe_client *cli,
2027                                             TALLOC_CTX *mem_ctx,
2028                                             struct policy_handle *handle /* [in] [ref] */,
2029                                             uint32_t info_level /* [in]  */,
2030                                             uint8_t *buffer /* [out] [ref,size_is(buf_size)] */,
2031                                             uint32_t buf_size /* [in] [range(0,8192)] */,
2032                                             uint32_t *bytes_needed /* [out] [ref,range(0,8192)] */,
2033                                             WERROR *werror)
2034 {
2035         struct svcctl_QueryServiceStatusEx r;
2036         NTSTATUS status;
2037
2038         /* In parameters */
2039         r.in.handle = handle;
2040         r.in.info_level = info_level;
2041         r.in.buf_size = buf_size;
2042
2043         if (DEBUGLEVEL >= 10) {
2044                 NDR_PRINT_IN_DEBUG(svcctl_QueryServiceStatusEx, &r);
2045         }
2046
2047         status = cli_do_rpc_ndr(cli,
2048                                 mem_ctx,
2049                                 &ndr_table_svcctl,
2050                                 NDR_SVCCTL_QUERYSERVICESTATUSEX,
2051                                 &r);
2052
2053         if (!NT_STATUS_IS_OK(status)) {
2054                 return status;
2055         }
2056
2057         if (DEBUGLEVEL >= 10) {
2058                 NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceStatusEx, &r);
2059         }
2060
2061         if (NT_STATUS_IS_ERR(status)) {
2062                 return status;
2063         }
2064
2065         /* Return variables */
2066         memcpy(buffer, r.out.buffer, r.in.buf_size * sizeof(*buffer));
2067         *bytes_needed = *r.out.bytes_needed;
2068
2069         /* Return result */
2070         if (werror) {
2071                 *werror = r.out.result;
2072         }
2073
2074         return werror_to_ntstatus(r.out.result);
2075 }
2076
2077 NTSTATUS rpccli_EnumServicesStatusExA(struct rpc_pipe_client *cli,
2078                                       TALLOC_CTX *mem_ctx,
2079                                       struct policy_handle *scmanager /* [in] [ref] */,
2080                                       uint32_t info_level /* [in]  */,
2081                                       uint32_t type /* [in]  */,
2082                                       uint32_t state /* [in]  */,
2083                                       uint8_t *services /* [out]  */,
2084                                       uint32_t buf_size /* [in]  */,
2085                                       uint32_t *bytes_needed /* [out] [ref] */,
2086                                       uint32_t *service_returned /* [out] [ref] */,
2087                                       uint32_t *resume_handle /* [in,out] [unique] */,
2088                                       const char **group_name /* [out] [ref,charset(UTF16)] */,
2089                                       WERROR *werror)
2090 {
2091         struct EnumServicesStatusExA r;
2092         NTSTATUS status;
2093
2094         /* In parameters */
2095         r.in.scmanager = scmanager;
2096         r.in.info_level = info_level;
2097         r.in.type = type;
2098         r.in.state = state;
2099         r.in.buf_size = buf_size;
2100         r.in.resume_handle = resume_handle;
2101
2102         if (DEBUGLEVEL >= 10) {
2103                 NDR_PRINT_IN_DEBUG(EnumServicesStatusExA, &r);
2104         }
2105
2106         status = cli_do_rpc_ndr(cli,
2107                                 mem_ctx,
2108                                 &ndr_table_svcctl,
2109                                 NDR_ENUMSERVICESSTATUSEXA,
2110                                 &r);
2111
2112         if (!NT_STATUS_IS_OK(status)) {
2113                 return status;
2114         }
2115
2116         if (DEBUGLEVEL >= 10) {
2117                 NDR_PRINT_OUT_DEBUG(EnumServicesStatusExA, &r);
2118         }
2119
2120         if (NT_STATUS_IS_ERR(status)) {
2121                 return status;
2122         }
2123
2124         /* Return variables */
2125         memcpy(services, r.out.services, r.in.buf_size * sizeof(*services));
2126         *bytes_needed = *r.out.bytes_needed;
2127         *service_returned = *r.out.service_returned;
2128         if (resume_handle && r.out.resume_handle) {
2129                 *resume_handle = *r.out.resume_handle;
2130         }
2131         *group_name = *r.out.group_name;
2132
2133         /* Return result */
2134         if (werror) {
2135                 *werror = r.out.result;
2136         }
2137
2138         return werror_to_ntstatus(r.out.result);
2139 }
2140
2141 NTSTATUS rpccli_EnumServicesStatusExW(struct rpc_pipe_client *cli,
2142                                       TALLOC_CTX *mem_ctx,
2143                                       struct policy_handle *scmanager /* [in] [ref] */,
2144                                       uint32_t info_level /* [in]  */,
2145                                       uint32_t type /* [in]  */,
2146                                       uint32_t state /* [in]  */,
2147                                       uint8_t *services /* [out] [ref,size_is(buf_size)] */,
2148                                       uint32_t buf_size /* [in] [range(0,262144)] */,
2149                                       uint32_t *bytes_needed /* [out] [ref,range(0,262144)] */,
2150                                       uint32_t *service_returned /* [out] [ref,range(0,262144)] */,
2151                                       uint32_t *resume_handle /* [in,out] [unique,range(0,262144)] */,
2152                                       const char *group_name /* [in] [unique,charset(UTF16)] */,
2153                                       WERROR *werror)
2154 {
2155         struct EnumServicesStatusExW r;
2156         NTSTATUS status;
2157
2158         /* In parameters */
2159         r.in.scmanager = scmanager;
2160         r.in.info_level = info_level;
2161         r.in.type = type;
2162         r.in.state = state;
2163         r.in.buf_size = buf_size;
2164         r.in.resume_handle = resume_handle;
2165         r.in.group_name = group_name;
2166
2167         if (DEBUGLEVEL >= 10) {
2168                 NDR_PRINT_IN_DEBUG(EnumServicesStatusExW, &r);
2169         }
2170
2171         status = cli_do_rpc_ndr(cli,
2172                                 mem_ctx,
2173                                 &ndr_table_svcctl,
2174                                 NDR_ENUMSERVICESSTATUSEXW,
2175                                 &r);
2176
2177         if (!NT_STATUS_IS_OK(status)) {
2178                 return status;
2179         }
2180
2181         if (DEBUGLEVEL >= 10) {
2182                 NDR_PRINT_OUT_DEBUG(EnumServicesStatusExW, &r);
2183         }
2184
2185         if (NT_STATUS_IS_ERR(status)) {
2186                 return status;
2187         }
2188
2189         /* Return variables */
2190         memcpy(services, r.out.services, r.in.buf_size * sizeof(*services));
2191         *bytes_needed = *r.out.bytes_needed;
2192         *service_returned = *r.out.service_returned;
2193         if (resume_handle && r.out.resume_handle) {
2194                 *resume_handle = *r.out.resume_handle;
2195         }
2196
2197         /* Return result */
2198         if (werror) {
2199                 *werror = r.out.result;
2200         }
2201
2202         return werror_to_ntstatus(r.out.result);
2203 }
2204
2205 NTSTATUS rpccli_svcctl_SCSendTSMessage(struct rpc_pipe_client *cli,
2206                                        TALLOC_CTX *mem_ctx,
2207                                        WERROR *werror)
2208 {
2209         struct svcctl_SCSendTSMessage r;
2210         NTSTATUS status;
2211
2212         /* In parameters */
2213
2214         if (DEBUGLEVEL >= 10) {
2215                 NDR_PRINT_IN_DEBUG(svcctl_SCSendTSMessage, &r);
2216         }
2217
2218         status = cli_do_rpc_ndr(cli,
2219                                 mem_ctx,
2220                                 &ndr_table_svcctl,
2221                                 NDR_SVCCTL_SCSENDTSMESSAGE,
2222                                 &r);
2223
2224         if (!NT_STATUS_IS_OK(status)) {
2225                 return status;
2226         }
2227
2228         if (DEBUGLEVEL >= 10) {
2229                 NDR_PRINT_OUT_DEBUG(svcctl_SCSendTSMessage, &r);
2230         }
2231
2232         if (NT_STATUS_IS_ERR(status)) {
2233                 return status;
2234         }
2235
2236         /* Return variables */
2237
2238         /* Return result */
2239         if (werror) {
2240                 *werror = r.out.result;
2241         }
2242
2243         return werror_to_ntstatus(r.out.result);
2244 }
2245