r20674: Regenerate NDR parsers after pidl changes. This should fix a couple of
[ira/wip.git] / source3 / librpc / gen_ndr / ndr_winreg.c
1 /* parser auto-generated by pidl */
2
3 #include "includes.h"
4 #include "librpc/gen_ndr/ndr_winreg.h"
5
6 #include "librpc/gen_ndr/ndr_lsa.h"
7 #include "librpc/gen_ndr/ndr_initshutdown.h"
8 #include "librpc/gen_ndr/ndr_security.h"
9 NTSTATUS ndr_push_winreg_AccessMask(struct ndr_push *ndr, int ndr_flags, uint32_t r)
10 {
11         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
12         return NT_STATUS_OK;
13 }
14
15 NTSTATUS ndr_pull_winreg_AccessMask(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
16 {
17         uint32_t v;
18         NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
19         *r = v;
20         return NT_STATUS_OK;
21 }
22
23 _PUBLIC_ void ndr_print_winreg_AccessMask(struct ndr_print *ndr, const char *name, uint32_t r)
24 {
25         ndr_print_uint32(ndr, name, r);
26         ndr->depth++;
27         ndr->depth--;
28 }
29
30 NTSTATUS ndr_push_winreg_Type(struct ndr_push *ndr, int ndr_flags, enum winreg_Type r)
31 {
32         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
33         return NT_STATUS_OK;
34 }
35
36 NTSTATUS ndr_pull_winreg_Type(struct ndr_pull *ndr, int ndr_flags, enum winreg_Type *r)
37 {
38         uint32_t v;
39         NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
40         *r = v;
41         return NT_STATUS_OK;
42 }
43
44 _PUBLIC_ void ndr_print_winreg_Type(struct ndr_print *ndr, const char *name, enum winreg_Type r)
45 {
46         const char *val = NULL;
47
48         switch (r) {
49                 case REG_NONE: val = "REG_NONE"; break;
50                 case REG_SZ: val = "REG_SZ"; break;
51                 case REG_EXPAND_SZ: val = "REG_EXPAND_SZ"; break;
52                 case REG_BINARY: val = "REG_BINARY"; break;
53                 case REG_DWORD: val = "REG_DWORD"; break;
54                 case REG_DWORD_BIG_ENDIAN: val = "REG_DWORD_BIG_ENDIAN"; break;
55                 case REG_LINK: val = "REG_LINK"; break;
56                 case REG_MULTI_SZ: val = "REG_MULTI_SZ"; break;
57                 case REG_RESOURCE_LIST: val = "REG_RESOURCE_LIST"; break;
58                 case REG_FULL_RESOURCE_DESCRIPTOR: val = "REG_FULL_RESOURCE_DESCRIPTOR"; break;
59                 case REG_RESOURCE_REQUIREMENTS_LIST: val = "REG_RESOURCE_REQUIREMENTS_LIST"; break;
60                 case REG_QWORD: val = "REG_QWORD"; break;
61         }
62         ndr_print_enum(ndr, name, "ENUM", val, r);
63 }
64
65 _PUBLIC_ NTSTATUS ndr_push_winreg_String(struct ndr_push *ndr, int ndr_flags, const struct winreg_String *r)
66 {
67         if (ndr_flags & NDR_SCALARS) {
68                 NDR_CHECK(ndr_push_align(ndr, 4));
69                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, strlen_m_term(r->name) * 2));
70                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, strlen_m_term(r->name) * 2));
71                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->name));
72         }
73         if (ndr_flags & NDR_BUFFERS) {
74                 if (r->name) {
75                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->name, CH_UTF16)));
76                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
77                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->name, CH_UTF16)));
78                         NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->name, ndr_charset_length(r->name, CH_UTF16), sizeof(uint16_t), CH_UTF16));
79                 }
80         }
81         return NT_STATUS_OK;
82 }
83
84 _PUBLIC_ NTSTATUS ndr_pull_winreg_String(struct ndr_pull *ndr, int ndr_flags, struct winreg_String *r)
85 {
86         uint32_t _ptr_name;
87         TALLOC_CTX *_mem_save_name_0;
88         if (ndr_flags & NDR_SCALARS) {
89                 NDR_CHECK(ndr_pull_align(ndr, 4));
90                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->name_len));
91                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->name_size));
92                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_name));
93                 if (_ptr_name) {
94                         NDR_PULL_ALLOC(ndr, r->name);
95                 } else {
96                         r->name = NULL;
97                 }
98         }
99         if (ndr_flags & NDR_BUFFERS) {
100                 if (r->name) {
101                         _mem_save_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
102                         NDR_PULL_SET_MEM_CTX(ndr, r->name, 0);
103                         NDR_CHECK(ndr_pull_array_size(ndr, &r->name));
104                         NDR_CHECK(ndr_pull_array_length(ndr, &r->name));
105                         if (ndr_get_array_length(ndr, &r->name) > ndr_get_array_size(ndr, &r->name)) {
106                                 return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->name), ndr_get_array_length(ndr, &r->name));
107                         }
108                         NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->name), sizeof(uint16_t)));
109                         NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->name, ndr_get_array_length(ndr, &r->name), sizeof(uint16_t), CH_UTF16));
110                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_name_0, 0);
111                 }
112         }
113         return NT_STATUS_OK;
114 }
115
116 _PUBLIC_ void ndr_print_winreg_String(struct ndr_print *ndr, const char *name, const struct winreg_String *r)
117 {
118         ndr_print_struct(ndr, name, "winreg_String");
119         ndr->depth++;
120         ndr_print_uint16(ndr, "name_len", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?strlen_m_term(r->name) * 2:r->name_len);
121         ndr_print_uint16(ndr, "name_size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?strlen_m_term(r->name) * 2:r->name_size);
122         ndr_print_ptr(ndr, "name", r->name);
123         ndr->depth++;
124         if (r->name) {
125                 ndr_print_string(ndr, "name", r->name);
126         }
127         ndr->depth--;
128         ndr->depth--;
129 }
130
131 NTSTATUS ndr_push_KeySecurityData(struct ndr_push *ndr, int ndr_flags, const struct KeySecurityData *r)
132 {
133         if (ndr_flags & NDR_SCALARS) {
134                 NDR_CHECK(ndr_push_align(ndr, 4));
135                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->data));
136                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->size));
137                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->len));
138         }
139         if (ndr_flags & NDR_BUFFERS) {
140                 if (r->data) {
141                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->size));
142                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
143                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->len));
144                         NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->data, r->len));
145                 }
146         }
147         return NT_STATUS_OK;
148 }
149
150 NTSTATUS ndr_pull_KeySecurityData(struct ndr_pull *ndr, int ndr_flags, struct KeySecurityData *r)
151 {
152         uint32_t _ptr_data;
153         TALLOC_CTX *_mem_save_data_0;
154         if (ndr_flags & NDR_SCALARS) {
155                 NDR_CHECK(ndr_pull_align(ndr, 4));
156                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_data));
157                 if (_ptr_data) {
158                         NDR_PULL_ALLOC(ndr, r->data);
159                 } else {
160                         r->data = NULL;
161                 }
162                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->size));
163                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->len));
164         }
165         if (ndr_flags & NDR_BUFFERS) {
166                 if (r->data) {
167                         _mem_save_data_0 = NDR_PULL_GET_MEM_CTX(ndr);
168                         NDR_PULL_SET_MEM_CTX(ndr, r->data, 0);
169                         NDR_CHECK(ndr_pull_array_size(ndr, &r->data));
170                         NDR_CHECK(ndr_pull_array_length(ndr, &r->data));
171                         if (ndr_get_array_length(ndr, &r->data) > ndr_get_array_size(ndr, &r->data)) {
172                                 return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->data), ndr_get_array_length(ndr, &r->data));
173                         }
174                         NDR_PULL_ALLOC_N(ndr, r->data, ndr_get_array_size(ndr, &r->data));
175                         NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->data, ndr_get_array_length(ndr, &r->data)));
176                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_0, 0);
177                 }
178                 if (r->data) {
179                         NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->data, r->size));
180                 }
181                 if (r->data) {
182                         NDR_CHECK(ndr_check_array_length(ndr, (void*)&r->data, r->len));
183                 }
184         }
185         return NT_STATUS_OK;
186 }
187
188 _PUBLIC_ void ndr_print_KeySecurityData(struct ndr_print *ndr, const char *name, const struct KeySecurityData *r)
189 {
190         ndr_print_struct(ndr, name, "KeySecurityData");
191         ndr->depth++;
192         ndr_print_ptr(ndr, "data", r->data);
193         ndr->depth++;
194         if (r->data) {
195                 ndr_print_array_uint8(ndr, "data", r->data, r->len);
196         }
197         ndr->depth--;
198         ndr_print_uint32(ndr, "size", r->size);
199         ndr_print_uint32(ndr, "len", r->len);
200         ndr->depth--;
201 }
202
203 NTSTATUS ndr_push_winreg_SecBuf(struct ndr_push *ndr, int ndr_flags, const struct winreg_SecBuf *r)
204 {
205         if (ndr_flags & NDR_SCALARS) {
206                 NDR_CHECK(ndr_push_align(ndr, 4));
207                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->length));
208                 NDR_CHECK(ndr_push_KeySecurityData(ndr, NDR_SCALARS, &r->sd));
209                 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->inherit));
210         }
211         if (ndr_flags & NDR_BUFFERS) {
212                 NDR_CHECK(ndr_push_KeySecurityData(ndr, NDR_BUFFERS, &r->sd));
213         }
214         return NT_STATUS_OK;
215 }
216
217 NTSTATUS ndr_pull_winreg_SecBuf(struct ndr_pull *ndr, int ndr_flags, struct winreg_SecBuf *r)
218 {
219         if (ndr_flags & NDR_SCALARS) {
220                 NDR_CHECK(ndr_pull_align(ndr, 4));
221                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->length));
222                 NDR_CHECK(ndr_pull_KeySecurityData(ndr, NDR_SCALARS, &r->sd));
223                 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->inherit));
224         }
225         if (ndr_flags & NDR_BUFFERS) {
226                 NDR_CHECK(ndr_pull_KeySecurityData(ndr, NDR_BUFFERS, &r->sd));
227         }
228         return NT_STATUS_OK;
229 }
230
231 _PUBLIC_ void ndr_print_winreg_SecBuf(struct ndr_print *ndr, const char *name, const struct winreg_SecBuf *r)
232 {
233         ndr_print_struct(ndr, name, "winreg_SecBuf");
234         ndr->depth++;
235         ndr_print_uint32(ndr, "length", r->length);
236         ndr_print_KeySecurityData(ndr, "sd", &r->sd);
237         ndr_print_uint8(ndr, "inherit", r->inherit);
238         ndr->depth--;
239 }
240
241 NTSTATUS ndr_push_winreg_CreateAction(struct ndr_push *ndr, int ndr_flags, enum winreg_CreateAction r)
242 {
243         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
244         return NT_STATUS_OK;
245 }
246
247 NTSTATUS ndr_pull_winreg_CreateAction(struct ndr_pull *ndr, int ndr_flags, enum winreg_CreateAction *r)
248 {
249         uint32_t v;
250         NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
251         *r = v;
252         return NT_STATUS_OK;
253 }
254
255 _PUBLIC_ void ndr_print_winreg_CreateAction(struct ndr_print *ndr, const char *name, enum winreg_CreateAction r)
256 {
257         const char *val = NULL;
258
259         switch (r) {
260                 case REG_ACTION_NONE: val = "REG_ACTION_NONE"; break;
261                 case REG_CREATED_NEW_KEY: val = "REG_CREATED_NEW_KEY"; break;
262                 case REG_OPENED_EXISTING_KEY: val = "REG_OPENED_EXISTING_KEY"; break;
263         }
264         ndr_print_enum(ndr, name, "ENUM", val, r);
265 }
266
267 NTSTATUS ndr_push_winreg_StringBuf(struct ndr_push *ndr, int ndr_flags, const struct winreg_StringBuf *r)
268 {
269         if (ndr_flags & NDR_SCALARS) {
270                 NDR_CHECK(ndr_push_align(ndr, 4));
271                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, strlen_m_term_null(r->name) * 2));
272                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->size));
273                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->name));
274         }
275         if (ndr_flags & NDR_BUFFERS) {
276                 if (r->name) {
277                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->size / 2));
278                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
279                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, strlen_m_term_null(r->name) * 2 / 2));
280                         NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->name, strlen_m_term_null(r->name) * 2 / 2, sizeof(uint16_t), CH_UTF16));
281                 }
282         }
283         return NT_STATUS_OK;
284 }
285
286 NTSTATUS ndr_pull_winreg_StringBuf(struct ndr_pull *ndr, int ndr_flags, struct winreg_StringBuf *r)
287 {
288         uint32_t _ptr_name;
289         TALLOC_CTX *_mem_save_name_0;
290         if (ndr_flags & NDR_SCALARS) {
291                 NDR_CHECK(ndr_pull_align(ndr, 4));
292                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->length));
293                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->size));
294                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_name));
295                 if (_ptr_name) {
296                         NDR_PULL_ALLOC(ndr, r->name);
297                 } else {
298                         r->name = NULL;
299                 }
300         }
301         if (ndr_flags & NDR_BUFFERS) {
302                 if (r->name) {
303                         _mem_save_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
304                         NDR_PULL_SET_MEM_CTX(ndr, r->name, 0);
305                         NDR_CHECK(ndr_pull_array_size(ndr, &r->name));
306                         NDR_CHECK(ndr_pull_array_length(ndr, &r->name));
307                         if (ndr_get_array_length(ndr, &r->name) > ndr_get_array_size(ndr, &r->name)) {
308                                 return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->name), ndr_get_array_length(ndr, &r->name));
309                         }
310                         NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->name, ndr_get_array_length(ndr, &r->name), sizeof(uint16_t), CH_UTF16));
311                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_name_0, 0);
312                 }
313                 if (r->name) {
314                         NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->name, r->size / 2));
315                 }
316                 if (r->name) {
317                         NDR_CHECK(ndr_check_array_length(ndr, (void*)&r->name, r->length / 2));
318                 }
319         }
320         return NT_STATUS_OK;
321 }
322
323 _PUBLIC_ void ndr_print_winreg_StringBuf(struct ndr_print *ndr, const char *name, const struct winreg_StringBuf *r)
324 {
325         ndr_print_struct(ndr, name, "winreg_StringBuf");
326         ndr->depth++;
327         ndr_print_uint16(ndr, "length", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?strlen_m_term_null(r->name) * 2:r->length);
328         ndr_print_uint16(ndr, "size", r->size);
329         ndr_print_ptr(ndr, "name", r->name);
330         ndr->depth++;
331         if (r->name) {
332                 ndr_print_string(ndr, "name", r->name);
333         }
334         ndr->depth--;
335         ndr->depth--;
336 }
337
338 NTSTATUS ndr_push_winreg_ValNameBuf(struct ndr_push *ndr, int ndr_flags, const struct winreg_ValNameBuf *r)
339 {
340         if (ndr_flags & NDR_SCALARS) {
341                 NDR_CHECK(ndr_push_align(ndr, 4));
342                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, strlen_m_term(r->name) * 2));
343                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->size));
344                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->name));
345         }
346         if (ndr_flags & NDR_BUFFERS) {
347                 if (r->name) {
348                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->size / 2));
349                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
350                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, strlen_m_term(r->name) * 2 / 2));
351                         NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->name, strlen_m_term(r->name) * 2 / 2, sizeof(uint16_t), CH_UTF16));
352                 }
353         }
354         return NT_STATUS_OK;
355 }
356
357 NTSTATUS ndr_pull_winreg_ValNameBuf(struct ndr_pull *ndr, int ndr_flags, struct winreg_ValNameBuf *r)
358 {
359         uint32_t _ptr_name;
360         TALLOC_CTX *_mem_save_name_0;
361         if (ndr_flags & NDR_SCALARS) {
362                 NDR_CHECK(ndr_pull_align(ndr, 4));
363                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->length));
364                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->size));
365                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_name));
366                 if (_ptr_name) {
367                         NDR_PULL_ALLOC(ndr, r->name);
368                 } else {
369                         r->name = NULL;
370                 }
371         }
372         if (ndr_flags & NDR_BUFFERS) {
373                 if (r->name) {
374                         _mem_save_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
375                         NDR_PULL_SET_MEM_CTX(ndr, r->name, 0);
376                         NDR_CHECK(ndr_pull_array_size(ndr, &r->name));
377                         NDR_CHECK(ndr_pull_array_length(ndr, &r->name));
378                         if (ndr_get_array_length(ndr, &r->name) > ndr_get_array_size(ndr, &r->name)) {
379                                 return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->name), ndr_get_array_length(ndr, &r->name));
380                         }
381                         NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->name, ndr_get_array_length(ndr, &r->name), sizeof(uint16_t), CH_UTF16));
382                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_name_0, 0);
383                 }
384                 if (r->name) {
385                         NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->name, r->size / 2));
386                 }
387                 if (r->name) {
388                         NDR_CHECK(ndr_check_array_length(ndr, (void*)&r->name, r->length / 2));
389                 }
390         }
391         return NT_STATUS_OK;
392 }
393
394 _PUBLIC_ void ndr_print_winreg_ValNameBuf(struct ndr_print *ndr, const char *name, const struct winreg_ValNameBuf *r)
395 {
396         ndr_print_struct(ndr, name, "winreg_ValNameBuf");
397         ndr->depth++;
398         ndr_print_uint16(ndr, "length", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?strlen_m_term(r->name) * 2:r->length);
399         ndr_print_uint16(ndr, "size", r->size);
400         ndr_print_ptr(ndr, "name", r->name);
401         ndr->depth++;
402         if (r->name) {
403                 ndr_print_string(ndr, "name", r->name);
404         }
405         ndr->depth--;
406         ndr->depth--;
407 }
408
409 NTSTATUS ndr_push_KeySecurityAttribute(struct ndr_push *ndr, int ndr_flags, const struct KeySecurityAttribute *r)
410 {
411         if (ndr_flags & NDR_SCALARS) {
412                 NDR_CHECK(ndr_push_align(ndr, 4));
413                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->data_size));
414                 NDR_CHECK(ndr_push_KeySecurityData(ndr, NDR_SCALARS, &r->sec_data));
415                 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->inherit));
416         }
417         if (ndr_flags & NDR_BUFFERS) {
418                 NDR_CHECK(ndr_push_KeySecurityData(ndr, NDR_BUFFERS, &r->sec_data));
419         }
420         return NT_STATUS_OK;
421 }
422
423 NTSTATUS ndr_pull_KeySecurityAttribute(struct ndr_pull *ndr, int ndr_flags, struct KeySecurityAttribute *r)
424 {
425         if (ndr_flags & NDR_SCALARS) {
426                 NDR_CHECK(ndr_pull_align(ndr, 4));
427                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->data_size));
428                 NDR_CHECK(ndr_pull_KeySecurityData(ndr, NDR_SCALARS, &r->sec_data));
429                 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->inherit));
430         }
431         if (ndr_flags & NDR_BUFFERS) {
432                 NDR_CHECK(ndr_pull_KeySecurityData(ndr, NDR_BUFFERS, &r->sec_data));
433         }
434         return NT_STATUS_OK;
435 }
436
437 _PUBLIC_ void ndr_print_KeySecurityAttribute(struct ndr_print *ndr, const char *name, const struct KeySecurityAttribute *r)
438 {
439         ndr_print_struct(ndr, name, "KeySecurityAttribute");
440         ndr->depth++;
441         ndr_print_uint32(ndr, "data_size", r->data_size);
442         ndr_print_KeySecurityData(ndr, "sec_data", &r->sec_data);
443         ndr_print_uint8(ndr, "inherit", r->inherit);
444         ndr->depth--;
445 }
446
447 NTSTATUS ndr_push_QueryMultipleValue(struct ndr_push *ndr, int ndr_flags, const struct QueryMultipleValue *r)
448 {
449         if (ndr_flags & NDR_SCALARS) {
450                 NDR_CHECK(ndr_push_align(ndr, 4));
451                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->name));
452                 NDR_CHECK(ndr_push_winreg_Type(ndr, NDR_SCALARS, r->type));
453                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->offset));
454                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->length));
455         }
456         if (ndr_flags & NDR_BUFFERS) {
457                 if (r->name) {
458                         NDR_CHECK(ndr_push_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->name));
459                 }
460         }
461         return NT_STATUS_OK;
462 }
463
464 NTSTATUS ndr_pull_QueryMultipleValue(struct ndr_pull *ndr, int ndr_flags, struct QueryMultipleValue *r)
465 {
466         uint32_t _ptr_name;
467         TALLOC_CTX *_mem_save_name_0;
468         if (ndr_flags & NDR_SCALARS) {
469                 NDR_CHECK(ndr_pull_align(ndr, 4));
470                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_name));
471                 if (_ptr_name) {
472                         NDR_PULL_ALLOC(ndr, r->name);
473                 } else {
474                         r->name = NULL;
475                 }
476                 NDR_CHECK(ndr_pull_winreg_Type(ndr, NDR_SCALARS, &r->type));
477                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->offset));
478                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->length));
479         }
480         if (ndr_flags & NDR_BUFFERS) {
481                 if (r->name) {
482                         _mem_save_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
483                         NDR_PULL_SET_MEM_CTX(ndr, r->name, 0);
484                         NDR_CHECK(ndr_pull_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->name));
485                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_name_0, 0);
486                 }
487         }
488         return NT_STATUS_OK;
489 }
490
491 _PUBLIC_ void ndr_print_QueryMultipleValue(struct ndr_print *ndr, const char *name, const struct QueryMultipleValue *r)
492 {
493         ndr_print_struct(ndr, name, "QueryMultipleValue");
494         ndr->depth++;
495         ndr_print_ptr(ndr, "name", r->name);
496         ndr->depth++;
497         if (r->name) {
498                 ndr_print_winreg_String(ndr, "name", r->name);
499         }
500         ndr->depth--;
501         ndr_print_winreg_Type(ndr, "type", r->type);
502         ndr_print_uint32(ndr, "offset", r->offset);
503         ndr_print_uint32(ndr, "length", r->length);
504         ndr->depth--;
505 }
506
507 NTSTATUS ndr_push_winreg_OpenHKCR(struct ndr_push *ndr, int flags, const struct winreg_OpenHKCR *r)
508 {
509         if (flags & NDR_IN) {
510                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.system_name));
511                 if (r->in.system_name) {
512                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, *r->in.system_name));
513                 }
514                 NDR_CHECK(ndr_push_winreg_AccessMask(ndr, NDR_SCALARS, r->in.access_mask));
515         }
516         if (flags & NDR_OUT) {
517                 if (r->out.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
518                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle));
519                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
520         }
521         return NT_STATUS_OK;
522 }
523
524 NTSTATUS ndr_pull_winreg_OpenHKCR(struct ndr_pull *ndr, int flags, struct winreg_OpenHKCR *r)
525 {
526         uint32_t _ptr_system_name;
527         TALLOC_CTX *_mem_save_system_name_0;
528         TALLOC_CTX *_mem_save_handle_0;
529         if (flags & NDR_IN) {
530                 ZERO_STRUCT(r->out);
531
532                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_system_name));
533                 if (_ptr_system_name) {
534                         NDR_PULL_ALLOC(ndr, r->in.system_name);
535                 } else {
536                         r->in.system_name = NULL;
537                 }
538                 if (r->in.system_name) {
539                         _mem_save_system_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
540                         NDR_PULL_SET_MEM_CTX(ndr, r->in.system_name, 0);
541                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, r->in.system_name));
542                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_system_name_0, 0);
543                 }
544                 NDR_CHECK(ndr_pull_winreg_AccessMask(ndr, NDR_SCALARS, &r->in.access_mask));
545                 NDR_PULL_ALLOC(ndr, r->out.handle);
546                 ZERO_STRUCTP(r->out.handle);
547         }
548         if (flags & NDR_OUT) {
549                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
550                         NDR_PULL_ALLOC(ndr, r->out.handle);
551                 }
552                 _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
553                 NDR_PULL_SET_MEM_CTX(ndr, r->out.handle, LIBNDR_FLAG_REF_ALLOC);
554                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle));
555                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
556                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
557         }
558         return NT_STATUS_OK;
559 }
560
561 _PUBLIC_ void ndr_print_winreg_OpenHKCR(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKCR *r)
562 {
563         ndr_print_struct(ndr, name, "winreg_OpenHKCR");
564         ndr->depth++;
565         if (flags & NDR_SET_VALUES) {
566                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
567         }
568         if (flags & NDR_IN) {
569                 ndr_print_struct(ndr, "in", "winreg_OpenHKCR");
570                 ndr->depth++;
571                 ndr_print_ptr(ndr, "system_name", r->in.system_name);
572                 ndr->depth++;
573                 if (r->in.system_name) {
574                         ndr_print_uint16(ndr, "system_name", *r->in.system_name);
575                 }
576                 ndr->depth--;
577                 ndr_print_winreg_AccessMask(ndr, "access_mask", r->in.access_mask);
578                 ndr->depth--;
579         }
580         if (flags & NDR_OUT) {
581                 ndr_print_struct(ndr, "out", "winreg_OpenHKCR");
582                 ndr->depth++;
583                 ndr_print_ptr(ndr, "handle", r->out.handle);
584                 ndr->depth++;
585                 ndr_print_policy_handle(ndr, "handle", r->out.handle);
586                 ndr->depth--;
587                 ndr_print_WERROR(ndr, "result", r->out.result);
588                 ndr->depth--;
589         }
590         ndr->depth--;
591 }
592
593 NTSTATUS ndr_push_winreg_OpenHKCU(struct ndr_push *ndr, int flags, const struct winreg_OpenHKCU *r)
594 {
595         if (flags & NDR_IN) {
596                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.system_name));
597                 if (r->in.system_name) {
598                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, *r->in.system_name));
599                 }
600                 NDR_CHECK(ndr_push_winreg_AccessMask(ndr, NDR_SCALARS, r->in.access_mask));
601         }
602         if (flags & NDR_OUT) {
603                 if (r->out.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
604                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle));
605                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
606         }
607         return NT_STATUS_OK;
608 }
609
610 NTSTATUS ndr_pull_winreg_OpenHKCU(struct ndr_pull *ndr, int flags, struct winreg_OpenHKCU *r)
611 {
612         uint32_t _ptr_system_name;
613         TALLOC_CTX *_mem_save_system_name_0;
614         TALLOC_CTX *_mem_save_handle_0;
615         if (flags & NDR_IN) {
616                 ZERO_STRUCT(r->out);
617
618                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_system_name));
619                 if (_ptr_system_name) {
620                         NDR_PULL_ALLOC(ndr, r->in.system_name);
621                 } else {
622                         r->in.system_name = NULL;
623                 }
624                 if (r->in.system_name) {
625                         _mem_save_system_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
626                         NDR_PULL_SET_MEM_CTX(ndr, r->in.system_name, 0);
627                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, r->in.system_name));
628                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_system_name_0, 0);
629                 }
630                 NDR_CHECK(ndr_pull_winreg_AccessMask(ndr, NDR_SCALARS, &r->in.access_mask));
631                 NDR_PULL_ALLOC(ndr, r->out.handle);
632                 ZERO_STRUCTP(r->out.handle);
633         }
634         if (flags & NDR_OUT) {
635                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
636                         NDR_PULL_ALLOC(ndr, r->out.handle);
637                 }
638                 _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
639                 NDR_PULL_SET_MEM_CTX(ndr, r->out.handle, LIBNDR_FLAG_REF_ALLOC);
640                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle));
641                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
642                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
643         }
644         return NT_STATUS_OK;
645 }
646
647 _PUBLIC_ void ndr_print_winreg_OpenHKCU(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKCU *r)
648 {
649         ndr_print_struct(ndr, name, "winreg_OpenHKCU");
650         ndr->depth++;
651         if (flags & NDR_SET_VALUES) {
652                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
653         }
654         if (flags & NDR_IN) {
655                 ndr_print_struct(ndr, "in", "winreg_OpenHKCU");
656                 ndr->depth++;
657                 ndr_print_ptr(ndr, "system_name", r->in.system_name);
658                 ndr->depth++;
659                 if (r->in.system_name) {
660                         ndr_print_uint16(ndr, "system_name", *r->in.system_name);
661                 }
662                 ndr->depth--;
663                 ndr_print_winreg_AccessMask(ndr, "access_mask", r->in.access_mask);
664                 ndr->depth--;
665         }
666         if (flags & NDR_OUT) {
667                 ndr_print_struct(ndr, "out", "winreg_OpenHKCU");
668                 ndr->depth++;
669                 ndr_print_ptr(ndr, "handle", r->out.handle);
670                 ndr->depth++;
671                 ndr_print_policy_handle(ndr, "handle", r->out.handle);
672                 ndr->depth--;
673                 ndr_print_WERROR(ndr, "result", r->out.result);
674                 ndr->depth--;
675         }
676         ndr->depth--;
677 }
678
679 NTSTATUS ndr_push_winreg_OpenHKLM(struct ndr_push *ndr, int flags, const struct winreg_OpenHKLM *r)
680 {
681         if (flags & NDR_IN) {
682                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.system_name));
683                 if (r->in.system_name) {
684                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, *r->in.system_name));
685                 }
686                 NDR_CHECK(ndr_push_winreg_AccessMask(ndr, NDR_SCALARS, r->in.access_mask));
687         }
688         if (flags & NDR_OUT) {
689                 if (r->out.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
690                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle));
691                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
692         }
693         return NT_STATUS_OK;
694 }
695
696 NTSTATUS ndr_pull_winreg_OpenHKLM(struct ndr_pull *ndr, int flags, struct winreg_OpenHKLM *r)
697 {
698         uint32_t _ptr_system_name;
699         TALLOC_CTX *_mem_save_system_name_0;
700         TALLOC_CTX *_mem_save_handle_0;
701         if (flags & NDR_IN) {
702                 ZERO_STRUCT(r->out);
703
704                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_system_name));
705                 if (_ptr_system_name) {
706                         NDR_PULL_ALLOC(ndr, r->in.system_name);
707                 } else {
708                         r->in.system_name = NULL;
709                 }
710                 if (r->in.system_name) {
711                         _mem_save_system_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
712                         NDR_PULL_SET_MEM_CTX(ndr, r->in.system_name, 0);
713                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, r->in.system_name));
714                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_system_name_0, 0);
715                 }
716                 NDR_CHECK(ndr_pull_winreg_AccessMask(ndr, NDR_SCALARS, &r->in.access_mask));
717                 NDR_PULL_ALLOC(ndr, r->out.handle);
718                 ZERO_STRUCTP(r->out.handle);
719         }
720         if (flags & NDR_OUT) {
721                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
722                         NDR_PULL_ALLOC(ndr, r->out.handle);
723                 }
724                 _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
725                 NDR_PULL_SET_MEM_CTX(ndr, r->out.handle, LIBNDR_FLAG_REF_ALLOC);
726                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle));
727                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
728                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
729         }
730         return NT_STATUS_OK;
731 }
732
733 _PUBLIC_ void ndr_print_winreg_OpenHKLM(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKLM *r)
734 {
735         ndr_print_struct(ndr, name, "winreg_OpenHKLM");
736         ndr->depth++;
737         if (flags & NDR_SET_VALUES) {
738                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
739         }
740         if (flags & NDR_IN) {
741                 ndr_print_struct(ndr, "in", "winreg_OpenHKLM");
742                 ndr->depth++;
743                 ndr_print_ptr(ndr, "system_name", r->in.system_name);
744                 ndr->depth++;
745                 if (r->in.system_name) {
746                         ndr_print_uint16(ndr, "system_name", *r->in.system_name);
747                 }
748                 ndr->depth--;
749                 ndr_print_winreg_AccessMask(ndr, "access_mask", r->in.access_mask);
750                 ndr->depth--;
751         }
752         if (flags & NDR_OUT) {
753                 ndr_print_struct(ndr, "out", "winreg_OpenHKLM");
754                 ndr->depth++;
755                 ndr_print_ptr(ndr, "handle", r->out.handle);
756                 ndr->depth++;
757                 ndr_print_policy_handle(ndr, "handle", r->out.handle);
758                 ndr->depth--;
759                 ndr_print_WERROR(ndr, "result", r->out.result);
760                 ndr->depth--;
761         }
762         ndr->depth--;
763 }
764
765 NTSTATUS ndr_push_winreg_OpenHKPD(struct ndr_push *ndr, int flags, const struct winreg_OpenHKPD *r)
766 {
767         if (flags & NDR_IN) {
768                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.system_name));
769                 if (r->in.system_name) {
770                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, *r->in.system_name));
771                 }
772                 NDR_CHECK(ndr_push_winreg_AccessMask(ndr, NDR_SCALARS, r->in.access_mask));
773         }
774         if (flags & NDR_OUT) {
775                 if (r->out.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
776                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle));
777                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
778         }
779         return NT_STATUS_OK;
780 }
781
782 NTSTATUS ndr_pull_winreg_OpenHKPD(struct ndr_pull *ndr, int flags, struct winreg_OpenHKPD *r)
783 {
784         uint32_t _ptr_system_name;
785         TALLOC_CTX *_mem_save_system_name_0;
786         TALLOC_CTX *_mem_save_handle_0;
787         if (flags & NDR_IN) {
788                 ZERO_STRUCT(r->out);
789
790                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_system_name));
791                 if (_ptr_system_name) {
792                         NDR_PULL_ALLOC(ndr, r->in.system_name);
793                 } else {
794                         r->in.system_name = NULL;
795                 }
796                 if (r->in.system_name) {
797                         _mem_save_system_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
798                         NDR_PULL_SET_MEM_CTX(ndr, r->in.system_name, 0);
799                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, r->in.system_name));
800                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_system_name_0, 0);
801                 }
802                 NDR_CHECK(ndr_pull_winreg_AccessMask(ndr, NDR_SCALARS, &r->in.access_mask));
803                 NDR_PULL_ALLOC(ndr, r->out.handle);
804                 ZERO_STRUCTP(r->out.handle);
805         }
806         if (flags & NDR_OUT) {
807                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
808                         NDR_PULL_ALLOC(ndr, r->out.handle);
809                 }
810                 _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
811                 NDR_PULL_SET_MEM_CTX(ndr, r->out.handle, LIBNDR_FLAG_REF_ALLOC);
812                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle));
813                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
814                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
815         }
816         return NT_STATUS_OK;
817 }
818
819 _PUBLIC_ void ndr_print_winreg_OpenHKPD(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKPD *r)
820 {
821         ndr_print_struct(ndr, name, "winreg_OpenHKPD");
822         ndr->depth++;
823         if (flags & NDR_SET_VALUES) {
824                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
825         }
826         if (flags & NDR_IN) {
827                 ndr_print_struct(ndr, "in", "winreg_OpenHKPD");
828                 ndr->depth++;
829                 ndr_print_ptr(ndr, "system_name", r->in.system_name);
830                 ndr->depth++;
831                 if (r->in.system_name) {
832                         ndr_print_uint16(ndr, "system_name", *r->in.system_name);
833                 }
834                 ndr->depth--;
835                 ndr_print_winreg_AccessMask(ndr, "access_mask", r->in.access_mask);
836                 ndr->depth--;
837         }
838         if (flags & NDR_OUT) {
839                 ndr_print_struct(ndr, "out", "winreg_OpenHKPD");
840                 ndr->depth++;
841                 ndr_print_ptr(ndr, "handle", r->out.handle);
842                 ndr->depth++;
843                 ndr_print_policy_handle(ndr, "handle", r->out.handle);
844                 ndr->depth--;
845                 ndr_print_WERROR(ndr, "result", r->out.result);
846                 ndr->depth--;
847         }
848         ndr->depth--;
849 }
850
851 NTSTATUS ndr_push_winreg_OpenHKU(struct ndr_push *ndr, int flags, const struct winreg_OpenHKU *r)
852 {
853         if (flags & NDR_IN) {
854                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.system_name));
855                 if (r->in.system_name) {
856                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, *r->in.system_name));
857                 }
858                 NDR_CHECK(ndr_push_winreg_AccessMask(ndr, NDR_SCALARS, r->in.access_mask));
859         }
860         if (flags & NDR_OUT) {
861                 if (r->out.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
862                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle));
863                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
864         }
865         return NT_STATUS_OK;
866 }
867
868 NTSTATUS ndr_pull_winreg_OpenHKU(struct ndr_pull *ndr, int flags, struct winreg_OpenHKU *r)
869 {
870         uint32_t _ptr_system_name;
871         TALLOC_CTX *_mem_save_system_name_0;
872         TALLOC_CTX *_mem_save_handle_0;
873         if (flags & NDR_IN) {
874                 ZERO_STRUCT(r->out);
875
876                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_system_name));
877                 if (_ptr_system_name) {
878                         NDR_PULL_ALLOC(ndr, r->in.system_name);
879                 } else {
880                         r->in.system_name = NULL;
881                 }
882                 if (r->in.system_name) {
883                         _mem_save_system_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
884                         NDR_PULL_SET_MEM_CTX(ndr, r->in.system_name, 0);
885                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, r->in.system_name));
886                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_system_name_0, 0);
887                 }
888                 NDR_CHECK(ndr_pull_winreg_AccessMask(ndr, NDR_SCALARS, &r->in.access_mask));
889                 NDR_PULL_ALLOC(ndr, r->out.handle);
890                 ZERO_STRUCTP(r->out.handle);
891         }
892         if (flags & NDR_OUT) {
893                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
894                         NDR_PULL_ALLOC(ndr, r->out.handle);
895                 }
896                 _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
897                 NDR_PULL_SET_MEM_CTX(ndr, r->out.handle, LIBNDR_FLAG_REF_ALLOC);
898                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle));
899                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
900                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
901         }
902         return NT_STATUS_OK;
903 }
904
905 _PUBLIC_ void ndr_print_winreg_OpenHKU(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKU *r)
906 {
907         ndr_print_struct(ndr, name, "winreg_OpenHKU");
908         ndr->depth++;
909         if (flags & NDR_SET_VALUES) {
910                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
911         }
912         if (flags & NDR_IN) {
913                 ndr_print_struct(ndr, "in", "winreg_OpenHKU");
914                 ndr->depth++;
915                 ndr_print_ptr(ndr, "system_name", r->in.system_name);
916                 ndr->depth++;
917                 if (r->in.system_name) {
918                         ndr_print_uint16(ndr, "system_name", *r->in.system_name);
919                 }
920                 ndr->depth--;
921                 ndr_print_winreg_AccessMask(ndr, "access_mask", r->in.access_mask);
922                 ndr->depth--;
923         }
924         if (flags & NDR_OUT) {
925                 ndr_print_struct(ndr, "out", "winreg_OpenHKU");
926                 ndr->depth++;
927                 ndr_print_ptr(ndr, "handle", r->out.handle);
928                 ndr->depth++;
929                 ndr_print_policy_handle(ndr, "handle", r->out.handle);
930                 ndr->depth--;
931                 ndr_print_WERROR(ndr, "result", r->out.result);
932                 ndr->depth--;
933         }
934         ndr->depth--;
935 }
936
937 NTSTATUS ndr_push_winreg_CloseKey(struct ndr_push *ndr, int flags, const struct winreg_CloseKey *r)
938 {
939         if (flags & NDR_IN) {
940                 if (r->in.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
941                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
942         }
943         if (flags & NDR_OUT) {
944                 if (r->out.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
945                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle));
946                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
947         }
948         return NT_STATUS_OK;
949 }
950
951 NTSTATUS ndr_pull_winreg_CloseKey(struct ndr_pull *ndr, int flags, struct winreg_CloseKey *r)
952 {
953         TALLOC_CTX *_mem_save_handle_0;
954         if (flags & NDR_IN) {
955                 ZERO_STRUCT(r->out);
956
957                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
958                         NDR_PULL_ALLOC(ndr, r->in.handle);
959                 }
960                 _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
961                 NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC);
962                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
963                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
964                 NDR_PULL_ALLOC(ndr, r->out.handle);
965                 *r->out.handle = *r->in.handle;
966         }
967         if (flags & NDR_OUT) {
968                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
969                         NDR_PULL_ALLOC(ndr, r->out.handle);
970                 }
971                 _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
972                 NDR_PULL_SET_MEM_CTX(ndr, r->out.handle, LIBNDR_FLAG_REF_ALLOC);
973                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle));
974                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
975                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
976         }
977         return NT_STATUS_OK;
978 }
979
980 _PUBLIC_ void ndr_print_winreg_CloseKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_CloseKey *r)
981 {
982         ndr_print_struct(ndr, name, "winreg_CloseKey");
983         ndr->depth++;
984         if (flags & NDR_SET_VALUES) {
985                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
986         }
987         if (flags & NDR_IN) {
988                 ndr_print_struct(ndr, "in", "winreg_CloseKey");
989                 ndr->depth++;
990                 ndr_print_ptr(ndr, "handle", r->in.handle);
991                 ndr->depth++;
992                 ndr_print_policy_handle(ndr, "handle", r->in.handle);
993                 ndr->depth--;
994                 ndr->depth--;
995         }
996         if (flags & NDR_OUT) {
997                 ndr_print_struct(ndr, "out", "winreg_CloseKey");
998                 ndr->depth++;
999                 ndr_print_ptr(ndr, "handle", r->out.handle);
1000                 ndr->depth++;
1001                 ndr_print_policy_handle(ndr, "handle", r->out.handle);
1002                 ndr->depth--;
1003                 ndr_print_WERROR(ndr, "result", r->out.result);
1004                 ndr->depth--;
1005         }
1006         ndr->depth--;
1007 }
1008
1009 NTSTATUS ndr_push_winreg_CreateKey(struct ndr_push *ndr, int flags, const struct winreg_CreateKey *r)
1010 {
1011         if (flags & NDR_IN) {
1012                 if (r->in.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
1013                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
1014                 NDR_CHECK(ndr_push_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.name));
1015                 NDR_CHECK(ndr_push_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.keyclass));
1016                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.options));
1017                 NDR_CHECK(ndr_push_winreg_AccessMask(ndr, NDR_SCALARS, r->in.access_mask));
1018                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.secdesc));
1019                 if (r->in.secdesc) {
1020                         NDR_CHECK(ndr_push_winreg_SecBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.secdesc));
1021                 }
1022                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.action_taken));
1023                 if (r->in.action_taken) {
1024                         NDR_CHECK(ndr_push_winreg_CreateAction(ndr, NDR_SCALARS, *r->in.action_taken));
1025                 }
1026         }
1027         if (flags & NDR_OUT) {
1028                 if (r->out.new_handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
1029                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.new_handle));
1030                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.action_taken));
1031                 if (r->out.action_taken) {
1032                         NDR_CHECK(ndr_push_winreg_CreateAction(ndr, NDR_SCALARS, *r->out.action_taken));
1033                 }
1034                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
1035         }
1036         return NT_STATUS_OK;
1037 }
1038
1039 NTSTATUS ndr_pull_winreg_CreateKey(struct ndr_pull *ndr, int flags, struct winreg_CreateKey *r)
1040 {
1041         uint32_t _ptr_secdesc;
1042         uint32_t _ptr_action_taken;
1043         TALLOC_CTX *_mem_save_handle_0;
1044         TALLOC_CTX *_mem_save_secdesc_0;
1045         TALLOC_CTX *_mem_save_new_handle_0;
1046         TALLOC_CTX *_mem_save_action_taken_0;
1047         if (flags & NDR_IN) {
1048                 ZERO_STRUCT(r->out);
1049
1050                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
1051                         NDR_PULL_ALLOC(ndr, r->in.handle);
1052                 }
1053                 _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
1054                 NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC);
1055                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
1056                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
1057                 NDR_CHECK(ndr_pull_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.name));
1058                 NDR_CHECK(ndr_pull_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.keyclass));
1059                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.options));
1060                 NDR_CHECK(ndr_pull_winreg_AccessMask(ndr, NDR_SCALARS, &r->in.access_mask));
1061                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_secdesc));
1062                 if (_ptr_secdesc) {
1063                         NDR_PULL_ALLOC(ndr, r->in.secdesc);
1064                 } else {
1065                         r->in.secdesc = NULL;
1066                 }
1067                 if (r->in.secdesc) {
1068                         _mem_save_secdesc_0 = NDR_PULL_GET_MEM_CTX(ndr);
1069                         NDR_PULL_SET_MEM_CTX(ndr, r->in.secdesc, 0);
1070                         NDR_CHECK(ndr_pull_winreg_SecBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.secdesc));
1071                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_secdesc_0, 0);
1072                 }
1073                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_action_taken));
1074                 if (_ptr_action_taken) {
1075                         NDR_PULL_ALLOC(ndr, r->in.action_taken);
1076                 } else {
1077                         r->in.action_taken = NULL;
1078                 }
1079                 if (r->in.action_taken) {
1080                         _mem_save_action_taken_0 = NDR_PULL_GET_MEM_CTX(ndr);
1081                         NDR_PULL_SET_MEM_CTX(ndr, r->in.action_taken, 0);
1082                         NDR_CHECK(ndr_pull_winreg_CreateAction(ndr, NDR_SCALARS, r->in.action_taken));
1083                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_action_taken_0, 0);
1084                 }
1085                 NDR_PULL_ALLOC(ndr, r->out.new_handle);
1086                 ZERO_STRUCTP(r->out.new_handle);
1087         }
1088         if (flags & NDR_OUT) {
1089                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
1090                         NDR_PULL_ALLOC(ndr, r->out.new_handle);
1091                 }
1092                 _mem_save_new_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
1093                 NDR_PULL_SET_MEM_CTX(ndr, r->out.new_handle, LIBNDR_FLAG_REF_ALLOC);
1094                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.new_handle));
1095                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_new_handle_0, LIBNDR_FLAG_REF_ALLOC);
1096                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_action_taken));
1097                 if (_ptr_action_taken) {
1098                         NDR_PULL_ALLOC(ndr, r->out.action_taken);
1099                 } else {
1100                         r->out.action_taken = NULL;
1101                 }
1102                 if (r->out.action_taken) {
1103                         _mem_save_action_taken_0 = NDR_PULL_GET_MEM_CTX(ndr);
1104                         NDR_PULL_SET_MEM_CTX(ndr, r->out.action_taken, 0);
1105                         NDR_CHECK(ndr_pull_winreg_CreateAction(ndr, NDR_SCALARS, r->out.action_taken));
1106                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_action_taken_0, 0);
1107                 }
1108                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
1109         }
1110         return NT_STATUS_OK;
1111 }
1112
1113 _PUBLIC_ void ndr_print_winreg_CreateKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_CreateKey *r)
1114 {
1115         ndr_print_struct(ndr, name, "winreg_CreateKey");
1116         ndr->depth++;
1117         if (flags & NDR_SET_VALUES) {
1118                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
1119         }
1120         if (flags & NDR_IN) {
1121                 ndr_print_struct(ndr, "in", "winreg_CreateKey");
1122                 ndr->depth++;
1123                 ndr_print_ptr(ndr, "handle", r->in.handle);
1124                 ndr->depth++;
1125                 ndr_print_policy_handle(ndr, "handle", r->in.handle);
1126                 ndr->depth--;
1127                 ndr_print_winreg_String(ndr, "name", &r->in.name);
1128                 ndr_print_winreg_String(ndr, "keyclass", &r->in.keyclass);
1129                 ndr_print_uint32(ndr, "options", r->in.options);
1130                 ndr_print_winreg_AccessMask(ndr, "access_mask", r->in.access_mask);
1131                 ndr_print_ptr(ndr, "secdesc", r->in.secdesc);
1132                 ndr->depth++;
1133                 if (r->in.secdesc) {
1134                         ndr_print_winreg_SecBuf(ndr, "secdesc", r->in.secdesc);
1135                 }
1136                 ndr->depth--;
1137                 ndr_print_ptr(ndr, "action_taken", r->in.action_taken);
1138                 ndr->depth++;
1139                 if (r->in.action_taken) {
1140                         ndr_print_winreg_CreateAction(ndr, "action_taken", *r->in.action_taken);
1141                 }
1142                 ndr->depth--;
1143                 ndr->depth--;
1144         }
1145         if (flags & NDR_OUT) {
1146                 ndr_print_struct(ndr, "out", "winreg_CreateKey");
1147                 ndr->depth++;
1148                 ndr_print_ptr(ndr, "new_handle", r->out.new_handle);
1149                 ndr->depth++;
1150                 ndr_print_policy_handle(ndr, "new_handle", r->out.new_handle);
1151                 ndr->depth--;
1152                 ndr_print_ptr(ndr, "action_taken", r->out.action_taken);
1153                 ndr->depth++;
1154                 if (r->out.action_taken) {
1155                         ndr_print_winreg_CreateAction(ndr, "action_taken", *r->out.action_taken);
1156                 }
1157                 ndr->depth--;
1158                 ndr_print_WERROR(ndr, "result", r->out.result);
1159                 ndr->depth--;
1160         }
1161         ndr->depth--;
1162 }
1163
1164 NTSTATUS ndr_push_winreg_DeleteKey(struct ndr_push *ndr, int flags, const struct winreg_DeleteKey *r)
1165 {
1166         if (flags & NDR_IN) {
1167                 if (r->in.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
1168                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
1169                 NDR_CHECK(ndr_push_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.key));
1170         }
1171         if (flags & NDR_OUT) {
1172                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
1173         }
1174         return NT_STATUS_OK;
1175 }
1176
1177 NTSTATUS ndr_pull_winreg_DeleteKey(struct ndr_pull *ndr, int flags, struct winreg_DeleteKey *r)
1178 {
1179         TALLOC_CTX *_mem_save_handle_0;
1180         if (flags & NDR_IN) {
1181                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
1182                         NDR_PULL_ALLOC(ndr, r->in.handle);
1183                 }
1184                 _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
1185                 NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC);
1186                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
1187                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
1188                 NDR_CHECK(ndr_pull_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.key));
1189         }
1190         if (flags & NDR_OUT) {
1191                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
1192         }
1193         return NT_STATUS_OK;
1194 }
1195
1196 _PUBLIC_ void ndr_print_winreg_DeleteKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_DeleteKey *r)
1197 {
1198         ndr_print_struct(ndr, name, "winreg_DeleteKey");
1199         ndr->depth++;
1200         if (flags & NDR_SET_VALUES) {
1201                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
1202         }
1203         if (flags & NDR_IN) {
1204                 ndr_print_struct(ndr, "in", "winreg_DeleteKey");
1205                 ndr->depth++;
1206                 ndr_print_ptr(ndr, "handle", r->in.handle);
1207                 ndr->depth++;
1208                 ndr_print_policy_handle(ndr, "handle", r->in.handle);
1209                 ndr->depth--;
1210                 ndr_print_winreg_String(ndr, "key", &r->in.key);
1211                 ndr->depth--;
1212         }
1213         if (flags & NDR_OUT) {
1214                 ndr_print_struct(ndr, "out", "winreg_DeleteKey");
1215                 ndr->depth++;
1216                 ndr_print_WERROR(ndr, "result", r->out.result);
1217                 ndr->depth--;
1218         }
1219         ndr->depth--;
1220 }
1221
1222 NTSTATUS ndr_push_winreg_DeleteValue(struct ndr_push *ndr, int flags, const struct winreg_DeleteValue *r)
1223 {
1224         if (flags & NDR_IN) {
1225                 if (r->in.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
1226                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
1227                 NDR_CHECK(ndr_push_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.value));
1228         }
1229         if (flags & NDR_OUT) {
1230                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
1231         }
1232         return NT_STATUS_OK;
1233 }
1234
1235 NTSTATUS ndr_pull_winreg_DeleteValue(struct ndr_pull *ndr, int flags, struct winreg_DeleteValue *r)
1236 {
1237         TALLOC_CTX *_mem_save_handle_0;
1238         if (flags & NDR_IN) {
1239                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
1240                         NDR_PULL_ALLOC(ndr, r->in.handle);
1241                 }
1242                 _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
1243                 NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC);
1244                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
1245                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
1246                 NDR_CHECK(ndr_pull_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.value));
1247         }
1248         if (flags & NDR_OUT) {
1249                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
1250         }
1251         return NT_STATUS_OK;
1252 }
1253
1254 _PUBLIC_ void ndr_print_winreg_DeleteValue(struct ndr_print *ndr, const char *name, int flags, const struct winreg_DeleteValue *r)
1255 {
1256         ndr_print_struct(ndr, name, "winreg_DeleteValue");
1257         ndr->depth++;
1258         if (flags & NDR_SET_VALUES) {
1259                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
1260         }
1261         if (flags & NDR_IN) {
1262                 ndr_print_struct(ndr, "in", "winreg_DeleteValue");
1263                 ndr->depth++;
1264                 ndr_print_ptr(ndr, "handle", r->in.handle);
1265                 ndr->depth++;
1266                 ndr_print_policy_handle(ndr, "handle", r->in.handle);
1267                 ndr->depth--;
1268                 ndr_print_winreg_String(ndr, "value", &r->in.value);
1269                 ndr->depth--;
1270         }
1271         if (flags & NDR_OUT) {
1272                 ndr_print_struct(ndr, "out", "winreg_DeleteValue");
1273                 ndr->depth++;
1274                 ndr_print_WERROR(ndr, "result", r->out.result);
1275                 ndr->depth--;
1276         }
1277         ndr->depth--;
1278 }
1279
1280 NTSTATUS ndr_push_winreg_EnumKey(struct ndr_push *ndr, int flags, const struct winreg_EnumKey *r)
1281 {
1282         if (flags & NDR_IN) {
1283                 if (r->in.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
1284                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
1285                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.enum_index));
1286                 if (r->in.name == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
1287                 NDR_CHECK(ndr_push_winreg_StringBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.name));
1288                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.keyclass));
1289                 if (r->in.keyclass) {
1290                         NDR_CHECK(ndr_push_winreg_StringBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.keyclass));
1291                 }
1292                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.last_changed_time));
1293                 if (r->in.last_changed_time) {
1294                         NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, *r->in.last_changed_time));
1295                 }
1296         }
1297         if (flags & NDR_OUT) {
1298                 if (r->out.name == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
1299                 NDR_CHECK(ndr_push_winreg_StringBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.name));
1300                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.keyclass));
1301                 if (r->out.keyclass) {
1302                         NDR_CHECK(ndr_push_winreg_StringBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.keyclass));
1303                 }
1304                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.last_changed_time));
1305                 if (r->out.last_changed_time) {
1306                         NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, *r->out.last_changed_time));
1307                 }
1308                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
1309         }
1310         return NT_STATUS_OK;
1311 }
1312
1313 NTSTATUS ndr_pull_winreg_EnumKey(struct ndr_pull *ndr, int flags, struct winreg_EnumKey *r)
1314 {
1315         uint32_t _ptr_keyclass;
1316         uint32_t _ptr_last_changed_time;
1317         TALLOC_CTX *_mem_save_handle_0;
1318         TALLOC_CTX *_mem_save_name_0;
1319         TALLOC_CTX *_mem_save_keyclass_0;
1320         TALLOC_CTX *_mem_save_last_changed_time_0;
1321         if (flags & NDR_IN) {
1322                 ZERO_STRUCT(r->out);
1323
1324                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
1325                         NDR_PULL_ALLOC(ndr, r->in.handle);
1326                 }
1327                 _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
1328                 NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC);
1329                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
1330                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
1331                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.enum_index));
1332                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
1333                         NDR_PULL_ALLOC(ndr, r->in.name);
1334                 }
1335                 _mem_save_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
1336                 NDR_PULL_SET_MEM_CTX(ndr, r->in.name, LIBNDR_FLAG_REF_ALLOC);
1337                 NDR_CHECK(ndr_pull_winreg_StringBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.name));
1338                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_name_0, LIBNDR_FLAG_REF_ALLOC);
1339                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_keyclass));
1340                 if (_ptr_keyclass) {
1341                         NDR_PULL_ALLOC(ndr, r->in.keyclass);
1342                 } else {
1343                         r->in.keyclass = NULL;
1344                 }
1345                 if (r->in.keyclass) {
1346                         _mem_save_keyclass_0 = NDR_PULL_GET_MEM_CTX(ndr);
1347                         NDR_PULL_SET_MEM_CTX(ndr, r->in.keyclass, 0);
1348                         NDR_CHECK(ndr_pull_winreg_StringBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.keyclass));
1349                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_keyclass_0, 0);
1350                 }
1351                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_last_changed_time));
1352                 if (_ptr_last_changed_time) {
1353                         NDR_PULL_ALLOC(ndr, r->in.last_changed_time);
1354                 } else {
1355                         r->in.last_changed_time = NULL;
1356                 }
1357                 if (r->in.last_changed_time) {
1358                         _mem_save_last_changed_time_0 = NDR_PULL_GET_MEM_CTX(ndr);
1359                         NDR_PULL_SET_MEM_CTX(ndr, r->in.last_changed_time, 0);
1360                         NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, r->in.last_changed_time));
1361                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_last_changed_time_0, 0);
1362                 }
1363                 NDR_PULL_ALLOC(ndr, r->out.name);
1364                 *r->out.name = *r->in.name;
1365         }
1366         if (flags & NDR_OUT) {
1367                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
1368                         NDR_PULL_ALLOC(ndr, r->out.name);
1369                 }
1370                 _mem_save_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
1371                 NDR_PULL_SET_MEM_CTX(ndr, r->out.name, LIBNDR_FLAG_REF_ALLOC);
1372                 NDR_CHECK(ndr_pull_winreg_StringBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.name));
1373                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_name_0, LIBNDR_FLAG_REF_ALLOC);
1374                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_keyclass));
1375                 if (_ptr_keyclass) {
1376                         NDR_PULL_ALLOC(ndr, r->out.keyclass);
1377                 } else {
1378                         r->out.keyclass = NULL;
1379                 }
1380                 if (r->out.keyclass) {
1381                         _mem_save_keyclass_0 = NDR_PULL_GET_MEM_CTX(ndr);
1382                         NDR_PULL_SET_MEM_CTX(ndr, r->out.keyclass, 0);
1383                         NDR_CHECK(ndr_pull_winreg_StringBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.keyclass));
1384                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_keyclass_0, 0);
1385                 }
1386                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_last_changed_time));
1387                 if (_ptr_last_changed_time) {
1388                         NDR_PULL_ALLOC(ndr, r->out.last_changed_time);
1389                 } else {
1390                         r->out.last_changed_time = NULL;
1391                 }
1392                 if (r->out.last_changed_time) {
1393                         _mem_save_last_changed_time_0 = NDR_PULL_GET_MEM_CTX(ndr);
1394                         NDR_PULL_SET_MEM_CTX(ndr, r->out.last_changed_time, 0);
1395                         NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, r->out.last_changed_time));
1396                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_last_changed_time_0, 0);
1397                 }
1398                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
1399         }
1400         return NT_STATUS_OK;
1401 }
1402
1403 _PUBLIC_ void ndr_print_winreg_EnumKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_EnumKey *r)
1404 {
1405         ndr_print_struct(ndr, name, "winreg_EnumKey");
1406         ndr->depth++;
1407         if (flags & NDR_SET_VALUES) {
1408                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
1409         }
1410         if (flags & NDR_IN) {
1411                 ndr_print_struct(ndr, "in", "winreg_EnumKey");
1412                 ndr->depth++;
1413                 ndr_print_ptr(ndr, "handle", r->in.handle);
1414                 ndr->depth++;
1415                 ndr_print_policy_handle(ndr, "handle", r->in.handle);
1416                 ndr->depth--;
1417                 ndr_print_uint32(ndr, "enum_index", r->in.enum_index);
1418                 ndr_print_ptr(ndr, "name", r->in.name);
1419                 ndr->depth++;
1420                 ndr_print_winreg_StringBuf(ndr, "name", r->in.name);
1421                 ndr->depth--;
1422                 ndr_print_ptr(ndr, "keyclass", r->in.keyclass);
1423                 ndr->depth++;
1424                 if (r->in.keyclass) {
1425                         ndr_print_winreg_StringBuf(ndr, "keyclass", r->in.keyclass);
1426                 }
1427                 ndr->depth--;
1428                 ndr_print_ptr(ndr, "last_changed_time", r->in.last_changed_time);
1429                 ndr->depth++;
1430                 if (r->in.last_changed_time) {
1431                         ndr_print_NTTIME(ndr, "last_changed_time", *r->in.last_changed_time);
1432                 }
1433                 ndr->depth--;
1434                 ndr->depth--;
1435         }
1436         if (flags & NDR_OUT) {
1437                 ndr_print_struct(ndr, "out", "winreg_EnumKey");
1438                 ndr->depth++;
1439                 ndr_print_ptr(ndr, "name", r->out.name);
1440                 ndr->depth++;
1441                 ndr_print_winreg_StringBuf(ndr, "name", r->out.name);
1442                 ndr->depth--;
1443                 ndr_print_ptr(ndr, "keyclass", r->out.keyclass);
1444                 ndr->depth++;
1445                 if (r->out.keyclass) {
1446                         ndr_print_winreg_StringBuf(ndr, "keyclass", r->out.keyclass);
1447                 }
1448                 ndr->depth--;
1449                 ndr_print_ptr(ndr, "last_changed_time", r->out.last_changed_time);
1450                 ndr->depth++;
1451                 if (r->out.last_changed_time) {
1452                         ndr_print_NTTIME(ndr, "last_changed_time", *r->out.last_changed_time);
1453                 }
1454                 ndr->depth--;
1455                 ndr_print_WERROR(ndr, "result", r->out.result);
1456                 ndr->depth--;
1457         }
1458         ndr->depth--;
1459 }
1460
1461 NTSTATUS ndr_push_winreg_EnumValue(struct ndr_push *ndr, int flags, const struct winreg_EnumValue *r)
1462 {
1463         if (flags & NDR_IN) {
1464                 if (r->in.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
1465                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
1466                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.enum_index));
1467                 if (r->in.name == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
1468                 NDR_CHECK(ndr_push_winreg_ValNameBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.name));
1469                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.type));
1470                 if (r->in.type) {
1471                         NDR_CHECK(ndr_push_winreg_Type(ndr, NDR_SCALARS, *r->in.type));
1472                 }
1473                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.data));
1474                 if (r->in.data) {
1475                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.data_size));
1476                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
1477                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.value_length));
1478                         NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->in.data, *r->in.value_length));
1479                 }
1480                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.data_size));
1481                 if (r->in.data_size) {
1482                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.data_size));
1483                 }
1484                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.value_length));
1485                 if (r->in.value_length) {
1486                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.value_length));
1487                 }
1488         }
1489         if (flags & NDR_OUT) {
1490                 if (r->out.name == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
1491                 NDR_CHECK(ndr_push_winreg_ValNameBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.name));
1492                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.type));
1493                 if (r->out.type) {
1494                         NDR_CHECK(ndr_push_winreg_Type(ndr, NDR_SCALARS, *r->out.type));
1495                 }
1496                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.data));
1497                 if (r->out.data) {
1498                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.data_size));
1499                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
1500                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.value_length));
1501                         NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->out.data, *r->out.value_length));
1502                 }
1503                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.data_size));
1504                 if (r->out.data_size) {
1505                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.data_size));
1506                 }
1507                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.value_length));
1508                 if (r->out.value_length) {
1509                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.value_length));
1510                 }
1511                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
1512         }
1513         return NT_STATUS_OK;
1514 }
1515
1516 NTSTATUS ndr_pull_winreg_EnumValue(struct ndr_pull *ndr, int flags, struct winreg_EnumValue *r)
1517 {
1518         uint32_t _ptr_type;
1519         uint32_t _ptr_data;
1520         uint32_t _ptr_data_size;
1521         uint32_t _ptr_value_length;
1522         TALLOC_CTX *_mem_save_handle_0;
1523         TALLOC_CTX *_mem_save_name_0;
1524         TALLOC_CTX *_mem_save_type_0;
1525         TALLOC_CTX *_mem_save_data_0;
1526         TALLOC_CTX *_mem_save_data_size_0;
1527         TALLOC_CTX *_mem_save_value_length_0;
1528         if (flags & NDR_IN) {
1529                 ZERO_STRUCT(r->out);
1530
1531                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
1532                         NDR_PULL_ALLOC(ndr, r->in.handle);
1533                 }
1534                 _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
1535                 NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC);
1536                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
1537                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
1538                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.enum_index));
1539                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
1540                         NDR_PULL_ALLOC(ndr, r->in.name);
1541                 }
1542                 _mem_save_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
1543                 NDR_PULL_SET_MEM_CTX(ndr, r->in.name, LIBNDR_FLAG_REF_ALLOC);
1544                 NDR_CHECK(ndr_pull_winreg_ValNameBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.name));
1545                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_name_0, LIBNDR_FLAG_REF_ALLOC);
1546                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_type));
1547                 if (_ptr_type) {
1548                         NDR_PULL_ALLOC(ndr, r->in.type);
1549                 } else {
1550                         r->in.type = NULL;
1551                 }
1552                 if (r->in.type) {
1553                         _mem_save_type_0 = NDR_PULL_GET_MEM_CTX(ndr);
1554                         NDR_PULL_SET_MEM_CTX(ndr, r->in.type, 0);
1555                         NDR_CHECK(ndr_pull_winreg_Type(ndr, NDR_SCALARS, r->in.type));
1556                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_type_0, 0);
1557                 }
1558                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_data));
1559                 if (_ptr_data) {
1560                         NDR_PULL_ALLOC(ndr, r->in.data);
1561                 } else {
1562                         r->in.data = NULL;
1563                 }
1564                 if (r->in.data) {
1565                         _mem_save_data_0 = NDR_PULL_GET_MEM_CTX(ndr);
1566                         NDR_PULL_SET_MEM_CTX(ndr, r->in.data, 0);
1567                         NDR_CHECK(ndr_pull_array_size(ndr, &r->in.data));
1568                         NDR_CHECK(ndr_pull_array_length(ndr, &r->in.data));
1569                         if (ndr_get_array_length(ndr, &r->in.data) > ndr_get_array_size(ndr, &r->in.data)) {
1570                                 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.data), ndr_get_array_length(ndr, &r->in.data));
1571                         }
1572                         NDR_PULL_ALLOC_N(ndr, r->in.data, ndr_get_array_size(ndr, &r->in.data));
1573                         NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->in.data, ndr_get_array_length(ndr, &r->in.data)));
1574                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_0, 0);
1575                 }
1576                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_data_size));
1577                 if (_ptr_data_size) {
1578                         NDR_PULL_ALLOC(ndr, r->in.data_size);
1579                 } else {
1580                         r->in.data_size = NULL;
1581                 }
1582                 if (r->in.data_size) {
1583                         _mem_save_data_size_0 = NDR_PULL_GET_MEM_CTX(ndr);
1584                         NDR_PULL_SET_MEM_CTX(ndr, r->in.data_size, 0);
1585                         NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.data_size));
1586                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_size_0, 0);
1587                 }
1588                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_value_length));
1589                 if (_ptr_value_length) {
1590                         NDR_PULL_ALLOC(ndr, r->in.value_length);
1591                 } else {
1592                         r->in.value_length = NULL;
1593                 }
1594                 if (r->in.value_length) {
1595                         _mem_save_value_length_0 = NDR_PULL_GET_MEM_CTX(ndr);
1596                         NDR_PULL_SET_MEM_CTX(ndr, r->in.value_length, 0);
1597                         NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.value_length));
1598                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_value_length_0, 0);
1599                 }
1600                 NDR_PULL_ALLOC(ndr, r->out.name);
1601                 *r->out.name = *r->in.name;
1602                 if (r->in.data) {
1603                         if (r->in.data_size == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
1604                         NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->in.data, *r->in.data_size));
1605                 }
1606                 if (r->in.data) {
1607                         if (r->in.value_length == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
1608                         NDR_CHECK(ndr_check_array_length(ndr, (void*)&r->in.data, *r->in.value_length));
1609                 }
1610         }
1611         if (flags & NDR_OUT) {
1612                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
1613                         NDR_PULL_ALLOC(ndr, r->out.name);
1614                 }
1615                 _mem_save_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
1616                 NDR_PULL_SET_MEM_CTX(ndr, r->out.name, LIBNDR_FLAG_REF_ALLOC);
1617                 NDR_CHECK(ndr_pull_winreg_ValNameBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.name));
1618                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_name_0, LIBNDR_FLAG_REF_ALLOC);
1619                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_type));
1620                 if (_ptr_type) {
1621                         NDR_PULL_ALLOC(ndr, r->out.type);
1622                 } else {
1623                         r->out.type = NULL;
1624                 }
1625                 if (r->out.type) {
1626                         _mem_save_type_0 = NDR_PULL_GET_MEM_CTX(ndr);
1627                         NDR_PULL_SET_MEM_CTX(ndr, r->out.type, 0);
1628                         NDR_CHECK(ndr_pull_winreg_Type(ndr, NDR_SCALARS, r->out.type));
1629                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_type_0, 0);
1630                 }
1631                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_data));
1632                 if (_ptr_data) {
1633                         NDR_PULL_ALLOC(ndr, r->out.data);
1634                 } else {
1635                         r->out.data = NULL;
1636                 }
1637                 if (r->out.data) {
1638                         _mem_save_data_0 = NDR_PULL_GET_MEM_CTX(ndr);
1639                         NDR_PULL_SET_MEM_CTX(ndr, r->out.data, 0);
1640                         NDR_CHECK(ndr_pull_array_size(ndr, &r->out.data));
1641                         NDR_CHECK(ndr_pull_array_length(ndr, &r->out.data));
1642                         if (ndr_get_array_length(ndr, &r->out.data) > ndr_get_array_size(ndr, &r->out.data)) {
1643                                 return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->out.data), ndr_get_array_length(ndr, &r->out.data));
1644                         }
1645                         NDR_PULL_ALLOC_N(ndr, r->out.data, ndr_get_array_size(ndr, &r->out.data));
1646                         NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->out.data, ndr_get_array_length(ndr, &r->out.data)));
1647                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_0, 0);
1648                 }
1649                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_data_size));
1650                 if (_ptr_data_size) {
1651                         NDR_PULL_ALLOC(ndr, r->out.data_size);
1652                 } else {
1653                         r->out.data_size = NULL;
1654                 }
1655                 if (r->out.data_size) {
1656                         _mem_save_data_size_0 = NDR_PULL_GET_MEM_CTX(ndr);
1657                         NDR_PULL_SET_MEM_CTX(ndr, r->out.data_size, 0);
1658                         NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.data_size));
1659                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_size_0, 0);
1660                 }
1661                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_value_length));
1662                 if (_ptr_value_length) {
1663                         NDR_PULL_ALLOC(ndr, r->out.value_length);
1664                 } else {
1665                         r->out.value_length = NULL;
1666                 }
1667                 if (r->out.value_length) {
1668                         _mem_save_value_length_0 = NDR_PULL_GET_MEM_CTX(ndr);
1669                         NDR_PULL_SET_MEM_CTX(ndr, r->out.value_length, 0);
1670                         NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.value_length));
1671                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_value_length_0, 0);
1672                 }
1673                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
1674                 if (r->out.data) {
1675                         if (r->out.data_size == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
1676                         NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->out.data, *r->out.data_size));
1677                 }
1678                 if (r->out.data) {
1679                         if (r->out.value_length == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
1680                         NDR_CHECK(ndr_check_array_length(ndr, (void*)&r->out.data, *r->out.value_length));
1681                 }
1682         }
1683         return NT_STATUS_OK;
1684 }
1685
1686 _PUBLIC_ void ndr_print_winreg_EnumValue(struct ndr_print *ndr, const char *name, int flags, const struct winreg_EnumValue *r)
1687 {
1688         ndr_print_struct(ndr, name, "winreg_EnumValue");
1689         ndr->depth++;
1690         if (flags & NDR_SET_VALUES) {
1691                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
1692         }
1693         if (flags & NDR_IN) {
1694                 ndr_print_struct(ndr, "in", "winreg_EnumValue");
1695                 ndr->depth++;
1696                 ndr_print_ptr(ndr, "handle", r->in.handle);
1697                 ndr->depth++;
1698                 ndr_print_policy_handle(ndr, "handle", r->in.handle);
1699                 ndr->depth--;
1700                 ndr_print_uint32(ndr, "enum_index", r->in.enum_index);
1701                 ndr_print_ptr(ndr, "name", r->in.name);
1702                 ndr->depth++;
1703                 ndr_print_winreg_ValNameBuf(ndr, "name", r->in.name);
1704                 ndr->depth--;
1705                 ndr_print_ptr(ndr, "type", r->in.type);
1706                 ndr->depth++;
1707                 if (r->in.type) {
1708                         ndr_print_winreg_Type(ndr, "type", *r->in.type);
1709                 }
1710                 ndr->depth--;
1711                 ndr_print_ptr(ndr, "data", r->in.data);
1712                 ndr->depth++;
1713                 if (r->in.data) {
1714                         if (r->in.value_length == NULL) return;
1715                         ndr_print_array_uint8(ndr, "data", r->in.data, *r->in.value_length);
1716                 }
1717                 ndr->depth--;
1718                 ndr_print_ptr(ndr, "data_size", r->in.data_size);
1719                 ndr->depth++;
1720                 if (r->in.data_size) {
1721                         ndr_print_uint32(ndr, "data_size", *r->in.data_size);
1722                 }
1723                 ndr->depth--;
1724                 ndr_print_ptr(ndr, "value_length", r->in.value_length);
1725                 ndr->depth++;
1726                 if (r->in.value_length) {
1727                         ndr_print_uint32(ndr, "value_length", *r->in.value_length);
1728                 }
1729                 ndr->depth--;
1730                 ndr->depth--;
1731         }
1732         if (flags & NDR_OUT) {
1733                 ndr_print_struct(ndr, "out", "winreg_EnumValue");
1734                 ndr->depth++;
1735                 ndr_print_ptr(ndr, "name", r->out.name);
1736                 ndr->depth++;
1737                 ndr_print_winreg_ValNameBuf(ndr, "name", r->out.name);
1738                 ndr->depth--;
1739                 ndr_print_ptr(ndr, "type", r->out.type);
1740                 ndr->depth++;
1741                 if (r->out.type) {
1742                         ndr_print_winreg_Type(ndr, "type", *r->out.type);
1743                 }
1744                 ndr->depth--;
1745                 ndr_print_ptr(ndr, "data", r->out.data);
1746                 ndr->depth++;
1747                 if (r->out.data) {
1748                         if (r->out.value_length == NULL) return;
1749                         ndr_print_array_uint8(ndr, "data", r->out.data, *r->out.value_length);
1750                 }
1751                 ndr->depth--;
1752                 ndr_print_ptr(ndr, "data_size", r->out.data_size);
1753                 ndr->depth++;
1754                 if (r->out.data_size) {
1755                         ndr_print_uint32(ndr, "data_size", *r->out.data_size);
1756                 }
1757                 ndr->depth--;
1758                 ndr_print_ptr(ndr, "value_length", r->out.value_length);
1759                 ndr->depth++;
1760                 if (r->out.value_length) {
1761                         ndr_print_uint32(ndr, "value_length", *r->out.value_length);
1762                 }
1763                 ndr->depth--;
1764                 ndr_print_WERROR(ndr, "result", r->out.result);
1765                 ndr->depth--;
1766         }
1767         ndr->depth--;
1768 }
1769
1770 NTSTATUS ndr_push_winreg_FlushKey(struct ndr_push *ndr, int flags, const struct winreg_FlushKey *r)
1771 {
1772         if (flags & NDR_IN) {
1773                 if (r->in.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
1774                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
1775         }
1776         if (flags & NDR_OUT) {
1777                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
1778         }
1779         return NT_STATUS_OK;
1780 }
1781
1782 NTSTATUS ndr_pull_winreg_FlushKey(struct ndr_pull *ndr, int flags, struct winreg_FlushKey *r)
1783 {
1784         TALLOC_CTX *_mem_save_handle_0;
1785         if (flags & NDR_IN) {
1786                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
1787                         NDR_PULL_ALLOC(ndr, r->in.handle);
1788                 }
1789                 _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
1790                 NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC);
1791                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
1792                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
1793         }
1794         if (flags & NDR_OUT) {
1795                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
1796         }
1797         return NT_STATUS_OK;
1798 }
1799
1800 _PUBLIC_ void ndr_print_winreg_FlushKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_FlushKey *r)
1801 {
1802         ndr_print_struct(ndr, name, "winreg_FlushKey");
1803         ndr->depth++;
1804         if (flags & NDR_SET_VALUES) {
1805                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
1806         }
1807         if (flags & NDR_IN) {
1808                 ndr_print_struct(ndr, "in", "winreg_FlushKey");
1809                 ndr->depth++;
1810                 ndr_print_ptr(ndr, "handle", r->in.handle);
1811                 ndr->depth++;
1812                 ndr_print_policy_handle(ndr, "handle", r->in.handle);
1813                 ndr->depth--;
1814                 ndr->depth--;
1815         }
1816         if (flags & NDR_OUT) {
1817                 ndr_print_struct(ndr, "out", "winreg_FlushKey");
1818                 ndr->depth++;
1819                 ndr_print_WERROR(ndr, "result", r->out.result);
1820                 ndr->depth--;
1821         }
1822         ndr->depth--;
1823 }
1824
1825 NTSTATUS ndr_push_winreg_GetKeySecurity(struct ndr_push *ndr, int flags, const struct winreg_GetKeySecurity *r)
1826 {
1827         if (flags & NDR_IN) {
1828                 if (r->in.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
1829                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
1830                 NDR_CHECK(ndr_push_security_secinfo(ndr, NDR_SCALARS, r->in.sec_info));
1831                 if (r->in.sd == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
1832                 NDR_CHECK(ndr_push_KeySecurityData(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sd));
1833         }
1834         if (flags & NDR_OUT) {
1835                 if (r->out.sd == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
1836                 NDR_CHECK(ndr_push_KeySecurityData(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sd));
1837                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
1838         }
1839         return NT_STATUS_OK;
1840 }
1841
1842 NTSTATUS ndr_pull_winreg_GetKeySecurity(struct ndr_pull *ndr, int flags, struct winreg_GetKeySecurity *r)
1843 {
1844         TALLOC_CTX *_mem_save_handle_0;
1845         TALLOC_CTX *_mem_save_sd_0;
1846         if (flags & NDR_IN) {
1847                 ZERO_STRUCT(r->out);
1848
1849                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
1850                         NDR_PULL_ALLOC(ndr, r->in.handle);
1851                 }
1852                 _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
1853                 NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC);
1854                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
1855                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
1856                 NDR_CHECK(ndr_pull_security_secinfo(ndr, NDR_SCALARS, &r->in.sec_info));
1857                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
1858                         NDR_PULL_ALLOC(ndr, r->in.sd);
1859                 }
1860                 _mem_save_sd_0 = NDR_PULL_GET_MEM_CTX(ndr);
1861                 NDR_PULL_SET_MEM_CTX(ndr, r->in.sd, LIBNDR_FLAG_REF_ALLOC);
1862                 NDR_CHECK(ndr_pull_KeySecurityData(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sd));
1863                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sd_0, LIBNDR_FLAG_REF_ALLOC);
1864                 NDR_PULL_ALLOC(ndr, r->out.sd);
1865                 *r->out.sd = *r->in.sd;
1866         }
1867         if (flags & NDR_OUT) {
1868                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
1869                         NDR_PULL_ALLOC(ndr, r->out.sd);
1870                 }
1871                 _mem_save_sd_0 = NDR_PULL_GET_MEM_CTX(ndr);
1872                 NDR_PULL_SET_MEM_CTX(ndr, r->out.sd, LIBNDR_FLAG_REF_ALLOC);
1873                 NDR_CHECK(ndr_pull_KeySecurityData(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sd));
1874                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sd_0, LIBNDR_FLAG_REF_ALLOC);
1875                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
1876         }
1877         return NT_STATUS_OK;
1878 }
1879
1880 _PUBLIC_ void ndr_print_winreg_GetKeySecurity(struct ndr_print *ndr, const char *name, int flags, const struct winreg_GetKeySecurity *r)
1881 {
1882         ndr_print_struct(ndr, name, "winreg_GetKeySecurity");
1883         ndr->depth++;
1884         if (flags & NDR_SET_VALUES) {
1885                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
1886         }
1887         if (flags & NDR_IN) {
1888                 ndr_print_struct(ndr, "in", "winreg_GetKeySecurity");
1889                 ndr->depth++;
1890                 ndr_print_ptr(ndr, "handle", r->in.handle);
1891                 ndr->depth++;
1892                 ndr_print_policy_handle(ndr, "handle", r->in.handle);
1893                 ndr->depth--;
1894                 ndr_print_security_secinfo(ndr, "sec_info", r->in.sec_info);
1895                 ndr_print_ptr(ndr, "sd", r->in.sd);
1896                 ndr->depth++;
1897                 ndr_print_KeySecurityData(ndr, "sd", r->in.sd);
1898                 ndr->depth--;
1899                 ndr->depth--;
1900         }
1901         if (flags & NDR_OUT) {
1902                 ndr_print_struct(ndr, "out", "winreg_GetKeySecurity");
1903                 ndr->depth++;
1904                 ndr_print_ptr(ndr, "sd", r->out.sd);
1905                 ndr->depth++;
1906                 ndr_print_KeySecurityData(ndr, "sd", r->out.sd);
1907                 ndr->depth--;
1908                 ndr_print_WERROR(ndr, "result", r->out.result);
1909                 ndr->depth--;
1910         }
1911         ndr->depth--;
1912 }
1913
1914 NTSTATUS ndr_push_winreg_LoadKey(struct ndr_push *ndr, int flags, const struct winreg_LoadKey *r)
1915 {
1916         if (flags & NDR_IN) {
1917                 if (r->in.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
1918                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
1919                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.keyname));
1920                 if (r->in.keyname) {
1921                         NDR_CHECK(ndr_push_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.keyname));
1922                 }
1923                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.filename));
1924                 if (r->in.filename) {
1925                         NDR_CHECK(ndr_push_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.filename));
1926                 }
1927         }
1928         if (flags & NDR_OUT) {
1929                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
1930         }
1931         return NT_STATUS_OK;
1932 }
1933
1934 NTSTATUS ndr_pull_winreg_LoadKey(struct ndr_pull *ndr, int flags, struct winreg_LoadKey *r)
1935 {
1936         uint32_t _ptr_keyname;
1937         uint32_t _ptr_filename;
1938         TALLOC_CTX *_mem_save_handle_0;
1939         TALLOC_CTX *_mem_save_keyname_0;
1940         TALLOC_CTX *_mem_save_filename_0;
1941         if (flags & NDR_IN) {
1942                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
1943                         NDR_PULL_ALLOC(ndr, r->in.handle);
1944                 }
1945                 _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
1946                 NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC);
1947                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
1948                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
1949                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_keyname));
1950                 if (_ptr_keyname) {
1951                         NDR_PULL_ALLOC(ndr, r->in.keyname);
1952                 } else {
1953                         r->in.keyname = NULL;
1954                 }
1955                 if (r->in.keyname) {
1956                         _mem_save_keyname_0 = NDR_PULL_GET_MEM_CTX(ndr);
1957                         NDR_PULL_SET_MEM_CTX(ndr, r->in.keyname, 0);
1958                         NDR_CHECK(ndr_pull_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.keyname));
1959                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_keyname_0, 0);
1960                 }
1961                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_filename));
1962                 if (_ptr_filename) {
1963                         NDR_PULL_ALLOC(ndr, r->in.filename);
1964                 } else {
1965                         r->in.filename = NULL;
1966                 }
1967                 if (r->in.filename) {
1968                         _mem_save_filename_0 = NDR_PULL_GET_MEM_CTX(ndr);
1969                         NDR_PULL_SET_MEM_CTX(ndr, r->in.filename, 0);
1970                         NDR_CHECK(ndr_pull_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.filename));
1971                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_filename_0, 0);
1972                 }
1973         }
1974         if (flags & NDR_OUT) {
1975                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
1976         }
1977         return NT_STATUS_OK;
1978 }
1979
1980 _PUBLIC_ void ndr_print_winreg_LoadKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_LoadKey *r)
1981 {
1982         ndr_print_struct(ndr, name, "winreg_LoadKey");
1983         ndr->depth++;
1984         if (flags & NDR_SET_VALUES) {
1985                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
1986         }
1987         if (flags & NDR_IN) {
1988                 ndr_print_struct(ndr, "in", "winreg_LoadKey");
1989                 ndr->depth++;
1990                 ndr_print_ptr(ndr, "handle", r->in.handle);
1991                 ndr->depth++;
1992                 ndr_print_policy_handle(ndr, "handle", r->in.handle);
1993                 ndr->depth--;
1994                 ndr_print_ptr(ndr, "keyname", r->in.keyname);
1995                 ndr->depth++;
1996                 if (r->in.keyname) {
1997                         ndr_print_winreg_String(ndr, "keyname", r->in.keyname);
1998                 }
1999                 ndr->depth--;
2000                 ndr_print_ptr(ndr, "filename", r->in.filename);
2001                 ndr->depth++;
2002                 if (r->in.filename) {
2003                         ndr_print_winreg_String(ndr, "filename", r->in.filename);
2004                 }
2005                 ndr->depth--;
2006                 ndr->depth--;
2007         }
2008         if (flags & NDR_OUT) {
2009                 ndr_print_struct(ndr, "out", "winreg_LoadKey");
2010                 ndr->depth++;
2011                 ndr_print_WERROR(ndr, "result", r->out.result);
2012                 ndr->depth--;
2013         }
2014         ndr->depth--;
2015 }
2016
2017 NTSTATUS ndr_push_winreg_NotifyChangeKeyValue(struct ndr_push *ndr, int flags, const struct winreg_NotifyChangeKeyValue *r)
2018 {
2019         if (flags & NDR_IN) {
2020                 if (r->in.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
2021                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
2022                 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->in.watch_subtree));
2023                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.notify_filter));
2024                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.unknown));
2025                 NDR_CHECK(ndr_push_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.string1));
2026                 NDR_CHECK(ndr_push_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.string2));
2027                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.unknown2));
2028         }
2029         if (flags & NDR_OUT) {
2030                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
2031         }
2032         return NT_STATUS_OK;
2033 }
2034
2035 NTSTATUS ndr_pull_winreg_NotifyChangeKeyValue(struct ndr_pull *ndr, int flags, struct winreg_NotifyChangeKeyValue *r)
2036 {
2037         TALLOC_CTX *_mem_save_handle_0;
2038         if (flags & NDR_IN) {
2039                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
2040                         NDR_PULL_ALLOC(ndr, r->in.handle);
2041                 }
2042                 _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
2043                 NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC);
2044                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
2045                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
2046                 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->in.watch_subtree));
2047                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.notify_filter));
2048                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.unknown));
2049                 NDR_CHECK(ndr_pull_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.string1));
2050                 NDR_CHECK(ndr_pull_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.string2));
2051                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.unknown2));
2052         }
2053         if (flags & NDR_OUT) {
2054                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
2055         }
2056         return NT_STATUS_OK;
2057 }
2058
2059 _PUBLIC_ void ndr_print_winreg_NotifyChangeKeyValue(struct ndr_print *ndr, const char *name, int flags, const struct winreg_NotifyChangeKeyValue *r)
2060 {
2061         ndr_print_struct(ndr, name, "winreg_NotifyChangeKeyValue");
2062         ndr->depth++;
2063         if (flags & NDR_SET_VALUES) {
2064                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
2065         }
2066         if (flags & NDR_IN) {
2067                 ndr_print_struct(ndr, "in", "winreg_NotifyChangeKeyValue");
2068                 ndr->depth++;
2069                 ndr_print_ptr(ndr, "handle", r->in.handle);
2070                 ndr->depth++;
2071                 ndr_print_policy_handle(ndr, "handle", r->in.handle);
2072                 ndr->depth--;
2073                 ndr_print_uint8(ndr, "watch_subtree", r->in.watch_subtree);
2074                 ndr_print_uint32(ndr, "notify_filter", r->in.notify_filter);
2075                 ndr_print_uint32(ndr, "unknown", r->in.unknown);
2076                 ndr_print_winreg_String(ndr, "string1", &r->in.string1);
2077                 ndr_print_winreg_String(ndr, "string2", &r->in.string2);
2078                 ndr_print_uint32(ndr, "unknown2", r->in.unknown2);
2079                 ndr->depth--;
2080         }
2081         if (flags & NDR_OUT) {
2082                 ndr_print_struct(ndr, "out", "winreg_NotifyChangeKeyValue");
2083                 ndr->depth++;
2084                 ndr_print_WERROR(ndr, "result", r->out.result);
2085                 ndr->depth--;
2086         }
2087         ndr->depth--;
2088 }
2089
2090 NTSTATUS ndr_push_winreg_OpenKey(struct ndr_push *ndr, int flags, const struct winreg_OpenKey *r)
2091 {
2092         if (flags & NDR_IN) {
2093                 if (r->in.parent_handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
2094                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.parent_handle));
2095                 NDR_CHECK(ndr_push_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.keyname));
2096                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.unknown));
2097                 NDR_CHECK(ndr_push_winreg_AccessMask(ndr, NDR_SCALARS, r->in.access_mask));
2098         }
2099         if (flags & NDR_OUT) {
2100                 if (r->out.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
2101                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle));
2102                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
2103         }
2104         return NT_STATUS_OK;
2105 }
2106
2107 NTSTATUS ndr_pull_winreg_OpenKey(struct ndr_pull *ndr, int flags, struct winreg_OpenKey *r)
2108 {
2109         TALLOC_CTX *_mem_save_parent_handle_0;
2110         TALLOC_CTX *_mem_save_handle_0;
2111         if (flags & NDR_IN) {
2112                 ZERO_STRUCT(r->out);
2113
2114                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
2115                         NDR_PULL_ALLOC(ndr, r->in.parent_handle);
2116                 }
2117                 _mem_save_parent_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
2118                 NDR_PULL_SET_MEM_CTX(ndr, r->in.parent_handle, LIBNDR_FLAG_REF_ALLOC);
2119                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.parent_handle));
2120                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_parent_handle_0, LIBNDR_FLAG_REF_ALLOC);
2121                 NDR_CHECK(ndr_pull_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.keyname));
2122                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.unknown));
2123                 NDR_CHECK(ndr_pull_winreg_AccessMask(ndr, NDR_SCALARS, &r->in.access_mask));
2124                 NDR_PULL_ALLOC(ndr, r->out.handle);
2125                 ZERO_STRUCTP(r->out.handle);
2126         }
2127         if (flags & NDR_OUT) {
2128                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
2129                         NDR_PULL_ALLOC(ndr, r->out.handle);
2130                 }
2131                 _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
2132                 NDR_PULL_SET_MEM_CTX(ndr, r->out.handle, LIBNDR_FLAG_REF_ALLOC);
2133                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle));
2134                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
2135                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
2136         }
2137         return NT_STATUS_OK;
2138 }
2139
2140 _PUBLIC_ void ndr_print_winreg_OpenKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenKey *r)
2141 {
2142         ndr_print_struct(ndr, name, "winreg_OpenKey");
2143         ndr->depth++;
2144         if (flags & NDR_SET_VALUES) {
2145                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
2146         }
2147         if (flags & NDR_IN) {
2148                 ndr_print_struct(ndr, "in", "winreg_OpenKey");
2149                 ndr->depth++;
2150                 ndr_print_ptr(ndr, "parent_handle", r->in.parent_handle);
2151                 ndr->depth++;
2152                 ndr_print_policy_handle(ndr, "parent_handle", r->in.parent_handle);
2153                 ndr->depth--;
2154                 ndr_print_winreg_String(ndr, "keyname", &r->in.keyname);
2155                 ndr_print_uint32(ndr, "unknown", r->in.unknown);
2156                 ndr_print_winreg_AccessMask(ndr, "access_mask", r->in.access_mask);
2157                 ndr->depth--;
2158         }
2159         if (flags & NDR_OUT) {
2160                 ndr_print_struct(ndr, "out", "winreg_OpenKey");
2161                 ndr->depth++;
2162                 ndr_print_ptr(ndr, "handle", r->out.handle);
2163                 ndr->depth++;
2164                 ndr_print_policy_handle(ndr, "handle", r->out.handle);
2165                 ndr->depth--;
2166                 ndr_print_WERROR(ndr, "result", r->out.result);
2167                 ndr->depth--;
2168         }
2169         ndr->depth--;
2170 }
2171
2172 NTSTATUS ndr_push_winreg_QueryInfoKey(struct ndr_push *ndr, int flags, const struct winreg_QueryInfoKey *r)
2173 {
2174         if (flags & NDR_IN) {
2175                 if (r->in.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
2176                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
2177                 if (r->in.classname == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
2178                 NDR_CHECK(ndr_push_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.classname));
2179         }
2180         if (flags & NDR_OUT) {
2181                 if (r->out.classname == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
2182                 NDR_CHECK(ndr_push_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.classname));
2183                 if (r->out.num_subkeys == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
2184                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.num_subkeys));
2185                 if (r->out.max_subkeylen == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
2186                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.max_subkeylen));
2187                 if (r->out.max_classlen == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
2188                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.max_classlen));
2189                 if (r->out.num_values == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
2190                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.num_values));
2191                 if (r->out.max_valnamelen == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
2192                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.max_valnamelen));
2193                 if (r->out.max_valbufsize == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
2194                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.max_valbufsize));
2195                 if (r->out.secdescsize == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
2196                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.secdescsize));
2197                 if (r->out.last_changed_time == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
2198                 NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, *r->out.last_changed_time));
2199                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
2200         }
2201         return NT_STATUS_OK;
2202 }
2203
2204 NTSTATUS ndr_pull_winreg_QueryInfoKey(struct ndr_pull *ndr, int flags, struct winreg_QueryInfoKey *r)
2205 {
2206         TALLOC_CTX *_mem_save_handle_0;
2207         TALLOC_CTX *_mem_save_classname_0;
2208         TALLOC_CTX *_mem_save_num_subkeys_0;
2209         TALLOC_CTX *_mem_save_max_subkeylen_0;
2210         TALLOC_CTX *_mem_save_max_classlen_0;
2211         TALLOC_CTX *_mem_save_num_values_0;
2212         TALLOC_CTX *_mem_save_max_valnamelen_0;
2213         TALLOC_CTX *_mem_save_max_valbufsize_0;
2214         TALLOC_CTX *_mem_save_secdescsize_0;
2215         TALLOC_CTX *_mem_save_last_changed_time_0;
2216         if (flags & NDR_IN) {
2217                 ZERO_STRUCT(r->out);
2218
2219                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
2220                         NDR_PULL_ALLOC(ndr, r->in.handle);
2221                 }
2222                 _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
2223                 NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC);
2224                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
2225                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
2226                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
2227                         NDR_PULL_ALLOC(ndr, r->in.classname);
2228                 }
2229                 _mem_save_classname_0 = NDR_PULL_GET_MEM_CTX(ndr);
2230                 NDR_PULL_SET_MEM_CTX(ndr, r->in.classname, LIBNDR_FLAG_REF_ALLOC);
2231                 NDR_CHECK(ndr_pull_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.classname));
2232                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_classname_0, LIBNDR_FLAG_REF_ALLOC);
2233                 NDR_PULL_ALLOC(ndr, r->out.classname);
2234                 *r->out.classname = *r->in.classname;
2235                 NDR_PULL_ALLOC(ndr, r->out.num_subkeys);
2236                 ZERO_STRUCTP(r->out.num_subkeys);
2237                 NDR_PULL_ALLOC(ndr, r->out.max_subkeylen);
2238                 ZERO_STRUCTP(r->out.max_subkeylen);
2239                 NDR_PULL_ALLOC(ndr, r->out.max_classlen);
2240                 ZERO_STRUCTP(r->out.max_classlen);
2241                 NDR_PULL_ALLOC(ndr, r->out.num_values);
2242                 ZERO_STRUCTP(r->out.num_values);
2243                 NDR_PULL_ALLOC(ndr, r->out.max_valnamelen);
2244                 ZERO_STRUCTP(r->out.max_valnamelen);
2245                 NDR_PULL_ALLOC(ndr, r->out.max_valbufsize);
2246                 ZERO_STRUCTP(r->out.max_valbufsize);
2247                 NDR_PULL_ALLOC(ndr, r->out.secdescsize);
2248                 ZERO_STRUCTP(r->out.secdescsize);
2249                 NDR_PULL_ALLOC(ndr, r->out.last_changed_time);
2250                 ZERO_STRUCTP(r->out.last_changed_time);
2251         }
2252         if (flags & NDR_OUT) {
2253                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
2254                         NDR_PULL_ALLOC(ndr, r->out.classname);
2255                 }
2256                 _mem_save_classname_0 = NDR_PULL_GET_MEM_CTX(ndr);
2257                 NDR_PULL_SET_MEM_CTX(ndr, r->out.classname, LIBNDR_FLAG_REF_ALLOC);
2258                 NDR_CHECK(ndr_pull_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.classname));
2259                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_classname_0, LIBNDR_FLAG_REF_ALLOC);
2260                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
2261                         NDR_PULL_ALLOC(ndr, r->out.num_subkeys);
2262                 }
2263                 _mem_save_num_subkeys_0 = NDR_PULL_GET_MEM_CTX(ndr);
2264                 NDR_PULL_SET_MEM_CTX(ndr, r->out.num_subkeys, LIBNDR_FLAG_REF_ALLOC);
2265                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.num_subkeys));
2266                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_num_subkeys_0, LIBNDR_FLAG_REF_ALLOC);
2267                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
2268                         NDR_PULL_ALLOC(ndr, r->out.max_subkeylen);
2269                 }
2270                 _mem_save_max_subkeylen_0 = NDR_PULL_GET_MEM_CTX(ndr);
2271                 NDR_PULL_SET_MEM_CTX(ndr, r->out.max_subkeylen, LIBNDR_FLAG_REF_ALLOC);
2272                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.max_subkeylen));
2273                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_max_subkeylen_0, LIBNDR_FLAG_REF_ALLOC);
2274                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
2275                         NDR_PULL_ALLOC(ndr, r->out.max_classlen);
2276                 }
2277                 _mem_save_max_classlen_0 = NDR_PULL_GET_MEM_CTX(ndr);
2278                 NDR_PULL_SET_MEM_CTX(ndr, r->out.max_classlen, LIBNDR_FLAG_REF_ALLOC);
2279                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.max_classlen));
2280                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_max_classlen_0, LIBNDR_FLAG_REF_ALLOC);
2281                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
2282                         NDR_PULL_ALLOC(ndr, r->out.num_values);
2283                 }
2284                 _mem_save_num_values_0 = NDR_PULL_GET_MEM_CTX(ndr);
2285                 NDR_PULL_SET_MEM_CTX(ndr, r->out.num_values, LIBNDR_FLAG_REF_ALLOC);
2286                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.num_values));
2287                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_num_values_0, LIBNDR_FLAG_REF_ALLOC);
2288                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
2289                         NDR_PULL_ALLOC(ndr, r->out.max_valnamelen);
2290                 }
2291                 _mem_save_max_valnamelen_0 = NDR_PULL_GET_MEM_CTX(ndr);
2292                 NDR_PULL_SET_MEM_CTX(ndr, r->out.max_valnamelen, LIBNDR_FLAG_REF_ALLOC);
2293                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.max_valnamelen));
2294                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_max_valnamelen_0, LIBNDR_FLAG_REF_ALLOC);
2295                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
2296                         NDR_PULL_ALLOC(ndr, r->out.max_valbufsize);
2297                 }
2298                 _mem_save_max_valbufsize_0 = NDR_PULL_GET_MEM_CTX(ndr);
2299                 NDR_PULL_SET_MEM_CTX(ndr, r->out.max_valbufsize, LIBNDR_FLAG_REF_ALLOC);
2300                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.max_valbufsize));
2301                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_max_valbufsize_0, LIBNDR_FLAG_REF_ALLOC);
2302                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
2303                         NDR_PULL_ALLOC(ndr, r->out.secdescsize);
2304                 }
2305                 _mem_save_secdescsize_0 = NDR_PULL_GET_MEM_CTX(ndr);
2306                 NDR_PULL_SET_MEM_CTX(ndr, r->out.secdescsize, LIBNDR_FLAG_REF_ALLOC);
2307                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.secdescsize));
2308                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_secdescsize_0, LIBNDR_FLAG_REF_ALLOC);
2309                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
2310                         NDR_PULL_ALLOC(ndr, r->out.last_changed_time);
2311                 }
2312                 _mem_save_last_changed_time_0 = NDR_PULL_GET_MEM_CTX(ndr);
2313                 NDR_PULL_SET_MEM_CTX(ndr, r->out.last_changed_time, LIBNDR_FLAG_REF_ALLOC);
2314                 NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, r->out.last_changed_time));
2315                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_last_changed_time_0, LIBNDR_FLAG_REF_ALLOC);
2316                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
2317         }
2318         return NT_STATUS_OK;
2319 }
2320
2321 _PUBLIC_ void ndr_print_winreg_QueryInfoKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_QueryInfoKey *r)
2322 {
2323         ndr_print_struct(ndr, name, "winreg_QueryInfoKey");
2324         ndr->depth++;
2325         if (flags & NDR_SET_VALUES) {
2326                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
2327         }
2328         if (flags & NDR_IN) {
2329                 ndr_print_struct(ndr, "in", "winreg_QueryInfoKey");
2330                 ndr->depth++;
2331                 ndr_print_ptr(ndr, "handle", r->in.handle);
2332                 ndr->depth++;
2333                 ndr_print_policy_handle(ndr, "handle", r->in.handle);
2334                 ndr->depth--;
2335                 ndr_print_ptr(ndr, "classname", r->in.classname);
2336                 ndr->depth++;
2337                 ndr_print_winreg_String(ndr, "classname", r->in.classname);
2338                 ndr->depth--;
2339                 ndr->depth--;
2340         }
2341         if (flags & NDR_OUT) {
2342                 ndr_print_struct(ndr, "out", "winreg_QueryInfoKey");
2343                 ndr->depth++;
2344                 ndr_print_ptr(ndr, "classname", r->out.classname);
2345                 ndr->depth++;
2346                 ndr_print_winreg_String(ndr, "classname", r->out.classname);
2347                 ndr->depth--;
2348                 ndr_print_ptr(ndr, "num_subkeys", r->out.num_subkeys);
2349                 ndr->depth++;
2350                 ndr_print_uint32(ndr, "num_subkeys", *r->out.num_subkeys);
2351                 ndr->depth--;
2352                 ndr_print_ptr(ndr, "max_subkeylen", r->out.max_subkeylen);
2353                 ndr->depth++;
2354                 ndr_print_uint32(ndr, "max_subkeylen", *r->out.max_subkeylen);
2355                 ndr->depth--;
2356                 ndr_print_ptr(ndr, "max_classlen", r->out.max_classlen);
2357                 ndr->depth++;
2358                 ndr_print_uint32(ndr, "max_classlen", *r->out.max_classlen);
2359                 ndr->depth--;
2360                 ndr_print_ptr(ndr, "num_values", r->out.num_values);
2361                 ndr->depth++;
2362                 ndr_print_uint32(ndr, "num_values", *r->out.num_values);
2363                 ndr->depth--;
2364                 ndr_print_ptr(ndr, "max_valnamelen", r->out.max_valnamelen);
2365                 ndr->depth++;
2366                 ndr_print_uint32(ndr, "max_valnamelen", *r->out.max_valnamelen);
2367                 ndr->depth--;
2368                 ndr_print_ptr(ndr, "max_valbufsize", r->out.max_valbufsize);
2369                 ndr->depth++;
2370                 ndr_print_uint32(ndr, "max_valbufsize", *r->out.max_valbufsize);
2371                 ndr->depth--;
2372                 ndr_print_ptr(ndr, "secdescsize", r->out.secdescsize);
2373                 ndr->depth++;
2374                 ndr_print_uint32(ndr, "secdescsize", *r->out.secdescsize);
2375                 ndr->depth--;
2376                 ndr_print_ptr(ndr, "last_changed_time", r->out.last_changed_time);
2377                 ndr->depth++;
2378                 ndr_print_NTTIME(ndr, "last_changed_time", *r->out.last_changed_time);
2379                 ndr->depth--;
2380                 ndr_print_WERROR(ndr, "result", r->out.result);
2381                 ndr->depth--;
2382         }
2383         ndr->depth--;
2384 }
2385
2386 NTSTATUS ndr_push_winreg_QueryValue(struct ndr_push *ndr, int flags, const struct winreg_QueryValue *r)
2387 {
2388         if (flags & NDR_IN) {
2389                 if (r->in.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
2390                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
2391                 NDR_CHECK(ndr_push_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.value_name));
2392                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.type));
2393                 if (r->in.type) {
2394                         NDR_CHECK(ndr_push_winreg_Type(ndr, NDR_SCALARS, *r->in.type));
2395                 }
2396                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.data));
2397                 if (r->in.data) {
2398                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.data_size));
2399                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
2400                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.value_length));
2401                         NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->in.data, *r->in.value_length));
2402                 }
2403                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.data_size));
2404                 if (r->in.data_size) {
2405                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.data_size));
2406                 }
2407                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.value_length));
2408                 if (r->in.value_length) {
2409                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.value_length));
2410                 }
2411         }
2412         if (flags & NDR_OUT) {
2413                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.type));
2414                 if (r->out.type) {
2415                         NDR_CHECK(ndr_push_winreg_Type(ndr, NDR_SCALARS, *r->out.type));
2416                 }
2417                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.data));
2418                 if (r->out.data) {
2419                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.data_size));
2420                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
2421                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.value_length));
2422                         NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->out.data, *r->out.value_length));
2423                 }
2424                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.data_size));
2425                 if (r->out.data_size) {
2426                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.data_size));
2427                 }
2428                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.value_length));
2429                 if (r->out.value_length) {
2430                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.value_length));
2431                 }
2432                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
2433         }
2434         return NT_STATUS_OK;
2435 }
2436
2437 NTSTATUS ndr_pull_winreg_QueryValue(struct ndr_pull *ndr, int flags, struct winreg_QueryValue *r)
2438 {
2439         uint32_t _ptr_type;
2440         uint32_t _ptr_data;
2441         uint32_t _ptr_data_size;
2442         uint32_t _ptr_value_length;
2443         TALLOC_CTX *_mem_save_handle_0;
2444         TALLOC_CTX *_mem_save_type_0;
2445         TALLOC_CTX *_mem_save_data_0;
2446         TALLOC_CTX *_mem_save_data_size_0;
2447         TALLOC_CTX *_mem_save_value_length_0;
2448         if (flags & NDR_IN) {
2449                 ZERO_STRUCT(r->out);
2450
2451                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
2452                         NDR_PULL_ALLOC(ndr, r->in.handle);
2453                 }
2454                 _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
2455                 NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC);
2456                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
2457                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
2458                 NDR_CHECK(ndr_pull_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.value_name));
2459                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_type));
2460                 if (_ptr_type) {
2461                         NDR_PULL_ALLOC(ndr, r->in.type);
2462                 } else {
2463                         r->in.type = NULL;
2464                 }
2465                 if (r->in.type) {
2466                         _mem_save_type_0 = NDR_PULL_GET_MEM_CTX(ndr);
2467                         NDR_PULL_SET_MEM_CTX(ndr, r->in.type, 0);
2468                         NDR_CHECK(ndr_pull_winreg_Type(ndr, NDR_SCALARS, r->in.type));
2469                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_type_0, 0);
2470                 }
2471                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_data));
2472                 if (_ptr_data) {
2473                         NDR_PULL_ALLOC(ndr, r->in.data);
2474                 } else {
2475                         r->in.data = NULL;
2476                 }
2477                 if (r->in.data) {
2478                         _mem_save_data_0 = NDR_PULL_GET_MEM_CTX(ndr);
2479                         NDR_PULL_SET_MEM_CTX(ndr, r->in.data, 0);
2480                         NDR_CHECK(ndr_pull_array_size(ndr, &r->in.data));
2481                         NDR_CHECK(ndr_pull_array_length(ndr, &r->in.data));
2482                         if (ndr_get_array_length(ndr, &r->in.data) > ndr_get_array_size(ndr, &r->in.data)) {
2483                                 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.data), ndr_get_array_length(ndr, &r->in.data));
2484                         }
2485                         NDR_PULL_ALLOC_N(ndr, r->in.data, ndr_get_array_size(ndr, &r->in.data));
2486                         NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->in.data, ndr_get_array_length(ndr, &r->in.data)));
2487                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_0, 0);
2488                 }
2489                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_data_size));
2490                 if (_ptr_data_size) {
2491                         NDR_PULL_ALLOC(ndr, r->in.data_size);
2492                 } else {
2493                         r->in.data_size = NULL;
2494                 }
2495                 if (r->in.data_size) {
2496                         _mem_save_data_size_0 = NDR_PULL_GET_MEM_CTX(ndr);
2497                         NDR_PULL_SET_MEM_CTX(ndr, r->in.data_size, 0);
2498                         NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.data_size));
2499                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_size_0, 0);
2500                 }
2501                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_value_length));
2502                 if (_ptr_value_length) {
2503                         NDR_PULL_ALLOC(ndr, r->in.value_length);
2504                 } else {
2505                         r->in.value_length = NULL;
2506                 }
2507                 if (r->in.value_length) {
2508                         _mem_save_value_length_0 = NDR_PULL_GET_MEM_CTX(ndr);
2509                         NDR_PULL_SET_MEM_CTX(ndr, r->in.value_length, 0);
2510                         NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.value_length));
2511                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_value_length_0, 0);
2512                 }
2513                 if (r->in.data) {
2514                         if (r->in.data_size == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
2515                         NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->in.data, *r->in.data_size));
2516                 }
2517                 if (r->in.data) {
2518                         if (r->in.value_length == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
2519                         NDR_CHECK(ndr_check_array_length(ndr, (void*)&r->in.data, *r->in.value_length));
2520                 }
2521         }
2522         if (flags & NDR_OUT) {
2523                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_type));
2524                 if (_ptr_type) {
2525                         NDR_PULL_ALLOC(ndr, r->out.type);
2526                 } else {
2527                         r->out.type = NULL;
2528                 }
2529                 if (r->out.type) {
2530                         _mem_save_type_0 = NDR_PULL_GET_MEM_CTX(ndr);
2531                         NDR_PULL_SET_MEM_CTX(ndr, r->out.type, 0);
2532                         NDR_CHECK(ndr_pull_winreg_Type(ndr, NDR_SCALARS, r->out.type));
2533                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_type_0, 0);
2534                 }
2535                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_data));
2536                 if (_ptr_data) {
2537                         NDR_PULL_ALLOC(ndr, r->out.data);
2538                 } else {
2539                         r->out.data = NULL;
2540                 }
2541                 if (r->out.data) {
2542                         _mem_save_data_0 = NDR_PULL_GET_MEM_CTX(ndr);
2543                         NDR_PULL_SET_MEM_CTX(ndr, r->out.data, 0);
2544                         NDR_CHECK(ndr_pull_array_size(ndr, &r->out.data));
2545                         NDR_CHECK(ndr_pull_array_length(ndr, &r->out.data));
2546                         if (ndr_get_array_length(ndr, &r->out.data) > ndr_get_array_size(ndr, &r->out.data)) {
2547                                 return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->out.data), ndr_get_array_length(ndr, &r->out.data));
2548                         }
2549                         NDR_PULL_ALLOC_N(ndr, r->out.data, ndr_get_array_size(ndr, &r->out.data));
2550                         NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->out.data, ndr_get_array_length(ndr, &r->out.data)));
2551                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_0, 0);
2552                 }
2553                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_data_size));
2554                 if (_ptr_data_size) {
2555                         NDR_PULL_ALLOC(ndr, r->out.data_size);
2556                 } else {
2557                         r->out.data_size = NULL;
2558                 }
2559                 if (r->out.data_size) {
2560                         _mem_save_data_size_0 = NDR_PULL_GET_MEM_CTX(ndr);
2561                         NDR_PULL_SET_MEM_CTX(ndr, r->out.data_size, 0);
2562                         NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.data_size));
2563                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_size_0, 0);
2564                 }
2565                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_value_length));
2566                 if (_ptr_value_length) {
2567                         NDR_PULL_ALLOC(ndr, r->out.value_length);
2568                 } else {
2569                         r->out.value_length = NULL;
2570                 }
2571                 if (r->out.value_length) {
2572                         _mem_save_value_length_0 = NDR_PULL_GET_MEM_CTX(ndr);
2573                         NDR_PULL_SET_MEM_CTX(ndr, r->out.value_length, 0);
2574                         NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.value_length));
2575                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_value_length_0, 0);
2576                 }
2577                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
2578                 if (r->out.data) {
2579                         if (r->out.data_size == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
2580                         NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->out.data, *r->out.data_size));
2581                 }
2582                 if (r->out.data) {
2583                         if (r->out.value_length == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
2584                         NDR_CHECK(ndr_check_array_length(ndr, (void*)&r->out.data, *r->out.value_length));
2585                 }
2586         }
2587         return NT_STATUS_OK;
2588 }
2589
2590 _PUBLIC_ void ndr_print_winreg_QueryValue(struct ndr_print *ndr, const char *name, int flags, const struct winreg_QueryValue *r)
2591 {
2592         ndr_print_struct(ndr, name, "winreg_QueryValue");
2593         ndr->depth++;
2594         if (flags & NDR_SET_VALUES) {
2595                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
2596         }
2597         if (flags & NDR_IN) {
2598                 ndr_print_struct(ndr, "in", "winreg_QueryValue");
2599                 ndr->depth++;
2600                 ndr_print_ptr(ndr, "handle", r->in.handle);
2601                 ndr->depth++;
2602                 ndr_print_policy_handle(ndr, "handle", r->in.handle);
2603                 ndr->depth--;
2604                 ndr_print_winreg_String(ndr, "value_name", &r->in.value_name);
2605                 ndr_print_ptr(ndr, "type", r->in.type);
2606                 ndr->depth++;
2607                 if (r->in.type) {
2608                         ndr_print_winreg_Type(ndr, "type", *r->in.type);
2609                 }
2610                 ndr->depth--;
2611                 ndr_print_ptr(ndr, "data", r->in.data);
2612                 ndr->depth++;
2613                 if (r->in.data) {
2614                         if (r->in.value_length == NULL) return;
2615                         ndr_print_array_uint8(ndr, "data", r->in.data, *r->in.value_length);
2616                 }
2617                 ndr->depth--;
2618                 ndr_print_ptr(ndr, "data_size", r->in.data_size);
2619                 ndr->depth++;
2620                 if (r->in.data_size) {
2621                         ndr_print_uint32(ndr, "data_size", *r->in.data_size);
2622                 }
2623                 ndr->depth--;
2624                 ndr_print_ptr(ndr, "value_length", r->in.value_length);
2625                 ndr->depth++;
2626                 if (r->in.value_length) {
2627                         ndr_print_uint32(ndr, "value_length", *r->in.value_length);
2628                 }
2629                 ndr->depth--;
2630                 ndr->depth--;
2631         }
2632         if (flags & NDR_OUT) {
2633                 ndr_print_struct(ndr, "out", "winreg_QueryValue");
2634                 ndr->depth++;
2635                 ndr_print_ptr(ndr, "type", r->out.type);
2636                 ndr->depth++;
2637                 if (r->out.type) {
2638                         ndr_print_winreg_Type(ndr, "type", *r->out.type);
2639                 }
2640                 ndr->depth--;
2641                 ndr_print_ptr(ndr, "data", r->out.data);
2642                 ndr->depth++;
2643                 if (r->out.data) {
2644                         if (r->out.value_length == NULL) return;
2645                         ndr_print_array_uint8(ndr, "data", r->out.data, *r->out.value_length);
2646                 }
2647                 ndr->depth--;
2648                 ndr_print_ptr(ndr, "data_size", r->out.data_size);
2649                 ndr->depth++;
2650                 if (r->out.data_size) {
2651                         ndr_print_uint32(ndr, "data_size", *r->out.data_size);
2652                 }
2653                 ndr->depth--;
2654                 ndr_print_ptr(ndr, "value_length", r->out.value_length);
2655                 ndr->depth++;
2656                 if (r->out.value_length) {
2657                         ndr_print_uint32(ndr, "value_length", *r->out.value_length);
2658                 }
2659                 ndr->depth--;
2660                 ndr_print_WERROR(ndr, "result", r->out.result);
2661                 ndr->depth--;
2662         }
2663         ndr->depth--;
2664 }
2665
2666 NTSTATUS ndr_push_winreg_ReplaceKey(struct ndr_push *ndr, int flags, const struct winreg_ReplaceKey *r)
2667 {
2668         if (flags & NDR_IN) {
2669         }
2670         if (flags & NDR_OUT) {
2671                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
2672         }
2673         return NT_STATUS_OK;
2674 }
2675
2676 NTSTATUS ndr_pull_winreg_ReplaceKey(struct ndr_pull *ndr, int flags, struct winreg_ReplaceKey *r)
2677 {
2678         if (flags & NDR_IN) {
2679         }
2680         if (flags & NDR_OUT) {
2681                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
2682         }
2683         return NT_STATUS_OK;
2684 }
2685
2686 _PUBLIC_ void ndr_print_winreg_ReplaceKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_ReplaceKey *r)
2687 {
2688         ndr_print_struct(ndr, name, "winreg_ReplaceKey");
2689         ndr->depth++;
2690         if (flags & NDR_SET_VALUES) {
2691                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
2692         }
2693         if (flags & NDR_IN) {
2694                 ndr_print_struct(ndr, "in", "winreg_ReplaceKey");
2695                 ndr->depth++;
2696                 ndr->depth--;
2697         }
2698         if (flags & NDR_OUT) {
2699                 ndr_print_struct(ndr, "out", "winreg_ReplaceKey");
2700                 ndr->depth++;
2701                 ndr_print_WERROR(ndr, "result", r->out.result);
2702                 ndr->depth--;
2703         }
2704         ndr->depth--;
2705 }
2706
2707 NTSTATUS ndr_push_winreg_RestoreKey(struct ndr_push *ndr, int flags, const struct winreg_RestoreKey *r)
2708 {
2709         if (flags & NDR_IN) {
2710                 if (r->in.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
2711                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
2712                 if (r->in.filename == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
2713                 NDR_CHECK(ndr_push_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.filename));
2714                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.flags));
2715         }
2716         if (flags & NDR_OUT) {
2717                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
2718         }
2719         return NT_STATUS_OK;
2720 }
2721
2722 NTSTATUS ndr_pull_winreg_RestoreKey(struct ndr_pull *ndr, int flags, struct winreg_RestoreKey *r)
2723 {
2724         TALLOC_CTX *_mem_save_handle_0;
2725         TALLOC_CTX *_mem_save_filename_0;
2726         if (flags & NDR_IN) {
2727                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
2728                         NDR_PULL_ALLOC(ndr, r->in.handle);
2729                 }
2730                 _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
2731                 NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC);
2732                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
2733                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
2734                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
2735                         NDR_PULL_ALLOC(ndr, r->in.filename);
2736                 }
2737                 _mem_save_filename_0 = NDR_PULL_GET_MEM_CTX(ndr);
2738                 NDR_PULL_SET_MEM_CTX(ndr, r->in.filename, LIBNDR_FLAG_REF_ALLOC);
2739                 NDR_CHECK(ndr_pull_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.filename));
2740                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_filename_0, LIBNDR_FLAG_REF_ALLOC);
2741                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.flags));
2742         }
2743         if (flags & NDR_OUT) {
2744                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
2745         }
2746         return NT_STATUS_OK;
2747 }
2748
2749 _PUBLIC_ void ndr_print_winreg_RestoreKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_RestoreKey *r)
2750 {
2751         ndr_print_struct(ndr, name, "winreg_RestoreKey");
2752         ndr->depth++;
2753         if (flags & NDR_SET_VALUES) {
2754                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
2755         }
2756         if (flags & NDR_IN) {
2757                 ndr_print_struct(ndr, "in", "winreg_RestoreKey");
2758                 ndr->depth++;
2759                 ndr_print_ptr(ndr, "handle", r->in.handle);
2760                 ndr->depth++;
2761                 ndr_print_policy_handle(ndr, "handle", r->in.handle);
2762                 ndr->depth--;
2763                 ndr_print_ptr(ndr, "filename", r->in.filename);
2764                 ndr->depth++;
2765                 ndr_print_winreg_String(ndr, "filename", r->in.filename);
2766                 ndr->depth--;
2767                 ndr_print_uint32(ndr, "flags", r->in.flags);
2768                 ndr->depth--;
2769         }
2770         if (flags & NDR_OUT) {
2771                 ndr_print_struct(ndr, "out", "winreg_RestoreKey");
2772                 ndr->depth++;
2773                 ndr_print_WERROR(ndr, "result", r->out.result);
2774                 ndr->depth--;
2775         }
2776         ndr->depth--;
2777 }
2778
2779 NTSTATUS ndr_push_winreg_SaveKey(struct ndr_push *ndr, int flags, const struct winreg_SaveKey *r)
2780 {
2781         if (flags & NDR_IN) {
2782                 if (r->in.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
2783                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
2784                 if (r->in.filename == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
2785                 NDR_CHECK(ndr_push_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.filename));
2786                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.sec_attrib));
2787                 if (r->in.sec_attrib) {
2788                         NDR_CHECK(ndr_push_KeySecurityAttribute(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sec_attrib));
2789                 }
2790         }
2791         if (flags & NDR_OUT) {
2792                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
2793         }
2794         return NT_STATUS_OK;
2795 }
2796
2797 NTSTATUS ndr_pull_winreg_SaveKey(struct ndr_pull *ndr, int flags, struct winreg_SaveKey *r)
2798 {
2799         uint32_t _ptr_sec_attrib;
2800         TALLOC_CTX *_mem_save_handle_0;
2801         TALLOC_CTX *_mem_save_filename_0;
2802         TALLOC_CTX *_mem_save_sec_attrib_0;
2803         if (flags & NDR_IN) {
2804                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
2805                         NDR_PULL_ALLOC(ndr, r->in.handle);
2806                 }
2807                 _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
2808                 NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC);
2809                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
2810                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
2811                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
2812                         NDR_PULL_ALLOC(ndr, r->in.filename);
2813                 }
2814                 _mem_save_filename_0 = NDR_PULL_GET_MEM_CTX(ndr);
2815                 NDR_PULL_SET_MEM_CTX(ndr, r->in.filename, LIBNDR_FLAG_REF_ALLOC);
2816                 NDR_CHECK(ndr_pull_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.filename));
2817                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_filename_0, LIBNDR_FLAG_REF_ALLOC);
2818                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sec_attrib));
2819                 if (_ptr_sec_attrib) {
2820                         NDR_PULL_ALLOC(ndr, r->in.sec_attrib);
2821                 } else {
2822                         r->in.sec_attrib = NULL;
2823                 }
2824                 if (r->in.sec_attrib) {
2825                         _mem_save_sec_attrib_0 = NDR_PULL_GET_MEM_CTX(ndr);
2826                         NDR_PULL_SET_MEM_CTX(ndr, r->in.sec_attrib, 0);
2827                         NDR_CHECK(ndr_pull_KeySecurityAttribute(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sec_attrib));
2828                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sec_attrib_0, 0);
2829                 }
2830         }
2831         if (flags & NDR_OUT) {
2832                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
2833         }
2834         return NT_STATUS_OK;
2835 }
2836
2837 _PUBLIC_ void ndr_print_winreg_SaveKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_SaveKey *r)
2838 {
2839         ndr_print_struct(ndr, name, "winreg_SaveKey");
2840         ndr->depth++;
2841         if (flags & NDR_SET_VALUES) {
2842                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
2843         }
2844         if (flags & NDR_IN) {
2845                 ndr_print_struct(ndr, "in", "winreg_SaveKey");
2846                 ndr->depth++;
2847                 ndr_print_ptr(ndr, "handle", r->in.handle);
2848                 ndr->depth++;
2849                 ndr_print_policy_handle(ndr, "handle", r->in.handle);
2850                 ndr->depth--;
2851                 ndr_print_ptr(ndr, "filename", r->in.filename);
2852                 ndr->depth++;
2853                 ndr_print_winreg_String(ndr, "filename", r->in.filename);
2854                 ndr->depth--;
2855                 ndr_print_ptr(ndr, "sec_attrib", r->in.sec_attrib);
2856                 ndr->depth++;
2857                 if (r->in.sec_attrib) {
2858                         ndr_print_KeySecurityAttribute(ndr, "sec_attrib", r->in.sec_attrib);
2859                 }
2860                 ndr->depth--;
2861                 ndr->depth--;
2862         }
2863         if (flags & NDR_OUT) {
2864                 ndr_print_struct(ndr, "out", "winreg_SaveKey");
2865                 ndr->depth++;
2866                 ndr_print_WERROR(ndr, "result", r->out.result);
2867                 ndr->depth--;
2868         }
2869         ndr->depth--;
2870 }
2871
2872 NTSTATUS ndr_push_winreg_SetKeySecurity(struct ndr_push *ndr, int flags, const struct winreg_SetKeySecurity *r)
2873 {
2874         if (flags & NDR_IN) {
2875                 if (r->in.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
2876                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
2877                 NDR_CHECK(ndr_push_winreg_AccessMask(ndr, NDR_SCALARS, r->in.access_mask));
2878                 if (r->in.sd == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
2879                 NDR_CHECK(ndr_push_KeySecurityData(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sd));
2880         }
2881         if (flags & NDR_OUT) {
2882                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
2883         }
2884         return NT_STATUS_OK;
2885 }
2886
2887 NTSTATUS ndr_pull_winreg_SetKeySecurity(struct ndr_pull *ndr, int flags, struct winreg_SetKeySecurity *r)
2888 {
2889         TALLOC_CTX *_mem_save_handle_0;
2890         TALLOC_CTX *_mem_save_sd_0;
2891         if (flags & NDR_IN) {
2892                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
2893                         NDR_PULL_ALLOC(ndr, r->in.handle);
2894                 }
2895                 _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
2896                 NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC);
2897                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
2898                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
2899                 NDR_CHECK(ndr_pull_winreg_AccessMask(ndr, NDR_SCALARS, &r->in.access_mask));
2900                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
2901                         NDR_PULL_ALLOC(ndr, r->in.sd);
2902                 }
2903                 _mem_save_sd_0 = NDR_PULL_GET_MEM_CTX(ndr);
2904                 NDR_PULL_SET_MEM_CTX(ndr, r->in.sd, LIBNDR_FLAG_REF_ALLOC);
2905                 NDR_CHECK(ndr_pull_KeySecurityData(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sd));
2906                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sd_0, LIBNDR_FLAG_REF_ALLOC);
2907         }
2908         if (flags & NDR_OUT) {
2909                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
2910         }
2911         return NT_STATUS_OK;
2912 }
2913
2914 _PUBLIC_ void ndr_print_winreg_SetKeySecurity(struct ndr_print *ndr, const char *name, int flags, const struct winreg_SetKeySecurity *r)
2915 {
2916         ndr_print_struct(ndr, name, "winreg_SetKeySecurity");
2917         ndr->depth++;
2918         if (flags & NDR_SET_VALUES) {
2919                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
2920         }
2921         if (flags & NDR_IN) {
2922                 ndr_print_struct(ndr, "in", "winreg_SetKeySecurity");
2923                 ndr->depth++;
2924                 ndr_print_ptr(ndr, "handle", r->in.handle);
2925                 ndr->depth++;
2926                 ndr_print_policy_handle(ndr, "handle", r->in.handle);
2927                 ndr->depth--;
2928                 ndr_print_winreg_AccessMask(ndr, "access_mask", r->in.access_mask);
2929                 ndr_print_ptr(ndr, "sd", r->in.sd);
2930                 ndr->depth++;
2931                 ndr_print_KeySecurityData(ndr, "sd", r->in.sd);
2932                 ndr->depth--;
2933                 ndr->depth--;
2934         }
2935         if (flags & NDR_OUT) {
2936                 ndr_print_struct(ndr, "out", "winreg_SetKeySecurity");
2937                 ndr->depth++;
2938                 ndr_print_WERROR(ndr, "result", r->out.result);
2939                 ndr->depth--;
2940         }
2941         ndr->depth--;
2942 }
2943
2944 NTSTATUS ndr_push_winreg_SetValue(struct ndr_push *ndr, int flags, const struct winreg_SetValue *r)
2945 {
2946         if (flags & NDR_IN) {
2947                 if (r->in.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
2948                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
2949                 NDR_CHECK(ndr_push_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.name));
2950                 NDR_CHECK(ndr_push_winreg_Type(ndr, NDR_SCALARS, r->in.type));
2951                 if (r->in.data == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
2952                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.size));
2953                 NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->in.data, r->in.size));
2954                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.size));
2955         }
2956         if (flags & NDR_OUT) {
2957                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
2958         }
2959         return NT_STATUS_OK;
2960 }
2961
2962 NTSTATUS ndr_pull_winreg_SetValue(struct ndr_pull *ndr, int flags, struct winreg_SetValue *r)
2963 {
2964         TALLOC_CTX *_mem_save_handle_0;
2965         if (flags & NDR_IN) {
2966                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
2967                         NDR_PULL_ALLOC(ndr, r->in.handle);
2968                 }
2969                 _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
2970                 NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC);
2971                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
2972                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
2973                 NDR_CHECK(ndr_pull_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.name));
2974                 NDR_CHECK(ndr_pull_winreg_Type(ndr, NDR_SCALARS, &r->in.type));
2975                 NDR_CHECK(ndr_pull_array_size(ndr, &r->in.data));
2976                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
2977                         NDR_PULL_ALLOC_N(ndr, r->in.data, ndr_get_array_size(ndr, &r->in.data));
2978                 }
2979                 NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->in.data, ndr_get_array_size(ndr, &r->in.data)));
2980                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.size));
2981                 if (r->in.data) {
2982                         NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->in.data, r->in.size));
2983                 }
2984         }
2985         if (flags & NDR_OUT) {
2986                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
2987         }
2988         return NT_STATUS_OK;
2989 }
2990
2991 _PUBLIC_ void ndr_print_winreg_SetValue(struct ndr_print *ndr, const char *name, int flags, const struct winreg_SetValue *r)
2992 {
2993         ndr_print_struct(ndr, name, "winreg_SetValue");
2994         ndr->depth++;
2995         if (flags & NDR_SET_VALUES) {
2996                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
2997         }
2998         if (flags & NDR_IN) {
2999                 ndr_print_struct(ndr, "in", "winreg_SetValue");
3000                 ndr->depth++;
3001                 ndr_print_ptr(ndr, "handle", r->in.handle);
3002                 ndr->depth++;
3003                 ndr_print_policy_handle(ndr, "handle", r->in.handle);
3004                 ndr->depth--;
3005                 ndr_print_winreg_String(ndr, "name", &r->in.name);
3006                 ndr_print_winreg_Type(ndr, "type", r->in.type);
3007                 ndr_print_ptr(ndr, "data", r->in.data);
3008                 ndr->depth++;
3009                 ndr_print_array_uint8(ndr, "data", r->in.data, r->in.size);
3010                 ndr->depth--;
3011                 ndr_print_uint32(ndr, "size", r->in.size);
3012                 ndr->depth--;
3013         }
3014         if (flags & NDR_OUT) {
3015                 ndr_print_struct(ndr, "out", "winreg_SetValue");
3016                 ndr->depth++;
3017                 ndr_print_WERROR(ndr, "result", r->out.result);
3018                 ndr->depth--;
3019         }
3020         ndr->depth--;
3021 }
3022
3023 NTSTATUS ndr_push_winreg_UnLoadKey(struct ndr_push *ndr, int flags, const struct winreg_UnLoadKey *r)
3024 {
3025         if (flags & NDR_IN) {
3026         }
3027         if (flags & NDR_OUT) {
3028                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
3029         }
3030         return NT_STATUS_OK;
3031 }
3032
3033 NTSTATUS ndr_pull_winreg_UnLoadKey(struct ndr_pull *ndr, int flags, struct winreg_UnLoadKey *r)
3034 {
3035         if (flags & NDR_IN) {
3036         }
3037         if (flags & NDR_OUT) {
3038                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
3039         }
3040         return NT_STATUS_OK;
3041 }
3042
3043 _PUBLIC_ void ndr_print_winreg_UnLoadKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_UnLoadKey *r)
3044 {
3045         ndr_print_struct(ndr, name, "winreg_UnLoadKey");
3046         ndr->depth++;
3047         if (flags & NDR_SET_VALUES) {
3048                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
3049         }
3050         if (flags & NDR_IN) {
3051                 ndr_print_struct(ndr, "in", "winreg_UnLoadKey");
3052                 ndr->depth++;
3053                 ndr->depth--;
3054         }
3055         if (flags & NDR_OUT) {
3056                 ndr_print_struct(ndr, "out", "winreg_UnLoadKey");
3057                 ndr->depth++;
3058                 ndr_print_WERROR(ndr, "result", r->out.result);
3059                 ndr->depth--;
3060         }
3061         ndr->depth--;
3062 }
3063
3064 NTSTATUS ndr_push_winreg_InitiateSystemShutdown(struct ndr_push *ndr, int flags, const struct winreg_InitiateSystemShutdown *r)
3065 {
3066         if (flags & NDR_IN) {
3067                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.hostname));
3068                 if (r->in.hostname) {
3069                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, *r->in.hostname));
3070                 }
3071                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.message));
3072                 if (r->in.message) {
3073                         NDR_CHECK(ndr_push_initshutdown_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.message));
3074                 }
3075                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.timeout));
3076                 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->in.force_apps));
3077                 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->in.reboot));
3078         }
3079         if (flags & NDR_OUT) {
3080                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
3081         }
3082         return NT_STATUS_OK;
3083 }
3084
3085 NTSTATUS ndr_pull_winreg_InitiateSystemShutdown(struct ndr_pull *ndr, int flags, struct winreg_InitiateSystemShutdown *r)
3086 {
3087         uint32_t _ptr_hostname;
3088         uint32_t _ptr_message;
3089         TALLOC_CTX *_mem_save_hostname_0;
3090         TALLOC_CTX *_mem_save_message_0;
3091         if (flags & NDR_IN) {
3092                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_hostname));
3093                 if (_ptr_hostname) {
3094                         NDR_PULL_ALLOC(ndr, r->in.hostname);
3095                 } else {
3096                         r->in.hostname = NULL;
3097                 }
3098                 if (r->in.hostname) {
3099                         _mem_save_hostname_0 = NDR_PULL_GET_MEM_CTX(ndr);
3100                         NDR_PULL_SET_MEM_CTX(ndr, r->in.hostname, 0);
3101                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, r->in.hostname));
3102                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_hostname_0, 0);
3103                 }
3104                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_message));
3105                 if (_ptr_message) {
3106                         NDR_PULL_ALLOC(ndr, r->in.message);
3107                 } else {
3108                         r->in.message = NULL;
3109                 }
3110                 if (r->in.message) {
3111                         _mem_save_message_0 = NDR_PULL_GET_MEM_CTX(ndr);
3112                         NDR_PULL_SET_MEM_CTX(ndr, r->in.message, 0);
3113                         NDR_CHECK(ndr_pull_initshutdown_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.message));
3114                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_message_0, 0);
3115                 }
3116                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.timeout));
3117                 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->in.force_apps));
3118                 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->in.reboot));
3119         }
3120         if (flags & NDR_OUT) {
3121                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
3122         }
3123         return NT_STATUS_OK;
3124 }
3125
3126 _PUBLIC_ void ndr_print_winreg_InitiateSystemShutdown(struct ndr_print *ndr, const char *name, int flags, const struct winreg_InitiateSystemShutdown *r)
3127 {
3128         ndr_print_struct(ndr, name, "winreg_InitiateSystemShutdown");
3129         ndr->depth++;
3130         if (flags & NDR_SET_VALUES) {
3131                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
3132         }
3133         if (flags & NDR_IN) {
3134                 ndr_print_struct(ndr, "in", "winreg_InitiateSystemShutdown");
3135                 ndr->depth++;
3136                 ndr_print_ptr(ndr, "hostname", r->in.hostname);
3137                 ndr->depth++;
3138                 if (r->in.hostname) {
3139                         ndr_print_uint16(ndr, "hostname", *r->in.hostname);
3140                 }
3141                 ndr->depth--;
3142                 ndr_print_ptr(ndr, "message", r->in.message);
3143                 ndr->depth++;
3144                 if (r->in.message) {
3145                         ndr_print_initshutdown_String(ndr, "message", r->in.message);
3146                 }
3147                 ndr->depth--;
3148                 ndr_print_uint32(ndr, "timeout", r->in.timeout);
3149                 ndr_print_uint8(ndr, "force_apps", r->in.force_apps);
3150                 ndr_print_uint8(ndr, "reboot", r->in.reboot);
3151                 ndr->depth--;
3152         }
3153         if (flags & NDR_OUT) {
3154                 ndr_print_struct(ndr, "out", "winreg_InitiateSystemShutdown");
3155                 ndr->depth++;
3156                 ndr_print_WERROR(ndr, "result", r->out.result);
3157                 ndr->depth--;
3158         }
3159         ndr->depth--;
3160 }
3161
3162 NTSTATUS ndr_push_winreg_AbortSystemShutdown(struct ndr_push *ndr, int flags, const struct winreg_AbortSystemShutdown *r)
3163 {
3164         if (flags & NDR_IN) {
3165                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.server));
3166                 if (r->in.server) {
3167                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, *r->in.server));
3168                 }
3169         }
3170         if (flags & NDR_OUT) {
3171                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
3172         }
3173         return NT_STATUS_OK;
3174 }
3175
3176 NTSTATUS ndr_pull_winreg_AbortSystemShutdown(struct ndr_pull *ndr, int flags, struct winreg_AbortSystemShutdown *r)
3177 {
3178         uint32_t _ptr_server;
3179         TALLOC_CTX *_mem_save_server_0;
3180         if (flags & NDR_IN) {
3181                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_server));
3182                 if (_ptr_server) {
3183                         NDR_PULL_ALLOC(ndr, r->in.server);
3184                 } else {
3185                         r->in.server = NULL;
3186                 }
3187                 if (r->in.server) {
3188                         _mem_save_server_0 = NDR_PULL_GET_MEM_CTX(ndr);
3189                         NDR_PULL_SET_MEM_CTX(ndr, r->in.server, 0);
3190                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, r->in.server));
3191                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_server_0, 0);
3192                 }
3193         }
3194         if (flags & NDR_OUT) {
3195                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
3196         }
3197         return NT_STATUS_OK;
3198 }
3199
3200 _PUBLIC_ void ndr_print_winreg_AbortSystemShutdown(struct ndr_print *ndr, const char *name, int flags, const struct winreg_AbortSystemShutdown *r)
3201 {
3202         ndr_print_struct(ndr, name, "winreg_AbortSystemShutdown");
3203         ndr->depth++;
3204         if (flags & NDR_SET_VALUES) {
3205                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
3206         }
3207         if (flags & NDR_IN) {
3208                 ndr_print_struct(ndr, "in", "winreg_AbortSystemShutdown");
3209                 ndr->depth++;
3210                 ndr_print_ptr(ndr, "server", r->in.server);
3211                 ndr->depth++;
3212                 if (r->in.server) {
3213                         ndr_print_uint16(ndr, "server", *r->in.server);
3214                 }
3215                 ndr->depth--;
3216                 ndr->depth--;
3217         }
3218         if (flags & NDR_OUT) {
3219                 ndr_print_struct(ndr, "out", "winreg_AbortSystemShutdown");
3220                 ndr->depth++;
3221                 ndr_print_WERROR(ndr, "result", r->out.result);
3222                 ndr->depth--;
3223         }
3224         ndr->depth--;
3225 }
3226
3227 NTSTATUS ndr_push_winreg_GetVersion(struct ndr_push *ndr, int flags, const struct winreg_GetVersion *r)
3228 {
3229         if (flags & NDR_IN) {
3230                 if (r->in.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
3231                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
3232         }
3233         if (flags & NDR_OUT) {
3234                 if (r->out.version == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
3235                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.version));
3236                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
3237         }
3238         return NT_STATUS_OK;
3239 }
3240
3241 NTSTATUS ndr_pull_winreg_GetVersion(struct ndr_pull *ndr, int flags, struct winreg_GetVersion *r)
3242 {
3243         TALLOC_CTX *_mem_save_handle_0;
3244         TALLOC_CTX *_mem_save_version_0;
3245         if (flags & NDR_IN) {
3246                 ZERO_STRUCT(r->out);
3247
3248                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
3249                         NDR_PULL_ALLOC(ndr, r->in.handle);
3250                 }
3251                 _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
3252                 NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC);
3253                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
3254                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
3255                 NDR_PULL_ALLOC(ndr, r->out.version);
3256                 ZERO_STRUCTP(r->out.version);
3257         }
3258         if (flags & NDR_OUT) {
3259                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
3260                         NDR_PULL_ALLOC(ndr, r->out.version);
3261                 }
3262                 _mem_save_version_0 = NDR_PULL_GET_MEM_CTX(ndr);
3263                 NDR_PULL_SET_MEM_CTX(ndr, r->out.version, LIBNDR_FLAG_REF_ALLOC);
3264                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.version));
3265                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_version_0, LIBNDR_FLAG_REF_ALLOC);
3266                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
3267         }
3268         return NT_STATUS_OK;
3269 }
3270
3271 _PUBLIC_ void ndr_print_winreg_GetVersion(struct ndr_print *ndr, const char *name, int flags, const struct winreg_GetVersion *r)
3272 {
3273         ndr_print_struct(ndr, name, "winreg_GetVersion");
3274         ndr->depth++;
3275         if (flags & NDR_SET_VALUES) {
3276                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
3277         }
3278         if (flags & NDR_IN) {
3279                 ndr_print_struct(ndr, "in", "winreg_GetVersion");
3280                 ndr->depth++;
3281                 ndr_print_ptr(ndr, "handle", r->in.handle);
3282                 ndr->depth++;
3283                 ndr_print_policy_handle(ndr, "handle", r->in.handle);
3284                 ndr->depth--;
3285                 ndr->depth--;
3286         }
3287         if (flags & NDR_OUT) {
3288                 ndr_print_struct(ndr, "out", "winreg_GetVersion");
3289                 ndr->depth++;
3290                 ndr_print_ptr(ndr, "version", r->out.version);
3291                 ndr->depth++;
3292                 ndr_print_uint32(ndr, "version", *r->out.version);
3293                 ndr->depth--;
3294                 ndr_print_WERROR(ndr, "result", r->out.result);
3295                 ndr->depth--;
3296         }
3297         ndr->depth--;
3298 }
3299
3300 NTSTATUS ndr_push_winreg_OpenHKCC(struct ndr_push *ndr, int flags, const struct winreg_OpenHKCC *r)
3301 {
3302         if (flags & NDR_IN) {
3303                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.system_name));
3304                 if (r->in.system_name) {
3305                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, *r->in.system_name));
3306                 }
3307                 NDR_CHECK(ndr_push_winreg_AccessMask(ndr, NDR_SCALARS, r->in.access_mask));
3308         }
3309         if (flags & NDR_OUT) {
3310                 if (r->out.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
3311                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle));
3312                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
3313         }
3314         return NT_STATUS_OK;
3315 }
3316
3317 NTSTATUS ndr_pull_winreg_OpenHKCC(struct ndr_pull *ndr, int flags, struct winreg_OpenHKCC *r)
3318 {
3319         uint32_t _ptr_system_name;
3320         TALLOC_CTX *_mem_save_system_name_0;
3321         TALLOC_CTX *_mem_save_handle_0;
3322         if (flags & NDR_IN) {
3323                 ZERO_STRUCT(r->out);
3324
3325                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_system_name));
3326                 if (_ptr_system_name) {
3327                         NDR_PULL_ALLOC(ndr, r->in.system_name);
3328                 } else {
3329                         r->in.system_name = NULL;
3330                 }
3331                 if (r->in.system_name) {
3332                         _mem_save_system_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
3333                         NDR_PULL_SET_MEM_CTX(ndr, r->in.system_name, 0);
3334                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, r->in.system_name));
3335                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_system_name_0, 0);
3336                 }
3337                 NDR_CHECK(ndr_pull_winreg_AccessMask(ndr, NDR_SCALARS, &r->in.access_mask));
3338                 NDR_PULL_ALLOC(ndr, r->out.handle);
3339                 ZERO_STRUCTP(r->out.handle);
3340         }
3341         if (flags & NDR_OUT) {
3342                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
3343                         NDR_PULL_ALLOC(ndr, r->out.handle);
3344                 }
3345                 _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
3346                 NDR_PULL_SET_MEM_CTX(ndr, r->out.handle, LIBNDR_FLAG_REF_ALLOC);
3347                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle));
3348                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
3349                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
3350         }
3351         return NT_STATUS_OK;
3352 }
3353
3354 _PUBLIC_ void ndr_print_winreg_OpenHKCC(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKCC *r)
3355 {
3356         ndr_print_struct(ndr, name, "winreg_OpenHKCC");
3357         ndr->depth++;
3358         if (flags & NDR_SET_VALUES) {
3359                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
3360         }
3361         if (flags & NDR_IN) {
3362                 ndr_print_struct(ndr, "in", "winreg_OpenHKCC");
3363                 ndr->depth++;
3364                 ndr_print_ptr(ndr, "system_name", r->in.system_name);
3365                 ndr->depth++;
3366                 if (r->in.system_name) {
3367                         ndr_print_uint16(ndr, "system_name", *r->in.system_name);
3368                 }
3369                 ndr->depth--;
3370                 ndr_print_winreg_AccessMask(ndr, "access_mask", r->in.access_mask);
3371                 ndr->depth--;
3372         }
3373         if (flags & NDR_OUT) {
3374                 ndr_print_struct(ndr, "out", "winreg_OpenHKCC");
3375                 ndr->depth++;
3376                 ndr_print_ptr(ndr, "handle", r->out.handle);
3377                 ndr->depth++;
3378                 ndr_print_policy_handle(ndr, "handle", r->out.handle);
3379                 ndr->depth--;
3380                 ndr_print_WERROR(ndr, "result", r->out.result);
3381                 ndr->depth--;
3382         }
3383         ndr->depth--;
3384 }
3385
3386 NTSTATUS ndr_push_winreg_OpenHKDD(struct ndr_push *ndr, int flags, const struct winreg_OpenHKDD *r)
3387 {
3388         if (flags & NDR_IN) {
3389                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.system_name));
3390                 if (r->in.system_name) {
3391                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, *r->in.system_name));
3392                 }
3393                 NDR_CHECK(ndr_push_winreg_AccessMask(ndr, NDR_SCALARS, r->in.access_mask));
3394         }
3395         if (flags & NDR_OUT) {
3396                 if (r->out.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
3397                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle));
3398                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
3399         }
3400         return NT_STATUS_OK;
3401 }
3402
3403 NTSTATUS ndr_pull_winreg_OpenHKDD(struct ndr_pull *ndr, int flags, struct winreg_OpenHKDD *r)
3404 {
3405         uint32_t _ptr_system_name;
3406         TALLOC_CTX *_mem_save_system_name_0;
3407         TALLOC_CTX *_mem_save_handle_0;
3408         if (flags & NDR_IN) {
3409                 ZERO_STRUCT(r->out);
3410
3411                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_system_name));
3412                 if (_ptr_system_name) {
3413                         NDR_PULL_ALLOC(ndr, r->in.system_name);
3414                 } else {
3415                         r->in.system_name = NULL;
3416                 }
3417                 if (r->in.system_name) {
3418                         _mem_save_system_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
3419                         NDR_PULL_SET_MEM_CTX(ndr, r->in.system_name, 0);
3420                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, r->in.system_name));
3421                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_system_name_0, 0);
3422                 }
3423                 NDR_CHECK(ndr_pull_winreg_AccessMask(ndr, NDR_SCALARS, &r->in.access_mask));
3424                 NDR_PULL_ALLOC(ndr, r->out.handle);
3425                 ZERO_STRUCTP(r->out.handle);
3426         }
3427         if (flags & NDR_OUT) {
3428                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
3429                         NDR_PULL_ALLOC(ndr, r->out.handle);
3430                 }
3431                 _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
3432                 NDR_PULL_SET_MEM_CTX(ndr, r->out.handle, LIBNDR_FLAG_REF_ALLOC);
3433                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle));
3434                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
3435                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
3436         }
3437         return NT_STATUS_OK;
3438 }
3439
3440 _PUBLIC_ void ndr_print_winreg_OpenHKDD(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKDD *r)
3441 {
3442         ndr_print_struct(ndr, name, "winreg_OpenHKDD");
3443         ndr->depth++;
3444         if (flags & NDR_SET_VALUES) {
3445                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
3446         }
3447         if (flags & NDR_IN) {
3448                 ndr_print_struct(ndr, "in", "winreg_OpenHKDD");
3449                 ndr->depth++;
3450                 ndr_print_ptr(ndr, "system_name", r->in.system_name);
3451                 ndr->depth++;
3452                 if (r->in.system_name) {
3453                         ndr_print_uint16(ndr, "system_name", *r->in.system_name);
3454                 }
3455                 ndr->depth--;
3456                 ndr_print_winreg_AccessMask(ndr, "access_mask", r->in.access_mask);
3457                 ndr->depth--;
3458         }
3459         if (flags & NDR_OUT) {
3460                 ndr_print_struct(ndr, "out", "winreg_OpenHKDD");
3461                 ndr->depth++;
3462                 ndr_print_ptr(ndr, "handle", r->out.handle);
3463                 ndr->depth++;
3464                 ndr_print_policy_handle(ndr, "handle", r->out.handle);
3465                 ndr->depth--;
3466                 ndr_print_WERROR(ndr, "result", r->out.result);
3467                 ndr->depth--;
3468         }
3469         ndr->depth--;
3470 }
3471
3472 NTSTATUS ndr_push_winreg_QueryMultipleValues(struct ndr_push *ndr, int flags, const struct winreg_QueryMultipleValues *r)
3473 {
3474         uint32_t cntr_values_1;
3475         if (flags & NDR_IN) {
3476                 if (r->in.key_handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
3477                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.key_handle));
3478                 if (r->in.values == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
3479                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.num_values));
3480                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
3481                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.num_values));
3482                 for (cntr_values_1 = 0; cntr_values_1 < r->in.num_values; cntr_values_1++) {
3483                         NDR_CHECK(ndr_push_QueryMultipleValue(ndr, NDR_SCALARS, &r->in.values[cntr_values_1]));
3484                 }
3485                 for (cntr_values_1 = 0; cntr_values_1 < r->in.num_values; cntr_values_1++) {
3486                         NDR_CHECK(ndr_push_QueryMultipleValue(ndr, NDR_BUFFERS, &r->in.values[cntr_values_1]));
3487                 }
3488                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.num_values));
3489                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.buffer));
3490                 if (r->in.buffer) {
3491                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.buffer_size));
3492                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
3493                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.buffer_size));
3494                         NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->in.buffer, *r->in.buffer_size));
3495                 }
3496                 if (r->in.buffer_size == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
3497                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.buffer_size));
3498         }
3499         if (flags & NDR_OUT) {
3500                 if (r->out.values == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
3501                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.num_values));
3502                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
3503                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.num_values));
3504                 for (cntr_values_1 = 0; cntr_values_1 < r->in.num_values; cntr_values_1++) {
3505                         NDR_CHECK(ndr_push_QueryMultipleValue(ndr, NDR_SCALARS, &r->out.values[cntr_values_1]));
3506                 }
3507                 for (cntr_values_1 = 0; cntr_values_1 < r->in.num_values; cntr_values_1++) {
3508                         NDR_CHECK(ndr_push_QueryMultipleValue(ndr, NDR_BUFFERS, &r->out.values[cntr_values_1]));
3509                 }
3510                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.buffer));
3511                 if (r->out.buffer) {
3512                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.buffer_size));
3513                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
3514                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.buffer_size));
3515                         NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->out.buffer, *r->out.buffer_size));
3516                 }
3517                 if (r->out.buffer_size == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
3518                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.buffer_size));
3519                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
3520         }
3521         return NT_STATUS_OK;
3522 }
3523
3524 NTSTATUS ndr_pull_winreg_QueryMultipleValues(struct ndr_pull *ndr, int flags, struct winreg_QueryMultipleValues *r)
3525 {
3526         uint32_t cntr_values_1;
3527         uint32_t _ptr_buffer;
3528         TALLOC_CTX *_mem_save_key_handle_0;
3529         TALLOC_CTX *_mem_save_values_1;
3530         TALLOC_CTX *_mem_save_buffer_0;
3531         TALLOC_CTX *_mem_save_buffer_size_0;
3532         if (flags & NDR_IN) {
3533                 ZERO_STRUCT(r->out);
3534
3535                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
3536                         NDR_PULL_ALLOC(ndr, r->in.key_handle);
3537                 }
3538                 _mem_save_key_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
3539                 NDR_PULL_SET_MEM_CTX(ndr, r->in.key_handle, LIBNDR_FLAG_REF_ALLOC);
3540                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.key_handle));
3541                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_key_handle_0, LIBNDR_FLAG_REF_ALLOC);
3542                 NDR_CHECK(ndr_pull_array_size(ndr, &r->in.values));
3543                 NDR_CHECK(ndr_pull_array_length(ndr, &r->in.values));
3544                 if (ndr_get_array_length(ndr, &r->in.values) > ndr_get_array_size(ndr, &r->in.values)) {
3545                         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.values), ndr_get_array_length(ndr, &r->in.values));
3546                 }
3547                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
3548                         NDR_PULL_ALLOC_N(ndr, r->in.values, ndr_get_array_size(ndr, &r->in.values));
3549                 }
3550                 memcpy(r->out.values,r->in.values,ndr_get_array_size(ndr, &r->in.values) * sizeof(*r->in.values));
3551                 _mem_save_values_1 = NDR_PULL_GET_MEM_CTX(ndr);
3552                 NDR_PULL_SET_MEM_CTX(ndr, r->in.values, 0);
3553                 for (cntr_values_1 = 0; cntr_values_1 < r->in.num_values; cntr_values_1++) {
3554                         NDR_CHECK(ndr_pull_QueryMultipleValue(ndr, NDR_SCALARS, &r->in.values[cntr_values_1]));
3555                 }
3556                 for (cntr_values_1 = 0; cntr_values_1 < r->in.num_values; cntr_values_1++) {
3557                         NDR_CHECK(ndr_pull_QueryMultipleValue(ndr, NDR_BUFFERS, &r->in.values[cntr_values_1]));
3558                 }
3559                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_values_1, 0);
3560                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.num_values));
3561                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_buffer));
3562                 if (_ptr_buffer) {
3563                         NDR_PULL_ALLOC(ndr, r->in.buffer);
3564                 } else {
3565                         r->in.buffer = NULL;
3566                 }
3567                 if (r->in.buffer) {
3568                         _mem_save_buffer_0 = NDR_PULL_GET_MEM_CTX(ndr);
3569                         NDR_PULL_SET_MEM_CTX(ndr, r->in.buffer, 0);
3570                         NDR_CHECK(ndr_pull_array_size(ndr, &r->in.buffer));
3571                         NDR_CHECK(ndr_pull_array_length(ndr, &r->in.buffer));
3572                         if (ndr_get_array_length(ndr, &r->in.buffer) > ndr_get_array_size(ndr, &r->in.buffer)) {
3573                                 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.buffer), ndr_get_array_length(ndr, &r->in.buffer));
3574                         }
3575                         NDR_PULL_ALLOC_N(ndr, r->in.buffer, ndr_get_array_size(ndr, &r->in.buffer));
3576                         NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->in.buffer, ndr_get_array_length(ndr, &r->in.buffer)));
3577                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_buffer_0, 0);
3578                 }
3579                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
3580                         NDR_PULL_ALLOC(ndr, r->in.buffer_size);
3581                 }
3582                 _mem_save_buffer_size_0 = NDR_PULL_GET_MEM_CTX(ndr);
3583                 NDR_PULL_SET_MEM_CTX(ndr, r->in.buffer_size, LIBNDR_FLAG_REF_ALLOC);
3584                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.buffer_size));
3585                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_buffer_size_0, LIBNDR_FLAG_REF_ALLOC);
3586                 NDR_PULL_ALLOC_N(ndr, r->out.values, r->in.num_values);
3587                 memcpy(r->out.values, r->in.values, r->in.num_values * sizeof(*r->in.values));
3588                 NDR_PULL_ALLOC(ndr, r->out.buffer_size);
3589                 *r->out.buffer_size = *r->in.buffer_size;
3590                 if (r->in.values) {
3591                         NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->in.values, r->in.num_values));
3592                 }
3593                 if (r->in.values) {
3594                         NDR_CHECK(ndr_check_array_length(ndr, (void*)&r->in.values, r->in.num_values));
3595                 }
3596                 if (r->in.buffer) {
3597                         NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->in.buffer, *r->in.buffer_size));
3598                 }
3599                 if (r->in.buffer) {
3600                         NDR_CHECK(ndr_check_array_length(ndr, (void*)&r->in.buffer, *r->in.buffer_size));
3601                 }
3602         }
3603         if (flags & NDR_OUT) {
3604                 NDR_CHECK(ndr_pull_array_size(ndr, &r->out.values));
3605                 NDR_CHECK(ndr_pull_array_length(ndr, &r->out.values));
3606                 if (ndr_get_array_length(ndr, &r->out.values) > ndr_get_array_size(ndr, &r->out.values)) {
3607                         return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->out.values), ndr_get_array_length(ndr, &r->out.values));
3608                 }
3609                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
3610                         NDR_PULL_ALLOC_N(ndr, r->out.values, ndr_get_array_size(ndr, &r->out.values));
3611                 }
3612                 memcpy(r->out.values,r->in.values,ndr_get_array_size(ndr, &r->out.values) * sizeof(*r->in.values));
3613                 _mem_save_values_1 = NDR_PULL_GET_MEM_CTX(ndr);
3614                 NDR_PULL_SET_MEM_CTX(ndr, r->out.values, 0);
3615                 for (cntr_values_1 = 0; cntr_values_1 < r->in.num_values; cntr_values_1++) {
3616                         NDR_CHECK(ndr_pull_QueryMultipleValue(ndr, NDR_SCALARS, &r->out.values[cntr_values_1]));
3617                 }
3618                 for (cntr_values_1 = 0; cntr_values_1 < r->in.num_values; cntr_values_1++) {
3619                         NDR_CHECK(ndr_pull_QueryMultipleValue(ndr, NDR_BUFFERS, &r->out.values[cntr_values_1]));
3620                 }
3621                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_values_1, 0);
3622                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_buffer));
3623                 if (_ptr_buffer) {
3624                         NDR_PULL_ALLOC(ndr, r->out.buffer);
3625                 } else {
3626                         r->out.buffer = NULL;
3627                 }
3628                 if (r->out.buffer) {
3629                         _mem_save_buffer_0 = NDR_PULL_GET_MEM_CTX(ndr);
3630                         NDR_PULL_SET_MEM_CTX(ndr, r->out.buffer, 0);
3631                         NDR_CHECK(ndr_pull_array_size(ndr, &r->out.buffer));
3632                         NDR_CHECK(ndr_pull_array_length(ndr, &r->out.buffer));
3633                         if (ndr_get_array_length(ndr, &r->out.buffer) > ndr_get_array_size(ndr, &r->out.buffer)) {
3634                                 return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->out.buffer), ndr_get_array_length(ndr, &r->out.buffer));
3635                         }
3636                         NDR_PULL_ALLOC_N(ndr, r->out.buffer, ndr_get_array_size(ndr, &r->out.buffer));
3637                         NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->out.buffer, ndr_get_array_length(ndr, &r->out.buffer)));
3638                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_buffer_0, 0);
3639                 }
3640                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
3641                         NDR_PULL_ALLOC(ndr, r->out.buffer_size);
3642                 }
3643                 _mem_save_buffer_size_0 = NDR_PULL_GET_MEM_CTX(ndr);
3644                 NDR_PULL_SET_MEM_CTX(ndr, r->out.buffer_size, LIBNDR_FLAG_REF_ALLOC);
3645                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.buffer_size));
3646                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_buffer_size_0, LIBNDR_FLAG_REF_ALLOC);
3647                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
3648                 if (r->out.values) {
3649                         NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->out.values, r->in.num_values));
3650                 }
3651                 if (r->out.values) {
3652                         NDR_CHECK(ndr_check_array_length(ndr, (void*)&r->out.values, r->in.num_values));
3653                 }
3654                 if (r->out.buffer) {
3655                         NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->out.buffer, *r->out.buffer_size));
3656                 }
3657                 if (r->out.buffer) {
3658                         NDR_CHECK(ndr_check_array_length(ndr, (void*)&r->out.buffer, *r->out.buffer_size));
3659                 }
3660         }
3661         return NT_STATUS_OK;
3662 }
3663
3664 _PUBLIC_ void ndr_print_winreg_QueryMultipleValues(struct ndr_print *ndr, const char *name, int flags, const struct winreg_QueryMultipleValues *r)
3665 {
3666         uint32_t cntr_values_1;
3667         ndr_print_struct(ndr, name, "winreg_QueryMultipleValues");
3668         ndr->depth++;
3669         if (flags & NDR_SET_VALUES) {
3670                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
3671         }
3672         if (flags & NDR_IN) {
3673                 ndr_print_struct(ndr, "in", "winreg_QueryMultipleValues");
3674                 ndr->depth++;
3675                 ndr_print_ptr(ndr, "key_handle", r->in.key_handle);
3676                 ndr->depth++;
3677                 ndr_print_policy_handle(ndr, "key_handle", r->in.key_handle);
3678                 ndr->depth--;
3679                 ndr_print_ptr(ndr, "values", r->in.values);
3680                 ndr->depth++;
3681                 ndr->print(ndr, "%s: ARRAY(%d)", "values", r->in.num_values);
3682                 ndr->depth++;
3683                 for (cntr_values_1=0;cntr_values_1<r->in.num_values;cntr_values_1++) {
3684                         char *idx_1=NULL;
3685                         asprintf(&idx_1, "[%d]", cntr_values_1);
3686                         if (idx_1) {
3687                                 ndr_print_QueryMultipleValue(ndr, "values", &r->in.values[cntr_values_1]);
3688                                 free(idx_1);
3689                         }
3690                 }
3691                 ndr->depth--;
3692                 ndr->depth--;
3693                 ndr_print_uint32(ndr, "num_values", r->in.num_values);
3694                 ndr_print_ptr(ndr, "buffer", r->in.buffer);
3695                 ndr->depth++;
3696                 if (r->in.buffer) {
3697                         ndr_print_array_uint8(ndr, "buffer", r->in.buffer, *r->in.buffer_size);
3698                 }
3699                 ndr->depth--;
3700                 ndr_print_ptr(ndr, "buffer_size", r->in.buffer_size);
3701                 ndr->depth++;
3702                 ndr_print_uint32(ndr, "buffer_size", *r->in.buffer_size);
3703                 ndr->depth--;
3704                 ndr->depth--;
3705         }
3706         if (flags & NDR_OUT) {
3707                 ndr_print_struct(ndr, "out", "winreg_QueryMultipleValues");
3708                 ndr->depth++;
3709                 ndr_print_ptr(ndr, "values", r->out.values);
3710                 ndr->depth++;
3711                 ndr->print(ndr, "%s: ARRAY(%d)", "values", r->in.num_values);
3712                 ndr->depth++;
3713                 for (cntr_values_1=0;cntr_values_1<r->in.num_values;cntr_values_1++) {
3714                         char *idx_1=NULL;
3715                         asprintf(&idx_1, "[%d]", cntr_values_1);
3716                         if (idx_1) {
3717                                 ndr_print_QueryMultipleValue(ndr, "values", &r->out.values[cntr_values_1]);
3718                                 free(idx_1);
3719                         }
3720                 }
3721                 ndr->depth--;
3722                 ndr->depth--;
3723                 ndr_print_ptr(ndr, "buffer", r->out.buffer);
3724                 ndr->depth++;
3725                 if (r->out.buffer) {
3726                         ndr_print_array_uint8(ndr, "buffer", r->out.buffer, *r->out.buffer_size);
3727                 }
3728                 ndr->depth--;
3729                 ndr_print_ptr(ndr, "buffer_size", r->out.buffer_size);
3730                 ndr->depth++;
3731                 ndr_print_uint32(ndr, "buffer_size", *r->out.buffer_size);
3732                 ndr->depth--;
3733                 ndr_print_WERROR(ndr, "result", r->out.result);
3734                 ndr->depth--;
3735         }
3736         ndr->depth--;
3737 }
3738
3739 NTSTATUS ndr_push_winreg_InitiateSystemShutdownEx(struct ndr_push *ndr, int flags, const struct winreg_InitiateSystemShutdownEx *r)
3740 {
3741         if (flags & NDR_IN) {
3742                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.hostname));
3743                 if (r->in.hostname) {
3744                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, *r->in.hostname));
3745                 }
3746                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.message));
3747                 if (r->in.message) {
3748                         NDR_CHECK(ndr_push_initshutdown_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.message));
3749                 }
3750                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.timeout));
3751                 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->in.force_apps));
3752                 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->in.reboot));
3753                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.reason));
3754         }
3755         if (flags & NDR_OUT) {
3756                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
3757         }
3758         return NT_STATUS_OK;
3759 }
3760
3761 NTSTATUS ndr_pull_winreg_InitiateSystemShutdownEx(struct ndr_pull *ndr, int flags, struct winreg_InitiateSystemShutdownEx *r)
3762 {
3763         uint32_t _ptr_hostname;
3764         uint32_t _ptr_message;
3765         TALLOC_CTX *_mem_save_hostname_0;
3766         TALLOC_CTX *_mem_save_message_0;
3767         if (flags & NDR_IN) {
3768                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_hostname));
3769                 if (_ptr_hostname) {
3770                         NDR_PULL_ALLOC(ndr, r->in.hostname);
3771                 } else {
3772                         r->in.hostname = NULL;
3773                 }
3774                 if (r->in.hostname) {
3775                         _mem_save_hostname_0 = NDR_PULL_GET_MEM_CTX(ndr);
3776                         NDR_PULL_SET_MEM_CTX(ndr, r->in.hostname, 0);
3777                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, r->in.hostname));
3778                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_hostname_0, 0);
3779                 }
3780                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_message));
3781                 if (_ptr_message) {
3782                         NDR_PULL_ALLOC(ndr, r->in.message);
3783                 } else {
3784                         r->in.message = NULL;
3785                 }
3786                 if (r->in.message) {
3787                         _mem_save_message_0 = NDR_PULL_GET_MEM_CTX(ndr);
3788                         NDR_PULL_SET_MEM_CTX(ndr, r->in.message, 0);
3789                         NDR_CHECK(ndr_pull_initshutdown_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.message));
3790                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_message_0, 0);
3791                 }
3792                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.timeout));
3793                 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->in.force_apps));
3794                 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->in.reboot));
3795                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.reason));
3796         }
3797         if (flags & NDR_OUT) {
3798                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
3799         }
3800         return NT_STATUS_OK;
3801 }
3802
3803 _PUBLIC_ void ndr_print_winreg_InitiateSystemShutdownEx(struct ndr_print *ndr, const char *name, int flags, const struct winreg_InitiateSystemShutdownEx *r)
3804 {
3805         ndr_print_struct(ndr, name, "winreg_InitiateSystemShutdownEx");
3806         ndr->depth++;
3807         if (flags & NDR_SET_VALUES) {
3808                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
3809         }
3810         if (flags & NDR_IN) {
3811                 ndr_print_struct(ndr, "in", "winreg_InitiateSystemShutdownEx");
3812                 ndr->depth++;
3813                 ndr_print_ptr(ndr, "hostname", r->in.hostname);
3814                 ndr->depth++;
3815                 if (r->in.hostname) {
3816                         ndr_print_uint16(ndr, "hostname", *r->in.hostname);
3817                 }
3818                 ndr->depth--;
3819                 ndr_print_ptr(ndr, "message", r->in.message);
3820                 ndr->depth++;
3821                 if (r->in.message) {
3822                         ndr_print_initshutdown_String(ndr, "message", r->in.message);
3823                 }
3824                 ndr->depth--;
3825                 ndr_print_uint32(ndr, "timeout", r->in.timeout);
3826                 ndr_print_uint8(ndr, "force_apps", r->in.force_apps);
3827                 ndr_print_uint8(ndr, "reboot", r->in.reboot);
3828                 ndr_print_uint32(ndr, "reason", r->in.reason);
3829                 ndr->depth--;
3830         }
3831         if (flags & NDR_OUT) {
3832                 ndr_print_struct(ndr, "out", "winreg_InitiateSystemShutdownEx");
3833                 ndr->depth++;
3834                 ndr_print_WERROR(ndr, "result", r->out.result);
3835                 ndr->depth--;
3836         }
3837         ndr->depth--;
3838 }
3839
3840 NTSTATUS ndr_push_winreg_SaveKeyEx(struct ndr_push *ndr, int flags, const struct winreg_SaveKeyEx *r)
3841 {
3842         if (flags & NDR_IN) {
3843         }
3844         if (flags & NDR_OUT) {
3845                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
3846         }
3847         return NT_STATUS_OK;
3848 }
3849
3850 NTSTATUS ndr_pull_winreg_SaveKeyEx(struct ndr_pull *ndr, int flags, struct winreg_SaveKeyEx *r)
3851 {
3852         if (flags & NDR_IN) {
3853         }
3854         if (flags & NDR_OUT) {
3855                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
3856         }
3857         return NT_STATUS_OK;
3858 }
3859
3860 _PUBLIC_ void ndr_print_winreg_SaveKeyEx(struct ndr_print *ndr, const char *name, int flags, const struct winreg_SaveKeyEx *r)
3861 {
3862         ndr_print_struct(ndr, name, "winreg_SaveKeyEx");
3863         ndr->depth++;
3864         if (flags & NDR_SET_VALUES) {
3865                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
3866         }
3867         if (flags & NDR_IN) {
3868                 ndr_print_struct(ndr, "in", "winreg_SaveKeyEx");
3869                 ndr->depth++;
3870                 ndr->depth--;
3871         }
3872         if (flags & NDR_OUT) {
3873                 ndr_print_struct(ndr, "out", "winreg_SaveKeyEx");
3874                 ndr->depth++;
3875                 ndr_print_WERROR(ndr, "result", r->out.result);
3876                 ndr->depth--;
3877         }
3878         ndr->depth--;
3879 }
3880
3881 NTSTATUS ndr_push_winreg_OpenHKPT(struct ndr_push *ndr, int flags, const struct winreg_OpenHKPT *r)
3882 {
3883         if (flags & NDR_IN) {
3884                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.system_name));
3885                 if (r->in.system_name) {
3886                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, *r->in.system_name));
3887                 }
3888                 NDR_CHECK(ndr_push_winreg_AccessMask(ndr, NDR_SCALARS, r->in.access_mask));
3889         }
3890         if (flags & NDR_OUT) {
3891                 if (r->out.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
3892                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle));
3893                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
3894         }
3895         return NT_STATUS_OK;
3896 }
3897
3898 NTSTATUS ndr_pull_winreg_OpenHKPT(struct ndr_pull *ndr, int flags, struct winreg_OpenHKPT *r)
3899 {
3900         uint32_t _ptr_system_name;
3901         TALLOC_CTX *_mem_save_system_name_0;
3902         TALLOC_CTX *_mem_save_handle_0;
3903         if (flags & NDR_IN) {
3904                 ZERO_STRUCT(r->out);
3905
3906                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_system_name));
3907                 if (_ptr_system_name) {
3908                         NDR_PULL_ALLOC(ndr, r->in.system_name);
3909                 } else {
3910                         r->in.system_name = NULL;
3911                 }
3912                 if (r->in.system_name) {
3913                         _mem_save_system_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
3914                         NDR_PULL_SET_MEM_CTX(ndr, r->in.system_name, 0);
3915                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, r->in.system_name));
3916                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_system_name_0, 0);
3917                 }
3918                 NDR_CHECK(ndr_pull_winreg_AccessMask(ndr, NDR_SCALARS, &r->in.access_mask));
3919                 NDR_PULL_ALLOC(ndr, r->out.handle);
3920                 ZERO_STRUCTP(r->out.handle);
3921         }
3922         if (flags & NDR_OUT) {
3923                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
3924                         NDR_PULL_ALLOC(ndr, r->out.handle);
3925                 }
3926                 _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
3927                 NDR_PULL_SET_MEM_CTX(ndr, r->out.handle, LIBNDR_FLAG_REF_ALLOC);
3928                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle));
3929                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
3930                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
3931         }
3932         return NT_STATUS_OK;
3933 }
3934
3935 _PUBLIC_ void ndr_print_winreg_OpenHKPT(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKPT *r)
3936 {
3937         ndr_print_struct(ndr, name, "winreg_OpenHKPT");
3938         ndr->depth++;
3939         if (flags & NDR_SET_VALUES) {
3940                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
3941         }
3942         if (flags & NDR_IN) {
3943                 ndr_print_struct(ndr, "in", "winreg_OpenHKPT");
3944                 ndr->depth++;
3945                 ndr_print_ptr(ndr, "system_name", r->in.system_name);
3946                 ndr->depth++;
3947                 if (r->in.system_name) {
3948                         ndr_print_uint16(ndr, "system_name", *r->in.system_name);
3949                 }
3950                 ndr->depth--;
3951                 ndr_print_winreg_AccessMask(ndr, "access_mask", r->in.access_mask);
3952                 ndr->depth--;
3953         }
3954         if (flags & NDR_OUT) {
3955                 ndr_print_struct(ndr, "out", "winreg_OpenHKPT");
3956                 ndr->depth++;
3957                 ndr_print_ptr(ndr, "handle", r->out.handle);
3958                 ndr->depth++;
3959                 ndr_print_policy_handle(ndr, "handle", r->out.handle);
3960                 ndr->depth--;
3961                 ndr_print_WERROR(ndr, "result", r->out.result);
3962                 ndr->depth--;
3963         }
3964         ndr->depth--;
3965 }
3966
3967 NTSTATUS ndr_push_winreg_OpenHKPN(struct ndr_push *ndr, int flags, const struct winreg_OpenHKPN *r)
3968 {
3969         if (flags & NDR_IN) {
3970                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.system_name));
3971                 if (r->in.system_name) {
3972                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, *r->in.system_name));
3973                 }
3974                 NDR_CHECK(ndr_push_winreg_AccessMask(ndr, NDR_SCALARS, r->in.access_mask));
3975         }
3976         if (flags & NDR_OUT) {
3977                 if (r->out.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
3978                 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle));
3979                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
3980         }
3981         return NT_STATUS_OK;
3982 }
3983
3984 NTSTATUS ndr_pull_winreg_OpenHKPN(struct ndr_pull *ndr, int flags, struct winreg_OpenHKPN *r)
3985 {
3986         uint32_t _ptr_system_name;
3987         TALLOC_CTX *_mem_save_system_name_0;
3988         TALLOC_CTX *_mem_save_handle_0;
3989         if (flags & NDR_IN) {
3990                 ZERO_STRUCT(r->out);
3991
3992                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_system_name));
3993                 if (_ptr_system_name) {
3994                         NDR_PULL_ALLOC(ndr, r->in.system_name);
3995                 } else {
3996                         r->in.system_name = NULL;
3997                 }
3998                 if (r->in.system_name) {
3999                         _mem_save_system_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
4000                         NDR_PULL_SET_MEM_CTX(ndr, r->in.system_name, 0);
4001                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, r->in.system_name));
4002                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_system_name_0, 0);
4003                 }
4004                 NDR_CHECK(ndr_pull_winreg_AccessMask(ndr, NDR_SCALARS, &r->in.access_mask));
4005                 NDR_PULL_ALLOC(ndr, r->out.handle);
4006                 ZERO_STRUCTP(r->out.handle);
4007         }
4008         if (flags & NDR_OUT) {
4009                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
4010                         NDR_PULL_ALLOC(ndr, r->out.handle);
4011                 }
4012                 _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
4013                 NDR_PULL_SET_MEM_CTX(ndr, r->out.handle, LIBNDR_FLAG_REF_ALLOC);
4014                 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle));
4015                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
4016                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
4017         }
4018         return NT_STATUS_OK;
4019 }
4020
4021 _PUBLIC_ void ndr_print_winreg_OpenHKPN(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKPN *r)
4022 {
4023         ndr_print_struct(ndr, name, "winreg_OpenHKPN");
4024         ndr->depth++;
4025         if (flags & NDR_SET_VALUES) {
4026                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
4027         }
4028         if (flags & NDR_IN) {
4029                 ndr_print_struct(ndr, "in", "winreg_OpenHKPN");
4030                 ndr->depth++;
4031                 ndr_print_ptr(ndr, "system_name", r->in.system_name);
4032                 ndr->depth++;
4033                 if (r->in.system_name) {
4034                         ndr_print_uint16(ndr, "system_name", *r->in.system_name);
4035                 }
4036                 ndr->depth--;
4037                 ndr_print_winreg_AccessMask(ndr, "access_mask", r->in.access_mask);
4038                 ndr->depth--;
4039         }
4040         if (flags & NDR_OUT) {
4041                 ndr_print_struct(ndr, "out", "winreg_OpenHKPN");
4042                 ndr->depth++;
4043                 ndr_print_ptr(ndr, "handle", r->out.handle);
4044                 ndr->depth++;
4045                 ndr_print_policy_handle(ndr, "handle", r->out.handle);
4046                 ndr->depth--;
4047                 ndr_print_WERROR(ndr, "result", r->out.result);
4048                 ndr->depth--;
4049         }
4050         ndr->depth--;
4051 }
4052
4053 NTSTATUS ndr_push_winreg_QueryMultipleValues2(struct ndr_push *ndr, int flags, const struct winreg_QueryMultipleValues2 *r)
4054 {
4055         if (flags & NDR_IN) {
4056         }
4057         if (flags & NDR_OUT) {
4058                 NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
4059         }
4060         return NT_STATUS_OK;
4061 }
4062
4063 NTSTATUS ndr_pull_winreg_QueryMultipleValues2(struct ndr_pull *ndr, int flags, struct winreg_QueryMultipleValues2 *r)
4064 {
4065         if (flags & NDR_IN) {
4066         }
4067         if (flags & NDR_OUT) {
4068                 NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
4069         }
4070         return NT_STATUS_OK;
4071 }
4072
4073 _PUBLIC_ void ndr_print_winreg_QueryMultipleValues2(struct ndr_print *ndr, const char *name, int flags, const struct winreg_QueryMultipleValues2 *r)
4074 {
4075         ndr_print_struct(ndr, name, "winreg_QueryMultipleValues2");
4076         ndr->depth++;
4077         if (flags & NDR_SET_VALUES) {
4078                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
4079         }
4080         if (flags & NDR_IN) {
4081                 ndr_print_struct(ndr, "in", "winreg_QueryMultipleValues2");
4082                 ndr->depth++;
4083                 ndr->depth--;
4084         }
4085         if (flags & NDR_OUT) {
4086                 ndr_print_struct(ndr, "out", "winreg_QueryMultipleValues2");
4087                 ndr->depth++;
4088                 ndr_print_WERROR(ndr, "result", r->out.result);
4089                 ndr->depth--;
4090         }
4091         ndr->depth--;
4092 }
4093
4094 const struct dcerpc_interface_call winreg_calls[] = {
4095         {
4096                 "winreg_OpenHKCR",
4097                 sizeof(struct winreg_OpenHKCR),
4098                 (ndr_push_flags_fn_t) ndr_push_winreg_OpenHKCR,
4099                 (ndr_pull_flags_fn_t) ndr_pull_winreg_OpenHKCR,
4100                 (ndr_print_function_t) ndr_print_winreg_OpenHKCR,
4101                 False,
4102         },
4103         {
4104                 "winreg_OpenHKCU",
4105                 sizeof(struct winreg_OpenHKCU),
4106                 (ndr_push_flags_fn_t) ndr_push_winreg_OpenHKCU,
4107                 (ndr_pull_flags_fn_t) ndr_pull_winreg_OpenHKCU,
4108                 (ndr_print_function_t) ndr_print_winreg_OpenHKCU,
4109                 False,
4110         },
4111         {
4112                 "winreg_OpenHKLM",
4113                 sizeof(struct winreg_OpenHKLM),
4114                 (ndr_push_flags_fn_t) ndr_push_winreg_OpenHKLM,
4115                 (ndr_pull_flags_fn_t) ndr_pull_winreg_OpenHKLM,
4116                 (ndr_print_function_t) ndr_print_winreg_OpenHKLM,
4117                 False,
4118         },
4119         {
4120                 "winreg_OpenHKPD",
4121                 sizeof(struct winreg_OpenHKPD),
4122                 (ndr_push_flags_fn_t) ndr_push_winreg_OpenHKPD,
4123                 (ndr_pull_flags_fn_t) ndr_pull_winreg_OpenHKPD,
4124                 (ndr_print_function_t) ndr_print_winreg_OpenHKPD,
4125                 False,
4126         },
4127         {
4128                 "winreg_OpenHKU",
4129                 sizeof(struct winreg_OpenHKU),
4130                 (ndr_push_flags_fn_t) ndr_push_winreg_OpenHKU,
4131                 (ndr_pull_flags_fn_t) ndr_pull_winreg_OpenHKU,
4132                 (ndr_print_function_t) ndr_print_winreg_OpenHKU,
4133                 False,
4134         },
4135         {
4136                 "winreg_CloseKey",
4137                 sizeof(struct winreg_CloseKey),
4138                 (ndr_push_flags_fn_t) ndr_push_winreg_CloseKey,
4139                 (ndr_pull_flags_fn_t) ndr_pull_winreg_CloseKey,
4140                 (ndr_print_function_t) ndr_print_winreg_CloseKey,
4141                 False,
4142         },
4143         {
4144                 "winreg_CreateKey",
4145                 sizeof(struct winreg_CreateKey),
4146                 (ndr_push_flags_fn_t) ndr_push_winreg_CreateKey,
4147                 (ndr_pull_flags_fn_t) ndr_pull_winreg_CreateKey,
4148                 (ndr_print_function_t) ndr_print_winreg_CreateKey,
4149                 False,
4150         },
4151         {
4152                 "winreg_DeleteKey",
4153                 sizeof(struct winreg_DeleteKey),
4154                 (ndr_push_flags_fn_t) ndr_push_winreg_DeleteKey,
4155                 (ndr_pull_flags_fn_t) ndr_pull_winreg_DeleteKey,
4156                 (ndr_print_function_t) ndr_print_winreg_DeleteKey,
4157                 False,
4158         },
4159         {
4160                 "winreg_DeleteValue",
4161                 sizeof(struct winreg_DeleteValue),
4162                 (ndr_push_flags_fn_t) ndr_push_winreg_DeleteValue,
4163                 (ndr_pull_flags_fn_t) ndr_pull_winreg_DeleteValue,
4164                 (ndr_print_function_t) ndr_print_winreg_DeleteValue,
4165                 False,
4166         },
4167         {
4168                 "winreg_EnumKey",
4169                 sizeof(struct winreg_EnumKey),
4170                 (ndr_push_flags_fn_t) ndr_push_winreg_EnumKey,
4171                 (ndr_pull_flags_fn_t) ndr_pull_winreg_EnumKey,
4172                 (ndr_print_function_t) ndr_print_winreg_EnumKey,
4173                 False,
4174         },
4175         {
4176                 "winreg_EnumValue",
4177                 sizeof(struct winreg_EnumValue),
4178                 (ndr_push_flags_fn_t) ndr_push_winreg_EnumValue,
4179                 (ndr_pull_flags_fn_t) ndr_pull_winreg_EnumValue,
4180                 (ndr_print_function_t) ndr_print_winreg_EnumValue,
4181                 False,
4182         },
4183         {
4184                 "winreg_FlushKey",
4185                 sizeof(struct winreg_FlushKey),
4186                 (ndr_push_flags_fn_t) ndr_push_winreg_FlushKey,
4187                 (ndr_pull_flags_fn_t) ndr_pull_winreg_FlushKey,
4188                 (ndr_print_function_t) ndr_print_winreg_FlushKey,
4189                 False,
4190         },
4191         {
4192                 "winreg_GetKeySecurity",
4193                 sizeof(struct winreg_GetKeySecurity),
4194                 (ndr_push_flags_fn_t) ndr_push_winreg_GetKeySecurity,
4195                 (ndr_pull_flags_fn_t) ndr_pull_winreg_GetKeySecurity,
4196                 (ndr_print_function_t) ndr_print_winreg_GetKeySecurity,
4197                 False,
4198         },
4199         {
4200                 "winreg_LoadKey",
4201                 sizeof(struct winreg_LoadKey),
4202                 (ndr_push_flags_fn_t) ndr_push_winreg_LoadKey,
4203                 (ndr_pull_flags_fn_t) ndr_pull_winreg_LoadKey,
4204                 (ndr_print_function_t) ndr_print_winreg_LoadKey,
4205                 False,
4206         },
4207         {
4208                 "winreg_NotifyChangeKeyValue",
4209                 sizeof(struct winreg_NotifyChangeKeyValue),
4210                 (ndr_push_flags_fn_t) ndr_push_winreg_NotifyChangeKeyValue,
4211                 (ndr_pull_flags_fn_t) ndr_pull_winreg_NotifyChangeKeyValue,
4212                 (ndr_print_function_t) ndr_print_winreg_NotifyChangeKeyValue,
4213                 False,
4214         },
4215         {
4216                 "winreg_OpenKey",
4217                 sizeof(struct winreg_OpenKey),
4218                 (ndr_push_flags_fn_t) ndr_push_winreg_OpenKey,
4219                 (ndr_pull_flags_fn_t) ndr_pull_winreg_OpenKey,
4220                 (ndr_print_function_t) ndr_print_winreg_OpenKey,
4221                 False,
4222         },
4223         {
4224                 "winreg_QueryInfoKey",
4225                 sizeof(struct winreg_QueryInfoKey),
4226                 (ndr_push_flags_fn_t) ndr_push_winreg_QueryInfoKey,
4227                 (ndr_pull_flags_fn_t) ndr_pull_winreg_QueryInfoKey,
4228                 (ndr_print_function_t) ndr_print_winreg_QueryInfoKey,
4229                 False,
4230         },
4231         {
4232                 "winreg_QueryValue",
4233                 sizeof(struct winreg_QueryValue),
4234                 (ndr_push_flags_fn_t) ndr_push_winreg_QueryValue,
4235                 (ndr_pull_flags_fn_t) ndr_pull_winreg_QueryValue,
4236                 (ndr_print_function_t) ndr_print_winreg_QueryValue,
4237                 False,
4238         },
4239         {
4240                 "winreg_ReplaceKey",
4241                 sizeof(struct winreg_ReplaceKey),
4242                 (ndr_push_flags_fn_t) ndr_push_winreg_ReplaceKey,
4243                 (ndr_pull_flags_fn_t) ndr_pull_winreg_ReplaceKey,
4244                 (ndr_print_function_t) ndr_print_winreg_ReplaceKey,
4245                 False,
4246         },
4247         {
4248                 "winreg_RestoreKey",
4249                 sizeof(struct winreg_RestoreKey),
4250                 (ndr_push_flags_fn_t) ndr_push_winreg_RestoreKey,
4251                 (ndr_pull_flags_fn_t) ndr_pull_winreg_RestoreKey,
4252                 (ndr_print_function_t) ndr_print_winreg_RestoreKey,
4253                 False,
4254         },
4255         {
4256                 "winreg_SaveKey",
4257                 sizeof(struct winreg_SaveKey),
4258                 (ndr_push_flags_fn_t) ndr_push_winreg_SaveKey,
4259                 (ndr_pull_flags_fn_t) ndr_pull_winreg_SaveKey,
4260                 (ndr_print_function_t) ndr_print_winreg_SaveKey,
4261                 False,
4262         },
4263         {
4264                 "winreg_SetKeySecurity",
4265                 sizeof(struct winreg_SetKeySecurity),
4266                 (ndr_push_flags_fn_t) ndr_push_winreg_SetKeySecurity,
4267                 (ndr_pull_flags_fn_t) ndr_pull_winreg_SetKeySecurity,
4268                 (ndr_print_function_t) ndr_print_winreg_SetKeySecurity,
4269                 False,
4270         },
4271         {
4272                 "winreg_SetValue",
4273                 sizeof(struct winreg_SetValue),
4274                 (ndr_push_flags_fn_t) ndr_push_winreg_SetValue,
4275                 (ndr_pull_flags_fn_t) ndr_pull_winreg_SetValue,
4276                 (ndr_print_function_t) ndr_print_winreg_SetValue,
4277                 False,
4278         },
4279         {
4280                 "winreg_UnLoadKey",
4281                 sizeof(struct winreg_UnLoadKey),
4282                 (ndr_push_flags_fn_t) ndr_push_winreg_UnLoadKey,
4283                 (ndr_pull_flags_fn_t) ndr_pull_winreg_UnLoadKey,
4284                 (ndr_print_function_t) ndr_print_winreg_UnLoadKey,
4285                 False,
4286         },
4287         {
4288                 "winreg_InitiateSystemShutdown",
4289                 sizeof(struct winreg_InitiateSystemShutdown),
4290                 (ndr_push_flags_fn_t) ndr_push_winreg_InitiateSystemShutdown,
4291                 (ndr_pull_flags_fn_t) ndr_pull_winreg_InitiateSystemShutdown,
4292                 (ndr_print_function_t) ndr_print_winreg_InitiateSystemShutdown,
4293                 False,
4294         },
4295         {
4296                 "winreg_AbortSystemShutdown",
4297                 sizeof(struct winreg_AbortSystemShutdown),
4298                 (ndr_push_flags_fn_t) ndr_push_winreg_AbortSystemShutdown,
4299                 (ndr_pull_flags_fn_t) ndr_pull_winreg_AbortSystemShutdown,
4300                 (ndr_print_function_t) ndr_print_winreg_AbortSystemShutdown,
4301                 False,
4302         },
4303         {
4304                 "winreg_GetVersion",
4305                 sizeof(struct winreg_GetVersion),
4306                 (ndr_push_flags_fn_t) ndr_push_winreg_GetVersion,
4307                 (ndr_pull_flags_fn_t) ndr_pull_winreg_GetVersion,
4308                 (ndr_print_function_t) ndr_print_winreg_GetVersion,
4309                 False,
4310         },
4311         {
4312                 "winreg_OpenHKCC",
4313                 sizeof(struct winreg_OpenHKCC),
4314                 (ndr_push_flags_fn_t) ndr_push_winreg_OpenHKCC,
4315                 (ndr_pull_flags_fn_t) ndr_pull_winreg_OpenHKCC,
4316                 (ndr_print_function_t) ndr_print_winreg_OpenHKCC,
4317                 False,
4318         },
4319         {
4320                 "winreg_OpenHKDD",
4321                 sizeof(struct winreg_OpenHKDD),
4322                 (ndr_push_flags_fn_t) ndr_push_winreg_OpenHKDD,
4323                 (ndr_pull_flags_fn_t) ndr_pull_winreg_OpenHKDD,
4324                 (ndr_print_function_t) ndr_print_winreg_OpenHKDD,
4325                 False,
4326         },
4327         {
4328                 "winreg_QueryMultipleValues",
4329                 sizeof(struct winreg_QueryMultipleValues),
4330                 (ndr_push_flags_fn_t) ndr_push_winreg_QueryMultipleValues,
4331                 (ndr_pull_flags_fn_t) ndr_pull_winreg_QueryMultipleValues,
4332                 (ndr_print_function_t) ndr_print_winreg_QueryMultipleValues,
4333                 False,
4334         },
4335         {
4336                 "winreg_InitiateSystemShutdownEx",
4337                 sizeof(struct winreg_InitiateSystemShutdownEx),
4338                 (ndr_push_flags_fn_t) ndr_push_winreg_InitiateSystemShutdownEx,
4339                 (ndr_pull_flags_fn_t) ndr_pull_winreg_InitiateSystemShutdownEx,
4340                 (ndr_print_function_t) ndr_print_winreg_InitiateSystemShutdownEx,
4341                 False,
4342         },
4343         {
4344                 "winreg_SaveKeyEx",
4345                 sizeof(struct winreg_SaveKeyEx),
4346                 (ndr_push_flags_fn_t) ndr_push_winreg_SaveKeyEx,
4347                 (ndr_pull_flags_fn_t) ndr_pull_winreg_SaveKeyEx,
4348                 (ndr_print_function_t) ndr_print_winreg_SaveKeyEx,
4349                 False,
4350         },
4351         {
4352                 "winreg_OpenHKPT",
4353                 sizeof(struct winreg_OpenHKPT),
4354                 (ndr_push_flags_fn_t) ndr_push_winreg_OpenHKPT,
4355                 (ndr_pull_flags_fn_t) ndr_pull_winreg_OpenHKPT,
4356                 (ndr_print_function_t) ndr_print_winreg_OpenHKPT,
4357                 False,
4358         },
4359         {
4360                 "winreg_OpenHKPN",
4361                 sizeof(struct winreg_OpenHKPN),
4362                 (ndr_push_flags_fn_t) ndr_push_winreg_OpenHKPN,
4363                 (ndr_pull_flags_fn_t) ndr_pull_winreg_OpenHKPN,
4364                 (ndr_print_function_t) ndr_print_winreg_OpenHKPN,
4365                 False,
4366         },
4367         {
4368                 "winreg_QueryMultipleValues2",
4369                 sizeof(struct winreg_QueryMultipleValues2),
4370                 (ndr_push_flags_fn_t) ndr_push_winreg_QueryMultipleValues2,
4371                 (ndr_pull_flags_fn_t) ndr_pull_winreg_QueryMultipleValues2,
4372                 (ndr_print_function_t) ndr_print_winreg_QueryMultipleValues2,
4373                 False,
4374         },
4375         { NULL, 0, NULL, NULL, NULL, False }
4376 };
4377
4378 const char * const winreg_endpoint_strings[] = {
4379         "ncacn_np:[\\pipe\\winreg]", 
4380         "ncacn_ip_tcp:", 
4381         "ncalrpc:", 
4382 };
4383
4384 const struct dcerpc_endpoint_list winreg_endpoints = {
4385         .count  = 3,
4386         .names  = winreg_endpoint_strings
4387 };
4388
4389 const char * const winreg_authservice_strings[] = {
4390         "host", 
4391 };
4392
4393 const struct dcerpc_authservice_list winreg_authservices = {
4394         .count  = 3,
4395         .names  = winreg_authservice_strings
4396 };
4397
4398
4399 const struct dcerpc_interface_table dcerpc_table_winreg = {
4400         .name           = "winreg",
4401         .syntax_id      = {
4402                 {0x338cd001,0x2244,0x31f1,{0xaa,0xaa},{0x90,0x00,0x38,0x00,0x10,0x03}},
4403                 DCERPC_WINREG_VERSION
4404         },
4405         .helpstring     = DCERPC_WINREG_HELPSTRING,
4406         .num_calls      = 35,
4407         .calls          = winreg_calls,
4408         .endpoints      = &winreg_endpoints,
4409         .authservices   = &winreg_authservices
4410 };
4411