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