r18931: * Fix the IDL for QueryInfoKey. teh Classname in an
[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                 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.data = r.in.data;
650         r.out.data_size = r.in.data_size;
651         r.out.value_length = r.in.value_length;
652         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);
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.classname = r.in.classname;
999         r.out.num_subkeys = talloc_zero_size(mem_ctx, sizeof(*r.out.num_subkeys));
1000         if (r.out.num_subkeys == NULL) {
1001                 talloc_free(mem_ctx);
1002                 return False;
1003         }
1004         
1005         r.out.max_subkeylen = talloc_zero_size(mem_ctx, sizeof(*r.out.max_subkeylen));
1006         if (r.out.max_subkeylen == NULL) {
1007                 talloc_free(mem_ctx);
1008                 return False;
1009         }
1010         
1011         r.out.max_subkeysize = talloc_zero_size(mem_ctx, sizeof(*r.out.max_subkeysize));
1012         if (r.out.max_subkeysize == NULL) {
1013                 talloc_free(mem_ctx);
1014                 return False;
1015         }
1016         
1017         r.out.num_values = talloc_zero_size(mem_ctx, sizeof(*r.out.num_values));
1018         if (r.out.num_values == NULL) {
1019                 talloc_free(mem_ctx);
1020                 return False;
1021         }
1022         
1023         r.out.max_valnamelen = talloc_zero_size(mem_ctx, sizeof(*r.out.max_valnamelen));
1024         if (r.out.max_valnamelen == NULL) {
1025                 talloc_free(mem_ctx);
1026                 return False;
1027         }
1028         
1029         r.out.max_valbufsize = talloc_zero_size(mem_ctx, sizeof(*r.out.max_valbufsize));
1030         if (r.out.max_valbufsize == NULL) {
1031                 talloc_free(mem_ctx);
1032                 return False;
1033         }
1034         
1035         r.out.secdescsize = talloc_zero_size(mem_ctx, sizeof(*r.out.secdescsize));
1036         if (r.out.secdescsize == NULL) {
1037                 talloc_free(mem_ctx);
1038                 return False;
1039         }
1040         
1041         r.out.last_changed_time = talloc_zero_size(mem_ctx, sizeof(*r.out.last_changed_time));
1042         if (r.out.last_changed_time == NULL) {
1043                 talloc_free(mem_ctx);
1044                 return False;
1045         }
1046         
1047         r.out.result = _winreg_QueryInfoKey(p, r.in.handle, r.in.classname, 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);
1048         
1049         if (DEBUGLEVEL >= 10)
1050                 NDR_PRINT_OUT_DEBUG(winreg_QueryInfoKey, &r);
1051         
1052         push = ndr_push_init_ctx(mem_ctx);
1053         if (push == NULL) {
1054                 talloc_free(mem_ctx);
1055                 return False;
1056         }
1057         
1058         status = ndr_push_winreg_QueryInfoKey(push, NDR_OUT, &r);
1059         if (NT_STATUS_IS_ERR(status)) {
1060                 talloc_free(mem_ctx);
1061                 return False;
1062         }
1063         
1064         blob = ndr_push_blob(push);
1065         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
1066                 talloc_free(mem_ctx);
1067                 return False;
1068         }
1069         
1070         talloc_free(mem_ctx);
1071         
1072         return True;
1073 }
1074
1075 static BOOL api_winreg_QueryValue(pipes_struct *p)
1076 {
1077         struct ndr_pull *pull;
1078         struct ndr_push *push;
1079         NTSTATUS status;
1080         DATA_BLOB blob;
1081         struct winreg_QueryValue r;
1082         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_QueryValue");
1083         
1084         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
1085                 talloc_free(mem_ctx);
1086                 return False;
1087         }
1088         
1089         pull = ndr_pull_init_blob(&blob, mem_ctx);
1090         if (pull == NULL)
1091                 return False;
1092         
1093         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1094         status = ndr_pull_winreg_QueryValue(pull, NDR_IN, &r);
1095         if (NT_STATUS_IS_ERR(status)) {
1096                 talloc_free(mem_ctx);
1097                 return False;
1098         }
1099         
1100         if (DEBUGLEVEL >= 10)
1101                 NDR_PRINT_IN_DEBUG(winreg_QueryValue, &r);
1102         
1103         ZERO_STRUCT(r.out);
1104         r.out.type = r.in.type;
1105         r.out.data = r.in.data;
1106         r.out.data_size = r.in.data_size;
1107         r.out.value_length = r.in.value_length;
1108         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);
1109         
1110         if (DEBUGLEVEL >= 10)
1111                 NDR_PRINT_OUT_DEBUG(winreg_QueryValue, &r);
1112         
1113         push = ndr_push_init_ctx(mem_ctx);
1114         if (push == NULL) {
1115                 talloc_free(mem_ctx);
1116                 return False;
1117         }
1118         
1119         status = ndr_push_winreg_QueryValue(push, NDR_OUT, &r);
1120         if (NT_STATUS_IS_ERR(status)) {
1121                 talloc_free(mem_ctx);
1122                 return False;
1123         }
1124         
1125         blob = ndr_push_blob(push);
1126         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
1127                 talloc_free(mem_ctx);
1128                 return False;
1129         }
1130         
1131         talloc_free(mem_ctx);
1132         
1133         return True;
1134 }
1135
1136 static BOOL api_winreg_ReplaceKey(pipes_struct *p)
1137 {
1138         struct ndr_pull *pull;
1139         struct ndr_push *push;
1140         NTSTATUS status;
1141         DATA_BLOB blob;
1142         struct winreg_ReplaceKey r;
1143         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_ReplaceKey");
1144         
1145         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
1146                 talloc_free(mem_ctx);
1147                 return False;
1148         }
1149         
1150         pull = ndr_pull_init_blob(&blob, mem_ctx);
1151         if (pull == NULL)
1152                 return False;
1153         
1154         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1155         status = ndr_pull_winreg_ReplaceKey(pull, NDR_IN, &r);
1156         if (NT_STATUS_IS_ERR(status)) {
1157                 talloc_free(mem_ctx);
1158                 return False;
1159         }
1160         
1161         if (DEBUGLEVEL >= 10)
1162                 NDR_PRINT_IN_DEBUG(winreg_ReplaceKey, &r);
1163         
1164         r.out.result = _winreg_ReplaceKey(p);
1165         
1166         if (DEBUGLEVEL >= 10)
1167                 NDR_PRINT_OUT_DEBUG(winreg_ReplaceKey, &r);
1168         
1169         push = ndr_push_init_ctx(mem_ctx);
1170         if (push == NULL) {
1171                 talloc_free(mem_ctx);
1172                 return False;
1173         }
1174         
1175         status = ndr_push_winreg_ReplaceKey(push, NDR_OUT, &r);
1176         if (NT_STATUS_IS_ERR(status)) {
1177                 talloc_free(mem_ctx);
1178                 return False;
1179         }
1180         
1181         blob = ndr_push_blob(push);
1182         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
1183                 talloc_free(mem_ctx);
1184                 return False;
1185         }
1186         
1187         talloc_free(mem_ctx);
1188         
1189         return True;
1190 }
1191
1192 static BOOL api_winreg_RestoreKey(pipes_struct *p)
1193 {
1194         struct ndr_pull *pull;
1195         struct ndr_push *push;
1196         NTSTATUS status;
1197         DATA_BLOB blob;
1198         struct winreg_RestoreKey r;
1199         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_RestoreKey");
1200         
1201         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
1202                 talloc_free(mem_ctx);
1203                 return False;
1204         }
1205         
1206         pull = ndr_pull_init_blob(&blob, mem_ctx);
1207         if (pull == NULL)
1208                 return False;
1209         
1210         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1211         status = ndr_pull_winreg_RestoreKey(pull, NDR_IN, &r);
1212         if (NT_STATUS_IS_ERR(status)) {
1213                 talloc_free(mem_ctx);
1214                 return False;
1215         }
1216         
1217         if (DEBUGLEVEL >= 10)
1218                 NDR_PRINT_IN_DEBUG(winreg_RestoreKey, &r);
1219         
1220         r.out.result = _winreg_RestoreKey(p);
1221         
1222         if (DEBUGLEVEL >= 10)
1223                 NDR_PRINT_OUT_DEBUG(winreg_RestoreKey, &r);
1224         
1225         push = ndr_push_init_ctx(mem_ctx);
1226         if (push == NULL) {
1227                 talloc_free(mem_ctx);
1228                 return False;
1229         }
1230         
1231         status = ndr_push_winreg_RestoreKey(push, NDR_OUT, &r);
1232         if (NT_STATUS_IS_ERR(status)) {
1233                 talloc_free(mem_ctx);
1234                 return False;
1235         }
1236         
1237         blob = ndr_push_blob(push);
1238         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
1239                 talloc_free(mem_ctx);
1240                 return False;
1241         }
1242         
1243         talloc_free(mem_ctx);
1244         
1245         return True;
1246 }
1247
1248 static BOOL api_winreg_SaveKey(pipes_struct *p)
1249 {
1250         struct ndr_pull *pull;
1251         struct ndr_push *push;
1252         NTSTATUS status;
1253         DATA_BLOB blob;
1254         struct winreg_SaveKey r;
1255         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_SaveKey");
1256         
1257         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
1258                 talloc_free(mem_ctx);
1259                 return False;
1260         }
1261         
1262         pull = ndr_pull_init_blob(&blob, mem_ctx);
1263         if (pull == NULL)
1264                 return False;
1265         
1266         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1267         status = ndr_pull_winreg_SaveKey(pull, NDR_IN, &r);
1268         if (NT_STATUS_IS_ERR(status)) {
1269                 talloc_free(mem_ctx);
1270                 return False;
1271         }
1272         
1273         if (DEBUGLEVEL >= 10)
1274                 NDR_PRINT_IN_DEBUG(winreg_SaveKey, &r);
1275         
1276         r.out.result = _winreg_SaveKey(p);
1277         
1278         if (DEBUGLEVEL >= 10)
1279                 NDR_PRINT_OUT_DEBUG(winreg_SaveKey, &r);
1280         
1281         push = ndr_push_init_ctx(mem_ctx);
1282         if (push == NULL) {
1283                 talloc_free(mem_ctx);
1284                 return False;
1285         }
1286         
1287         status = ndr_push_winreg_SaveKey(push, NDR_OUT, &r);
1288         if (NT_STATUS_IS_ERR(status)) {
1289                 talloc_free(mem_ctx);
1290                 return False;
1291         }
1292         
1293         blob = ndr_push_blob(push);
1294         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
1295                 talloc_free(mem_ctx);
1296                 return False;
1297         }
1298         
1299         talloc_free(mem_ctx);
1300         
1301         return True;
1302 }
1303
1304 static BOOL api_winreg_SetKeySecurity(pipes_struct *p)
1305 {
1306         struct ndr_pull *pull;
1307         struct ndr_push *push;
1308         NTSTATUS status;
1309         DATA_BLOB blob;
1310         struct winreg_SetKeySecurity r;
1311         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_SetKeySecurity");
1312         
1313         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
1314                 talloc_free(mem_ctx);
1315                 return False;
1316         }
1317         
1318         pull = ndr_pull_init_blob(&blob, mem_ctx);
1319         if (pull == NULL)
1320                 return False;
1321         
1322         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1323         status = ndr_pull_winreg_SetKeySecurity(pull, NDR_IN, &r);
1324         if (NT_STATUS_IS_ERR(status)) {
1325                 talloc_free(mem_ctx);
1326                 return False;
1327         }
1328         
1329         if (DEBUGLEVEL >= 10)
1330                 NDR_PRINT_IN_DEBUG(winreg_SetKeySecurity, &r);
1331         
1332         ZERO_STRUCT(r.out);
1333         r.out.sd = r.in.sd;
1334         r.out.result = _winreg_SetKeySecurity(p, r.in.handle, r.in.access_mask, r.in.sd);
1335         
1336         if (DEBUGLEVEL >= 10)
1337                 NDR_PRINT_OUT_DEBUG(winreg_SetKeySecurity, &r);
1338         
1339         push = ndr_push_init_ctx(mem_ctx);
1340         if (push == NULL) {
1341                 talloc_free(mem_ctx);
1342                 return False;
1343         }
1344         
1345         status = ndr_push_winreg_SetKeySecurity(push, NDR_OUT, &r);
1346         if (NT_STATUS_IS_ERR(status)) {
1347                 talloc_free(mem_ctx);
1348                 return False;
1349         }
1350         
1351         blob = ndr_push_blob(push);
1352         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
1353                 talloc_free(mem_ctx);
1354                 return False;
1355         }
1356         
1357         talloc_free(mem_ctx);
1358         
1359         return True;
1360 }
1361
1362 static BOOL api_winreg_SetValue(pipes_struct *p)
1363 {
1364         struct ndr_pull *pull;
1365         struct ndr_push *push;
1366         NTSTATUS status;
1367         DATA_BLOB blob;
1368         struct winreg_SetValue r;
1369         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_SetValue");
1370         
1371         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
1372                 talloc_free(mem_ctx);
1373                 return False;
1374         }
1375         
1376         pull = ndr_pull_init_blob(&blob, mem_ctx);
1377         if (pull == NULL)
1378                 return False;
1379         
1380         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1381         status = ndr_pull_winreg_SetValue(pull, NDR_IN, &r);
1382         if (NT_STATUS_IS_ERR(status)) {
1383                 talloc_free(mem_ctx);
1384                 return False;
1385         }
1386         
1387         if (DEBUGLEVEL >= 10)
1388                 NDR_PRINT_IN_DEBUG(winreg_SetValue, &r);
1389         
1390         r.out.result = _winreg_SetValue(p, r.in.handle, r.in.name, r.in.type, r.in.data, r.in.size);
1391         
1392         if (DEBUGLEVEL >= 10)
1393                 NDR_PRINT_OUT_DEBUG(winreg_SetValue, &r);
1394         
1395         push = ndr_push_init_ctx(mem_ctx);
1396         if (push == NULL) {
1397                 talloc_free(mem_ctx);
1398                 return False;
1399         }
1400         
1401         status = ndr_push_winreg_SetValue(push, NDR_OUT, &r);
1402         if (NT_STATUS_IS_ERR(status)) {
1403                 talloc_free(mem_ctx);
1404                 return False;
1405         }
1406         
1407         blob = ndr_push_blob(push);
1408         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
1409                 talloc_free(mem_ctx);
1410                 return False;
1411         }
1412         
1413         talloc_free(mem_ctx);
1414         
1415         return True;
1416 }
1417
1418 static BOOL api_winreg_UnLoadKey(pipes_struct *p)
1419 {
1420         struct ndr_pull *pull;
1421         struct ndr_push *push;
1422         NTSTATUS status;
1423         DATA_BLOB blob;
1424         struct winreg_UnLoadKey r;
1425         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_UnLoadKey");
1426         
1427         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
1428                 talloc_free(mem_ctx);
1429                 return False;
1430         }
1431         
1432         pull = ndr_pull_init_blob(&blob, mem_ctx);
1433         if (pull == NULL)
1434                 return False;
1435         
1436         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1437         status = ndr_pull_winreg_UnLoadKey(pull, NDR_IN, &r);
1438         if (NT_STATUS_IS_ERR(status)) {
1439                 talloc_free(mem_ctx);
1440                 return False;
1441         }
1442         
1443         if (DEBUGLEVEL >= 10)
1444                 NDR_PRINT_IN_DEBUG(winreg_UnLoadKey, &r);
1445         
1446         r.out.result = _winreg_UnLoadKey(p);
1447         
1448         if (DEBUGLEVEL >= 10)
1449                 NDR_PRINT_OUT_DEBUG(winreg_UnLoadKey, &r);
1450         
1451         push = ndr_push_init_ctx(mem_ctx);
1452         if (push == NULL) {
1453                 talloc_free(mem_ctx);
1454                 return False;
1455         }
1456         
1457         status = ndr_push_winreg_UnLoadKey(push, NDR_OUT, &r);
1458         if (NT_STATUS_IS_ERR(status)) {
1459                 talloc_free(mem_ctx);
1460                 return False;
1461         }
1462         
1463         blob = ndr_push_blob(push);
1464         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
1465                 talloc_free(mem_ctx);
1466                 return False;
1467         }
1468         
1469         talloc_free(mem_ctx);
1470         
1471         return True;
1472 }
1473
1474 static BOOL api_winreg_InitiateSystemShutdown(pipes_struct *p)
1475 {
1476         struct ndr_pull *pull;
1477         struct ndr_push *push;
1478         NTSTATUS status;
1479         DATA_BLOB blob;
1480         struct winreg_InitiateSystemShutdown r;
1481         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_InitiateSystemShutdown");
1482         
1483         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
1484                 talloc_free(mem_ctx);
1485                 return False;
1486         }
1487         
1488         pull = ndr_pull_init_blob(&blob, mem_ctx);
1489         if (pull == NULL)
1490                 return False;
1491         
1492         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1493         status = ndr_pull_winreg_InitiateSystemShutdown(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_InitiateSystemShutdown, &r);
1501         
1502         r.out.result = _winreg_InitiateSystemShutdown(p, r.in.hostname, r.in.message, r.in.timeout, r.in.force_apps, r.in.reboot);
1503         
1504         if (DEBUGLEVEL >= 10)
1505                 NDR_PRINT_OUT_DEBUG(winreg_InitiateSystemShutdown, &r);
1506         
1507         push = ndr_push_init_ctx(mem_ctx);
1508         if (push == NULL) {
1509                 talloc_free(mem_ctx);
1510                 return False;
1511         }
1512         
1513         status = ndr_push_winreg_InitiateSystemShutdown(push, NDR_OUT, &r);
1514         if (NT_STATUS_IS_ERR(status)) {
1515                 talloc_free(mem_ctx);
1516                 return False;
1517         }
1518         
1519         blob = ndr_push_blob(push);
1520         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
1521                 talloc_free(mem_ctx);
1522                 return False;
1523         }
1524         
1525         talloc_free(mem_ctx);
1526         
1527         return True;
1528 }
1529
1530 static BOOL api_winreg_AbortSystemShutdown(pipes_struct *p)
1531 {
1532         struct ndr_pull *pull;
1533         struct ndr_push *push;
1534         NTSTATUS status;
1535         DATA_BLOB blob;
1536         struct winreg_AbortSystemShutdown r;
1537         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_AbortSystemShutdown");
1538         
1539         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
1540                 talloc_free(mem_ctx);
1541                 return False;
1542         }
1543         
1544         pull = ndr_pull_init_blob(&blob, mem_ctx);
1545         if (pull == NULL)
1546                 return False;
1547         
1548         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1549         status = ndr_pull_winreg_AbortSystemShutdown(pull, NDR_IN, &r);
1550         if (NT_STATUS_IS_ERR(status)) {
1551                 talloc_free(mem_ctx);
1552                 return False;
1553         }
1554         
1555         if (DEBUGLEVEL >= 10)
1556                 NDR_PRINT_IN_DEBUG(winreg_AbortSystemShutdown, &r);
1557         
1558         r.out.result = _winreg_AbortSystemShutdown(p, r.in.server);
1559         
1560         if (DEBUGLEVEL >= 10)
1561                 NDR_PRINT_OUT_DEBUG(winreg_AbortSystemShutdown, &r);
1562         
1563         push = ndr_push_init_ctx(mem_ctx);
1564         if (push == NULL) {
1565                 talloc_free(mem_ctx);
1566                 return False;
1567         }
1568         
1569         status = ndr_push_winreg_AbortSystemShutdown(push, NDR_OUT, &r);
1570         if (NT_STATUS_IS_ERR(status)) {
1571                 talloc_free(mem_ctx);
1572                 return False;
1573         }
1574         
1575         blob = ndr_push_blob(push);
1576         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
1577                 talloc_free(mem_ctx);
1578                 return False;
1579         }
1580         
1581         talloc_free(mem_ctx);
1582         
1583         return True;
1584 }
1585
1586 static BOOL api_winreg_GetVersion(pipes_struct *p)
1587 {
1588         struct ndr_pull *pull;
1589         struct ndr_push *push;
1590         NTSTATUS status;
1591         DATA_BLOB blob;
1592         struct winreg_GetVersion r;
1593         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_GetVersion");
1594         
1595         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
1596                 talloc_free(mem_ctx);
1597                 return False;
1598         }
1599         
1600         pull = ndr_pull_init_blob(&blob, mem_ctx);
1601         if (pull == NULL)
1602                 return False;
1603         
1604         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1605         status = ndr_pull_winreg_GetVersion(pull, NDR_IN, &r);
1606         if (NT_STATUS_IS_ERR(status)) {
1607                 talloc_free(mem_ctx);
1608                 return False;
1609         }
1610         
1611         if (DEBUGLEVEL >= 10)
1612                 NDR_PRINT_IN_DEBUG(winreg_GetVersion, &r);
1613         
1614         ZERO_STRUCT(r.out);
1615         r.out.version = talloc_zero_size(mem_ctx, sizeof(*r.out.version));
1616         if (r.out.version == NULL) {
1617                 talloc_free(mem_ctx);
1618                 return False;
1619         }
1620         
1621         r.out.result = _winreg_GetVersion(p, r.in.handle, r.out.version);
1622         
1623         if (DEBUGLEVEL >= 10)
1624                 NDR_PRINT_OUT_DEBUG(winreg_GetVersion, &r);
1625         
1626         push = ndr_push_init_ctx(mem_ctx);
1627         if (push == NULL) {
1628                 talloc_free(mem_ctx);
1629                 return False;
1630         }
1631         
1632         status = ndr_push_winreg_GetVersion(push, NDR_OUT, &r);
1633         if (NT_STATUS_IS_ERR(status)) {
1634                 talloc_free(mem_ctx);
1635                 return False;
1636         }
1637         
1638         blob = ndr_push_blob(push);
1639         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
1640                 talloc_free(mem_ctx);
1641                 return False;
1642         }
1643         
1644         talloc_free(mem_ctx);
1645         
1646         return True;
1647 }
1648
1649 static BOOL api_winreg_OpenHKCC(pipes_struct *p)
1650 {
1651         struct ndr_pull *pull;
1652         struct ndr_push *push;
1653         NTSTATUS status;
1654         DATA_BLOB blob;
1655         struct winreg_OpenHKCC r;
1656         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_OpenHKCC");
1657         
1658         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
1659                 talloc_free(mem_ctx);
1660                 return False;
1661         }
1662         
1663         pull = ndr_pull_init_blob(&blob, mem_ctx);
1664         if (pull == NULL)
1665                 return False;
1666         
1667         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1668         status = ndr_pull_winreg_OpenHKCC(pull, NDR_IN, &r);
1669         if (NT_STATUS_IS_ERR(status)) {
1670                 talloc_free(mem_ctx);
1671                 return False;
1672         }
1673         
1674         if (DEBUGLEVEL >= 10)
1675                 NDR_PRINT_IN_DEBUG(winreg_OpenHKCC, &r);
1676         
1677         ZERO_STRUCT(r.out);
1678         r.out.handle = talloc_zero_size(mem_ctx, sizeof(*r.out.handle));
1679         if (r.out.handle == NULL) {
1680                 talloc_free(mem_ctx);
1681                 return False;
1682         }
1683         
1684         r.out.result = _winreg_OpenHKCC(p, r.in.system_name, r.in.access_mask, r.out.handle);
1685         
1686         if (DEBUGLEVEL >= 10)
1687                 NDR_PRINT_OUT_DEBUG(winreg_OpenHKCC, &r);
1688         
1689         push = ndr_push_init_ctx(mem_ctx);
1690         if (push == NULL) {
1691                 talloc_free(mem_ctx);
1692                 return False;
1693         }
1694         
1695         status = ndr_push_winreg_OpenHKCC(push, NDR_OUT, &r);
1696         if (NT_STATUS_IS_ERR(status)) {
1697                 talloc_free(mem_ctx);
1698                 return False;
1699         }
1700         
1701         blob = ndr_push_blob(push);
1702         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
1703                 talloc_free(mem_ctx);
1704                 return False;
1705         }
1706         
1707         talloc_free(mem_ctx);
1708         
1709         return True;
1710 }
1711
1712 static BOOL api_winreg_OpenHKDD(pipes_struct *p)
1713 {
1714         struct ndr_pull *pull;
1715         struct ndr_push *push;
1716         NTSTATUS status;
1717         DATA_BLOB blob;
1718         struct winreg_OpenHKDD r;
1719         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_OpenHKDD");
1720         
1721         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
1722                 talloc_free(mem_ctx);
1723                 return False;
1724         }
1725         
1726         pull = ndr_pull_init_blob(&blob, mem_ctx);
1727         if (pull == NULL)
1728                 return False;
1729         
1730         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1731         status = ndr_pull_winreg_OpenHKDD(pull, NDR_IN, &r);
1732         if (NT_STATUS_IS_ERR(status)) {
1733                 talloc_free(mem_ctx);
1734                 return False;
1735         }
1736         
1737         if (DEBUGLEVEL >= 10)
1738                 NDR_PRINT_IN_DEBUG(winreg_OpenHKDD, &r);
1739         
1740         ZERO_STRUCT(r.out);
1741         r.out.handle = talloc_zero_size(mem_ctx, sizeof(*r.out.handle));
1742         if (r.out.handle == NULL) {
1743                 talloc_free(mem_ctx);
1744                 return False;
1745         }
1746         
1747         r.out.result = _winreg_OpenHKDD(p, r.in.system_name, r.in.access_mask, r.out.handle);
1748         
1749         if (DEBUGLEVEL >= 10)
1750                 NDR_PRINT_OUT_DEBUG(winreg_OpenHKDD, &r);
1751         
1752         push = ndr_push_init_ctx(mem_ctx);
1753         if (push == NULL) {
1754                 talloc_free(mem_ctx);
1755                 return False;
1756         }
1757         
1758         status = ndr_push_winreg_OpenHKDD(push, NDR_OUT, &r);
1759         if (NT_STATUS_IS_ERR(status)) {
1760                 talloc_free(mem_ctx);
1761                 return False;
1762         }
1763         
1764         blob = ndr_push_blob(push);
1765         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
1766                 talloc_free(mem_ctx);
1767                 return False;
1768         }
1769         
1770         talloc_free(mem_ctx);
1771         
1772         return True;
1773 }
1774
1775 static BOOL api_winreg_QueryMultipleValues(pipes_struct *p)
1776 {
1777         struct ndr_pull *pull;
1778         struct ndr_push *push;
1779         NTSTATUS status;
1780         DATA_BLOB blob;
1781         struct winreg_QueryMultipleValues r;
1782         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_QueryMultipleValues");
1783         
1784         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
1785                 talloc_free(mem_ctx);
1786                 return False;
1787         }
1788         
1789         pull = ndr_pull_init_blob(&blob, mem_ctx);
1790         if (pull == NULL)
1791                 return False;
1792         
1793         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1794         status = ndr_pull_winreg_QueryMultipleValues(pull, NDR_IN, &r);
1795         if (NT_STATUS_IS_ERR(status)) {
1796                 talloc_free(mem_ctx);
1797                 return False;
1798         }
1799         
1800         if (DEBUGLEVEL >= 10)
1801                 NDR_PRINT_IN_DEBUG(winreg_QueryMultipleValues, &r);
1802         
1803         ZERO_STRUCT(r.out);
1804         r.out.values = r.in.values;
1805         r.out.buffer = r.in.buffer;
1806         r.out.buffer_size = r.in.buffer_size;
1807         r.out.result = _winreg_QueryMultipleValues(p, r.in.key_handle, r.in.values, r.in.num_values, r.in.buffer, r.in.buffer_size);
1808         
1809         if (DEBUGLEVEL >= 10)
1810                 NDR_PRINT_OUT_DEBUG(winreg_QueryMultipleValues, &r);
1811         
1812         push = ndr_push_init_ctx(mem_ctx);
1813         if (push == NULL) {
1814                 talloc_free(mem_ctx);
1815                 return False;
1816         }
1817         
1818         status = ndr_push_winreg_QueryMultipleValues(push, NDR_OUT, &r);
1819         if (NT_STATUS_IS_ERR(status)) {
1820                 talloc_free(mem_ctx);
1821                 return False;
1822         }
1823         
1824         blob = ndr_push_blob(push);
1825         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
1826                 talloc_free(mem_ctx);
1827                 return False;
1828         }
1829         
1830         talloc_free(mem_ctx);
1831         
1832         return True;
1833 }
1834
1835 static BOOL api_winreg_InitiateSystemShutdownEx(pipes_struct *p)
1836 {
1837         struct ndr_pull *pull;
1838         struct ndr_push *push;
1839         NTSTATUS status;
1840         DATA_BLOB blob;
1841         struct winreg_InitiateSystemShutdownEx r;
1842         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_InitiateSystemShutdownEx");
1843         
1844         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
1845                 talloc_free(mem_ctx);
1846                 return False;
1847         }
1848         
1849         pull = ndr_pull_init_blob(&blob, mem_ctx);
1850         if (pull == NULL)
1851                 return False;
1852         
1853         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1854         status = ndr_pull_winreg_InitiateSystemShutdownEx(pull, NDR_IN, &r);
1855         if (NT_STATUS_IS_ERR(status)) {
1856                 talloc_free(mem_ctx);
1857                 return False;
1858         }
1859         
1860         if (DEBUGLEVEL >= 10)
1861                 NDR_PRINT_IN_DEBUG(winreg_InitiateSystemShutdownEx, &r);
1862         
1863         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);
1864         
1865         if (DEBUGLEVEL >= 10)
1866                 NDR_PRINT_OUT_DEBUG(winreg_InitiateSystemShutdownEx, &r);
1867         
1868         push = ndr_push_init_ctx(mem_ctx);
1869         if (push == NULL) {
1870                 talloc_free(mem_ctx);
1871                 return False;
1872         }
1873         
1874         status = ndr_push_winreg_InitiateSystemShutdownEx(push, NDR_OUT, &r);
1875         if (NT_STATUS_IS_ERR(status)) {
1876                 talloc_free(mem_ctx);
1877                 return False;
1878         }
1879         
1880         blob = ndr_push_blob(push);
1881         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
1882                 talloc_free(mem_ctx);
1883                 return False;
1884         }
1885         
1886         talloc_free(mem_ctx);
1887         
1888         return True;
1889 }
1890
1891 static BOOL api_winreg_SaveKeyEx(pipes_struct *p)
1892 {
1893         struct ndr_pull *pull;
1894         struct ndr_push *push;
1895         NTSTATUS status;
1896         DATA_BLOB blob;
1897         struct winreg_SaveKeyEx r;
1898         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_SaveKeyEx");
1899         
1900         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
1901                 talloc_free(mem_ctx);
1902                 return False;
1903         }
1904         
1905         pull = ndr_pull_init_blob(&blob, mem_ctx);
1906         if (pull == NULL)
1907                 return False;
1908         
1909         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1910         status = ndr_pull_winreg_SaveKeyEx(pull, NDR_IN, &r);
1911         if (NT_STATUS_IS_ERR(status)) {
1912                 talloc_free(mem_ctx);
1913                 return False;
1914         }
1915         
1916         if (DEBUGLEVEL >= 10)
1917                 NDR_PRINT_IN_DEBUG(winreg_SaveKeyEx, &r);
1918         
1919         r.out.result = _winreg_SaveKeyEx(p);
1920         
1921         if (DEBUGLEVEL >= 10)
1922                 NDR_PRINT_OUT_DEBUG(winreg_SaveKeyEx, &r);
1923         
1924         push = ndr_push_init_ctx(mem_ctx);
1925         if (push == NULL) {
1926                 talloc_free(mem_ctx);
1927                 return False;
1928         }
1929         
1930         status = ndr_push_winreg_SaveKeyEx(push, NDR_OUT, &r);
1931         if (NT_STATUS_IS_ERR(status)) {
1932                 talloc_free(mem_ctx);
1933                 return False;
1934         }
1935         
1936         blob = ndr_push_blob(push);
1937         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
1938                 talloc_free(mem_ctx);
1939                 return False;
1940         }
1941         
1942         talloc_free(mem_ctx);
1943         
1944         return True;
1945 }
1946
1947 static BOOL api_winreg_OpenHKPT(pipes_struct *p)
1948 {
1949         struct ndr_pull *pull;
1950         struct ndr_push *push;
1951         NTSTATUS status;
1952         DATA_BLOB blob;
1953         struct winreg_OpenHKPT r;
1954         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_OpenHKPT");
1955         
1956         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
1957                 talloc_free(mem_ctx);
1958                 return False;
1959         }
1960         
1961         pull = ndr_pull_init_blob(&blob, mem_ctx);
1962         if (pull == NULL)
1963                 return False;
1964         
1965         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
1966         status = ndr_pull_winreg_OpenHKPT(pull, NDR_IN, &r);
1967         if (NT_STATUS_IS_ERR(status)) {
1968                 talloc_free(mem_ctx);
1969                 return False;
1970         }
1971         
1972         if (DEBUGLEVEL >= 10)
1973                 NDR_PRINT_IN_DEBUG(winreg_OpenHKPT, &r);
1974         
1975         ZERO_STRUCT(r.out);
1976         r.out.handle = talloc_zero_size(mem_ctx, sizeof(*r.out.handle));
1977         if (r.out.handle == NULL) {
1978                 talloc_free(mem_ctx);
1979                 return False;
1980         }
1981         
1982         r.out.result = _winreg_OpenHKPT(p, r.in.system_name, r.in.access_mask, r.out.handle);
1983         
1984         if (DEBUGLEVEL >= 10)
1985                 NDR_PRINT_OUT_DEBUG(winreg_OpenHKPT, &r);
1986         
1987         push = ndr_push_init_ctx(mem_ctx);
1988         if (push == NULL) {
1989                 talloc_free(mem_ctx);
1990                 return False;
1991         }
1992         
1993         status = ndr_push_winreg_OpenHKPT(push, NDR_OUT, &r);
1994         if (NT_STATUS_IS_ERR(status)) {
1995                 talloc_free(mem_ctx);
1996                 return False;
1997         }
1998         
1999         blob = ndr_push_blob(push);
2000         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
2001                 talloc_free(mem_ctx);
2002                 return False;
2003         }
2004         
2005         talloc_free(mem_ctx);
2006         
2007         return True;
2008 }
2009
2010 static BOOL api_winreg_OpenHKPN(pipes_struct *p)
2011 {
2012         struct ndr_pull *pull;
2013         struct ndr_push *push;
2014         NTSTATUS status;
2015         DATA_BLOB blob;
2016         struct winreg_OpenHKPN r;
2017         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_OpenHKPN");
2018         
2019         if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
2020                 talloc_free(mem_ctx);
2021                 return False;
2022         }
2023         
2024         pull = ndr_pull_init_blob(&blob, mem_ctx);
2025         if (pull == NULL)
2026                 return False;
2027         
2028         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2029         status = ndr_pull_winreg_OpenHKPN(pull, NDR_IN, &r);
2030         if (NT_STATUS_IS_ERR(status)) {
2031                 talloc_free(mem_ctx);
2032                 return False;
2033         }
2034         
2035         if (DEBUGLEVEL >= 10)
2036                 NDR_PRINT_IN_DEBUG(winreg_OpenHKPN, &r);
2037         
2038         ZERO_STRUCT(r.out);
2039         r.out.handle = talloc_zero_size(mem_ctx, sizeof(*r.out.handle));
2040         if (r.out.handle == NULL) {
2041                 talloc_free(mem_ctx);
2042                 return False;
2043         }
2044         
2045         r.out.result = _winreg_OpenHKPN(p, r.in.system_name, r.in.access_mask, r.out.handle);
2046         
2047         if (DEBUGLEVEL >= 10)
2048                 NDR_PRINT_OUT_DEBUG(winreg_OpenHKPN, &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_OpenHKPN(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_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
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_QueryMultipleValues2(pipes_struct *p)
2074 {
2075         struct ndr_pull *pull;
2076         struct ndr_push *push;
2077         NTSTATUS status;
2078         DATA_BLOB blob;
2079         struct winreg_QueryMultipleValues2 r;
2080         TALLOC_CTX *mem_ctx = talloc_init("api_winreg_QueryMultipleValues2");
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                 return False;
2090         
2091         pull->flags |= LIBNDR_FLAG_REF_ALLOC;
2092         status = ndr_pull_winreg_QueryMultipleValues2(pull, NDR_IN, &r);
2093         if (NT_STATUS_IS_ERR(status)) {
2094                 talloc_free(mem_ctx);
2095                 return False;
2096         }
2097         
2098         if (DEBUGLEVEL >= 10)
2099                 NDR_PRINT_IN_DEBUG(winreg_QueryMultipleValues2, &r);
2100         
2101         r.out.result = _winreg_QueryMultipleValues2(p);
2102         
2103         if (DEBUGLEVEL >= 10)
2104                 NDR_PRINT_OUT_DEBUG(winreg_QueryMultipleValues2, &r);
2105         
2106         push = ndr_push_init_ctx(mem_ctx);
2107         if (push == NULL) {
2108                 talloc_free(mem_ctx);
2109                 return False;
2110         }
2111         
2112         status = ndr_push_winreg_QueryMultipleValues2(push, NDR_OUT, &r);
2113         if (NT_STATUS_IS_ERR(status)) {
2114                 talloc_free(mem_ctx);
2115                 return False;
2116         }
2117         
2118         blob = ndr_push_blob(push);
2119         if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
2120                 talloc_free(mem_ctx);
2121                 return False;
2122         }
2123         
2124         talloc_free(mem_ctx);
2125         
2126         return True;
2127 }
2128
2129
2130 /* Tables */
2131 static struct api_struct api_winreg_cmds[] = 
2132 {
2133         {"WINREG_OPENHKCR", DCERPC_WINREG_OPENHKCR, api_winreg_OpenHKCR},
2134         {"WINREG_OPENHKCU", DCERPC_WINREG_OPENHKCU, api_winreg_OpenHKCU},
2135         {"WINREG_OPENHKLM", DCERPC_WINREG_OPENHKLM, api_winreg_OpenHKLM},
2136         {"WINREG_OPENHKPD", DCERPC_WINREG_OPENHKPD, api_winreg_OpenHKPD},
2137         {"WINREG_OPENHKU", DCERPC_WINREG_OPENHKU, api_winreg_OpenHKU},
2138         {"WINREG_CLOSEKEY", DCERPC_WINREG_CLOSEKEY, api_winreg_CloseKey},
2139         {"WINREG_CREATEKEY", DCERPC_WINREG_CREATEKEY, api_winreg_CreateKey},
2140         {"WINREG_DELETEKEY", DCERPC_WINREG_DELETEKEY, api_winreg_DeleteKey},
2141         {"WINREG_DELETEVALUE", DCERPC_WINREG_DELETEVALUE, api_winreg_DeleteValue},
2142         {"WINREG_ENUMKEY", DCERPC_WINREG_ENUMKEY, api_winreg_EnumKey},
2143         {"WINREG_ENUMVALUE", DCERPC_WINREG_ENUMVALUE, api_winreg_EnumValue},
2144         {"WINREG_FLUSHKEY", DCERPC_WINREG_FLUSHKEY, api_winreg_FlushKey},
2145         {"WINREG_GETKEYSECURITY", DCERPC_WINREG_GETKEYSECURITY, api_winreg_GetKeySecurity},
2146         {"WINREG_LOADKEY", DCERPC_WINREG_LOADKEY, api_winreg_LoadKey},
2147         {"WINREG_NOTIFYCHANGEKEYVALUE", DCERPC_WINREG_NOTIFYCHANGEKEYVALUE, api_winreg_NotifyChangeKeyValue},
2148         {"WINREG_OPENKEY", DCERPC_WINREG_OPENKEY, api_winreg_OpenKey},
2149         {"WINREG_QUERYINFOKEY", DCERPC_WINREG_QUERYINFOKEY, api_winreg_QueryInfoKey},
2150         {"WINREG_QUERYVALUE", DCERPC_WINREG_QUERYVALUE, api_winreg_QueryValue},
2151         {"WINREG_REPLACEKEY", DCERPC_WINREG_REPLACEKEY, api_winreg_ReplaceKey},
2152         {"WINREG_RESTOREKEY", DCERPC_WINREG_RESTOREKEY, api_winreg_RestoreKey},
2153         {"WINREG_SAVEKEY", DCERPC_WINREG_SAVEKEY, api_winreg_SaveKey},
2154         {"WINREG_SETKEYSECURITY", DCERPC_WINREG_SETKEYSECURITY, api_winreg_SetKeySecurity},
2155         {"WINREG_SETVALUE", DCERPC_WINREG_SETVALUE, api_winreg_SetValue},
2156         {"WINREG_UNLOADKEY", DCERPC_WINREG_UNLOADKEY, api_winreg_UnLoadKey},
2157         {"WINREG_INITIATESYSTEMSHUTDOWN", DCERPC_WINREG_INITIATESYSTEMSHUTDOWN, api_winreg_InitiateSystemShutdown},
2158         {"WINREG_ABORTSYSTEMSHUTDOWN", DCERPC_WINREG_ABORTSYSTEMSHUTDOWN, api_winreg_AbortSystemShutdown},
2159         {"WINREG_GETVERSION", DCERPC_WINREG_GETVERSION, api_winreg_GetVersion},
2160         {"WINREG_OPENHKCC", DCERPC_WINREG_OPENHKCC, api_winreg_OpenHKCC},
2161         {"WINREG_OPENHKDD", DCERPC_WINREG_OPENHKDD, api_winreg_OpenHKDD},
2162         {"WINREG_QUERYMULTIPLEVALUES", DCERPC_WINREG_QUERYMULTIPLEVALUES, api_winreg_QueryMultipleValues},
2163         {"WINREG_INITIATESYSTEMSHUTDOWNEX", DCERPC_WINREG_INITIATESYSTEMSHUTDOWNEX, api_winreg_InitiateSystemShutdownEx},
2164         {"WINREG_SAVEKEYEX", DCERPC_WINREG_SAVEKEYEX, api_winreg_SaveKeyEx},
2165         {"WINREG_OPENHKPT", DCERPC_WINREG_OPENHKPT, api_winreg_OpenHKPT},
2166         {"WINREG_OPENHKPN", DCERPC_WINREG_OPENHKPN, api_winreg_OpenHKPN},
2167         {"WINREG_QUERYMULTIPLEVALUES2", DCERPC_WINREG_QUERYMULTIPLEVALUES2, api_winreg_QueryMultipleValues2},
2168 };
2169
2170 void winreg_get_pipe_fns(struct api_struct **fns, int *n_fns)
2171 {
2172         *fns = api_winreg_cmds;
2173         *n_fns = sizeof(api_winreg_cmds) / sizeof(struct api_struct);
2174 }
2175
2176 NTSTATUS rpc_winreg_init(void)
2177 {
2178         return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "winreg", "winreg", api_winreg_cmds, sizeof(api_winreg_cmds) / sizeof(struct api_struct));
2179 }