svcctl: add svcctl_ConfigLevel from samba 3.
[amitay/samba.git] / librpc / gen_ndr / ndr_svcctl.c
1 /* parser auto-generated by pidl */
2
3 #include "includes.h"
4 #include "../librpc/gen_ndr/ndr_svcctl.h"
5
6 #include "librpc/gen_ndr/ndr_misc.h"
7 #include "librpc/gen_ndr/ndr_security.h"
8 static enum ndr_err_code ndr_push_SERVICE_LOCK_STATUS(struct ndr_push *ndr, int ndr_flags, const struct SERVICE_LOCK_STATUS *r)
9 {
10         if (ndr_flags & NDR_SCALARS) {
11                 NDR_CHECK(ndr_push_align(ndr, 4));
12                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->is_locked));
13                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->lock_owner));
14                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->lock_duration));
15         }
16         if (ndr_flags & NDR_BUFFERS) {
17                 if (r->lock_owner) {
18                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->lock_owner, CH_UTF16)));
19                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
20                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->lock_owner, CH_UTF16)));
21                         NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->lock_owner, ndr_charset_length(r->lock_owner, CH_UTF16), sizeof(uint16_t), CH_UTF16));
22                 }
23         }
24         return NDR_ERR_SUCCESS;
25 }
26
27 static enum ndr_err_code ndr_pull_SERVICE_LOCK_STATUS(struct ndr_pull *ndr, int ndr_flags, struct SERVICE_LOCK_STATUS *r)
28 {
29         uint32_t _ptr_lock_owner;
30         TALLOC_CTX *_mem_save_lock_owner_0;
31         if (ndr_flags & NDR_SCALARS) {
32                 NDR_CHECK(ndr_pull_align(ndr, 4));
33                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->is_locked));
34                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_lock_owner));
35                 if (_ptr_lock_owner) {
36                         NDR_PULL_ALLOC(ndr, r->lock_owner);
37                 } else {
38                         r->lock_owner = NULL;
39                 }
40                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->lock_duration));
41         }
42         if (ndr_flags & NDR_BUFFERS) {
43                 if (r->lock_owner) {
44                         _mem_save_lock_owner_0 = NDR_PULL_GET_MEM_CTX(ndr);
45                         NDR_PULL_SET_MEM_CTX(ndr, r->lock_owner, 0);
46                         NDR_CHECK(ndr_pull_array_size(ndr, &r->lock_owner));
47                         NDR_CHECK(ndr_pull_array_length(ndr, &r->lock_owner));
48                         if (ndr_get_array_length(ndr, &r->lock_owner) > ndr_get_array_size(ndr, &r->lock_owner)) {
49                                 return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->lock_owner), ndr_get_array_length(ndr, &r->lock_owner));
50                         }
51                         NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->lock_owner), sizeof(uint16_t)));
52                         NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->lock_owner, ndr_get_array_length(ndr, &r->lock_owner), sizeof(uint16_t), CH_UTF16));
53                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_lock_owner_0, 0);
54                 }
55         }
56         return NDR_ERR_SUCCESS;
57 }
58
59 _PUBLIC_ void ndr_print_SERVICE_LOCK_STATUS(struct ndr_print *ndr, const char *name, const struct SERVICE_LOCK_STATUS *r)
60 {
61         ndr_print_struct(ndr, name, "SERVICE_LOCK_STATUS");
62         ndr->depth++;
63         ndr_print_uint32(ndr, "is_locked", r->is_locked);
64         ndr_print_ptr(ndr, "lock_owner", r->lock_owner);
65         ndr->depth++;
66         if (r->lock_owner) {
67                 ndr_print_string(ndr, "lock_owner", r->lock_owner);
68         }
69         ndr->depth--;
70         ndr_print_uint32(ndr, "lock_duration", r->lock_duration);
71         ndr->depth--;
72 }
73
74 static enum ndr_err_code ndr_push_SERVICE_STATUS(struct ndr_push *ndr, int ndr_flags, const struct SERVICE_STATUS *r)
75 {
76         if (ndr_flags & NDR_SCALARS) {
77                 NDR_CHECK(ndr_push_align(ndr, 4));
78                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->type));
79                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->state));
80                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->controls_accepted));
81                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->win32_exit_code));
82                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->service_exit_code));
83                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->check_point));
84                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->wait_hint));
85         }
86         if (ndr_flags & NDR_BUFFERS) {
87         }
88         return NDR_ERR_SUCCESS;
89 }
90
91 static enum ndr_err_code ndr_pull_SERVICE_STATUS(struct ndr_pull *ndr, int ndr_flags, struct SERVICE_STATUS *r)
92 {
93         if (ndr_flags & NDR_SCALARS) {
94                 NDR_CHECK(ndr_pull_align(ndr, 4));
95                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->type));
96                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->state));
97                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->controls_accepted));
98                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->win32_exit_code));
99                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->service_exit_code));
100                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->check_point));
101                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->wait_hint));
102         }
103         if (ndr_flags & NDR_BUFFERS) {
104         }
105         return NDR_ERR_SUCCESS;
106 }
107
108 _PUBLIC_ void ndr_print_SERVICE_STATUS(struct ndr_print *ndr, const char *name, const struct SERVICE_STATUS *r)
109 {
110         ndr_print_struct(ndr, name, "SERVICE_STATUS");
111         ndr->depth++;
112         ndr_print_uint32(ndr, "type", r->type);
113         ndr_print_uint32(ndr, "state", r->state);
114         ndr_print_uint32(ndr, "controls_accepted", r->controls_accepted);
115         ndr_print_WERROR(ndr, "win32_exit_code", r->win32_exit_code);
116         ndr_print_uint32(ndr, "service_exit_code", r->service_exit_code);
117         ndr_print_uint32(ndr, "check_point", r->check_point);
118         ndr_print_uint32(ndr, "wait_hint", r->wait_hint);
119         ndr->depth--;
120 }
121
122 static enum ndr_err_code ndr_push_ENUM_SERVICE_STATUS(struct ndr_push *ndr, int ndr_flags, const struct ENUM_SERVICE_STATUS *r)
123 {
124         if (ndr_flags & NDR_SCALARS) {
125                 NDR_CHECK(ndr_push_align(ndr, 4));
126                 {
127                         uint32_t _flags_save_string = ndr->flags;
128                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
129                         NDR_CHECK(ndr_push_relative_ptr1(ndr, r->service_name));
130                         ndr->flags = _flags_save_string;
131                 }
132                 {
133                         uint32_t _flags_save_string = ndr->flags;
134                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
135                         NDR_CHECK(ndr_push_relative_ptr1(ndr, r->display_name));
136                         ndr->flags = _flags_save_string;
137                 }
138                 NDR_CHECK(ndr_push_SERVICE_STATUS(ndr, NDR_SCALARS, &r->status));
139         }
140         if (ndr_flags & NDR_BUFFERS) {
141                 {
142                         uint32_t _flags_save_string = ndr->flags;
143                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
144                         if (r->service_name) {
145                                 NDR_CHECK(ndr_push_relative_ptr2(ndr, r->service_name));
146                                 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->service_name));
147                         }
148                         ndr->flags = _flags_save_string;
149                 }
150                 {
151                         uint32_t _flags_save_string = ndr->flags;
152                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
153                         if (r->display_name) {
154                                 NDR_CHECK(ndr_push_relative_ptr2(ndr, r->display_name));
155                                 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->display_name));
156                         }
157                         ndr->flags = _flags_save_string;
158                 }
159         }
160         return NDR_ERR_SUCCESS;
161 }
162
163 static enum ndr_err_code ndr_pull_ENUM_SERVICE_STATUS(struct ndr_pull *ndr, int ndr_flags, struct ENUM_SERVICE_STATUS *r)
164 {
165         uint32_t _ptr_service_name;
166         TALLOC_CTX *_mem_save_service_name_0;
167         uint32_t _ptr_display_name;
168         TALLOC_CTX *_mem_save_display_name_0;
169         if (ndr_flags & NDR_SCALARS) {
170                 NDR_CHECK(ndr_pull_align(ndr, 4));
171                 {
172                         uint32_t _flags_save_string = ndr->flags;
173                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
174                         NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_service_name));
175                         if (_ptr_service_name) {
176                                 NDR_PULL_ALLOC(ndr, r->service_name);
177                                 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->service_name, _ptr_service_name));
178                         } else {
179                                 r->service_name = NULL;
180                         }
181                         ndr->flags = _flags_save_string;
182                 }
183                 {
184                         uint32_t _flags_save_string = ndr->flags;
185                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
186                         NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_display_name));
187                         if (_ptr_display_name) {
188                                 NDR_PULL_ALLOC(ndr, r->display_name);
189                                 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->display_name, _ptr_display_name));
190                         } else {
191                                 r->display_name = NULL;
192                         }
193                         ndr->flags = _flags_save_string;
194                 }
195                 NDR_CHECK(ndr_pull_SERVICE_STATUS(ndr, NDR_SCALARS, &r->status));
196         }
197         if (ndr_flags & NDR_BUFFERS) {
198                 {
199                         uint32_t _flags_save_string = ndr->flags;
200                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
201                         if (r->service_name) {
202                                 uint32_t _relative_save_offset;
203                                 _relative_save_offset = ndr->offset;
204                                 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->service_name));
205                                 _mem_save_service_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
206                                 NDR_PULL_SET_MEM_CTX(ndr, r->service_name, 0);
207                                 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->service_name));
208                                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_service_name_0, 0);
209                                 ndr->offset = _relative_save_offset;
210                         }
211                         ndr->flags = _flags_save_string;
212                 }
213                 {
214                         uint32_t _flags_save_string = ndr->flags;
215                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
216                         if (r->display_name) {
217                                 uint32_t _relative_save_offset;
218                                 _relative_save_offset = ndr->offset;
219                                 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->display_name));
220                                 _mem_save_display_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
221                                 NDR_PULL_SET_MEM_CTX(ndr, r->display_name, 0);
222                                 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->display_name));
223                                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_display_name_0, 0);
224                                 ndr->offset = _relative_save_offset;
225                         }
226                         ndr->flags = _flags_save_string;
227                 }
228         }
229         return NDR_ERR_SUCCESS;
230 }
231
232 _PUBLIC_ void ndr_print_ENUM_SERVICE_STATUS(struct ndr_print *ndr, const char *name, const struct ENUM_SERVICE_STATUS *r)
233 {
234         ndr_print_struct(ndr, name, "ENUM_SERVICE_STATUS");
235         ndr->depth++;
236         ndr_print_ptr(ndr, "service_name", r->service_name);
237         ndr->depth++;
238         if (r->service_name) {
239                 ndr_print_string(ndr, "service_name", r->service_name);
240         }
241         ndr->depth--;
242         ndr_print_ptr(ndr, "display_name", r->display_name);
243         ndr->depth++;
244         if (r->display_name) {
245                 ndr_print_string(ndr, "display_name", r->display_name);
246         }
247         ndr->depth--;
248         ndr_print_SERVICE_STATUS(ndr, "status", &r->status);
249         ndr->depth--;
250 }
251
252 _PUBLIC_ enum ndr_err_code ndr_push_svcctl_ServerType(struct ndr_push *ndr, int ndr_flags, uint32_t r)
253 {
254         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
255         return NDR_ERR_SUCCESS;
256 }
257
258 _PUBLIC_ enum ndr_err_code ndr_pull_svcctl_ServerType(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
259 {
260         uint32_t v;
261         NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
262         *r = v;
263         return NDR_ERR_SUCCESS;
264 }
265
266 _PUBLIC_ void ndr_print_svcctl_ServerType(struct ndr_print *ndr, const char *name, uint32_t r)
267 {
268         ndr_print_uint32(ndr, name, r);
269         ndr->depth++;
270         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SV_TYPE_WORKSTATION", SV_TYPE_WORKSTATION, r);
271         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SV_TYPE_SERVER", SV_TYPE_SERVER, r);
272         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SV_TYPE_SQLSERVER", SV_TYPE_SQLSERVER, r);
273         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SV_TYPE_DOMAIN_CTRL", SV_TYPE_DOMAIN_CTRL, r);
274         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SV_TYPE_DOMAIN_BAKCTRL", SV_TYPE_DOMAIN_BAKCTRL, r);
275         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SV_TYPE_TIME_SOURCE", SV_TYPE_TIME_SOURCE, r);
276         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SV_TYPE_AFP", SV_TYPE_AFP, r);
277         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SV_TYPE_NOVELL", SV_TYPE_NOVELL, r);
278         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SV_TYPE_DOMAIN_MEMBER", SV_TYPE_DOMAIN_MEMBER, r);
279         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SV_TYPE_PRINTQ_SERVER", SV_TYPE_PRINTQ_SERVER, r);
280         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SV_TYPE_DIALIN_SERVER", SV_TYPE_DIALIN_SERVER, r);
281         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SV_TYPE_SERVER_UNIX", SV_TYPE_SERVER_UNIX, r);
282         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SV_TYPE_NT", SV_TYPE_NT, r);
283         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SV_TYPE_WFW", SV_TYPE_WFW, r);
284         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SV_TYPE_SERVER_MFPN", SV_TYPE_SERVER_MFPN, r);
285         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SV_TYPE_SERVER_NT", SV_TYPE_SERVER_NT, r);
286         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SV_TYPE_POTENTIAL_BROWSER", SV_TYPE_POTENTIAL_BROWSER, r);
287         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SV_TYPE_BACKUP_BROWSER", SV_TYPE_BACKUP_BROWSER, r);
288         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SV_TYPE_MASTER_BROWSER", SV_TYPE_MASTER_BROWSER, r);
289         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SV_TYPE_DOMAIN_MASTER", SV_TYPE_DOMAIN_MASTER, r);
290         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SV_TYPE_SERVER_OSF", SV_TYPE_SERVER_OSF, r);
291         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SV_TYPE_SERVER_VMS", SV_TYPE_SERVER_VMS, r);
292         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SV_TYPE_WIN95_PLUS", SV_TYPE_WIN95_PLUS, r);
293         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SV_TYPE_DFS_SERVER", SV_TYPE_DFS_SERVER, r);
294         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SV_TYPE_ALTERNATE_XPORT", SV_TYPE_ALTERNATE_XPORT, r);
295         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SV_TYPE_LOCAL_LIST_ONLY", SV_TYPE_LOCAL_LIST_ONLY, r);
296         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SV_TYPE_DOMAIN_ENUM", SV_TYPE_DOMAIN_ENUM, r);
297         ndr->depth--;
298 }
299
300 static enum ndr_err_code ndr_push_SERVICE_CONTROL(struct ndr_push *ndr, int ndr_flags, enum SERVICE_CONTROL r)
301 {
302         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
303         return NDR_ERR_SUCCESS;
304 }
305
306 static enum ndr_err_code ndr_pull_SERVICE_CONTROL(struct ndr_pull *ndr, int ndr_flags, enum SERVICE_CONTROL *r)
307 {
308         uint32_t v;
309         NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
310         *r = v;
311         return NDR_ERR_SUCCESS;
312 }
313
314 _PUBLIC_ void ndr_print_SERVICE_CONTROL(struct ndr_print *ndr, const char *name, enum SERVICE_CONTROL r)
315 {
316         const char *val = NULL;
317
318         switch (r) {
319                 case SVCCTL_CONTROL_STOP: val = "SVCCTL_CONTROL_STOP"; break;
320                 case SVCCTL_CONTROL_PAUSE: val = "SVCCTL_CONTROL_PAUSE"; break;
321                 case SVCCTL_CONTROL_CONTINUE: val = "SVCCTL_CONTROL_CONTINUE"; break;
322                 case SVCCTL_CONTROL_INTERROGATE: val = "SVCCTL_CONTROL_INTERROGATE"; break;
323                 case SVCCTL_CONTROL_SHUTDOWN: val = "SVCCTL_CONTROL_SHUTDOWN"; break;
324         }
325         ndr_print_enum(ndr, name, "ENUM", val, r);
326 }
327
328 static enum ndr_err_code ndr_push_svcctl_MgrAccessMask(struct ndr_push *ndr, int ndr_flags, uint32_t r)
329 {
330         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
331         return NDR_ERR_SUCCESS;
332 }
333
334 static enum ndr_err_code ndr_pull_svcctl_MgrAccessMask(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
335 {
336         uint32_t v;
337         NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
338         *r = v;
339         return NDR_ERR_SUCCESS;
340 }
341
342 _PUBLIC_ void ndr_print_svcctl_MgrAccessMask(struct ndr_print *ndr, const char *name, uint32_t r)
343 {
344         ndr_print_uint32(ndr, name, r);
345         ndr->depth++;
346         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SC_RIGHT_MGR_CONNECT", SC_RIGHT_MGR_CONNECT, r);
347         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SC_RIGHT_MGR_CREATE_SERVICE", SC_RIGHT_MGR_CREATE_SERVICE, r);
348         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SC_RIGHT_MGR_ENUMERATE_SERVICE", SC_RIGHT_MGR_ENUMERATE_SERVICE, r);
349         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SC_RIGHT_MGR_LOCK", SC_RIGHT_MGR_LOCK, r);
350         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SC_RIGHT_MGR_QUERY_LOCK_STATUS", SC_RIGHT_MGR_QUERY_LOCK_STATUS, r);
351         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SC_RIGHT_MGR_MODIFY_BOOT_CONFIG", SC_RIGHT_MGR_MODIFY_BOOT_CONFIG, r);
352         ndr->depth--;
353 }
354
355 static enum ndr_err_code ndr_push_svcctl_ServiceAccessMask(struct ndr_push *ndr, int ndr_flags, uint32_t r)
356 {
357         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
358         return NDR_ERR_SUCCESS;
359 }
360
361 static enum ndr_err_code ndr_pull_svcctl_ServiceAccessMask(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
362 {
363         uint32_t v;
364         NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
365         *r = v;
366         return NDR_ERR_SUCCESS;
367 }
368
369 _PUBLIC_ void ndr_print_svcctl_ServiceAccessMask(struct ndr_print *ndr, const char *name, uint32_t r)
370 {
371         ndr_print_uint32(ndr, name, r);
372         ndr->depth++;
373         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SC_RIGHT_SVC_QUERY_CONFIG", SC_RIGHT_SVC_QUERY_CONFIG, r);
374         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SC_RIGHT_SVC_CHANGE_CONFIG", SC_RIGHT_SVC_CHANGE_CONFIG, r);
375         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SC_RIGHT_SVC_QUERY_STATUS", SC_RIGHT_SVC_QUERY_STATUS, r);
376         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SC_RIGHT_SVC_ENUMERATE_DEPENDENTS", SC_RIGHT_SVC_ENUMERATE_DEPENDENTS, r);
377         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SC_RIGHT_SVC_START", SC_RIGHT_SVC_START, r);
378         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SC_RIGHT_SVC_STOP", SC_RIGHT_SVC_STOP, r);
379         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SC_RIGHT_SVC_PAUSE_CONTINUE", SC_RIGHT_SVC_PAUSE_CONTINUE, r);
380         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SC_RIGHT_SVC_INTERROGATE", SC_RIGHT_SVC_INTERROGATE, r);
381         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SC_RIGHT_SVC_USER_DEFINED_CONTROL", SC_RIGHT_SVC_USER_DEFINED_CONTROL, r);
382         ndr->depth--;
383 }
384
385 _PUBLIC_ enum ndr_err_code ndr_push_QUERY_SERVICE_CONFIG(struct ndr_push *ndr, int ndr_flags, const struct QUERY_SERVICE_CONFIG *r)
386 {
387         if (ndr_flags & NDR_SCALARS) {
388                 NDR_CHECK(ndr_push_align(ndr, 4));
389                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->service_type));
390                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->start_type));
391                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->error_control));
392                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->executablepath));
393                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->loadordergroup));
394                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->tag_id));
395                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->dependencies));
396                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->startname));
397                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->displayname));
398         }
399         if (ndr_flags & NDR_BUFFERS) {
400                 if (r->executablepath) {
401                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->executablepath, CH_UTF16)));
402                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
403                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->executablepath, CH_UTF16)));
404                         NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->executablepath, ndr_charset_length(r->executablepath, CH_UTF16), sizeof(uint16_t), CH_UTF16));
405                 }
406                 if (r->loadordergroup) {
407                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->loadordergroup, CH_UTF16)));
408                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
409                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->loadordergroup, CH_UTF16)));
410                         NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->loadordergroup, ndr_charset_length(r->loadordergroup, CH_UTF16), sizeof(uint16_t), CH_UTF16));
411                 }
412                 if (r->dependencies) {
413                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->dependencies, CH_UTF16)));
414                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
415                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->dependencies, CH_UTF16)));
416                         NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->dependencies, ndr_charset_length(r->dependencies, CH_UTF16), sizeof(uint16_t), CH_UTF16));
417                 }
418                 if (r->startname) {
419                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->startname, CH_UTF16)));
420                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
421                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->startname, CH_UTF16)));
422                         NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->startname, ndr_charset_length(r->startname, CH_UTF16), sizeof(uint16_t), CH_UTF16));
423                 }
424                 if (r->displayname) {
425                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->displayname, CH_UTF16)));
426                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
427                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->displayname, CH_UTF16)));
428                         NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->displayname, ndr_charset_length(r->displayname, CH_UTF16), sizeof(uint16_t), CH_UTF16));
429                 }
430         }
431         return NDR_ERR_SUCCESS;
432 }
433
434 _PUBLIC_ enum ndr_err_code ndr_pull_QUERY_SERVICE_CONFIG(struct ndr_pull *ndr, int ndr_flags, struct QUERY_SERVICE_CONFIG *r)
435 {
436         uint32_t _ptr_executablepath;
437         TALLOC_CTX *_mem_save_executablepath_0;
438         uint32_t _ptr_loadordergroup;
439         TALLOC_CTX *_mem_save_loadordergroup_0;
440         uint32_t _ptr_dependencies;
441         TALLOC_CTX *_mem_save_dependencies_0;
442         uint32_t _ptr_startname;
443         TALLOC_CTX *_mem_save_startname_0;
444         uint32_t _ptr_displayname;
445         TALLOC_CTX *_mem_save_displayname_0;
446         if (ndr_flags & NDR_SCALARS) {
447                 NDR_CHECK(ndr_pull_align(ndr, 4));
448                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->service_type));
449                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->start_type));
450                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->error_control));
451                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_executablepath));
452                 if (_ptr_executablepath) {
453                         NDR_PULL_ALLOC(ndr, r->executablepath);
454                 } else {
455                         r->executablepath = NULL;
456                 }
457                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_loadordergroup));
458                 if (_ptr_loadordergroup) {
459                         NDR_PULL_ALLOC(ndr, r->loadordergroup);
460                 } else {
461                         r->loadordergroup = NULL;
462                 }
463                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->tag_id));
464                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_dependencies));
465                 if (_ptr_dependencies) {
466                         NDR_PULL_ALLOC(ndr, r->dependencies);
467                 } else {
468                         r->dependencies = NULL;
469                 }
470                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_startname));
471                 if (_ptr_startname) {
472                         NDR_PULL_ALLOC(ndr, r->startname);
473                 } else {
474                         r->startname = NULL;
475                 }
476                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_displayname));
477                 if (_ptr_displayname) {
478                         NDR_PULL_ALLOC(ndr, r->displayname);
479                 } else {
480                         r->displayname = NULL;
481                 }
482         }
483         if (ndr_flags & NDR_BUFFERS) {
484                 if (r->executablepath) {
485                         _mem_save_executablepath_0 = NDR_PULL_GET_MEM_CTX(ndr);
486                         NDR_PULL_SET_MEM_CTX(ndr, r->executablepath, 0);
487                         NDR_CHECK(ndr_pull_array_size(ndr, &r->executablepath));
488                         NDR_CHECK(ndr_pull_array_length(ndr, &r->executablepath));
489                         if (ndr_get_array_length(ndr, &r->executablepath) > ndr_get_array_size(ndr, &r->executablepath)) {
490                                 return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->executablepath), ndr_get_array_length(ndr, &r->executablepath));
491                         }
492                         NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->executablepath), sizeof(uint16_t)));
493                         NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->executablepath, ndr_get_array_length(ndr, &r->executablepath), sizeof(uint16_t), CH_UTF16));
494                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_executablepath_0, 0);
495                 }
496                 if (r->loadordergroup) {
497                         _mem_save_loadordergroup_0 = NDR_PULL_GET_MEM_CTX(ndr);
498                         NDR_PULL_SET_MEM_CTX(ndr, r->loadordergroup, 0);
499                         NDR_CHECK(ndr_pull_array_size(ndr, &r->loadordergroup));
500                         NDR_CHECK(ndr_pull_array_length(ndr, &r->loadordergroup));
501                         if (ndr_get_array_length(ndr, &r->loadordergroup) > ndr_get_array_size(ndr, &r->loadordergroup)) {
502                                 return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->loadordergroup), ndr_get_array_length(ndr, &r->loadordergroup));
503                         }
504                         NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->loadordergroup), sizeof(uint16_t)));
505                         NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->loadordergroup, ndr_get_array_length(ndr, &r->loadordergroup), sizeof(uint16_t), CH_UTF16));
506                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_loadordergroup_0, 0);
507                 }
508                 if (r->dependencies) {
509                         _mem_save_dependencies_0 = NDR_PULL_GET_MEM_CTX(ndr);
510                         NDR_PULL_SET_MEM_CTX(ndr, r->dependencies, 0);
511                         NDR_CHECK(ndr_pull_array_size(ndr, &r->dependencies));
512                         NDR_CHECK(ndr_pull_array_length(ndr, &r->dependencies));
513                         if (ndr_get_array_length(ndr, &r->dependencies) > ndr_get_array_size(ndr, &r->dependencies)) {
514                                 return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->dependencies), ndr_get_array_length(ndr, &r->dependencies));
515                         }
516                         NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->dependencies), sizeof(uint16_t)));
517                         NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->dependencies, ndr_get_array_length(ndr, &r->dependencies), sizeof(uint16_t), CH_UTF16));
518                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_dependencies_0, 0);
519                 }
520                 if (r->startname) {
521                         _mem_save_startname_0 = NDR_PULL_GET_MEM_CTX(ndr);
522                         NDR_PULL_SET_MEM_CTX(ndr, r->startname, 0);
523                         NDR_CHECK(ndr_pull_array_size(ndr, &r->startname));
524                         NDR_CHECK(ndr_pull_array_length(ndr, &r->startname));
525                         if (ndr_get_array_length(ndr, &r->startname) > ndr_get_array_size(ndr, &r->startname)) {
526                                 return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->startname), ndr_get_array_length(ndr, &r->startname));
527                         }
528                         NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->startname), sizeof(uint16_t)));
529                         NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->startname, ndr_get_array_length(ndr, &r->startname), sizeof(uint16_t), CH_UTF16));
530                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_startname_0, 0);
531                 }
532                 if (r->displayname) {
533                         _mem_save_displayname_0 = NDR_PULL_GET_MEM_CTX(ndr);
534                         NDR_PULL_SET_MEM_CTX(ndr, r->displayname, 0);
535                         NDR_CHECK(ndr_pull_array_size(ndr, &r->displayname));
536                         NDR_CHECK(ndr_pull_array_length(ndr, &r->displayname));
537                         if (ndr_get_array_length(ndr, &r->displayname) > ndr_get_array_size(ndr, &r->displayname)) {
538                                 return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->displayname), ndr_get_array_length(ndr, &r->displayname));
539                         }
540                         NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->displayname), sizeof(uint16_t)));
541                         NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->displayname, ndr_get_array_length(ndr, &r->displayname), sizeof(uint16_t), CH_UTF16));
542                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_displayname_0, 0);
543                 }
544         }
545         return NDR_ERR_SUCCESS;
546 }
547
548 _PUBLIC_ void ndr_print_QUERY_SERVICE_CONFIG(struct ndr_print *ndr, const char *name, const struct QUERY_SERVICE_CONFIG *r)
549 {
550         ndr_print_struct(ndr, name, "QUERY_SERVICE_CONFIG");
551         ndr->depth++;
552         ndr_print_uint32(ndr, "service_type", r->service_type);
553         ndr_print_uint32(ndr, "start_type", r->start_type);
554         ndr_print_uint32(ndr, "error_control", r->error_control);
555         ndr_print_ptr(ndr, "executablepath", r->executablepath);
556         ndr->depth++;
557         if (r->executablepath) {
558                 ndr_print_string(ndr, "executablepath", r->executablepath);
559         }
560         ndr->depth--;
561         ndr_print_ptr(ndr, "loadordergroup", r->loadordergroup);
562         ndr->depth++;
563         if (r->loadordergroup) {
564                 ndr_print_string(ndr, "loadordergroup", r->loadordergroup);
565         }
566         ndr->depth--;
567         ndr_print_uint32(ndr, "tag_id", r->tag_id);
568         ndr_print_ptr(ndr, "dependencies", r->dependencies);
569         ndr->depth++;
570         if (r->dependencies) {
571                 ndr_print_string(ndr, "dependencies", r->dependencies);
572         }
573         ndr->depth--;
574         ndr_print_ptr(ndr, "startname", r->startname);
575         ndr->depth++;
576         if (r->startname) {
577                 ndr_print_string(ndr, "startname", r->startname);
578         }
579         ndr->depth--;
580         ndr_print_ptr(ndr, "displayname", r->displayname);
581         ndr->depth++;
582         if (r->displayname) {
583                 ndr_print_string(ndr, "displayname", r->displayname);
584         }
585         ndr->depth--;
586         ndr->depth--;
587 }
588
589 _PUBLIC_ size_t ndr_size_QUERY_SERVICE_CONFIG(const struct QUERY_SERVICE_CONFIG *r, struct smb_iconv_convenience *ic, int flags)
590 {
591         return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_QUERY_SERVICE_CONFIG, ic);
592 }
593
594 static enum ndr_err_code ndr_push_svcctl_ConfigLevel(struct ndr_push *ndr, int ndr_flags, enum svcctl_ConfigLevel r)
595 {
596         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
597         return NDR_ERR_SUCCESS;
598 }
599
600 static enum ndr_err_code ndr_pull_svcctl_ConfigLevel(struct ndr_pull *ndr, int ndr_flags, enum svcctl_ConfigLevel *r)
601 {
602         uint32_t v;
603         NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
604         *r = v;
605         return NDR_ERR_SUCCESS;
606 }
607
608 _PUBLIC_ void ndr_print_svcctl_ConfigLevel(struct ndr_print *ndr, const char *name, enum svcctl_ConfigLevel r)
609 {
610         const char *val = NULL;
611
612         switch (r) {
613                 case SERVICE_CONFIG_DESCRIPTION: val = "SERVICE_CONFIG_DESCRIPTION"; break;
614                 case SERVICE_CONFIG_FAILURE_ACTIONS: val = "SERVICE_CONFIG_FAILURE_ACTIONS"; break;
615         }
616         ndr_print_enum(ndr, name, "ENUM", val, r);
617 }
618
619 static enum ndr_err_code ndr_push_svcctl_StatusLevel(struct ndr_push *ndr, int ndr_flags, enum svcctl_StatusLevel r)
620 {
621         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
622         return NDR_ERR_SUCCESS;
623 }
624
625 static enum ndr_err_code ndr_pull_svcctl_StatusLevel(struct ndr_pull *ndr, int ndr_flags, enum svcctl_StatusLevel *r)
626 {
627         uint32_t v;
628         NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
629         *r = v;
630         return NDR_ERR_SUCCESS;
631 }
632
633 _PUBLIC_ void ndr_print_svcctl_StatusLevel(struct ndr_print *ndr, const char *name, enum svcctl_StatusLevel r)
634 {
635         const char *val = NULL;
636
637         switch (r) {
638                 case SVC_STATUS_PROCESS_INFO: val = "SVC_STATUS_PROCESS_INFO"; break;
639         }
640         ndr_print_enum(ndr, name, "ENUM", val, r);
641 }
642
643 static enum ndr_err_code ndr_push_svcctl_CloseServiceHandle(struct ndr_push *ndr, int flags, const struct svcctl_CloseServiceHandle *r)
644 {
645         if (flags & NDR_IN) {
646                 if (r->in.handle == NULL) {
647                         return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
648                 }
649                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.handle));
650         }
651         if (flags & NDR_OUT) {
652                 if (r->out.handle == NULL) {
653                         return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
654                 }
655                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.handle));
656                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
657         }
658         return NDR_ERR_SUCCESS;
659 }
660
661 static enum ndr_err_code ndr_pull_svcctl_CloseServiceHandle(struct ndr_pull *ndr, int flags, struct svcctl_CloseServiceHandle *r)
662 {
663         TALLOC_CTX *_mem_save_handle_0;
664         if (flags & NDR_IN) {
665                 ZERO_STRUCT(r->out);
666
667                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
668                         NDR_PULL_ALLOC(ndr, r->in.handle);
669                 }
670                 _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
671                 NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC);
672                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.handle));
673                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
674                 NDR_PULL_ALLOC(ndr, r->out.handle);
675                 *r->out.handle = *r->in.handle;
676         }
677         if (flags & NDR_OUT) {
678                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
679                         NDR_PULL_ALLOC(ndr, r->out.handle);
680                 }
681                 _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
682                 NDR_PULL_SET_MEM_CTX(ndr, r->out.handle, LIBNDR_FLAG_REF_ALLOC);
683                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.handle));
684                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
685                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
686         }
687         return NDR_ERR_SUCCESS;
688 }
689
690 _PUBLIC_ void ndr_print_svcctl_CloseServiceHandle(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_CloseServiceHandle *r)
691 {
692         ndr_print_struct(ndr, name, "svcctl_CloseServiceHandle");
693         ndr->depth++;
694         if (flags & NDR_SET_VALUES) {
695                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
696         }
697         if (flags & NDR_IN) {
698                 ndr_print_struct(ndr, "in", "svcctl_CloseServiceHandle");
699                 ndr->depth++;
700                 ndr_print_ptr(ndr, "handle", r->in.handle);
701                 ndr->depth++;
702                 ndr_print_policy_handle(ndr, "handle", r->in.handle);
703                 ndr->depth--;
704                 ndr->depth--;
705         }
706         if (flags & NDR_OUT) {
707                 ndr_print_struct(ndr, "out", "svcctl_CloseServiceHandle");
708                 ndr->depth++;
709                 ndr_print_ptr(ndr, "handle", r->out.handle);
710                 ndr->depth++;
711                 ndr_print_policy_handle(ndr, "handle", r->out.handle);
712                 ndr->depth--;
713                 ndr_print_WERROR(ndr, "result", r->out.result);
714                 ndr->depth--;
715         }
716         ndr->depth--;
717 }
718
719 static enum ndr_err_code ndr_push_svcctl_ControlService(struct ndr_push *ndr, int flags, const struct svcctl_ControlService *r)
720 {
721         if (flags & NDR_IN) {
722                 if (r->in.handle == NULL) {
723                         return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
724                 }
725                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.handle));
726                 NDR_CHECK(ndr_push_SERVICE_CONTROL(ndr, NDR_SCALARS, r->in.control));
727         }
728         if (flags & NDR_OUT) {
729                 if (r->out.service_status == NULL) {
730                         return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
731                 }
732                 NDR_CHECK(ndr_push_SERVICE_STATUS(ndr, NDR_SCALARS, r->out.service_status));
733                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
734         }
735         return NDR_ERR_SUCCESS;
736 }
737
738 static enum ndr_err_code ndr_pull_svcctl_ControlService(struct ndr_pull *ndr, int flags, struct svcctl_ControlService *r)
739 {
740         TALLOC_CTX *_mem_save_handle_0;
741         TALLOC_CTX *_mem_save_service_status_0;
742         if (flags & NDR_IN) {
743                 ZERO_STRUCT(r->out);
744
745                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
746                         NDR_PULL_ALLOC(ndr, r->in.handle);
747                 }
748                 _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
749                 NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC);
750                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.handle));
751                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
752                 NDR_CHECK(ndr_pull_SERVICE_CONTROL(ndr, NDR_SCALARS, &r->in.control));
753                 NDR_PULL_ALLOC(ndr, r->out.service_status);
754                 ZERO_STRUCTP(r->out.service_status);
755         }
756         if (flags & NDR_OUT) {
757                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
758                         NDR_PULL_ALLOC(ndr, r->out.service_status);
759                 }
760                 _mem_save_service_status_0 = NDR_PULL_GET_MEM_CTX(ndr);
761                 NDR_PULL_SET_MEM_CTX(ndr, r->out.service_status, LIBNDR_FLAG_REF_ALLOC);
762                 NDR_CHECK(ndr_pull_SERVICE_STATUS(ndr, NDR_SCALARS, r->out.service_status));
763                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_service_status_0, LIBNDR_FLAG_REF_ALLOC);
764                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
765         }
766         return NDR_ERR_SUCCESS;
767 }
768
769 _PUBLIC_ void ndr_print_svcctl_ControlService(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_ControlService *r)
770 {
771         ndr_print_struct(ndr, name, "svcctl_ControlService");
772         ndr->depth++;
773         if (flags & NDR_SET_VALUES) {
774                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
775         }
776         if (flags & NDR_IN) {
777                 ndr_print_struct(ndr, "in", "svcctl_ControlService");
778                 ndr->depth++;
779                 ndr_print_ptr(ndr, "handle", r->in.handle);
780                 ndr->depth++;
781                 ndr_print_policy_handle(ndr, "handle", r->in.handle);
782                 ndr->depth--;
783                 ndr_print_SERVICE_CONTROL(ndr, "control", r->in.control);
784                 ndr->depth--;
785         }
786         if (flags & NDR_OUT) {
787                 ndr_print_struct(ndr, "out", "svcctl_ControlService");
788                 ndr->depth++;
789                 ndr_print_ptr(ndr, "service_status", r->out.service_status);
790                 ndr->depth++;
791                 ndr_print_SERVICE_STATUS(ndr, "service_status", r->out.service_status);
792                 ndr->depth--;
793                 ndr_print_WERROR(ndr, "result", r->out.result);
794                 ndr->depth--;
795         }
796         ndr->depth--;
797 }
798
799 static enum ndr_err_code ndr_push_svcctl_DeleteService(struct ndr_push *ndr, int flags, const struct svcctl_DeleteService *r)
800 {
801         if (flags & NDR_IN) {
802                 if (r->in.handle == NULL) {
803                         return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
804                 }
805                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.handle));
806         }
807         if (flags & NDR_OUT) {
808                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
809         }
810         return NDR_ERR_SUCCESS;
811 }
812
813 static enum ndr_err_code ndr_pull_svcctl_DeleteService(struct ndr_pull *ndr, int flags, struct svcctl_DeleteService *r)
814 {
815         TALLOC_CTX *_mem_save_handle_0;
816         if (flags & NDR_IN) {
817                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
818                         NDR_PULL_ALLOC(ndr, r->in.handle);
819                 }
820                 _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
821                 NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC);
822                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.handle));
823                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
824         }
825         if (flags & NDR_OUT) {
826                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
827         }
828         return NDR_ERR_SUCCESS;
829 }
830
831 _PUBLIC_ void ndr_print_svcctl_DeleteService(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_DeleteService *r)
832 {
833         ndr_print_struct(ndr, name, "svcctl_DeleteService");
834         ndr->depth++;
835         if (flags & NDR_SET_VALUES) {
836                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
837         }
838         if (flags & NDR_IN) {
839                 ndr_print_struct(ndr, "in", "svcctl_DeleteService");
840                 ndr->depth++;
841                 ndr_print_ptr(ndr, "handle", r->in.handle);
842                 ndr->depth++;
843                 ndr_print_policy_handle(ndr, "handle", r->in.handle);
844                 ndr->depth--;
845                 ndr->depth--;
846         }
847         if (flags & NDR_OUT) {
848                 ndr_print_struct(ndr, "out", "svcctl_DeleteService");
849                 ndr->depth++;
850                 ndr_print_WERROR(ndr, "result", r->out.result);
851                 ndr->depth--;
852         }
853         ndr->depth--;
854 }
855
856 static enum ndr_err_code ndr_push_svcctl_LockServiceDatabase(struct ndr_push *ndr, int flags, const struct svcctl_LockServiceDatabase *r)
857 {
858         if (flags & NDR_IN) {
859                 if (r->in.handle == NULL) {
860                         return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
861                 }
862                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.handle));
863         }
864         if (flags & NDR_OUT) {
865                 if (r->out.lock == NULL) {
866                         return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
867                 }
868                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.lock));
869                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
870         }
871         return NDR_ERR_SUCCESS;
872 }
873
874 static enum ndr_err_code ndr_pull_svcctl_LockServiceDatabase(struct ndr_pull *ndr, int flags, struct svcctl_LockServiceDatabase *r)
875 {
876         TALLOC_CTX *_mem_save_handle_0;
877         TALLOC_CTX *_mem_save_lock_0;
878         if (flags & NDR_IN) {
879                 ZERO_STRUCT(r->out);
880
881                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
882                         NDR_PULL_ALLOC(ndr, r->in.handle);
883                 }
884                 _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
885                 NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC);
886                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.handle));
887                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
888                 NDR_PULL_ALLOC(ndr, r->out.lock);
889                 ZERO_STRUCTP(r->out.lock);
890         }
891         if (flags & NDR_OUT) {
892                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
893                         NDR_PULL_ALLOC(ndr, r->out.lock);
894                 }
895                 _mem_save_lock_0 = NDR_PULL_GET_MEM_CTX(ndr);
896                 NDR_PULL_SET_MEM_CTX(ndr, r->out.lock, LIBNDR_FLAG_REF_ALLOC);
897                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.lock));
898                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_lock_0, LIBNDR_FLAG_REF_ALLOC);
899                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
900         }
901         return NDR_ERR_SUCCESS;
902 }
903
904 _PUBLIC_ void ndr_print_svcctl_LockServiceDatabase(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_LockServiceDatabase *r)
905 {
906         ndr_print_struct(ndr, name, "svcctl_LockServiceDatabase");
907         ndr->depth++;
908         if (flags & NDR_SET_VALUES) {
909                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
910         }
911         if (flags & NDR_IN) {
912                 ndr_print_struct(ndr, "in", "svcctl_LockServiceDatabase");
913                 ndr->depth++;
914                 ndr_print_ptr(ndr, "handle", r->in.handle);
915                 ndr->depth++;
916                 ndr_print_policy_handle(ndr, "handle", r->in.handle);
917                 ndr->depth--;
918                 ndr->depth--;
919         }
920         if (flags & NDR_OUT) {
921                 ndr_print_struct(ndr, "out", "svcctl_LockServiceDatabase");
922                 ndr->depth++;
923                 ndr_print_ptr(ndr, "lock", r->out.lock);
924                 ndr->depth++;
925                 ndr_print_policy_handle(ndr, "lock", r->out.lock);
926                 ndr->depth--;
927                 ndr_print_WERROR(ndr, "result", r->out.result);
928                 ndr->depth--;
929         }
930         ndr->depth--;
931 }
932
933 static enum ndr_err_code ndr_push_svcctl_QueryServiceObjectSecurity(struct ndr_push *ndr, int flags, const struct svcctl_QueryServiceObjectSecurity *r)
934 {
935         if (flags & NDR_IN) {
936                 if (r->in.handle == NULL) {
937                         return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
938                 }
939                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.handle));
940                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.security_flags));
941                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.buffer_size));
942         }
943         if (flags & NDR_OUT) {
944                 if (r->out.buffer == NULL) {
945                         return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
946                 }
947                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.buffer_size));
948                 NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->out.buffer, r->in.buffer_size));
949                 if (r->out.needed == NULL) {
950                         return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
951                 }
952                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.needed));
953                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
954         }
955         return NDR_ERR_SUCCESS;
956 }
957
958 static enum ndr_err_code ndr_pull_svcctl_QueryServiceObjectSecurity(struct ndr_pull *ndr, int flags, struct svcctl_QueryServiceObjectSecurity *r)
959 {
960         TALLOC_CTX *_mem_save_handle_0;
961         TALLOC_CTX *_mem_save_needed_0;
962         if (flags & NDR_IN) {
963                 ZERO_STRUCT(r->out);
964
965                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
966                         NDR_PULL_ALLOC(ndr, r->in.handle);
967                 }
968                 _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
969                 NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC);
970                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.handle));
971                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
972                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.security_flags));
973                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.buffer_size));
974                 if (r->in.buffer_size < 0 || r->in.buffer_size > 0x40000) {
975                         return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
976                 }
977                 NDR_PULL_ALLOC_N(ndr, r->out.buffer, r->in.buffer_size);
978                 memset(CONST_DISCARD(struct svcctl_QueryServiceObjectSecurity *,r->out.buffer), 0, (r->in.buffer_size) * sizeof(*r->out.buffer));
979                 NDR_PULL_ALLOC(ndr, r->out.needed);
980                 ZERO_STRUCTP(r->out.needed);
981         }
982         if (flags & NDR_OUT) {
983                 NDR_CHECK(ndr_pull_array_size(ndr, &r->out.buffer));
984                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
985                         NDR_PULL_ALLOC_N(ndr, r->out.buffer, ndr_get_array_size(ndr, &r->out.buffer));
986                 }
987                 NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->out.buffer, ndr_get_array_size(ndr, &r->out.buffer)));
988                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
989                         NDR_PULL_ALLOC(ndr, r->out.needed);
990                 }
991                 _mem_save_needed_0 = NDR_PULL_GET_MEM_CTX(ndr);
992                 NDR_PULL_SET_MEM_CTX(ndr, r->out.needed, LIBNDR_FLAG_REF_ALLOC);
993                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.needed));
994                 if (*r->out.needed < 0 || *r->out.needed > 0x40000) {
995                         return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
996                 }
997                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_needed_0, LIBNDR_FLAG_REF_ALLOC);
998                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
999                 if (r->out.buffer) {
1000                         NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->out.buffer, r->in.buffer_size));
1001                 }
1002         }
1003         return NDR_ERR_SUCCESS;
1004 }
1005
1006 _PUBLIC_ void ndr_print_svcctl_QueryServiceObjectSecurity(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_QueryServiceObjectSecurity *r)
1007 {
1008         ndr_print_struct(ndr, name, "svcctl_QueryServiceObjectSecurity");
1009         ndr->depth++;
1010         if (flags & NDR_SET_VALUES) {
1011                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
1012         }
1013         if (flags & NDR_IN) {
1014                 ndr_print_struct(ndr, "in", "svcctl_QueryServiceObjectSecurity");
1015                 ndr->depth++;
1016                 ndr_print_ptr(ndr, "handle", r->in.handle);
1017                 ndr->depth++;
1018                 ndr_print_policy_handle(ndr, "handle", r->in.handle);
1019                 ndr->depth--;
1020                 ndr_print_uint32(ndr, "security_flags", r->in.security_flags);
1021                 ndr_print_uint32(ndr, "buffer_size", r->in.buffer_size);
1022                 ndr->depth--;
1023         }
1024         if (flags & NDR_OUT) {
1025                 ndr_print_struct(ndr, "out", "svcctl_QueryServiceObjectSecurity");
1026                 ndr->depth++;
1027                 ndr_print_ptr(ndr, "buffer", r->out.buffer);
1028                 ndr->depth++;
1029                 ndr_print_array_uint8(ndr, "buffer", r->out.buffer, r->in.buffer_size);
1030                 ndr->depth--;
1031                 ndr_print_ptr(ndr, "needed", r->out.needed);
1032                 ndr->depth++;
1033                 ndr_print_uint32(ndr, "needed", *r->out.needed);
1034                 ndr->depth--;
1035                 ndr_print_WERROR(ndr, "result", r->out.result);
1036                 ndr->depth--;
1037         }
1038         ndr->depth--;
1039 }
1040
1041 static enum ndr_err_code ndr_push_svcctl_SetServiceObjectSecurity(struct ndr_push *ndr, int flags, const struct svcctl_SetServiceObjectSecurity *r)
1042 {
1043         if (flags & NDR_IN) {
1044                 if (r->in.handle == NULL) {
1045                         return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
1046                 }
1047                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.handle));
1048                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.security_flags));
1049                 if (r->in.buffer == NULL) {
1050                         return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
1051                 }
1052                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.buffer_size));
1053                 NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->in.buffer, r->in.buffer_size));
1054                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.buffer_size));
1055         }
1056         if (flags & NDR_OUT) {
1057                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
1058         }
1059         return NDR_ERR_SUCCESS;
1060 }
1061
1062 static enum ndr_err_code ndr_pull_svcctl_SetServiceObjectSecurity(struct ndr_pull *ndr, int flags, struct svcctl_SetServiceObjectSecurity *r)
1063 {
1064         TALLOC_CTX *_mem_save_handle_0;
1065         if (flags & NDR_IN) {
1066                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
1067                         NDR_PULL_ALLOC(ndr, r->in.handle);
1068                 }
1069                 _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
1070                 NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC);
1071                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.handle));
1072                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
1073                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.security_flags));
1074                 NDR_CHECK(ndr_pull_array_size(ndr, &r->in.buffer));
1075                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
1076                         NDR_PULL_ALLOC_N(ndr, r->in.buffer, ndr_get_array_size(ndr, &r->in.buffer));
1077                 }
1078                 NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->in.buffer, ndr_get_array_size(ndr, &r->in.buffer)));
1079                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.buffer_size));
1080                 if (r->in.buffer) {
1081                         NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->in.buffer, r->in.buffer_size));
1082                 }
1083         }
1084         if (flags & NDR_OUT) {
1085                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
1086         }
1087         return NDR_ERR_SUCCESS;
1088 }
1089
1090 _PUBLIC_ void ndr_print_svcctl_SetServiceObjectSecurity(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_SetServiceObjectSecurity *r)
1091 {
1092         ndr_print_struct(ndr, name, "svcctl_SetServiceObjectSecurity");
1093         ndr->depth++;
1094         if (flags & NDR_SET_VALUES) {
1095                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
1096         }
1097         if (flags & NDR_IN) {
1098                 ndr_print_struct(ndr, "in", "svcctl_SetServiceObjectSecurity");
1099                 ndr->depth++;
1100                 ndr_print_ptr(ndr, "handle", r->in.handle);
1101                 ndr->depth++;
1102                 ndr_print_policy_handle(ndr, "handle", r->in.handle);
1103                 ndr->depth--;
1104                 ndr_print_uint32(ndr, "security_flags", r->in.security_flags);
1105                 ndr_print_ptr(ndr, "buffer", r->in.buffer);
1106                 ndr->depth++;
1107                 ndr_print_array_uint8(ndr, "buffer", r->in.buffer, r->in.buffer_size);
1108                 ndr->depth--;
1109                 ndr_print_uint32(ndr, "buffer_size", r->in.buffer_size);
1110                 ndr->depth--;
1111         }
1112         if (flags & NDR_OUT) {
1113                 ndr_print_struct(ndr, "out", "svcctl_SetServiceObjectSecurity");
1114                 ndr->depth++;
1115                 ndr_print_WERROR(ndr, "result", r->out.result);
1116                 ndr->depth--;
1117         }
1118         ndr->depth--;
1119 }
1120
1121 static enum ndr_err_code ndr_push_svcctl_QueryServiceStatus(struct ndr_push *ndr, int flags, const struct svcctl_QueryServiceStatus *r)
1122 {
1123         if (flags & NDR_IN) {
1124                 if (r->in.handle == NULL) {
1125                         return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
1126                 }
1127                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.handle));
1128         }
1129         if (flags & NDR_OUT) {
1130                 if (r->out.service_status == NULL) {
1131                         return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
1132                 }
1133                 NDR_CHECK(ndr_push_SERVICE_STATUS(ndr, NDR_SCALARS, r->out.service_status));
1134                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
1135         }
1136         return NDR_ERR_SUCCESS;
1137 }
1138
1139 static enum ndr_err_code ndr_pull_svcctl_QueryServiceStatus(struct ndr_pull *ndr, int flags, struct svcctl_QueryServiceStatus *r)
1140 {
1141         TALLOC_CTX *_mem_save_handle_0;
1142         TALLOC_CTX *_mem_save_service_status_0;
1143         if (flags & NDR_IN) {
1144                 ZERO_STRUCT(r->out);
1145
1146                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
1147                         NDR_PULL_ALLOC(ndr, r->in.handle);
1148                 }
1149                 _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
1150                 NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC);
1151                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.handle));
1152                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
1153                 NDR_PULL_ALLOC(ndr, r->out.service_status);
1154                 ZERO_STRUCTP(r->out.service_status);
1155         }
1156         if (flags & NDR_OUT) {
1157                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
1158                         NDR_PULL_ALLOC(ndr, r->out.service_status);
1159                 }
1160                 _mem_save_service_status_0 = NDR_PULL_GET_MEM_CTX(ndr);
1161                 NDR_PULL_SET_MEM_CTX(ndr, r->out.service_status, LIBNDR_FLAG_REF_ALLOC);
1162                 NDR_CHECK(ndr_pull_SERVICE_STATUS(ndr, NDR_SCALARS, r->out.service_status));
1163                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_service_status_0, LIBNDR_FLAG_REF_ALLOC);
1164                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
1165         }
1166         return NDR_ERR_SUCCESS;
1167 }
1168
1169 _PUBLIC_ void ndr_print_svcctl_QueryServiceStatus(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_QueryServiceStatus *r)
1170 {
1171         ndr_print_struct(ndr, name, "svcctl_QueryServiceStatus");
1172         ndr->depth++;
1173         if (flags & NDR_SET_VALUES) {
1174                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
1175         }
1176         if (flags & NDR_IN) {
1177                 ndr_print_struct(ndr, "in", "svcctl_QueryServiceStatus");
1178                 ndr->depth++;
1179                 ndr_print_ptr(ndr, "handle", r->in.handle);
1180                 ndr->depth++;
1181                 ndr_print_policy_handle(ndr, "handle", r->in.handle);
1182                 ndr->depth--;
1183                 ndr->depth--;
1184         }
1185         if (flags & NDR_OUT) {
1186                 ndr_print_struct(ndr, "out", "svcctl_QueryServiceStatus");
1187                 ndr->depth++;
1188                 ndr_print_ptr(ndr, "service_status", r->out.service_status);
1189                 ndr->depth++;
1190                 ndr_print_SERVICE_STATUS(ndr, "service_status", r->out.service_status);
1191                 ndr->depth--;
1192                 ndr_print_WERROR(ndr, "result", r->out.result);
1193                 ndr->depth--;
1194         }
1195         ndr->depth--;
1196 }
1197
1198 static enum ndr_err_code ndr_push_svcctl_SetServiceStatus(struct ndr_push *ndr, int flags, const struct svcctl_SetServiceStatus *r)
1199 {
1200         if (flags & NDR_IN) {
1201         }
1202         if (flags & NDR_OUT) {
1203                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
1204         }
1205         return NDR_ERR_SUCCESS;
1206 }
1207
1208 static enum ndr_err_code ndr_pull_svcctl_SetServiceStatus(struct ndr_pull *ndr, int flags, struct svcctl_SetServiceStatus *r)
1209 {
1210         if (flags & NDR_IN) {
1211         }
1212         if (flags & NDR_OUT) {
1213                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
1214         }
1215         return NDR_ERR_SUCCESS;
1216 }
1217
1218 _PUBLIC_ void ndr_print_svcctl_SetServiceStatus(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_SetServiceStatus *r)
1219 {
1220         ndr_print_struct(ndr, name, "svcctl_SetServiceStatus");
1221         ndr->depth++;
1222         if (flags & NDR_SET_VALUES) {
1223                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
1224         }
1225         if (flags & NDR_IN) {
1226                 ndr_print_struct(ndr, "in", "svcctl_SetServiceStatus");
1227                 ndr->depth++;
1228                 ndr->depth--;
1229         }
1230         if (flags & NDR_OUT) {
1231                 ndr_print_struct(ndr, "out", "svcctl_SetServiceStatus");
1232                 ndr->depth++;
1233                 ndr_print_WERROR(ndr, "result", r->out.result);
1234                 ndr->depth--;
1235         }
1236         ndr->depth--;
1237 }
1238
1239 static enum ndr_err_code ndr_push_svcctl_UnlockServiceDatabase(struct ndr_push *ndr, int flags, const struct svcctl_UnlockServiceDatabase *r)
1240 {
1241         if (flags & NDR_IN) {
1242                 if (r->in.lock == NULL) {
1243                         return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
1244                 }
1245                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.lock));
1246         }
1247         if (flags & NDR_OUT) {
1248                 if (r->out.lock == NULL) {
1249                         return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
1250                 }
1251                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.lock));
1252                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
1253         }
1254         return NDR_ERR_SUCCESS;
1255 }
1256
1257 static enum ndr_err_code ndr_pull_svcctl_UnlockServiceDatabase(struct ndr_pull *ndr, int flags, struct svcctl_UnlockServiceDatabase *r)
1258 {
1259         TALLOC_CTX *_mem_save_lock_0;
1260         if (flags & NDR_IN) {
1261                 ZERO_STRUCT(r->out);
1262
1263                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
1264                         NDR_PULL_ALLOC(ndr, r->in.lock);
1265                 }
1266                 _mem_save_lock_0 = NDR_PULL_GET_MEM_CTX(ndr);
1267                 NDR_PULL_SET_MEM_CTX(ndr, r->in.lock, LIBNDR_FLAG_REF_ALLOC);
1268                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.lock));
1269                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_lock_0, LIBNDR_FLAG_REF_ALLOC);
1270                 NDR_PULL_ALLOC(ndr, r->out.lock);
1271                 *r->out.lock = *r->in.lock;
1272         }
1273         if (flags & NDR_OUT) {
1274                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
1275                         NDR_PULL_ALLOC(ndr, r->out.lock);
1276                 }
1277                 _mem_save_lock_0 = NDR_PULL_GET_MEM_CTX(ndr);
1278                 NDR_PULL_SET_MEM_CTX(ndr, r->out.lock, LIBNDR_FLAG_REF_ALLOC);
1279                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.lock));
1280                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_lock_0, LIBNDR_FLAG_REF_ALLOC);
1281                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
1282         }
1283         return NDR_ERR_SUCCESS;
1284 }
1285
1286 _PUBLIC_ void ndr_print_svcctl_UnlockServiceDatabase(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_UnlockServiceDatabase *r)
1287 {
1288         ndr_print_struct(ndr, name, "svcctl_UnlockServiceDatabase");
1289         ndr->depth++;
1290         if (flags & NDR_SET_VALUES) {
1291                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
1292         }
1293         if (flags & NDR_IN) {
1294                 ndr_print_struct(ndr, "in", "svcctl_UnlockServiceDatabase");
1295                 ndr->depth++;
1296                 ndr_print_ptr(ndr, "lock", r->in.lock);
1297                 ndr->depth++;
1298                 ndr_print_policy_handle(ndr, "lock", r->in.lock);
1299                 ndr->depth--;
1300                 ndr->depth--;
1301         }
1302         if (flags & NDR_OUT) {
1303                 ndr_print_struct(ndr, "out", "svcctl_UnlockServiceDatabase");
1304                 ndr->depth++;
1305                 ndr_print_ptr(ndr, "lock", r->out.lock);
1306                 ndr->depth++;
1307                 ndr_print_policy_handle(ndr, "lock", r->out.lock);
1308                 ndr->depth--;
1309                 ndr_print_WERROR(ndr, "result", r->out.result);
1310                 ndr->depth--;
1311         }
1312         ndr->depth--;
1313 }
1314
1315 static enum ndr_err_code ndr_push_svcctl_NotifyBootConfigStatus(struct ndr_push *ndr, int flags, const struct svcctl_NotifyBootConfigStatus *r)
1316 {
1317         if (flags & NDR_IN) {
1318         }
1319         if (flags & NDR_OUT) {
1320                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
1321         }
1322         return NDR_ERR_SUCCESS;
1323 }
1324
1325 static enum ndr_err_code ndr_pull_svcctl_NotifyBootConfigStatus(struct ndr_pull *ndr, int flags, struct svcctl_NotifyBootConfigStatus *r)
1326 {
1327         if (flags & NDR_IN) {
1328         }
1329         if (flags & NDR_OUT) {
1330                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
1331         }
1332         return NDR_ERR_SUCCESS;
1333 }
1334
1335 _PUBLIC_ void ndr_print_svcctl_NotifyBootConfigStatus(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_NotifyBootConfigStatus *r)
1336 {
1337         ndr_print_struct(ndr, name, "svcctl_NotifyBootConfigStatus");
1338         ndr->depth++;
1339         if (flags & NDR_SET_VALUES) {
1340                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
1341         }
1342         if (flags & NDR_IN) {
1343                 ndr_print_struct(ndr, "in", "svcctl_NotifyBootConfigStatus");
1344                 ndr->depth++;
1345                 ndr->depth--;
1346         }
1347         if (flags & NDR_OUT) {
1348                 ndr_print_struct(ndr, "out", "svcctl_NotifyBootConfigStatus");
1349                 ndr->depth++;
1350                 ndr_print_WERROR(ndr, "result", r->out.result);
1351                 ndr->depth--;
1352         }
1353         ndr->depth--;
1354 }
1355
1356 static enum ndr_err_code ndr_push_svcctl_SCSetServiceBitsW(struct ndr_push *ndr, int flags, const struct svcctl_SCSetServiceBitsW *r)
1357 {
1358         if (flags & NDR_IN) {
1359                 if (r->in.handle == NULL) {
1360                         return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
1361                 }
1362                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.handle));
1363                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.bits));
1364                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.bitson));
1365                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.immediate));
1366         }
1367         if (flags & NDR_OUT) {
1368                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
1369         }
1370         return NDR_ERR_SUCCESS;
1371 }
1372
1373 static enum ndr_err_code ndr_pull_svcctl_SCSetServiceBitsW(struct ndr_pull *ndr, int flags, struct svcctl_SCSetServiceBitsW *r)
1374 {
1375         TALLOC_CTX *_mem_save_handle_0;
1376         if (flags & NDR_IN) {
1377                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
1378                         NDR_PULL_ALLOC(ndr, r->in.handle);
1379                 }
1380                 _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
1381                 NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC);
1382                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.handle));
1383                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
1384                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.bits));
1385                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.bitson));
1386                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.immediate));
1387         }
1388         if (flags & NDR_OUT) {
1389                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
1390         }
1391         return NDR_ERR_SUCCESS;
1392 }
1393
1394 _PUBLIC_ void ndr_print_svcctl_SCSetServiceBitsW(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_SCSetServiceBitsW *r)
1395 {
1396         ndr_print_struct(ndr, name, "svcctl_SCSetServiceBitsW");
1397         ndr->depth++;
1398         if (flags & NDR_SET_VALUES) {
1399                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
1400         }
1401         if (flags & NDR_IN) {
1402                 ndr_print_struct(ndr, "in", "svcctl_SCSetServiceBitsW");
1403                 ndr->depth++;
1404                 ndr_print_ptr(ndr, "handle", r->in.handle);
1405                 ndr->depth++;
1406                 ndr_print_policy_handle(ndr, "handle", r->in.handle);
1407                 ndr->depth--;
1408                 ndr_print_uint32(ndr, "bits", r->in.bits);
1409                 ndr_print_uint32(ndr, "bitson", r->in.bitson);
1410                 ndr_print_uint32(ndr, "immediate", r->in.immediate);
1411                 ndr->depth--;
1412         }
1413         if (flags & NDR_OUT) {
1414                 ndr_print_struct(ndr, "out", "svcctl_SCSetServiceBitsW");
1415                 ndr->depth++;
1416                 ndr_print_WERROR(ndr, "result", r->out.result);
1417                 ndr->depth--;
1418         }
1419         ndr->depth--;
1420 }
1421
1422 static enum ndr_err_code ndr_push_svcctl_ChangeServiceConfigW(struct ndr_push *ndr, int flags, const struct svcctl_ChangeServiceConfigW *r)
1423 {
1424         if (flags & NDR_IN) {
1425                 if (r->in.handle == NULL) {
1426                         return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
1427                 }
1428                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.handle));
1429                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.type));
1430                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.start));
1431                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.error));
1432                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.binary_path));
1433                 if (r->in.binary_path) {
1434                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.binary_path, CH_UTF16)));
1435                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
1436                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.binary_path, CH_UTF16)));
1437                         NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.binary_path, ndr_charset_length(r->in.binary_path, CH_UTF16), sizeof(uint16_t), CH_UTF16));
1438                 }
1439                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.load_order_group));
1440                 if (r->in.load_order_group) {
1441                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.load_order_group, CH_UTF16)));
1442                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
1443                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.load_order_group, CH_UTF16)));
1444                         NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.load_order_group, ndr_charset_length(r->in.load_order_group, CH_UTF16), sizeof(uint16_t), CH_UTF16));
1445                 }
1446                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.dependencies));
1447                 if (r->in.dependencies) {
1448                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.dependencies, CH_UTF16)));
1449                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
1450                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.dependencies, CH_UTF16)));
1451                         NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.dependencies, ndr_charset_length(r->in.dependencies, CH_UTF16), sizeof(uint16_t), CH_UTF16));
1452                 }
1453                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.service_start_name));
1454                 if (r->in.service_start_name) {
1455                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.service_start_name, CH_UTF16)));
1456                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
1457                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.service_start_name, CH_UTF16)));
1458                         NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.service_start_name, ndr_charset_length(r->in.service_start_name, CH_UTF16), sizeof(uint16_t), CH_UTF16));
1459                 }
1460                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.password));
1461                 if (r->in.password) {
1462                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.password, CH_UTF16)));
1463                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
1464                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.password, CH_UTF16)));
1465                         NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.password, ndr_charset_length(r->in.password, CH_UTF16), sizeof(uint16_t), CH_UTF16));
1466                 }
1467                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.display_name));
1468                 if (r->in.display_name) {
1469                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.display_name, CH_UTF16)));
1470                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
1471                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.display_name, CH_UTF16)));
1472                         NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.display_name, ndr_charset_length(r->in.display_name, CH_UTF16), sizeof(uint16_t), CH_UTF16));
1473                 }
1474         }
1475         if (flags & NDR_OUT) {
1476                 if (r->out.tag_id == NULL) {
1477                         return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
1478                 }
1479                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.tag_id));
1480                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
1481         }
1482         return NDR_ERR_SUCCESS;
1483 }
1484
1485 static enum ndr_err_code ndr_pull_svcctl_ChangeServiceConfigW(struct ndr_pull *ndr, int flags, struct svcctl_ChangeServiceConfigW *r)
1486 {
1487         uint32_t _ptr_binary_path;
1488         uint32_t _ptr_load_order_group;
1489         uint32_t _ptr_dependencies;
1490         uint32_t _ptr_service_start_name;
1491         uint32_t _ptr_password;
1492         uint32_t _ptr_display_name;
1493         TALLOC_CTX *_mem_save_handle_0;
1494         TALLOC_CTX *_mem_save_binary_path_0;
1495         TALLOC_CTX *_mem_save_load_order_group_0;
1496         TALLOC_CTX *_mem_save_tag_id_0;
1497         TALLOC_CTX *_mem_save_dependencies_0;
1498         TALLOC_CTX *_mem_save_service_start_name_0;
1499         TALLOC_CTX *_mem_save_password_0;
1500         TALLOC_CTX *_mem_save_display_name_0;
1501         if (flags & NDR_IN) {
1502                 ZERO_STRUCT(r->out);
1503
1504                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
1505                         NDR_PULL_ALLOC(ndr, r->in.handle);
1506                 }
1507                 _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
1508                 NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC);
1509                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.handle));
1510                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
1511                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.type));
1512                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.start));
1513                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.error));
1514                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_binary_path));
1515                 if (_ptr_binary_path) {
1516                         NDR_PULL_ALLOC(ndr, r->in.binary_path);
1517                 } else {
1518                         r->in.binary_path = NULL;
1519                 }
1520                 if (r->in.binary_path) {
1521                         _mem_save_binary_path_0 = NDR_PULL_GET_MEM_CTX(ndr);
1522                         NDR_PULL_SET_MEM_CTX(ndr, r->in.binary_path, 0);
1523                         NDR_CHECK(ndr_pull_array_size(ndr, &r->in.binary_path));
1524                         NDR_CHECK(ndr_pull_array_length(ndr, &r->in.binary_path));
1525                         if (ndr_get_array_length(ndr, &r->in.binary_path) > ndr_get_array_size(ndr, &r->in.binary_path)) {
1526                                 return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.binary_path), ndr_get_array_length(ndr, &r->in.binary_path));
1527                         }
1528                         NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.binary_path), sizeof(uint16_t)));
1529                         NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.binary_path, ndr_get_array_length(ndr, &r->in.binary_path), sizeof(uint16_t), CH_UTF16));
1530                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_binary_path_0, 0);
1531                 }
1532                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_load_order_group));
1533                 if (_ptr_load_order_group) {
1534                         NDR_PULL_ALLOC(ndr, r->in.load_order_group);
1535                 } else {
1536                         r->in.load_order_group = NULL;
1537                 }
1538                 if (r->in.load_order_group) {
1539                         _mem_save_load_order_group_0 = NDR_PULL_GET_MEM_CTX(ndr);
1540                         NDR_PULL_SET_MEM_CTX(ndr, r->in.load_order_group, 0);
1541                         NDR_CHECK(ndr_pull_array_size(ndr, &r->in.load_order_group));
1542                         NDR_CHECK(ndr_pull_array_length(ndr, &r->in.load_order_group));
1543                         if (ndr_get_array_length(ndr, &r->in.load_order_group) > ndr_get_array_size(ndr, &r->in.load_order_group)) {
1544                                 return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.load_order_group), ndr_get_array_length(ndr, &r->in.load_order_group));
1545                         }
1546                         NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.load_order_group), sizeof(uint16_t)));
1547                         NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.load_order_group, ndr_get_array_length(ndr, &r->in.load_order_group), sizeof(uint16_t), CH_UTF16));
1548                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_load_order_group_0, 0);
1549                 }
1550                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_dependencies));
1551                 if (_ptr_dependencies) {
1552                         NDR_PULL_ALLOC(ndr, r->in.dependencies);
1553                 } else {
1554                         r->in.dependencies = NULL;
1555                 }
1556                 if (r->in.dependencies) {
1557                         _mem_save_dependencies_0 = NDR_PULL_GET_MEM_CTX(ndr);
1558                         NDR_PULL_SET_MEM_CTX(ndr, r->in.dependencies, 0);
1559                         NDR_CHECK(ndr_pull_array_size(ndr, &r->in.dependencies));
1560                         NDR_CHECK(ndr_pull_array_length(ndr, &r->in.dependencies));
1561                         if (ndr_get_array_length(ndr, &r->in.dependencies) > ndr_get_array_size(ndr, &r->in.dependencies)) {
1562                                 return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.dependencies), ndr_get_array_length(ndr, &r->in.dependencies));
1563                         }
1564                         NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.dependencies), sizeof(uint16_t)));
1565                         NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.dependencies, ndr_get_array_length(ndr, &r->in.dependencies), sizeof(uint16_t), CH_UTF16));
1566                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_dependencies_0, 0);
1567                 }
1568                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_service_start_name));
1569                 if (_ptr_service_start_name) {
1570                         NDR_PULL_ALLOC(ndr, r->in.service_start_name);
1571                 } else {
1572                         r->in.service_start_name = NULL;
1573                 }
1574                 if (r->in.service_start_name) {
1575                         _mem_save_service_start_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
1576                         NDR_PULL_SET_MEM_CTX(ndr, r->in.service_start_name, 0);
1577                         NDR_CHECK(ndr_pull_array_size(ndr, &r->in.service_start_name));
1578                         NDR_CHECK(ndr_pull_array_length(ndr, &r->in.service_start_name));
1579                         if (ndr_get_array_length(ndr, &r->in.service_start_name) > ndr_get_array_size(ndr, &r->in.service_start_name)) {
1580                                 return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.service_start_name), ndr_get_array_length(ndr, &r->in.service_start_name));
1581                         }
1582                         NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.service_start_name), sizeof(uint16_t)));
1583                         NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.service_start_name, ndr_get_array_length(ndr, &r->in.service_start_name), sizeof(uint16_t), CH_UTF16));
1584                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_service_start_name_0, 0);
1585                 }
1586                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_password));
1587                 if (_ptr_password) {
1588                         NDR_PULL_ALLOC(ndr, r->in.password);
1589                 } else {
1590                         r->in.password = NULL;
1591                 }
1592                 if (r->in.password) {
1593                         _mem_save_password_0 = NDR_PULL_GET_MEM_CTX(ndr);
1594                         NDR_PULL_SET_MEM_CTX(ndr, r->in.password, 0);
1595                         NDR_CHECK(ndr_pull_array_size(ndr, &r->in.password));
1596                         NDR_CHECK(ndr_pull_array_length(ndr, &r->in.password));
1597                         if (ndr_get_array_length(ndr, &r->in.password) > ndr_get_array_size(ndr, &r->in.password)) {
1598                                 return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.password), ndr_get_array_length(ndr, &r->in.password));
1599                         }
1600                         NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.password), sizeof(uint16_t)));
1601                         NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.password, ndr_get_array_length(ndr, &r->in.password), sizeof(uint16_t), CH_UTF16));
1602                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_password_0, 0);
1603                 }
1604                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_display_name));
1605                 if (_ptr_display_name) {
1606                         NDR_PULL_ALLOC(ndr, r->in.display_name);
1607                 } else {
1608                         r->in.display_name = NULL;
1609                 }
1610                 if (r->in.display_name) {
1611                         _mem_save_display_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
1612                         NDR_PULL_SET_MEM_CTX(ndr, r->in.display_name, 0);
1613                         NDR_CHECK(ndr_pull_array_size(ndr, &r->in.display_name));
1614                         NDR_CHECK(ndr_pull_array_length(ndr, &r->in.display_name));
1615                         if (ndr_get_array_length(ndr, &r->in.display_name) > ndr_get_array_size(ndr, &r->in.display_name)) {
1616                                 return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.display_name), ndr_get_array_length(ndr, &r->in.display_name));
1617                         }
1618                         NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.display_name), sizeof(uint16_t)));
1619                         NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.display_name, ndr_get_array_length(ndr, &r->in.display_name), sizeof(uint16_t), CH_UTF16));
1620                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_display_name_0, 0);
1621                 }
1622                 NDR_PULL_ALLOC(ndr, r->out.tag_id);
1623                 ZERO_STRUCTP(r->out.tag_id);
1624         }
1625         if (flags & NDR_OUT) {
1626                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
1627                         NDR_PULL_ALLOC(ndr, r->out.tag_id);
1628                 }
1629                 _mem_save_tag_id_0 = NDR_PULL_GET_MEM_CTX(ndr);
1630                 NDR_PULL_SET_MEM_CTX(ndr, r->out.tag_id, LIBNDR_FLAG_REF_ALLOC);
1631                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.tag_id));
1632                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_tag_id_0, LIBNDR_FLAG_REF_ALLOC);
1633                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
1634         }
1635         return NDR_ERR_SUCCESS;
1636 }
1637
1638 _PUBLIC_ void ndr_print_svcctl_ChangeServiceConfigW(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_ChangeServiceConfigW *r)
1639 {
1640         ndr_print_struct(ndr, name, "svcctl_ChangeServiceConfigW");
1641         ndr->depth++;
1642         if (flags & NDR_SET_VALUES) {
1643                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
1644         }
1645         if (flags & NDR_IN) {
1646                 ndr_print_struct(ndr, "in", "svcctl_ChangeServiceConfigW");
1647                 ndr->depth++;
1648                 ndr_print_ptr(ndr, "handle", r->in.handle);
1649                 ndr->depth++;
1650                 ndr_print_policy_handle(ndr, "handle", r->in.handle);
1651                 ndr->depth--;
1652                 ndr_print_uint32(ndr, "type", r->in.type);
1653                 ndr_print_uint32(ndr, "start", r->in.start);
1654                 ndr_print_uint32(ndr, "error", r->in.error);
1655                 ndr_print_ptr(ndr, "binary_path", r->in.binary_path);
1656                 ndr->depth++;
1657                 if (r->in.binary_path) {
1658                         ndr_print_string(ndr, "binary_path", r->in.binary_path);
1659                 }
1660                 ndr->depth--;
1661                 ndr_print_ptr(ndr, "load_order_group", r->in.load_order_group);
1662                 ndr->depth++;
1663                 if (r->in.load_order_group) {
1664                         ndr_print_string(ndr, "load_order_group", r->in.load_order_group);
1665                 }
1666                 ndr->depth--;
1667                 ndr_print_ptr(ndr, "dependencies", r->in.dependencies);
1668                 ndr->depth++;
1669                 if (r->in.dependencies) {
1670                         ndr_print_string(ndr, "dependencies", r->in.dependencies);
1671                 }
1672                 ndr->depth--;
1673                 ndr_print_ptr(ndr, "service_start_name", r->in.service_start_name);
1674                 ndr->depth++;
1675                 if (r->in.service_start_name) {
1676                         ndr_print_string(ndr, "service_start_name", r->in.service_start_name);
1677                 }
1678                 ndr->depth--;
1679                 ndr_print_ptr(ndr, "password", r->in.password);
1680                 ndr->depth++;
1681                 if (r->in.password) {
1682                         ndr_print_string(ndr, "password", r->in.password);
1683                 }
1684                 ndr->depth--;
1685                 ndr_print_ptr(ndr, "display_name", r->in.display_name);
1686                 ndr->depth++;
1687                 if (r->in.display_name) {
1688                         ndr_print_string(ndr, "display_name", r->in.display_name);
1689                 }
1690                 ndr->depth--;
1691                 ndr->depth--;
1692         }
1693         if (flags & NDR_OUT) {
1694                 ndr_print_struct(ndr, "out", "svcctl_ChangeServiceConfigW");
1695                 ndr->depth++;
1696                 ndr_print_ptr(ndr, "tag_id", r->out.tag_id);
1697                 ndr->depth++;
1698                 ndr_print_uint32(ndr, "tag_id", *r->out.tag_id);
1699                 ndr->depth--;
1700                 ndr_print_WERROR(ndr, "result", r->out.result);
1701                 ndr->depth--;
1702         }
1703         ndr->depth--;
1704 }
1705
1706 static enum ndr_err_code ndr_push_svcctl_CreateServiceW(struct ndr_push *ndr, int flags, const struct svcctl_CreateServiceW *r)
1707 {
1708         if (flags & NDR_IN) {
1709                 if (r->in.scmanager_handle == NULL) {
1710                         return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
1711                 }
1712                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.scmanager_handle));
1713                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.ServiceName, CH_UTF16)));
1714                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
1715                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.ServiceName, CH_UTF16)));
1716                 NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.ServiceName, ndr_charset_length(r->in.ServiceName, CH_UTF16), sizeof(uint16_t), CH_UTF16));
1717                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.DisplayName));
1718                 if (r->in.DisplayName) {
1719                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.DisplayName, CH_UTF16)));
1720                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
1721                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.DisplayName, CH_UTF16)));
1722                         NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.DisplayName, ndr_charset_length(r->in.DisplayName, CH_UTF16), sizeof(uint16_t), CH_UTF16));
1723                 }
1724                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.desired_access));
1725                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.type));
1726                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.start_type));
1727                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.error_control));
1728                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.binary_path, CH_UTF16)));
1729                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
1730                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.binary_path, CH_UTF16)));
1731                 NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.binary_path, ndr_charset_length(r->in.binary_path, CH_UTF16), sizeof(uint16_t), CH_UTF16));
1732                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.LoadOrderGroupKey));
1733                 if (r->in.LoadOrderGroupKey) {
1734                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.LoadOrderGroupKey, CH_UTF16)));
1735                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
1736                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.LoadOrderGroupKey, CH_UTF16)));
1737                         NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.LoadOrderGroupKey, ndr_charset_length(r->in.LoadOrderGroupKey, CH_UTF16), sizeof(uint16_t), CH_UTF16));
1738                 }
1739                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.TagId));
1740                 if (r->in.TagId) {
1741                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.TagId));
1742                 }
1743                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.dependencies));
1744                 if (r->in.dependencies) {
1745                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.dependencies_size));
1746                         NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->in.dependencies, r->in.dependencies_size));
1747                 }
1748                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.dependencies_size));
1749                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.service_start_name));
1750                 if (r->in.service_start_name) {
1751                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.service_start_name, CH_UTF16)));
1752                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
1753                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.service_start_name, CH_UTF16)));
1754                         NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.service_start_name, ndr_charset_length(r->in.service_start_name, CH_UTF16), sizeof(uint16_t), CH_UTF16));
1755                 }
1756                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.password));
1757                 if (r->in.password) {
1758                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.password_size));
1759                         NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->in.password, r->in.password_size));
1760                 }
1761                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.password_size));
1762         }
1763         if (flags & NDR_OUT) {
1764                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.TagId));
1765                 if (r->out.TagId) {
1766                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.TagId));
1767                 }
1768                 if (r->out.handle == NULL) {
1769                         return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
1770                 }
1771                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.handle));
1772                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
1773         }
1774         return NDR_ERR_SUCCESS;
1775 }
1776
1777 static enum ndr_err_code ndr_pull_svcctl_CreateServiceW(struct ndr_pull *ndr, int flags, struct svcctl_CreateServiceW *r)
1778 {
1779         uint32_t _ptr_DisplayName;
1780         uint32_t _ptr_LoadOrderGroupKey;
1781         uint32_t _ptr_TagId;
1782         uint32_t _ptr_dependencies;
1783         uint32_t _ptr_service_start_name;
1784         uint32_t _ptr_password;
1785         TALLOC_CTX *_mem_save_scmanager_handle_0;
1786         TALLOC_CTX *_mem_save_DisplayName_0;
1787         TALLOC_CTX *_mem_save_LoadOrderGroupKey_0;
1788         TALLOC_CTX *_mem_save_TagId_0;
1789         TALLOC_CTX *_mem_save_dependencies_0;
1790         TALLOC_CTX *_mem_save_service_start_name_0;
1791         TALLOC_CTX *_mem_save_password_0;
1792         TALLOC_CTX *_mem_save_handle_0;
1793         if (flags & NDR_IN) {
1794                 ZERO_STRUCT(r->out);
1795
1796                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
1797                         NDR_PULL_ALLOC(ndr, r->in.scmanager_handle);
1798                 }
1799                 _mem_save_scmanager_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
1800                 NDR_PULL_SET_MEM_CTX(ndr, r->in.scmanager_handle, LIBNDR_FLAG_REF_ALLOC);
1801                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.scmanager_handle));
1802                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_scmanager_handle_0, LIBNDR_FLAG_REF_ALLOC);
1803                 NDR_CHECK(ndr_pull_array_size(ndr, &r->in.ServiceName));
1804                 NDR_CHECK(ndr_pull_array_length(ndr, &r->in.ServiceName));
1805                 if (ndr_get_array_length(ndr, &r->in.ServiceName) > ndr_get_array_size(ndr, &r->in.ServiceName)) {
1806                         return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.ServiceName), ndr_get_array_length(ndr, &r->in.ServiceName));
1807                 }
1808                 NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.ServiceName), sizeof(uint16_t)));
1809                 NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.ServiceName, ndr_get_array_length(ndr, &r->in.ServiceName), sizeof(uint16_t), CH_UTF16));
1810                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_DisplayName));
1811                 if (_ptr_DisplayName) {
1812                         NDR_PULL_ALLOC(ndr, r->in.DisplayName);
1813                 } else {
1814                         r->in.DisplayName = NULL;
1815                 }
1816                 if (r->in.DisplayName) {
1817                         _mem_save_DisplayName_0 = NDR_PULL_GET_MEM_CTX(ndr);
1818                         NDR_PULL_SET_MEM_CTX(ndr, r->in.DisplayName, 0);
1819                         NDR_CHECK(ndr_pull_array_size(ndr, &r->in.DisplayName));
1820                         NDR_CHECK(ndr_pull_array_length(ndr, &r->in.DisplayName));
1821                         if (ndr_get_array_length(ndr, &r->in.DisplayName) > ndr_get_array_size(ndr, &r->in.DisplayName)) {
1822                                 return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.DisplayName), ndr_get_array_length(ndr, &r->in.DisplayName));
1823                         }
1824                         NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.DisplayName), sizeof(uint16_t)));
1825                         NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.DisplayName, ndr_get_array_length(ndr, &r->in.DisplayName), sizeof(uint16_t), CH_UTF16));
1826                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_DisplayName_0, 0);
1827                 }
1828                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.desired_access));
1829                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.type));
1830                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.start_type));
1831                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.error_control));
1832                 NDR_CHECK(ndr_pull_array_size(ndr, &r->in.binary_path));
1833                 NDR_CHECK(ndr_pull_array_length(ndr, &r->in.binary_path));
1834                 if (ndr_get_array_length(ndr, &r->in.binary_path) > ndr_get_array_size(ndr, &r->in.binary_path)) {
1835                         return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.binary_path), ndr_get_array_length(ndr, &r->in.binary_path));
1836                 }
1837                 NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.binary_path), sizeof(uint16_t)));
1838                 NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.binary_path, ndr_get_array_length(ndr, &r->in.binary_path), sizeof(uint16_t), CH_UTF16));
1839                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_LoadOrderGroupKey));
1840                 if (_ptr_LoadOrderGroupKey) {
1841                         NDR_PULL_ALLOC(ndr, r->in.LoadOrderGroupKey);
1842                 } else {
1843                         r->in.LoadOrderGroupKey = NULL;
1844                 }
1845                 if (r->in.LoadOrderGroupKey) {
1846                         _mem_save_LoadOrderGroupKey_0 = NDR_PULL_GET_MEM_CTX(ndr);
1847                         NDR_PULL_SET_MEM_CTX(ndr, r->in.LoadOrderGroupKey, 0);
1848                         NDR_CHECK(ndr_pull_array_size(ndr, &r->in.LoadOrderGroupKey));
1849                         NDR_CHECK(ndr_pull_array_length(ndr, &r->in.LoadOrderGroupKey));
1850                         if (ndr_get_array_length(ndr, &r->in.LoadOrderGroupKey) > ndr_get_array_size(ndr, &r->in.LoadOrderGroupKey)) {
1851                                 return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.LoadOrderGroupKey), ndr_get_array_length(ndr, &r->in.LoadOrderGroupKey));
1852                         }
1853                         NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.LoadOrderGroupKey), sizeof(uint16_t)));
1854                         NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.LoadOrderGroupKey, ndr_get_array_length(ndr, &r->in.LoadOrderGroupKey), sizeof(uint16_t), CH_UTF16));
1855                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_LoadOrderGroupKey_0, 0);
1856                 }
1857                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_TagId));
1858                 if (_ptr_TagId) {
1859                         NDR_PULL_ALLOC(ndr, r->in.TagId);
1860                 } else {
1861                         r->in.TagId = NULL;
1862                 }
1863                 if (r->in.TagId) {
1864                         _mem_save_TagId_0 = NDR_PULL_GET_MEM_CTX(ndr);
1865                         NDR_PULL_SET_MEM_CTX(ndr, r->in.TagId, 0);
1866                         NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.TagId));
1867                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_TagId_0, 0);
1868                 }
1869                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_dependencies));
1870                 if (_ptr_dependencies) {
1871                         NDR_PULL_ALLOC(ndr, r->in.dependencies);
1872                 } else {
1873                         r->in.dependencies = NULL;
1874                 }
1875                 if (r->in.dependencies) {
1876                         _mem_save_dependencies_0 = NDR_PULL_GET_MEM_CTX(ndr);
1877                         NDR_PULL_SET_MEM_CTX(ndr, r->in.dependencies, 0);
1878                         NDR_CHECK(ndr_pull_array_size(ndr, &r->in.dependencies));
1879                         NDR_PULL_ALLOC_N(ndr, r->in.dependencies, ndr_get_array_size(ndr, &r->in.dependencies));
1880                         NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->in.dependencies, ndr_get_array_size(ndr, &r->in.dependencies)));
1881                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_dependencies_0, 0);
1882                 }
1883                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.dependencies_size));
1884                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_service_start_name));
1885                 if (_ptr_service_start_name) {
1886                         NDR_PULL_ALLOC(ndr, r->in.service_start_name);
1887                 } else {
1888                         r->in.service_start_name = NULL;
1889                 }
1890                 if (r->in.service_start_name) {
1891                         _mem_save_service_start_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
1892                         NDR_PULL_SET_MEM_CTX(ndr, r->in.service_start_name, 0);
1893                         NDR_CHECK(ndr_pull_array_size(ndr, &r->in.service_start_name));
1894                         NDR_CHECK(ndr_pull_array_length(ndr, &r->in.service_start_name));
1895                         if (ndr_get_array_length(ndr, &r->in.service_start_name) > ndr_get_array_size(ndr, &r->in.service_start_name)) {
1896                                 return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.service_start_name), ndr_get_array_length(ndr, &r->in.service_start_name));
1897                         }
1898                         NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.service_start_name), sizeof(uint16_t)));
1899                         NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.service_start_name, ndr_get_array_length(ndr, &r->in.service_start_name), sizeof(uint16_t), CH_UTF16));
1900                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_service_start_name_0, 0);
1901                 }
1902                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_password));
1903                 if (_ptr_password) {
1904                         NDR_PULL_ALLOC(ndr, r->in.password);
1905                 } else {
1906                         r->in.password = NULL;
1907                 }
1908                 if (r->in.password) {
1909                         _mem_save_password_0 = NDR_PULL_GET_MEM_CTX(ndr);
1910                         NDR_PULL_SET_MEM_CTX(ndr, r->in.password, 0);
1911                         NDR_CHECK(ndr_pull_array_size(ndr, &r->in.password));
1912                         NDR_PULL_ALLOC_N(ndr, r->in.password, ndr_get_array_size(ndr, &r->in.password));
1913                         NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->in.password, ndr_get_array_size(ndr, &r->in.password)));
1914                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_password_0, 0);
1915                 }
1916                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.password_size));
1917                 NDR_PULL_ALLOC(ndr, r->out.handle);
1918                 ZERO_STRUCTP(r->out.handle);
1919                 if (r->in.dependencies) {
1920                         NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->in.dependencies, r->in.dependencies_size));
1921                 }
1922                 if (r->in.password) {
1923                         NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->in.password, r->in.password_size));
1924                 }
1925         }
1926         if (flags & NDR_OUT) {
1927                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_TagId));
1928                 if (_ptr_TagId) {
1929                         NDR_PULL_ALLOC(ndr, r->out.TagId);
1930                 } else {
1931                         r->out.TagId = NULL;
1932                 }
1933                 if (r->out.TagId) {
1934                         _mem_save_TagId_0 = NDR_PULL_GET_MEM_CTX(ndr);
1935                         NDR_PULL_SET_MEM_CTX(ndr, r->out.TagId, 0);
1936                         NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.TagId));
1937                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_TagId_0, 0);
1938                 }
1939                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
1940                         NDR_PULL_ALLOC(ndr, r->out.handle);
1941                 }
1942                 _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
1943                 NDR_PULL_SET_MEM_CTX(ndr, r->out.handle, LIBNDR_FLAG_REF_ALLOC);
1944                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.handle));
1945                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
1946                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
1947         }
1948         return NDR_ERR_SUCCESS;
1949 }
1950
1951 _PUBLIC_ void ndr_print_svcctl_CreateServiceW(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_CreateServiceW *r)
1952 {
1953         ndr_print_struct(ndr, name, "svcctl_CreateServiceW");
1954         ndr->depth++;
1955         if (flags & NDR_SET_VALUES) {
1956                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
1957         }
1958         if (flags & NDR_IN) {
1959                 ndr_print_struct(ndr, "in", "svcctl_CreateServiceW");
1960                 ndr->depth++;
1961                 ndr_print_ptr(ndr, "scmanager_handle", r->in.scmanager_handle);
1962                 ndr->depth++;
1963                 ndr_print_policy_handle(ndr, "scmanager_handle", r->in.scmanager_handle);
1964                 ndr->depth--;
1965                 ndr_print_string(ndr, "ServiceName", r->in.ServiceName);
1966                 ndr_print_ptr(ndr, "DisplayName", r->in.DisplayName);
1967                 ndr->depth++;
1968                 if (r->in.DisplayName) {
1969                         ndr_print_string(ndr, "DisplayName", r->in.DisplayName);
1970                 }
1971                 ndr->depth--;
1972                 ndr_print_uint32(ndr, "desired_access", r->in.desired_access);
1973                 ndr_print_uint32(ndr, "type", r->in.type);
1974                 ndr_print_uint32(ndr, "start_type", r->in.start_type);
1975                 ndr_print_uint32(ndr, "error_control", r->in.error_control);
1976                 ndr_print_string(ndr, "binary_path", r->in.binary_path);
1977                 ndr_print_ptr(ndr, "LoadOrderGroupKey", r->in.LoadOrderGroupKey);
1978                 ndr->depth++;
1979                 if (r->in.LoadOrderGroupKey) {
1980                         ndr_print_string(ndr, "LoadOrderGroupKey", r->in.LoadOrderGroupKey);
1981                 }
1982                 ndr->depth--;
1983                 ndr_print_ptr(ndr, "TagId", r->in.TagId);
1984                 ndr->depth++;
1985                 if (r->in.TagId) {
1986                         ndr_print_uint32(ndr, "TagId", *r->in.TagId);
1987                 }
1988                 ndr->depth--;
1989                 ndr_print_ptr(ndr, "dependencies", r->in.dependencies);
1990                 ndr->depth++;
1991                 if (r->in.dependencies) {
1992                         ndr_print_array_uint8(ndr, "dependencies", r->in.dependencies, r->in.dependencies_size);
1993                 }
1994                 ndr->depth--;
1995                 ndr_print_uint32(ndr, "dependencies_size", r->in.dependencies_size);
1996                 ndr_print_ptr(ndr, "service_start_name", r->in.service_start_name);
1997                 ndr->depth++;
1998                 if (r->in.service_start_name) {
1999                         ndr_print_string(ndr, "service_start_name", r->in.service_start_name);
2000                 }
2001                 ndr->depth--;
2002                 ndr_print_ptr(ndr, "password", r->in.password);
2003                 ndr->depth++;
2004                 if (r->in.password) {
2005                         ndr_print_array_uint8(ndr, "password", r->in.password, r->in.password_size);
2006                 }
2007                 ndr->depth--;
2008                 ndr_print_uint32(ndr, "password_size", r->in.password_size);
2009                 ndr->depth--;
2010         }
2011         if (flags & NDR_OUT) {
2012                 ndr_print_struct(ndr, "out", "svcctl_CreateServiceW");
2013                 ndr->depth++;
2014                 ndr_print_ptr(ndr, "TagId", r->out.TagId);
2015                 ndr->depth++;
2016                 if (r->out.TagId) {
2017                         ndr_print_uint32(ndr, "TagId", *r->out.TagId);
2018                 }
2019                 ndr->depth--;
2020                 ndr_print_ptr(ndr, "handle", r->out.handle);
2021                 ndr->depth++;
2022                 ndr_print_policy_handle(ndr, "handle", r->out.handle);
2023                 ndr->depth--;
2024                 ndr_print_WERROR(ndr, "result", r->out.result);
2025                 ndr->depth--;
2026         }
2027         ndr->depth--;
2028 }
2029
2030 static enum ndr_err_code ndr_push_svcctl_EnumDependentServicesW(struct ndr_push *ndr, int flags, const struct svcctl_EnumDependentServicesW *r)
2031 {
2032         if (flags & NDR_IN) {
2033                 if (r->in.service == NULL) {
2034                         return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
2035                 }
2036                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.service));
2037                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.state));
2038                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.buf_size));
2039         }
2040         if (flags & NDR_OUT) {
2041                 if (r->out.service_status == NULL) {
2042                         return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
2043                 }
2044                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.buf_size));
2045                 NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->out.service_status, r->in.buf_size));
2046                 if (r->out.bytes_needed == NULL) {
2047                         return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
2048                 }
2049                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.bytes_needed));
2050                 if (r->out.services_returned == NULL) {
2051                         return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
2052                 }
2053                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.services_returned));
2054                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
2055         }
2056         return NDR_ERR_SUCCESS;
2057 }
2058
2059 static enum ndr_err_code ndr_pull_svcctl_EnumDependentServicesW(struct ndr_pull *ndr, int flags, struct svcctl_EnumDependentServicesW *r)
2060 {
2061         TALLOC_CTX *_mem_save_service_0;
2062         TALLOC_CTX *_mem_save_bytes_needed_0;
2063         TALLOC_CTX *_mem_save_services_returned_0;
2064         if (flags & NDR_IN) {
2065                 ZERO_STRUCT(r->out);
2066
2067                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
2068                         NDR_PULL_ALLOC(ndr, r->in.service);
2069                 }
2070                 _mem_save_service_0 = NDR_PULL_GET_MEM_CTX(ndr);
2071                 NDR_PULL_SET_MEM_CTX(ndr, r->in.service, LIBNDR_FLAG_REF_ALLOC);
2072                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.service));
2073                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_service_0, LIBNDR_FLAG_REF_ALLOC);
2074                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.state));
2075                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.buf_size));
2076                 if (r->in.buf_size < 0 || r->in.buf_size > 0x40000) {
2077                         return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
2078                 }
2079                 NDR_PULL_ALLOC_N(ndr, r->out.service_status, r->in.buf_size);
2080                 memset(CONST_DISCARD(struct svcctl_EnumDependentServicesW *,r->out.service_status), 0, (r->in.buf_size) * sizeof(*r->out.service_status));
2081                 NDR_PULL_ALLOC(ndr, r->out.bytes_needed);
2082                 ZERO_STRUCTP(r->out.bytes_needed);
2083                 NDR_PULL_ALLOC(ndr, r->out.services_returned);
2084                 ZERO_STRUCTP(r->out.services_returned);
2085         }
2086         if (flags & NDR_OUT) {
2087                 NDR_CHECK(ndr_pull_array_size(ndr, &r->out.service_status));
2088                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
2089                         NDR_PULL_ALLOC_N(ndr, r->out.service_status, ndr_get_array_size(ndr, &r->out.service_status));
2090                 }
2091                 NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->out.service_status, ndr_get_array_size(ndr, &r->out.service_status)));
2092                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
2093                         NDR_PULL_ALLOC(ndr, r->out.bytes_needed);
2094                 }
2095                 _mem_save_bytes_needed_0 = NDR_PULL_GET_MEM_CTX(ndr);
2096                 NDR_PULL_SET_MEM_CTX(ndr, r->out.bytes_needed, LIBNDR_FLAG_REF_ALLOC);
2097                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.bytes_needed));
2098                 if (*r->out.bytes_needed < 0 || *r->out.bytes_needed > 0x40000) {
2099                         return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
2100                 }
2101                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_bytes_needed_0, LIBNDR_FLAG_REF_ALLOC);
2102                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
2103                         NDR_PULL_ALLOC(ndr, r->out.services_returned);
2104                 }
2105                 _mem_save_services_returned_0 = NDR_PULL_GET_MEM_CTX(ndr);
2106                 NDR_PULL_SET_MEM_CTX(ndr, r->out.services_returned, LIBNDR_FLAG_REF_ALLOC);
2107                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.services_returned));
2108                 if (*r->out.services_returned < 0 || *r->out.services_returned > 0x40000) {
2109                         return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
2110                 }
2111                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_services_returned_0, LIBNDR_FLAG_REF_ALLOC);
2112                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
2113                 if (r->out.service_status) {
2114                         NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->out.service_status, r->in.buf_size));
2115                 }
2116         }
2117         return NDR_ERR_SUCCESS;
2118 }
2119
2120 _PUBLIC_ void ndr_print_svcctl_EnumDependentServicesW(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_EnumDependentServicesW *r)
2121 {
2122         ndr_print_struct(ndr, name, "svcctl_EnumDependentServicesW");
2123         ndr->depth++;
2124         if (flags & NDR_SET_VALUES) {
2125                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
2126         }
2127         if (flags & NDR_IN) {
2128                 ndr_print_struct(ndr, "in", "svcctl_EnumDependentServicesW");
2129                 ndr->depth++;
2130                 ndr_print_ptr(ndr, "service", r->in.service);
2131                 ndr->depth++;
2132                 ndr_print_policy_handle(ndr, "service", r->in.service);
2133                 ndr->depth--;
2134                 ndr_print_uint32(ndr, "state", r->in.state);
2135                 ndr_print_uint32(ndr, "buf_size", r->in.buf_size);
2136                 ndr->depth--;
2137         }
2138         if (flags & NDR_OUT) {
2139                 ndr_print_struct(ndr, "out", "svcctl_EnumDependentServicesW");
2140                 ndr->depth++;
2141                 ndr_print_ptr(ndr, "service_status", r->out.service_status);
2142                 ndr->depth++;
2143                 ndr_print_array_uint8(ndr, "service_status", r->out.service_status, r->in.buf_size);
2144                 ndr->depth--;
2145                 ndr_print_ptr(ndr, "bytes_needed", r->out.bytes_needed);
2146                 ndr->depth++;
2147                 ndr_print_uint32(ndr, "bytes_needed", *r->out.bytes_needed);
2148                 ndr->depth--;
2149                 ndr_print_ptr(ndr, "services_returned", r->out.services_returned);
2150                 ndr->depth++;
2151                 ndr_print_uint32(ndr, "services_returned", *r->out.services_returned);
2152                 ndr->depth--;
2153                 ndr_print_WERROR(ndr, "result", r->out.result);
2154                 ndr->depth--;
2155         }
2156         ndr->depth--;
2157 }
2158
2159 static enum ndr_err_code ndr_push_svcctl_EnumServicesStatusW(struct ndr_push *ndr, int flags, const struct svcctl_EnumServicesStatusW *r)
2160 {
2161         if (flags & NDR_IN) {
2162                 if (r->in.handle == NULL) {
2163                         return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
2164                 }
2165                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.handle));
2166                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.type));
2167                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.state));
2168                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.buf_size));
2169                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.resume_handle));
2170                 if (r->in.resume_handle) {
2171                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.resume_handle));
2172                 }
2173         }
2174         if (flags & NDR_OUT) {
2175                 if (r->out.service == NULL) {
2176                         return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
2177                 }
2178                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.buf_size));
2179                 NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->out.service, r->in.buf_size));
2180                 if (r->out.bytes_needed == NULL) {
2181                         return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
2182                 }
2183                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.bytes_needed));
2184                 if (r->out.services_returned == NULL) {
2185                         return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
2186                 }
2187                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.services_returned));
2188                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.resume_handle));
2189                 if (r->out.resume_handle) {
2190                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.resume_handle));
2191                 }
2192                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
2193         }
2194         return NDR_ERR_SUCCESS;
2195 }
2196
2197 static enum ndr_err_code ndr_pull_svcctl_EnumServicesStatusW(struct ndr_pull *ndr, int flags, struct svcctl_EnumServicesStatusW *r)
2198 {
2199         uint32_t _ptr_resume_handle;
2200         TALLOC_CTX *_mem_save_handle_0;
2201         TALLOC_CTX *_mem_save_bytes_needed_0;
2202         TALLOC_CTX *_mem_save_services_returned_0;
2203         TALLOC_CTX *_mem_save_resume_handle_0;
2204         if (flags & NDR_IN) {
2205                 ZERO_STRUCT(r->out);
2206
2207                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
2208                         NDR_PULL_ALLOC(ndr, r->in.handle);
2209                 }
2210                 _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
2211                 NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC);
2212                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.handle));
2213                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
2214                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.type));
2215                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.state));
2216                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.buf_size));
2217                 if (r->in.buf_size < 0 || r->in.buf_size > 262144) {
2218                         return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
2219                 }
2220                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_resume_handle));
2221                 if (_ptr_resume_handle) {
2222                         NDR_PULL_ALLOC(ndr, r->in.resume_handle);
2223                 } else {
2224                         r->in.resume_handle = NULL;
2225                 }
2226                 if (r->in.resume_handle) {
2227                         _mem_save_resume_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
2228                         NDR_PULL_SET_MEM_CTX(ndr, r->in.resume_handle, 0);
2229                         NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.resume_handle));
2230                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_resume_handle_0, 0);
2231                 }
2232                 NDR_PULL_ALLOC_N(ndr, r->out.service, r->in.buf_size);
2233                 memset(CONST_DISCARD(struct svcctl_EnumServicesStatusW *,r->out.service), 0, (r->in.buf_size) * sizeof(*r->out.service));
2234                 NDR_PULL_ALLOC(ndr, r->out.bytes_needed);
2235                 ZERO_STRUCTP(r->out.bytes_needed);
2236                 NDR_PULL_ALLOC(ndr, r->out.services_returned);
2237                 ZERO_STRUCTP(r->out.services_returned);
2238         }
2239         if (flags & NDR_OUT) {
2240                 NDR_CHECK(ndr_pull_array_size(ndr, &r->out.service));
2241                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
2242                         NDR_PULL_ALLOC_N(ndr, r->out.service, ndr_get_array_size(ndr, &r->out.service));
2243                 }
2244                 NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->out.service, ndr_get_array_size(ndr, &r->out.service)));
2245                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
2246                         NDR_PULL_ALLOC(ndr, r->out.bytes_needed);
2247                 }
2248                 _mem_save_bytes_needed_0 = NDR_PULL_GET_MEM_CTX(ndr);
2249                 NDR_PULL_SET_MEM_CTX(ndr, r->out.bytes_needed, LIBNDR_FLAG_REF_ALLOC);
2250                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.bytes_needed));
2251                 if (*r->out.bytes_needed < 0 || *r->out.bytes_needed > 262144) {
2252                         return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
2253                 }
2254                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_bytes_needed_0, LIBNDR_FLAG_REF_ALLOC);
2255                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
2256                         NDR_PULL_ALLOC(ndr, r->out.services_returned);
2257                 }
2258                 _mem_save_services_returned_0 = NDR_PULL_GET_MEM_CTX(ndr);
2259                 NDR_PULL_SET_MEM_CTX(ndr, r->out.services_returned, LIBNDR_FLAG_REF_ALLOC);
2260                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.services_returned));
2261                 if (*r->out.services_returned < 0 || *r->out.services_returned > 262144) {
2262                         return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
2263                 }
2264                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_services_returned_0, LIBNDR_FLAG_REF_ALLOC);
2265                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_resume_handle));
2266                 if (_ptr_resume_handle) {
2267                         NDR_PULL_ALLOC(ndr, r->out.resume_handle);
2268                 } else {
2269                         r->out.resume_handle = NULL;
2270                 }
2271                 if (r->out.resume_handle) {
2272                         _mem_save_resume_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
2273                         NDR_PULL_SET_MEM_CTX(ndr, r->out.resume_handle, 0);
2274                         NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.resume_handle));
2275                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_resume_handle_0, 0);
2276                 }
2277                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
2278                 if (r->out.service) {
2279                         NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->out.service, r->in.buf_size));
2280                 }
2281         }
2282         return NDR_ERR_SUCCESS;
2283 }
2284
2285 _PUBLIC_ void ndr_print_svcctl_EnumServicesStatusW(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_EnumServicesStatusW *r)
2286 {
2287         ndr_print_struct(ndr, name, "svcctl_EnumServicesStatusW");
2288         ndr->depth++;
2289         if (flags & NDR_SET_VALUES) {
2290                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
2291         }
2292         if (flags & NDR_IN) {
2293                 ndr_print_struct(ndr, "in", "svcctl_EnumServicesStatusW");
2294                 ndr->depth++;
2295                 ndr_print_ptr(ndr, "handle", r->in.handle);
2296                 ndr->depth++;
2297                 ndr_print_policy_handle(ndr, "handle", r->in.handle);
2298                 ndr->depth--;
2299                 ndr_print_uint32(ndr, "type", r->in.type);
2300                 ndr_print_uint32(ndr, "state", r->in.state);
2301                 ndr_print_uint32(ndr, "buf_size", r->in.buf_size);
2302                 ndr_print_ptr(ndr, "resume_handle", r->in.resume_handle);
2303                 ndr->depth++;
2304                 if (r->in.resume_handle) {
2305                         ndr_print_uint32(ndr, "resume_handle", *r->in.resume_handle);
2306                 }
2307                 ndr->depth--;
2308                 ndr->depth--;
2309         }
2310         if (flags & NDR_OUT) {
2311                 ndr_print_struct(ndr, "out", "svcctl_EnumServicesStatusW");
2312                 ndr->depth++;
2313                 ndr_print_ptr(ndr, "service", r->out.service);
2314                 ndr->depth++;
2315                 ndr_print_array_uint8(ndr, "service", r->out.service, r->in.buf_size);
2316                 ndr->depth--;
2317                 ndr_print_ptr(ndr, "bytes_needed", r->out.bytes_needed);
2318                 ndr->depth++;
2319                 ndr_print_uint32(ndr, "bytes_needed", *r->out.bytes_needed);
2320                 ndr->depth--;
2321                 ndr_print_ptr(ndr, "services_returned", r->out.services_returned);
2322                 ndr->depth++;
2323                 ndr_print_uint32(ndr, "services_returned", *r->out.services_returned);
2324                 ndr->depth--;
2325                 ndr_print_ptr(ndr, "resume_handle", r->out.resume_handle);
2326                 ndr->depth++;
2327                 if (r->out.resume_handle) {
2328                         ndr_print_uint32(ndr, "resume_handle", *r->out.resume_handle);
2329                 }
2330                 ndr->depth--;
2331                 ndr_print_WERROR(ndr, "result", r->out.result);
2332                 ndr->depth--;
2333         }
2334         ndr->depth--;
2335 }
2336
2337 static enum ndr_err_code ndr_push_svcctl_OpenSCManagerW(struct ndr_push *ndr, int flags, const struct svcctl_OpenSCManagerW *r)
2338 {
2339         if (flags & NDR_IN) {
2340                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.MachineName));
2341                 if (r->in.MachineName) {
2342                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.MachineName, CH_UTF16)));
2343                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
2344                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.MachineName, CH_UTF16)));
2345                         NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.MachineName, ndr_charset_length(r->in.MachineName, CH_UTF16), sizeof(uint16_t), CH_UTF16));
2346                 }
2347                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.DatabaseName));
2348                 if (r->in.DatabaseName) {
2349                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.DatabaseName, CH_UTF16)));
2350                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
2351                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.DatabaseName, CH_UTF16)));
2352                         NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.DatabaseName, ndr_charset_length(r->in.DatabaseName, CH_UTF16), sizeof(uint16_t), CH_UTF16));
2353                 }
2354                 NDR_CHECK(ndr_push_svcctl_MgrAccessMask(ndr, NDR_SCALARS, r->in.access_mask));
2355         }
2356         if (flags & NDR_OUT) {
2357                 if (r->out.handle == NULL) {
2358                         return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
2359                 }
2360                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.handle));
2361                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
2362         }
2363         return NDR_ERR_SUCCESS;
2364 }
2365
2366 static enum ndr_err_code ndr_pull_svcctl_OpenSCManagerW(struct ndr_pull *ndr, int flags, struct svcctl_OpenSCManagerW *r)
2367 {
2368         uint32_t _ptr_MachineName;
2369         uint32_t _ptr_DatabaseName;
2370         TALLOC_CTX *_mem_save_MachineName_0;
2371         TALLOC_CTX *_mem_save_DatabaseName_0;
2372         TALLOC_CTX *_mem_save_handle_0;
2373         if (flags & NDR_IN) {
2374                 ZERO_STRUCT(r->out);
2375
2376                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_MachineName));
2377                 if (_ptr_MachineName) {
2378                         NDR_PULL_ALLOC(ndr, r->in.MachineName);
2379                 } else {
2380                         r->in.MachineName = NULL;
2381                 }
2382                 if (r->in.MachineName) {
2383                         _mem_save_MachineName_0 = NDR_PULL_GET_MEM_CTX(ndr);
2384                         NDR_PULL_SET_MEM_CTX(ndr, r->in.MachineName, 0);
2385                         NDR_CHECK(ndr_pull_array_size(ndr, &r->in.MachineName));
2386                         NDR_CHECK(ndr_pull_array_length(ndr, &r->in.MachineName));
2387                         if (ndr_get_array_length(ndr, &r->in.MachineName) > ndr_get_array_size(ndr, &r->in.MachineName)) {
2388                                 return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.MachineName), ndr_get_array_length(ndr, &r->in.MachineName));
2389                         }
2390                         NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.MachineName), sizeof(uint16_t)));
2391                         NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.MachineName, ndr_get_array_length(ndr, &r->in.MachineName), sizeof(uint16_t), CH_UTF16));
2392                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_MachineName_0, 0);
2393                 }
2394                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_DatabaseName));
2395                 if (_ptr_DatabaseName) {
2396                         NDR_PULL_ALLOC(ndr, r->in.DatabaseName);
2397                 } else {
2398                         r->in.DatabaseName = NULL;
2399                 }
2400                 if (r->in.DatabaseName) {
2401                         _mem_save_DatabaseName_0 = NDR_PULL_GET_MEM_CTX(ndr);
2402                         NDR_PULL_SET_MEM_CTX(ndr, r->in.DatabaseName, 0);
2403                         NDR_CHECK(ndr_pull_array_size(ndr, &r->in.DatabaseName));
2404                         NDR_CHECK(ndr_pull_array_length(ndr, &r->in.DatabaseName));
2405                         if (ndr_get_array_length(ndr, &r->in.DatabaseName) > ndr_get_array_size(ndr, &r->in.DatabaseName)) {
2406                                 return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.DatabaseName), ndr_get_array_length(ndr, &r->in.DatabaseName));
2407                         }
2408                         NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.DatabaseName), sizeof(uint16_t)));
2409                         NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.DatabaseName, ndr_get_array_length(ndr, &r->in.DatabaseName), sizeof(uint16_t), CH_UTF16));
2410                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_DatabaseName_0, 0);
2411                 }
2412                 NDR_CHECK(ndr_pull_svcctl_MgrAccessMask(ndr, NDR_SCALARS, &r->in.access_mask));
2413                 NDR_PULL_ALLOC(ndr, r->out.handle);
2414                 ZERO_STRUCTP(r->out.handle);
2415         }
2416         if (flags & NDR_OUT) {
2417                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
2418                         NDR_PULL_ALLOC(ndr, r->out.handle);
2419                 }
2420                 _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
2421                 NDR_PULL_SET_MEM_CTX(ndr, r->out.handle, LIBNDR_FLAG_REF_ALLOC);
2422                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.handle));
2423                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
2424                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
2425         }
2426         return NDR_ERR_SUCCESS;
2427 }
2428
2429 _PUBLIC_ void ndr_print_svcctl_OpenSCManagerW(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_OpenSCManagerW *r)
2430 {
2431         ndr_print_struct(ndr, name, "svcctl_OpenSCManagerW");
2432         ndr->depth++;
2433         if (flags & NDR_SET_VALUES) {
2434                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
2435         }
2436         if (flags & NDR_IN) {
2437                 ndr_print_struct(ndr, "in", "svcctl_OpenSCManagerW");
2438                 ndr->depth++;
2439                 ndr_print_ptr(ndr, "MachineName", r->in.MachineName);
2440                 ndr->depth++;
2441                 if (r->in.MachineName) {
2442                         ndr_print_string(ndr, "MachineName", r->in.MachineName);
2443                 }
2444                 ndr->depth--;
2445                 ndr_print_ptr(ndr, "DatabaseName", r->in.DatabaseName);
2446                 ndr->depth++;
2447                 if (r->in.DatabaseName) {
2448                         ndr_print_string(ndr, "DatabaseName", r->in.DatabaseName);
2449                 }
2450                 ndr->depth--;
2451                 ndr_print_svcctl_MgrAccessMask(ndr, "access_mask", r->in.access_mask);
2452                 ndr->depth--;
2453         }
2454         if (flags & NDR_OUT) {
2455                 ndr_print_struct(ndr, "out", "svcctl_OpenSCManagerW");
2456                 ndr->depth++;
2457                 ndr_print_ptr(ndr, "handle", r->out.handle);
2458                 ndr->depth++;
2459                 ndr_print_policy_handle(ndr, "handle", r->out.handle);
2460                 ndr->depth--;
2461                 ndr_print_WERROR(ndr, "result", r->out.result);
2462                 ndr->depth--;
2463         }
2464         ndr->depth--;
2465 }
2466
2467 static enum ndr_err_code ndr_push_svcctl_OpenServiceW(struct ndr_push *ndr, int flags, const struct svcctl_OpenServiceW *r)
2468 {
2469         if (flags & NDR_IN) {
2470                 if (r->in.scmanager_handle == NULL) {
2471                         return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
2472                 }
2473                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.scmanager_handle));
2474                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.ServiceName, CH_UTF16)));
2475                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
2476                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.ServiceName, CH_UTF16)));
2477                 NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.ServiceName, ndr_charset_length(r->in.ServiceName, CH_UTF16), sizeof(uint16_t), CH_UTF16));
2478                 NDR_CHECK(ndr_push_svcctl_ServiceAccessMask(ndr, NDR_SCALARS, r->in.access_mask));
2479         }
2480         if (flags & NDR_OUT) {
2481                 if (r->out.handle == NULL) {
2482                         return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
2483                 }
2484                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.handle));
2485                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
2486         }
2487         return NDR_ERR_SUCCESS;
2488 }
2489
2490 static enum ndr_err_code ndr_pull_svcctl_OpenServiceW(struct ndr_pull *ndr, int flags, struct svcctl_OpenServiceW *r)
2491 {
2492         TALLOC_CTX *_mem_save_scmanager_handle_0;
2493         TALLOC_CTX *_mem_save_handle_0;
2494         if (flags & NDR_IN) {
2495                 ZERO_STRUCT(r->out);
2496
2497                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
2498                         NDR_PULL_ALLOC(ndr, r->in.scmanager_handle);
2499                 }
2500                 _mem_save_scmanager_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
2501                 NDR_PULL_SET_MEM_CTX(ndr, r->in.scmanager_handle, LIBNDR_FLAG_REF_ALLOC);
2502                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.scmanager_handle));
2503                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_scmanager_handle_0, LIBNDR_FLAG_REF_ALLOC);
2504                 NDR_CHECK(ndr_pull_array_size(ndr, &r->in.ServiceName));
2505                 NDR_CHECK(ndr_pull_array_length(ndr, &r->in.ServiceName));
2506                 if (ndr_get_array_length(ndr, &r->in.ServiceName) > ndr_get_array_size(ndr, &r->in.ServiceName)) {
2507                         return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.ServiceName), ndr_get_array_length(ndr, &r->in.ServiceName));
2508                 }
2509                 NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.ServiceName), sizeof(uint16_t)));
2510                 NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.ServiceName, ndr_get_array_length(ndr, &r->in.ServiceName), sizeof(uint16_t), CH_UTF16));
2511                 NDR_CHECK(ndr_pull_svcctl_ServiceAccessMask(ndr, NDR_SCALARS, &r->in.access_mask));
2512                 NDR_PULL_ALLOC(ndr, r->out.handle);
2513                 ZERO_STRUCTP(r->out.handle);
2514         }
2515         if (flags & NDR_OUT) {
2516                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
2517                         NDR_PULL_ALLOC(ndr, r->out.handle);
2518                 }
2519                 _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
2520                 NDR_PULL_SET_MEM_CTX(ndr, r->out.handle, LIBNDR_FLAG_REF_ALLOC);
2521                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.handle));
2522                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
2523                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
2524         }
2525         return NDR_ERR_SUCCESS;
2526 }
2527
2528 _PUBLIC_ void ndr_print_svcctl_OpenServiceW(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_OpenServiceW *r)
2529 {
2530         ndr_print_struct(ndr, name, "svcctl_OpenServiceW");
2531         ndr->depth++;
2532         if (flags & NDR_SET_VALUES) {
2533                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
2534         }
2535         if (flags & NDR_IN) {
2536                 ndr_print_struct(ndr, "in", "svcctl_OpenServiceW");
2537                 ndr->depth++;
2538                 ndr_print_ptr(ndr, "scmanager_handle", r->in.scmanager_handle);
2539                 ndr->depth++;
2540                 ndr_print_policy_handle(ndr, "scmanager_handle", r->in.scmanager_handle);
2541                 ndr->depth--;
2542                 ndr_print_string(ndr, "ServiceName", r->in.ServiceName);
2543                 ndr_print_svcctl_ServiceAccessMask(ndr, "access_mask", r->in.access_mask);
2544                 ndr->depth--;
2545         }
2546         if (flags & NDR_OUT) {
2547                 ndr_print_struct(ndr, "out", "svcctl_OpenServiceW");
2548                 ndr->depth++;
2549                 ndr_print_ptr(ndr, "handle", r->out.handle);
2550                 ndr->depth++;
2551                 ndr_print_policy_handle(ndr, "handle", r->out.handle);
2552                 ndr->depth--;
2553                 ndr_print_WERROR(ndr, "result", r->out.result);
2554                 ndr->depth--;
2555         }
2556         ndr->depth--;
2557 }
2558
2559 static enum ndr_err_code ndr_push_svcctl_QueryServiceConfigW(struct ndr_push *ndr, int flags, const struct svcctl_QueryServiceConfigW *r)
2560 {
2561         if (flags & NDR_IN) {
2562                 if (r->in.handle == NULL) {
2563                         return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
2564                 }
2565                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.handle));
2566                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.buf_size));
2567         }
2568         if (flags & NDR_OUT) {
2569                 if (r->out.query == NULL) {
2570                         return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
2571                 }
2572                 NDR_CHECK(ndr_push_QUERY_SERVICE_CONFIG(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.query));
2573                 if (r->out.bytes_needed == NULL) {
2574                         return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
2575                 }
2576                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.bytes_needed));
2577                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
2578         }
2579         return NDR_ERR_SUCCESS;
2580 }
2581
2582 static enum ndr_err_code ndr_pull_svcctl_QueryServiceConfigW(struct ndr_pull *ndr, int flags, struct svcctl_QueryServiceConfigW *r)
2583 {
2584         TALLOC_CTX *_mem_save_handle_0;
2585         TALLOC_CTX *_mem_save_query_0;
2586         TALLOC_CTX *_mem_save_bytes_needed_0;
2587         if (flags & NDR_IN) {
2588                 ZERO_STRUCT(r->out);
2589
2590                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
2591                         NDR_PULL_ALLOC(ndr, r->in.handle);
2592                 }
2593                 _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
2594                 NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC);
2595                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.handle));
2596                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
2597                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.buf_size));
2598                 if (r->in.buf_size < 0 || r->in.buf_size > 8192) {
2599                         return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
2600                 }
2601                 NDR_PULL_ALLOC(ndr, r->out.query);
2602                 ZERO_STRUCTP(r->out.query);
2603                 NDR_PULL_ALLOC(ndr, r->out.bytes_needed);
2604                 ZERO_STRUCTP(r->out.bytes_needed);
2605         }
2606         if (flags & NDR_OUT) {
2607                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
2608                         NDR_PULL_ALLOC(ndr, r->out.query);
2609                 }
2610                 _mem_save_query_0 = NDR_PULL_GET_MEM_CTX(ndr);
2611                 NDR_PULL_SET_MEM_CTX(ndr, r->out.query, LIBNDR_FLAG_REF_ALLOC);
2612                 NDR_CHECK(ndr_pull_QUERY_SERVICE_CONFIG(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.query));
2613                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_query_0, LIBNDR_FLAG_REF_ALLOC);
2614                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
2615                         NDR_PULL_ALLOC(ndr, r->out.bytes_needed);
2616                 }
2617                 _mem_save_bytes_needed_0 = NDR_PULL_GET_MEM_CTX(ndr);
2618                 NDR_PULL_SET_MEM_CTX(ndr, r->out.bytes_needed, LIBNDR_FLAG_REF_ALLOC);
2619                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.bytes_needed));
2620                 if (*r->out.bytes_needed < 0 || *r->out.bytes_needed > 8192) {
2621                         return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
2622                 }
2623                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_bytes_needed_0, LIBNDR_FLAG_REF_ALLOC);
2624                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
2625         }
2626         return NDR_ERR_SUCCESS;
2627 }
2628
2629 _PUBLIC_ void ndr_print_svcctl_QueryServiceConfigW(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_QueryServiceConfigW *r)
2630 {
2631         ndr_print_struct(ndr, name, "svcctl_QueryServiceConfigW");
2632         ndr->depth++;
2633         if (flags & NDR_SET_VALUES) {
2634                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
2635         }
2636         if (flags & NDR_IN) {
2637                 ndr_print_struct(ndr, "in", "svcctl_QueryServiceConfigW");
2638                 ndr->depth++;
2639                 ndr_print_ptr(ndr, "handle", r->in.handle);
2640                 ndr->depth++;
2641                 ndr_print_policy_handle(ndr, "handle", r->in.handle);
2642                 ndr->depth--;
2643                 ndr_print_uint32(ndr, "buf_size", r->in.buf_size);
2644                 ndr->depth--;
2645         }
2646         if (flags & NDR_OUT) {
2647                 ndr_print_struct(ndr, "out", "svcctl_QueryServiceConfigW");
2648                 ndr->depth++;
2649                 ndr_print_ptr(ndr, "query", r->out.query);
2650                 ndr->depth++;
2651                 ndr_print_QUERY_SERVICE_CONFIG(ndr, "query", r->out.query);
2652                 ndr->depth--;
2653                 ndr_print_ptr(ndr, "bytes_needed", r->out.bytes_needed);
2654                 ndr->depth++;
2655                 ndr_print_uint32(ndr, "bytes_needed", *r->out.bytes_needed);
2656                 ndr->depth--;
2657                 ndr_print_WERROR(ndr, "result", r->out.result);
2658                 ndr->depth--;
2659         }
2660         ndr->depth--;
2661 }
2662
2663 static enum ndr_err_code ndr_push_svcctl_QueryServiceLockStatusW(struct ndr_push *ndr, int flags, const struct svcctl_QueryServiceLockStatusW *r)
2664 {
2665         if (flags & NDR_IN) {
2666                 if (r->in.handle == NULL) {
2667                         return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
2668                 }
2669                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.handle));
2670                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.buf_size));
2671         }
2672         if (flags & NDR_OUT) {
2673                 if (r->out.lock_status == NULL) {
2674                         return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
2675                 }
2676                 NDR_CHECK(ndr_push_SERVICE_LOCK_STATUS(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.lock_status));
2677                 if (r->out.required_buf_size == NULL) {
2678                         return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
2679                 }
2680                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.required_buf_size));
2681                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
2682         }
2683         return NDR_ERR_SUCCESS;
2684 }
2685
2686 static enum ndr_err_code ndr_pull_svcctl_QueryServiceLockStatusW(struct ndr_pull *ndr, int flags, struct svcctl_QueryServiceLockStatusW *r)
2687 {
2688         TALLOC_CTX *_mem_save_handle_0;
2689         TALLOC_CTX *_mem_save_lock_status_0;
2690         TALLOC_CTX *_mem_save_required_buf_size_0;
2691         if (flags & NDR_IN) {
2692                 ZERO_STRUCT(r->out);
2693
2694                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
2695                         NDR_PULL_ALLOC(ndr, r->in.handle);
2696                 }
2697                 _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
2698                 NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC);
2699                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.handle));
2700                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
2701                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.buf_size));
2702                 NDR_PULL_ALLOC(ndr, r->out.lock_status);
2703                 ZERO_STRUCTP(r->out.lock_status);
2704                 NDR_PULL_ALLOC(ndr, r->out.required_buf_size);
2705                 ZERO_STRUCTP(r->out.required_buf_size);
2706         }
2707         if (flags & NDR_OUT) {
2708                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
2709                         NDR_PULL_ALLOC(ndr, r->out.lock_status);
2710                 }
2711                 _mem_save_lock_status_0 = NDR_PULL_GET_MEM_CTX(ndr);
2712                 NDR_PULL_SET_MEM_CTX(ndr, r->out.lock_status, LIBNDR_FLAG_REF_ALLOC);
2713                 NDR_CHECK(ndr_pull_SERVICE_LOCK_STATUS(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.lock_status));
2714                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_lock_status_0, LIBNDR_FLAG_REF_ALLOC);
2715                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
2716                         NDR_PULL_ALLOC(ndr, r->out.required_buf_size);
2717                 }
2718                 _mem_save_required_buf_size_0 = NDR_PULL_GET_MEM_CTX(ndr);
2719                 NDR_PULL_SET_MEM_CTX(ndr, r->out.required_buf_size, LIBNDR_FLAG_REF_ALLOC);
2720                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.required_buf_size));
2721                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_required_buf_size_0, LIBNDR_FLAG_REF_ALLOC);
2722                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
2723         }
2724         return NDR_ERR_SUCCESS;
2725 }
2726
2727 _PUBLIC_ void ndr_print_svcctl_QueryServiceLockStatusW(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_QueryServiceLockStatusW *r)
2728 {
2729         ndr_print_struct(ndr, name, "svcctl_QueryServiceLockStatusW");
2730         ndr->depth++;
2731         if (flags & NDR_SET_VALUES) {
2732                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
2733         }
2734         if (flags & NDR_IN) {
2735                 ndr_print_struct(ndr, "in", "svcctl_QueryServiceLockStatusW");
2736                 ndr->depth++;
2737                 ndr_print_ptr(ndr, "handle", r->in.handle);
2738                 ndr->depth++;
2739                 ndr_print_policy_handle(ndr, "handle", r->in.handle);
2740                 ndr->depth--;
2741                 ndr_print_uint32(ndr, "buf_size", r->in.buf_size);
2742                 ndr->depth--;
2743         }
2744         if (flags & NDR_OUT) {
2745                 ndr_print_struct(ndr, "out", "svcctl_QueryServiceLockStatusW");
2746                 ndr->depth++;
2747                 ndr_print_ptr(ndr, "lock_status", r->out.lock_status);
2748                 ndr->depth++;
2749                 ndr_print_SERVICE_LOCK_STATUS(ndr, "lock_status", r->out.lock_status);
2750                 ndr->depth--;
2751                 ndr_print_ptr(ndr, "required_buf_size", r->out.required_buf_size);
2752                 ndr->depth++;
2753                 ndr_print_uint32(ndr, "required_buf_size", *r->out.required_buf_size);
2754                 ndr->depth--;
2755                 ndr_print_WERROR(ndr, "result", r->out.result);
2756                 ndr->depth--;
2757         }
2758         ndr->depth--;
2759 }
2760
2761 static enum ndr_err_code ndr_push_svcctl_StartServiceW(struct ndr_push *ndr, int flags, const struct svcctl_StartServiceW *r)
2762 {
2763         if (flags & NDR_IN) {
2764                 if (r->in.handle == NULL) {
2765                         return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
2766                 }
2767                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.handle));
2768                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.NumArgs));
2769                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.Arguments));
2770                 if (r->in.Arguments) {
2771                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.Arguments, CH_UTF16)));
2772                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
2773                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.Arguments, CH_UTF16)));
2774                         NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.Arguments, ndr_charset_length(r->in.Arguments, CH_UTF16), sizeof(uint16_t), CH_UTF16));
2775                 }
2776         }
2777         if (flags & NDR_OUT) {
2778                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
2779         }
2780         return NDR_ERR_SUCCESS;
2781 }
2782
2783 static enum ndr_err_code ndr_pull_svcctl_StartServiceW(struct ndr_pull *ndr, int flags, struct svcctl_StartServiceW *r)
2784 {
2785         uint32_t _ptr_Arguments;
2786         TALLOC_CTX *_mem_save_handle_0;
2787         TALLOC_CTX *_mem_save_Arguments_0;
2788         if (flags & NDR_IN) {
2789                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
2790                         NDR_PULL_ALLOC(ndr, r->in.handle);
2791                 }
2792                 _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
2793                 NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC);
2794                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.handle));
2795                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
2796                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.NumArgs));
2797                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_Arguments));
2798                 if (_ptr_Arguments) {
2799                         NDR_PULL_ALLOC(ndr, r->in.Arguments);
2800                 } else {
2801                         r->in.Arguments = NULL;
2802                 }
2803                 if (r->in.Arguments) {
2804                         _mem_save_Arguments_0 = NDR_PULL_GET_MEM_CTX(ndr);
2805                         NDR_PULL_SET_MEM_CTX(ndr, r->in.Arguments, 0);
2806                         NDR_CHECK(ndr_pull_array_size(ndr, &r->in.Arguments));
2807                         NDR_CHECK(ndr_pull_array_length(ndr, &r->in.Arguments));
2808                         if (ndr_get_array_length(ndr, &r->in.Arguments) > ndr_get_array_size(ndr, &r->in.Arguments)) {
2809                                 return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.Arguments), ndr_get_array_length(ndr, &r->in.Arguments));
2810                         }
2811                         NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.Arguments), sizeof(uint16_t)));
2812                         NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.Arguments, ndr_get_array_length(ndr, &r->in.Arguments), sizeof(uint16_t), CH_UTF16));
2813                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_Arguments_0, 0);
2814                 }
2815         }
2816         if (flags & NDR_OUT) {
2817                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
2818         }
2819         return NDR_ERR_SUCCESS;
2820 }
2821
2822 _PUBLIC_ void ndr_print_svcctl_StartServiceW(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_StartServiceW *r)
2823 {
2824         ndr_print_struct(ndr, name, "svcctl_StartServiceW");
2825         ndr->depth++;
2826         if (flags & NDR_SET_VALUES) {
2827                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
2828         }
2829         if (flags & NDR_IN) {
2830                 ndr_print_struct(ndr, "in", "svcctl_StartServiceW");
2831                 ndr->depth++;
2832                 ndr_print_ptr(ndr, "handle", r->in.handle);
2833                 ndr->depth++;
2834                 ndr_print_policy_handle(ndr, "handle", r->in.handle);
2835                 ndr->depth--;
2836                 ndr_print_uint32(ndr, "NumArgs", r->in.NumArgs);
2837                 ndr_print_ptr(ndr, "Arguments", r->in.Arguments);
2838                 ndr->depth++;
2839                 if (r->in.Arguments) {
2840                         ndr_print_string(ndr, "Arguments", r->in.Arguments);
2841                 }
2842                 ndr->depth--;
2843                 ndr->depth--;
2844         }
2845         if (flags & NDR_OUT) {
2846                 ndr_print_struct(ndr, "out", "svcctl_StartServiceW");
2847                 ndr->depth++;
2848                 ndr_print_WERROR(ndr, "result", r->out.result);
2849                 ndr->depth--;
2850         }
2851         ndr->depth--;
2852 }
2853
2854 static enum ndr_err_code ndr_push_svcctl_GetServiceDisplayNameW(struct ndr_push *ndr, int flags, const struct svcctl_GetServiceDisplayNameW *r)
2855 {
2856         if (flags & NDR_IN) {
2857                 if (r->in.handle == NULL) {
2858                         return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
2859                 }
2860                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.handle));
2861                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.service_name));
2862                 if (r->in.service_name) {
2863                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.service_name, CH_UTF16)));
2864                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
2865                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.service_name, CH_UTF16)));
2866                         NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.service_name, ndr_charset_length(r->in.service_name, CH_UTF16), sizeof(uint16_t), CH_UTF16));
2867                 }
2868                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.display_name_length));
2869                 if (r->in.display_name_length) {
2870                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.display_name_length));
2871                 }
2872         }
2873         if (flags & NDR_OUT) {
2874                 if (r->out.display_name == NULL) {
2875                         return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
2876                 }
2877                 NDR_CHECK(ndr_push_unique_ptr(ndr, *r->out.display_name));
2878                 if (*r->out.display_name) {
2879                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.display_name, CH_UTF16)));
2880                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
2881                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.display_name, CH_UTF16)));
2882                         NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, *r->out.display_name, ndr_charset_length(*r->out.display_name, CH_UTF16), sizeof(uint16_t), CH_UTF16));
2883                 }
2884                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.display_name_length));
2885                 if (r->out.display_name_length) {
2886                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.display_name_length));
2887                 }
2888                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
2889         }
2890         return NDR_ERR_SUCCESS;
2891 }
2892
2893 static enum ndr_err_code ndr_pull_svcctl_GetServiceDisplayNameW(struct ndr_pull *ndr, int flags, struct svcctl_GetServiceDisplayNameW *r)
2894 {
2895         uint32_t _ptr_service_name;
2896         uint32_t _ptr_display_name;
2897         uint32_t _ptr_display_name_length;
2898         TALLOC_CTX *_mem_save_handle_0;
2899         TALLOC_CTX *_mem_save_service_name_0;
2900         TALLOC_CTX *_mem_save_display_name_0;
2901         TALLOC_CTX *_mem_save_display_name_1;
2902         TALLOC_CTX *_mem_save_display_name_length_0;
2903         if (flags & NDR_IN) {
2904                 ZERO_STRUCT(r->out);
2905
2906                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
2907                         NDR_PULL_ALLOC(ndr, r->in.handle);
2908                 }
2909                 _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
2910                 NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC);
2911                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.handle));
2912                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
2913                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_service_name));
2914                 if (_ptr_service_name) {
2915                         NDR_PULL_ALLOC(ndr, r->in.service_name);
2916                 } else {
2917                         r->in.service_name = NULL;
2918                 }
2919                 if (r->in.service_name) {
2920                         _mem_save_service_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
2921                         NDR_PULL_SET_MEM_CTX(ndr, r->in.service_name, 0);
2922                         NDR_CHECK(ndr_pull_array_size(ndr, &r->in.service_name));
2923                         NDR_CHECK(ndr_pull_array_length(ndr, &r->in.service_name));
2924                         if (ndr_get_array_length(ndr, &r->in.service_name) > ndr_get_array_size(ndr, &r->in.service_name)) {
2925                                 return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.service_name), ndr_get_array_length(ndr, &r->in.service_name));
2926                         }
2927                         NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.service_name), sizeof(uint16_t)));
2928                         NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.service_name, ndr_get_array_length(ndr, &r->in.service_name), sizeof(uint16_t), CH_UTF16));
2929                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_service_name_0, 0);
2930                 }
2931                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_display_name_length));
2932                 if (_ptr_display_name_length) {
2933                         NDR_PULL_ALLOC(ndr, r->in.display_name_length);
2934                 } else {
2935                         r->in.display_name_length = NULL;
2936                 }
2937                 if (r->in.display_name_length) {
2938                         _mem_save_display_name_length_0 = NDR_PULL_GET_MEM_CTX(ndr);
2939                         NDR_PULL_SET_MEM_CTX(ndr, r->in.display_name_length, 0);
2940                         NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.display_name_length));
2941                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_display_name_length_0, 0);
2942                 }
2943                 NDR_PULL_ALLOC(ndr, r->out.display_name);
2944                 ZERO_STRUCTP(r->out.display_name);
2945         }
2946         if (flags & NDR_OUT) {
2947                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
2948                         NDR_PULL_ALLOC(ndr, r->out.display_name);