• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/router/samba-3.5.8/librpc/gen_ndr/
1/*
2 * Unix SMB/CIFS implementation.
3 * server auto-generated by pidl. DO NOT MODIFY!
4 */
5
6#include "includes.h"
7#include "../librpc/gen_ndr/srv_svcctl.h"
8
9static bool api_svcctl_CloseServiceHandle(pipes_struct *p)
10{
11	const struct ndr_interface_call *call;
12	struct ndr_pull *pull;
13	struct ndr_push *push;
14	enum ndr_err_code ndr_err;
15	DATA_BLOB blob;
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	if (!prs_data_blob(&p->in_data.data, &blob, r)) {
26		talloc_free(r);
27		return false;
28	}
29
30	pull = ndr_pull_init_blob(&blob, r, NULL);
31	if (pull == NULL) {
32		talloc_free(r);
33		return false;
34	}
35
36	pull->flags |= LIBNDR_FLAG_REF_ALLOC;
37	ndr_err = call->ndr_pull(pull, NDR_IN, r);
38	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
39		talloc_free(r);
40		return false;
41	}
42
43	if (DEBUGLEVEL >= 10) {
44		NDR_PRINT_IN_DEBUG(svcctl_CloseServiceHandle, r);
45	}
46
47	ZERO_STRUCT(r->out);
48	r->out.handle = r->in.handle;
49	r->out.result = _svcctl_CloseServiceHandle(p, r);
50
51	if (p->rng_fault_state) {
52		talloc_free(r);
53		/* Return true here, srv_pipe_hnd.c will take care */
54		return true;
55	}
56
57	if (DEBUGLEVEL >= 10) {
58		NDR_PRINT_OUT_DEBUG(svcctl_CloseServiceHandle, r);
59	}
60
61	push = ndr_push_init_ctx(r, NULL);
62	if (push == NULL) {
63		talloc_free(r);
64		return false;
65	}
66
67	ndr_err = call->ndr_push(push, NDR_OUT, r);
68	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
69		talloc_free(r);
70		return false;
71	}
72
73	blob = ndr_push_blob(push);
74	if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
75		talloc_free(r);
76		return false;
77	}
78
79	talloc_free(r);
80
81	return true;
82}
83
84static bool api_svcctl_ControlService(pipes_struct *p)
85{
86	const struct ndr_interface_call *call;
87	struct ndr_pull *pull;
88	struct ndr_push *push;
89	enum ndr_err_code ndr_err;
90	DATA_BLOB blob;
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	if (!prs_data_blob(&p->in_data.data, &blob, r)) {
101		talloc_free(r);
102		return false;
103	}
104
105	pull = ndr_pull_init_blob(&blob, r, NULL);
106	if (pull == NULL) {
107		talloc_free(r);
108		return false;
109	}
110
111	pull->flags |= LIBNDR_FLAG_REF_ALLOC;
112	ndr_err = call->ndr_pull(pull, NDR_IN, r);
113	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
114		talloc_free(r);
115		return false;
116	}
117
118	if (DEBUGLEVEL >= 10) {
119		NDR_PRINT_IN_DEBUG(svcctl_ControlService, r);
120	}
121
122	ZERO_STRUCT(r->out);
123	r->out.service_status = talloc_zero(r, struct SERVICE_STATUS);
124	if (r->out.service_status == NULL) {
125		talloc_free(r);
126		return false;
127	}
128
129	r->out.result = _svcctl_ControlService(p, r);
130
131	if (p->rng_fault_state) {
132		talloc_free(r);
133		/* Return true here, srv_pipe_hnd.c will take care */
134		return true;
135	}
136
137	if (DEBUGLEVEL >= 10) {
138		NDR_PRINT_OUT_DEBUG(svcctl_ControlService, r);
139	}
140
141	push = ndr_push_init_ctx(r, NULL);
142	if (push == NULL) {
143		talloc_free(r);
144		return false;
145	}
146
147	ndr_err = call->ndr_push(push, NDR_OUT, r);
148	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
149		talloc_free(r);
150		return false;
151	}
152
153	blob = ndr_push_blob(push);
154	if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
155		talloc_free(r);
156		return false;
157	}
158
159	talloc_free(r);
160
161	return true;
162}
163
164static bool api_svcctl_DeleteService(pipes_struct *p)
165{
166	const struct ndr_interface_call *call;
167	struct ndr_pull *pull;
168	struct ndr_push *push;
169	enum ndr_err_code ndr_err;
170	DATA_BLOB blob;
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	if (!prs_data_blob(&p->in_data.data, &blob, r)) {
181		talloc_free(r);
182		return false;
183	}
184
185	pull = ndr_pull_init_blob(&blob, r, NULL);
186	if (pull == NULL) {
187		talloc_free(r);
188		return false;
189	}
190
191	pull->flags |= LIBNDR_FLAG_REF_ALLOC;
192	ndr_err = call->ndr_pull(pull, NDR_IN, r);
193	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
194		talloc_free(r);
195		return false;
196	}
197
198	if (DEBUGLEVEL >= 10) {
199		NDR_PRINT_IN_DEBUG(svcctl_DeleteService, r);
200	}
201
202	r->out.result = _svcctl_DeleteService(p, r);
203
204	if (p->rng_fault_state) {
205		talloc_free(r);
206		/* Return true here, srv_pipe_hnd.c will take care */
207		return true;
208	}
209
210	if (DEBUGLEVEL >= 10) {
211		NDR_PRINT_OUT_DEBUG(svcctl_DeleteService, r);
212	}
213
214	push = ndr_push_init_ctx(r, NULL);
215	if (push == NULL) {
216		talloc_free(r);
217		return false;
218	}
219
220	ndr_err = call->ndr_push(push, NDR_OUT, r);
221	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
222		talloc_free(r);
223		return false;
224	}
225
226	blob = ndr_push_blob(push);
227	if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
228		talloc_free(r);
229		return false;
230	}
231
232	talloc_free(r);
233
234	return true;
235}
236
237static bool api_svcctl_LockServiceDatabase(pipes_struct *p)
238{
239	const struct ndr_interface_call *call;
240	struct ndr_pull *pull;
241	struct ndr_push *push;
242	enum ndr_err_code ndr_err;
243	DATA_BLOB blob;
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	if (!prs_data_blob(&p->in_data.data, &blob, r)) {
254		talloc_free(r);
255		return false;
256	}
257
258	pull = ndr_pull_init_blob(&blob, r, NULL);
259	if (pull == NULL) {
260		talloc_free(r);
261		return false;
262	}
263
264	pull->flags |= LIBNDR_FLAG_REF_ALLOC;
265	ndr_err = call->ndr_pull(pull, NDR_IN, r);
266	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
267		talloc_free(r);
268		return false;
269	}
270
271	if (DEBUGLEVEL >= 10) {
272		NDR_PRINT_IN_DEBUG(svcctl_LockServiceDatabase, r);
273	}
274
275	ZERO_STRUCT(r->out);
276	r->out.lock = talloc_zero(r, struct policy_handle);
277	if (r->out.lock == NULL) {
278		talloc_free(r);
279		return false;
280	}
281
282	r->out.result = _svcctl_LockServiceDatabase(p, r);
283
284	if (p->rng_fault_state) {
285		talloc_free(r);
286		/* Return true here, srv_pipe_hnd.c will take care */
287		return true;
288	}
289
290	if (DEBUGLEVEL >= 10) {
291		NDR_PRINT_OUT_DEBUG(svcctl_LockServiceDatabase, r);
292	}
293
294	push = ndr_push_init_ctx(r, NULL);
295	if (push == NULL) {
296		talloc_free(r);
297		return false;
298	}
299
300	ndr_err = call->ndr_push(push, NDR_OUT, r);
301	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
302		talloc_free(r);
303		return false;
304	}
305
306	blob = ndr_push_blob(push);
307	if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
308		talloc_free(r);
309		return false;
310	}
311
312	talloc_free(r);
313
314	return true;
315}
316
317static bool api_svcctl_QueryServiceObjectSecurity(pipes_struct *p)
318{
319	const struct ndr_interface_call *call;
320	struct ndr_pull *pull;
321	struct ndr_push *push;
322	enum ndr_err_code ndr_err;
323	DATA_BLOB blob;
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	if (!prs_data_blob(&p->in_data.data, &blob, r)) {
334		talloc_free(r);
335		return false;
336	}
337
338	pull = ndr_pull_init_blob(&blob, r, NULL);
339	if (pull == NULL) {
340		talloc_free(r);
341		return false;
342	}
343
344	pull->flags |= LIBNDR_FLAG_REF_ALLOC;
345	ndr_err = call->ndr_pull(pull, NDR_IN, r);
346	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
347		talloc_free(r);
348		return false;
349	}
350
351	if (DEBUGLEVEL >= 10) {
352		NDR_PRINT_IN_DEBUG(svcctl_QueryServiceObjectSecurity, r);
353	}
354
355	ZERO_STRUCT(r->out);
356	r->out.buffer = talloc_zero_array(r, uint8_t, r->in.offered);
357	if (r->out.buffer == NULL) {
358		talloc_free(r);
359		return false;
360	}
361
362	r->out.needed = talloc_zero(r, uint32_t);
363	if (r->out.needed == NULL) {
364		talloc_free(r);
365		return false;
366	}
367
368	r->out.result = _svcctl_QueryServiceObjectSecurity(p, r);
369
370	if (p->rng_fault_state) {
371		talloc_free(r);
372		/* Return true here, srv_pipe_hnd.c will take care */
373		return true;
374	}
375
376	if (DEBUGLEVEL >= 10) {
377		NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceObjectSecurity, r);
378	}
379
380	push = ndr_push_init_ctx(r, NULL);
381	if (push == NULL) {
382		talloc_free(r);
383		return false;
384	}
385
386	ndr_err = call->ndr_push(push, NDR_OUT, r);
387	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
388		talloc_free(r);
389		return false;
390	}
391
392	blob = ndr_push_blob(push);
393	if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
394		talloc_free(r);
395		return false;
396	}
397
398	talloc_free(r);
399
400	return true;
401}
402
403static bool api_svcctl_SetServiceObjectSecurity(pipes_struct *p)
404{
405	const struct ndr_interface_call *call;
406	struct ndr_pull *pull;
407	struct ndr_push *push;
408	enum ndr_err_code ndr_err;
409	DATA_BLOB blob;
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	if (!prs_data_blob(&p->in_data.data, &blob, r)) {
420		talloc_free(r);
421		return false;
422	}
423
424	pull = ndr_pull_init_blob(&blob, r, NULL);
425	if (pull == NULL) {
426		talloc_free(r);
427		return false;
428	}
429
430	pull->flags |= LIBNDR_FLAG_REF_ALLOC;
431	ndr_err = call->ndr_pull(pull, NDR_IN, r);
432	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
433		talloc_free(r);
434		return false;
435	}
436
437	if (DEBUGLEVEL >= 10) {
438		NDR_PRINT_IN_DEBUG(svcctl_SetServiceObjectSecurity, r);
439	}
440
441	r->out.result = _svcctl_SetServiceObjectSecurity(p, r);
442
443	if (p->rng_fault_state) {
444		talloc_free(r);
445		/* Return true here, srv_pipe_hnd.c will take care */
446		return true;
447	}
448
449	if (DEBUGLEVEL >= 10) {
450		NDR_PRINT_OUT_DEBUG(svcctl_SetServiceObjectSecurity, r);
451	}
452
453	push = ndr_push_init_ctx(r, NULL);
454	if (push == NULL) {
455		talloc_free(r);
456		return false;
457	}
458
459	ndr_err = call->ndr_push(push, NDR_OUT, r);
460	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
461		talloc_free(r);
462		return false;
463	}
464
465	blob = ndr_push_blob(push);
466	if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
467		talloc_free(r);
468		return false;
469	}
470
471	talloc_free(r);
472
473	return true;
474}
475
476static bool api_svcctl_QueryServiceStatus(pipes_struct *p)
477{
478	const struct ndr_interface_call *call;
479	struct ndr_pull *pull;
480	struct ndr_push *push;
481	enum ndr_err_code ndr_err;
482	DATA_BLOB blob;
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	if (!prs_data_blob(&p->in_data.data, &blob, r)) {
493		talloc_free(r);
494		return false;
495	}
496
497	pull = ndr_pull_init_blob(&blob, r, NULL);
498	if (pull == NULL) {
499		talloc_free(r);
500		return false;
501	}
502
503	pull->flags |= LIBNDR_FLAG_REF_ALLOC;
504	ndr_err = call->ndr_pull(pull, NDR_IN, r);
505	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
506		talloc_free(r);
507		return false;
508	}
509
510	if (DEBUGLEVEL >= 10) {
511		NDR_PRINT_IN_DEBUG(svcctl_QueryServiceStatus, r);
512	}
513
514	ZERO_STRUCT(r->out);
515	r->out.service_status = talloc_zero(r, struct SERVICE_STATUS);
516	if (r->out.service_status == NULL) {
517		talloc_free(r);
518		return false;
519	}
520
521	r->out.result = _svcctl_QueryServiceStatus(p, r);
522
523	if (p->rng_fault_state) {
524		talloc_free(r);
525		/* Return true here, srv_pipe_hnd.c will take care */
526		return true;
527	}
528
529	if (DEBUGLEVEL >= 10) {
530		NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceStatus, r);
531	}
532
533	push = ndr_push_init_ctx(r, NULL);
534	if (push == NULL) {
535		talloc_free(r);
536		return false;
537	}
538
539	ndr_err = call->ndr_push(push, NDR_OUT, r);
540	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
541		talloc_free(r);
542		return false;
543	}
544
545	blob = ndr_push_blob(push);
546	if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
547		talloc_free(r);
548		return false;
549	}
550
551	talloc_free(r);
552
553	return true;
554}
555
556static bool api_svcctl_SetServiceStatus(pipes_struct *p)
557{
558	const struct ndr_interface_call *call;
559	struct ndr_pull *pull;
560	struct ndr_push *push;
561	enum ndr_err_code ndr_err;
562	DATA_BLOB blob;
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	if (!prs_data_blob(&p->in_data.data, &blob, r)) {
573		talloc_free(r);
574		return false;
575	}
576
577	pull = ndr_pull_init_blob(&blob, r, NULL);
578	if (pull == NULL) {
579		talloc_free(r);
580		return false;
581	}
582
583	pull->flags |= LIBNDR_FLAG_REF_ALLOC;
584	ndr_err = call->ndr_pull(pull, NDR_IN, r);
585	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
586		talloc_free(r);
587		return false;
588	}
589
590	if (DEBUGLEVEL >= 10) {
591		NDR_PRINT_IN_DEBUG(svcctl_SetServiceStatus, r);
592	}
593
594	r->out.result = _svcctl_SetServiceStatus(p, r);
595
596	if (p->rng_fault_state) {
597		talloc_free(r);
598		/* Return true here, srv_pipe_hnd.c will take care */
599		return true;
600	}
601
602	if (DEBUGLEVEL >= 10) {
603		NDR_PRINT_OUT_DEBUG(svcctl_SetServiceStatus, r);
604	}
605
606	push = ndr_push_init_ctx(r, NULL);
607	if (push == NULL) {
608		talloc_free(r);
609		return false;
610	}
611
612	ndr_err = call->ndr_push(push, NDR_OUT, r);
613	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
614		talloc_free(r);
615		return false;
616	}
617
618	blob = ndr_push_blob(push);
619	if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
620		talloc_free(r);
621		return false;
622	}
623
624	talloc_free(r);
625
626	return true;
627}
628
629static bool api_svcctl_UnlockServiceDatabase(pipes_struct *p)
630{
631	const struct ndr_interface_call *call;
632	struct ndr_pull *pull;
633	struct ndr_push *push;
634	enum ndr_err_code ndr_err;
635	DATA_BLOB blob;
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	if (!prs_data_blob(&p->in_data.data, &blob, r)) {
646		talloc_free(r);
647		return false;
648	}
649
650	pull = ndr_pull_init_blob(&blob, r, NULL);
651	if (pull == NULL) {
652		talloc_free(r);
653		return false;
654	}
655
656	pull->flags |= LIBNDR_FLAG_REF_ALLOC;
657	ndr_err = call->ndr_pull(pull, NDR_IN, r);
658	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
659		talloc_free(r);
660		return false;
661	}
662
663	if (DEBUGLEVEL >= 10) {
664		NDR_PRINT_IN_DEBUG(svcctl_UnlockServiceDatabase, r);
665	}
666
667	ZERO_STRUCT(r->out);
668	r->out.lock = r->in.lock;
669	r->out.result = _svcctl_UnlockServiceDatabase(p, r);
670
671	if (p->rng_fault_state) {
672		talloc_free(r);
673		/* Return true here, srv_pipe_hnd.c will take care */
674		return true;
675	}
676
677	if (DEBUGLEVEL >= 10) {
678		NDR_PRINT_OUT_DEBUG(svcctl_UnlockServiceDatabase, r);
679	}
680
681	push = ndr_push_init_ctx(r, NULL);
682	if (push == NULL) {
683		talloc_free(r);
684		return false;
685	}
686
687	ndr_err = call->ndr_push(push, NDR_OUT, r);
688	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
689		talloc_free(r);
690		return false;
691	}
692
693	blob = ndr_push_blob(push);
694	if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
695		talloc_free(r);
696		return false;
697	}
698
699	talloc_free(r);
700
701	return true;
702}
703
704static bool api_svcctl_NotifyBootConfigStatus(pipes_struct *p)
705{
706	const struct ndr_interface_call *call;
707	struct ndr_pull *pull;
708	struct ndr_push *push;
709	enum ndr_err_code ndr_err;
710	DATA_BLOB blob;
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	if (!prs_data_blob(&p->in_data.data, &blob, r)) {
721		talloc_free(r);
722		return false;
723	}
724
725	pull = ndr_pull_init_blob(&blob, r, NULL);
726	if (pull == NULL) {
727		talloc_free(r);
728		return false;
729	}
730
731	pull->flags |= LIBNDR_FLAG_REF_ALLOC;
732	ndr_err = call->ndr_pull(pull, NDR_IN, r);
733	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
734		talloc_free(r);
735		return false;
736	}
737
738	if (DEBUGLEVEL >= 10) {
739		NDR_PRINT_IN_DEBUG(svcctl_NotifyBootConfigStatus, r);
740	}
741
742	r->out.result = _svcctl_NotifyBootConfigStatus(p, r);
743
744	if (p->rng_fault_state) {
745		talloc_free(r);
746		/* Return true here, srv_pipe_hnd.c will take care */
747		return true;
748	}
749
750	if (DEBUGLEVEL >= 10) {
751		NDR_PRINT_OUT_DEBUG(svcctl_NotifyBootConfigStatus, r);
752	}
753
754	push = ndr_push_init_ctx(r, NULL);
755	if (push == NULL) {
756		talloc_free(r);
757		return false;
758	}
759
760	ndr_err = call->ndr_push(push, NDR_OUT, r);
761	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
762		talloc_free(r);
763		return false;
764	}
765
766	blob = ndr_push_blob(push);
767	if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
768		talloc_free(r);
769		return false;
770	}
771
772	talloc_free(r);
773
774	return true;
775}
776
777static bool api_svcctl_SCSetServiceBitsW(pipes_struct *p)
778{
779	const struct ndr_interface_call *call;
780	struct ndr_pull *pull;
781	struct ndr_push *push;
782	enum ndr_err_code ndr_err;
783	DATA_BLOB blob;
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	if (!prs_data_blob(&p->in_data.data, &blob, r)) {
794		talloc_free(r);
795		return false;
796	}
797
798	pull = ndr_pull_init_blob(&blob, r, NULL);
799	if (pull == NULL) {
800		talloc_free(r);
801		return false;
802	}
803
804	pull->flags |= LIBNDR_FLAG_REF_ALLOC;
805	ndr_err = call->ndr_pull(pull, NDR_IN, r);
806	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
807		talloc_free(r);
808		return false;
809	}
810
811	if (DEBUGLEVEL >= 10) {
812		NDR_PRINT_IN_DEBUG(svcctl_SCSetServiceBitsW, r);
813	}
814
815	r->out.result = _svcctl_SCSetServiceBitsW(p, r);
816
817	if (p->rng_fault_state) {
818		talloc_free(r);
819		/* Return true here, srv_pipe_hnd.c will take care */
820		return true;
821	}
822
823	if (DEBUGLEVEL >= 10) {
824		NDR_PRINT_OUT_DEBUG(svcctl_SCSetServiceBitsW, r);
825	}
826
827	push = ndr_push_init_ctx(r, NULL);
828	if (push == NULL) {
829		talloc_free(r);
830		return false;
831	}
832
833	ndr_err = call->ndr_push(push, NDR_OUT, r);
834	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
835		talloc_free(r);
836		return false;
837	}
838
839	blob = ndr_push_blob(push);
840	if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
841		talloc_free(r);
842		return false;
843	}
844
845	talloc_free(r);
846
847	return true;
848}
849
850static bool api_svcctl_ChangeServiceConfigW(pipes_struct *p)
851{
852	const struct ndr_interface_call *call;
853	struct ndr_pull *pull;
854	struct ndr_push *push;
855	enum ndr_err_code ndr_err;
856	DATA_BLOB blob;
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	if (!prs_data_blob(&p->in_data.data, &blob, r)) {
867		talloc_free(r);
868		return false;
869	}
870
871	pull = ndr_pull_init_blob(&blob, r, NULL);
872	if (pull == NULL) {
873		talloc_free(r);
874		return false;
875	}
876
877	pull->flags |= LIBNDR_FLAG_REF_ALLOC;
878	ndr_err = call->ndr_pull(pull, NDR_IN, r);
879	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
880		talloc_free(r);
881		return false;
882	}
883
884	if (DEBUGLEVEL >= 10) {
885		NDR_PRINT_IN_DEBUG(svcctl_ChangeServiceConfigW, r);
886	}
887
888	ZERO_STRUCT(r->out);
889	r->out.tag_id = talloc_zero(r, uint32_t);
890	if (r->out.tag_id == NULL) {
891		talloc_free(r);
892		return false;
893	}
894
895	r->out.result = _svcctl_ChangeServiceConfigW(p, r);
896
897	if (p->rng_fault_state) {
898		talloc_free(r);
899		/* Return true here, srv_pipe_hnd.c will take care */
900		return true;
901	}
902
903	if (DEBUGLEVEL >= 10) {
904		NDR_PRINT_OUT_DEBUG(svcctl_ChangeServiceConfigW, r);
905	}
906
907	push = ndr_push_init_ctx(r, NULL);
908	if (push == NULL) {
909		talloc_free(r);
910		return false;
911	}
912
913	ndr_err = call->ndr_push(push, NDR_OUT, r);
914	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
915		talloc_free(r);
916		return false;
917	}
918
919	blob = ndr_push_blob(push);
920	if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
921		talloc_free(r);
922		return false;
923	}
924
925	talloc_free(r);
926
927	return true;
928}
929
930static bool api_svcctl_CreateServiceW(pipes_struct *p)
931{
932	const struct ndr_interface_call *call;
933	struct ndr_pull *pull;
934	struct ndr_push *push;
935	enum ndr_err_code ndr_err;
936	DATA_BLOB blob;
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	if (!prs_data_blob(&p->in_data.data, &blob, r)) {
947		talloc_free(r);
948		return false;
949	}
950
951	pull = ndr_pull_init_blob(&blob, r, NULL);
952	if (pull == NULL) {
953		talloc_free(r);
954		return false;
955	}
956
957	pull->flags |= LIBNDR_FLAG_REF_ALLOC;
958	ndr_err = call->ndr_pull(pull, NDR_IN, r);
959	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
960		talloc_free(r);
961		return false;
962	}
963
964	if (DEBUGLEVEL >= 10) {
965		NDR_PRINT_IN_DEBUG(svcctl_CreateServiceW, r);
966	}
967
968	ZERO_STRUCT(r->out);
969	r->out.TagId = r->in.TagId;
970	r->out.handle = talloc_zero(r, struct policy_handle);
971	if (r->out.handle == NULL) {
972		talloc_free(r);
973		return false;
974	}
975
976	r->out.result = _svcctl_CreateServiceW(p, r);
977
978	if (p->rng_fault_state) {
979		talloc_free(r);
980		/* Return true here, srv_pipe_hnd.c will take care */
981		return true;
982	}
983
984	if (DEBUGLEVEL >= 10) {
985		NDR_PRINT_OUT_DEBUG(svcctl_CreateServiceW, r);
986	}
987
988	push = ndr_push_init_ctx(r, NULL);
989	if (push == NULL) {
990		talloc_free(r);
991		return false;
992	}
993
994	ndr_err = call->ndr_push(push, NDR_OUT, r);
995	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
996		talloc_free(r);
997		return false;
998	}
999
1000	blob = ndr_push_blob(push);
1001	if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1002		talloc_free(r);
1003		return false;
1004	}
1005
1006	talloc_free(r);
1007
1008	return true;
1009}
1010
1011static bool api_svcctl_EnumDependentServicesW(pipes_struct *p)
1012{
1013	const struct ndr_interface_call *call;
1014	struct ndr_pull *pull;
1015	struct ndr_push *push;
1016	enum ndr_err_code ndr_err;
1017	DATA_BLOB blob;
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	if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1028		talloc_free(r);
1029		return false;
1030	}
1031
1032	pull = ndr_pull_init_blob(&blob, r, NULL);
1033	if (pull == NULL) {
1034		talloc_free(r);
1035		return false;
1036	}
1037
1038	pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1039	ndr_err = call->ndr_pull(pull, NDR_IN, r);
1040	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1041		talloc_free(r);
1042		return false;
1043	}
1044
1045	if (DEBUGLEVEL >= 10) {
1046		NDR_PRINT_IN_DEBUG(svcctl_EnumDependentServicesW, r);
1047	}
1048
1049	ZERO_STRUCT(r->out);
1050	r->out.service_status = talloc_zero_array(r, uint8_t, r->in.offered);
1051	if (r->out.service_status == NULL) {
1052		talloc_free(r);
1053		return false;
1054	}
1055
1056	r->out.needed = talloc_zero(r, uint32_t);
1057	if (r->out.needed == NULL) {
1058		talloc_free(r);
1059		return false;
1060	}
1061
1062	r->out.services_returned = talloc_zero(r, uint32_t);
1063	if (r->out.services_returned == NULL) {
1064		talloc_free(r);
1065		return false;
1066	}
1067
1068	r->out.result = _svcctl_EnumDependentServicesW(p, r);
1069
1070	if (p->rng_fault_state) {
1071		talloc_free(r);
1072		/* Return true here, srv_pipe_hnd.c will take care */
1073		return true;
1074	}
1075
1076	if (DEBUGLEVEL >= 10) {
1077		NDR_PRINT_OUT_DEBUG(svcctl_EnumDependentServicesW, r);
1078	}
1079
1080	push = ndr_push_init_ctx(r, NULL);
1081	if (push == NULL) {
1082		talloc_free(r);
1083		return false;
1084	}
1085
1086	ndr_err = call->ndr_push(push, NDR_OUT, r);
1087	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1088		talloc_free(r);
1089		return false;
1090	}
1091
1092	blob = ndr_push_blob(push);
1093	if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1094		talloc_free(r);
1095		return false;
1096	}
1097
1098	talloc_free(r);
1099
1100	return true;
1101}
1102
1103static bool api_svcctl_EnumServicesStatusW(pipes_struct *p)
1104{
1105	const struct ndr_interface_call *call;
1106	struct ndr_pull *pull;
1107	struct ndr_push *push;
1108	enum ndr_err_code ndr_err;
1109	DATA_BLOB blob;
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	if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1120		talloc_free(r);
1121		return false;
1122	}
1123
1124	pull = ndr_pull_init_blob(&blob, r, NULL);
1125	if (pull == NULL) {
1126		talloc_free(r);
1127		return false;
1128	}
1129
1130	pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1131	ndr_err = call->ndr_pull(pull, NDR_IN, r);
1132	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1133		talloc_free(r);
1134		return false;
1135	}
1136
1137	if (DEBUGLEVEL >= 10) {
1138		NDR_PRINT_IN_DEBUG(svcctl_EnumServicesStatusW, r);
1139	}
1140
1141	ZERO_STRUCT(r->out);
1142	r->out.resume_handle = r->in.resume_handle;
1143	r->out.service = talloc_zero_array(r, uint8_t, r->in.offered);
1144	if (r->out.service == NULL) {
1145		talloc_free(r);
1146		return false;
1147	}
1148
1149	r->out.needed = talloc_zero(r, uint32_t);
1150	if (r->out.needed == NULL) {
1151		talloc_free(r);
1152		return false;
1153	}
1154
1155	r->out.services_returned = talloc_zero(r, uint32_t);
1156	if (r->out.services_returned == NULL) {
1157		talloc_free(r);
1158		return false;
1159	}
1160
1161	r->out.result = _svcctl_EnumServicesStatusW(p, r);
1162
1163	if (p->rng_fault_state) {
1164		talloc_free(r);
1165		/* Return true here, srv_pipe_hnd.c will take care */
1166		return true;
1167	}
1168
1169	if (DEBUGLEVEL >= 10) {
1170		NDR_PRINT_OUT_DEBUG(svcctl_EnumServicesStatusW, r);
1171	}
1172
1173	push = ndr_push_init_ctx(r, NULL);
1174	if (push == NULL) {
1175		talloc_free(r);
1176		return false;
1177	}
1178
1179	ndr_err = call->ndr_push(push, NDR_OUT, r);
1180	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1181		talloc_free(r);
1182		return false;
1183	}
1184
1185	blob = ndr_push_blob(push);
1186	if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1187		talloc_free(r);
1188		return false;
1189	}
1190
1191	talloc_free(r);
1192
1193	return true;
1194}
1195
1196static bool api_svcctl_OpenSCManagerW(pipes_struct *p)
1197{
1198	const struct ndr_interface_call *call;
1199	struct ndr_pull *pull;
1200	struct ndr_push *push;
1201	enum ndr_err_code ndr_err;
1202	DATA_BLOB blob;
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	if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1213		talloc_free(r);
1214		return false;
1215	}
1216
1217	pull = ndr_pull_init_blob(&blob, r, NULL);
1218	if (pull == NULL) {
1219		talloc_free(r);
1220		return false;
1221	}
1222
1223	pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1224	ndr_err = call->ndr_pull(pull, NDR_IN, r);
1225	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1226		talloc_free(r);
1227		return false;
1228	}
1229
1230	if (DEBUGLEVEL >= 10) {
1231		NDR_PRINT_IN_DEBUG(svcctl_OpenSCManagerW, r);
1232	}
1233
1234	ZERO_STRUCT(r->out);
1235	r->out.handle = talloc_zero(r, struct policy_handle);
1236	if (r->out.handle == NULL) {
1237		talloc_free(r);
1238		return false;
1239	}
1240
1241	r->out.result = _svcctl_OpenSCManagerW(p, r);
1242
1243	if (p->rng_fault_state) {
1244		talloc_free(r);
1245		/* Return true here, srv_pipe_hnd.c will take care */
1246		return true;
1247	}
1248
1249	if (DEBUGLEVEL >= 10) {
1250		NDR_PRINT_OUT_DEBUG(svcctl_OpenSCManagerW, r);
1251	}
1252
1253	push = ndr_push_init_ctx(r, NULL);
1254	if (push == NULL) {
1255		talloc_free(r);
1256		return false;
1257	}
1258
1259	ndr_err = call->ndr_push(push, NDR_OUT, r);
1260	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1261		talloc_free(r);
1262		return false;
1263	}
1264
1265	blob = ndr_push_blob(push);
1266	if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1267		talloc_free(r);
1268		return false;
1269	}
1270
1271	talloc_free(r);
1272
1273	return true;
1274}
1275
1276static bool api_svcctl_OpenServiceW(pipes_struct *p)
1277{
1278	const struct ndr_interface_call *call;
1279	struct ndr_pull *pull;
1280	struct ndr_push *push;
1281	enum ndr_err_code ndr_err;
1282	DATA_BLOB blob;
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	if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1293		talloc_free(r);
1294		return false;
1295	}
1296
1297	pull = ndr_pull_init_blob(&blob, r, NULL);
1298	if (pull == NULL) {
1299		talloc_free(r);
1300		return false;
1301	}
1302
1303	pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1304	ndr_err = call->ndr_pull(pull, NDR_IN, r);
1305	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1306		talloc_free(r);
1307		return false;
1308	}
1309
1310	if (DEBUGLEVEL >= 10) {
1311		NDR_PRINT_IN_DEBUG(svcctl_OpenServiceW, r);
1312	}
1313
1314	ZERO_STRUCT(r->out);
1315	r->out.handle = talloc_zero(r, struct policy_handle);
1316	if (r->out.handle == NULL) {
1317		talloc_free(r);
1318		return false;
1319	}
1320
1321	r->out.result = _svcctl_OpenServiceW(p, r);
1322
1323	if (p->rng_fault_state) {
1324		talloc_free(r);
1325		/* Return true here, srv_pipe_hnd.c will take care */
1326		return true;
1327	}
1328
1329	if (DEBUGLEVEL >= 10) {
1330		NDR_PRINT_OUT_DEBUG(svcctl_OpenServiceW, r);
1331	}
1332
1333	push = ndr_push_init_ctx(r, NULL);
1334	if (push == NULL) {
1335		talloc_free(r);
1336		return false;
1337	}
1338
1339	ndr_err = call->ndr_push(push, NDR_OUT, r);
1340	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1341		talloc_free(r);
1342		return false;
1343	}
1344
1345	blob = ndr_push_blob(push);
1346	if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1347		talloc_free(r);
1348		return false;
1349	}
1350
1351	talloc_free(r);
1352
1353	return true;
1354}
1355
1356static bool api_svcctl_QueryServiceConfigW(pipes_struct *p)
1357{
1358	const struct ndr_interface_call *call;
1359	struct ndr_pull *pull;
1360	struct ndr_push *push;
1361	enum ndr_err_code ndr_err;
1362	DATA_BLOB blob;
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	if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1373		talloc_free(r);
1374		return false;
1375	}
1376
1377	pull = ndr_pull_init_blob(&blob, r, NULL);
1378	if (pull == NULL) {
1379		talloc_free(r);
1380		return false;
1381	}
1382
1383	pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1384	ndr_err = call->ndr_pull(pull, NDR_IN, r);
1385	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1386		talloc_free(r);
1387		return false;
1388	}
1389
1390	if (DEBUGLEVEL >= 10) {
1391		NDR_PRINT_IN_DEBUG(svcctl_QueryServiceConfigW, r);
1392	}
1393
1394	ZERO_STRUCT(r->out);
1395	r->out.query = talloc_zero(r, struct QUERY_SERVICE_CONFIG);
1396	if (r->out.query == NULL) {
1397		talloc_free(r);
1398		return false;
1399	}
1400
1401	r->out.needed = talloc_zero(r, uint32_t);
1402	if (r->out.needed == NULL) {
1403		talloc_free(r);
1404		return false;
1405	}
1406
1407	r->out.result = _svcctl_QueryServiceConfigW(p, r);
1408
1409	if (p->rng_fault_state) {
1410		talloc_free(r);
1411		/* Return true here, srv_pipe_hnd.c will take care */
1412		return true;
1413	}
1414
1415	if (DEBUGLEVEL >= 10) {
1416		NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceConfigW, r);
1417	}
1418
1419	push = ndr_push_init_ctx(r, NULL);
1420	if (push == NULL) {
1421		talloc_free(r);
1422		return false;
1423	}
1424
1425	ndr_err = call->ndr_push(push, NDR_OUT, r);
1426	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1427		talloc_free(r);
1428		return false;
1429	}
1430
1431	blob = ndr_push_blob(push);
1432	if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1433		talloc_free(r);
1434		return false;
1435	}
1436
1437	talloc_free(r);
1438
1439	return true;
1440}
1441
1442static bool api_svcctl_QueryServiceLockStatusW(pipes_struct *p)
1443{
1444	const struct ndr_interface_call *call;
1445	struct ndr_pull *pull;
1446	struct ndr_push *push;
1447	enum ndr_err_code ndr_err;
1448	DATA_BLOB blob;
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	if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1459		talloc_free(r);
1460		return false;
1461	}
1462
1463	pull = ndr_pull_init_blob(&blob, r, NULL);
1464	if (pull == NULL) {
1465		talloc_free(r);
1466		return false;
1467	}
1468
1469	pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1470	ndr_err = call->ndr_pull(pull, NDR_IN, r);
1471	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1472		talloc_free(r);
1473		return false;
1474	}
1475
1476	if (DEBUGLEVEL >= 10) {
1477		NDR_PRINT_IN_DEBUG(svcctl_QueryServiceLockStatusW, r);
1478	}
1479
1480	ZERO_STRUCT(r->out);
1481	r->out.lock_status = talloc_zero(r, struct SERVICE_LOCK_STATUS);
1482	if (r->out.lock_status == NULL) {
1483		talloc_free(r);
1484		return false;
1485	}
1486
1487	r->out.needed = talloc_zero(r, uint32_t);
1488	if (r->out.needed == NULL) {
1489		talloc_free(r);
1490		return false;
1491	}
1492
1493	r->out.result = _svcctl_QueryServiceLockStatusW(p, r);
1494
1495	if (p->rng_fault_state) {
1496		talloc_free(r);
1497		/* Return true here, srv_pipe_hnd.c will take care */
1498		return true;
1499	}
1500
1501	if (DEBUGLEVEL >= 10) {
1502		NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceLockStatusW, r);
1503	}
1504
1505	push = ndr_push_init_ctx(r, NULL);
1506	if (push == NULL) {
1507		talloc_free(r);
1508		return false;
1509	}
1510
1511	ndr_err = call->ndr_push(push, NDR_OUT, r);
1512	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1513		talloc_free(r);
1514		return false;
1515	}
1516
1517	blob = ndr_push_blob(push);
1518	if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1519		talloc_free(r);
1520		return false;
1521	}
1522
1523	talloc_free(r);
1524
1525	return true;
1526}
1527
1528static bool api_svcctl_StartServiceW(pipes_struct *p)
1529{
1530	const struct ndr_interface_call *call;
1531	struct ndr_pull *pull;
1532	struct ndr_push *push;
1533	enum ndr_err_code ndr_err;
1534	DATA_BLOB blob;
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	if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1545		talloc_free(r);
1546		return false;
1547	}
1548
1549	pull = ndr_pull_init_blob(&blob, r, NULL);
1550	if (pull == NULL) {
1551		talloc_free(r);
1552		return false;
1553	}
1554
1555	pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1556	ndr_err = call->ndr_pull(pull, NDR_IN, r);
1557	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1558		talloc_free(r);
1559		return false;
1560	}
1561
1562	if (DEBUGLEVEL >= 10) {
1563		NDR_PRINT_IN_DEBUG(svcctl_StartServiceW, r);
1564	}
1565
1566	r->out.result = _svcctl_StartServiceW(p, r);
1567
1568	if (p->rng_fault_state) {
1569		talloc_free(r);
1570		/* Return true here, srv_pipe_hnd.c will take care */
1571		return true;
1572	}
1573
1574	if (DEBUGLEVEL >= 10) {
1575		NDR_PRINT_OUT_DEBUG(svcctl_StartServiceW, r);
1576	}
1577
1578	push = ndr_push_init_ctx(r, NULL);
1579	if (push == NULL) {
1580		talloc_free(r);
1581		return false;
1582	}
1583
1584	ndr_err = call->ndr_push(push, NDR_OUT, r);
1585	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1586		talloc_free(r);
1587		return false;
1588	}
1589
1590	blob = ndr_push_blob(push);
1591	if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1592		talloc_free(r);
1593		return false;
1594	}
1595
1596	talloc_free(r);
1597
1598	return true;
1599}
1600
1601static bool api_svcctl_GetServiceDisplayNameW(pipes_struct *p)
1602{
1603	const struct ndr_interface_call *call;
1604	struct ndr_pull *pull;
1605	struct ndr_push *push;
1606	enum ndr_err_code ndr_err;
1607	DATA_BLOB blob;
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	if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1618		talloc_free(r);
1619		return false;
1620	}
1621
1622	pull = ndr_pull_init_blob(&blob, r, NULL);
1623	if (pull == NULL) {
1624		talloc_free(r);
1625		return false;
1626	}
1627
1628	pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1629	ndr_err = call->ndr_pull(pull, NDR_IN, r);
1630	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1631		talloc_free(r);
1632		return false;
1633	}
1634
1635	if (DEBUGLEVEL >= 10) {
1636		NDR_PRINT_IN_DEBUG(svcctl_GetServiceDisplayNameW, r);
1637	}
1638
1639	ZERO_STRUCT(r->out);
1640	r->out.display_name_length = r->in.display_name_length;
1641	r->out.display_name = talloc_zero(r, const char *);
1642	if (r->out.display_name == NULL) {
1643		talloc_free(r);
1644		return false;
1645	}
1646
1647	r->out.result = _svcctl_GetServiceDisplayNameW(p, r);
1648
1649	if (p->rng_fault_state) {
1650		talloc_free(r);
1651		/* Return true here, srv_pipe_hnd.c will take care */
1652		return true;
1653	}
1654
1655	if (DEBUGLEVEL >= 10) {
1656		NDR_PRINT_OUT_DEBUG(svcctl_GetServiceDisplayNameW, r);
1657	}
1658
1659	push = ndr_push_init_ctx(r, NULL);
1660	if (push == NULL) {
1661		talloc_free(r);
1662		return false;
1663	}
1664
1665	ndr_err = call->ndr_push(push, NDR_OUT, r);
1666	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1667		talloc_free(r);
1668		return false;
1669	}
1670
1671	blob = ndr_push_blob(push);
1672	if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1673		talloc_free(r);
1674		return false;
1675	}
1676
1677	talloc_free(r);
1678
1679	return true;
1680}
1681
1682static bool api_svcctl_GetServiceKeyNameW(pipes_struct *p)
1683{
1684	const struct ndr_interface_call *call;
1685	struct ndr_pull *pull;
1686	struct ndr_push *push;
1687	enum ndr_err_code ndr_err;
1688	DATA_BLOB blob;
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	if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1699		talloc_free(r);
1700		return false;
1701	}
1702
1703	pull = ndr_pull_init_blob(&blob, r, NULL);
1704	if (pull == NULL) {
1705		talloc_free(r);
1706		return false;
1707	}
1708
1709	pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1710	ndr_err = call->ndr_pull(pull, NDR_IN, r);
1711	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1712		talloc_free(r);
1713		return false;
1714	}
1715
1716	if (DEBUGLEVEL >= 10) {
1717		NDR_PRINT_IN_DEBUG(svcctl_GetServiceKeyNameW, r);
1718	}
1719
1720	ZERO_STRUCT(r->out);
1721	r->out.display_name_length = r->in.display_name_length;
1722	r->out.key_name = talloc_zero(r, const char *);
1723	if (r->out.key_name == NULL) {
1724		talloc_free(r);
1725		return false;
1726	}
1727
1728	r->out.result = _svcctl_GetServiceKeyNameW(p, r);
1729
1730	if (p->rng_fault_state) {
1731		talloc_free(r);
1732		/* Return true here, srv_pipe_hnd.c will take care */
1733		return true;
1734	}
1735
1736	if (DEBUGLEVEL >= 10) {
1737		NDR_PRINT_OUT_DEBUG(svcctl_GetServiceKeyNameW, r);
1738	}
1739
1740	push = ndr_push_init_ctx(r, NULL);
1741	if (push == NULL) {
1742		talloc_free(r);
1743		return false;
1744	}
1745
1746	ndr_err = call->ndr_push(push, NDR_OUT, r);
1747	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1748		talloc_free(r);
1749		return false;
1750	}
1751
1752	blob = ndr_push_blob(push);
1753	if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1754		talloc_free(r);
1755		return false;
1756	}
1757
1758	talloc_free(r);
1759
1760	return true;
1761}
1762
1763static bool api_svcctl_SCSetServiceBitsA(pipes_struct *p)
1764{
1765	const struct ndr_interface_call *call;
1766	struct ndr_pull *pull;
1767	struct ndr_push *push;
1768	enum ndr_err_code ndr_err;
1769	DATA_BLOB blob;
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	if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1780		talloc_free(r);
1781		return false;
1782	}
1783
1784	pull = ndr_pull_init_blob(&blob, r, NULL);
1785	if (pull == NULL) {
1786		talloc_free(r);
1787		return false;
1788	}
1789
1790	pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1791	ndr_err = call->ndr_pull(pull, NDR_IN, r);
1792	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1793		talloc_free(r);
1794		return false;
1795	}
1796
1797	if (DEBUGLEVEL >= 10) {
1798		NDR_PRINT_IN_DEBUG(svcctl_SCSetServiceBitsA, r);
1799	}
1800
1801	r->out.result = _svcctl_SCSetServiceBitsA(p, r);
1802
1803	if (p->rng_fault_state) {
1804		talloc_free(r);
1805		/* Return true here, srv_pipe_hnd.c will take care */
1806		return true;
1807	}
1808
1809	if (DEBUGLEVEL >= 10) {
1810		NDR_PRINT_OUT_DEBUG(svcctl_SCSetServiceBitsA, r);
1811	}
1812
1813	push = ndr_push_init_ctx(r, NULL);
1814	if (push == NULL) {
1815		talloc_free(r);
1816		return false;
1817	}
1818
1819	ndr_err = call->ndr_push(push, NDR_OUT, r);
1820	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1821		talloc_free(r);
1822		return false;
1823	}
1824
1825	blob = ndr_push_blob(push);
1826	if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1827		talloc_free(r);
1828		return false;
1829	}
1830
1831	talloc_free(r);
1832
1833	return true;
1834}
1835
1836static bool api_svcctl_ChangeServiceConfigA(pipes_struct *p)
1837{
1838	const struct ndr_interface_call *call;
1839	struct ndr_pull *pull;
1840	struct ndr_push *push;
1841	enum ndr_err_code ndr_err;
1842	DATA_BLOB blob;
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	if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1853		talloc_free(r);
1854		return false;
1855	}
1856
1857	pull = ndr_pull_init_blob(&blob, r, NULL);
1858	if (pull == NULL) {
1859		talloc_free(r);
1860		return false;
1861	}
1862
1863	pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1864	ndr_err = call->ndr_pull(pull, NDR_IN, r);
1865	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1866		talloc_free(r);
1867		return false;
1868	}
1869
1870	if (DEBUGLEVEL >= 10) {
1871		NDR_PRINT_IN_DEBUG(svcctl_ChangeServiceConfigA, r);
1872	}
1873
1874	ZERO_STRUCT(r->out);
1875	r->out.tag_id = talloc_zero(r, uint32_t);
1876	if (r->out.tag_id == NULL) {
1877		talloc_free(r);
1878		return false;
1879	}
1880
1881	r->out.result = _svcctl_ChangeServiceConfigA(p, r);
1882
1883	if (p->rng_fault_state) {
1884		talloc_free(r);
1885		/* Return true here, srv_pipe_hnd.c will take care */
1886		return true;
1887	}
1888
1889	if (DEBUGLEVEL >= 10) {
1890		NDR_PRINT_OUT_DEBUG(svcctl_ChangeServiceConfigA, r);
1891	}
1892
1893	push = ndr_push_init_ctx(r, NULL);
1894	if (push == NULL) {
1895		talloc_free(r);
1896		return false;
1897	}
1898
1899	ndr_err = call->ndr_push(push, NDR_OUT, r);
1900	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1901		talloc_free(r);
1902		return false;
1903	}
1904
1905	blob = ndr_push_blob(push);
1906	if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1907		talloc_free(r);
1908		return false;
1909	}
1910
1911	talloc_free(r);
1912
1913	return true;
1914}
1915
1916static bool api_svcctl_CreateServiceA(pipes_struct *p)
1917{
1918	const struct ndr_interface_call *call;
1919	struct ndr_pull *pull;
1920	struct ndr_push *push;
1921	enum ndr_err_code ndr_err;
1922	DATA_BLOB blob;
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	if (!prs_data_blob(&p->in_data.data, &blob, r)) {
1933		talloc_free(r);
1934		return false;
1935	}
1936
1937	pull = ndr_pull_init_blob(&blob, r, NULL);
1938	if (pull == NULL) {
1939		talloc_free(r);
1940		return false;
1941	}
1942
1943	pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1944	ndr_err = call->ndr_pull(pull, NDR_IN, r);
1945	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1946		talloc_free(r);
1947		return false;
1948	}
1949
1950	if (DEBUGLEVEL >= 10) {
1951		NDR_PRINT_IN_DEBUG(svcctl_CreateServiceA, r);
1952	}
1953
1954	ZERO_STRUCT(r->out);
1955	r->out.TagId = talloc_zero(r, uint32_t);
1956	if (r->out.TagId == NULL) {
1957		talloc_free(r);
1958		return false;
1959	}
1960
1961	r->out.result = _svcctl_CreateServiceA(p, r);
1962
1963	if (p->rng_fault_state) {
1964		talloc_free(r);
1965		/* Return true here, srv_pipe_hnd.c will take care */
1966		return true;
1967	}
1968
1969	if (DEBUGLEVEL >= 10) {
1970		NDR_PRINT_OUT_DEBUG(svcctl_CreateServiceA, r);
1971	}
1972
1973	push = ndr_push_init_ctx(r, NULL);
1974	if (push == NULL) {
1975		talloc_free(r);
1976		return false;
1977	}
1978
1979	ndr_err = call->ndr_push(push, NDR_OUT, r);
1980	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
1981		talloc_free(r);
1982		return false;
1983	}
1984
1985	blob = ndr_push_blob(push);
1986	if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
1987		talloc_free(r);
1988		return false;
1989	}
1990
1991	talloc_free(r);
1992
1993	return true;
1994}
1995
1996static bool api_svcctl_EnumDependentServicesA(pipes_struct *p)
1997{
1998	const struct ndr_interface_call *call;
1999	struct ndr_pull *pull;
2000	struct ndr_push *push;
2001	enum ndr_err_code ndr_err;
2002	DATA_BLOB blob;
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	if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2013		talloc_free(r);
2014		return false;
2015	}
2016
2017	pull = ndr_pull_init_blob(&blob, r, NULL);
2018	if (pull == NULL) {
2019		talloc_free(r);
2020		return false;
2021	}
2022
2023	pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2024	ndr_err = call->ndr_pull(pull, NDR_IN, r);
2025	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2026		talloc_free(r);
2027		return false;
2028	}
2029
2030	if (DEBUGLEVEL >= 10) {
2031		NDR_PRINT_IN_DEBUG(svcctl_EnumDependentServicesA, r);
2032	}
2033
2034	ZERO_STRUCT(r->out);
2035	r->out.service_status = talloc_zero(r, struct ENUM_SERVICE_STATUSA);
2036	if (r->out.service_status == NULL) {
2037		talloc_free(r);
2038		return false;
2039	}
2040
2041	r->out.needed = talloc_zero(r, uint32_t);
2042	if (r->out.needed == NULL) {
2043		talloc_free(r);
2044		return false;
2045	}
2046
2047	r->out.services_returned = talloc_zero(r, uint32_t);
2048	if (r->out.services_returned == NULL) {
2049		talloc_free(r);
2050		return false;
2051	}
2052
2053	r->out.result = _svcctl_EnumDependentServicesA(p, r);
2054
2055	if (p->rng_fault_state) {
2056		talloc_free(r);
2057		/* Return true here, srv_pipe_hnd.c will take care */
2058		return true;
2059	}
2060
2061	if (DEBUGLEVEL >= 10) {
2062		NDR_PRINT_OUT_DEBUG(svcctl_EnumDependentServicesA, r);
2063	}
2064
2065	push = ndr_push_init_ctx(r, NULL);
2066	if (push == NULL) {
2067		talloc_free(r);
2068		return false;
2069	}
2070
2071	ndr_err = call->ndr_push(push, NDR_OUT, r);
2072	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2073		talloc_free(r);
2074		return false;
2075	}
2076
2077	blob = ndr_push_blob(push);
2078	if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2079		talloc_free(r);
2080		return false;
2081	}
2082
2083	talloc_free(r);
2084
2085	return true;
2086}
2087
2088static bool api_svcctl_EnumServicesStatusA(pipes_struct *p)
2089{
2090	const struct ndr_interface_call *call;
2091	struct ndr_pull *pull;
2092	struct ndr_push *push;
2093	enum ndr_err_code ndr_err;
2094	DATA_BLOB blob;
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	if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2105		talloc_free(r);
2106		return false;
2107	}
2108
2109	pull = ndr_pull_init_blob(&blob, r, NULL);
2110	if (pull == NULL) {
2111		talloc_free(r);
2112		return false;
2113	}
2114
2115	pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2116	ndr_err = call->ndr_pull(pull, NDR_IN, r);
2117	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2118		talloc_free(r);
2119		return false;
2120	}
2121
2122	if (DEBUGLEVEL >= 10) {
2123		NDR_PRINT_IN_DEBUG(svcctl_EnumServicesStatusA, r);
2124	}
2125
2126	ZERO_STRUCT(r->out);
2127	r->out.resume_handle = r->in.resume_handle;
2128	r->out.service = talloc_zero_array(r, uint8_t, r->in.offered);
2129	if (r->out.service == NULL) {
2130		talloc_free(r);
2131		return false;
2132	}
2133
2134	r->out.needed = talloc_zero(r, uint32_t);
2135	if (r->out.needed == NULL) {
2136		talloc_free(r);
2137		return false;
2138	}
2139
2140	r->out.services_returned = talloc_zero(r, uint32_t);
2141	if (r->out.services_returned == NULL) {
2142		talloc_free(r);
2143		return false;
2144	}
2145
2146	r->out.result = _svcctl_EnumServicesStatusA(p, r);
2147
2148	if (p->rng_fault_state) {
2149		talloc_free(r);
2150		/* Return true here, srv_pipe_hnd.c will take care */
2151		return true;
2152	}
2153
2154	if (DEBUGLEVEL >= 10) {
2155		NDR_PRINT_OUT_DEBUG(svcctl_EnumServicesStatusA, r);
2156	}
2157
2158	push = ndr_push_init_ctx(r, NULL);
2159	if (push == NULL) {
2160		talloc_free(r);
2161		return false;
2162	}
2163
2164	ndr_err = call->ndr_push(push, NDR_OUT, r);
2165	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2166		talloc_free(r);
2167		return false;
2168	}
2169
2170	blob = ndr_push_blob(push);
2171	if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2172		talloc_free(r);
2173		return false;
2174	}
2175
2176	talloc_free(r);
2177
2178	return true;
2179}
2180
2181static bool api_svcctl_OpenSCManagerA(pipes_struct *p)
2182{
2183	const struct ndr_interface_call *call;
2184	struct ndr_pull *pull;
2185	struct ndr_push *push;
2186	enum ndr_err_code ndr_err;
2187	DATA_BLOB blob;
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	if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2198		talloc_free(r);
2199		return false;
2200	}
2201
2202	pull = ndr_pull_init_blob(&blob, r, NULL);
2203	if (pull == NULL) {
2204		talloc_free(r);
2205		return false;
2206	}
2207
2208	pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2209	ndr_err = call->ndr_pull(pull, NDR_IN, r);
2210	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2211		talloc_free(r);
2212		return false;
2213	}
2214
2215	if (DEBUGLEVEL >= 10) {
2216		NDR_PRINT_IN_DEBUG(svcctl_OpenSCManagerA, r);
2217	}
2218
2219	ZERO_STRUCT(r->out);
2220	r->out.handle = talloc_zero(r, struct policy_handle);
2221	if (r->out.handle == NULL) {
2222		talloc_free(r);
2223		return false;
2224	}
2225
2226	r->out.result = _svcctl_OpenSCManagerA(p, r);
2227
2228	if (p->rng_fault_state) {
2229		talloc_free(r);
2230		/* Return true here, srv_pipe_hnd.c will take care */
2231		return true;
2232	}
2233
2234	if (DEBUGLEVEL >= 10) {
2235		NDR_PRINT_OUT_DEBUG(svcctl_OpenSCManagerA, r);
2236	}
2237
2238	push = ndr_push_init_ctx(r, NULL);
2239	if (push == NULL) {
2240		talloc_free(r);
2241		return false;
2242	}
2243
2244	ndr_err = call->ndr_push(push, NDR_OUT, r);
2245	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2246		talloc_free(r);
2247		return false;
2248	}
2249
2250	blob = ndr_push_blob(push);
2251	if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2252		talloc_free(r);
2253		return false;
2254	}
2255
2256	talloc_free(r);
2257
2258	return true;
2259}
2260
2261static bool api_svcctl_OpenServiceA(pipes_struct *p)
2262{
2263	const struct ndr_interface_call *call;
2264	struct ndr_pull *pull;
2265	struct ndr_push *push;
2266	enum ndr_err_code ndr_err;
2267	DATA_BLOB blob;
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	if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2278		talloc_free(r);
2279		return false;
2280	}
2281
2282	pull = ndr_pull_init_blob(&blob, r, NULL);
2283	if (pull == NULL) {
2284		talloc_free(r);
2285		return false;
2286	}
2287
2288	pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2289	ndr_err = call->ndr_pull(pull, NDR_IN, r);
2290	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2291		talloc_free(r);
2292		return false;
2293	}
2294
2295	if (DEBUGLEVEL >= 10) {
2296		NDR_PRINT_IN_DEBUG(svcctl_OpenServiceA, r);
2297	}
2298
2299	r->out.result = _svcctl_OpenServiceA(p, r);
2300
2301	if (p->rng_fault_state) {
2302		talloc_free(r);
2303		/* Return true here, srv_pipe_hnd.c will take care */
2304		return true;
2305	}
2306
2307	if (DEBUGLEVEL >= 10) {
2308		NDR_PRINT_OUT_DEBUG(svcctl_OpenServiceA, r);
2309	}
2310
2311	push = ndr_push_init_ctx(r, NULL);
2312	if (push == NULL) {
2313		talloc_free(r);
2314		return false;
2315	}
2316
2317	ndr_err = call->ndr_push(push, NDR_OUT, r);
2318	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2319		talloc_free(r);
2320		return false;
2321	}
2322
2323	blob = ndr_push_blob(push);
2324	if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2325		talloc_free(r);
2326		return false;
2327	}
2328
2329	talloc_free(r);
2330
2331	return true;
2332}
2333
2334static bool api_svcctl_QueryServiceConfigA(pipes_struct *p)
2335{
2336	const struct ndr_interface_call *call;
2337	struct ndr_pull *pull;
2338	struct ndr_push *push;
2339	enum ndr_err_code ndr_err;
2340	DATA_BLOB blob;
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	if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2351		talloc_free(r);
2352		return false;
2353	}
2354
2355	pull = ndr_pull_init_blob(&blob, r, NULL);
2356	if (pull == NULL) {
2357		talloc_free(r);
2358		return false;
2359	}
2360
2361	pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2362	ndr_err = call->ndr_pull(pull, NDR_IN, r);
2363	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2364		talloc_free(r);
2365		return false;
2366	}
2367
2368	if (DEBUGLEVEL >= 10) {
2369		NDR_PRINT_IN_DEBUG(svcctl_QueryServiceConfigA, r);
2370	}
2371
2372	ZERO_STRUCT(r->out);
2373	r->out.query = talloc_zero_array(r, uint8_t, r->in.offered);
2374	if (r->out.query == NULL) {
2375		talloc_free(r);
2376		return false;
2377	}
2378
2379	r->out.needed = talloc_zero(r, uint32_t);
2380	if (r->out.needed == NULL) {
2381		talloc_free(r);
2382		return false;
2383	}
2384
2385	r->out.result = _svcctl_QueryServiceConfigA(p, r);
2386
2387	if (p->rng_fault_state) {
2388		talloc_free(r);
2389		/* Return true here, srv_pipe_hnd.c will take care */
2390		return true;
2391	}
2392
2393	if (DEBUGLEVEL >= 10) {
2394		NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceConfigA, r);
2395	}
2396
2397	push = ndr_push_init_ctx(r, NULL);
2398	if (push == NULL) {
2399		talloc_free(r);
2400		return false;
2401	}
2402
2403	ndr_err = call->ndr_push(push, NDR_OUT, r);
2404	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2405		talloc_free(r);
2406		return false;
2407	}
2408
2409	blob = ndr_push_blob(push);
2410	if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2411		talloc_free(r);
2412		return false;
2413	}
2414
2415	talloc_free(r);
2416
2417	return true;
2418}
2419
2420static bool api_svcctl_QueryServiceLockStatusA(pipes_struct *p)
2421{
2422	const struct ndr_interface_call *call;
2423	struct ndr_pull *pull;
2424	struct ndr_push *push;
2425	enum ndr_err_code ndr_err;
2426	DATA_BLOB blob;
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	if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2437		talloc_free(r);
2438		return false;
2439	}
2440
2441	pull = ndr_pull_init_blob(&blob, r, NULL);
2442	if (pull == NULL) {
2443		talloc_free(r);
2444		return false;
2445	}
2446
2447	pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2448	ndr_err = call->ndr_pull(pull, NDR_IN, r);
2449	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2450		talloc_free(r);
2451		return false;
2452	}
2453
2454	if (DEBUGLEVEL >= 10) {
2455		NDR_PRINT_IN_DEBUG(svcctl_QueryServiceLockStatusA, r);
2456	}
2457
2458	ZERO_STRUCT(r->out);
2459	r->out.lock_status = talloc_zero(r, struct SERVICE_LOCK_STATUS);
2460	if (r->out.lock_status == NULL) {
2461		talloc_free(r);
2462		return false;
2463	}
2464
2465	r->out.needed = talloc_zero(r, uint32_t);
2466	if (r->out.needed == NULL) {
2467		talloc_free(r);
2468		return false;
2469	}
2470
2471	r->out.result = _svcctl_QueryServiceLockStatusA(p, r);
2472
2473	if (p->rng_fault_state) {
2474		talloc_free(r);
2475		/* Return true here, srv_pipe_hnd.c will take care */
2476		return true;
2477	}
2478
2479	if (DEBUGLEVEL >= 10) {
2480		NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceLockStatusA, r);
2481	}
2482
2483	push = ndr_push_init_ctx(r, NULL);
2484	if (push == NULL) {
2485		talloc_free(r);
2486		return false;
2487	}
2488
2489	ndr_err = call->ndr_push(push, NDR_OUT, r);
2490	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2491		talloc_free(r);
2492		return false;
2493	}
2494
2495	blob = ndr_push_blob(push);
2496	if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2497		talloc_free(r);
2498		return false;
2499	}
2500
2501	talloc_free(r);
2502
2503	return true;
2504}
2505
2506static bool api_svcctl_StartServiceA(pipes_struct *p)
2507{
2508	const struct ndr_interface_call *call;
2509	struct ndr_pull *pull;
2510	struct ndr_push *push;
2511	enum ndr_err_code ndr_err;
2512	DATA_BLOB blob;
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	if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2523		talloc_free(r);
2524		return false;
2525	}
2526
2527	pull = ndr_pull_init_blob(&blob, r, NULL);
2528	if (pull == NULL) {
2529		talloc_free(r);
2530		return false;
2531	}
2532
2533	pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2534	ndr_err = call->ndr_pull(pull, NDR_IN, r);
2535	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2536		talloc_free(r);
2537		return false;
2538	}
2539
2540	if (DEBUGLEVEL >= 10) {
2541		NDR_PRINT_IN_DEBUG(svcctl_StartServiceA, r);
2542	}
2543
2544	r->out.result = _svcctl_StartServiceA(p, r);
2545
2546	if (p->rng_fault_state) {
2547		talloc_free(r);
2548		/* Return true here, srv_pipe_hnd.c will take care */
2549		return true;
2550	}
2551
2552	if (DEBUGLEVEL >= 10) {
2553		NDR_PRINT_OUT_DEBUG(svcctl_StartServiceA, r);
2554	}
2555
2556	push = ndr_push_init_ctx(r, NULL);
2557	if (push == NULL) {
2558		talloc_free(r);
2559		return false;
2560	}
2561
2562	ndr_err = call->ndr_push(push, NDR_OUT, r);
2563	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2564		talloc_free(r);
2565		return false;
2566	}
2567
2568	blob = ndr_push_blob(push);
2569	if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2570		talloc_free(r);
2571		return false;
2572	}
2573
2574	talloc_free(r);
2575
2576	return true;
2577}
2578
2579static bool api_svcctl_GetServiceDisplayNameA(pipes_struct *p)
2580{
2581	const struct ndr_interface_call *call;
2582	struct ndr_pull *pull;
2583	struct ndr_push *push;
2584	enum ndr_err_code ndr_err;
2585	DATA_BLOB blob;
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	if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2596		talloc_free(r);
2597		return false;
2598	}
2599
2600	pull = ndr_pull_init_blob(&blob, r, NULL);
2601	if (pull == NULL) {
2602		talloc_free(r);
2603		return false;
2604	}
2605
2606	pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2607	ndr_err = call->ndr_pull(pull, NDR_IN, r);
2608	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2609		talloc_free(r);
2610		return false;
2611	}
2612
2613	if (DEBUGLEVEL >= 10) {
2614		NDR_PRINT_IN_DEBUG(svcctl_GetServiceDisplayNameA, r);
2615	}
2616
2617	ZERO_STRUCT(r->out);
2618	r->out.display_name_length = r->in.display_name_length;
2619	r->out.display_name = talloc_zero(r, const char *);
2620	if (r->out.display_name == NULL) {
2621		talloc_free(r);
2622		return false;
2623	}
2624
2625	r->out.result = _svcctl_GetServiceDisplayNameA(p, r);
2626
2627	if (p->rng_fault_state) {
2628		talloc_free(r);
2629		/* Return true here, srv_pipe_hnd.c will take care */
2630		return true;
2631	}
2632
2633	if (DEBUGLEVEL >= 10) {
2634		NDR_PRINT_OUT_DEBUG(svcctl_GetServiceDisplayNameA, r);
2635	}
2636
2637	push = ndr_push_init_ctx(r, NULL);
2638	if (push == NULL) {
2639		talloc_free(r);
2640		return false;
2641	}
2642
2643	ndr_err = call->ndr_push(push, NDR_OUT, r);
2644	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2645		talloc_free(r);
2646		return false;
2647	}
2648
2649	blob = ndr_push_blob(push);
2650	if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2651		talloc_free(r);
2652		return false;
2653	}
2654
2655	talloc_free(r);
2656
2657	return true;
2658}
2659
2660static bool api_svcctl_GetServiceKeyNameA(pipes_struct *p)
2661{
2662	const struct ndr_interface_call *call;
2663	struct ndr_pull *pull;
2664	struct ndr_push *push;
2665	enum ndr_err_code ndr_err;
2666	DATA_BLOB blob;
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	if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2677		talloc_free(r);
2678		return false;
2679	}
2680
2681	pull = ndr_pull_init_blob(&blob, r, NULL);
2682	if (pull == NULL) {
2683		talloc_free(r);
2684		return false;
2685	}
2686
2687	pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2688	ndr_err = call->ndr_pull(pull, NDR_IN, r);
2689	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2690		talloc_free(r);
2691		return false;
2692	}
2693
2694	if (DEBUGLEVEL >= 10) {
2695		NDR_PRINT_IN_DEBUG(svcctl_GetServiceKeyNameA, r);
2696	}
2697
2698	ZERO_STRUCT(r->out);
2699	r->out.display_name_length = r->in.display_name_length;
2700	r->out.key_name = talloc_zero(r, const char *);
2701	if (r->out.key_name == NULL) {
2702		talloc_free(r);
2703		return false;
2704	}
2705
2706	r->out.result = _svcctl_GetServiceKeyNameA(p, r);
2707
2708	if (p->rng_fault_state) {
2709		talloc_free(r);
2710		/* Return true here, srv_pipe_hnd.c will take care */
2711		return true;
2712	}
2713
2714	if (DEBUGLEVEL >= 10) {
2715		NDR_PRINT_OUT_DEBUG(svcctl_GetServiceKeyNameA, r);
2716	}
2717
2718	push = ndr_push_init_ctx(r, NULL);
2719	if (push == NULL) {
2720		talloc_free(r);
2721		return false;
2722	}
2723
2724	ndr_err = call->ndr_push(push, NDR_OUT, r);
2725	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2726		talloc_free(r);
2727		return false;
2728	}
2729
2730	blob = ndr_push_blob(push);
2731	if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2732		talloc_free(r);
2733		return false;
2734	}
2735
2736	talloc_free(r);
2737
2738	return true;
2739}
2740
2741static bool api_svcctl_GetCurrentGroupeStateW(pipes_struct *p)
2742{
2743	const struct ndr_interface_call *call;
2744	struct ndr_pull *pull;
2745	struct ndr_push *push;
2746	enum ndr_err_code ndr_err;
2747	DATA_BLOB blob;
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	if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2758		talloc_free(r);
2759		return false;
2760	}
2761
2762	pull = ndr_pull_init_blob(&blob, r, NULL);
2763	if (pull == NULL) {
2764		talloc_free(r);
2765		return false;
2766	}
2767
2768	pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2769	ndr_err = call->ndr_pull(pull, NDR_IN, r);
2770	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2771		talloc_free(r);
2772		return false;
2773	}
2774
2775	if (DEBUGLEVEL >= 10) {
2776		NDR_PRINT_IN_DEBUG(svcctl_GetCurrentGroupeStateW, r);
2777	}
2778
2779	r->out.result = _svcctl_GetCurrentGroupeStateW(p, r);
2780
2781	if (p->rng_fault_state) {
2782		talloc_free(r);
2783		/* Return true here, srv_pipe_hnd.c will take care */
2784		return true;
2785	}
2786
2787	if (DEBUGLEVEL >= 10) {
2788		NDR_PRINT_OUT_DEBUG(svcctl_GetCurrentGroupeStateW, r);
2789	}
2790
2791	push = ndr_push_init_ctx(r, NULL);
2792	if (push == NULL) {
2793		talloc_free(r);
2794		return false;
2795	}
2796
2797	ndr_err = call->ndr_push(push, NDR_OUT, r);
2798	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2799		talloc_free(r);
2800		return false;
2801	}
2802
2803	blob = ndr_push_blob(push);
2804	if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2805		talloc_free(r);
2806		return false;
2807	}
2808
2809	talloc_free(r);
2810
2811	return true;
2812}
2813
2814static bool api_svcctl_EnumServiceGroupW(pipes_struct *p)
2815{
2816	const struct ndr_interface_call *call;
2817	struct ndr_pull *pull;
2818	struct ndr_push *push;
2819	enum ndr_err_code ndr_err;
2820	DATA_BLOB blob;
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	if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2831		talloc_free(r);
2832		return false;
2833	}
2834
2835	pull = ndr_pull_init_blob(&blob, r, NULL);
2836	if (pull == NULL) {
2837		talloc_free(r);
2838		return false;
2839	}
2840
2841	pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2842	ndr_err = call->ndr_pull(pull, NDR_IN, r);
2843	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2844		talloc_free(r);
2845		return false;
2846	}
2847
2848	if (DEBUGLEVEL >= 10) {
2849		NDR_PRINT_IN_DEBUG(svcctl_EnumServiceGroupW, r);
2850	}
2851
2852	r->out.result = _svcctl_EnumServiceGroupW(p, r);
2853
2854	if (p->rng_fault_state) {
2855		talloc_free(r);
2856		/* Return true here, srv_pipe_hnd.c will take care */
2857		return true;
2858	}
2859
2860	if (DEBUGLEVEL >= 10) {
2861		NDR_PRINT_OUT_DEBUG(svcctl_EnumServiceGroupW, r);
2862	}
2863
2864	push = ndr_push_init_ctx(r, NULL);
2865	if (push == NULL) {
2866		talloc_free(r);
2867		return false;
2868	}
2869
2870	ndr_err = call->ndr_push(push, NDR_OUT, r);
2871	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2872		talloc_free(r);
2873		return false;
2874	}
2875
2876	blob = ndr_push_blob(push);
2877	if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2878		talloc_free(r);
2879		return false;
2880	}
2881
2882	talloc_free(r);
2883
2884	return true;
2885}
2886
2887static bool api_svcctl_ChangeServiceConfig2A(pipes_struct *p)
2888{
2889	const struct ndr_interface_call *call;
2890	struct ndr_pull *pull;
2891	struct ndr_push *push;
2892	enum ndr_err_code ndr_err;
2893	DATA_BLOB blob;
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	if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2904		talloc_free(r);
2905		return false;
2906	}
2907
2908	pull = ndr_pull_init_blob(&blob, r, NULL);
2909	if (pull == NULL) {
2910		talloc_free(r);
2911		return false;
2912	}
2913
2914	pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2915	ndr_err = call->ndr_pull(pull, NDR_IN, r);
2916	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2917		talloc_free(r);
2918		return false;
2919	}
2920
2921	if (DEBUGLEVEL >= 10) {
2922		NDR_PRINT_IN_DEBUG(svcctl_ChangeServiceConfig2A, r);
2923	}
2924
2925	r->out.result = _svcctl_ChangeServiceConfig2A(p, r);
2926
2927	if (p->rng_fault_state) {
2928		talloc_free(r);
2929		/* Return true here, srv_pipe_hnd.c will take care */
2930		return true;
2931	}
2932
2933	if (DEBUGLEVEL >= 10) {
2934		NDR_PRINT_OUT_DEBUG(svcctl_ChangeServiceConfig2A, r);
2935	}
2936
2937	push = ndr_push_init_ctx(r, NULL);
2938	if (push == NULL) {
2939		talloc_free(r);
2940		return false;
2941	}
2942
2943	ndr_err = call->ndr_push(push, NDR_OUT, r);
2944	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2945		talloc_free(r);
2946		return false;
2947	}
2948
2949	blob = ndr_push_blob(push);
2950	if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
2951		talloc_free(r);
2952		return false;
2953	}
2954
2955	talloc_free(r);
2956
2957	return true;
2958}
2959
2960static bool api_svcctl_ChangeServiceConfig2W(pipes_struct *p)
2961{
2962	const struct ndr_interface_call *call;
2963	struct ndr_pull *pull;
2964	struct ndr_push *push;
2965	enum ndr_err_code ndr_err;
2966	DATA_BLOB blob;
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	if (!prs_data_blob(&p->in_data.data, &blob, r)) {
2977		talloc_free(r);
2978		return false;
2979	}
2980
2981	pull = ndr_pull_init_blob(&blob, r, NULL);
2982	if (pull == NULL) {
2983		talloc_free(r);
2984		return false;
2985	}
2986
2987	pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2988	ndr_err = call->ndr_pull(pull, NDR_IN, r);
2989	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
2990		talloc_free(r);
2991		return false;
2992	}
2993
2994	if (DEBUGLEVEL >= 10) {
2995		NDR_PRINT_IN_DEBUG(svcctl_ChangeServiceConfig2W, r);
2996	}
2997
2998	r->out.result = _svcctl_ChangeServiceConfig2W(p, r);
2999
3000	if (p->rng_fault_state) {
3001		talloc_free(r);
3002		/* Return true here, srv_pipe_hnd.c will take care */
3003		return true;
3004	}
3005
3006	if (DEBUGLEVEL >= 10) {
3007		NDR_PRINT_OUT_DEBUG(svcctl_ChangeServiceConfig2W, r);
3008	}
3009
3010	push = ndr_push_init_ctx(r, NULL);
3011	if (push == NULL) {
3012		talloc_free(r);
3013		return false;
3014	}
3015
3016	ndr_err = call->ndr_push(push, NDR_OUT, r);
3017	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3018		talloc_free(r);
3019		return false;
3020	}
3021
3022	blob = ndr_push_blob(push);
3023	if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3024		talloc_free(r);
3025		return false;
3026	}
3027
3028	talloc_free(r);
3029
3030	return true;
3031}
3032
3033static bool api_svcctl_QueryServiceConfig2A(pipes_struct *p)
3034{
3035	const struct ndr_interface_call *call;
3036	struct ndr_pull *pull;
3037	struct ndr_push *push;
3038	enum ndr_err_code ndr_err;
3039	DATA_BLOB blob;
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	if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3050		talloc_free(r);
3051		return false;
3052	}
3053
3054	pull = ndr_pull_init_blob(&blob, r, NULL);
3055	if (pull == NULL) {
3056		talloc_free(r);
3057		return false;
3058	}
3059
3060	pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3061	ndr_err = call->ndr_pull(pull, NDR_IN, r);
3062	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3063		talloc_free(r);
3064		return false;
3065	}
3066
3067	if (DEBUGLEVEL >= 10) {
3068		NDR_PRINT_IN_DEBUG(svcctl_QueryServiceConfig2A, r);
3069	}
3070
3071	ZERO_STRUCT(r->out);
3072	r->out.buffer = talloc_zero_array(r, uint8_t, r->in.offered);
3073	if (r->out.buffer == NULL) {
3074		talloc_free(r);
3075		return false;
3076	}
3077
3078	r->out.needed = talloc_zero(r, uint32_t);
3079	if (r->out.needed == NULL) {
3080		talloc_free(r);
3081		return false;
3082	}
3083
3084	r->out.result = _svcctl_QueryServiceConfig2A(p, r);
3085
3086	if (p->rng_fault_state) {
3087		talloc_free(r);
3088		/* Return true here, srv_pipe_hnd.c will take care */
3089		return true;
3090	}
3091
3092	if (DEBUGLEVEL >= 10) {
3093		NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceConfig2A, r);
3094	}
3095
3096	push = ndr_push_init_ctx(r, NULL);
3097	if (push == NULL) {
3098		talloc_free(r);
3099		return false;
3100	}
3101
3102	ndr_err = call->ndr_push(push, NDR_OUT, r);
3103	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3104		talloc_free(r);
3105		return false;
3106	}
3107
3108	blob = ndr_push_blob(push);
3109	if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3110		talloc_free(r);
3111		return false;
3112	}
3113
3114	talloc_free(r);
3115
3116	return true;
3117}
3118
3119static bool api_svcctl_QueryServiceConfig2W(pipes_struct *p)
3120{
3121	const struct ndr_interface_call *call;
3122	struct ndr_pull *pull;
3123	struct ndr_push *push;
3124	enum ndr_err_code ndr_err;
3125	DATA_BLOB blob;
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	if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3136		talloc_free(r);
3137		return false;
3138	}
3139
3140	pull = ndr_pull_init_blob(&blob, r, NULL);
3141	if (pull == NULL) {
3142		talloc_free(r);
3143		return false;
3144	}
3145
3146	pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3147	ndr_err = call->ndr_pull(pull, NDR_IN, r);
3148	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3149		talloc_free(r);
3150		return false;
3151	}
3152
3153	if (DEBUGLEVEL >= 10) {
3154		NDR_PRINT_IN_DEBUG(svcctl_QueryServiceConfig2W, r);
3155	}
3156
3157	ZERO_STRUCT(r->out);
3158	r->out.buffer = talloc_zero_array(r, uint8_t, r->in.offered);
3159	if (r->out.buffer == NULL) {
3160		talloc_free(r);
3161		return false;
3162	}
3163
3164	r->out.needed = talloc_zero(r, uint32_t);
3165	if (r->out.needed == NULL) {
3166		talloc_free(r);
3167		return false;
3168	}
3169
3170	r->out.result = _svcctl_QueryServiceConfig2W(p, r);
3171
3172	if (p->rng_fault_state) {
3173		talloc_free(r);
3174		/* Return true here, srv_pipe_hnd.c will take care */
3175		return true;
3176	}
3177
3178	if (DEBUGLEVEL >= 10) {
3179		NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceConfig2W, r);
3180	}
3181
3182	push = ndr_push_init_ctx(r, NULL);
3183	if (push == NULL) {
3184		talloc_free(r);
3185		return false;
3186	}
3187
3188	ndr_err = call->ndr_push(push, NDR_OUT, r);
3189	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3190		talloc_free(r);
3191		return false;
3192	}
3193
3194	blob = ndr_push_blob(push);
3195	if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3196		talloc_free(r);
3197		return false;
3198	}
3199
3200	talloc_free(r);
3201
3202	return true;
3203}
3204
3205static bool api_svcctl_QueryServiceStatusEx(pipes_struct *p)
3206{
3207	const struct ndr_interface_call *call;
3208	struct ndr_pull *pull;
3209	struct ndr_push *push;
3210	enum ndr_err_code ndr_err;
3211	DATA_BLOB blob;
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	if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3222		talloc_free(r);
3223		return false;
3224	}
3225
3226	pull = ndr_pull_init_blob(&blob, r, NULL);
3227	if (pull == NULL) {
3228		talloc_free(r);
3229		return false;
3230	}
3231
3232	pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3233	ndr_err = call->ndr_pull(pull, NDR_IN, r);
3234	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3235		talloc_free(r);
3236		return false;
3237	}
3238
3239	if (DEBUGLEVEL >= 10) {
3240		NDR_PRINT_IN_DEBUG(svcctl_QueryServiceStatusEx, r);
3241	}
3242
3243	ZERO_STRUCT(r->out);
3244	r->out.buffer = talloc_zero_array(r, uint8_t, r->in.offered);
3245	if (r->out.buffer == NULL) {
3246		talloc_free(r);
3247		return false;
3248	}
3249
3250	r->out.needed = talloc_zero(r, uint32_t);
3251	if (r->out.needed == NULL) {
3252		talloc_free(r);
3253		return false;
3254	}
3255
3256	r->out.result = _svcctl_QueryServiceStatusEx(p, r);
3257
3258	if (p->rng_fault_state) {
3259		talloc_free(r);
3260		/* Return true here, srv_pipe_hnd.c will take care */
3261		return true;
3262	}
3263
3264	if (DEBUGLEVEL >= 10) {
3265		NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceStatusEx, r);
3266	}
3267
3268	push = ndr_push_init_ctx(r, NULL);
3269	if (push == NULL) {
3270		talloc_free(r);
3271		return false;
3272	}
3273
3274	ndr_err = call->ndr_push(push, NDR_OUT, r);
3275	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3276		talloc_free(r);
3277		return false;
3278	}
3279
3280	blob = ndr_push_blob(push);
3281	if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3282		talloc_free(r);
3283		return false;
3284	}
3285
3286	talloc_free(r);
3287
3288	return true;
3289}
3290
3291static bool api_EnumServicesStatusExA(pipes_struct *p)
3292{
3293	const struct ndr_interface_call *call;
3294	struct ndr_pull *pull;
3295	struct ndr_push *push;
3296	enum ndr_err_code ndr_err;
3297	DATA_BLOB blob;
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	if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3308		talloc_free(r);
3309		return false;
3310	}
3311
3312	pull = ndr_pull_init_blob(&blob, r, NULL);
3313	if (pull == NULL) {
3314		talloc_free(r);
3315		return false;
3316	}
3317
3318	pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3319	ndr_err = call->ndr_pull(pull, NDR_IN, r);
3320	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3321		talloc_free(r);
3322		return false;
3323	}
3324
3325	if (DEBUGLEVEL >= 10) {
3326		NDR_PRINT_IN_DEBUG(EnumServicesStatusExA, r);
3327	}
3328
3329	ZERO_STRUCT(r->out);
3330	r->out.resume_handle = r->in.resume_handle;
3331	r->out.services = talloc_zero_array(r, uint8_t, r->in.offered);
3332	if (r->out.services == NULL) {
3333		talloc_free(r);
3334		return false;
3335	}
3336
3337	r->out.needed = talloc_zero(r, uint32_t);
3338	if (r->out.needed == NULL) {
3339		talloc_free(r);
3340		return false;
3341	}
3342
3343	r->out.service_returned = talloc_zero(r, uint32_t);
3344	if (r->out.service_returned == NULL) {
3345		talloc_free(r);
3346		return false;
3347	}
3348
3349	r->out.group_name = talloc_zero(r, const char *);
3350	if (r->out.group_name == NULL) {
3351		talloc_free(r);
3352		return false;
3353	}
3354
3355	r->out.result = _EnumServicesStatusExA(p, r);
3356
3357	if (p->rng_fault_state) {
3358		talloc_free(r);
3359		/* Return true here, srv_pipe_hnd.c will take care */
3360		return true;
3361	}
3362
3363	if (DEBUGLEVEL >= 10) {
3364		NDR_PRINT_OUT_DEBUG(EnumServicesStatusExA, r);
3365	}
3366
3367	push = ndr_push_init_ctx(r, NULL);
3368	if (push == NULL) {
3369		talloc_free(r);
3370		return false;
3371	}
3372
3373	ndr_err = call->ndr_push(push, NDR_OUT, r);
3374	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3375		talloc_free(r);
3376		return false;
3377	}
3378
3379	blob = ndr_push_blob(push);
3380	if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3381		talloc_free(r);
3382		return false;
3383	}
3384
3385	talloc_free(r);
3386
3387	return true;
3388}
3389
3390static bool api_EnumServicesStatusExW(pipes_struct *p)
3391{
3392	const struct ndr_interface_call *call;
3393	struct ndr_pull *pull;
3394	struct ndr_push *push;
3395	enum ndr_err_code ndr_err;
3396	DATA_BLOB blob;
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	if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3407		talloc_free(r);
3408		return false;
3409	}
3410
3411	pull = ndr_pull_init_blob(&blob, r, NULL);
3412	if (pull == NULL) {
3413		talloc_free(r);
3414		return false;
3415	}
3416
3417	pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3418	ndr_err = call->ndr_pull(pull, NDR_IN, r);
3419	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3420		talloc_free(r);
3421		return false;
3422	}
3423
3424	if (DEBUGLEVEL >= 10) {
3425		NDR_PRINT_IN_DEBUG(EnumServicesStatusExW, r);
3426	}
3427
3428	ZERO_STRUCT(r->out);
3429	r->out.resume_handle = r->in.resume_handle;
3430	r->out.services = talloc_zero_array(r, uint8_t, r->in.offered);
3431	if (r->out.services == NULL) {
3432		talloc_free(r);
3433		return false;
3434	}
3435
3436	r->out.needed = talloc_zero(r, uint32_t);
3437	if (r->out.needed == NULL) {
3438		talloc_free(r);
3439		return false;
3440	}
3441
3442	r->out.service_returned = talloc_zero(r, uint32_t);
3443	if (r->out.service_returned == NULL) {
3444		talloc_free(r);
3445		return false;
3446	}
3447
3448	r->out.result = _EnumServicesStatusExW(p, r);
3449
3450	if (p->rng_fault_state) {
3451		talloc_free(r);
3452		/* Return true here, srv_pipe_hnd.c will take care */
3453		return true;
3454	}
3455
3456	if (DEBUGLEVEL >= 10) {
3457		NDR_PRINT_OUT_DEBUG(EnumServicesStatusExW, r);
3458	}
3459
3460	push = ndr_push_init_ctx(r, NULL);
3461	if (push == NULL) {
3462		talloc_free(r);
3463		return false;
3464	}
3465
3466	ndr_err = call->ndr_push(push, NDR_OUT, r);
3467	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3468		talloc_free(r);
3469		return false;
3470	}
3471
3472	blob = ndr_push_blob(push);
3473	if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3474		talloc_free(r);
3475		return false;
3476	}
3477
3478	talloc_free(r);
3479
3480	return true;
3481}
3482
3483static bool api_svcctl_SCSendTSMessage(pipes_struct *p)
3484{
3485	const struct ndr_interface_call *call;
3486	struct ndr_pull *pull;
3487	struct ndr_push *push;
3488	enum ndr_err_code ndr_err;
3489	DATA_BLOB blob;
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	if (!prs_data_blob(&p->in_data.data, &blob, r)) {
3500		talloc_free(r);
3501		return false;
3502	}
3503
3504	pull = ndr_pull_init_blob(&blob, r, NULL);
3505	if (pull == NULL) {
3506		talloc_free(r);
3507		return false;
3508	}
3509
3510	pull->flags |= LIBNDR_FLAG_REF_ALLOC;
3511	ndr_err = call->ndr_pull(pull, NDR_IN, r);
3512	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3513		talloc_free(r);
3514		return false;
3515	}
3516
3517	if (DEBUGLEVEL >= 10) {
3518		NDR_PRINT_IN_DEBUG(svcctl_SCSendTSMessage, r);
3519	}
3520
3521	r->out.result = _svcctl_SCSendTSMessage(p, r);
3522
3523	if (p->rng_fault_state) {
3524		talloc_free(r);
3525		/* Return true here, srv_pipe_hnd.c will take care */
3526		return true;
3527	}
3528
3529	if (DEBUGLEVEL >= 10) {
3530		NDR_PRINT_OUT_DEBUG(svcctl_SCSendTSMessage, r);
3531	}
3532
3533	push = ndr_push_init_ctx(r, NULL);
3534	if (push == NULL) {
3535		talloc_free(r);
3536		return false;
3537	}
3538
3539	ndr_err = call->ndr_push(push, NDR_OUT, r);
3540	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
3541		talloc_free(r);
3542		return false;
3543	}
3544
3545	blob = ndr_push_blob(push);
3546	if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) {
3547		talloc_free(r);
3548		return false;
3549	}
3550
3551	talloc_free(r);
3552
3553	return true;
3554}
3555
3556
3557/* Tables */
3558static struct api_struct api_svcctl_cmds[] =
3559{
3560	{"SVCCTL_CLOSESERVICEHANDLE", NDR_SVCCTL_CLOSESERVICEHANDLE, api_svcctl_CloseServiceHandle},
3561	{"SVCCTL_CONTROLSERVICE", NDR_SVCCTL_CONTROLSERVICE, api_svcctl_ControlService},
3562	{"SVCCTL_DELETESERVICE", NDR_SVCCTL_DELETESERVICE, api_svcctl_DeleteService},
3563	{"SVCCTL_LOCKSERVICEDATABASE", NDR_SVCCTL_LOCKSERVICEDATABASE, api_svcctl_LockServiceDatabase},
3564	{"SVCCTL_QUERYSERVICEOBJECTSECURITY", NDR_SVCCTL_QUERYSERVICEOBJECTSECURITY, api_svcctl_QueryServiceObjectSecurity},
3565	{"SVCCTL_SETSERVICEOBJECTSECURITY", NDR_SVCCTL_SETSERVICEOBJECTSECURITY, api_svcctl_SetServiceObjectSecurity},
3566	{"SVCCTL_QUERYSERVICESTATUS", NDR_SVCCTL_QUERYSERVICESTATUS, api_svcctl_QueryServiceStatus},
3567	{"SVCCTL_SETSERVICESTATUS", NDR_SVCCTL_SETSERVICESTATUS, api_svcctl_SetServiceStatus},
3568	{"SVCCTL_UNLOCKSERVICEDATABASE", NDR_SVCCTL_UNLOCKSERVICEDATABASE, api_svcctl_UnlockServiceDatabase},
3569	{"SVCCTL_NOTIFYBOOTCONFIGSTATUS", NDR_SVCCTL_NOTIFYBOOTCONFIGSTATUS, api_svcctl_NotifyBootConfigStatus},
3570	{"SVCCTL_SCSETSERVICEBITSW", NDR_SVCCTL_SCSETSERVICEBITSW, api_svcctl_SCSetServiceBitsW},
3571	{"SVCCTL_CHANGESERVICECONFIGW", NDR_SVCCTL_CHANGESERVICECONFIGW, api_svcctl_ChangeServiceConfigW},
3572	{"SVCCTL_CREATESERVICEW", NDR_SVCCTL_CREATESERVICEW, api_svcctl_CreateServiceW},
3573	{"SVCCTL_ENUMDEPENDENTSERVICESW", NDR_SVCCTL_ENUMDEPENDENTSERVICESW, api_svcctl_EnumDependentServicesW},
3574	{"SVCCTL_ENUMSERVICESSTATUSW", NDR_SVCCTL_ENUMSERVICESSTATUSW, api_svcctl_EnumServicesStatusW},
3575	{"SVCCTL_OPENSCMANAGERW", NDR_SVCCTL_OPENSCMANAGERW, api_svcctl_OpenSCManagerW},
3576	{"SVCCTL_OPENSERVICEW", NDR_SVCCTL_OPENSERVICEW, api_svcctl_OpenServiceW},
3577	{"SVCCTL_QUERYSERVICECONFIGW", NDR_SVCCTL_QUERYSERVICECONFIGW, api_svcctl_QueryServiceConfigW},
3578	{"SVCCTL_QUERYSERVICELOCKSTATUSW", NDR_SVCCTL_QUERYSERVICELOCKSTATUSW, api_svcctl_QueryServiceLockStatusW},
3579	{"SVCCTL_STARTSERVICEW", NDR_SVCCTL_STARTSERVICEW, api_svcctl_StartServiceW},
3580	{"SVCCTL_GETSERVICEDISPLAYNAMEW", NDR_SVCCTL_GETSERVICEDISPLAYNAMEW, api_svcctl_GetServiceDisplayNameW},
3581	{"SVCCTL_GETSERVICEKEYNAMEW", NDR_SVCCTL_GETSERVICEKEYNAMEW, api_svcctl_GetServiceKeyNameW},
3582	{"SVCCTL_SCSETSERVICEBITSA", NDR_SVCCTL_SCSETSERVICEBITSA, api_svcctl_SCSetServiceBitsA},
3583	{"SVCCTL_CHANGESERVICECONFIGA", NDR_SVCCTL_CHANGESERVICECONFIGA, api_svcctl_ChangeServiceConfigA},
3584	{"SVCCTL_CREATESERVICEA", NDR_SVCCTL_CREATESERVICEA, api_svcctl_CreateServiceA},
3585	{"SVCCTL_ENUMDEPENDENTSERVICESA", NDR_SVCCTL_ENUMDEPENDENTSERVICESA, api_svcctl_EnumDependentServicesA},
3586	{"SVCCTL_ENUMSERVICESSTATUSA", NDR_SVCCTL_ENUMSERVICESSTATUSA, api_svcctl_EnumServicesStatusA},
3587	{"SVCCTL_OPENSCMANAGERA", NDR_SVCCTL_OPENSCMANAGERA, api_svcctl_OpenSCManagerA},
3588	{"SVCCTL_OPENSERVICEA", NDR_SVCCTL_OPENSERVICEA, api_svcctl_OpenServiceA},
3589	{"SVCCTL_QUERYSERVICECONFIGA", NDR_SVCCTL_QUERYSERVICECONFIGA, api_svcctl_QueryServiceConfigA},
3590	{"SVCCTL_QUERYSERVICELOCKSTATUSA", NDR_SVCCTL_QUERYSERVICELOCKSTATUSA, api_svcctl_QueryServiceLockStatusA},
3591	{"SVCCTL_STARTSERVICEA", NDR_SVCCTL_STARTSERVICEA, api_svcctl_StartServiceA},
3592	{"SVCCTL_GETSERVICEDISPLAYNAMEA", NDR_SVCCTL_GETSERVICEDISPLAYNAMEA, api_svcctl_GetServiceDisplayNameA},
3593	{"SVCCTL_GETSERVICEKEYNAMEA", NDR_SVCCTL_GETSERVICEKEYNAMEA, api_svcctl_GetServiceKeyNameA},
3594	{"SVCCTL_GETCURRENTGROUPESTATEW", NDR_SVCCTL_GETCURRENTGROUPESTATEW, api_svcctl_GetCurrentGroupeStateW},
3595	{"SVCCTL_ENUMSERVICEGROUPW", NDR_SVCCTL_ENUMSERVICEGROUPW, api_svcctl_EnumServiceGroupW},
3596	{"SVCCTL_CHANGESERVICECONFIG2A", NDR_SVCCTL_CHANGESERVICECONFIG2A, api_svcctl_ChangeServiceConfig2A},
3597	{"SVCCTL_CHANGESERVICECONFIG2W", NDR_SVCCTL_CHANGESERVICECONFIG2W, api_svcctl_ChangeServiceConfig2W},
3598	{"SVCCTL_QUERYSERVICECONFIG2A", NDR_SVCCTL_QUERYSERVICECONFIG2A, api_svcctl_QueryServiceConfig2A},
3599	{"SVCCTL_QUERYSERVICECONFIG2W", NDR_SVCCTL_QUERYSERVICECONFIG2W, api_svcctl_QueryServiceConfig2W},
3600	{"SVCCTL_QUERYSERVICESTATUSEX", NDR_SVCCTL_QUERYSERVICESTATUSEX, api_svcctl_QueryServiceStatusEx},
3601	{"ENUMSERVICESSTATUSEXA", NDR_ENUMSERVICESSTATUSEXA, api_EnumServicesStatusExA},
3602	{"ENUMSERVICESSTATUSEXW", NDR_ENUMSERVICESSTATUSEXW, api_EnumServicesStatusExW},
3603	{"SVCCTL_SCSENDTSMESSAGE", NDR_SVCCTL_SCSENDTSMESSAGE, api_svcctl_SCSendTSMessage},
3604};
3605
3606void svcctl_get_pipe_fns(struct api_struct **fns, int *n_fns)
3607{
3608	*fns = api_svcctl_cmds;
3609	*n_fns = sizeof(api_svcctl_cmds) / sizeof(struct api_struct);
3610}
3611
3612NTSTATUS rpc_svcctl_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *_r)
3613{
3614	if (cli->pipes_struct == NULL) {
3615		return NT_STATUS_INVALID_PARAMETER;
3616	}
3617
3618	switch (opnum)
3619	{
3620		case NDR_SVCCTL_CLOSESERVICEHANDLE: {
3621			struct svcctl_CloseServiceHandle *r = (struct svcctl_CloseServiceHandle *)_r;
3622			ZERO_STRUCT(r->out);
3623			r->out.handle = r->in.handle;
3624			r->out.result = _svcctl_CloseServiceHandle(cli->pipes_struct, r);
3625			return NT_STATUS_OK;
3626		}
3627
3628		case NDR_SVCCTL_CONTROLSERVICE: {
3629			struct svcctl_ControlService *r = (struct svcctl_ControlService *)_r;
3630			ZERO_STRUCT(r->out);
3631			r->out.service_status = talloc_zero(mem_ctx, struct SERVICE_STATUS);
3632			if (r->out.service_status == NULL) {
3633			return NT_STATUS_NO_MEMORY;
3634			}
3635
3636			r->out.result = _svcctl_ControlService(cli->pipes_struct, r);
3637			return NT_STATUS_OK;
3638		}
3639
3640		case NDR_SVCCTL_DELETESERVICE: {
3641			struct svcctl_DeleteService *r = (struct svcctl_DeleteService *)_r;
3642			r->out.result = _svcctl_DeleteService(cli->pipes_struct, r);
3643			return NT_STATUS_OK;
3644		}
3645
3646		case NDR_SVCCTL_LOCKSERVICEDATABASE: {
3647			struct svcctl_LockServiceDatabase *r = (struct svcctl_LockServiceDatabase *)_r;
3648			ZERO_STRUCT(r->out);
3649			r->out.lock = talloc_zero(mem_ctx, struct policy_handle);
3650			if (r->out.lock == NULL) {
3651			return NT_STATUS_NO_MEMORY;
3652			}
3653
3654			r->out.result = _svcctl_LockServiceDatabase(cli->pipes_struct, r);
3655			return NT_STATUS_OK;
3656		}
3657
3658		case NDR_SVCCTL_QUERYSERVICEOBJECTSECURITY: {
3659			struct svcctl_QueryServiceObjectSecurity *r = (struct svcctl_QueryServiceObjectSecurity *)_r;
3660			ZERO_STRUCT(r->out);
3661			r->out.buffer = talloc_zero_array(mem_ctx, uint8_t, r->in.offered);
3662			if (r->out.buffer == NULL) {
3663			return NT_STATUS_NO_MEMORY;
3664			}
3665
3666			r->out.needed = talloc_zero(mem_ctx, uint32_t);
3667			if (r->out.needed == NULL) {
3668			return NT_STATUS_NO_MEMORY;
3669			}
3670
3671			r->out.result = _svcctl_QueryServiceObjectSecurity(cli->pipes_struct, r);
3672			return NT_STATUS_OK;
3673		}
3674
3675		case NDR_SVCCTL_SETSERVICEOBJECTSECURITY: {
3676			struct svcctl_SetServiceObjectSecurity *r = (struct svcctl_SetServiceObjectSecurity *)_r;
3677			r->out.result = _svcctl_SetServiceObjectSecurity(cli->pipes_struct, r);
3678			return NT_STATUS_OK;
3679		}
3680
3681		case NDR_SVCCTL_QUERYSERVICESTATUS: {
3682			struct svcctl_QueryServiceStatus *r = (struct svcctl_QueryServiceStatus *)_r;
3683			ZERO_STRUCT(r->out);
3684			r->out.service_status = talloc_zero(mem_ctx, struct SERVICE_STATUS);
3685			if (r->out.service_status == NULL) {
3686			return NT_STATUS_NO_MEMORY;
3687			}
3688
3689			r->out.result = _svcctl_QueryServiceStatus(cli->pipes_struct, r);
3690			return NT_STATUS_OK;
3691		}
3692
3693		case NDR_SVCCTL_SETSERVICESTATUS: {
3694			struct svcctl_SetServiceStatus *r = (struct svcctl_SetServiceStatus *)_r;
3695			r->out.result = _svcctl_SetServiceStatus(cli->pipes_struct, r);
3696			return NT_STATUS_OK;
3697		}
3698
3699		case NDR_SVCCTL_UNLOCKSERVICEDATABASE: {
3700			struct svcctl_UnlockServiceDatabase *r = (struct svcctl_UnlockServiceDatabase *)_r;
3701			ZERO_STRUCT(r->out);
3702			r->out.lock = r->in.lock;
3703			r->out.result = _svcctl_UnlockServiceDatabase(cli->pipes_struct, r);
3704			return NT_STATUS_OK;
3705		}
3706
3707		case NDR_SVCCTL_NOTIFYBOOTCONFIGSTATUS: {
3708			struct svcctl_NotifyBootConfigStatus *r = (struct svcctl_NotifyBootConfigStatus *)_r;
3709			r->out.result = _svcctl_NotifyBootConfigStatus(cli->pipes_struct, r);
3710			return NT_STATUS_OK;
3711		}
3712
3713		case NDR_SVCCTL_SCSETSERVICEBITSW: {
3714			struct svcctl_SCSetServiceBitsW *r = (struct svcctl_SCSetServiceBitsW *)_r;
3715			r->out.result = _svcctl_SCSetServiceBitsW(cli->pipes_struct, r);
3716			return NT_STATUS_OK;
3717		}
3718
3719		case NDR_SVCCTL_CHANGESERVICECONFIGW: {
3720			struct svcctl_ChangeServiceConfigW *r = (struct svcctl_ChangeServiceConfigW *)_r;
3721			ZERO_STRUCT(r->out);
3722			r->out.tag_id = talloc_zero(mem_ctx, uint32_t);
3723			if (r->out.tag_id == NULL) {
3724			return NT_STATUS_NO_MEMORY;
3725			}
3726
3727			r->out.result = _svcctl_ChangeServiceConfigW(cli->pipes_struct, r);
3728			return NT_STATUS_OK;
3729		}
3730
3731		case NDR_SVCCTL_CREATESERVICEW: {
3732			struct svcctl_CreateServiceW *r = (struct svcctl_CreateServiceW *)_r;
3733			ZERO_STRUCT(r->out);
3734			r->out.TagId = r->in.TagId;
3735			r->out.handle = talloc_zero(mem_ctx, struct policy_handle);
3736			if (r->out.handle == NULL) {
3737			return NT_STATUS_NO_MEMORY;
3738			}
3739
3740			r->out.result = _svcctl_CreateServiceW(cli->pipes_struct, r);
3741			return NT_STATUS_OK;
3742		}
3743
3744		case NDR_SVCCTL_ENUMDEPENDENTSERVICESW: {
3745			struct svcctl_EnumDependentServicesW *r = (struct svcctl_EnumDependentServicesW *)_r;
3746			ZERO_STRUCT(r->out);
3747			r->out.service_status = talloc_zero_array(mem_ctx, uint8_t, r->in.offered);
3748			if (r->out.service_status == NULL) {
3749			return NT_STATUS_NO_MEMORY;
3750			}
3751
3752			r->out.needed = talloc_zero(mem_ctx, uint32_t);
3753			if (r->out.needed == NULL) {
3754			return NT_STATUS_NO_MEMORY;
3755			}
3756
3757			r->out.services_returned = talloc_zero(mem_ctx, uint32_t);
3758			if (r->out.services_returned == NULL) {
3759			return NT_STATUS_NO_MEMORY;
3760			}
3761
3762			r->out.result = _svcctl_EnumDependentServicesW(cli->pipes_struct, r);
3763			return NT_STATUS_OK;
3764		}
3765
3766		case NDR_SVCCTL_ENUMSERVICESSTATUSW: {
3767			struct svcctl_EnumServicesStatusW *r = (struct svcctl_EnumServicesStatusW *)_r;
3768			ZERO_STRUCT(r->out);
3769			r->out.resume_handle = r->in.resume_handle;
3770			r->out.service = talloc_zero_array(mem_ctx, uint8_t, r->in.offered);
3771			if (r->out.service == NULL) {
3772			return NT_STATUS_NO_MEMORY;
3773			}
3774
3775			r->out.needed = talloc_zero(mem_ctx, uint32_t);
3776			if (r->out.needed == NULL) {
3777			return NT_STATUS_NO_MEMORY;
3778			}
3779
3780			r->out.services_returned = talloc_zero(mem_ctx, uint32_t);
3781			if (r->out.services_returned == NULL) {
3782			return NT_STATUS_NO_MEMORY;
3783			}
3784
3785			r->out.result = _svcctl_EnumServicesStatusW(cli->pipes_struct, r);
3786			return NT_STATUS_OK;
3787		}
3788
3789		case NDR_SVCCTL_OPENSCMANAGERW: {
3790			struct svcctl_OpenSCManagerW *r = (struct svcctl_OpenSCManagerW *)_r;
3791			ZERO_STRUCT(r->out);
3792			r->out.handle = talloc_zero(mem_ctx, struct policy_handle);
3793			if (r->out.handle == NULL) {
3794			return NT_STATUS_NO_MEMORY;
3795			}
3796
3797			r->out.result = _svcctl_OpenSCManagerW(cli->pipes_struct, r);
3798			return NT_STATUS_OK;
3799		}
3800
3801		case NDR_SVCCTL_OPENSERVICEW: {
3802			struct svcctl_OpenServiceW *r = (struct svcctl_OpenServiceW *)_r;
3803			ZERO_STRUCT(r->out);
3804			r->out.handle = talloc_zero(mem_ctx, struct policy_handle);
3805			if (r->out.handle == NULL) {
3806			return NT_STATUS_NO_MEMORY;
3807			}
3808
3809			r->out.result = _svcctl_OpenServiceW(cli->pipes_struct, r);
3810			return NT_STATUS_OK;
3811		}
3812
3813		case NDR_SVCCTL_QUERYSERVICECONFIGW: {
3814			struct svcctl_QueryServiceConfigW *r = (struct svcctl_QueryServiceConfigW *)_r;
3815			ZERO_STRUCT(r->out);
3816			r->out.query = talloc_zero(mem_ctx, struct QUERY_SERVICE_CONFIG);
3817			if (r->out.query == NULL) {
3818			return NT_STATUS_NO_MEMORY;
3819			}
3820
3821			r->out.needed = talloc_zero(mem_ctx, uint32_t);
3822			if (r->out.needed == NULL) {
3823			return NT_STATUS_NO_MEMORY;
3824			}
3825
3826			r->out.result = _svcctl_QueryServiceConfigW(cli->pipes_struct, r);
3827			return NT_STATUS_OK;
3828		}
3829
3830		case NDR_SVCCTL_QUERYSERVICELOCKSTATUSW: {
3831			struct svcctl_QueryServiceLockStatusW *r = (struct svcctl_QueryServiceLockStatusW *)_r;
3832			ZERO_STRUCT(r->out);
3833			r->out.lock_status = talloc_zero(mem_ctx, struct SERVICE_LOCK_STATUS);
3834			if (r->out.lock_status == NULL) {
3835			return NT_STATUS_NO_MEMORY;
3836			}
3837
3838			r->out.needed = talloc_zero(mem_ctx, uint32_t);
3839			if (r->out.needed == NULL) {
3840			return NT_STATUS_NO_MEMORY;
3841			}
3842
3843			r->out.result = _svcctl_QueryServiceLockStatusW(cli->pipes_struct, r);
3844			return NT_STATUS_OK;
3845		}
3846
3847		case NDR_SVCCTL_STARTSERVICEW: {
3848			struct svcctl_StartServiceW *r = (struct svcctl_StartServiceW *)_r;
3849			r->out.result = _svcctl_StartServiceW(cli->pipes_struct, r);
3850			return NT_STATUS_OK;
3851		}
3852
3853		case NDR_SVCCTL_GETSERVICEDISPLAYNAMEW: {
3854			struct svcctl_GetServiceDisplayNameW *r = (struct svcctl_GetServiceDisplayNameW *)_r;
3855			ZERO_STRUCT(r->out);
3856			r->out.display_name_length = r->in.display_name_length;
3857			r->out.display_name = talloc_zero(mem_ctx, const char *);
3858			if (r->out.display_name == NULL) {
3859			return NT_STATUS_NO_MEMORY;
3860			}
3861
3862			r->out.result = _svcctl_GetServiceDisplayNameW(cli->pipes_struct, r);
3863			return NT_STATUS_OK;
3864		}
3865
3866		case NDR_SVCCTL_GETSERVICEKEYNAMEW: {
3867			struct svcctl_GetServiceKeyNameW *r = (struct svcctl_GetServiceKeyNameW *)_r;
3868			ZERO_STRUCT(r->out);
3869			r->out.display_name_length = r->in.display_name_length;
3870			r->out.key_name = talloc_zero(mem_ctx, const char *);
3871			if (r->out.key_name == NULL) {
3872			return NT_STATUS_NO_MEMORY;
3873			}
3874
3875			r->out.result = _svcctl_GetServiceKeyNameW(cli->pipes_struct, r);
3876			return NT_STATUS_OK;
3877		}
3878
3879		case NDR_SVCCTL_SCSETSERVICEBITSA: {
3880			struct svcctl_SCSetServiceBitsA *r = (struct svcctl_SCSetServiceBitsA *)_r;
3881			r->out.result = _svcctl_SCSetServiceBitsA(cli->pipes_struct, r);
3882			return NT_STATUS_OK;
3883		}
3884
3885		case NDR_SVCCTL_CHANGESERVICECONFIGA: {
3886			struct svcctl_ChangeServiceConfigA *r = (struct svcctl_ChangeServiceConfigA *)_r;
3887			ZERO_STRUCT(r->out);
3888			r->out.tag_id = talloc_zero(mem_ctx, uint32_t);
3889			if (r->out.tag_id == NULL) {
3890			return NT_STATUS_NO_MEMORY;
3891			}
3892
3893			r->out.result = _svcctl_ChangeServiceConfigA(cli->pipes_struct, r);
3894			return NT_STATUS_OK;
3895		}
3896
3897		case NDR_SVCCTL_CREATESERVICEA: {
3898			struct svcctl_CreateServiceA *r = (struct svcctl_CreateServiceA *)_r;
3899			ZERO_STRUCT(r->out);
3900			r->out.TagId = talloc_zero(mem_ctx, uint32_t);
3901			if (r->out.TagId == NULL) {
3902			return NT_STATUS_NO_MEMORY;
3903			}
3904
3905			r->out.result = _svcctl_CreateServiceA(cli->pipes_struct, r);
3906			return NT_STATUS_OK;
3907		}
3908
3909		case NDR_SVCCTL_ENUMDEPENDENTSERVICESA: {
3910			struct svcctl_EnumDependentServicesA *r = (struct svcctl_EnumDependentServicesA *)_r;
3911			ZERO_STRUCT(r->out);
3912			r->out.service_status = talloc_zero(mem_ctx, struct ENUM_SERVICE_STATUSA);
3913			if (r->out.service_status == NULL) {
3914			return NT_STATUS_NO_MEMORY;
3915			}
3916
3917			r->out.needed = talloc_zero(mem_ctx, uint32_t);
3918			if (r->out.needed == NULL) {
3919			return NT_STATUS_NO_MEMORY;
3920			}
3921
3922			r->out.services_returned = talloc_zero(mem_ctx, uint32_t);
3923			if (r->out.services_returned == NULL) {
3924			return NT_STATUS_NO_MEMORY;
3925			}
3926
3927			r->out.result = _svcctl_EnumDependentServicesA(cli->pipes_struct, r);
3928			return NT_STATUS_OK;
3929		}
3930
3931		case NDR_SVCCTL_ENUMSERVICESSTATUSA: {
3932			struct svcctl_EnumServicesStatusA *r = (struct svcctl_EnumServicesStatusA *)_r;
3933			ZERO_STRUCT(r->out);
3934			r->out.resume_handle = r->in.resume_handle;
3935			r->out.service = talloc_zero_array(mem_ctx, uint8_t, r->in.offered);
3936			if (r->out.service == NULL) {
3937			return NT_STATUS_NO_MEMORY;
3938			}
3939
3940			r->out.needed = talloc_zero(mem_ctx, uint32_t);
3941			if (r->out.needed == NULL) {
3942			return NT_STATUS_NO_MEMORY;
3943			}
3944
3945			r->out.services_returned = talloc_zero(mem_ctx, uint32_t);
3946			if (r->out.services_returned == NULL) {
3947			return NT_STATUS_NO_MEMORY;
3948			}
3949
3950			r->out.result = _svcctl_EnumServicesStatusA(cli->pipes_struct, r);
3951			return NT_STATUS_OK;
3952		}
3953
3954		case NDR_SVCCTL_OPENSCMANAGERA: {
3955			struct svcctl_OpenSCManagerA *r = (struct svcctl_OpenSCManagerA *)_r;
3956			ZERO_STRUCT(r->out);
3957			r->out.handle = talloc_zero(mem_ctx, struct policy_handle);
3958			if (r->out.handle == NULL) {
3959			return NT_STATUS_NO_MEMORY;
3960			}
3961
3962			r->out.result = _svcctl_OpenSCManagerA(cli->pipes_struct, r);
3963			return NT_STATUS_OK;
3964		}
3965
3966		case NDR_SVCCTL_OPENSERVICEA: {
3967			struct svcctl_OpenServiceA *r = (struct svcctl_OpenServiceA *)_r;
3968			r->out.result = _svcctl_OpenServiceA(cli->pipes_struct, r);
3969			return NT_STATUS_OK;
3970		}
3971
3972		case NDR_SVCCTL_QUERYSERVICECONFIGA: {
3973			struct svcctl_QueryServiceConfigA *r = (struct svcctl_QueryServiceConfigA *)_r;
3974			ZERO_STRUCT(r->out);
3975			r->out.query = talloc_zero_array(mem_ctx, uint8_t, r->in.offered);
3976			if (r->out.query == NULL) {
3977			return NT_STATUS_NO_MEMORY;
3978			}
3979
3980			r->out.needed = talloc_zero(mem_ctx, uint32_t);
3981			if (r->out.needed == NULL) {
3982			return NT_STATUS_NO_MEMORY;
3983			}
3984
3985			r->out.result = _svcctl_QueryServiceConfigA(cli->pipes_struct, r);
3986			return NT_STATUS_OK;
3987		}
3988
3989		case NDR_SVCCTL_QUERYSERVICELOCKSTATUSA: {
3990			struct svcctl_QueryServiceLockStatusA *r = (struct svcctl_QueryServiceLockStatusA *)_r;
3991			ZERO_STRUCT(r->out);
3992			r->out.lock_status = talloc_zero(mem_ctx, struct SERVICE_LOCK_STATUS);
3993			if (r->out.lock_status == NULL) {
3994			return NT_STATUS_NO_MEMORY;
3995			}
3996
3997			r->out.needed = talloc_zero(mem_ctx, uint32_t);
3998			if (r->out.needed == NULL) {
3999			return NT_STATUS_NO_MEMORY;
4000			}
4001
4002			r->out.result = _svcctl_QueryServiceLockStatusA(cli->pipes_struct, r);
4003			return NT_STATUS_OK;
4004		}
4005
4006		case NDR_SVCCTL_STARTSERVICEA: {
4007			struct svcctl_StartServiceA *r = (struct svcctl_StartServiceA *)_r;
4008			r->out.result = _svcctl_StartServiceA(cli->pipes_struct, r);
4009			return NT_STATUS_OK;
4010		}
4011
4012		case NDR_SVCCTL_GETSERVICEDISPLAYNAMEA: {
4013			struct svcctl_GetServiceDisplayNameA *r = (struct svcctl_GetServiceDisplayNameA *)_r;
4014			ZERO_STRUCT(r->out);
4015			r->out.display_name_length = r->in.display_name_length;
4016			r->out.display_name = talloc_zero(mem_ctx, const char *);
4017			if (r->out.display_name == NULL) {
4018			return NT_STATUS_NO_MEMORY;
4019			}
4020
4021			r->out.result = _svcctl_GetServiceDisplayNameA(cli->pipes_struct, r);
4022			return NT_STATUS_OK;
4023		}
4024
4025		case NDR_SVCCTL_GETSERVICEKEYNAMEA: {
4026			struct svcctl_GetServiceKeyNameA *r = (struct svcctl_GetServiceKeyNameA *)_r;
4027			ZERO_STRUCT(r->out);
4028			r->out.display_name_length = r->in.display_name_length;
4029			r->out.key_name = talloc_zero(mem_ctx, const char *);
4030			if (r->out.key_name == NULL) {
4031			return NT_STATUS_NO_MEMORY;
4032			}
4033
4034			r->out.result = _svcctl_GetServiceKeyNameA(cli->pipes_struct, r);
4035			return NT_STATUS_OK;
4036		}
4037
4038		case NDR_SVCCTL_GETCURRENTGROUPESTATEW: {
4039			struct svcctl_GetCurrentGroupeStateW *r = (struct svcctl_GetCurrentGroupeStateW *)_r;
4040			r->out.result = _svcctl_GetCurrentGroupeStateW(cli->pipes_struct, r);
4041			return NT_STATUS_OK;
4042		}
4043
4044		case NDR_SVCCTL_ENUMSERVICEGROUPW: {
4045			struct svcctl_EnumServiceGroupW *r = (struct svcctl_EnumServiceGroupW *)_r;
4046			r->out.result = _svcctl_EnumServiceGroupW(cli->pipes_struct, r);
4047			return NT_STATUS_OK;
4048		}
4049
4050		case NDR_SVCCTL_CHANGESERVICECONFIG2A: {
4051			struct svcctl_ChangeServiceConfig2A *r = (struct svcctl_ChangeServiceConfig2A *)_r;
4052			r->out.result = _svcctl_ChangeServiceConfig2A(cli->pipes_struct, r);
4053			return NT_STATUS_OK;
4054		}
4055
4056		case NDR_SVCCTL_CHANGESERVICECONFIG2W: {
4057			struct svcctl_ChangeServiceConfig2W *r = (struct svcctl_ChangeServiceConfig2W *)_r;
4058			r->out.result = _svcctl_ChangeServiceConfig2W(cli->pipes_struct, r);
4059			return NT_STATUS_OK;
4060		}
4061
4062		case NDR_SVCCTL_QUERYSERVICECONFIG2A: {
4063			struct svcctl_QueryServiceConfig2A *r = (struct svcctl_QueryServiceConfig2A *)_r;
4064			ZERO_STRUCT(r->out);
4065			r->out.buffer = talloc_zero_array(mem_ctx, uint8_t, r->in.offered);
4066			if (r->out.buffer == NULL) {
4067			return NT_STATUS_NO_MEMORY;
4068			}
4069
4070			r->out.needed = talloc_zero(mem_ctx, uint32_t);
4071			if (r->out.needed == NULL) {
4072			return NT_STATUS_NO_MEMORY;
4073			}
4074
4075			r->out.result = _svcctl_QueryServiceConfig2A(cli->pipes_struct, r);
4076			return NT_STATUS_OK;
4077		}
4078
4079		case NDR_SVCCTL_QUERYSERVICECONFIG2W: {
4080			struct svcctl_QueryServiceConfig2W *r = (struct svcctl_QueryServiceConfig2W *)_r;
4081			ZERO_STRUCT(r->out);
4082			r->out.buffer = talloc_zero_array(mem_ctx, uint8_t, r->in.offered);
4083			if (r->out.buffer == NULL) {
4084			return NT_STATUS_NO_MEMORY;
4085			}
4086
4087			r->out.needed = talloc_zero(mem_ctx, uint32_t);
4088			if (r->out.needed == NULL) {
4089			return NT_STATUS_NO_MEMORY;
4090			}
4091
4092			r->out.result = _svcctl_QueryServiceConfig2W(cli->pipes_struct, r);
4093			return NT_STATUS_OK;
4094		}
4095
4096		case NDR_SVCCTL_QUERYSERVICESTATUSEX: {
4097			struct svcctl_QueryServiceStatusEx *r = (struct svcctl_QueryServiceStatusEx *)_r;
4098			ZERO_STRUCT(r->out);
4099			r->out.buffer = talloc_zero_array(mem_ctx, uint8_t, r->in.offered);
4100			if (r->out.buffer == NULL) {
4101			return NT_STATUS_NO_MEMORY;
4102			}
4103
4104			r->out.needed = talloc_zero(mem_ctx, uint32_t);
4105			if (r->out.needed == NULL) {
4106			return NT_STATUS_NO_MEMORY;
4107			}
4108
4109			r->out.result = _svcctl_QueryServiceStatusEx(cli->pipes_struct, r);
4110			return NT_STATUS_OK;
4111		}
4112
4113		case NDR_ENUMSERVICESSTATUSEXA: {
4114			struct EnumServicesStatusExA *r = (struct EnumServicesStatusExA *)_r;
4115			ZERO_STRUCT(r->out);
4116			r->out.resume_handle = r->in.resume_handle;
4117			r->out.services = talloc_zero_array(mem_ctx, uint8_t, r->in.offered);
4118			if (r->out.services == NULL) {
4119			return NT_STATUS_NO_MEMORY;
4120			}
4121
4122			r->out.needed = talloc_zero(mem_ctx, uint32_t);
4123			if (r->out.needed == NULL) {
4124			return NT_STATUS_NO_MEMORY;
4125			}
4126
4127			r->out.service_returned = talloc_zero(mem_ctx, uint32_t);
4128			if (r->out.service_returned == NULL) {
4129			return NT_STATUS_NO_MEMORY;
4130			}
4131
4132			r->out.group_name = talloc_zero(mem_ctx, const char *);
4133			if (r->out.group_name == NULL) {
4134			return NT_STATUS_NO_MEMORY;
4135			}
4136
4137			r->out.result = _EnumServicesStatusExA(cli->pipes_struct, r);
4138			return NT_STATUS_OK;
4139		}
4140
4141		case NDR_ENUMSERVICESSTATUSEXW: {
4142			struct EnumServicesStatusExW *r = (struct EnumServicesStatusExW *)_r;
4143			ZERO_STRUCT(r->out);
4144			r->out.resume_handle = r->in.resume_handle;
4145			r->out.services = talloc_zero_array(mem_ctx, uint8_t, r->in.offered);
4146			if (r->out.services == NULL) {
4147			return NT_STATUS_NO_MEMORY;
4148			}
4149
4150			r->out.needed = talloc_zero(mem_ctx, uint32_t);
4151			if (r->out.needed == NULL) {
4152			return NT_STATUS_NO_MEMORY;
4153			}
4154
4155			r->out.service_returned = talloc_zero(mem_ctx, uint32_t);
4156			if (r->out.service_returned == NULL) {
4157			return NT_STATUS_NO_MEMORY;
4158			}
4159
4160			r->out.result = _EnumServicesStatusExW(cli->pipes_struct, r);
4161			return NT_STATUS_OK;
4162		}
4163
4164		case NDR_SVCCTL_SCSENDTSMESSAGE: {
4165			struct svcctl_SCSendTSMessage *r = (struct svcctl_SCSendTSMessage *)_r;
4166			r->out.result = _svcctl_SCSendTSMessage(cli->pipes_struct, r);
4167			return NT_STATUS_OK;
4168		}
4169
4170		default:
4171			return NT_STATUS_NOT_IMPLEMENTED;
4172	}
4173}
4174
4175NTSTATUS rpc_svcctl_init(void)
4176{
4177	return rpc_srv_register(SMB_RPC_INTERFACE_VERSION, "svcctl", "svcctl", &ndr_table_svcctl, api_svcctl_cmds, sizeof(api_svcctl_cmds) / sizeof(struct api_struct));
4178}
4179