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