a1acdf8741dd36ee9fe4b2c9e75c87b27731eaad
[tprouty/samba.git] / source / librpc / gen_ndr / srv_winreg.c
1 /*
2  * Unix SMB/CIFS implementation.
3  * server auto-generated by pidl. DO NOT MODIFY!
4  */
5
6 #include "includes.h"
7 #include "librpc/gen_ndr/srv_winreg.h"
8
9 static BOOL api_winreg_OpenHKCR(pipes_struct *p)
10 {
11         struct ndr_pull *pull;
12         struct ndr_push *push;
13         NTSTATUS status;
14         DATA_BLOB blob;
15         struct winreg_OpenHKCR r;
16         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_OpenHKCR");
17         
18         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
19                 talloc_free(mem_ctx);
20                 return False;
21         }
22         
23         pull = ndr_pull_init_blob(&blob, mem_ctx);
24         if (pull == NULL)
25                 return False;
26         
27         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
28         status = ndr_pull_winreg_OpenHKCR(pull, NDR_IN, &r);
29         if (NT_STATUS_IS_ERR(status)) {
30                 talloc_free(mem_ctx);
31                 return False;
32         }
33         
34         if (DEBUGLEVEL >= 10)
35                 NDR_PRINT_IN_DEBUG(winreg_OpenHKCR, &r);
36         
37         ZERO_STRUCT(r.out);
38         r.out.handle = talloc_zero_size(mem_ctx, sizeof(*r.out.handle));
39         if (r.out.handle == NULL) {
40                 talloc_free(mem_ctx);
41                 return False;
42         }
43         
44         r.out.result = _winreg_OpenHKCR(p, r.in.system_name, r.in.access_mask, r.out.handle);
45         
46         if (DEBUGLEVEL >= 10)
47                 NDR_PRINT_OUT_DEBUG(winreg_OpenHKCR, &r);
48         
49         push = ndr_push_init_ctx(mem_ctx);
50         if (push == NULL) {
51                 talloc_free(mem_ctx);
52                 return False;
53         }
54         
55         status = ndr_push_winreg_OpenHKCR(push, NDR_OUT, &r);
56         if (NT_STATUS_IS_ERR(status)) {
57                 talloc_free(mem_ctx);
58                 return False;
59         }
60         
61         blob = ndr_push_blob(push);
62         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
63                 talloc_free(mem_ctx);
64                 return False;
65         }
66         
67         talloc_free(mem_ctx);
68         
69         return True;
70 }
71
72 static BOOL api_winreg_OpenHKCU(pipes_struct *p)
73 {
74         struct ndr_pull *pull;
75         struct ndr_push *push;
76         NTSTATUS status;
77         DATA_BLOB blob;
78         struct winreg_OpenHKCU r;
79         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_OpenHKCU");
80         
81         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
82                 talloc_free(mem_ctx);
83                 return False;
84         }
85         
86         pull = ndr_pull_init_blob(&blob, mem_ctx);
87         if (pull == NULL)
88                 return False;
89         
90         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
91         status = ndr_pull_winreg_OpenHKCU(pull, NDR_IN, &r);
92         if (NT_STATUS_IS_ERR(status)) {
93                 talloc_free(mem_ctx);
94                 return False;
95         }
96         
97         if (DEBUGLEVEL >= 10)
98                 NDR_PRINT_IN_DEBUG(winreg_OpenHKCU, &r);
99         
100         ZERO_STRUCT(r.out);
101         r.out.handle = talloc_zero_size(mem_ctx, sizeof(*r.out.handle));
102         if (r.out.handle == NULL) {
103                 talloc_free(mem_ctx);
104                 return False;
105         }
106         
107         r.out.result = _winreg_OpenHKCU(p, r.in.system_name, r.in.access_mask, r.out.handle);
108         
109         if (DEBUGLEVEL >= 10)
110                 NDR_PRINT_OUT_DEBUG(winreg_OpenHKCU, &r);
111         
112         push = ndr_push_init_ctx(mem_ctx);
113         if (push == NULL) {
114                 talloc_free(mem_ctx);
115                 return False;
116         }
117         
118         status = ndr_push_winreg_OpenHKCU(push, NDR_OUT, &r);
119         if (NT_STATUS_IS_ERR(status)) {
120                 talloc_free(mem_ctx);
121                 return False;
122         }
123         
124         blob = ndr_push_blob(push);
125         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
126                 talloc_free(mem_ctx);
127                 return False;
128         }
129         
130         talloc_free(mem_ctx);
131         
132         return True;
133 }
134
135 static BOOL api_winreg_OpenHKLM(pipes_struct *p)
136 {
137         struct ndr_pull *pull;
138         struct ndr_push *push;
139         NTSTATUS status;
140         DATA_BLOB blob;
141         struct winreg_OpenHKLM r;
142         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_OpenHKLM");
143         
144         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
145                 talloc_free(mem_ctx);
146                 return False;
147         }
148         
149         pull = ndr_pull_init_blob(&blob, mem_ctx);
150         if (pull == NULL)
151                 return False;
152         
153         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
154         status = ndr_pull_winreg_OpenHKLM(pull, NDR_IN, &r);
155         if (NT_STATUS_IS_ERR(status)) {
156                 talloc_free(mem_ctx);
157                 return False;
158         }
159         
160         if (DEBUGLEVEL >= 10)
161                 NDR_PRINT_IN_DEBUG(winreg_OpenHKLM, &r);
162         
163         ZERO_STRUCT(r.out);
164         r.out.handle = talloc_zero_size(mem_ctx, sizeof(*r.out.handle));
165         if (r.out.handle == NULL) {
166                 talloc_free(mem_ctx);
167                 return False;
168         }
169         
170         r.out.result = _winreg_OpenHKLM(p, r.in.system_name, r.in.access_mask, r.out.handle);
171         
172         if (DEBUGLEVEL >= 10)
173                 NDR_PRINT_OUT_DEBUG(winreg_OpenHKLM, &r);
174         
175         push = ndr_push_init_ctx(mem_ctx);
176         if (push == NULL) {
177                 talloc_free(mem_ctx);
178                 return False;
179         }
180         
181         status = ndr_push_winreg_OpenHKLM(push, NDR_OUT, &r);
182         if (NT_STATUS_IS_ERR(status)) {
183                 talloc_free(mem_ctx);
184                 return False;
185         }
186         
187         blob = ndr_push_blob(push);
188         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
189                 talloc_free(mem_ctx);
190                 return False;
191         }
192         
193         talloc_free(mem_ctx);
194         
195         return True;
196 }
197
198 static BOOL api_winreg_OpenHKPD(pipes_struct *p)
199 {
200         struct ndr_pull *pull;
201         struct ndr_push *push;
202         NTSTATUS status;
203         DATA_BLOB blob;
204         struct winreg_OpenHKPD r;
205         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_OpenHKPD");
206         
207         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
208                 talloc_free(mem_ctx);
209                 return False;
210         }
211         
212         pull = ndr_pull_init_blob(&blob, mem_ctx);
213         if (pull == NULL)
214                 return False;
215         
216         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
217         status = ndr_pull_winreg_OpenHKPD(pull, NDR_IN, &r);
218         if (NT_STATUS_IS_ERR(status)) {
219                 talloc_free(mem_ctx);
220                 return False;
221         }
222         
223         if (DEBUGLEVEL >= 10)
224                 NDR_PRINT_IN_DEBUG(winreg_OpenHKPD, &r);
225         
226         ZERO_STRUCT(r.out);
227         r.out.handle = talloc_zero_size(mem_ctx, sizeof(*r.out.handle));
228         if (r.out.handle == NULL) {
229                 talloc_free(mem_ctx);
230                 return False;
231         }
232         
233         r.out.result = _winreg_OpenHKPD(p, r.in.system_name, r.in.access_mask, r.out.handle);
234         
235         if (DEBUGLEVEL >= 10)
236                 NDR_PRINT_OUT_DEBUG(winreg_OpenHKPD, &r);
237         
238         push = ndr_push_init_ctx(mem_ctx);
239         if (push == NULL) {
240                 talloc_free(mem_ctx);
241                 return False;
242         }
243         
244         status = ndr_push_winreg_OpenHKPD(push, NDR_OUT, &r);
245         if (NT_STATUS_IS_ERR(status)) {
246                 talloc_free(mem_ctx);
247                 return False;
248         }
249         
250         blob = ndr_push_blob(push);
251         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
252                 talloc_free(mem_ctx);
253                 return False;
254         }
255         
256         talloc_free(mem_ctx);
257         
258         return True;
259 }
260
261 static BOOL api_winreg_OpenHKU(pipes_struct *p)
262 {
263         struct ndr_pull *pull;
264         struct ndr_push *push;
265         NTSTATUS status;
266         DATA_BLOB blob;
267         struct winreg_OpenHKU r;
268         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_OpenHKU");
269         
270         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
271                 talloc_free(mem_ctx);
272                 return False;
273         }
274         
275         pull = ndr_pull_init_blob(&blob, mem_ctx);
276         if (pull == NULL)
277                 return False;
278         
279         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
280         status = ndr_pull_winreg_OpenHKU(pull, NDR_IN, &r);
281         if (NT_STATUS_IS_ERR(status)) {
282                 talloc_free(mem_ctx);
283                 return False;
284         }
285         
286         if (DEBUGLEVEL >= 10)
287                 NDR_PRINT_IN_DEBUG(winreg_OpenHKU, &r);
288         
289         ZERO_STRUCT(r.out);
290         r.out.handle = talloc_zero_size(mem_ctx, sizeof(*r.out.handle));
291         if (r.out.handle == NULL) {
292                 talloc_free(mem_ctx);
293                 return False;
294         }
295         
296         r.out.result = _winreg_OpenHKU(p, r.in.system_name, r.in.access_mask, r.out.handle);
297         
298         if (DEBUGLEVEL >= 10)
299                 NDR_PRINT_OUT_DEBUG(winreg_OpenHKU, &r);
300         
301         push = ndr_push_init_ctx(mem_ctx);
302         if (push == NULL) {
303                 talloc_free(mem_ctx);
304                 return False;
305         }
306         
307         status = ndr_push_winreg_OpenHKU(push, NDR_OUT, &r);
308         if (NT_STATUS_IS_ERR(status)) {
309                 talloc_free(mem_ctx);
310                 return False;
311         }
312         
313         blob = ndr_push_blob(push);
314         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
315                 talloc_free(mem_ctx);
316                 return False;
317         }
318         
319         talloc_free(mem_ctx);
320         
321         return True;
322 }
323
324 static BOOL api_winreg_CloseKey(pipes_struct *p)
325 {
326         struct ndr_pull *pull;
327         struct ndr_push *push;
328         NTSTATUS status;
329         DATA_BLOB blob;
330         struct winreg_CloseKey r;
331         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_CloseKey");
332         
333         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
334                 talloc_free(mem_ctx);
335                 return False;
336         }
337         
338         pull = ndr_pull_init_blob(&blob, mem_ctx);
339         if (pull == NULL)
340                 return False;
341         
342         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
343         status = ndr_pull_winreg_CloseKey(pull, NDR_IN, &r);
344         if (NT_STATUS_IS_ERR(status)) {
345                 talloc_free(mem_ctx);
346                 return False;
347         }
348         
349         if (DEBUGLEVEL >= 10)
350                 NDR_PRINT_IN_DEBUG(winreg_CloseKey, &r);
351         
352         ZERO_STRUCT(r.out);
353         r.out.handle = r.in.handle;
354         r.out.result = _winreg_CloseKey(p, r.in.handle);
355         
356         if (DEBUGLEVEL >= 10)
357                 NDR_PRINT_OUT_DEBUG(winreg_CloseKey, &r);
358         
359         push = ndr_push_init_ctx(mem_ctx);
360         if (push == NULL) {
361                 talloc_free(mem_ctx);
362                 return False;
363         }
364         
365         status = ndr_push_winreg_CloseKey(push, NDR_OUT, &r);
366         if (NT_STATUS_IS_ERR(status)) {
367                 talloc_free(mem_ctx);
368                 return False;
369         }
370         
371         blob = ndr_push_blob(push);
372         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
373                 talloc_free(mem_ctx);
374                 return False;
375         }
376         
377         talloc_free(mem_ctx);
378         
379         return True;
380 }
381
382 static BOOL api_winreg_CreateKey(pipes_struct *p)
383 {
384         struct ndr_pull *pull;
385         struct ndr_push *push;
386         NTSTATUS status;
387         DATA_BLOB blob;
388         struct winreg_CreateKey r;
389         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_CreateKey");
390         
391         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
392                 talloc_free(mem_ctx);
393                 return False;
394         }
395         
396         pull = ndr_pull_init_blob(&blob, mem_ctx);
397         if (pull == NULL)
398                 return False;
399         
400         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
401         status = ndr_pull_winreg_CreateKey(pull, NDR_IN, &r);
402         if (NT_STATUS_IS_ERR(status)) {
403                 talloc_free(mem_ctx);
404                 return False;
405         }
406         
407         if (DEBUGLEVEL >= 10)
408                 NDR_PRINT_IN_DEBUG(winreg_CreateKey, &r);
409         
410         ZERO_STRUCT(r.out);
411         r.out.new_handle = talloc_zero_size(mem_ctx, sizeof(*r.out.new_handle));
412         if (r.out.new_handle == NULL) {
413                 talloc_free(mem_ctx);
414                 return False;
415         }
416         
417         r.out.action_taken = r.in.action_taken;
418         r.out.result = _winreg_CreateKey(p, r.in.handle, r.in.name, r.in.keyclass, r.in.options, r.in.access_mask, r.in.secdesc, r.out.new_handle, r.in.action_taken);
419         
420         if (DEBUGLEVEL >= 10)
421                 NDR_PRINT_OUT_DEBUG(winreg_CreateKey, &r);
422         
423         push = ndr_push_init_ctx(mem_ctx);
424         if (push == NULL) {
425                 talloc_free(mem_ctx);
426                 return False;
427         }
428         
429         status = ndr_push_winreg_CreateKey(push, NDR_OUT, &r);
430         if (NT_STATUS_IS_ERR(status)) {
431                 talloc_free(mem_ctx);
432                 return False;
433         }
434         
435         blob = ndr_push_blob(push);
436         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
437                 talloc_free(mem_ctx);
438                 return False;
439         }
440         
441         talloc_free(mem_ctx);
442         
443         return True;
444 }
445
446 static BOOL api_winreg_DeleteKey(pipes_struct *p)
447 {
448         struct ndr_pull *pull;
449         struct ndr_push *push;
450         NTSTATUS status;
451         DATA_BLOB blob;
452         struct winreg_DeleteKey r;
453         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_DeleteKey");
454         
455         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
456                 talloc_free(mem_ctx);
457                 return False;
458         }
459         
460         pull = ndr_pull_init_blob(&blob, mem_ctx);
461         if (pull == NULL)
462                 return False;
463         
464         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
465         status = ndr_pull_winreg_DeleteKey(pull, NDR_IN, &r);
466         if (NT_STATUS_IS_ERR(status)) {
467                 talloc_free(mem_ctx);
468                 return False;
469         }
470         
471         if (DEBUGLEVEL >= 10)
472                 NDR_PRINT_IN_DEBUG(winreg_DeleteKey, &r);
473         
474         r.out.result = _winreg_DeleteKey(p, r.in.handle, r.in.key);
475         
476         if (DEBUGLEVEL >= 10)
477                 NDR_PRINT_OUT_DEBUG(winreg_DeleteKey, &r);
478         
479         push = ndr_push_init_ctx(mem_ctx);
480         if (push == NULL) {
481                 talloc_free(mem_ctx);
482                 return False;
483         }
484         
485         status = ndr_push_winreg_DeleteKey(push, NDR_OUT, &r);
486         if (NT_STATUS_IS_ERR(status)) {
487                 talloc_free(mem_ctx);
488                 return False;
489         }
490         
491         blob = ndr_push_blob(push);
492         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
493                 talloc_free(mem_ctx);
494                 return False;
495         }
496         
497         talloc_free(mem_ctx);
498         
499         return True;
500 }
501
502 static BOOL api_winreg_DeleteValue(pipes_struct *p)
503 {
504         struct ndr_pull *pull;
505         struct ndr_push *push;
506         NTSTATUS status;
507         DATA_BLOB blob;
508         struct winreg_DeleteValue r;
509         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_DeleteValue");
510         
511         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
512                 talloc_free(mem_ctx);
513                 return False;
514         }
515         
516         pull = ndr_pull_init_blob(&blob, mem_ctx);
517         if (pull == NULL)
518                 return False;
519         
520         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
521         status = ndr_pull_winreg_DeleteValue(pull, NDR_IN, &r);
522         if (NT_STATUS_IS_ERR(status)) {
523                 talloc_free(mem_ctx);
524                 return False;
525         }
526         
527         if (DEBUGLEVEL >= 10)
528                 NDR_PRINT_IN_DEBUG(winreg_DeleteValue, &r);
529         
530         r.out.result = _winreg_DeleteValue(p, r.in.handle, r.in.value);
531         
532         if (DEBUGLEVEL >= 10)
533                 NDR_PRINT_OUT_DEBUG(winreg_DeleteValue, &r);
534         
535         push = ndr_push_init_ctx(mem_ctx);
536         if (push == NULL) {
537                 talloc_free(mem_ctx);
538                 return False;
539         }
540         
541         status = ndr_push_winreg_DeleteValue(push, NDR_OUT, &r);
542         if (NT_STATUS_IS_ERR(status)) {
543                 talloc_free(mem_ctx);
544                 return False;
545         }
546         
547         blob = ndr_push_blob(push);
548         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
549                 talloc_free(mem_ctx);
550                 return False;
551         }
552         
553         talloc_free(mem_ctx);
554         
555         return True;
556 }
557
558 static BOOL api_winreg_EnumKey(pipes_struct *p)
559 {
560         struct ndr_pull *pull;
561         struct ndr_push *push;
562         NTSTATUS status;
563         DATA_BLOB blob;
564         struct winreg_EnumKey r;
565         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_EnumKey");
566         
567         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
568                 talloc_free(mem_ctx);
569                 return False;
570         }
571         
572         pull = ndr_pull_init_blob(&blob, mem_ctx);
573         if (pull == NULL)
574                 return False;
575         
576         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
577         status = ndr_pull_winreg_EnumKey(pull, NDR_IN, &r);
578         if (NT_STATUS_IS_ERR(status)) {
579                 talloc_free(mem_ctx);
580                 return False;
581         }
582         
583         if (DEBUGLEVEL >= 10)
584                 NDR_PRINT_IN_DEBUG(winreg_EnumKey, &r);
585         
586         ZERO_STRUCT(r.out);
587         r.out.name = r.in.name;
588         r.out.keyclass = r.in.keyclass;
589         r.out.last_changed_time = r.in.last_changed_time;
590         r.out.result = _winreg_EnumKey(p, r.in.handle, r.in.enum_index, r.in.name, r.in.keyclass, r.in.last_changed_time);
591         
592         if (DEBUGLEVEL >= 10)
593                 NDR_PRINT_OUT_DEBUG(winreg_EnumKey, &r);
594         
595         push = ndr_push_init_ctx(mem_ctx);
596         if (push == NULL) {
597                 talloc_free(mem_ctx);
598                 return False;
599         }
600         
601         status = ndr_push_winreg_EnumKey(push, NDR_OUT, &r);
602         if (NT_STATUS_IS_ERR(status)) {
603                 talloc_free(mem_ctx);
604                 return False;
605         }
606         
607         blob = ndr_push_blob(push);
608         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
609                 talloc_free(mem_ctx);
610                 return False;
611         }
612         
613         talloc_free(mem_ctx);
614         
615         return True;
616 }
617
618 static BOOL api_winreg_EnumValue(pipes_struct *p)
619 {
620         struct ndr_pull *pull;
621         struct ndr_push *push;
622         NTSTATUS status;
623         DATA_BLOB blob;
624         struct winreg_EnumValue r;
625         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_EnumValue");
626         
627         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
628                 talloc_free(mem_ctx);
629                 return False;
630         }
631         
632         pull = ndr_pull_init_blob(&blob, mem_ctx);
633         if (pull == NULL)
634                 return False;
635         
636         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
637         status = ndr_pull_winreg_EnumValue(pull, NDR_IN, &r);
638         if (NT_STATUS_IS_ERR(status)) {
639                 talloc_free(mem_ctx);
640                 return False;
641         }
642         
643         if (DEBUGLEVEL >= 10)
644                 NDR_PRINT_IN_DEBUG(winreg_EnumValue, &r);
645         
646         ZERO_STRUCT(r.out);
647         r.out.name = r.in.name;
648         r.out.type = r.in.type;
649         r.out.value = r.in.value;
650         r.out.size = r.in.size;
651         r.out.length = r.in.length;
652         r.out.result = _winreg_EnumValue(p, r.in.handle, r.in.enum_index, r.in.name, r.in.type, r.in.value, r.in.size, r.in.length);
653         
654         if (DEBUGLEVEL >= 10)
655                 NDR_PRINT_OUT_DEBUG(winreg_EnumValue, &r);
656         
657         push = ndr_push_init_ctx(mem_ctx);
658         if (push == NULL) {
659                 talloc_free(mem_ctx);
660                 return False;
661         }
662         
663         status = ndr_push_winreg_EnumValue(push, NDR_OUT, &r);
664         if (NT_STATUS_IS_ERR(status)) {
665                 talloc_free(mem_ctx);
666                 return False;
667         }
668         
669         blob = ndr_push_blob(push);
670         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
671                 talloc_free(mem_ctx);
672                 return False;
673         }
674         
675         talloc_free(mem_ctx);
676         
677         return True;
678 }
679
680 static BOOL api_winreg_FlushKey(pipes_struct *p)
681 {
682         struct ndr_pull *pull;
683         struct ndr_push *push;
684         NTSTATUS status;
685         DATA_BLOB blob;
686         struct winreg_FlushKey r;
687         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_FlushKey");
688         
689         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
690                 talloc_free(mem_ctx);
691                 return False;
692         }
693         
694         pull = ndr_pull_init_blob(&blob, mem_ctx);
695         if (pull == NULL)
696                 return False;
697         
698         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
699         status = ndr_pull_winreg_FlushKey(pull, NDR_IN, &r);
700         if (NT_STATUS_IS_ERR(status)) {
701                 talloc_free(mem_ctx);
702                 return False;
703         }
704         
705         if (DEBUGLEVEL >= 10)
706                 NDR_PRINT_IN_DEBUG(winreg_FlushKey, &r);
707         
708         r.out.result = _winreg_FlushKey(p, r.in.handle);
709         
710         if (DEBUGLEVEL >= 10)
711                 NDR_PRINT_OUT_DEBUG(winreg_FlushKey, &r);
712         
713         push = ndr_push_init_ctx(mem_ctx);
714         if (push == NULL) {
715                 talloc_free(mem_ctx);
716                 return False;
717         }
718         
719         status = ndr_push_winreg_FlushKey(push, NDR_OUT, &r);
720         if (NT_STATUS_IS_ERR(status)) {
721                 talloc_free(mem_ctx);
722                 return False;
723         }
724         
725         blob = ndr_push_blob(push);
726         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
727                 talloc_free(mem_ctx);
728                 return False;
729         }
730         
731         talloc_free(mem_ctx);
732         
733         return True;
734 }
735
736 static BOOL api_winreg_GetKeySecurity(pipes_struct *p)
737 {
738         struct ndr_pull *pull;
739         struct ndr_push *push;
740         NTSTATUS status;
741         DATA_BLOB blob;
742         struct winreg_GetKeySecurity r;
743         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_GetKeySecurity");
744         
745         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
746                 talloc_free(mem_ctx);
747                 return False;
748         }
749         
750         pull = ndr_pull_init_blob(&blob, mem_ctx);
751         if (pull == NULL)
752                 return False;
753         
754         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
755         status = ndr_pull_winreg_GetKeySecurity(pull, NDR_IN, &r);
756         if (NT_STATUS_IS_ERR(status)) {
757                 talloc_free(mem_ctx);
758                 return False;
759         }
760         
761         if (DEBUGLEVEL >= 10)
762                 NDR_PRINT_IN_DEBUG(winreg_GetKeySecurity, &r);
763         
764         ZERO_STRUCT(r.out);
765         r.out.sd = r.in.sd;
766         r.out.result = _winreg_GetKeySecurity(p, r.in.handle, r.in.sec_info, r.in.sd);
767         
768         if (DEBUGLEVEL >= 10)
769                 NDR_PRINT_OUT_DEBUG(winreg_GetKeySecurity, &r);
770         
771         push = ndr_push_init_ctx(mem_ctx);
772         if (push == NULL) {
773                 talloc_free(mem_ctx);
774                 return False;
775         }
776         
777         status = ndr_push_winreg_GetKeySecurity(push, NDR_OUT, &r);
778         if (NT_STATUS_IS_ERR(status)) {
779                 talloc_free(mem_ctx);
780                 return False;
781         }
782         
783         blob = ndr_push_blob(push);
784         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
785                 talloc_free(mem_ctx);
786                 return False;
787         }
788         
789         talloc_free(mem_ctx);
790         
791         return True;
792 }
793
794 static BOOL api_winreg_LoadKey(pipes_struct *p)
795 {
796         struct ndr_pull *pull;
797         struct ndr_push *push;
798         NTSTATUS status;
799         DATA_BLOB blob;
800         struct winreg_LoadKey r;
801         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_LoadKey");
802         
803         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
804                 talloc_free(mem_ctx);
805                 return False;
806         }
807         
808         pull = ndr_pull_init_blob(&blob, mem_ctx);
809         if (pull == NULL)
810                 return False;
811         
812         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
813         status = ndr_pull_winreg_LoadKey(pull, NDR_IN, &r);
814         if (NT_STATUS_IS_ERR(status)) {
815                 talloc_free(mem_ctx);
816                 return False;
817         }
818         
819         if (DEBUGLEVEL >= 10)
820                 NDR_PRINT_IN_DEBUG(winreg_LoadKey, &r);
821         
822         r.out.result = _winreg_LoadKey(p, r.in.handle, r.in.keyname, r.in.filename);
823         
824         if (DEBUGLEVEL >= 10)
825                 NDR_PRINT_OUT_DEBUG(winreg_LoadKey, &r);
826         
827         push = ndr_push_init_ctx(mem_ctx);
828         if (push == NULL) {
829                 talloc_free(mem_ctx);
830                 return False;
831         }
832         
833         status = ndr_push_winreg_LoadKey(push, NDR_OUT, &r);
834         if (NT_STATUS_IS_ERR(status)) {
835                 talloc_free(mem_ctx);
836                 return False;
837         }
838         
839         blob = ndr_push_blob(push);
840         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
841                 talloc_free(mem_ctx);
842                 return False;
843         }
844         
845         talloc_free(mem_ctx);
846         
847         return True;
848 }
849
850 static BOOL api_winreg_NotifyChangeKeyValue(pipes_struct *p)
851 {
852         struct ndr_pull *pull;
853         struct ndr_push *push;
854         NTSTATUS status;
855         DATA_BLOB blob;
856         struct winreg_NotifyChangeKeyValue r;
857         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_NotifyChangeKeyValue");
858         
859         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
860                 talloc_free(mem_ctx);
861                 return False;
862         }
863         
864         pull = ndr_pull_init_blob(&blob, mem_ctx);
865         if (pull == NULL)
866                 return False;
867         
868         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
869         status = ndr_pull_winreg_NotifyChangeKeyValue(pull, NDR_IN, &r);
870         if (NT_STATUS_IS_ERR(status)) {
871                 talloc_free(mem_ctx);
872                 return False;
873         }
874         
875         if (DEBUGLEVEL >= 10)
876                 NDR_PRINT_IN_DEBUG(winreg_NotifyChangeKeyValue, &r);
877         
878         r.out.result = _winreg_NotifyChangeKeyValue(p, r.in.handle, r.in.watch_subtree, r.in.notify_filter, r.in.unknown, r.in.string1, r.in.string2, r.in.unknown2);
879         
880         if (DEBUGLEVEL >= 10)
881                 NDR_PRINT_OUT_DEBUG(winreg_NotifyChangeKeyValue, &r);
882         
883         push = ndr_push_init_ctx(mem_ctx);
884         if (push == NULL) {
885                 talloc_free(mem_ctx);
886                 return False;
887         }
888         
889         status = ndr_push_winreg_NotifyChangeKeyValue(push, NDR_OUT, &r);
890         if (NT_STATUS_IS_ERR(status)) {
891                 talloc_free(mem_ctx);
892                 return False;
893         }
894         
895         blob = ndr_push_blob(push);
896         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
897                 talloc_free(mem_ctx);
898                 return False;
899         }
900         
901         talloc_free(mem_ctx);
902         
903         return True;
904 }
905
906 static BOOL api_winreg_OpenKey(pipes_struct *p)
907 {
908         struct ndr_pull *pull;
909         struct ndr_push *push;
910         NTSTATUS status;
911         DATA_BLOB blob;
912         struct winreg_OpenKey r;
913         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_OpenKey");
914         
915         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
916                 talloc_free(mem_ctx);
917                 return False;
918         }
919         
920         pull = ndr_pull_init_blob(&blob, mem_ctx);
921         if (pull == NULL)
922                 return False;
923         
924         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
925         status = ndr_pull_winreg_OpenKey(pull, NDR_IN, &r);
926         if (NT_STATUS_IS_ERR(status)) {
927                 talloc_free(mem_ctx);
928                 return False;
929         }
930         
931         if (DEBUGLEVEL >= 10)
932                 NDR_PRINT_IN_DEBUG(winreg_OpenKey, &r);
933         
934         ZERO_STRUCT(r.out);
935         r.out.handle = talloc_zero_size(mem_ctx, sizeof(*r.out.handle));
936         if (r.out.handle == NULL) {
937                 talloc_free(mem_ctx);
938                 return False;
939         }
940         
941         r.out.result = _winreg_OpenKey(p, r.in.parent_handle, r.in.keyname, r.in.unknown, r.in.access_mask, r.out.handle);
942         
943         if (DEBUGLEVEL >= 10)
944                 NDR_PRINT_OUT_DEBUG(winreg_OpenKey, &r);
945         
946         push = ndr_push_init_ctx(mem_ctx);
947         if (push == NULL) {
948                 talloc_free(mem_ctx);
949                 return False;
950         }
951         
952         status = ndr_push_winreg_OpenKey(push, NDR_OUT, &r);
953         if (NT_STATUS_IS_ERR(status)) {
954                 talloc_free(mem_ctx);
955                 return False;
956         }
957         
958         blob = ndr_push_blob(push);
959         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
960                 talloc_free(mem_ctx);
961                 return False;
962         }
963         
964         talloc_free(mem_ctx);
965         
966         return True;
967 }
968
969 static BOOL api_winreg_QueryInfoKey(pipes_struct *p)
970 {
971         struct ndr_pull *pull;
972         struct ndr_push *push;
973         NTSTATUS status;
974         DATA_BLOB blob;
975         struct winreg_QueryInfoKey r;
976         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_QueryInfoKey");
977         
978         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
979                 talloc_free(mem_ctx);
980                 return False;
981         }
982         
983         pull = ndr_pull_init_blob(&blob, mem_ctx);
984         if (pull == NULL)
985                 return False;
986         
987         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
988         status = ndr_pull_winreg_QueryInfoKey(pull, NDR_IN, &r);
989         if (NT_STATUS_IS_ERR(status)) {
990                 talloc_free(mem_ctx);
991                 return False;
992         }
993         
994         if (DEBUGLEVEL >= 10)
995                 NDR_PRINT_IN_DEBUG(winreg_QueryInfoKey, &r);
996         
997         ZERO_STRUCT(r.out);
998         r.out.class_out = talloc_zero_size(mem_ctx, sizeof(*r.out.class_out));
999         if (r.out.class_out == NULL) {
1000                 talloc_free(mem_ctx);
1001                 return False;
1002         }
1003         
1004         r.out.num_subkeys = talloc_zero_size(mem_ctx, sizeof(*r.out.num_subkeys));
1005         if (r.out.num_subkeys == NULL) {
1006                 talloc_free(mem_ctx);
1007                 return False;
1008         }
1009         
1010         r.out.max_subkeylen = talloc_zero_size(mem_ctx, sizeof(*r.out.max_subkeylen));
1011         if (r.out.max_subkeylen == NULL) {
1012                 talloc_free(mem_ctx);
1013                 return False;
1014         }
1015         
1016         r.out.max_subkeysize = talloc_zero_size(mem_ctx, sizeof(*r.out.max_subkeysize));
1017         if (r.out.max_subkeysize == NULL) {
1018                 talloc_free(mem_ctx);
1019                 return False;
1020         }
1021         
1022         r.out.num_values = talloc_zero_size(mem_ctx, sizeof(*r.out.num_values));
1023         if (r.out.num_values == NULL) {
1024                 talloc_free(mem_ctx);
1025                 return False;
1026         }
1027         
1028         r.out.max_valnamelen = talloc_zero_size(mem_ctx, sizeof(*r.out.max_valnamelen));
1029         if (r.out.max_valnamelen == NULL) {
1030                 talloc_free(mem_ctx);
1031                 return False;
1032         }
1033         
1034         r.out.max_valbufsize = talloc_zero_size(mem_ctx, sizeof(*r.out.max_valbufsize));
1035         if (r.out.max_valbufsize == NULL) {
1036                 talloc_free(mem_ctx);
1037                 return False;
1038         }
1039         
1040         r.out.secdescsize = talloc_zero_size(mem_ctx, sizeof(*r.out.secdescsize));
1041         if (r.out.secdescsize == NULL) {
1042                 talloc_free(mem_ctx);
1043                 return False;
1044         }
1045         
1046         r.out.last_changed_time = talloc_zero_size(mem_ctx, sizeof(*r.out.last_changed_time));
1047         if (r.out.last_changed_time == NULL) {
1048                 talloc_free(mem_ctx);
1049                 return False;
1050         }
1051         
1052         r.out.result = _winreg_QueryInfoKey(p, r.in.handle, r.in.class_in, r.out.class_out, r.out.num_subkeys, r.out.max_subkeylen, r.out.max_subkeysize, r.out.num_values, r.out.max_valnamelen, r.out.max_valbufsize, r.out.secdescsize, r.out.last_changed_time);
1053         
1054         if (DEBUGLEVEL >= 10)
1055                 NDR_PRINT_OUT_DEBUG(winreg_QueryInfoKey, &r);
1056         
1057         push = ndr_push_init_ctx(mem_ctx);
1058         if (push == NULL) {
1059                 talloc_free(mem_ctx);
1060                 return False;
1061         }
1062         
1063         status = ndr_push_winreg_QueryInfoKey(push, NDR_OUT, &r);
1064         if (NT_STATUS_IS_ERR(status)) {
1065                 talloc_free(mem_ctx);
1066                 return False;
1067         }
1068         
1069         blob = ndr_push_blob(push);
1070         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
1071                 talloc_free(mem_ctx);
1072                 return False;
1073         }
1074         
1075         talloc_free(mem_ctx);
1076         
1077         return True;
1078 }
1079
1080 static BOOL api_winreg_QueryValue(pipes_struct *p)
1081 {
1082         struct ndr_pull *pull;
1083         struct ndr_push *push;
1084         NTSTATUS status;
1085         DATA_BLOB blob;
1086         struct winreg_QueryValue r;
1087         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_QueryValue");
1088         
1089         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
1090                 talloc_free(mem_ctx);
1091                 return False;
1092         }
1093         
1094         pull = ndr_pull_init_blob(&blob, mem_ctx);
1095         if (pull == NULL)
1096                 return False;
1097         
1098         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1099         status = ndr_pull_winreg_QueryValue(pull, NDR_IN, &r);
1100         if (NT_STATUS_IS_ERR(status)) {
1101                 talloc_free(mem_ctx);
1102                 return False;
1103         }
1104         
1105         if (DEBUGLEVEL >= 10)
1106                 NDR_PRINT_IN_DEBUG(winreg_QueryValue, &r);
1107         
1108         ZERO_STRUCT(r.out);
1109         r.out.type = r.in.type;
1110         r.out.data = r.in.data;
1111         r.out.data_size = r.in.data_size;
1112         r.out.value_length = r.in.value_length;
1113         r.out.result = _winreg_QueryValue(p, r.in.handle, r.in.value_name, r.in.type, r.in.data, r.in.data_size, r.in.value_length);
1114         
1115         if (DEBUGLEVEL >= 10)
1116                 NDR_PRINT_OUT_DEBUG(winreg_QueryValue, &r);
1117         
1118         push = ndr_push_init_ctx(mem_ctx);
1119         if (push == NULL) {
1120                 talloc_free(mem_ctx);
1121                 return False;
1122         }
1123         
1124         status = ndr_push_winreg_QueryValue(push, NDR_OUT, &r);
1125         if (NT_STATUS_IS_ERR(status)) {
1126                 talloc_free(mem_ctx);
1127                 return False;
1128         }
1129         
1130         blob = ndr_push_blob(push);
1131         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
1132                 talloc_free(mem_ctx);
1133                 return False;
1134         }
1135         
1136         talloc_free(mem_ctx);
1137         
1138         return True;
1139 }
1140
1141 static BOOL api_winreg_ReplaceKey(pipes_struct *p)
1142 {
1143         struct ndr_pull *pull;
1144         struct ndr_push *push;
1145         NTSTATUS status;
1146         DATA_BLOB blob;
1147         struct winreg_ReplaceKey r;
1148         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_ReplaceKey");
1149         
1150         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
1151                 talloc_free(mem_ctx);
1152                 return False;
1153         }
1154         
1155         pull = ndr_pull_init_blob(&blob, mem_ctx);
1156         if (pull == NULL)
1157                 return False;
1158         
1159         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1160         status = ndr_pull_winreg_ReplaceKey(pull, NDR_IN, &r);
1161         if (NT_STATUS_IS_ERR(status)) {
1162                 talloc_free(mem_ctx);
1163                 return False;
1164         }
1165         
1166         if (DEBUGLEVEL >= 10)
1167                 NDR_PRINT_IN_DEBUG(winreg_ReplaceKey, &r);
1168         
1169         r.out.result = _winreg_ReplaceKey(p);
1170         
1171         if (DEBUGLEVEL >= 10)
1172                 NDR_PRINT_OUT_DEBUG(winreg_ReplaceKey, &r);
1173         
1174         push = ndr_push_init_ctx(mem_ctx);
1175         if (push == NULL) {
1176                 talloc_free(mem_ctx);
1177                 return False;
1178         }
1179         
1180         status = ndr_push_winreg_ReplaceKey(push, NDR_OUT, &r);
1181         if (NT_STATUS_IS_ERR(status)) {
1182                 talloc_free(mem_ctx);
1183                 return False;
1184         }
1185         
1186         blob = ndr_push_blob(push);
1187         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
1188                 talloc_free(mem_ctx);
1189                 return False;
1190         }
1191         
1192         talloc_free(mem_ctx);
1193         
1194         return True;
1195 }
1196
1197 static BOOL api_winreg_RestoreKey(pipes_struct *p)
1198 {
1199         struct ndr_pull *pull;
1200         struct ndr_push *push;
1201         NTSTATUS status;
1202         DATA_BLOB blob;
1203         struct winreg_RestoreKey r;
1204         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_RestoreKey");
1205         
1206         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
1207                 talloc_free(mem_ctx);
1208                 return False;
1209         }
1210         
1211         pull = ndr_pull_init_blob(&blob, mem_ctx);
1212         if (pull == NULL)
1213                 return False;
1214         
1215         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1216         status = ndr_pull_winreg_RestoreKey(pull, NDR_IN, &r);
1217         if (NT_STATUS_IS_ERR(status)) {
1218                 talloc_free(mem_ctx);
1219                 return False;
1220         }
1221         
1222         if (DEBUGLEVEL >= 10)
1223                 NDR_PRINT_IN_DEBUG(winreg_RestoreKey, &r);
1224         
1225         r.out.result = _winreg_RestoreKey(p);
1226         
1227         if (DEBUGLEVEL >= 10)
1228                 NDR_PRINT_OUT_DEBUG(winreg_RestoreKey, &r);
1229         
1230         push = ndr_push_init_ctx(mem_ctx);
1231         if (push == NULL) {
1232                 talloc_free(mem_ctx);
1233                 return False;
1234         }
1235         
1236         status = ndr_push_winreg_RestoreKey(push, NDR_OUT, &r);
1237         if (NT_STATUS_IS_ERR(status)) {
1238                 talloc_free(mem_ctx);
1239                 return False;
1240         }
1241         
1242         blob = ndr_push_blob(push);
1243         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
1244                 talloc_free(mem_ctx);
1245                 return False;
1246         }
1247         
1248         talloc_free(mem_ctx);
1249         
1250         return True;
1251 }
1252
1253 static BOOL api_winreg_SaveKey(pipes_struct *p)
1254 {
1255         struct ndr_pull *pull;
1256         struct ndr_push *push;
1257         NTSTATUS status;
1258         DATA_BLOB blob;
1259         struct winreg_SaveKey r;
1260         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_SaveKey");
1261         
1262         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
1263                 talloc_free(mem_ctx);
1264                 return False;
1265         }
1266         
1267         pull = ndr_pull_init_blob(&blob, mem_ctx);
1268         if (pull == NULL)
1269                 return False;
1270         
1271         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1272         status = ndr_pull_winreg_SaveKey(pull, NDR_IN, &r);
1273         if (NT_STATUS_IS_ERR(status)) {
1274                 talloc_free(mem_ctx);
1275                 return False;
1276         }
1277         
1278         if (DEBUGLEVEL >= 10)
1279                 NDR_PRINT_IN_DEBUG(winreg_SaveKey, &r);
1280         
1281         r.out.result = _winreg_SaveKey(p);
1282         
1283         if (DEBUGLEVEL >= 10)
1284                 NDR_PRINT_OUT_DEBUG(winreg_SaveKey, &r);
1285         
1286         push = ndr_push_init_ctx(mem_ctx);
1287         if (push == NULL) {
1288                 talloc_free(mem_ctx);
1289                 return False;
1290         }
1291         
1292         status = ndr_push_winreg_SaveKey(push, NDR_OUT, &r);
1293         if (NT_STATUS_IS_ERR(status)) {
1294                 talloc_free(mem_ctx);
1295                 return False;
1296         }
1297         
1298         blob = ndr_push_blob(push);
1299         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
1300                 talloc_free(mem_ctx);
1301                 return False;
1302         }
1303         
1304         talloc_free(mem_ctx);
1305         
1306         return True;
1307 }
1308
1309 static BOOL api_winreg_SetKeySecurity(pipes_struct *p)
1310 {
1311         struct ndr_pull *pull;
1312         struct ndr_push *push;
1313         NTSTATUS status;
1314         DATA_BLOB blob;
1315         struct winreg_SetKeySecurity r;
1316         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_SetKeySecurity");
1317         
1318         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
1319                 talloc_free(mem_ctx);
1320                 return False;
1321         }
1322         
1323         pull = ndr_pull_init_blob(&blob, mem_ctx);
1324         if (pull == NULL)
1325                 return False;
1326         
1327         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1328         status = ndr_pull_winreg_SetKeySecurity(pull, NDR_IN, &r);
1329         if (NT_STATUS_IS_ERR(status)) {
1330                 talloc_free(mem_ctx);
1331                 return False;
1332         }
1333         
1334         if (DEBUGLEVEL >= 10)
1335                 NDR_PRINT_IN_DEBUG(winreg_SetKeySecurity, &r);
1336         
1337         ZERO_STRUCT(r.out);
1338         r.out.sd = r.in.sd;
1339         r.out.result = _winreg_SetKeySecurity(p, r.in.handle, r.in.access_mask, r.in.sd);
1340         
1341         if (DEBUGLEVEL >= 10)
1342                 NDR_PRINT_OUT_DEBUG(winreg_SetKeySecurity, &r);
1343         
1344         push = ndr_push_init_ctx(mem_ctx);
1345         if (push == NULL) {
1346                 talloc_free(mem_ctx);
1347                 return False;
1348         }
1349         
1350         status = ndr_push_winreg_SetKeySecurity(push, NDR_OUT, &r);
1351         if (NT_STATUS_IS_ERR(status)) {
1352                 talloc_free(mem_ctx);
1353                 return False;
1354         }
1355         
1356         blob = ndr_push_blob(push);
1357         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
1358                 talloc_free(mem_ctx);
1359                 return False;
1360         }
1361         
1362         talloc_free(mem_ctx);
1363         
1364         return True;
1365 }
1366
1367 static BOOL api_winreg_SetValue(pipes_struct *p)
1368 {
1369         struct ndr_pull *pull;
1370         struct ndr_push *push;
1371         NTSTATUS status;
1372         DATA_BLOB blob;
1373         struct winreg_SetValue r;
1374         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_SetValue");
1375         
1376         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
1377                 talloc_free(mem_ctx);
1378                 return False;
1379         }
1380         
1381         pull = ndr_pull_init_blob(&blob, mem_ctx);
1382         if (pull == NULL)
1383                 return False;
1384         
1385         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1386         status = ndr_pull_winreg_SetValue(pull, NDR_IN, &r);
1387         if (NT_STATUS_IS_ERR(status)) {
1388                 talloc_free(mem_ctx);
1389                 return False;
1390         }
1391         
1392         if (DEBUGLEVEL >= 10)
1393                 NDR_PRINT_IN_DEBUG(winreg_SetValue, &r);
1394         
1395         r.out.result = _winreg_SetValue(p, r.in.handle, r.in.name, r.in.type, r.in.data, r.in.size);
1396         
1397         if (DEBUGLEVEL >= 10)
1398                 NDR_PRINT_OUT_DEBUG(winreg_SetValue, &r);
1399         
1400         push = ndr_push_init_ctx(mem_ctx);
1401         if (push == NULL) {
1402                 talloc_free(mem_ctx);
1403                 return False;
1404         }
1405         
1406         status = ndr_push_winreg_SetValue(push, NDR_OUT, &r);
1407         if (NT_STATUS_IS_ERR(status)) {
1408                 talloc_free(mem_ctx);
1409                 return False;
1410         }
1411         
1412         blob = ndr_push_blob(push);
1413         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
1414                 talloc_free(mem_ctx);
1415                 return False;
1416         }
1417         
1418         talloc_free(mem_ctx);
1419         
1420         return True;
1421 }
1422
1423 static BOOL api_winreg_UnLoadKey(pipes_struct *p)
1424 {
1425         struct ndr_pull *pull;
1426         struct ndr_push *push;
1427         NTSTATUS status;
1428         DATA_BLOB blob;
1429         struct winreg_UnLoadKey r;
1430         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_UnLoadKey");
1431         
1432         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
1433                 talloc_free(mem_ctx);
1434                 return False;
1435         }
1436         
1437         pull = ndr_pull_init_blob(&blob, mem_ctx);
1438         if (pull == NULL)
1439                 return False;
1440         
1441         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1442         status = ndr_pull_winreg_UnLoadKey(pull, NDR_IN, &r);
1443         if (NT_STATUS_IS_ERR(status)) {
1444                 talloc_free(mem_ctx);
1445                 return False;
1446         }
1447         
1448         if (DEBUGLEVEL >= 10)
1449                 NDR_PRINT_IN_DEBUG(winreg_UnLoadKey, &r);
1450         
1451         r.out.result = _winreg_UnLoadKey(p);
1452         
1453         if (DEBUGLEVEL >= 10)
1454                 NDR_PRINT_OUT_DEBUG(winreg_UnLoadKey, &r);
1455         
1456         push = ndr_push_init_ctx(mem_ctx);
1457         if (push == NULL) {
1458                 talloc_free(mem_ctx);
1459                 return False;
1460         }
1461         
1462         status = ndr_push_winreg_UnLoadKey(push, NDR_OUT, &r);
1463         if (NT_STATUS_IS_ERR(status)) {
1464                 talloc_free(mem_ctx);
1465                 return False;
1466         }
1467         
1468         blob = ndr_push_blob(push);
1469         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
1470                 talloc_free(mem_ctx);
1471                 return False;
1472         }
1473         
1474         talloc_free(mem_ctx);
1475         
1476         return True;
1477 }
1478
1479 static BOOL api_winreg_InitiateSystemShutdown(pipes_struct *p)
1480 {
1481         struct ndr_pull *pull;
1482         struct ndr_push *push;
1483         NTSTATUS status;
1484         DATA_BLOB blob;
1485         struct winreg_InitiateSystemShutdown r;
1486         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_InitiateSystemShutdown");
1487         
1488         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
1489                 talloc_free(mem_ctx);
1490                 return False;
1491         }
1492         
1493         pull = ndr_pull_init_blob(&blob, mem_ctx);
1494         if (pull == NULL)
1495                 return False;
1496         
1497         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1498         status = ndr_pull_winreg_InitiateSystemShutdown(pull, NDR_IN, &r);
1499         if (NT_STATUS_IS_ERR(status)) {
1500                 talloc_free(mem_ctx);
1501                 return False;
1502         }
1503         
1504         if (DEBUGLEVEL >= 10)
1505                 NDR_PRINT_IN_DEBUG(winreg_InitiateSystemShutdown, &r);
1506         
1507         r.out.result = _winreg_InitiateSystemShutdown(p, r.in.hostname, r.in.message, r.in.timeout, r.in.force_apps, r.in.reboot);
1508         
1509         if (DEBUGLEVEL >= 10)
1510                 NDR_PRINT_OUT_DEBUG(winreg_InitiateSystemShutdown, &r);
1511         
1512         push = ndr_push_init_ctx(mem_ctx);
1513         if (push == NULL) {
1514                 talloc_free(mem_ctx);
1515                 return False;
1516         }
1517         
1518         status = ndr_push_winreg_InitiateSystemShutdown(push, NDR_OUT, &r);
1519         if (NT_STATUS_IS_ERR(status)) {
1520                 talloc_free(mem_ctx);
1521                 return False;
1522         }
1523         
1524         blob = ndr_push_blob(push);
1525         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
1526                 talloc_free(mem_ctx);
1527                 return False;
1528         }
1529         
1530         talloc_free(mem_ctx);
1531         
1532         return True;
1533 }
1534
1535 static BOOL api_winreg_AbortSystemShutdown(pipes_struct *p)
1536 {
1537         struct ndr_pull *pull;
1538         struct ndr_push *push;
1539         NTSTATUS status;
1540         DATA_BLOB blob;
1541         struct winreg_AbortSystemShutdown r;
1542         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_AbortSystemShutdown");
1543         
1544         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
1545                 talloc_free(mem_ctx);
1546                 return False;
1547         }
1548         
1549         pull = ndr_pull_init_blob(&blob, mem_ctx);
1550         if (pull == NULL)
1551                 return False;
1552         
1553         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1554         status = ndr_pull_winreg_AbortSystemShutdown(pull, NDR_IN, &r);
1555         if (NT_STATUS_IS_ERR(status)) {
1556                 talloc_free(mem_ctx);
1557                 return False;
1558         }
1559         
1560         if (DEBUGLEVEL >= 10)
1561                 NDR_PRINT_IN_DEBUG(winreg_AbortSystemShutdown, &r);
1562         
1563         r.out.result = _winreg_AbortSystemShutdown(p, r.in.server);
1564         
1565         if (DEBUGLEVEL >= 10)
1566                 NDR_PRINT_OUT_DEBUG(winreg_AbortSystemShutdown, &r);
1567         
1568         push = ndr_push_init_ctx(mem_ctx);
1569         if (push == NULL) {
1570                 talloc_free(mem_ctx);
1571                 return False;
1572         }
1573         
1574         status = ndr_push_winreg_AbortSystemShutdown(push, NDR_OUT, &r);
1575         if (NT_STATUS_IS_ERR(status)) {
1576                 talloc_free(mem_ctx);
1577                 return False;
1578         }
1579         
1580         blob = ndr_push_blob(push);
1581         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
1582                 talloc_free(mem_ctx);
1583                 return False;
1584         }
1585         
1586         talloc_free(mem_ctx);
1587         
1588         return True;
1589 }
1590
1591 static BOOL api_winreg_GetVersion(pipes_struct *p)
1592 {
1593         struct ndr_pull *pull;
1594         struct ndr_push *push;
1595         NTSTATUS status;
1596         DATA_BLOB blob;
1597         struct winreg_GetVersion r;
1598         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_GetVersion");
1599         
1600         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
1601                 talloc_free(mem_ctx);
1602                 return False;
1603         }
1604         
1605         pull = ndr_pull_init_blob(&blob, mem_ctx);
1606         if (pull == NULL)
1607                 return False;
1608         
1609         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1610         status = ndr_pull_winreg_GetVersion(pull, NDR_IN, &r);
1611         if (NT_STATUS_IS_ERR(status)) {
1612                 talloc_free(mem_ctx);
1613                 return False;
1614         }
1615         
1616         if (DEBUGLEVEL >= 10)
1617                 NDR_PRINT_IN_DEBUG(winreg_GetVersion, &r);
1618         
1619         ZERO_STRUCT(r.out);
1620         r.out.version = talloc_zero_size(mem_ctx, sizeof(*r.out.version));
1621         if (r.out.version == NULL) {
1622                 talloc_free(mem_ctx);
1623                 return False;
1624         }
1625         
1626         r.out.result = _winreg_GetVersion(p, r.in.handle, r.out.version);
1627         
1628         if (DEBUGLEVEL >= 10)
1629                 NDR_PRINT_OUT_DEBUG(winreg_GetVersion, &r);
1630         
1631         push = ndr_push_init_ctx(mem_ctx);
1632         if (push == NULL) {
1633                 talloc_free(mem_ctx);
1634                 return False;
1635         }
1636         
1637         status = ndr_push_winreg_GetVersion(push, NDR_OUT, &r);
1638         if (NT_STATUS_IS_ERR(status)) {
1639                 talloc_free(mem_ctx);
1640                 return False;
1641         }
1642         
1643         blob = ndr_push_blob(push);
1644         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
1645                 talloc_free(mem_ctx);
1646                 return False;
1647         }
1648         
1649         talloc_free(mem_ctx);
1650         
1651         return True;
1652 }
1653
1654 static BOOL api_winreg_OpenHKCC(pipes_struct *p)
1655 {
1656         struct ndr_pull *pull;
1657         struct ndr_push *push;
1658         NTSTATUS status;
1659         DATA_BLOB blob;
1660         struct winreg_OpenHKCC r;
1661         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_OpenHKCC");
1662         
1663         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
1664                 talloc_free(mem_ctx);
1665                 return False;
1666         }
1667         
1668         pull = ndr_pull_init_blob(&blob, mem_ctx);
1669         if (pull == NULL)
1670                 return False;
1671         
1672         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1673         status = ndr_pull_winreg_OpenHKCC(pull, NDR_IN, &r);
1674         if (NT_STATUS_IS_ERR(status)) {
1675                 talloc_free(mem_ctx);
1676                 return False;
1677         }
1678         
1679         if (DEBUGLEVEL >= 10)
1680                 NDR_PRINT_IN_DEBUG(winreg_OpenHKCC, &r);
1681         
1682         ZERO_STRUCT(r.out);
1683         r.out.handle = talloc_zero_size(mem_ctx, sizeof(*r.out.handle));
1684         if (r.out.handle == NULL) {
1685                 talloc_free(mem_ctx);
1686                 return False;
1687         }
1688         
1689         r.out.result = _winreg_OpenHKCC(p, r.in.system_name, r.in.access_mask, r.out.handle);
1690         
1691         if (DEBUGLEVEL >= 10)
1692                 NDR_PRINT_OUT_DEBUG(winreg_OpenHKCC, &r);
1693         
1694         push = ndr_push_init_ctx(mem_ctx);
1695         if (push == NULL) {
1696                 talloc_free(mem_ctx);
1697                 return False;
1698         }
1699         
1700         status = ndr_push_winreg_OpenHKCC(push, NDR_OUT, &r);
1701         if (NT_STATUS_IS_ERR(status)) {
1702                 talloc_free(mem_ctx);
1703                 return False;
1704         }
1705         
1706         blob = ndr_push_blob(push);
1707         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
1708                 talloc_free(mem_ctx);
1709                 return False;
1710         }
1711         
1712         talloc_free(mem_ctx);
1713         
1714         return True;
1715 }
1716
1717 static BOOL api_winreg_OpenHKDD(pipes_struct *p)
1718 {
1719         struct ndr_pull *pull;
1720         struct ndr_push *push;
1721         NTSTATUS status;
1722         DATA_BLOB blob;
1723         struct winreg_OpenHKDD r;
1724         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_OpenHKDD");
1725         
1726         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
1727                 talloc_free(mem_ctx);
1728                 return False;
1729         }
1730         
1731         pull = ndr_pull_init_blob(&blob, mem_ctx);
1732         if (pull == NULL)
1733                 return False;
1734         
1735         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1736         status = ndr_pull_winreg_OpenHKDD(pull, NDR_IN, &r);
1737         if (NT_STATUS_IS_ERR(status)) {
1738                 talloc_free(mem_ctx);
1739                 return False;
1740         }
1741         
1742         if (DEBUGLEVEL >= 10)
1743                 NDR_PRINT_IN_DEBUG(winreg_OpenHKDD, &r);
1744         
1745         ZERO_STRUCT(r.out);
1746         r.out.handle = talloc_zero_size(mem_ctx, sizeof(*r.out.handle));
1747         if (r.out.handle == NULL) {
1748                 talloc_free(mem_ctx);
1749                 return False;
1750         }
1751         
1752         r.out.result = _winreg_OpenHKDD(p, r.in.system_name, r.in.access_mask, r.out.handle);
1753         
1754         if (DEBUGLEVEL >= 10)
1755                 NDR_PRINT_OUT_DEBUG(winreg_OpenHKDD, &r);
1756         
1757         push = ndr_push_init_ctx(mem_ctx);
1758         if (push == NULL) {
1759                 talloc_free(mem_ctx);
1760                 return False;
1761         }
1762         
1763         status = ndr_push_winreg_OpenHKDD(push, NDR_OUT, &r);
1764         if (NT_STATUS_IS_ERR(status)) {
1765                 talloc_free(mem_ctx);
1766                 return False;
1767         }
1768         
1769         blob = ndr_push_blob(push);
1770         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
1771                 talloc_free(mem_ctx);
1772                 return False;
1773         }
1774         
1775         talloc_free(mem_ctx);
1776         
1777         return True;
1778 }
1779
1780 static BOOL api_winreg_QueryMultipleValues(pipes_struct *p)
1781 {
1782         struct ndr_pull *pull;
1783         struct ndr_push *push;
1784         NTSTATUS status;
1785         DATA_BLOB blob;
1786         struct winreg_QueryMultipleValues r;
1787         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_QueryMultipleValues");
1788         
1789         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
1790                 talloc_free(mem_ctx);
1791                 return False;
1792         }
1793         
1794         pull = ndr_pull_init_blob(&blob, mem_ctx);
1795         if (pull == NULL)
1796                 return False;
1797         
1798         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1799         status = ndr_pull_winreg_QueryMultipleValues(pull, NDR_IN, &r);
1800         if (NT_STATUS_IS_ERR(status)) {
1801                 talloc_free(mem_ctx);
1802                 return False;
1803         }
1804         
1805         if (DEBUGLEVEL >= 10)
1806                 NDR_PRINT_IN_DEBUG(winreg_QueryMultipleValues, &r);
1807         
1808         ZERO_STRUCT(r.out);
1809         r.out.values = r.in.values;
1810         r.out.buffer = r.in.buffer;
1811         r.out.buffer_size = r.in.buffer_size;
1812         r.out.result = _winreg_QueryMultipleValues(p, r.in.key_handle, r.in.values, r.in.num_values, r.in.buffer, r.in.buffer_size);
1813         
1814         if (DEBUGLEVEL >= 10)
1815                 NDR_PRINT_OUT_DEBUG(winreg_QueryMultipleValues, &r);
1816         
1817         push = ndr_push_init_ctx(mem_ctx);
1818         if (push == NULL) {
1819                 talloc_free(mem_ctx);
1820                 return False;
1821         }
1822         
1823         status = ndr_push_winreg_QueryMultipleValues(push, NDR_OUT, &r);
1824         if (NT_STATUS_IS_ERR(status)) {
1825                 talloc_free(mem_ctx);
1826                 return False;
1827         }
1828         
1829         blob = ndr_push_blob(push);
1830         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
1831                 talloc_free(mem_ctx);
1832                 return False;
1833         }
1834         
1835         talloc_free(mem_ctx);
1836         
1837         return True;
1838 }
1839
1840 static BOOL api_winreg_InitiateSystemShutdownEx(pipes_struct *p)
1841 {
1842         struct ndr_pull *pull;
1843         struct ndr_push *push;
1844         NTSTATUS status;
1845         DATA_BLOB blob;
1846         struct winreg_InitiateSystemShutdownEx r;
1847         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_InitiateSystemShutdownEx");
1848         
1849         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
1850                 talloc_free(mem_ctx);
1851                 return False;
1852         }
1853         
1854         pull = ndr_pull_init_blob(&blob, mem_ctx);
1855         if (pull == NULL)
1856                 return False;
1857         
1858         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1859         status = ndr_pull_winreg_InitiateSystemShutdownEx(pull, NDR_IN, &r);
1860         if (NT_STATUS_IS_ERR(status)) {
1861                 talloc_free(mem_ctx);
1862                 return False;
1863         }
1864         
1865         if (DEBUGLEVEL >= 10)
1866                 NDR_PRINT_IN_DEBUG(winreg_InitiateSystemShutdownEx, &r);
1867         
1868         r.out.result = _winreg_InitiateSystemShutdownEx(p, r.in.hostname, r.in.message, r.in.timeout, r.in.force_apps, r.in.reboot, r.in.reason);
1869         
1870         if (DEBUGLEVEL >= 10)
1871                 NDR_PRINT_OUT_DEBUG(winreg_InitiateSystemShutdownEx, &r);
1872         
1873         push = ndr_push_init_ctx(mem_ctx);
1874         if (push == NULL) {
1875                 talloc_free(mem_ctx);
1876                 return False;
1877         }
1878         
1879         status = ndr_push_winreg_InitiateSystemShutdownEx(push, NDR_OUT, &r);
1880         if (NT_STATUS_IS_ERR(status)) {
1881                 talloc_free(mem_ctx);
1882                 return False;
1883         }
1884         
1885         blob = ndr_push_blob(push);
1886         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
1887                 talloc_free(mem_ctx);
1888                 return False;
1889         }
1890         
1891         talloc_free(mem_ctx);
1892         
1893         return True;
1894 }
1895
1896 static BOOL api_winreg_SaveKeyEx(pipes_struct *p)
1897 {
1898         struct ndr_pull *pull;
1899         struct ndr_push *push;
1900         NTSTATUS status;
1901         DATA_BLOB blob;
1902         struct winreg_SaveKeyEx r;
1903         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_SaveKeyEx");
1904         
1905         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
1906                 talloc_free(mem_ctx);
1907                 return False;
1908         }
1909         
1910         pull = ndr_pull_init_blob(&blob, mem_ctx);
1911         if (pull == NULL)
1912                 return False;
1913         
1914         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1915         status = ndr_pull_winreg_SaveKeyEx(pull, NDR_IN, &r);
1916         if (NT_STATUS_IS_ERR(status)) {
1917                 talloc_free(mem_ctx);
1918                 return False;
1919         }
1920         
1921         if (DEBUGLEVEL >= 10)
1922                 NDR_PRINT_IN_DEBUG(winreg_SaveKeyEx, &r);
1923         
1924         r.out.result = _winreg_SaveKeyEx(p);
1925         
1926         if (DEBUGLEVEL >= 10)
1927                 NDR_PRINT_OUT_DEBUG(winreg_SaveKeyEx, &r);
1928         
1929         push = ndr_push_init_ctx(mem_ctx);
1930         if (push == NULL) {
1931                 talloc_free(mem_ctx);
1932                 return False;
1933         }
1934         
1935         status = ndr_push_winreg_SaveKeyEx(push, NDR_OUT, &r);
1936         if (NT_STATUS_IS_ERR(status)) {
1937                 talloc_free(mem_ctx);
1938                 return False;
1939         }
1940         
1941         blob = ndr_push_blob(push);
1942         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
1943                 talloc_free(mem_ctx);
1944                 return False;
1945         }
1946         
1947         talloc_free(mem_ctx);
1948         
1949         return True;
1950 }
1951
1952 static BOOL api_winreg_OpenHKPT(pipes_struct *p)
1953 {
1954         struct ndr_pull *pull;
1955         struct ndr_push *push;
1956         NTSTATUS status;
1957         DATA_BLOB blob;
1958         struct winreg_OpenHKPT r;
1959         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_OpenHKPT");
1960         
1961         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
1962                 talloc_free(mem_ctx);
1963                 return False;
1964         }
1965         
1966         pull = ndr_pull_init_blob(&blob, mem_ctx);
1967         if (pull == NULL)
1968                 return False;
1969         
1970         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1971         status = ndr_pull_winreg_OpenHKPT(pull, NDR_IN, &r);
1972         if (NT_STATUS_IS_ERR(status)) {
1973                 talloc_free(mem_ctx);
1974                 return False;
1975         }
1976         
1977         if (DEBUGLEVEL >= 10)
1978                 NDR_PRINT_IN_DEBUG(winreg_OpenHKPT, &r);
1979         
1980         ZERO_STRUCT(r.out);
1981         r.out.handle = talloc_zero_size(mem_ctx, sizeof(*r.out.handle));
1982         if (r.out.handle == NULL) {
1983                 talloc_free(mem_ctx);
1984                 return False;
1985         }
1986         
1987         r.out.result = _winreg_OpenHKPT(p, r.in.system_name, r.in.access_mask, r.out.handle);
1988         
1989         if (DEBUGLEVEL >= 10)
1990                 NDR_PRINT_OUT_DEBUG(winreg_OpenHKPT, &r);
1991         
1992         push = ndr_push_init_ctx(mem_ctx);
1993         if (push == NULL) {
1994                 talloc_free(mem_ctx);
1995                 return False;
1996         }
1997         
1998         status = ndr_push_winreg_OpenHKPT(push, NDR_OUT, &r);
1999         if (NT_STATUS_IS_ERR(status)) {
2000                 talloc_free(mem_ctx);
2001                 return False;
2002         }
2003         
2004         blob = ndr_push_blob(push);
2005         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
2006                 talloc_free(mem_ctx);
2007                 return False;
2008         }
2009         
2010         talloc_free(mem_ctx);
2011         
2012         return True;
2013 }
2014
2015 static BOOL api_winreg_OpenHKPN(pipes_struct *p)
2016 {
2017         struct ndr_pull *pull;
2018         struct ndr_push *push;
2019         NTSTATUS status;
2020         DATA_BLOB blob;
2021         struct winreg_OpenHKPN r;
2022         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_OpenHKPN");
2023         
2024         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
2025                 talloc_free(mem_ctx);
2026                 return False;
2027         }
2028         
2029         pull = ndr_pull_init_blob(&blob, mem_ctx);
2030         if (pull == NULL)
2031                 return False;
2032         
2033         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2034         status = ndr_pull_winreg_OpenHKPN(pull, NDR_IN, &r);
2035         if (NT_STATUS_IS_ERR(status)) {
2036                 talloc_free(mem_ctx);
2037                 return False;
2038         }
2039         
2040         if (DEBUGLEVEL >= 10)
2041                 NDR_PRINT_IN_DEBUG(winreg_OpenHKPN, &r);
2042         
2043         ZERO_STRUCT(r.out);
2044         r.out.handle = talloc_zero_size(mem_ctx, sizeof(*r.out.handle));
2045         if (r.out.handle == NULL) {
2046                 talloc_free(mem_ctx);
2047                 return False;
2048         }
2049         
2050         r.out.result = _winreg_OpenHKPN(p, r.in.system_name, r.in.access_mask, r.out.handle);
2051         
2052         if (DEBUGLEVEL >= 10)
2053                 NDR_PRINT_OUT_DEBUG(winreg_OpenHKPN, &r);
2054         
2055         push = ndr_push_init_ctx(mem_ctx);
2056         if (push == NULL) {
2057                 talloc_free(mem_ctx);
2058                 return False;
2059         }
2060         
2061         status = ndr_push_winreg_OpenHKPN(push, NDR_OUT, &r);
2062         if (NT_STATUS_IS_ERR(status)) {
2063                 talloc_free(mem_ctx);
2064                 return False;
2065         }
2066         
2067         blob = ndr_push_blob(push);
2068         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
2069                 talloc_free(mem_ctx);
2070                 return False;
2071         }
2072         
2073         talloc_free(mem_ctx);
2074         
2075         return True;
2076 }
2077
2078 static BOOL api_winreg_QueryMultipleValues2(pipes_struct *p)
2079 {
2080         struct ndr_pull *pull;
2081         struct ndr_push *push;
2082         NTSTATUS status;
2083         DATA_BLOB blob;
2084         struct winreg_QueryMultipleValues2 r;
2085         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_QueryMultipleValues2");
2086         
2087         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
2088                 talloc_free(mem_ctx);
2089                 return False;
2090         }
2091         
2092         pull = ndr_pull_init_blob(&blob, mem_ctx);
2093         if (pull == NULL)
2094                 return False;
2095         
2096         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2097         status = ndr_pull_winreg_QueryMultipleValues2(pull, NDR_IN, &r);
2098         if (NT_STATUS_IS_ERR(status)) {
2099                 talloc_free(mem_ctx);
2100                 return False;
2101         }
2102         
2103         if (DEBUGLEVEL >= 10)
2104                 NDR_PRINT_IN_DEBUG(winreg_QueryMultipleValues2, &r);
2105         
2106         r.out.result = _winreg_QueryMultipleValues2(p);
2107         
2108         if (DEBUGLEVEL >= 10)
2109                 NDR_PRINT_OUT_DEBUG(winreg_QueryMultipleValues2, &r);
2110         
2111         push = ndr_push_init_ctx(mem_ctx);
2112         if (push == NULL) {
2113                 talloc_free(mem_ctx);
2114                 return False;
2115         }
2116         
2117         status = ndr_push_winreg_QueryMultipleValues2(push, NDR_OUT, &r);
2118         if (NT_STATUS_IS_ERR(status)) {
2119                 talloc_free(mem_ctx);
2120                 return False;
2121         }
2122         
2123         blob = ndr_push_blob(push);
2124         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
2125                 talloc_free(mem_ctx);
2126                 return False;
2127         }
2128         
2129         talloc_free(mem_ctx);
2130         
2131         return True;
2132 }
2133
2134
2135 /* Tables */
2136 static struct api_struct api_winreg_cmds[] = 
2137 {
2138         {"WINREG_OPENHKCR", DCERPC_WINREG_OPENHKCR, api_winreg_OpenHKCR},
2139         {"WINREG_OPENHKCU", DCERPC_WINREG_OPENHKCU, api_winreg_OpenHKCU},
2140         {"WINREG_OPENHKLM", DCERPC_WINREG_OPENHKLM, api_winreg_OpenHKLM},
2141         {"WINREG_OPENHKPD", DCERPC_WINREG_OPENHKPD, api_winreg_OpenHKPD},
2142         {"WINREG_OPENHKU", DCERPC_WINREG_OPENHKU, api_winreg_OpenHKU},
2143         {"WINREG_CLOSEKEY", DCERPC_WINREG_CLOSEKEY, api_winreg_CloseKey},
2144         {"WINREG_CREATEKEY", DCERPC_WINREG_CREATEKEY, api_winreg_CreateKey},
2145         {"WINREG_DELETEKEY", DCERPC_WINREG_DELETEKEY, api_winreg_DeleteKey},
2146         {"WINREG_DELETEVALUE", DCERPC_WINREG_DELETEVALUE, api_winreg_DeleteValue},
2147         {"WINREG_ENUMKEY", DCERPC_WINREG_ENUMKEY, api_winreg_EnumKey},
2148         {"WINREG_ENUMVALUE", DCERPC_WINREG_ENUMVALUE, api_winreg_EnumValue},
2149         {"WINREG_FLUSHKEY", DCERPC_WINREG_FLUSHKEY, api_winreg_FlushKey},
2150         {"WINREG_GETKEYSECURITY", DCERPC_WINREG_GETKEYSECURITY, api_winreg_GetKeySecurity},
2151         {"WINREG_LOADKEY", DCERPC_WINREG_LOADKEY, api_winreg_LoadKey},
2152         {"WINREG_NOTIFYCHANGEKEYVALUE", DCERPC_WINREG_NOTIFYCHANGEKEYVALUE, api_winreg_NotifyChangeKeyValue},
2153         {"WINREG_OPENKEY", DCERPC_WINREG_OPENKEY, api_winreg_OpenKey},
2154         {"WINREG_QUERYINFOKEY", DCERPC_WINREG_QUERYINFOKEY, api_winreg_QueryInfoKey},
2155         {"WINREG_QUERYVALUE", DCERPC_WINREG_QUERYVALUE, api_winreg_QueryValue},
2156         {"WINREG_REPLACEKEY", DCERPC_WINREG_REPLACEKEY, api_winreg_ReplaceKey},
2157         {"WINREG_RESTOREKEY", DCERPC_WINREG_RESTOREKEY, api_winreg_RestoreKey},
2158         {"WINREG_SAVEKEY", DCERPC_WINREG_SAVEKEY, api_winreg_SaveKey},
2159         {"WINREG_SETKEYSECURITY", DCERPC_WINREG_SETKEYSECURITY, api_winreg_SetKeySecurity},
2160         {"WINREG_SETVALUE", DCERPC_WINREG_SETVALUE, api_winreg_SetValue},
2161         {"WINREG_UNLOADKEY", DCERPC_WINREG_UNLOADKEY, api_winreg_UnLoadKey},
2162         {"WINREG_INITIATESYSTEMSHUTDOWN", DCERPC_WINREG_INITIATESYSTEMSHUTDOWN, api_winreg_InitiateSystemShutdown},
2163         {"WINREG_ABORTSYSTEMSHUTDOWN", DCERPC_WINREG_ABORTSYSTEMSHUTDOWN, api_winreg_AbortSystemShutdown},
2164         {"WINREG_GETVERSION", DCERPC_WINREG_GETVERSION, api_winreg_GetVersion},
2165         {"WINREG_OPENHKCC", DCERPC_WINREG_OPENHKCC, api_winreg_OpenHKCC},
2166         {"WINREG_OPENHKDD", DCERPC_WINREG_OPENHKDD, api_winreg_OpenHKDD},
2167         {"WINREG_QUERYMULTIPLEVALUES", DCERPC_WINREG_QUERYMULTIPLEVALUES, api_winreg_QueryMultipleValues},
2168         {"WINREG_INITIATESYSTEMSHUTDOWNEX", DCERPC_WINREG_INITIATESYSTEMSHUTDOWNEX, api_winreg_InitiateSystemShutdownEx},
2169         {"WINREG_SAVEKEYEX", DCERPC_WINREG_SAVEKEYEX, api_winreg_SaveKeyEx},
2170         {"WINREG_OPENHKPT", DCERPC_WINREG_OPENHKPT, api_winreg_OpenHKPT},
2171         {"WINREG_OPENHKPN", DCERPC_WINREG_OPENHKPN, api_winreg_OpenHKPN},
2172         {"WINREG_QUERYMULTIPLEVALUES2", DCERPC_WINREG_QUERYMULTIPLEVALUES2, api_winreg_QueryMultipleValues2},
2173 };
2174
2175 void winreg_get_pipe_fns(struct api_struct **fns, int *n_fns)
2176 {
2177         *fns = api_winreg_cmds;
2178         *n_fns = sizeof(api_winreg_cmds) / sizeof(struct api_struct);
2179 }
2180
2181 NTSTATUS rpc_winreg_init(void)
2182 {
2183         return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "winreg", "winreg", api_winreg_cmds, sizeof(api_winreg_cmds) / sizeof(struct api_struct));
2184 }