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