git add -f bin/default/librpc/gen_ndr/*.[ch] bin/default/source*/librpc/gen_ndr/...
[metze/samba/wip.git] / bin.gen_ndr / default / librpc / gen_ndr / srv_svcctl.c
1 /*
2  * Unix SMB/CIFS implementation.
3  * server auto-generated by pidl. DO NOT MODIFY!
4  */
5
6 #include "includes.h"
7 #include "ntdomain.h"
8 #include "bin/default/librpc/gen_ndr/srv_svcctl.h"
9
10 static bool api_svcctl_CloseServiceHandle(struct pipes_struct *p)
11 {
12         const struct ndr_interface_call *call;
13         struct ndr_pull *pull;
14         struct ndr_push *push;
15         enum ndr_err_code ndr_err;
16         struct svcctl_CloseServiceHandle *r;
17
18         call = &ndr_table_svcctl.calls[NDR_SVCCTL_CLOSESERVICEHANDLE];
19
20         r = talloc(talloc_tos(), struct svcctl_CloseServiceHandle);
21         if (r == NULL) {
22                 return false;
23         }
24
25         pull = ndr_pull_init_blob(&p->in_data.data, r);
26         if (pull == NULL) {
27                 talloc_free(r);
28                 return false;
29         }
30
31         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
32         if (p->endian) {
33                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
34         }
35         ndr_err = call->ndr_pull(pull, NDR_IN, r);
36         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
37                 talloc_free(r);
38                 return false;
39         }
40
41         if (DEBUGLEVEL >= 10) {
42                 NDR_PRINT_FUNCTION_DEBUG(svcctl_CloseServiceHandle, NDR_IN, r);
43         }
44
45         ZERO_STRUCT(r->out);
46         r->out.handle = r->in.handle;
47         r->out.result = _svcctl_CloseServiceHandle(p, r);
48
49         if (p->fault_state) {
50                 talloc_free(r);
51                 /* Return true here, srv_pipe_hnd.c will take care */
52                 return true;
53         }
54
55         if (DEBUGLEVEL >= 10) {
56                 NDR_PRINT_FUNCTION_DEBUG(svcctl_CloseServiceHandle, NDR_OUT | NDR_SET_VALUES, r);
57         }
58
59         push = ndr_push_init_ctx(r);
60         if (push == NULL) {
61                 talloc_free(r);
62                 return false;
63         }
64
65         /*
66          * carry over the pointer count to the reply in case we are
67          * using full pointer. See NDR specification for full pointers
68          */
69         push->ptr_count = pull->ptr_count;
70
71         ndr_err = call->ndr_push(push, NDR_OUT, r);
72         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
73                 talloc_free(r);
74                 return false;
75         }
76
77         p->out_data.rdata = ndr_push_blob(push);
78         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
79
80         talloc_free(r);
81
82         return true;
83 }
84
85 static bool api_svcctl_ControlService(struct pipes_struct *p)
86 {
87         const struct ndr_interface_call *call;
88         struct ndr_pull *pull;
89         struct ndr_push *push;
90         enum ndr_err_code ndr_err;
91         struct svcctl_ControlService *r;
92
93         call = &ndr_table_svcctl.calls[NDR_SVCCTL_CONTROLSERVICE];
94
95         r = talloc(talloc_tos(), struct svcctl_ControlService);
96         if (r == NULL) {
97                 return false;
98         }
99
100         pull = ndr_pull_init_blob(&p->in_data.data, r);
101         if (pull == NULL) {
102                 talloc_free(r);
103                 return false;
104         }
105
106         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
107         if (p->endian) {
108                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
109         }
110         ndr_err = call->ndr_pull(pull, NDR_IN, r);
111         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
112                 talloc_free(r);
113                 return false;
114         }
115
116         if (DEBUGLEVEL >= 10) {
117                 NDR_PRINT_FUNCTION_DEBUG(svcctl_ControlService, NDR_IN, r);
118         }
119
120         ZERO_STRUCT(r->out);
121         r->out.service_status = talloc_zero(r, struct SERVICE_STATUS);
122         if (r->out.service_status == NULL) {
123                 talloc_free(r);
124                 return false;
125         }
126
127         r->out.result = _svcctl_ControlService(p, r);
128
129         if (p->fault_state) {
130                 talloc_free(r);
131                 /* Return true here, srv_pipe_hnd.c will take care */
132                 return true;
133         }
134
135         if (DEBUGLEVEL >= 10) {
136                 NDR_PRINT_FUNCTION_DEBUG(svcctl_ControlService, NDR_OUT | NDR_SET_VALUES, r);
137         }
138
139         push = ndr_push_init_ctx(r);
140         if (push == NULL) {
141                 talloc_free(r);
142                 return false;
143         }
144
145         /*
146          * carry over the pointer count to the reply in case we are
147          * using full pointer. See NDR specification for full pointers
148          */
149         push->ptr_count = pull->ptr_count;
150
151         ndr_err = call->ndr_push(push, NDR_OUT, r);
152         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
153                 talloc_free(r);
154                 return false;
155         }
156
157         p->out_data.rdata = ndr_push_blob(push);
158         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
159
160         talloc_free(r);
161
162         return true;
163 }
164
165 static bool api_svcctl_DeleteService(struct pipes_struct *p)
166 {
167         const struct ndr_interface_call *call;
168         struct ndr_pull *pull;
169         struct ndr_push *push;
170         enum ndr_err_code ndr_err;
171         struct svcctl_DeleteService *r;
172
173         call = &ndr_table_svcctl.calls[NDR_SVCCTL_DELETESERVICE];
174
175         r = talloc(talloc_tos(), struct svcctl_DeleteService);
176         if (r == NULL) {
177                 return false;
178         }
179
180         pull = ndr_pull_init_blob(&p->in_data.data, r);
181         if (pull == NULL) {
182                 talloc_free(r);
183                 return false;
184         }
185
186         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
187         if (p->endian) {
188                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
189         }
190         ndr_err = call->ndr_pull(pull, NDR_IN, r);
191         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
192                 talloc_free(r);
193                 return false;
194         }
195
196         if (DEBUGLEVEL >= 10) {
197                 NDR_PRINT_FUNCTION_DEBUG(svcctl_DeleteService, NDR_IN, r);
198         }
199
200         r->out.result = _svcctl_DeleteService(p, r);
201
202         if (p->fault_state) {
203                 talloc_free(r);
204                 /* Return true here, srv_pipe_hnd.c will take care */
205                 return true;
206         }
207
208         if (DEBUGLEVEL >= 10) {
209                 NDR_PRINT_FUNCTION_DEBUG(svcctl_DeleteService, NDR_OUT | NDR_SET_VALUES, r);
210         }
211
212         push = ndr_push_init_ctx(r);
213         if (push == NULL) {
214                 talloc_free(r);
215                 return false;
216         }
217
218         /*
219          * carry over the pointer count to the reply in case we are
220          * using full pointer. See NDR specification for full pointers
221          */
222         push->ptr_count = pull->ptr_count;
223
224         ndr_err = call->ndr_push(push, NDR_OUT, r);
225         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
226                 talloc_free(r);
227                 return false;
228         }
229
230         p->out_data.rdata = ndr_push_blob(push);
231         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
232
233         talloc_free(r);
234
235         return true;
236 }
237
238 static bool api_svcctl_LockServiceDatabase(struct pipes_struct *p)
239 {
240         const struct ndr_interface_call *call;
241         struct ndr_pull *pull;
242         struct ndr_push *push;
243         enum ndr_err_code ndr_err;
244         struct svcctl_LockServiceDatabase *r;
245
246         call = &ndr_table_svcctl.calls[NDR_SVCCTL_LOCKSERVICEDATABASE];
247
248         r = talloc(talloc_tos(), struct svcctl_LockServiceDatabase);
249         if (r == NULL) {
250                 return false;
251         }
252
253         pull = ndr_pull_init_blob(&p->in_data.data, r);
254         if (pull == NULL) {
255                 talloc_free(r);
256                 return false;
257         }
258
259         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
260         if (p->endian) {
261                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
262         }
263         ndr_err = call->ndr_pull(pull, NDR_IN, r);
264         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
265                 talloc_free(r);
266                 return false;
267         }
268
269         if (DEBUGLEVEL >= 10) {
270                 NDR_PRINT_FUNCTION_DEBUG(svcctl_LockServiceDatabase, NDR_IN, r);
271         }
272
273         ZERO_STRUCT(r->out);
274         r->out.lock = talloc_zero(r, struct policy_handle);
275         if (r->out.lock == NULL) {
276                 talloc_free(r);
277                 return false;
278         }
279
280         r->out.result = _svcctl_LockServiceDatabase(p, r);
281
282         if (p->fault_state) {
283                 talloc_free(r);
284                 /* Return true here, srv_pipe_hnd.c will take care */
285                 return true;
286         }
287
288         if (DEBUGLEVEL >= 10) {
289                 NDR_PRINT_FUNCTION_DEBUG(svcctl_LockServiceDatabase, NDR_OUT | NDR_SET_VALUES, r);
290         }
291
292         push = ndr_push_init_ctx(r);
293         if (push == NULL) {
294                 talloc_free(r);
295                 return false;
296         }
297
298         /*
299          * carry over the pointer count to the reply in case we are
300          * using full pointer. See NDR specification for full pointers
301          */
302         push->ptr_count = pull->ptr_count;
303
304         ndr_err = call->ndr_push(push, NDR_OUT, r);
305         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
306                 talloc_free(r);
307                 return false;
308         }
309
310         p->out_data.rdata = ndr_push_blob(push);
311         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
312
313         talloc_free(r);
314
315         return true;
316 }
317
318 static bool api_svcctl_QueryServiceObjectSecurity(struct pipes_struct *p)
319 {
320         const struct ndr_interface_call *call;
321         struct ndr_pull *pull;
322         struct ndr_push *push;
323         enum ndr_err_code ndr_err;
324         struct svcctl_QueryServiceObjectSecurity *r;
325
326         call = &ndr_table_svcctl.calls[NDR_SVCCTL_QUERYSERVICEOBJECTSECURITY];
327
328         r = talloc(talloc_tos(), struct svcctl_QueryServiceObjectSecurity);
329         if (r == NULL) {
330                 return false;
331         }
332
333         pull = ndr_pull_init_blob(&p->in_data.data, r);
334         if (pull == NULL) {
335                 talloc_free(r);
336                 return false;
337         }
338
339         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
340         if (p->endian) {
341                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
342         }
343         ndr_err = call->ndr_pull(pull, NDR_IN, r);
344         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
345                 talloc_free(r);
346                 return false;
347         }
348
349         if (DEBUGLEVEL >= 10) {
350                 NDR_PRINT_FUNCTION_DEBUG(svcctl_QueryServiceObjectSecurity, NDR_IN, r);
351         }
352
353         ZERO_STRUCT(r->out);
354         r->out.buffer = talloc_zero_array(r, uint8_t, r->in.offered);
355         if (r->out.buffer == NULL) {
356                 talloc_free(r);
357                 return false;
358         }
359
360         r->out.needed = talloc_zero(r, uint32_t);
361         if (r->out.needed == NULL) {
362                 talloc_free(r);
363                 return false;
364         }
365
366         r->out.result = _svcctl_QueryServiceObjectSecurity(p, r);
367
368         if (p->fault_state) {
369                 talloc_free(r);
370                 /* Return true here, srv_pipe_hnd.c will take care */
371                 return true;
372         }
373
374         if (DEBUGLEVEL >= 10) {
375                 NDR_PRINT_FUNCTION_DEBUG(svcctl_QueryServiceObjectSecurity, NDR_OUT | NDR_SET_VALUES, r);
376         }
377
378         push = ndr_push_init_ctx(r);
379         if (push == NULL) {
380                 talloc_free(r);
381                 return false;
382         }
383
384         /*
385          * carry over the pointer count to the reply in case we are
386          * using full pointer. See NDR specification for full pointers
387          */
388         push->ptr_count = pull->ptr_count;
389
390         ndr_err = call->ndr_push(push, NDR_OUT, r);
391         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
392                 talloc_free(r);
393                 return false;
394         }
395
396         p->out_data.rdata = ndr_push_blob(push);
397         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
398
399         talloc_free(r);
400
401         return true;
402 }
403
404 static bool api_svcctl_SetServiceObjectSecurity(struct pipes_struct *p)
405 {
406         const struct ndr_interface_call *call;
407         struct ndr_pull *pull;
408         struct ndr_push *push;
409         enum ndr_err_code ndr_err;
410         struct svcctl_SetServiceObjectSecurity *r;
411
412         call = &ndr_table_svcctl.calls[NDR_SVCCTL_SETSERVICEOBJECTSECURITY];
413
414         r = talloc(talloc_tos(), struct svcctl_SetServiceObjectSecurity);
415         if (r == NULL) {
416                 return false;
417         }
418
419         pull = ndr_pull_init_blob(&p->in_data.data, r);
420         if (pull == NULL) {
421                 talloc_free(r);
422                 return false;
423         }
424
425         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
426         if (p->endian) {
427                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
428         }
429         ndr_err = call->ndr_pull(pull, NDR_IN, r);
430         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
431                 talloc_free(r);
432                 return false;
433         }
434
435         if (DEBUGLEVEL >= 10) {
436                 NDR_PRINT_FUNCTION_DEBUG(svcctl_SetServiceObjectSecurity, NDR_IN, r);
437         }
438
439         r->out.result = _svcctl_SetServiceObjectSecurity(p, r);
440
441         if (p->fault_state) {
442                 talloc_free(r);
443                 /* Return true here, srv_pipe_hnd.c will take care */
444                 return true;
445         }
446
447         if (DEBUGLEVEL >= 10) {
448                 NDR_PRINT_FUNCTION_DEBUG(svcctl_SetServiceObjectSecurity, NDR_OUT | NDR_SET_VALUES, r);
449         }
450
451         push = ndr_push_init_ctx(r);
452         if (push == NULL) {
453                 talloc_free(r);
454                 return false;
455         }
456
457         /*
458          * carry over the pointer count to the reply in case we are
459          * using full pointer. See NDR specification for full pointers
460          */
461         push->ptr_count = pull->ptr_count;
462
463         ndr_err = call->ndr_push(push, NDR_OUT, r);
464         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
465                 talloc_free(r);
466                 return false;
467         }
468
469         p->out_data.rdata = ndr_push_blob(push);
470         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
471
472         talloc_free(r);
473
474         return true;
475 }
476
477 static bool api_svcctl_QueryServiceStatus(struct pipes_struct *p)
478 {
479         const struct ndr_interface_call *call;
480         struct ndr_pull *pull;
481         struct ndr_push *push;
482         enum ndr_err_code ndr_err;
483         struct svcctl_QueryServiceStatus *r;
484
485         call = &ndr_table_svcctl.calls[NDR_SVCCTL_QUERYSERVICESTATUS];
486
487         r = talloc(talloc_tos(), struct svcctl_QueryServiceStatus);
488         if (r == NULL) {
489                 return false;
490         }
491
492         pull = ndr_pull_init_blob(&p->in_data.data, r);
493         if (pull == NULL) {
494                 talloc_free(r);
495                 return false;
496         }
497
498         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
499         if (p->endian) {
500                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
501         }
502         ndr_err = call->ndr_pull(pull, NDR_IN, r);
503         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
504                 talloc_free(r);
505                 return false;
506         }
507
508         if (DEBUGLEVEL >= 10) {
509                 NDR_PRINT_FUNCTION_DEBUG(svcctl_QueryServiceStatus, NDR_IN, r);
510         }
511
512         ZERO_STRUCT(r->out);
513         r->out.service_status = talloc_zero(r, struct SERVICE_STATUS);
514         if (r->out.service_status == NULL) {
515                 talloc_free(r);
516                 return false;
517         }
518
519         r->out.result = _svcctl_QueryServiceStatus(p, r);
520
521         if (p->fault_state) {
522                 talloc_free(r);
523                 /* Return true here, srv_pipe_hnd.c will take care */
524                 return true;
525         }
526
527         if (DEBUGLEVEL >= 10) {
528                 NDR_PRINT_FUNCTION_DEBUG(svcctl_QueryServiceStatus, NDR_OUT | NDR_SET_VALUES, r);
529         }
530
531         push = ndr_push_init_ctx(r);
532         if (push == NULL) {
533                 talloc_free(r);
534                 return false;
535         }
536
537         /*
538          * carry over the pointer count to the reply in case we are
539          * using full pointer. See NDR specification for full pointers
540          */
541         push->ptr_count = pull->ptr_count;
542
543         ndr_err = call->ndr_push(push, NDR_OUT, r);
544         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
545                 talloc_free(r);
546                 return false;
547         }
548
549         p->out_data.rdata = ndr_push_blob(push);
550         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
551
552         talloc_free(r);
553
554         return true;
555 }
556
557 static bool api_svcctl_SetServiceStatus(struct pipes_struct *p)
558 {
559         const struct ndr_interface_call *call;
560         struct ndr_pull *pull;
561         struct ndr_push *push;
562         enum ndr_err_code ndr_err;
563         struct svcctl_SetServiceStatus *r;
564
565         call = &ndr_table_svcctl.calls[NDR_SVCCTL_SETSERVICESTATUS];
566
567         r = talloc(talloc_tos(), struct svcctl_SetServiceStatus);
568         if (r == NULL) {
569                 return false;
570         }
571
572         pull = ndr_pull_init_blob(&p->in_data.data, r);
573         if (pull == NULL) {
574                 talloc_free(r);
575                 return false;
576         }
577
578         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
579         if (p->endian) {
580                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
581         }
582         ndr_err = call->ndr_pull(pull, NDR_IN, r);
583         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
584                 talloc_free(r);
585                 return false;
586         }
587
588         if (DEBUGLEVEL >= 10) {
589                 NDR_PRINT_FUNCTION_DEBUG(svcctl_SetServiceStatus, NDR_IN, r);
590         }
591
592         r->out.result = _svcctl_SetServiceStatus(p, r);
593
594         if (p->fault_state) {
595                 talloc_free(r);
596                 /* Return true here, srv_pipe_hnd.c will take care */
597                 return true;
598         }
599
600         if (DEBUGLEVEL >= 10) {
601                 NDR_PRINT_FUNCTION_DEBUG(svcctl_SetServiceStatus, NDR_OUT | NDR_SET_VALUES, r);
602         }
603
604         push = ndr_push_init_ctx(r);
605         if (push == NULL) {
606                 talloc_free(r);
607                 return false;
608         }
609
610         /*
611          * carry over the pointer count to the reply in case we are
612          * using full pointer. See NDR specification for full pointers
613          */
614         push->ptr_count = pull->ptr_count;
615
616         ndr_err = call->ndr_push(push, NDR_OUT, r);
617         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
618                 talloc_free(r);
619                 return false;
620         }
621
622         p->out_data.rdata = ndr_push_blob(push);
623         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
624
625         talloc_free(r);
626
627         return true;
628 }
629
630 static bool api_svcctl_UnlockServiceDatabase(struct pipes_struct *p)
631 {
632         const struct ndr_interface_call *call;
633         struct ndr_pull *pull;
634         struct ndr_push *push;
635         enum ndr_err_code ndr_err;
636         struct svcctl_UnlockServiceDatabase *r;
637
638         call = &ndr_table_svcctl.calls[NDR_SVCCTL_UNLOCKSERVICEDATABASE];
639
640         r = talloc(talloc_tos(), struct svcctl_UnlockServiceDatabase);
641         if (r == NULL) {
642                 return false;
643         }
644
645         pull = ndr_pull_init_blob(&p->in_data.data, r);
646         if (pull == NULL) {
647                 talloc_free(r);
648                 return false;
649         }
650
651         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
652         if (p->endian) {
653                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
654         }
655         ndr_err = call->ndr_pull(pull, NDR_IN, r);
656         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
657                 talloc_free(r);
658                 return false;
659         }
660
661         if (DEBUGLEVEL >= 10) {
662                 NDR_PRINT_FUNCTION_DEBUG(svcctl_UnlockServiceDatabase, NDR_IN, r);
663         }
664
665         ZERO_STRUCT(r->out);
666         r->out.lock = r->in.lock;
667         r->out.result = _svcctl_UnlockServiceDatabase(p, r);
668
669         if (p->fault_state) {
670                 talloc_free(r);
671                 /* Return true here, srv_pipe_hnd.c will take care */
672                 return true;
673         }
674
675         if (DEBUGLEVEL >= 10) {
676                 NDR_PRINT_FUNCTION_DEBUG(svcctl_UnlockServiceDatabase, NDR_OUT | NDR_SET_VALUES, r);
677         }
678
679         push = ndr_push_init_ctx(r);
680         if (push == NULL) {
681                 talloc_free(r);
682                 return false;
683         }
684
685         /*
686          * carry over the pointer count to the reply in case we are
687          * using full pointer. See NDR specification for full pointers
688          */
689         push->ptr_count = pull->ptr_count;
690
691         ndr_err = call->ndr_push(push, NDR_OUT, r);
692         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
693                 talloc_free(r);
694                 return false;
695         }
696
697         p->out_data.rdata = ndr_push_blob(push);
698         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
699
700         talloc_free(r);
701
702         return true;
703 }
704
705 static bool api_svcctl_NotifyBootConfigStatus(struct pipes_struct *p)
706 {
707         const struct ndr_interface_call *call;
708         struct ndr_pull *pull;
709         struct ndr_push *push;
710         enum ndr_err_code ndr_err;
711         struct svcctl_NotifyBootConfigStatus *r;
712
713         call = &ndr_table_svcctl.calls[NDR_SVCCTL_NOTIFYBOOTCONFIGSTATUS];
714
715         r = talloc(talloc_tos(), struct svcctl_NotifyBootConfigStatus);
716         if (r == NULL) {
717                 return false;
718         }
719
720         pull = ndr_pull_init_blob(&p->in_data.data, r);
721         if (pull == NULL) {
722                 talloc_free(r);
723                 return false;
724         }
725
726         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
727         if (p->endian) {
728                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
729         }
730         ndr_err = call->ndr_pull(pull, NDR_IN, r);
731         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
732                 talloc_free(r);
733                 return false;
734         }
735
736         if (DEBUGLEVEL >= 10) {
737                 NDR_PRINT_FUNCTION_DEBUG(svcctl_NotifyBootConfigStatus, NDR_IN, r);
738         }
739
740         r->out.result = _svcctl_NotifyBootConfigStatus(p, r);
741
742         if (p->fault_state) {
743                 talloc_free(r);
744                 /* Return true here, srv_pipe_hnd.c will take care */
745                 return true;
746         }
747
748         if (DEBUGLEVEL >= 10) {
749                 NDR_PRINT_FUNCTION_DEBUG(svcctl_NotifyBootConfigStatus, NDR_OUT | NDR_SET_VALUES, r);
750         }
751
752         push = ndr_push_init_ctx(r);
753         if (push == NULL) {
754                 talloc_free(r);
755                 return false;
756         }
757
758         /*
759          * carry over the pointer count to the reply in case we are
760          * using full pointer. See NDR specification for full pointers
761          */
762         push->ptr_count = pull->ptr_count;
763
764         ndr_err = call->ndr_push(push, NDR_OUT, r);
765         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
766                 talloc_free(r);
767                 return false;
768         }
769
770         p->out_data.rdata = ndr_push_blob(push);
771         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
772
773         talloc_free(r);
774
775         return true;
776 }
777
778 static bool api_svcctl_SCSetServiceBitsW(struct pipes_struct *p)
779 {
780         const struct ndr_interface_call *call;
781         struct ndr_pull *pull;
782         struct ndr_push *push;
783         enum ndr_err_code ndr_err;
784         struct svcctl_SCSetServiceBitsW *r;
785
786         call = &ndr_table_svcctl.calls[NDR_SVCCTL_SCSETSERVICEBITSW];
787
788         r = talloc(talloc_tos(), struct svcctl_SCSetServiceBitsW);
789         if (r == NULL) {
790                 return false;
791         }
792
793         pull = ndr_pull_init_blob(&p->in_data.data, r);
794         if (pull == NULL) {
795                 talloc_free(r);
796                 return false;
797         }
798
799         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
800         if (p->endian) {
801                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
802         }
803         ndr_err = call->ndr_pull(pull, NDR_IN, r);
804         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
805                 talloc_free(r);
806                 return false;
807         }
808
809         if (DEBUGLEVEL >= 10) {
810                 NDR_PRINT_FUNCTION_DEBUG(svcctl_SCSetServiceBitsW, NDR_IN, r);
811         }
812
813         r->out.result = _svcctl_SCSetServiceBitsW(p, r);
814
815         if (p->fault_state) {
816                 talloc_free(r);
817                 /* Return true here, srv_pipe_hnd.c will take care */
818                 return true;
819         }
820
821         if (DEBUGLEVEL >= 10) {
822                 NDR_PRINT_FUNCTION_DEBUG(svcctl_SCSetServiceBitsW, NDR_OUT | NDR_SET_VALUES, r);
823         }
824
825         push = ndr_push_init_ctx(r);
826         if (push == NULL) {
827                 talloc_free(r);
828                 return false;
829         }
830
831         /*
832          * carry over the pointer count to the reply in case we are
833          * using full pointer. See NDR specification for full pointers
834          */
835         push->ptr_count = pull->ptr_count;
836
837         ndr_err = call->ndr_push(push, NDR_OUT, r);
838         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
839                 talloc_free(r);
840                 return false;
841         }
842
843         p->out_data.rdata = ndr_push_blob(push);
844         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
845
846         talloc_free(r);
847
848         return true;
849 }
850
851 static bool api_svcctl_ChangeServiceConfigW(struct pipes_struct *p)
852 {
853         const struct ndr_interface_call *call;
854         struct ndr_pull *pull;
855         struct ndr_push *push;
856         enum ndr_err_code ndr_err;
857         struct svcctl_ChangeServiceConfigW *r;
858
859         call = &ndr_table_svcctl.calls[NDR_SVCCTL_CHANGESERVICECONFIGW];
860
861         r = talloc(talloc_tos(), struct svcctl_ChangeServiceConfigW);
862         if (r == NULL) {
863                 return false;
864         }
865
866         pull = ndr_pull_init_blob(&p->in_data.data, r);
867         if (pull == NULL) {
868                 talloc_free(r);
869                 return false;
870         }
871
872         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
873         if (p->endian) {
874                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
875         }
876         ndr_err = call->ndr_pull(pull, NDR_IN, r);
877         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
878                 talloc_free(r);
879                 return false;
880         }
881
882         if (DEBUGLEVEL >= 10) {
883                 NDR_PRINT_FUNCTION_DEBUG(svcctl_ChangeServiceConfigW, NDR_IN, r);
884         }
885
886         ZERO_STRUCT(r->out);
887         r->out.tag_id = talloc_zero(r, uint32_t);
888         if (r->out.tag_id == NULL) {
889                 talloc_free(r);
890                 return false;
891         }
892
893         r->out.result = _svcctl_ChangeServiceConfigW(p, r);
894
895         if (p->fault_state) {
896                 talloc_free(r);
897                 /* Return true here, srv_pipe_hnd.c will take care */
898                 return true;
899         }
900
901         if (DEBUGLEVEL >= 10) {
902                 NDR_PRINT_FUNCTION_DEBUG(svcctl_ChangeServiceConfigW, NDR_OUT | NDR_SET_VALUES, r);
903         }
904
905         push = ndr_push_init_ctx(r);
906         if (push == NULL) {
907                 talloc_free(r);
908                 return false;
909         }
910
911         /*
912          * carry over the pointer count to the reply in case we are
913          * using full pointer. See NDR specification for full pointers
914          */
915         push->ptr_count = pull->ptr_count;
916
917         ndr_err = call->ndr_push(push, NDR_OUT, r);
918         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
919                 talloc_free(r);
920                 return false;
921         }
922
923         p->out_data.rdata = ndr_push_blob(push);
924         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
925
926         talloc_free(r);
927
928         return true;
929 }
930
931 static bool api_svcctl_CreateServiceW(struct pipes_struct *p)
932 {
933         const struct ndr_interface_call *call;
934         struct ndr_pull *pull;
935         struct ndr_push *push;
936         enum ndr_err_code ndr_err;
937         struct svcctl_CreateServiceW *r;
938
939         call = &ndr_table_svcctl.calls[NDR_SVCCTL_CREATESERVICEW];
940
941         r = talloc(talloc_tos(), struct svcctl_CreateServiceW);
942         if (r == NULL) {
943                 return false;
944         }
945
946         pull = ndr_pull_init_blob(&p->in_data.data, r);
947         if (pull == NULL) {
948                 talloc_free(r);
949                 return false;
950         }
951
952         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
953         if (p->endian) {
954                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
955         }
956         ndr_err = call->ndr_pull(pull, NDR_IN, r);
957         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
958                 talloc_free(r);
959                 return false;
960         }
961
962         if (DEBUGLEVEL >= 10) {
963                 NDR_PRINT_FUNCTION_DEBUG(svcctl_CreateServiceW, NDR_IN, r);
964         }
965
966         ZERO_STRUCT(r->out);
967         r->out.TagId = r->in.TagId;
968         r->out.handle = talloc_zero(r, struct policy_handle);
969         if (r->out.handle == NULL) {
970                 talloc_free(r);
971                 return false;
972         }
973
974         r->out.result = _svcctl_CreateServiceW(p, r);
975
976         if (p->fault_state) {
977                 talloc_free(r);
978                 /* Return true here, srv_pipe_hnd.c will take care */
979                 return true;
980         }
981
982         if (DEBUGLEVEL >= 10) {
983                 NDR_PRINT_FUNCTION_DEBUG(svcctl_CreateServiceW, NDR_OUT | NDR_SET_VALUES, r);
984         }
985
986         push = ndr_push_init_ctx(r);
987         if (push == NULL) {
988                 talloc_free(r);
989                 return false;
990         }
991
992         /*
993          * carry over the pointer count to the reply in case we are
994          * using full pointer. See NDR specification for full pointers
995          */
996         push->ptr_count = pull->ptr_count;
997
998         ndr_err = call->ndr_push(push, NDR_OUT, r);
999         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1000                 talloc_free(r);
1001                 return false;
1002         }
1003
1004         p->out_data.rdata = ndr_push_blob(push);
1005         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
1006
1007         talloc_free(r);
1008
1009         return true;
1010 }
1011
1012 static bool api_svcctl_EnumDependentServicesW(struct pipes_struct *p)
1013 {
1014         const struct ndr_interface_call *call;
1015         struct ndr_pull *pull;
1016         struct ndr_push *push;
1017         enum ndr_err_code ndr_err;
1018         struct svcctl_EnumDependentServicesW *r;
1019
1020         call = &ndr_table_svcctl.calls[NDR_SVCCTL_ENUMDEPENDENTSERVICESW];
1021
1022         r = talloc(talloc_tos(), struct svcctl_EnumDependentServicesW);
1023         if (r == NULL) {
1024                 return false;
1025         }
1026
1027         pull = ndr_pull_init_blob(&p->in_data.data, r);
1028         if (pull == NULL) {
1029                 talloc_free(r);
1030                 return false;
1031         }
1032
1033         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1034         if (p->endian) {
1035                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
1036         }
1037         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1038         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1039                 talloc_free(r);
1040                 return false;
1041         }
1042
1043         if (DEBUGLEVEL >= 10) {
1044                 NDR_PRINT_FUNCTION_DEBUG(svcctl_EnumDependentServicesW, NDR_IN, r);
1045         }
1046
1047         ZERO_STRUCT(r->out);
1048         r->out.service_status = talloc_zero_array(r, uint8_t, r->in.offered);
1049         if (r->out.service_status == NULL) {
1050                 talloc_free(r);
1051                 return false;
1052         }
1053
1054         r->out.needed = talloc_zero(r, uint32_t);
1055         if (r->out.needed == NULL) {
1056                 talloc_free(r);
1057                 return false;
1058         }
1059
1060         r->out.services_returned = talloc_zero(r, uint32_t);
1061         if (r->out.services_returned == NULL) {
1062                 talloc_free(r);
1063                 return false;
1064         }
1065
1066         r->out.result = _svcctl_EnumDependentServicesW(p, r);
1067
1068         if (p->fault_state) {
1069                 talloc_free(r);
1070                 /* Return true here, srv_pipe_hnd.c will take care */
1071                 return true;
1072         }
1073
1074         if (DEBUGLEVEL >= 10) {
1075                 NDR_PRINT_FUNCTION_DEBUG(svcctl_EnumDependentServicesW, NDR_OUT | NDR_SET_VALUES, r);
1076         }
1077
1078         push = ndr_push_init_ctx(r);
1079         if (push == NULL) {
1080                 talloc_free(r);
1081                 return false;
1082         }
1083
1084         /*
1085          * carry over the pointer count to the reply in case we are
1086          * using full pointer. See NDR specification for full pointers
1087          */
1088         push->ptr_count = pull->ptr_count;
1089
1090         ndr_err = call->ndr_push(push, NDR_OUT, r);
1091         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1092                 talloc_free(r);
1093                 return false;
1094         }
1095
1096         p->out_data.rdata = ndr_push_blob(push);
1097         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
1098
1099         talloc_free(r);
1100
1101         return true;
1102 }
1103
1104 static bool api_svcctl_EnumServicesStatusW(struct pipes_struct *p)
1105 {
1106         const struct ndr_interface_call *call;
1107         struct ndr_pull *pull;
1108         struct ndr_push *push;
1109         enum ndr_err_code ndr_err;
1110         struct svcctl_EnumServicesStatusW *r;
1111
1112         call = &ndr_table_svcctl.calls[NDR_SVCCTL_ENUMSERVICESSTATUSW];
1113
1114         r = talloc(talloc_tos(), struct svcctl_EnumServicesStatusW);
1115         if (r == NULL) {
1116                 return false;
1117         }
1118
1119         pull = ndr_pull_init_blob(&p->in_data.data, r);
1120         if (pull == NULL) {
1121                 talloc_free(r);
1122                 return false;
1123         }
1124
1125         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1126         if (p->endian) {
1127                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
1128         }
1129         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1130         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1131                 talloc_free(r);
1132                 return false;
1133         }
1134
1135         if (DEBUGLEVEL >= 10) {
1136                 NDR_PRINT_FUNCTION_DEBUG(svcctl_EnumServicesStatusW, NDR_IN, r);
1137         }
1138
1139         ZERO_STRUCT(r->out);
1140         r->out.resume_handle = r->in.resume_handle;
1141         r->out.service = talloc_zero_array(r, uint8_t, r->in.offered);
1142         if (r->out.service == NULL) {
1143                 talloc_free(r);
1144                 return false;
1145         }
1146
1147         r->out.needed = talloc_zero(r, uint32_t);
1148         if (r->out.needed == NULL) {
1149                 talloc_free(r);
1150                 return false;
1151         }
1152
1153         r->out.services_returned = talloc_zero(r, uint32_t);
1154         if (r->out.services_returned == NULL) {
1155                 talloc_free(r);
1156                 return false;
1157         }
1158
1159         r->out.result = _svcctl_EnumServicesStatusW(p, r);
1160
1161         if (p->fault_state) {
1162                 talloc_free(r);
1163                 /* Return true here, srv_pipe_hnd.c will take care */
1164                 return true;
1165         }
1166
1167         if (DEBUGLEVEL >= 10) {
1168                 NDR_PRINT_FUNCTION_DEBUG(svcctl_EnumServicesStatusW, NDR_OUT | NDR_SET_VALUES, r);
1169         }
1170
1171         push = ndr_push_init_ctx(r);
1172         if (push == NULL) {
1173                 talloc_free(r);
1174                 return false;
1175         }
1176
1177         /*
1178          * carry over the pointer count to the reply in case we are
1179          * using full pointer. See NDR specification for full pointers
1180          */
1181         push->ptr_count = pull->ptr_count;
1182
1183         ndr_err = call->ndr_push(push, NDR_OUT, r);
1184         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1185                 talloc_free(r);
1186                 return false;
1187         }
1188
1189         p->out_data.rdata = ndr_push_blob(push);
1190         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
1191
1192         talloc_free(r);
1193
1194         return true;
1195 }
1196
1197 static bool api_svcctl_OpenSCManagerW(struct pipes_struct *p)
1198 {
1199         const struct ndr_interface_call *call;
1200         struct ndr_pull *pull;
1201         struct ndr_push *push;
1202         enum ndr_err_code ndr_err;
1203         struct svcctl_OpenSCManagerW *r;
1204
1205         call = &ndr_table_svcctl.calls[NDR_SVCCTL_OPENSCMANAGERW];
1206
1207         r = talloc(talloc_tos(), struct svcctl_OpenSCManagerW);
1208         if (r == NULL) {
1209                 return false;
1210         }
1211
1212         pull = ndr_pull_init_blob(&p->in_data.data, r);
1213         if (pull == NULL) {
1214                 talloc_free(r);
1215                 return false;
1216         }
1217
1218         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1219         if (p->endian) {
1220                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
1221         }
1222         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1223         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1224                 talloc_free(r);
1225                 return false;
1226         }
1227
1228         if (DEBUGLEVEL >= 10) {
1229                 NDR_PRINT_FUNCTION_DEBUG(svcctl_OpenSCManagerW, NDR_IN, r);
1230         }
1231
1232         ZERO_STRUCT(r->out);
1233         r->out.handle = talloc_zero(r, struct policy_handle);
1234         if (r->out.handle == NULL) {
1235                 talloc_free(r);
1236                 return false;
1237         }
1238
1239         r->out.result = _svcctl_OpenSCManagerW(p, r);
1240
1241         if (p->fault_state) {
1242                 talloc_free(r);
1243                 /* Return true here, srv_pipe_hnd.c will take care */
1244                 return true;
1245         }
1246
1247         if (DEBUGLEVEL >= 10) {
1248                 NDR_PRINT_FUNCTION_DEBUG(svcctl_OpenSCManagerW, NDR_OUT | NDR_SET_VALUES, r);
1249         }
1250
1251         push = ndr_push_init_ctx(r);
1252         if (push == NULL) {
1253                 talloc_free(r);
1254                 return false;
1255         }
1256
1257         /*
1258          * carry over the pointer count to the reply in case we are
1259          * using full pointer. See NDR specification for full pointers
1260          */
1261         push->ptr_count = pull->ptr_count;
1262
1263         ndr_err = call->ndr_push(push, NDR_OUT, r);
1264         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1265                 talloc_free(r);
1266                 return false;
1267         }
1268
1269         p->out_data.rdata = ndr_push_blob(push);
1270         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
1271
1272         talloc_free(r);
1273
1274         return true;
1275 }
1276
1277 static bool api_svcctl_OpenServiceW(struct pipes_struct *p)
1278 {
1279         const struct ndr_interface_call *call;
1280         struct ndr_pull *pull;
1281         struct ndr_push *push;
1282         enum ndr_err_code ndr_err;
1283         struct svcctl_OpenServiceW *r;
1284
1285         call = &ndr_table_svcctl.calls[NDR_SVCCTL_OPENSERVICEW];
1286
1287         r = talloc(talloc_tos(), struct svcctl_OpenServiceW);
1288         if (r == NULL) {
1289                 return false;
1290         }
1291
1292         pull = ndr_pull_init_blob(&p->in_data.data, r);
1293         if (pull == NULL) {
1294                 talloc_free(r);
1295                 return false;
1296         }
1297
1298         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1299         if (p->endian) {
1300                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
1301         }
1302         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1303         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1304                 talloc_free(r);
1305                 return false;
1306         }
1307
1308         if (DEBUGLEVEL >= 10) {
1309                 NDR_PRINT_FUNCTION_DEBUG(svcctl_OpenServiceW, NDR_IN, r);
1310         }
1311
1312         ZERO_STRUCT(r->out);
1313         r->out.handle = talloc_zero(r, struct policy_handle);
1314         if (r->out.handle == NULL) {
1315                 talloc_free(r);
1316                 return false;
1317         }
1318
1319         r->out.result = _svcctl_OpenServiceW(p, r);
1320
1321         if (p->fault_state) {
1322                 talloc_free(r);
1323                 /* Return true here, srv_pipe_hnd.c will take care */
1324                 return true;
1325         }
1326
1327         if (DEBUGLEVEL >= 10) {
1328                 NDR_PRINT_FUNCTION_DEBUG(svcctl_OpenServiceW, NDR_OUT | NDR_SET_VALUES, r);
1329         }
1330
1331         push = ndr_push_init_ctx(r);
1332         if (push == NULL) {
1333                 talloc_free(r);
1334                 return false;
1335         }
1336
1337         /*
1338          * carry over the pointer count to the reply in case we are
1339          * using full pointer. See NDR specification for full pointers
1340          */
1341         push->ptr_count = pull->ptr_count;
1342
1343         ndr_err = call->ndr_push(push, NDR_OUT, r);
1344         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1345                 talloc_free(r);
1346                 return false;
1347         }
1348
1349         p->out_data.rdata = ndr_push_blob(push);
1350         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
1351
1352         talloc_free(r);
1353
1354         return true;
1355 }
1356
1357 static bool api_svcctl_QueryServiceConfigW(struct pipes_struct *p)
1358 {
1359         const struct ndr_interface_call *call;
1360         struct ndr_pull *pull;
1361         struct ndr_push *push;
1362         enum ndr_err_code ndr_err;
1363         struct svcctl_QueryServiceConfigW *r;
1364
1365         call = &ndr_table_svcctl.calls[NDR_SVCCTL_QUERYSERVICECONFIGW];
1366
1367         r = talloc(talloc_tos(), struct svcctl_QueryServiceConfigW);
1368         if (r == NULL) {
1369                 return false;
1370         }
1371
1372         pull = ndr_pull_init_blob(&p->in_data.data, r);
1373         if (pull == NULL) {
1374                 talloc_free(r);
1375                 return false;
1376         }
1377
1378         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1379         if (p->endian) {
1380                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
1381         }
1382         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1383         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1384                 talloc_free(r);
1385                 return false;
1386         }
1387
1388         if (DEBUGLEVEL >= 10) {
1389                 NDR_PRINT_FUNCTION_DEBUG(svcctl_QueryServiceConfigW, NDR_IN, r);
1390         }
1391
1392         ZERO_STRUCT(r->out);
1393         r->out.query = talloc_zero(r, struct QUERY_SERVICE_CONFIG);
1394         if (r->out.query == NULL) {
1395                 talloc_free(r);
1396                 return false;
1397         }
1398
1399         r->out.needed = talloc_zero(r, uint32_t);
1400         if (r->out.needed == NULL) {
1401                 talloc_free(r);
1402                 return false;
1403         }
1404
1405         r->out.result = _svcctl_QueryServiceConfigW(p, r);
1406
1407         if (p->fault_state) {
1408                 talloc_free(r);
1409                 /* Return true here, srv_pipe_hnd.c will take care */
1410                 return true;
1411         }
1412
1413         if (DEBUGLEVEL >= 10) {
1414                 NDR_PRINT_FUNCTION_DEBUG(svcctl_QueryServiceConfigW, NDR_OUT | NDR_SET_VALUES, r);
1415         }
1416
1417         push = ndr_push_init_ctx(r);
1418         if (push == NULL) {
1419                 talloc_free(r);
1420                 return false;
1421         }
1422
1423         /*
1424          * carry over the pointer count to the reply in case we are
1425          * using full pointer. See NDR specification for full pointers
1426          */
1427         push->ptr_count = pull->ptr_count;
1428
1429         ndr_err = call->ndr_push(push, NDR_OUT, r);
1430         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1431                 talloc_free(r);
1432                 return false;
1433         }
1434
1435         p->out_data.rdata = ndr_push_blob(push);
1436         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
1437
1438         talloc_free(r);
1439
1440         return true;
1441 }
1442
1443 static bool api_svcctl_QueryServiceLockStatusW(struct pipes_struct *p)
1444 {
1445         const struct ndr_interface_call *call;
1446         struct ndr_pull *pull;
1447         struct ndr_push *push;
1448         enum ndr_err_code ndr_err;
1449         struct svcctl_QueryServiceLockStatusW *r;
1450
1451         call = &ndr_table_svcctl.calls[NDR_SVCCTL_QUERYSERVICELOCKSTATUSW];
1452
1453         r = talloc(talloc_tos(), struct svcctl_QueryServiceLockStatusW);
1454         if (r == NULL) {
1455                 return false;
1456         }
1457
1458         pull = ndr_pull_init_blob(&p->in_data.data, r);
1459         if (pull == NULL) {
1460                 talloc_free(r);
1461                 return false;
1462         }
1463
1464         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1465         if (p->endian) {
1466                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
1467         }
1468         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1469         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1470                 talloc_free(r);
1471                 return false;
1472         }
1473
1474         if (DEBUGLEVEL >= 10) {
1475                 NDR_PRINT_FUNCTION_DEBUG(svcctl_QueryServiceLockStatusW, NDR_IN, r);
1476         }
1477
1478         ZERO_STRUCT(r->out);
1479         r->out.lock_status = talloc_zero(r, struct SERVICE_LOCK_STATUS);
1480         if (r->out.lock_status == NULL) {
1481                 talloc_free(r);
1482                 return false;
1483         }
1484
1485         r->out.needed = talloc_zero(r, uint32_t);
1486         if (r->out.needed == NULL) {
1487                 talloc_free(r);
1488                 return false;
1489         }
1490
1491         r->out.result = _svcctl_QueryServiceLockStatusW(p, r);
1492
1493         if (p->fault_state) {
1494                 talloc_free(r);
1495                 /* Return true here, srv_pipe_hnd.c will take care */
1496                 return true;
1497         }
1498
1499         if (DEBUGLEVEL >= 10) {
1500                 NDR_PRINT_FUNCTION_DEBUG(svcctl_QueryServiceLockStatusW, NDR_OUT | NDR_SET_VALUES, r);
1501         }
1502
1503         push = ndr_push_init_ctx(r);
1504         if (push == NULL) {
1505                 talloc_free(r);
1506                 return false;
1507         }
1508
1509         /*
1510          * carry over the pointer count to the reply in case we are
1511          * using full pointer. See NDR specification for full pointers
1512          */
1513         push->ptr_count = pull->ptr_count;
1514
1515         ndr_err = call->ndr_push(push, NDR_OUT, r);
1516         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1517                 talloc_free(r);
1518                 return false;
1519         }
1520
1521         p->out_data.rdata = ndr_push_blob(push);
1522         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
1523
1524         talloc_free(r);
1525
1526         return true;
1527 }
1528
1529 static bool api_svcctl_StartServiceW(struct pipes_struct *p)
1530 {
1531         const struct ndr_interface_call *call;
1532         struct ndr_pull *pull;
1533         struct ndr_push *push;
1534         enum ndr_err_code ndr_err;
1535         struct svcctl_StartServiceW *r;
1536
1537         call = &ndr_table_svcctl.calls[NDR_SVCCTL_STARTSERVICEW];
1538
1539         r = talloc(talloc_tos(), struct svcctl_StartServiceW);
1540         if (r == NULL) {
1541                 return false;
1542         }
1543
1544         pull = ndr_pull_init_blob(&p->in_data.data, r);
1545         if (pull == NULL) {
1546                 talloc_free(r);
1547                 return false;
1548         }
1549
1550         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1551         if (p->endian) {
1552                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
1553         }
1554         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1555         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1556                 talloc_free(r);
1557                 return false;
1558         }
1559
1560         if (DEBUGLEVEL >= 10) {
1561                 NDR_PRINT_FUNCTION_DEBUG(svcctl_StartServiceW, NDR_IN, r);
1562         }
1563
1564         r->out.result = _svcctl_StartServiceW(p, r);
1565
1566         if (p->fault_state) {
1567                 talloc_free(r);
1568                 /* Return true here, srv_pipe_hnd.c will take care */
1569                 return true;
1570         }
1571
1572         if (DEBUGLEVEL >= 10) {
1573                 NDR_PRINT_FUNCTION_DEBUG(svcctl_StartServiceW, NDR_OUT | NDR_SET_VALUES, r);
1574         }
1575
1576         push = ndr_push_init_ctx(r);
1577         if (push == NULL) {
1578                 talloc_free(r);
1579                 return false;
1580         }
1581
1582         /*
1583          * carry over the pointer count to the reply in case we are
1584          * using full pointer. See NDR specification for full pointers
1585          */
1586         push->ptr_count = pull->ptr_count;
1587
1588         ndr_err = call->ndr_push(push, NDR_OUT, r);
1589         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1590                 talloc_free(r);
1591                 return false;
1592         }
1593
1594         p->out_data.rdata = ndr_push_blob(push);
1595         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
1596
1597         talloc_free(r);
1598
1599         return true;
1600 }
1601
1602 static bool api_svcctl_GetServiceDisplayNameW(struct pipes_struct *p)
1603 {
1604         const struct ndr_interface_call *call;
1605         struct ndr_pull *pull;
1606         struct ndr_push *push;
1607         enum ndr_err_code ndr_err;
1608         struct svcctl_GetServiceDisplayNameW *r;
1609
1610         call = &ndr_table_svcctl.calls[NDR_SVCCTL_GETSERVICEDISPLAYNAMEW];
1611
1612         r = talloc(talloc_tos(), struct svcctl_GetServiceDisplayNameW);
1613         if (r == NULL) {
1614                 return false;
1615         }
1616
1617         pull = ndr_pull_init_blob(&p->in_data.data, r);
1618         if (pull == NULL) {
1619                 talloc_free(r);
1620                 return false;
1621         }
1622
1623         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1624         if (p->endian) {
1625                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
1626         }
1627         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1628         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1629                 talloc_free(r);
1630                 return false;
1631         }
1632
1633         if (DEBUGLEVEL >= 10) {
1634                 NDR_PRINT_FUNCTION_DEBUG(svcctl_GetServiceDisplayNameW, NDR_IN, r);
1635         }
1636
1637         ZERO_STRUCT(r->out);
1638         r->out.display_name_length = r->in.display_name_length;
1639         r->out.display_name = talloc_zero(r, const char *);
1640         if (r->out.display_name == NULL) {
1641                 talloc_free(r);
1642                 return false;
1643         }
1644
1645         r->out.result = _svcctl_GetServiceDisplayNameW(p, r);
1646
1647         if (p->fault_state) {
1648                 talloc_free(r);
1649                 /* Return true here, srv_pipe_hnd.c will take care */
1650                 return true;
1651         }
1652
1653         if (DEBUGLEVEL >= 10) {
1654                 NDR_PRINT_FUNCTION_DEBUG(svcctl_GetServiceDisplayNameW, NDR_OUT | NDR_SET_VALUES, r);
1655         }
1656
1657         push = ndr_push_init_ctx(r);
1658         if (push == NULL) {
1659                 talloc_free(r);
1660                 return false;
1661         }
1662
1663         /*
1664          * carry over the pointer count to the reply in case we are
1665          * using full pointer. See NDR specification for full pointers
1666          */
1667         push->ptr_count = pull->ptr_count;
1668
1669         ndr_err = call->ndr_push(push, NDR_OUT, r);
1670         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1671                 talloc_free(r);
1672                 return false;
1673         }
1674
1675         p->out_data.rdata = ndr_push_blob(push);
1676         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
1677
1678         talloc_free(r);
1679
1680         return true;
1681 }
1682
1683 static bool api_svcctl_GetServiceKeyNameW(struct pipes_struct *p)
1684 {
1685         const struct ndr_interface_call *call;
1686         struct ndr_pull *pull;
1687         struct ndr_push *push;
1688         enum ndr_err_code ndr_err;
1689         struct svcctl_GetServiceKeyNameW *r;
1690
1691         call = &ndr_table_svcctl.calls[NDR_SVCCTL_GETSERVICEKEYNAMEW];
1692
1693         r = talloc(talloc_tos(), struct svcctl_GetServiceKeyNameW);
1694         if (r == NULL) {
1695                 return false;
1696         }
1697
1698         pull = ndr_pull_init_blob(&p->in_data.data, r);
1699         if (pull == NULL) {
1700                 talloc_free(r);
1701                 return false;
1702         }
1703
1704         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1705         if (p->endian) {
1706                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
1707         }
1708         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1709         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1710                 talloc_free(r);
1711                 return false;
1712         }
1713
1714         if (DEBUGLEVEL >= 10) {
1715                 NDR_PRINT_FUNCTION_DEBUG(svcctl_GetServiceKeyNameW, NDR_IN, r);
1716         }
1717
1718         ZERO_STRUCT(r->out);
1719         r->out.display_name_length = r->in.display_name_length;
1720         r->out.key_name = talloc_zero(r, const char *);
1721         if (r->out.key_name == NULL) {
1722                 talloc_free(r);
1723                 return false;
1724         }
1725
1726         r->out.result = _svcctl_GetServiceKeyNameW(p, r);
1727
1728         if (p->fault_state) {
1729                 talloc_free(r);
1730                 /* Return true here, srv_pipe_hnd.c will take care */
1731                 return true;
1732         }
1733
1734         if (DEBUGLEVEL >= 10) {
1735                 NDR_PRINT_FUNCTION_DEBUG(svcctl_GetServiceKeyNameW, NDR_OUT | NDR_SET_VALUES, r);
1736         }
1737
1738         push = ndr_push_init_ctx(r);
1739         if (push == NULL) {
1740                 talloc_free(r);
1741                 return false;
1742         }
1743
1744         /*
1745          * carry over the pointer count to the reply in case we are
1746          * using full pointer. See NDR specification for full pointers
1747          */
1748         push->ptr_count = pull->ptr_count;
1749
1750         ndr_err = call->ndr_push(push, NDR_OUT, r);
1751         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1752                 talloc_free(r);
1753                 return false;
1754         }
1755
1756         p->out_data.rdata = ndr_push_blob(push);
1757         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
1758
1759         talloc_free(r);
1760
1761         return true;
1762 }
1763
1764 static bool api_svcctl_SCSetServiceBitsA(struct pipes_struct *p)
1765 {
1766         const struct ndr_interface_call *call;
1767         struct ndr_pull *pull;
1768         struct ndr_push *push;
1769         enum ndr_err_code ndr_err;
1770         struct svcctl_SCSetServiceBitsA *r;
1771
1772         call = &ndr_table_svcctl.calls[NDR_SVCCTL_SCSETSERVICEBITSA];
1773
1774         r = talloc(talloc_tos(), struct svcctl_SCSetServiceBitsA);
1775         if (r == NULL) {
1776                 return false;
1777         }
1778
1779         pull = ndr_pull_init_blob(&p->in_data.data, r);
1780         if (pull == NULL) {
1781                 talloc_free(r);
1782                 return false;
1783         }
1784
1785         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1786         if (p->endian) {
1787                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
1788         }
1789         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1790         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1791                 talloc_free(r);
1792                 return false;
1793         }
1794
1795         if (DEBUGLEVEL >= 10) {
1796                 NDR_PRINT_FUNCTION_DEBUG(svcctl_SCSetServiceBitsA, NDR_IN, r);
1797         }
1798
1799         r->out.result = _svcctl_SCSetServiceBitsA(p, r);
1800
1801         if (p->fault_state) {
1802                 talloc_free(r);
1803                 /* Return true here, srv_pipe_hnd.c will take care */
1804                 return true;
1805         }
1806
1807         if (DEBUGLEVEL >= 10) {
1808                 NDR_PRINT_FUNCTION_DEBUG(svcctl_SCSetServiceBitsA, NDR_OUT | NDR_SET_VALUES, r);
1809         }
1810
1811         push = ndr_push_init_ctx(r);
1812         if (push == NULL) {
1813                 talloc_free(r);
1814                 return false;
1815         }
1816
1817         /*
1818          * carry over the pointer count to the reply in case we are
1819          * using full pointer. See NDR specification for full pointers
1820          */
1821         push->ptr_count = pull->ptr_count;
1822
1823         ndr_err = call->ndr_push(push, NDR_OUT, r);
1824         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1825                 talloc_free(r);
1826                 return false;
1827         }
1828
1829         p->out_data.rdata = ndr_push_blob(push);
1830         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
1831
1832         talloc_free(r);
1833
1834         return true;
1835 }
1836
1837 static bool api_svcctl_ChangeServiceConfigA(struct pipes_struct *p)
1838 {
1839         const struct ndr_interface_call *call;
1840         struct ndr_pull *pull;
1841         struct ndr_push *push;
1842         enum ndr_err_code ndr_err;
1843         struct svcctl_ChangeServiceConfigA *r;
1844
1845         call = &ndr_table_svcctl.calls[NDR_SVCCTL_CHANGESERVICECONFIGA];
1846
1847         r = talloc(talloc_tos(), struct svcctl_ChangeServiceConfigA);
1848         if (r == NULL) {
1849                 return false;
1850         }
1851
1852         pull = ndr_pull_init_blob(&p->in_data.data, r);
1853         if (pull == NULL) {
1854                 talloc_free(r);
1855                 return false;
1856         }
1857
1858         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1859         if (p->endian) {
1860                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
1861         }
1862         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1863         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1864                 talloc_free(r);
1865                 return false;
1866         }
1867
1868         if (DEBUGLEVEL >= 10) {
1869                 NDR_PRINT_FUNCTION_DEBUG(svcctl_ChangeServiceConfigA, NDR_IN, r);
1870         }
1871
1872         ZERO_STRUCT(r->out);
1873         r->out.tag_id = talloc_zero(r, uint32_t);
1874         if (r->out.tag_id == NULL) {
1875                 talloc_free(r);
1876                 return false;
1877         }
1878
1879         r->out.result = _svcctl_ChangeServiceConfigA(p, r);
1880
1881         if (p->fault_state) {
1882                 talloc_free(r);
1883                 /* Return true here, srv_pipe_hnd.c will take care */
1884                 return true;
1885         }
1886
1887         if (DEBUGLEVEL >= 10) {
1888                 NDR_PRINT_FUNCTION_DEBUG(svcctl_ChangeServiceConfigA, NDR_OUT | NDR_SET_VALUES, r);
1889         }
1890
1891         push = ndr_push_init_ctx(r);
1892         if (push == NULL) {
1893                 talloc_free(r);
1894                 return false;
1895         }
1896
1897         /*
1898          * carry over the pointer count to the reply in case we are
1899          * using full pointer. See NDR specification for full pointers
1900          */
1901         push->ptr_count = pull->ptr_count;
1902
1903         ndr_err = call->ndr_push(push, NDR_OUT, r);
1904         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1905                 talloc_free(r);
1906                 return false;
1907         }
1908
1909         p->out_data.rdata = ndr_push_blob(push);
1910         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
1911
1912         talloc_free(r);
1913
1914         return true;
1915 }
1916
1917 static bool api_svcctl_CreateServiceA(struct pipes_struct *p)
1918 {
1919         const struct ndr_interface_call *call;
1920         struct ndr_pull *pull;
1921         struct ndr_push *push;
1922         enum ndr_err_code ndr_err;
1923         struct svcctl_CreateServiceA *r;
1924
1925         call = &ndr_table_svcctl.calls[NDR_SVCCTL_CREATESERVICEA];
1926
1927         r = talloc(talloc_tos(), struct svcctl_CreateServiceA);
1928         if (r == NULL) {
1929                 return false;
1930         }
1931
1932         pull = ndr_pull_init_blob(&p->in_data.data, r);
1933         if (pull == NULL) {
1934                 talloc_free(r);
1935                 return false;
1936         }
1937
1938         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1939         if (p->endian) {
1940                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
1941         }
1942         ndr_err = call->ndr_pull(pull, NDR_IN, r);
1943         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1944                 talloc_free(r);
1945                 return false;
1946         }
1947
1948         if (DEBUGLEVEL >= 10) {
1949                 NDR_PRINT_FUNCTION_DEBUG(svcctl_CreateServiceA, NDR_IN, r);
1950         }
1951
1952         ZERO_STRUCT(r->out);
1953         r->out.TagId = talloc_zero(r, uint32_t);
1954         if (r->out.TagId == NULL) {
1955                 talloc_free(r);
1956                 return false;
1957         }
1958
1959         r->out.result = _svcctl_CreateServiceA(p, r);
1960
1961         if (p->fault_state) {
1962                 talloc_free(r);
1963                 /* Return true here, srv_pipe_hnd.c will take care */
1964                 return true;
1965         }
1966
1967         if (DEBUGLEVEL >= 10) {
1968                 NDR_PRINT_FUNCTION_DEBUG(svcctl_CreateServiceA, NDR_OUT | NDR_SET_VALUES, r);
1969         }
1970
1971         push = ndr_push_init_ctx(r);
1972         if (push == NULL) {
1973                 talloc_free(r);
1974                 return false;
1975         }
1976
1977         /*
1978          * carry over the pointer count to the reply in case we are
1979          * using full pointer. See NDR specification for full pointers
1980          */
1981         push->ptr_count = pull->ptr_count;
1982
1983         ndr_err = call->ndr_push(push, NDR_OUT, r);
1984         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1985                 talloc_free(r);
1986                 return false;
1987         }
1988
1989         p->out_data.rdata = ndr_push_blob(push);
1990         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
1991
1992         talloc_free(r);
1993
1994         return true;
1995 }
1996
1997 static bool api_svcctl_EnumDependentServicesA(struct pipes_struct *p)
1998 {
1999         const struct ndr_interface_call *call;
2000         struct ndr_pull *pull;
2001         struct ndr_push *push;
2002         enum ndr_err_code ndr_err;
2003         struct svcctl_EnumDependentServicesA *r;
2004
2005         call = &ndr_table_svcctl.calls[NDR_SVCCTL_ENUMDEPENDENTSERVICESA];
2006
2007         r = talloc(talloc_tos(), struct svcctl_EnumDependentServicesA);
2008         if (r == NULL) {
2009                 return false;
2010         }
2011
2012         pull = ndr_pull_init_blob(&p->in_data.data, r);
2013         if (pull == NULL) {
2014                 talloc_free(r);
2015                 return false;
2016         }
2017
2018         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2019         if (p->endian) {
2020                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
2021         }
2022         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2023         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2024                 talloc_free(r);
2025                 return false;
2026         }
2027
2028         if (DEBUGLEVEL >= 10) {
2029                 NDR_PRINT_FUNCTION_DEBUG(svcctl_EnumDependentServicesA, NDR_IN, r);
2030         }
2031
2032         ZERO_STRUCT(r->out);
2033         r->out.service_status = talloc_zero(r, struct ENUM_SERVICE_STATUSA);
2034         if (r->out.service_status == NULL) {
2035                 talloc_free(r);
2036                 return false;
2037         }
2038
2039         r->out.needed = talloc_zero(r, uint32_t);
2040         if (r->out.needed == NULL) {
2041                 talloc_free(r);
2042                 return false;
2043         }
2044
2045         r->out.services_returned = talloc_zero(r, uint32_t);
2046         if (r->out.services_returned == NULL) {
2047                 talloc_free(r);
2048                 return false;
2049         }
2050
2051         r->out.result = _svcctl_EnumDependentServicesA(p, r);
2052
2053         if (p->fault_state) {
2054                 talloc_free(r);
2055                 /* Return true here, srv_pipe_hnd.c will take care */
2056                 return true;
2057         }
2058
2059         if (DEBUGLEVEL >= 10) {
2060                 NDR_PRINT_FUNCTION_DEBUG(svcctl_EnumDependentServicesA, NDR_OUT | NDR_SET_VALUES, r);
2061         }
2062
2063         push = ndr_push_init_ctx(r);
2064         if (push == NULL) {
2065                 talloc_free(r);
2066                 return false;
2067         }
2068
2069         /*
2070          * carry over the pointer count to the reply in case we are
2071          * using full pointer. See NDR specification for full pointers
2072          */
2073         push->ptr_count = pull->ptr_count;
2074
2075         ndr_err = call->ndr_push(push, NDR_OUT, r);
2076         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2077                 talloc_free(r);
2078                 return false;
2079         }
2080
2081         p->out_data.rdata = ndr_push_blob(push);
2082         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
2083
2084         talloc_free(r);
2085
2086         return true;
2087 }
2088
2089 static bool api_svcctl_EnumServicesStatusA(struct pipes_struct *p)
2090 {
2091         const struct ndr_interface_call *call;
2092         struct ndr_pull *pull;
2093         struct ndr_push *push;
2094         enum ndr_err_code ndr_err;
2095         struct svcctl_EnumServicesStatusA *r;
2096
2097         call = &ndr_table_svcctl.calls[NDR_SVCCTL_ENUMSERVICESSTATUSA];
2098
2099         r = talloc(talloc_tos(), struct svcctl_EnumServicesStatusA);
2100         if (r == NULL) {
2101                 return false;
2102         }
2103
2104         pull = ndr_pull_init_blob(&p->in_data.data, r);
2105         if (pull == NULL) {
2106                 talloc_free(r);
2107                 return false;
2108         }
2109
2110         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2111         if (p->endian) {
2112                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
2113         }
2114         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2115         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2116                 talloc_free(r);
2117                 return false;
2118         }
2119
2120         if (DEBUGLEVEL >= 10) {
2121                 NDR_PRINT_FUNCTION_DEBUG(svcctl_EnumServicesStatusA, NDR_IN, r);
2122         }
2123
2124         ZERO_STRUCT(r->out);
2125         r->out.resume_handle = r->in.resume_handle;
2126         r->out.service = talloc_zero_array(r, uint8_t, r->in.offered);
2127         if (r->out.service == NULL) {
2128                 talloc_free(r);
2129                 return false;
2130         }
2131
2132         r->out.needed = talloc_zero(r, uint32_t);
2133         if (r->out.needed == NULL) {
2134                 talloc_free(r);
2135                 return false;
2136         }
2137
2138         r->out.services_returned = talloc_zero(r, uint32_t);
2139         if (r->out.services_returned == NULL) {
2140                 talloc_free(r);
2141                 return false;
2142         }
2143
2144         r->out.result = _svcctl_EnumServicesStatusA(p, r);
2145
2146         if (p->fault_state) {
2147                 talloc_free(r);
2148                 /* Return true here, srv_pipe_hnd.c will take care */
2149                 return true;
2150         }
2151
2152         if (DEBUGLEVEL >= 10) {
2153                 NDR_PRINT_FUNCTION_DEBUG(svcctl_EnumServicesStatusA, NDR_OUT | NDR_SET_VALUES, r);
2154         }
2155
2156         push = ndr_push_init_ctx(r);
2157         if (push == NULL) {
2158                 talloc_free(r);
2159                 return false;
2160         }
2161
2162         /*
2163          * carry over the pointer count to the reply in case we are
2164          * using full pointer. See NDR specification for full pointers
2165          */
2166         push->ptr_count = pull->ptr_count;
2167
2168         ndr_err = call->ndr_push(push, NDR_OUT, r);
2169         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2170                 talloc_free(r);
2171                 return false;
2172         }
2173
2174         p->out_data.rdata = ndr_push_blob(push);
2175         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
2176
2177         talloc_free(r);
2178
2179         return true;
2180 }
2181
2182 static bool api_svcctl_OpenSCManagerA(struct pipes_struct *p)
2183 {
2184         const struct ndr_interface_call *call;
2185         struct ndr_pull *pull;
2186         struct ndr_push *push;
2187         enum ndr_err_code ndr_err;
2188         struct svcctl_OpenSCManagerA *r;
2189
2190         call = &ndr_table_svcctl.calls[NDR_SVCCTL_OPENSCMANAGERA];
2191
2192         r = talloc(talloc_tos(), struct svcctl_OpenSCManagerA);
2193         if (r == NULL) {
2194                 return false;
2195         }
2196
2197         pull = ndr_pull_init_blob(&p->in_data.data, r);
2198         if (pull == NULL) {
2199                 talloc_free(r);
2200                 return false;
2201         }
2202
2203         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2204         if (p->endian) {
2205                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
2206         }
2207         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2208         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2209                 talloc_free(r);
2210                 return false;
2211         }
2212
2213         if (DEBUGLEVEL >= 10) {
2214                 NDR_PRINT_FUNCTION_DEBUG(svcctl_OpenSCManagerA, NDR_IN, r);
2215         }
2216
2217         ZERO_STRUCT(r->out);
2218         r->out.handle = talloc_zero(r, struct policy_handle);
2219         if (r->out.handle == NULL) {
2220                 talloc_free(r);
2221                 return false;
2222         }
2223
2224         r->out.result = _svcctl_OpenSCManagerA(p, r);
2225
2226         if (p->fault_state) {
2227                 talloc_free(r);
2228                 /* Return true here, srv_pipe_hnd.c will take care */
2229                 return true;
2230         }
2231
2232         if (DEBUGLEVEL >= 10) {
2233                 NDR_PRINT_FUNCTION_DEBUG(svcctl_OpenSCManagerA, NDR_OUT | NDR_SET_VALUES, r);
2234         }
2235
2236         push = ndr_push_init_ctx(r);
2237         if (push == NULL) {
2238                 talloc_free(r);
2239                 return false;
2240         }
2241
2242         /*
2243          * carry over the pointer count to the reply in case we are
2244          * using full pointer. See NDR specification for full pointers
2245          */
2246         push->ptr_count = pull->ptr_count;
2247
2248         ndr_err = call->ndr_push(push, NDR_OUT, r);
2249         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2250                 talloc_free(r);
2251                 return false;
2252         }
2253
2254         p->out_data.rdata = ndr_push_blob(push);
2255         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
2256
2257         talloc_free(r);
2258
2259         return true;
2260 }
2261
2262 static bool api_svcctl_OpenServiceA(struct pipes_struct *p)
2263 {
2264         const struct ndr_interface_call *call;
2265         struct ndr_pull *pull;
2266         struct ndr_push *push;
2267         enum ndr_err_code ndr_err;
2268         struct svcctl_OpenServiceA *r;
2269
2270         call = &ndr_table_svcctl.calls[NDR_SVCCTL_OPENSERVICEA];
2271
2272         r = talloc(talloc_tos(), struct svcctl_OpenServiceA);
2273         if (r == NULL) {
2274                 return false;
2275         }
2276
2277         pull = ndr_pull_init_blob(&p->in_data.data, r);
2278         if (pull == NULL) {
2279                 talloc_free(r);
2280                 return false;
2281         }
2282
2283         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2284         if (p->endian) {
2285                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
2286         }
2287         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2288         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2289                 talloc_free(r);
2290                 return false;
2291         }
2292
2293         if (DEBUGLEVEL >= 10) {
2294                 NDR_PRINT_FUNCTION_DEBUG(svcctl_OpenServiceA, NDR_IN, r);
2295         }
2296
2297         r->out.result = _svcctl_OpenServiceA(p, r);
2298
2299         if (p->fault_state) {
2300                 talloc_free(r);
2301                 /* Return true here, srv_pipe_hnd.c will take care */
2302                 return true;
2303         }
2304
2305         if (DEBUGLEVEL >= 10) {
2306                 NDR_PRINT_FUNCTION_DEBUG(svcctl_OpenServiceA, NDR_OUT | NDR_SET_VALUES, r);
2307         }
2308
2309         push = ndr_push_init_ctx(r);
2310         if (push == NULL) {
2311                 talloc_free(r);
2312                 return false;
2313         }
2314
2315         /*
2316          * carry over the pointer count to the reply in case we are
2317          * using full pointer. See NDR specification for full pointers
2318          */
2319         push->ptr_count = pull->ptr_count;
2320
2321         ndr_err = call->ndr_push(push, NDR_OUT, r);
2322         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2323                 talloc_free(r);
2324                 return false;
2325         }
2326
2327         p->out_data.rdata = ndr_push_blob(push);
2328         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
2329
2330         talloc_free(r);
2331
2332         return true;
2333 }
2334
2335 static bool api_svcctl_QueryServiceConfigA(struct pipes_struct *p)
2336 {
2337         const struct ndr_interface_call *call;
2338         struct ndr_pull *pull;
2339         struct ndr_push *push;
2340         enum ndr_err_code ndr_err;
2341         struct svcctl_QueryServiceConfigA *r;
2342
2343         call = &ndr_table_svcctl.calls[NDR_SVCCTL_QUERYSERVICECONFIGA];
2344
2345         r = talloc(talloc_tos(), struct svcctl_QueryServiceConfigA);
2346         if (r == NULL) {
2347                 return false;
2348         }
2349
2350         pull = ndr_pull_init_blob(&p->in_data.data, r);
2351         if (pull == NULL) {
2352                 talloc_free(r);
2353                 return false;
2354         }
2355
2356         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2357         if (p->endian) {
2358                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
2359         }
2360         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2361         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2362                 talloc_free(r);
2363                 return false;
2364         }
2365
2366         if (DEBUGLEVEL >= 10) {
2367                 NDR_PRINT_FUNCTION_DEBUG(svcctl_QueryServiceConfigA, NDR_IN, r);
2368         }
2369
2370         ZERO_STRUCT(r->out);
2371         r->out.query = talloc_zero_array(r, uint8_t, r->in.offered);
2372         if (r->out.query == NULL) {
2373                 talloc_free(r);
2374                 return false;
2375         }
2376
2377         r->out.needed = talloc_zero(r, uint32_t);
2378         if (r->out.needed == NULL) {
2379                 talloc_free(r);
2380                 return false;
2381         }
2382
2383         r->out.result = _svcctl_QueryServiceConfigA(p, r);
2384
2385         if (p->fault_state) {
2386                 talloc_free(r);
2387                 /* Return true here, srv_pipe_hnd.c will take care */
2388                 return true;
2389         }
2390
2391         if (DEBUGLEVEL >= 10) {
2392                 NDR_PRINT_FUNCTION_DEBUG(svcctl_QueryServiceConfigA, NDR_OUT | NDR_SET_VALUES, r);
2393         }
2394
2395         push = ndr_push_init_ctx(r);
2396         if (push == NULL) {
2397                 talloc_free(r);
2398                 return false;
2399         }
2400
2401         /*
2402          * carry over the pointer count to the reply in case we are
2403          * using full pointer. See NDR specification for full pointers
2404          */
2405         push->ptr_count = pull->ptr_count;
2406
2407         ndr_err = call->ndr_push(push, NDR_OUT, r);
2408         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2409                 talloc_free(r);
2410                 return false;
2411         }
2412
2413         p->out_data.rdata = ndr_push_blob(push);
2414         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
2415
2416         talloc_free(r);
2417
2418         return true;
2419 }
2420
2421 static bool api_svcctl_QueryServiceLockStatusA(struct pipes_struct *p)
2422 {
2423         const struct ndr_interface_call *call;
2424         struct ndr_pull *pull;
2425         struct ndr_push *push;
2426         enum ndr_err_code ndr_err;
2427         struct svcctl_QueryServiceLockStatusA *r;
2428
2429         call = &ndr_table_svcctl.calls[NDR_SVCCTL_QUERYSERVICELOCKSTATUSA];
2430
2431         r = talloc(talloc_tos(), struct svcctl_QueryServiceLockStatusA);
2432         if (r == NULL) {
2433                 return false;
2434         }
2435
2436         pull = ndr_pull_init_blob(&p->in_data.data, r);
2437         if (pull == NULL) {
2438                 talloc_free(r);
2439                 return false;
2440         }
2441
2442         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2443         if (p->endian) {
2444                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
2445         }
2446         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2447         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2448                 talloc_free(r);
2449                 return false;
2450         }
2451
2452         if (DEBUGLEVEL >= 10) {
2453                 NDR_PRINT_FUNCTION_DEBUG(svcctl_QueryServiceLockStatusA, NDR_IN, r);
2454         }
2455
2456         ZERO_STRUCT(r->out);
2457         r->out.lock_status = talloc_zero(r, struct SERVICE_LOCK_STATUS);
2458         if (r->out.lock_status == NULL) {
2459                 talloc_free(r);
2460                 return false;
2461         }
2462
2463         r->out.needed = talloc_zero(r, uint32_t);
2464         if (r->out.needed == NULL) {
2465                 talloc_free(r);
2466                 return false;
2467         }
2468
2469         r->out.result = _svcctl_QueryServiceLockStatusA(p, r);
2470
2471         if (p->fault_state) {
2472                 talloc_free(r);
2473                 /* Return true here, srv_pipe_hnd.c will take care */
2474                 return true;
2475         }
2476
2477         if (DEBUGLEVEL >= 10) {
2478                 NDR_PRINT_FUNCTION_DEBUG(svcctl_QueryServiceLockStatusA, NDR_OUT | NDR_SET_VALUES, r);
2479         }
2480
2481         push = ndr_push_init_ctx(r);
2482         if (push == NULL) {
2483                 talloc_free(r);
2484                 return false;
2485         }
2486
2487         /*
2488          * carry over the pointer count to the reply in case we are
2489          * using full pointer. See NDR specification for full pointers
2490          */
2491         push->ptr_count = pull->ptr_count;
2492
2493         ndr_err = call->ndr_push(push, NDR_OUT, r);
2494         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2495                 talloc_free(r);
2496                 return false;
2497         }
2498
2499         p->out_data.rdata = ndr_push_blob(push);
2500         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
2501
2502         talloc_free(r);
2503
2504         return true;
2505 }
2506
2507 static bool api_svcctl_StartServiceA(struct pipes_struct *p)
2508 {
2509         const struct ndr_interface_call *call;
2510         struct ndr_pull *pull;
2511         struct ndr_push *push;
2512         enum ndr_err_code ndr_err;
2513         struct svcctl_StartServiceA *r;
2514
2515         call = &ndr_table_svcctl.calls[NDR_SVCCTL_STARTSERVICEA];
2516
2517         r = talloc(talloc_tos(), struct svcctl_StartServiceA);
2518         if (r == NULL) {
2519                 return false;
2520         }
2521
2522         pull = ndr_pull_init_blob(&p->in_data.data, r);
2523         if (pull == NULL) {
2524                 talloc_free(r);
2525                 return false;
2526         }
2527
2528         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2529         if (p->endian) {
2530                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
2531         }
2532         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2533         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2534                 talloc_free(r);
2535                 return false;
2536         }
2537
2538         if (DEBUGLEVEL >= 10) {
2539                 NDR_PRINT_FUNCTION_DEBUG(svcctl_StartServiceA, NDR_IN, r);
2540         }
2541
2542         r->out.result = _svcctl_StartServiceA(p, r);
2543
2544         if (p->fault_state) {
2545                 talloc_free(r);
2546                 /* Return true here, srv_pipe_hnd.c will take care */
2547                 return true;
2548         }
2549
2550         if (DEBUGLEVEL >= 10) {
2551                 NDR_PRINT_FUNCTION_DEBUG(svcctl_StartServiceA, NDR_OUT | NDR_SET_VALUES, r);
2552         }
2553
2554         push = ndr_push_init_ctx(r);
2555         if (push == NULL) {
2556                 talloc_free(r);
2557                 return false;
2558         }
2559
2560         /*
2561          * carry over the pointer count to the reply in case we are
2562          * using full pointer. See NDR specification for full pointers
2563          */
2564         push->ptr_count = pull->ptr_count;
2565
2566         ndr_err = call->ndr_push(push, NDR_OUT, r);
2567         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2568                 talloc_free(r);
2569                 return false;
2570         }
2571
2572         p->out_data.rdata = ndr_push_blob(push);
2573         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
2574
2575         talloc_free(r);
2576
2577         return true;
2578 }
2579
2580 static bool api_svcctl_GetServiceDisplayNameA(struct pipes_struct *p)
2581 {
2582         const struct ndr_interface_call *call;
2583         struct ndr_pull *pull;
2584         struct ndr_push *push;
2585         enum ndr_err_code ndr_err;
2586         struct svcctl_GetServiceDisplayNameA *r;
2587
2588         call = &ndr_table_svcctl.calls[NDR_SVCCTL_GETSERVICEDISPLAYNAMEA];
2589
2590         r = talloc(talloc_tos(), struct svcctl_GetServiceDisplayNameA);
2591         if (r == NULL) {
2592                 return false;
2593         }
2594
2595         pull = ndr_pull_init_blob(&p->in_data.data, r);
2596         if (pull == NULL) {
2597                 talloc_free(r);
2598                 return false;
2599         }
2600
2601         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2602         if (p->endian) {
2603                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
2604         }
2605         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2606         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2607                 talloc_free(r);
2608                 return false;
2609         }
2610
2611         if (DEBUGLEVEL >= 10) {
2612                 NDR_PRINT_FUNCTION_DEBUG(svcctl_GetServiceDisplayNameA, NDR_IN, r);
2613         }
2614
2615         ZERO_STRUCT(r->out);
2616         r->out.display_name_length = r->in.display_name_length;
2617         r->out.display_name = talloc_zero(r, const char *);
2618         if (r->out.display_name == NULL) {
2619                 talloc_free(r);
2620                 return false;
2621         }
2622
2623         r->out.result = _svcctl_GetServiceDisplayNameA(p, r);
2624
2625         if (p->fault_state) {
2626                 talloc_free(r);
2627                 /* Return true here, srv_pipe_hnd.c will take care */
2628                 return true;
2629         }
2630
2631         if (DEBUGLEVEL >= 10) {
2632                 NDR_PRINT_FUNCTION_DEBUG(svcctl_GetServiceDisplayNameA, NDR_OUT | NDR_SET_VALUES, r);
2633         }
2634
2635         push = ndr_push_init_ctx(r);
2636         if (push == NULL) {
2637                 talloc_free(r);
2638                 return false;
2639         }
2640
2641         /*
2642          * carry over the pointer count to the reply in case we are
2643          * using full pointer. See NDR specification for full pointers
2644          */
2645         push->ptr_count = pull->ptr_count;
2646
2647         ndr_err = call->ndr_push(push, NDR_OUT, r);
2648         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2649                 talloc_free(r);
2650                 return false;
2651         }
2652
2653         p->out_data.rdata = ndr_push_blob(push);
2654         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
2655
2656         talloc_free(r);
2657
2658         return true;
2659 }
2660
2661 static bool api_svcctl_GetServiceKeyNameA(struct pipes_struct *p)
2662 {
2663         const struct ndr_interface_call *call;
2664         struct ndr_pull *pull;
2665         struct ndr_push *push;
2666         enum ndr_err_code ndr_err;
2667         struct svcctl_GetServiceKeyNameA *r;
2668
2669         call = &ndr_table_svcctl.calls[NDR_SVCCTL_GETSERVICEKEYNAMEA];
2670
2671         r = talloc(talloc_tos(), struct svcctl_GetServiceKeyNameA);
2672         if (r == NULL) {
2673                 return false;
2674         }
2675
2676         pull = ndr_pull_init_blob(&p->in_data.data, r);
2677         if (pull == NULL) {
2678                 talloc_free(r);
2679                 return false;
2680         }
2681
2682         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2683         if (p->endian) {
2684                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
2685         }
2686         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2687         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2688                 talloc_free(r);
2689                 return false;
2690         }
2691
2692         if (DEBUGLEVEL >= 10) {
2693                 NDR_PRINT_FUNCTION_DEBUG(svcctl_GetServiceKeyNameA, NDR_IN, r);
2694         }
2695
2696         ZERO_STRUCT(r->out);
2697         r->out.display_name_length = r->in.display_name_length;
2698         r->out.key_name = talloc_zero(r, const char *);
2699         if (r->out.key_name == NULL) {
2700                 talloc_free(r);
2701                 return false;
2702         }
2703
2704         r->out.result = _svcctl_GetServiceKeyNameA(p, r);
2705
2706         if (p->fault_state) {
2707                 talloc_free(r);
2708                 /* Return true here, srv_pipe_hnd.c will take care */
2709                 return true;
2710         }
2711
2712         if (DEBUGLEVEL >= 10) {
2713                 NDR_PRINT_FUNCTION_DEBUG(svcctl_GetServiceKeyNameA, NDR_OUT | NDR_SET_VALUES, r);
2714         }
2715
2716         push = ndr_push_init_ctx(r);
2717         if (push == NULL) {
2718                 talloc_free(r);
2719                 return false;
2720         }
2721
2722         /*
2723          * carry over the pointer count to the reply in case we are
2724          * using full pointer. See NDR specification for full pointers
2725          */
2726         push->ptr_count = pull->ptr_count;
2727
2728         ndr_err = call->ndr_push(push, NDR_OUT, r);
2729         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2730                 talloc_free(r);
2731                 return false;
2732         }
2733
2734         p->out_data.rdata = ndr_push_blob(push);
2735         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
2736
2737         talloc_free(r);
2738
2739         return true;
2740 }
2741
2742 static bool api_svcctl_GetCurrentGroupeStateW(struct pipes_struct *p)
2743 {
2744         const struct ndr_interface_call *call;
2745         struct ndr_pull *pull;
2746         struct ndr_push *push;
2747         enum ndr_err_code ndr_err;
2748         struct svcctl_GetCurrentGroupeStateW *r;
2749
2750         call = &ndr_table_svcctl.calls[NDR_SVCCTL_GETCURRENTGROUPESTATEW];
2751
2752         r = talloc(talloc_tos(), struct svcctl_GetCurrentGroupeStateW);
2753         if (r == NULL) {
2754                 return false;
2755         }
2756
2757         pull = ndr_pull_init_blob(&p->in_data.data, r);
2758         if (pull == NULL) {
2759                 talloc_free(r);
2760                 return false;
2761         }
2762
2763         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2764         if (p->endian) {
2765                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
2766         }
2767         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2768         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2769                 talloc_free(r);
2770                 return false;
2771         }
2772
2773         if (DEBUGLEVEL >= 10) {
2774                 NDR_PRINT_FUNCTION_DEBUG(svcctl_GetCurrentGroupeStateW, NDR_IN, r);
2775         }
2776
2777         r->out.result = _svcctl_GetCurrentGroupeStateW(p, r);
2778
2779         if (p->fault_state) {
2780                 talloc_free(r);
2781                 /* Return true here, srv_pipe_hnd.c will take care */
2782                 return true;
2783         }
2784
2785         if (DEBUGLEVEL >= 10) {
2786                 NDR_PRINT_FUNCTION_DEBUG(svcctl_GetCurrentGroupeStateW, NDR_OUT | NDR_SET_VALUES, r);
2787         }
2788
2789         push = ndr_push_init_ctx(r);
2790         if (push == NULL) {
2791                 talloc_free(r);
2792                 return false;
2793         }
2794
2795         /*
2796          * carry over the pointer count to the reply in case we are
2797          * using full pointer. See NDR specification for full pointers
2798          */
2799         push->ptr_count = pull->ptr_count;
2800
2801         ndr_err = call->ndr_push(push, NDR_OUT, r);
2802         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2803                 talloc_free(r);
2804                 return false;
2805         }
2806
2807         p->out_data.rdata = ndr_push_blob(push);
2808         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
2809
2810         talloc_free(r);
2811
2812         return true;
2813 }
2814
2815 static bool api_svcctl_EnumServiceGroupW(struct pipes_struct *p)
2816 {
2817         const struct ndr_interface_call *call;
2818         struct ndr_pull *pull;
2819         struct ndr_push *push;
2820         enum ndr_err_code ndr_err;
2821         struct svcctl_EnumServiceGroupW *r;
2822
2823         call = &ndr_table_svcctl.calls[NDR_SVCCTL_ENUMSERVICEGROUPW];
2824
2825         r = talloc(talloc_tos(), struct svcctl_EnumServiceGroupW);
2826         if (r == NULL) {
2827                 return false;
2828         }
2829
2830         pull = ndr_pull_init_blob(&p->in_data.data, r);
2831         if (pull == NULL) {
2832                 talloc_free(r);
2833                 return false;
2834         }
2835
2836         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2837         if (p->endian) {
2838                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
2839         }
2840         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2841         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2842                 talloc_free(r);
2843                 return false;
2844         }
2845
2846         if (DEBUGLEVEL >= 10) {
2847                 NDR_PRINT_FUNCTION_DEBUG(svcctl_EnumServiceGroupW, NDR_IN, r);
2848         }
2849
2850         r->out.result = _svcctl_EnumServiceGroupW(p, r);
2851
2852         if (p->fault_state) {
2853                 talloc_free(r);
2854                 /* Return true here, srv_pipe_hnd.c will take care */
2855                 return true;
2856         }
2857
2858         if (DEBUGLEVEL >= 10) {
2859                 NDR_PRINT_FUNCTION_DEBUG(svcctl_EnumServiceGroupW, NDR_OUT | NDR_SET_VALUES, r);
2860         }
2861
2862         push = ndr_push_init_ctx(r);
2863         if (push == NULL) {
2864                 talloc_free(r);
2865                 return false;
2866         }
2867
2868         /*
2869          * carry over the pointer count to the reply in case we are
2870          * using full pointer. See NDR specification for full pointers
2871          */
2872         push->ptr_count = pull->ptr_count;
2873
2874         ndr_err = call->ndr_push(push, NDR_OUT, r);
2875         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2876                 talloc_free(r);
2877                 return false;
2878         }
2879
2880         p->out_data.rdata = ndr_push_blob(push);
2881         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
2882
2883         talloc_free(r);
2884
2885         return true;
2886 }
2887
2888 static bool api_svcctl_ChangeServiceConfig2A(struct pipes_struct *p)
2889 {
2890         const struct ndr_interface_call *call;
2891         struct ndr_pull *pull;
2892         struct ndr_push *push;
2893         enum ndr_err_code ndr_err;
2894         struct svcctl_ChangeServiceConfig2A *r;
2895
2896         call = &ndr_table_svcctl.calls[NDR_SVCCTL_CHANGESERVICECONFIG2A];
2897
2898         r = talloc(talloc_tos(), struct svcctl_ChangeServiceConfig2A);
2899         if (r == NULL) {
2900                 return false;
2901         }
2902
2903         pull = ndr_pull_init_blob(&p->in_data.data, r);
2904         if (pull == NULL) {
2905                 talloc_free(r);
2906                 return false;
2907         }
2908
2909         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2910         if (p->endian) {
2911                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
2912         }
2913         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2914         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2915                 talloc_free(r);
2916                 return false;
2917         }
2918
2919         if (DEBUGLEVEL >= 10) {
2920                 NDR_PRINT_FUNCTION_DEBUG(svcctl_ChangeServiceConfig2A, NDR_IN, r);
2921         }
2922
2923         r->out.result = _svcctl_ChangeServiceConfig2A(p, r);
2924
2925         if (p->fault_state) {
2926                 talloc_free(r);
2927                 /* Return true here, srv_pipe_hnd.c will take care */
2928                 return true;
2929         }
2930
2931         if (DEBUGLEVEL >= 10) {
2932                 NDR_PRINT_FUNCTION_DEBUG(svcctl_ChangeServiceConfig2A, NDR_OUT | NDR_SET_VALUES, r);
2933         }
2934
2935         push = ndr_push_init_ctx(r);
2936         if (push == NULL) {
2937                 talloc_free(r);
2938                 return false;
2939         }
2940
2941         /*
2942          * carry over the pointer count to the reply in case we are
2943          * using full pointer. See NDR specification for full pointers
2944          */
2945         push->ptr_count = pull->ptr_count;
2946
2947         ndr_err = call->ndr_push(push, NDR_OUT, r);
2948         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2949                 talloc_free(r);
2950                 return false;
2951         }
2952
2953         p->out_data.rdata = ndr_push_blob(push);
2954         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
2955
2956         talloc_free(r);
2957
2958         return true;
2959 }
2960
2961 static bool api_svcctl_ChangeServiceConfig2W(struct pipes_struct *p)
2962 {
2963         const struct ndr_interface_call *call;
2964         struct ndr_pull *pull;
2965         struct ndr_push *push;
2966         enum ndr_err_code ndr_err;
2967         struct svcctl_ChangeServiceConfig2W *r;
2968
2969         call = &ndr_table_svcctl.calls[NDR_SVCCTL_CHANGESERVICECONFIG2W];
2970
2971         r = talloc(talloc_tos(), struct svcctl_ChangeServiceConfig2W);
2972         if (r == NULL) {
2973                 return false;
2974         }
2975
2976         pull = ndr_pull_init_blob(&p->in_data.data, r);
2977         if (pull == NULL) {
2978                 talloc_free(r);
2979                 return false;
2980         }
2981
2982         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2983         if (p->endian) {
2984                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
2985         }
2986         ndr_err = call->ndr_pull(pull, NDR_IN, r);
2987         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2988                 talloc_free(r);
2989                 return false;
2990         }
2991
2992         if (DEBUGLEVEL >= 10) {
2993                 NDR_PRINT_FUNCTION_DEBUG(svcctl_ChangeServiceConfig2W, NDR_IN, r);
2994         }
2995
2996         r->out.result = _svcctl_ChangeServiceConfig2W(p, r);
2997
2998         if (p->fault_state) {
2999                 talloc_free(r);
3000                 /* Return true here, srv_pipe_hnd.c will take care */
3001                 return true;
3002         }
3003
3004         if (DEBUGLEVEL >= 10) {
3005                 NDR_PRINT_FUNCTION_DEBUG(svcctl_ChangeServiceConfig2W, NDR_OUT | NDR_SET_VALUES, r);
3006         }
3007
3008         push = ndr_push_init_ctx(r);
3009         if (push == NULL) {
3010                 talloc_free(r);
3011                 return false;
3012         }
3013
3014         /*
3015          * carry over the pointer count to the reply in case we are
3016          * using full pointer. See NDR specification for full pointers
3017          */
3018         push->ptr_count = pull->ptr_count;
3019
3020         ndr_err = call->ndr_push(push, NDR_OUT, r);
3021         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3022                 talloc_free(r);
3023                 return false;
3024         }
3025
3026         p->out_data.rdata = ndr_push_blob(push);
3027         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
3028
3029         talloc_free(r);
3030
3031         return true;
3032 }
3033
3034 static bool api_svcctl_QueryServiceConfig2A(struct pipes_struct *p)
3035 {
3036         const struct ndr_interface_call *call;
3037         struct ndr_pull *pull;
3038         struct ndr_push *push;
3039         enum ndr_err_code ndr_err;
3040         struct svcctl_QueryServiceConfig2A *r;
3041
3042         call = &ndr_table_svcctl.calls[NDR_SVCCTL_QUERYSERVICECONFIG2A];
3043
3044         r = talloc(talloc_tos(), struct svcctl_QueryServiceConfig2A);
3045         if (r == NULL) {
3046                 return false;
3047         }
3048
3049         pull = ndr_pull_init_blob(&p->in_data.data, r);
3050         if (pull == NULL) {
3051                 talloc_free(r);
3052                 return false;
3053         }
3054
3055         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3056         if (p->endian) {
3057                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
3058         }
3059         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3060         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3061                 talloc_free(r);
3062                 return false;
3063         }
3064
3065         if (DEBUGLEVEL >= 10) {
3066                 NDR_PRINT_FUNCTION_DEBUG(svcctl_QueryServiceConfig2A, NDR_IN, r);
3067         }
3068
3069         ZERO_STRUCT(r->out);
3070         r->out.buffer = talloc_zero_array(r, uint8_t, r->in.offered);
3071         if (r->out.buffer == NULL) {
3072                 talloc_free(r);
3073                 return false;
3074         }
3075
3076         r->out.needed = talloc_zero(r, uint32_t);
3077         if (r->out.needed == NULL) {
3078                 talloc_free(r);
3079                 return false;
3080         }
3081
3082         r->out.result = _svcctl_QueryServiceConfig2A(p, r);
3083
3084         if (p->fault_state) {
3085                 talloc_free(r);
3086                 /* Return true here, srv_pipe_hnd.c will take care */
3087                 return true;
3088         }
3089
3090         if (DEBUGLEVEL >= 10) {
3091                 NDR_PRINT_FUNCTION_DEBUG(svcctl_QueryServiceConfig2A, NDR_OUT | NDR_SET_VALUES, r);
3092         }
3093
3094         push = ndr_push_init_ctx(r);
3095         if (push == NULL) {
3096                 talloc_free(r);
3097                 return false;
3098         }
3099
3100         /*
3101          * carry over the pointer count to the reply in case we are
3102          * using full pointer. See NDR specification for full pointers
3103          */
3104         push->ptr_count = pull->ptr_count;
3105
3106         ndr_err = call->ndr_push(push, NDR_OUT, r);
3107         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3108                 talloc_free(r);
3109                 return false;
3110         }
3111
3112         p->out_data.rdata = ndr_push_blob(push);
3113         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
3114
3115         talloc_free(r);
3116
3117         return true;
3118 }
3119
3120 static bool api_svcctl_QueryServiceConfig2W(struct pipes_struct *p)
3121 {
3122         const struct ndr_interface_call *call;
3123         struct ndr_pull *pull;
3124         struct ndr_push *push;
3125         enum ndr_err_code ndr_err;
3126         struct svcctl_QueryServiceConfig2W *r;
3127
3128         call = &ndr_table_svcctl.calls[NDR_SVCCTL_QUERYSERVICECONFIG2W];
3129
3130         r = talloc(talloc_tos(), struct svcctl_QueryServiceConfig2W);
3131         if (r == NULL) {
3132                 return false;
3133         }
3134
3135         pull = ndr_pull_init_blob(&p->in_data.data, r);
3136         if (pull == NULL) {
3137                 talloc_free(r);
3138                 return false;
3139         }
3140
3141         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3142         if (p->endian) {
3143                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
3144         }
3145         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3146         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3147                 talloc_free(r);
3148                 return false;
3149         }
3150
3151         if (DEBUGLEVEL >= 10) {
3152                 NDR_PRINT_FUNCTION_DEBUG(svcctl_QueryServiceConfig2W, NDR_IN, r);
3153         }
3154
3155         ZERO_STRUCT(r->out);
3156         r->out.buffer = talloc_zero_array(r, uint8_t, r->in.offered);
3157         if (r->out.buffer == NULL) {
3158                 talloc_free(r);
3159                 return false;
3160         }
3161
3162         r->out.needed = talloc_zero(r, uint32_t);
3163         if (r->out.needed == NULL) {
3164                 talloc_free(r);
3165                 return false;
3166         }
3167
3168         r->out.result = _svcctl_QueryServiceConfig2W(p, r);
3169
3170         if (p->fault_state) {
3171                 talloc_free(r);
3172                 /* Return true here, srv_pipe_hnd.c will take care */
3173                 return true;
3174         }
3175
3176         if (DEBUGLEVEL >= 10) {
3177                 NDR_PRINT_FUNCTION_DEBUG(svcctl_QueryServiceConfig2W, NDR_OUT | NDR_SET_VALUES, r);
3178         }
3179
3180         push = ndr_push_init_ctx(r);
3181         if (push == NULL) {
3182                 talloc_free(r);
3183                 return false;
3184         }
3185
3186         /*
3187          * carry over the pointer count to the reply in case we are
3188          * using full pointer. See NDR specification for full pointers
3189          */
3190         push->ptr_count = pull->ptr_count;
3191
3192         ndr_err = call->ndr_push(push, NDR_OUT, r);
3193         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3194                 talloc_free(r);
3195                 return false;
3196         }
3197
3198         p->out_data.rdata = ndr_push_blob(push);
3199         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
3200
3201         talloc_free(r);
3202
3203         return true;
3204 }
3205
3206 static bool api_svcctl_QueryServiceStatusEx(struct pipes_struct *p)
3207 {
3208         const struct ndr_interface_call *call;
3209         struct ndr_pull *pull;
3210         struct ndr_push *push;
3211         enum ndr_err_code ndr_err;
3212         struct svcctl_QueryServiceStatusEx *r;
3213
3214         call = &ndr_table_svcctl.calls[NDR_SVCCTL_QUERYSERVICESTATUSEX];
3215
3216         r = talloc(talloc_tos(), struct svcctl_QueryServiceStatusEx);
3217         if (r == NULL) {
3218                 return false;
3219         }
3220
3221         pull = ndr_pull_init_blob(&p->in_data.data, r);
3222         if (pull == NULL) {
3223                 talloc_free(r);
3224                 return false;
3225         }
3226
3227         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3228         if (p->endian) {
3229                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
3230         }
3231         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3232         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3233                 talloc_free(r);
3234                 return false;
3235         }
3236
3237         if (DEBUGLEVEL >= 10) {
3238                 NDR_PRINT_FUNCTION_DEBUG(svcctl_QueryServiceStatusEx, NDR_IN, r);
3239         }
3240
3241         ZERO_STRUCT(r->out);
3242         r->out.buffer = talloc_zero_array(r, uint8_t, r->in.offered);
3243         if (r->out.buffer == NULL) {
3244                 talloc_free(r);
3245                 return false;
3246         }
3247
3248         r->out.needed = talloc_zero(r, uint32_t);
3249         if (r->out.needed == NULL) {
3250                 talloc_free(r);
3251                 return false;
3252         }
3253
3254         r->out.result = _svcctl_QueryServiceStatusEx(p, r);
3255
3256         if (p->fault_state) {
3257                 talloc_free(r);
3258                 /* Return true here, srv_pipe_hnd.c will take care */
3259                 return true;
3260         }
3261
3262         if (DEBUGLEVEL >= 10) {
3263                 NDR_PRINT_FUNCTION_DEBUG(svcctl_QueryServiceStatusEx, NDR_OUT | NDR_SET_VALUES, r);
3264         }
3265
3266         push = ndr_push_init_ctx(r);
3267         if (push == NULL) {
3268                 talloc_free(r);
3269                 return false;
3270         }
3271
3272         /*
3273          * carry over the pointer count to the reply in case we are
3274          * using full pointer. See NDR specification for full pointers
3275          */
3276         push->ptr_count = pull->ptr_count;
3277
3278         ndr_err = call->ndr_push(push, NDR_OUT, r);
3279         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3280                 talloc_free(r);
3281                 return false;
3282         }
3283
3284         p->out_data.rdata = ndr_push_blob(push);
3285         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
3286
3287         talloc_free(r);
3288
3289         return true;
3290 }
3291
3292 static bool api_EnumServicesStatusExA(struct pipes_struct *p)
3293 {
3294         const struct ndr_interface_call *call;
3295         struct ndr_pull *pull;
3296         struct ndr_push *push;
3297         enum ndr_err_code ndr_err;
3298         struct EnumServicesStatusExA *r;
3299
3300         call = &ndr_table_svcctl.calls[NDR_ENUMSERVICESSTATUSEXA];
3301
3302         r = talloc(talloc_tos(), struct EnumServicesStatusExA);
3303         if (r == NULL) {
3304                 return false;
3305         }
3306
3307         pull = ndr_pull_init_blob(&p->in_data.data, r);
3308         if (pull == NULL) {
3309                 talloc_free(r);
3310                 return false;
3311         }
3312
3313         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3314         if (p->endian) {
3315                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
3316         }
3317         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3318         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3319                 talloc_free(r);
3320                 return false;
3321         }
3322
3323         if (DEBUGLEVEL >= 10) {
3324                 NDR_PRINT_FUNCTION_DEBUG(EnumServicesStatusExA, NDR_IN, r);
3325         }
3326
3327         ZERO_STRUCT(r->out);
3328         r->out.resume_handle = r->in.resume_handle;
3329         r->out.services = talloc_zero_array(r, uint8_t, r->in.offered);
3330         if (r->out.services == NULL) {
3331                 talloc_free(r);
3332                 return false;
3333         }
3334
3335         r->out.needed = talloc_zero(r, uint32_t);
3336         if (r->out.needed == NULL) {
3337                 talloc_free(r);
3338                 return false;
3339         }
3340
3341         r->out.service_returned = talloc_zero(r, uint32_t);
3342         if (r->out.service_returned == NULL) {
3343                 talloc_free(r);
3344                 return false;
3345         }
3346
3347         r->out.group_name = talloc_zero(r, const char *);
3348         if (r->out.group_name == NULL) {
3349                 talloc_free(r);
3350                 return false;
3351         }
3352
3353         r->out.result = _EnumServicesStatusExA(p, r);
3354
3355         if (p->fault_state) {
3356                 talloc_free(r);
3357                 /* Return true here, srv_pipe_hnd.c will take care */
3358                 return true;
3359         }
3360
3361         if (DEBUGLEVEL >= 10) {
3362                 NDR_PRINT_FUNCTION_DEBUG(EnumServicesStatusExA, NDR_OUT | NDR_SET_VALUES, r);
3363         }
3364
3365         push = ndr_push_init_ctx(r);
3366         if (push == NULL) {
3367                 talloc_free(r);
3368                 return false;
3369         }
3370
3371         /*
3372          * carry over the pointer count to the reply in case we are
3373          * using full pointer. See NDR specification for full pointers
3374          */
3375         push->ptr_count = pull->ptr_count;
3376
3377         ndr_err = call->ndr_push(push, NDR_OUT, r);
3378         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3379                 talloc_free(r);
3380                 return false;
3381         }
3382
3383         p->out_data.rdata = ndr_push_blob(push);
3384         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
3385
3386         talloc_free(r);
3387
3388         return true;
3389 }
3390
3391 static bool api_EnumServicesStatusExW(struct pipes_struct *p)
3392 {
3393         const struct ndr_interface_call *call;
3394         struct ndr_pull *pull;
3395         struct ndr_push *push;
3396         enum ndr_err_code ndr_err;
3397         struct EnumServicesStatusExW *r;
3398
3399         call = &ndr_table_svcctl.calls[NDR_ENUMSERVICESSTATUSEXW];
3400
3401         r = talloc(talloc_tos(), struct EnumServicesStatusExW);
3402         if (r == NULL) {
3403                 return false;
3404         }
3405
3406         pull = ndr_pull_init_blob(&p->in_data.data, r);
3407         if (pull == NULL) {
3408                 talloc_free(r);
3409                 return false;
3410         }
3411
3412         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3413         if (p->endian) {
3414                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
3415         }
3416         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3417         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3418                 talloc_free(r);
3419                 return false;
3420         }
3421
3422         if (DEBUGLEVEL >= 10) {
3423                 NDR_PRINT_FUNCTION_DEBUG(EnumServicesStatusExW, NDR_IN, r);
3424         }
3425
3426         ZERO_STRUCT(r->out);
3427         r->out.resume_handle = r->in.resume_handle;
3428         r->out.services = talloc_zero_array(r, uint8_t, r->in.offered);
3429         if (r->out.services == NULL) {
3430                 talloc_free(r);
3431                 return false;
3432         }
3433
3434         r->out.needed = talloc_zero(r, uint32_t);
3435         if (r->out.needed == NULL) {
3436                 talloc_free(r);
3437                 return false;
3438         }
3439
3440         r->out.service_returned = talloc_zero(r, uint32_t);
3441         if (r->out.service_returned == NULL) {
3442                 talloc_free(r);
3443                 return false;
3444         }
3445
3446         r->out.result = _EnumServicesStatusExW(p, r);
3447
3448         if (p->fault_state) {
3449                 talloc_free(r);
3450                 /* Return true here, srv_pipe_hnd.c will take care */
3451                 return true;
3452         }
3453
3454         if (DEBUGLEVEL >= 10) {
3455                 NDR_PRINT_FUNCTION_DEBUG(EnumServicesStatusExW, NDR_OUT | NDR_SET_VALUES, r);
3456         }
3457
3458         push = ndr_push_init_ctx(r);
3459         if (push == NULL) {
3460                 talloc_free(r);
3461                 return false;
3462         }
3463
3464         /*
3465          * carry over the pointer count to the reply in case we are
3466          * using full pointer. See NDR specification for full pointers
3467          */
3468         push->ptr_count = pull->ptr_count;
3469
3470         ndr_err = call->ndr_push(push, NDR_OUT, r);
3471         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3472                 talloc_free(r);
3473                 return false;
3474         }
3475
3476         p->out_data.rdata = ndr_push_blob(push);
3477         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
3478
3479         talloc_free(r);
3480
3481         return true;
3482 }
3483
3484 static bool api_svcctl_SCSendTSMessage(struct pipes_struct *p)
3485 {
3486         const struct ndr_interface_call *call;
3487         struct ndr_pull *pull;
3488         struct ndr_push *push;
3489         enum ndr_err_code ndr_err;
3490         struct svcctl_SCSendTSMessage *r;
3491
3492         call = &ndr_table_svcctl.calls[NDR_SVCCTL_SCSENDTSMESSAGE];
3493
3494         r = talloc(talloc_tos(), struct svcctl_SCSendTSMessage);
3495         if (r == NULL) {
3496                 return false;
3497         }
3498
3499         pull = ndr_pull_init_blob(&p->in_data.data, r);
3500         if (pull == NULL) {
3501                 talloc_free(r);
3502                 return false;
3503         }
3504
3505         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3506         if (p->endian) {
3507                 pull->flags |= LIBNDR_FLAG_BIGENDIAN;
3508         }
3509         ndr_err = call->ndr_pull(pull, NDR_IN, r);
3510         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3511                 talloc_free(r);
3512                 return false;
3513         }
3514
3515         if (DEBUGLEVEL >= 10) {
3516                 NDR_PRINT_FUNCTION_DEBUG(svcctl_SCSendTSMessage, NDR_IN, r);
3517         }
3518
3519         r->out.result = _svcctl_SCSendTSMessage(p, r);
3520
3521         if (p->fault_state) {
3522                 talloc_free(r);
3523                 /* Return true here, srv_pipe_hnd.c will take care */
3524                 return true;
3525         }
3526
3527         if (DEBUGLEVEL >= 10) {
3528                 NDR_PRINT_FUNCTION_DEBUG(svcctl_SCSendTSMessage, NDR_OUT | NDR_SET_VALUES, r);
3529         }
3530
3531         push = ndr_push_init_ctx(r);
3532         if (push == NULL) {
3533                 talloc_free(r);
3534                 return false;
3535         }
3536
3537         /*
3538          * carry over the pointer count to the reply in case we are
3539          * using full pointer. See NDR specification for full pointers
3540          */
3541         push->ptr_count = pull->ptr_count;
3542
3543         ndr_err = call->ndr_push(push, NDR_OUT, r);
3544         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3545                 talloc_free(r);
3546                 return false;
3547         }
3548
3549         p->out_data.rdata = ndr_push_blob(push);
3550         talloc_steal(p->mem_ctx, p->out_data.rdata.data);
3551
3552         talloc_free(r);
3553
3554         return true;
3555 }
3556
3557
3558 /* Tables */
3559 static struct api_struct api_svcctl_cmds[] = 
3560 {
3561         {"SVCCTL_CLOSESERVICEHANDLE", NDR_SVCCTL_CLOSESERVICEHANDLE, api_svcctl_CloseServiceHandle},
3562         {"SVCCTL_CONTROLSERVICE", NDR_SVCCTL_CONTROLSERVICE, api_svcctl_ControlService},
3563         {"SVCCTL_DELETESERVICE", NDR_SVCCTL_DELETESERVICE, api_svcctl_DeleteService},
3564         {"SVCCTL_LOCKSERVICEDATABASE", NDR_SVCCTL_LOCKSERVICEDATABASE, api_svcctl_LockServiceDatabase},
3565         {"SVCCTL_QUERYSERVICEOBJECTSECURITY", NDR_SVCCTL_QUERYSERVICEOBJECTSECURITY, api_svcctl_QueryServiceObjectSecurity},
3566         {"SVCCTL_SETSERVICEOBJECTSECURITY", NDR_SVCCTL_SETSERVICEOBJECTSECURITY, api_svcctl_SetServiceObjectSecurity},
3567         {"SVCCTL_QUERYSERVICESTATUS", NDR_SVCCTL_QUERYSERVICESTATUS, api_svcctl_QueryServiceStatus},
3568         {"SVCCTL_SETSERVICESTATUS", NDR_SVCCTL_SETSERVICESTATUS, api_svcctl_SetServiceStatus},
3569         {"SVCCTL_UNLOCKSERVICEDATABASE", NDR_SVCCTL_UNLOCKSERVICEDATABASE, api_svcctl_UnlockServiceDatabase},
3570         {"SVCCTL_NOTIFYBOOTCONFIGSTATUS", NDR_SVCCTL_NOTIFYBOOTCONFIGSTATUS, api_svcctl_NotifyBootConfigStatus},
3571         {"SVCCTL_SCSETSERVICEBITSW", NDR_SVCCTL_SCSETSERVICEBITSW, api_svcctl_SCSetServiceBitsW},
3572         {"SVCCTL_CHANGESERVICECONFIGW", NDR_SVCCTL_CHANGESERVICECONFIGW, api_svcctl_ChangeServiceConfigW},
3573         {"SVCCTL_CREATESERVICEW", NDR_SVCCTL_CREATESERVICEW, api_svcctl_CreateServiceW},
3574         {"SVCCTL_ENUMDEPENDENTSERVICESW", NDR_SVCCTL_ENUMDEPENDENTSERVICESW, api_svcctl_EnumDependentServicesW},
3575         {"SVCCTL_ENUMSERVICESSTATUSW", NDR_SVCCTL_ENUMSERVICESSTATUSW, api_svcctl_EnumServicesStatusW},
3576         {"SVCCTL_OPENSCMANAGERW", NDR_SVCCTL_OPENSCMANAGERW, api_svcctl_OpenSCManagerW},
3577         {"SVCCTL_OPENSERVICEW", NDR_SVCCTL_OPENSERVICEW, api_svcctl_OpenServiceW},
3578         {"SVCCTL_QUERYSERVICECONFIGW", NDR_SVCCTL_QUERYSERVICECONFIGW, api_svcctl_QueryServiceConfigW},
3579         {"SVCCTL_QUERYSERVICELOCKSTATUSW", NDR_SVCCTL_QUERYSERVICELOCKSTATUSW, api_svcctl_QueryServiceLockStatusW},
3580         {"SVCCTL_STARTSERVICEW", NDR_SVCCTL_STARTSERVICEW, api_svcctl_StartServiceW},
3581         {"SVCCTL_GETSERVICEDISPLAYNAMEW", NDR_SVCCTL_GETSERVICEDISPLAYNAMEW, api_svcctl_GetServiceDisplayNameW},
3582         {"SVCCTL_GETSERVICEKEYNAMEW", NDR_SVCCTL_GETSERVICEKEYNAMEW, api_svcctl_GetServiceKeyNameW},
3583         {"SVCCTL_SCSETSERVICEBITSA", NDR_SVCCTL_SCSETSERVICEBITSA, api_svcctl_SCSetServiceBitsA},
3584         {"SVCCTL_CHANGESERVICECONFIGA", NDR_SVCCTL_CHANGESERVICECONFIGA, api_svcctl_ChangeServiceConfigA},
3585         {"SVCCTL_CREATESERVICEA", NDR_SVCCTL_CREATESERVICEA, api_svcctl_CreateServiceA},
3586         {"SVCCTL_ENUMDEPENDENTSERVICESA", NDR_SVCCTL_ENUMDEPENDENTSERVICESA, api_svcctl_EnumDependentServicesA},
3587         {"SVCCTL_ENUMSERVICESSTATUSA", NDR_SVCCTL_ENUMSERVICESSTATUSA, api_svcctl_EnumServicesStatusA},
3588         {"SVCCTL_OPENSCMANAGERA", NDR_SVCCTL_OPENSCMANAGERA, api_svcctl_OpenSCManagerA},
3589         {"SVCCTL_OPENSERVICEA", NDR_SVCCTL_OPENSERVICEA, api_svcctl_OpenServiceA},
3590         {"SVCCTL_QUERYSERVICECONFIGA", NDR_SVCCTL_QUERYSERVICECONFIGA, api_svcctl_QueryServiceConfigA},
3591         {"SVCCTL_QUERYSERVICELOCKSTATUSA", NDR_SVCCTL_QUERYSERVICELOCKSTATUSA, api_svcctl_QueryServiceLockStatusA},
3592         {"SVCCTL_STARTSERVICEA", NDR_SVCCTL_STARTSERVICEA, api_svcctl_StartServiceA},
3593         {"SVCCTL_GETSERVICEDISPLAYNAMEA", NDR_SVCCTL_GETSERVICEDISPLAYNAMEA, api_svcctl_GetServiceDisplayNameA},
3594         {"SVCCTL_GETSERVICEKEYNAMEA", NDR_SVCCTL_GETSERVICEKEYNAMEA, api_svcctl_GetServiceKeyNameA},
3595         {"SVCCTL_GETCURRENTGROUPESTATEW", NDR_SVCCTL_GETCURRENTGROUPESTATEW, api_svcctl_GetCurrentGroupeStateW},
3596         {"SVCCTL_ENUMSERVICEGROUPW", NDR_SVCCTL_ENUMSERVICEGROUPW, api_svcctl_EnumServiceGroupW},
3597         {"SVCCTL_CHANGESERVICECONFIG2A", NDR_SVCCTL_CHANGESERVICECONFIG2A, api_svcctl_ChangeServiceConfig2A},
3598         {"SVCCTL_CHANGESERVICECONFIG2W", NDR_SVCCTL_CHANGESERVICECONFIG2W, api_svcctl_ChangeServiceConfig2W},
3599         {"SVCCTL_QUERYSERVICECONFIG2A", NDR_SVCCTL_QUERYSERVICECONFIG2A, api_svcctl_QueryServiceConfig2A},
3600         {"SVCCTL_QUERYSERVICECONFIG2W", NDR_SVCCTL_QUERYSERVICECONFIG2W, api_svcctl_QueryServiceConfig2W},
3601         {"SVCCTL_QUERYSERVICESTATUSEX", NDR_SVCCTL_QUERYSERVICESTATUSEX, api_svcctl_QueryServiceStatusEx},
3602         {"ENUMSERVICESSTATUSEXA", NDR_ENUMSERVICESSTATUSEXA, api_EnumServicesStatusExA},
3603         {"ENUMSERVICESSTATUSEXW", NDR_ENUMSERVICESSTATUSEXW, api_EnumServicesStatusExW},
3604         {"SVCCTL_SCSENDTSMESSAGE", NDR_SVCCTL_SCSENDTSMESSAGE, api_svcctl_SCSendTSMessage},
3605 };
3606
3607 void svcctl_get_pipe_fns(struct api_struct **fns, int *n_fns)
3608 {
3609         *fns = api_svcctl_cmds;
3610         *n_fns = sizeof(api_svcctl_cmds) / sizeof(struct api_struct);
3611 }
3612
3613 NTSTATUS rpc_svcctl_init(const struct rpc_srv_callbacks *rpc_srv_cb)
3614 {
3615         return rpc_srv_register(SMB_RPC_INTERFACE_VERSION, "svcctl", "svcctl", &ndr_table_svcctl, api_svcctl_cmds, sizeof(api_svcctl_cmds) / sizeof(struct api_struct), rpc_srv_cb);
3616 }
3617
3618 NTSTATUS rpc_svcctl_shutdown(void)
3619 {
3620         return rpc_srv_unregister(&ndr_table_svcctl);
3621 }