r25068: Older samba3 DCs will return DCERPC_FAULT_OP_RNG_ERROR for every opcode on the
[Samba.git] / source / librpc / gen_ndr / srv_winreg.c
blob77b4c0ce58fc730c4836439475bc0816c79264a3
1 /*
2 * Unix SMB/CIFS implementation.
3 * server auto-generated by pidl. DO NOT MODIFY!
4 */
6 #include "includes.h"
7 #include "librpc/gen_ndr/srv_winreg.h"
9 static BOOL api_winreg_OpenHKCR(pipes_struct *p)
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");
18 if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
19 talloc_free(mem_ctx);
20 return False;
23 pull = ndr_pull_init_blob(&blob, mem_ctx);
24 if (pull == NULL) {
25 talloc_free(mem_ctx);
26 return False;
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;
36 if (DEBUGLEVEL >= 10)
37 NDR_PRINT_IN_DEBUG(winreg_OpenHKCR, &r);
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;
46 r.out.result = _winreg_OpenHKCR(p, &r);
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;
54 if (DEBUGLEVEL >= 10)
55 NDR_PRINT_OUT_DEBUG(winreg_OpenHKCR, &r);
57 push = ndr_push_init_ctx(mem_ctx);
58 if (push == NULL) {
59 talloc_free(mem_ctx);
60 return False;
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;
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;
75 talloc_free(mem_ctx);
77 return True;
80 static BOOL api_winreg_OpenHKCU(pipes_struct *p)
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");
89 if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
90 talloc_free(mem_ctx);
91 return False;
94 pull = ndr_pull_init_blob(&blob, mem_ctx);
95 if (pull == NULL) {
96 talloc_free(mem_ctx);
97 return False;
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;
107 if (DEBUGLEVEL >= 10)
108 NDR_PRINT_IN_DEBUG(winreg_OpenHKCU, &r);
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;
117 r.out.result = _winreg_OpenHKCU(p, &r);
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;
125 if (DEBUGLEVEL >= 10)
126 NDR_PRINT_OUT_DEBUG(winreg_OpenHKCU, &r);
128 push = ndr_push_init_ctx(mem_ctx);
129 if (push == NULL) {
130 talloc_free(mem_ctx);
131 return False;
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;
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;
146 talloc_free(mem_ctx);
148 return True;
151 static BOOL api_winreg_OpenHKLM(pipes_struct *p)
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");
160 if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
161 talloc_free(mem_ctx);
162 return False;
165 pull = ndr_pull_init_blob(&blob, mem_ctx);
166 if (pull == NULL) {
167 talloc_free(mem_ctx);
168 return False;
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;
178 if (DEBUGLEVEL >= 10)
179 NDR_PRINT_IN_DEBUG(winreg_OpenHKLM, &r);
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;
188 r.out.result = _winreg_OpenHKLM(p, &r);
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;
196 if (DEBUGLEVEL >= 10)
197 NDR_PRINT_OUT_DEBUG(winreg_OpenHKLM, &r);
199 push = ndr_push_init_ctx(mem_ctx);
200 if (push == NULL) {
201 talloc_free(mem_ctx);
202 return False;
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;
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;
217 talloc_free(mem_ctx);
219 return True;
222 static BOOL api_winreg_OpenHKPD(pipes_struct *p)
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");
231 if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
232 talloc_free(mem_ctx);
233 return False;
236 pull = ndr_pull_init_blob(&blob, mem_ctx);
237 if (pull == NULL) {
238 talloc_free(mem_ctx);
239 return False;
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;
249 if (DEBUGLEVEL >= 10)
250 NDR_PRINT_IN_DEBUG(winreg_OpenHKPD, &r);
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;
259 r.out.result = _winreg_OpenHKPD(p, &r);
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;
267 if (DEBUGLEVEL >= 10)
268 NDR_PRINT_OUT_DEBUG(winreg_OpenHKPD, &r);
270 push = ndr_push_init_ctx(mem_ctx);
271 if (push == NULL) {
272 talloc_free(mem_ctx);
273 return False;
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;
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;
288 talloc_free(mem_ctx);
290 return True;
293 static BOOL api_winreg_OpenHKU(pipes_struct *p)
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");
302 if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
303 talloc_free(mem_ctx);
304 return False;
307 pull = ndr_pull_init_blob(&blob, mem_ctx);
308 if (pull == NULL) {
309 talloc_free(mem_ctx);
310 return False;
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;
320 if (DEBUGLEVEL >= 10)
321 NDR_PRINT_IN_DEBUG(winreg_OpenHKU, &r);
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;
330 r.out.result = _winreg_OpenHKU(p, &r);
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;
338 if (DEBUGLEVEL >= 10)
339 NDR_PRINT_OUT_DEBUG(winreg_OpenHKU, &r);
341 push = ndr_push_init_ctx(mem_ctx);
342 if (push == NULL) {
343 talloc_free(mem_ctx);
344 return False;
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;
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;
359 talloc_free(mem_ctx);
361 return True;
364 static BOOL api_winreg_CloseKey(pipes_struct *p)
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");
373 if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
374 talloc_free(mem_ctx);
375 return False;
378 pull = ndr_pull_init_blob(&blob, mem_ctx);
379 if (pull == NULL) {
380 talloc_free(mem_ctx);
381 return False;
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;
391 if (DEBUGLEVEL >= 10)
392 NDR_PRINT_IN_DEBUG(winreg_CloseKey, &r);
394 ZERO_STRUCT(r.out);
395 r.out.handle = r.in.handle;
396 r.out.result = _winreg_CloseKey(p, &r);
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;
404 if (DEBUGLEVEL >= 10)
405 NDR_PRINT_OUT_DEBUG(winreg_CloseKey, &r);
407 push = ndr_push_init_ctx(mem_ctx);
408 if (push == NULL) {
409 talloc_free(mem_ctx);
410 return False;
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;
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;
425 talloc_free(mem_ctx);
427 return True;
430 static BOOL api_winreg_CreateKey(pipes_struct *p)
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");
439 if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
440 talloc_free(mem_ctx);
441 return False;
444 pull = ndr_pull_init_blob(&blob, mem_ctx);
445 if (pull == NULL) {
446 talloc_free(mem_ctx);
447 return False;
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;
457 if (DEBUGLEVEL >= 10)
458 NDR_PRINT_IN_DEBUG(winreg_CreateKey, &r);
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;
467 r.out.action_taken = r.in.action_taken;
468 r.out.result = _winreg_CreateKey(p, &r);
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;
476 if (DEBUGLEVEL >= 10)
477 NDR_PRINT_OUT_DEBUG(winreg_CreateKey, &r);
479 push = ndr_push_init_ctx(mem_ctx);
480 if (push == NULL) {
481 talloc_free(mem_ctx);
482 return False;
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;
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;
497 talloc_free(mem_ctx);
499 return True;
502 static BOOL api_winreg_DeleteKey(pipes_struct *p)
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");
511 if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
512 talloc_free(mem_ctx);
513 return False;
516 pull = ndr_pull_init_blob(&blob, mem_ctx);
517 if (pull == NULL) {
518 talloc_free(mem_ctx);
519 return False;
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;
529 if (DEBUGLEVEL >= 10)
530 NDR_PRINT_IN_DEBUG(winreg_DeleteKey, &r);
532 r.out.result = _winreg_DeleteKey(p, &r);
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;
540 if (DEBUGLEVEL >= 10)
541 NDR_PRINT_OUT_DEBUG(winreg_DeleteKey, &r);
543 push = ndr_push_init_ctx(mem_ctx);
544 if (push == NULL) {
545 talloc_free(mem_ctx);
546 return False;
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;
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;
561 talloc_free(mem_ctx);
563 return True;
566 static BOOL api_winreg_DeleteValue(pipes_struct *p)
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");
575 if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
576 talloc_free(mem_ctx);
577 return False;
580 pull = ndr_pull_init_blob(&blob, mem_ctx);
581 if (pull == NULL) {
582 talloc_free(mem_ctx);
583 return False;
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;
593 if (DEBUGLEVEL >= 10)
594 NDR_PRINT_IN_DEBUG(winreg_DeleteValue, &r);
596 r.out.result = _winreg_DeleteValue(p, &r);
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;
604 if (DEBUGLEVEL >= 10)
605 NDR_PRINT_OUT_DEBUG(winreg_DeleteValue, &r);
607 push = ndr_push_init_ctx(mem_ctx);
608 if (push == NULL) {
609 talloc_free(mem_ctx);
610 return False;
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;
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;
625 talloc_free(mem_ctx);
627 return True;
630 static BOOL api_winreg_EnumKey(pipes_struct *p)
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");
639 if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
640 talloc_free(mem_ctx);
641 return False;
644 pull = ndr_pull_init_blob(&blob, mem_ctx);
645 if (pull == NULL) {
646 talloc_free(mem_ctx);
647 return False;
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;
657 if (DEBUGLEVEL >= 10)
658 NDR_PRINT_IN_DEBUG(winreg_EnumKey, &r);
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);
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;
672 if (DEBUGLEVEL >= 10)
673 NDR_PRINT_OUT_DEBUG(winreg_EnumKey, &r);
675 push = ndr_push_init_ctx(mem_ctx);
676 if (push == NULL) {
677 talloc_free(mem_ctx);
678 return False;
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;
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;
693 talloc_free(mem_ctx);
695 return True;
698 static BOOL api_winreg_EnumValue(pipes_struct *p)
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");
707 if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
708 talloc_free(mem_ctx);
709 return False;
712 pull = ndr_pull_init_blob(&blob, mem_ctx);
713 if (pull == NULL) {
714 talloc_free(mem_ctx);
715 return False;
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;
725 if (DEBUGLEVEL >= 10)
726 NDR_PRINT_IN_DEBUG(winreg_EnumValue, &r);
728 ZERO_STRUCT(r.out);
729 r.out.name = r.in.name;
730 r.out.type = r.in.type;
731 r.out.value = r.in.value;
732 r.out.size = r.in.size;
733 r.out.length = r.in.length;
734 r.out.result = _winreg_EnumValue(p, &r);
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;
742 if (DEBUGLEVEL >= 10)
743 NDR_PRINT_OUT_DEBUG(winreg_EnumValue, &r);
745 push = ndr_push_init_ctx(mem_ctx);
746 if (push == NULL) {
747 talloc_free(mem_ctx);
748 return False;
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;
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;
763 talloc_free(mem_ctx);
765 return True;
768 static BOOL api_winreg_FlushKey(pipes_struct *p)
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");
777 if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
778 talloc_free(mem_ctx);
779 return False;
782 pull = ndr_pull_init_blob(&blob, mem_ctx);
783 if (pull == NULL) {
784 talloc_free(mem_ctx);
785 return False;
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;
795 if (DEBUGLEVEL >= 10)
796 NDR_PRINT_IN_DEBUG(winreg_FlushKey, &r);
798 r.out.result = _winreg_FlushKey(p, &r);
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;
806 if (DEBUGLEVEL >= 10)
807 NDR_PRINT_OUT_DEBUG(winreg_FlushKey, &r);
809 push = ndr_push_init_ctx(mem_ctx);
810 if (push == NULL) {
811 talloc_free(mem_ctx);
812 return False;
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;
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;
827 talloc_free(mem_ctx);
829 return True;
832 static BOOL api_winreg_GetKeySecurity(pipes_struct *p)
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");
841 if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
842 talloc_free(mem_ctx);
843 return False;
846 pull = ndr_pull_init_blob(&blob, mem_ctx);
847 if (pull == NULL) {
848 talloc_free(mem_ctx);
849 return False;
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;
859 if (DEBUGLEVEL >= 10)
860 NDR_PRINT_IN_DEBUG(winreg_GetKeySecurity, &r);
862 ZERO_STRUCT(r.out);
863 r.out.sd = r.in.sd;
864 r.out.result = _winreg_GetKeySecurity(p, &r);
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;
872 if (DEBUGLEVEL >= 10)
873 NDR_PRINT_OUT_DEBUG(winreg_GetKeySecurity, &r);
875 push = ndr_push_init_ctx(mem_ctx);
876 if (push == NULL) {
877 talloc_free(mem_ctx);
878 return False;
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;
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;
893 talloc_free(mem_ctx);
895 return True;
898 static BOOL api_winreg_LoadKey(pipes_struct *p)
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");
907 if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
908 talloc_free(mem_ctx);
909 return False;
912 pull = ndr_pull_init_blob(&blob, mem_ctx);
913 if (pull == NULL) {
914 talloc_free(mem_ctx);
915 return False;
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;
925 if (DEBUGLEVEL >= 10)
926 NDR_PRINT_IN_DEBUG(winreg_LoadKey, &r);
928 r.out.result = _winreg_LoadKey(p, &r);
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;
936 if (DEBUGLEVEL >= 10)
937 NDR_PRINT_OUT_DEBUG(winreg_LoadKey, &r);
939 push = ndr_push_init_ctx(mem_ctx);
940 if (push == NULL) {
941 talloc_free(mem_ctx);
942 return False;
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;
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;
957 talloc_free(mem_ctx);
959 return True;
962 static BOOL api_winreg_NotifyChangeKeyValue(pipes_struct *p)
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");
971 if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
972 talloc_free(mem_ctx);
973 return False;
976 pull = ndr_pull_init_blob(&blob, mem_ctx);
977 if (pull == NULL) {
978 talloc_free(mem_ctx);
979 return False;
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;
989 if (DEBUGLEVEL >= 10)
990 NDR_PRINT_IN_DEBUG(winreg_NotifyChangeKeyValue, &r);
992 r.out.result = _winreg_NotifyChangeKeyValue(p, &r);
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;
1000 if (DEBUGLEVEL >= 10)
1001 NDR_PRINT_OUT_DEBUG(winreg_NotifyChangeKeyValue, &r);
1003 push = ndr_push_init_ctx(mem_ctx);
1004 if (push == NULL) {
1005 talloc_free(mem_ctx);
1006 return False;
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;
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;
1021 talloc_free(mem_ctx);
1023 return True;
1026 static BOOL api_winreg_OpenKey(pipes_struct *p)
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");
1035 if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
1036 talloc_free(mem_ctx);
1037 return False;
1040 pull = ndr_pull_init_blob(&blob, mem_ctx);
1041 if (pull == NULL) {
1042 talloc_free(mem_ctx);
1043 return False;
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;
1053 if (DEBUGLEVEL >= 10)
1054 NDR_PRINT_IN_DEBUG(winreg_OpenKey, &r);
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;
1063 r.out.result = _winreg_OpenKey(p, &r);
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;
1071 if (DEBUGLEVEL >= 10)
1072 NDR_PRINT_OUT_DEBUG(winreg_OpenKey, &r);
1074 push = ndr_push_init_ctx(mem_ctx);
1075 if (push == NULL) {
1076 talloc_free(mem_ctx);
1077 return False;
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;
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;
1092 talloc_free(mem_ctx);
1094 return True;
1097 static BOOL api_winreg_QueryInfoKey(pipes_struct *p)
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");
1106 if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
1107 talloc_free(mem_ctx);
1108 return False;
1111 pull = ndr_pull_init_blob(&blob, mem_ctx);
1112 if (pull == NULL) {
1113 talloc_free(mem_ctx);
1114 return False;
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;
1124 if (DEBUGLEVEL >= 10)
1125 NDR_PRINT_IN_DEBUG(winreg_QueryInfoKey, &r);
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;
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;
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;
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;
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;
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;
1165 r.out.secdescsize = talloc_zero(mem_ctx, uint32_t);
1166 if (r.out.secdescsize == NULL) {
1167 talloc_free(mem_ctx);
1168 return False;
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;
1177 r.out.result = _winreg_QueryInfoKey(p, &r);
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;
1185 if (DEBUGLEVEL >= 10)
1186 NDR_PRINT_OUT_DEBUG(winreg_QueryInfoKey, &r);
1188 push = ndr_push_init_ctx(mem_ctx);
1189 if (push == NULL) {
1190 talloc_free(mem_ctx);
1191 return False;
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;
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;
1206 talloc_free(mem_ctx);
1208 return True;
1211 static BOOL api_winreg_QueryValue(pipes_struct *p)
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");
1220 if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
1221 talloc_free(mem_ctx);
1222 return False;
1225 pull = ndr_pull_init_blob(&blob, mem_ctx);
1226 if (pull == NULL) {
1227 talloc_free(mem_ctx);
1228 return False;
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;
1238 if (DEBUGLEVEL >= 10)
1239 NDR_PRINT_IN_DEBUG(winreg_QueryValue, &r);
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);
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;
1254 if (DEBUGLEVEL >= 10)
1255 NDR_PRINT_OUT_DEBUG(winreg_QueryValue, &r);
1257 push = ndr_push_init_ctx(mem_ctx);
1258 if (push == NULL) {
1259 talloc_free(mem_ctx);
1260 return False;
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;
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;
1275 talloc_free(mem_ctx);
1277 return True;
1280 static BOOL api_winreg_ReplaceKey(pipes_struct *p)
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");
1289 if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
1290 talloc_free(mem_ctx);
1291 return False;
1294 pull = ndr_pull_init_blob(&blob, mem_ctx);
1295 if (pull == NULL) {
1296 talloc_free(mem_ctx);
1297 return False;
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;
1307 if (DEBUGLEVEL >= 10)
1308 NDR_PRINT_IN_DEBUG(winreg_ReplaceKey, &r);
1310 r.out.result = _winreg_ReplaceKey(p, &r);
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;
1318 if (DEBUGLEVEL >= 10)
1319 NDR_PRINT_OUT_DEBUG(winreg_ReplaceKey, &r);
1321 push = ndr_push_init_ctx(mem_ctx);
1322 if (push == NULL) {
1323 talloc_free(mem_ctx);
1324 return False;
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;
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;
1339 talloc_free(mem_ctx);
1341 return True;
1344 static BOOL api_winreg_RestoreKey(pipes_struct *p)
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");
1353 if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
1354 talloc_free(mem_ctx);
1355 return False;
1358 pull = ndr_pull_init_blob(&blob, mem_ctx);
1359 if (pull == NULL) {
1360 talloc_free(mem_ctx);
1361 return False;
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;
1371 if (DEBUGLEVEL >= 10)
1372 NDR_PRINT_IN_DEBUG(winreg_RestoreKey, &r);
1374 r.out.result = _winreg_RestoreKey(p, &r);
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;
1382 if (DEBUGLEVEL >= 10)
1383 NDR_PRINT_OUT_DEBUG(winreg_RestoreKey, &r);
1385 push = ndr_push_init_ctx(mem_ctx);
1386 if (push == NULL) {
1387 talloc_free(mem_ctx);
1388 return False;
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;
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;
1403 talloc_free(mem_ctx);
1405 return True;
1408 static BOOL api_winreg_SaveKey(pipes_struct *p)
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");
1417 if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
1418 talloc_free(mem_ctx);
1419 return False;
1422 pull = ndr_pull_init_blob(&blob, mem_ctx);
1423 if (pull == NULL) {
1424 talloc_free(mem_ctx);
1425 return False;
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;
1435 if (DEBUGLEVEL >= 10)
1436 NDR_PRINT_IN_DEBUG(winreg_SaveKey, &r);
1438 r.out.result = _winreg_SaveKey(p, &r);
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;
1446 if (DEBUGLEVEL >= 10)
1447 NDR_PRINT_OUT_DEBUG(winreg_SaveKey, &r);
1449 push = ndr_push_init_ctx(mem_ctx);
1450 if (push == NULL) {
1451 talloc_free(mem_ctx);
1452 return False;
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;
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;
1467 talloc_free(mem_ctx);
1469 return True;
1472 static BOOL api_winreg_SetKeySecurity(pipes_struct *p)
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");
1481 if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
1482 talloc_free(mem_ctx);
1483 return False;
1486 pull = ndr_pull_init_blob(&blob, mem_ctx);
1487 if (pull == NULL) {
1488 talloc_free(mem_ctx);
1489 return False;
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;
1499 if (DEBUGLEVEL >= 10)
1500 NDR_PRINT_IN_DEBUG(winreg_SetKeySecurity, &r);
1502 r.out.result = _winreg_SetKeySecurity(p, &r);
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;
1510 if (DEBUGLEVEL >= 10)
1511 NDR_PRINT_OUT_DEBUG(winreg_SetKeySecurity, &r);
1513 push = ndr_push_init_ctx(mem_ctx);
1514 if (push == NULL) {
1515 talloc_free(mem_ctx);
1516 return False;
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;
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;
1531 talloc_free(mem_ctx);
1533 return True;
1536 static BOOL api_winreg_SetValue(pipes_struct *p)
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");
1545 if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
1546 talloc_free(mem_ctx);
1547 return False;
1550 pull = ndr_pull_init_blob(&blob, mem_ctx);
1551 if (pull == NULL) {
1552 talloc_free(mem_ctx);
1553 return False;
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;
1563 if (DEBUGLEVEL >= 10)
1564 NDR_PRINT_IN_DEBUG(winreg_SetValue, &r);
1566 r.out.result = _winreg_SetValue(p, &r);
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;
1574 if (DEBUGLEVEL >= 10)
1575 NDR_PRINT_OUT_DEBUG(winreg_SetValue, &r);
1577 push = ndr_push_init_ctx(mem_ctx);
1578 if (push == NULL) {
1579 talloc_free(mem_ctx);
1580 return False;
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;
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;
1595 talloc_free(mem_ctx);
1597 return True;
1600 static BOOL api_winreg_UnLoadKey(pipes_struct *p)
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");
1609 if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
1610 talloc_free(mem_ctx);
1611 return False;
1614 pull = ndr_pull_init_blob(&blob, mem_ctx);
1615 if (pull == NULL) {
1616 talloc_free(mem_ctx);
1617 return False;
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;
1627 if (DEBUGLEVEL >= 10)
1628 NDR_PRINT_IN_DEBUG(winreg_UnLoadKey, &r);
1630 r.out.result = _winreg_UnLoadKey(p, &r);
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;
1638 if (DEBUGLEVEL >= 10)
1639 NDR_PRINT_OUT_DEBUG(winreg_UnLoadKey, &r);
1641 push = ndr_push_init_ctx(mem_ctx);
1642 if (push == NULL) {
1643 talloc_free(mem_ctx);
1644 return False;
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;
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;
1659 talloc_free(mem_ctx);
1661 return True;
1664 static BOOL api_winreg_InitiateSystemShutdown(pipes_struct *p)
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");
1673 if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
1674 talloc_free(mem_ctx);
1675 return False;
1678 pull = ndr_pull_init_blob(&blob, mem_ctx);
1679 if (pull == NULL) {
1680 talloc_free(mem_ctx);
1681 return False;
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;
1691 if (DEBUGLEVEL >= 10)
1692 NDR_PRINT_IN_DEBUG(winreg_InitiateSystemShutdown, &r);
1694 r.out.result = _winreg_InitiateSystemShutdown(p, &r);
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;
1702 if (DEBUGLEVEL >= 10)
1703 NDR_PRINT_OUT_DEBUG(winreg_InitiateSystemShutdown, &r);
1705 push = ndr_push_init_ctx(mem_ctx);
1706 if (push == NULL) {
1707 talloc_free(mem_ctx);
1708 return False;
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;
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;
1723 talloc_free(mem_ctx);
1725 return True;
1728 static BOOL api_winreg_AbortSystemShutdown(pipes_struct *p)
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");
1737 if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
1738 talloc_free(mem_ctx);
1739 return False;
1742 pull = ndr_pull_init_blob(&blob, mem_ctx);
1743 if (pull == NULL) {
1744 talloc_free(mem_ctx);
1745 return False;
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;
1755 if (DEBUGLEVEL >= 10)
1756 NDR_PRINT_IN_DEBUG(winreg_AbortSystemShutdown, &r);
1758 r.out.result = _winreg_AbortSystemShutdown(p, &r);
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;
1766 if (DEBUGLEVEL >= 10)
1767 NDR_PRINT_OUT_DEBUG(winreg_AbortSystemShutdown, &r);
1769 push = ndr_push_init_ctx(mem_ctx);
1770 if (push == NULL) {
1771 talloc_free(mem_ctx);
1772 return False;
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;
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;
1787 talloc_free(mem_ctx);
1789 return True;
1792 static BOOL api_winreg_GetVersion(pipes_struct *p)
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");
1801 if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
1802 talloc_free(mem_ctx);
1803 return False;
1806 pull = ndr_pull_init_blob(&blob, mem_ctx);
1807 if (pull == NULL) {
1808 talloc_free(mem_ctx);
1809 return False;
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;
1819 if (DEBUGLEVEL >= 10)
1820 NDR_PRINT_IN_DEBUG(winreg_GetVersion, &r);
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;
1829 r.out.result = _winreg_GetVersion(p, &r);
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;
1837 if (DEBUGLEVEL >= 10)
1838 NDR_PRINT_OUT_DEBUG(winreg_GetVersion, &r);
1840 push = ndr_push_init_ctx(mem_ctx);
1841 if (push == NULL) {
1842 talloc_free(mem_ctx);
1843 return False;
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;
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;
1858 talloc_free(mem_ctx);
1860 return True;
1863 static BOOL api_winreg_OpenHKCC(pipes_struct *p)
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");
1872 if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
1873 talloc_free(mem_ctx);
1874 return False;
1877 pull = ndr_pull_init_blob(&blob, mem_ctx);
1878 if (pull == NULL) {
1879 talloc_free(mem_ctx);
1880 return False;
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;
1890 if (DEBUGLEVEL >= 10)
1891 NDR_PRINT_IN_DEBUG(winreg_OpenHKCC, &r);
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;
1900 r.out.result = _winreg_OpenHKCC(p, &r);
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;
1908 if (DEBUGLEVEL >= 10)
1909 NDR_PRINT_OUT_DEBUG(winreg_OpenHKCC, &r);
1911 push = ndr_push_init_ctx(mem_ctx);
1912 if (push == NULL) {
1913 talloc_free(mem_ctx);
1914 return False;
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;
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;
1929 talloc_free(mem_ctx);
1931 return True;
1934 static BOOL api_winreg_OpenHKDD(pipes_struct *p)
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");
1943 if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
1944 talloc_free(mem_ctx);
1945 return False;
1948 pull = ndr_pull_init_blob(&blob, mem_ctx);
1949 if (pull == NULL) {
1950 talloc_free(mem_ctx);
1951 return False;
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;
1961 if (DEBUGLEVEL >= 10)
1962 NDR_PRINT_IN_DEBUG(winreg_OpenHKDD, &r);
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;
1971 r.out.result = _winreg_OpenHKDD(p, &r);
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;
1979 if (DEBUGLEVEL >= 10)
1980 NDR_PRINT_OUT_DEBUG(winreg_OpenHKDD, &r);
1982 push = ndr_push_init_ctx(mem_ctx);
1983 if (push == NULL) {
1984 talloc_free(mem_ctx);
1985 return False;
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;
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;
2000 talloc_free(mem_ctx);
2002 return True;
2005 static BOOL api_winreg_QueryMultipleValues(pipes_struct *p)
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");
2014 if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
2015 talloc_free(mem_ctx);
2016 return False;
2019 pull = ndr_pull_init_blob(&blob, mem_ctx);
2020 if (pull == NULL) {
2021 talloc_free(mem_ctx);
2022 return False;
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;
2032 if (DEBUGLEVEL >= 10)
2033 NDR_PRINT_IN_DEBUG(winreg_QueryMultipleValues, &r);
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);
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;
2047 if (DEBUGLEVEL >= 10)
2048 NDR_PRINT_OUT_DEBUG(winreg_QueryMultipleValues, &r);
2050 push = ndr_push_init_ctx(mem_ctx);
2051 if (push == NULL) {
2052 talloc_free(mem_ctx);
2053 return False;
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;
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;
2068 talloc_free(mem_ctx);
2070 return True;
2073 static BOOL api_winreg_InitiateSystemShutdownEx(pipes_struct *p)
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");
2082 if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
2083 talloc_free(mem_ctx);
2084 return False;
2087 pull = ndr_pull_init_blob(&blob, mem_ctx);
2088 if (pull == NULL) {
2089 talloc_free(mem_ctx);
2090 return False;
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;
2100 if (DEBUGLEVEL >= 10)
2101 NDR_PRINT_IN_DEBUG(winreg_InitiateSystemShutdownEx, &r);
2103 r.out.result = _winreg_InitiateSystemShutdownEx(p, &r);
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;
2111 if (DEBUGLEVEL >= 10)
2112 NDR_PRINT_OUT_DEBUG(winreg_InitiateSystemShutdownEx, &r);
2114 push = ndr_push_init_ctx(mem_ctx);
2115 if (push == NULL) {
2116 talloc_free(mem_ctx);
2117 return False;
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;
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;
2132 talloc_free(mem_ctx);
2134 return True;
2137 static BOOL api_winreg_SaveKeyEx(pipes_struct *p)
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");
2146 if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
2147 talloc_free(mem_ctx);
2148 return False;
2151 pull = ndr_pull_init_blob(&blob, mem_ctx);
2152 if (pull == NULL) {
2153 talloc_free(mem_ctx);
2154 return False;
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;
2164 if (DEBUGLEVEL >= 10)
2165 NDR_PRINT_IN_DEBUG(winreg_SaveKeyEx, &r);
2167 r.out.result = _winreg_SaveKeyEx(p, &r);
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;
2175 if (DEBUGLEVEL >= 10)
2176 NDR_PRINT_OUT_DEBUG(winreg_SaveKeyEx, &r);
2178 push = ndr_push_init_ctx(mem_ctx);
2179 if (push == NULL) {
2180 talloc_free(mem_ctx);
2181 return False;
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;
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;
2196 talloc_free(mem_ctx);
2198 return True;
2201 static BOOL api_winreg_OpenHKPT(pipes_struct *p)
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");
2210 if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
2211 talloc_free(mem_ctx);
2212 return False;
2215 pull = ndr_pull_init_blob(&blob, mem_ctx);
2216 if (pull == NULL) {
2217 talloc_free(mem_ctx);
2218 return False;
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;
2228 if (DEBUGLEVEL >= 10)
2229 NDR_PRINT_IN_DEBUG(winreg_OpenHKPT, &r);
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;
2238 r.out.result = _winreg_OpenHKPT(p, &r);
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;
2246 if (DEBUGLEVEL >= 10)
2247 NDR_PRINT_OUT_DEBUG(winreg_OpenHKPT, &r);
2249 push = ndr_push_init_ctx(mem_ctx);
2250 if (push == NULL) {
2251 talloc_free(mem_ctx);
2252 return False;
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;
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;
2267 talloc_free(mem_ctx);
2269 return True;
2272 static BOOL api_winreg_OpenHKPN(pipes_struct *p)
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");
2281 if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
2282 talloc_free(mem_ctx);
2283 return False;
2286 pull = ndr_pull_init_blob(&blob, mem_ctx);
2287 if (pull == NULL) {
2288 talloc_free(mem_ctx);
2289 return False;
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;
2299 if (DEBUGLEVEL >= 10)
2300 NDR_PRINT_IN_DEBUG(winreg_OpenHKPN, &r);
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;
2309 r.out.result = _winreg_OpenHKPN(p, &r);
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;
2317 if (DEBUGLEVEL >= 10)
2318 NDR_PRINT_OUT_DEBUG(winreg_OpenHKPN, &r);
2320 push = ndr_push_init_ctx(mem_ctx);
2321 if (push == NULL) {
2322 talloc_free(mem_ctx);
2323 return False;
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;
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;
2338 talloc_free(mem_ctx);
2340 return True;
2343 static BOOL api_winreg_QueryMultipleValues2(pipes_struct *p)
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");
2352 if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
2353 talloc_free(mem_ctx);
2354 return False;
2357 pull = ndr_pull_init_blob(&blob, mem_ctx);
2358 if (pull == NULL) {
2359 talloc_free(mem_ctx);
2360 return False;
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;
2370 if (DEBUGLEVEL >= 10)
2371 NDR_PRINT_IN_DEBUG(winreg_QueryMultipleValues2, &r);
2373 r.out.result = _winreg_QueryMultipleValues2(p, &r);
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;
2381 if (DEBUGLEVEL >= 10)
2382 NDR_PRINT_OUT_DEBUG(winreg_QueryMultipleValues2, &r);
2384 push = ndr_push_init_ctx(mem_ctx);
2385 if (push == NULL) {
2386 talloc_free(mem_ctx);
2387 return False;
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;
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;
2402 talloc_free(mem_ctx);
2404 return True;
2408 /* Tables */
2409 static struct api_struct api_winreg_cmds[] =
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},
2448 void winreg_get_pipe_fns(struct api_struct **fns, int *n_fns)
2450 *fns = api_winreg_cmds;
2451 *n_fns = sizeof(api_winreg_cmds) / sizeof(struct api_struct);
2454 NTSTATUS rpc_winreg_init(void)
2456 return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "winreg", "winreg", api_winreg_cmds, sizeof(api_winreg_cmds) / sizeof(struct api_struct));