dsdb/samdb: add resolve_oids module
[gd/samba/.git] / librpc / gen_ndr / cli_winreg.c
1 /*
2  * Unix SMB/CIFS implementation.
3  * client auto-generated by pidl. DO NOT MODIFY!
4  */
5
6 #include "includes.h"
7 #include "../librpc/gen_ndr/cli_winreg.h"
8
9 struct rpccli_winreg_OpenHKCR_state {
10         struct winreg_OpenHKCR orig;
11         struct winreg_OpenHKCR tmp;
12         TALLOC_CTX *out_mem_ctx;
13         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
14 };
15
16 static void rpccli_winreg_OpenHKCR_done(struct tevent_req *subreq);
17
18 struct tevent_req *rpccli_winreg_OpenHKCR_send(TALLOC_CTX *mem_ctx,
19                                                struct tevent_context *ev,
20                                                struct rpc_pipe_client *cli,
21                                                uint16_t *_system_name /* [in] [unique] */,
22                                                uint32_t _access_mask /* [in]  */,
23                                                struct policy_handle *_handle /* [out] [ref] */)
24 {
25         struct tevent_req *req;
26         struct rpccli_winreg_OpenHKCR_state *state;
27         struct tevent_req *subreq;
28
29         req = tevent_req_create(mem_ctx, &state,
30                                 struct rpccli_winreg_OpenHKCR_state);
31         if (req == NULL) {
32                 return NULL;
33         }
34         state->out_mem_ctx = NULL;
35         state->dispatch_recv = cli->dispatch_recv;
36
37         /* In parameters */
38         state->orig.in.system_name = _system_name;
39         state->orig.in.access_mask = _access_mask;
40
41         /* Out parameters */
42         state->orig.out.handle = _handle;
43
44         /* Result */
45         ZERO_STRUCT(state->orig.out.result);
46
47         if (DEBUGLEVEL >= 10) {
48                 NDR_PRINT_IN_DEBUG(winreg_OpenHKCR, &state->orig);
49         }
50
51         state->out_mem_ctx = talloc_named_const(state, 0,
52                              "rpccli_winreg_OpenHKCR_out_memory");
53         if (tevent_req_nomem(state->out_mem_ctx, req)) {
54                 return tevent_req_post(req, ev);
55         }
56
57         /* make a temporary copy, that we pass to the dispatch function */
58         state->tmp = state->orig;
59
60         subreq = cli->dispatch_send(state, ev, cli,
61                                     &ndr_table_winreg,
62                                     NDR_WINREG_OPENHKCR,
63                                     &state->tmp);
64         if (tevent_req_nomem(subreq, req)) {
65                 return tevent_req_post(req, ev);
66         }
67         tevent_req_set_callback(subreq, rpccli_winreg_OpenHKCR_done, req);
68         return req;
69 }
70
71 static void rpccli_winreg_OpenHKCR_done(struct tevent_req *subreq)
72 {
73         struct tevent_req *req = tevent_req_callback_data(
74                 subreq, struct tevent_req);
75         struct rpccli_winreg_OpenHKCR_state *state = tevent_req_data(
76                 req, struct rpccli_winreg_OpenHKCR_state);
77         NTSTATUS status;
78         TALLOC_CTX *mem_ctx;
79
80         if (state->out_mem_ctx) {
81                 mem_ctx = state->out_mem_ctx;
82         } else {
83                 mem_ctx = state;
84         }
85
86         status = state->dispatch_recv(subreq, mem_ctx);
87         TALLOC_FREE(subreq);
88         if (!NT_STATUS_IS_OK(status)) {
89                 tevent_req_nterror(req, status);
90                 return;
91         }
92
93         /* Copy out parameters */
94         *state->orig.out.handle = *state->tmp.out.handle;
95
96         /* Copy result */
97         state->orig.out.result = state->tmp.out.result;
98
99         /* Reset temporary structure */
100         ZERO_STRUCT(state->tmp);
101
102         if (DEBUGLEVEL >= 10) {
103                 NDR_PRINT_OUT_DEBUG(winreg_OpenHKCR, &state->orig);
104         }
105
106         tevent_req_done(req);
107 }
108
109 NTSTATUS rpccli_winreg_OpenHKCR_recv(struct tevent_req *req,
110                                      TALLOC_CTX *mem_ctx,
111                                      WERROR *result)
112 {
113         struct rpccli_winreg_OpenHKCR_state *state = tevent_req_data(
114                 req, struct rpccli_winreg_OpenHKCR_state);
115         NTSTATUS status;
116
117         if (tevent_req_is_nterror(req, &status)) {
118                 tevent_req_received(req);
119                 return status;
120         }
121
122         /* Steal possbile out parameters to the callers context */
123         talloc_steal(mem_ctx, state->out_mem_ctx);
124
125         /* Return result */
126         *result = state->orig.out.result;
127
128         tevent_req_received(req);
129         return NT_STATUS_OK;
130 }
131
132 NTSTATUS rpccli_winreg_OpenHKCR(struct rpc_pipe_client *cli,
133                                 TALLOC_CTX *mem_ctx,
134                                 uint16_t *system_name /* [in] [unique] */,
135                                 uint32_t access_mask /* [in]  */,
136                                 struct policy_handle *handle /* [out] [ref] */,
137                                 WERROR *werror)
138 {
139         struct winreg_OpenHKCR r;
140         NTSTATUS status;
141
142         /* In parameters */
143         r.in.system_name = system_name;
144         r.in.access_mask = access_mask;
145
146         if (DEBUGLEVEL >= 10) {
147                 NDR_PRINT_IN_DEBUG(winreg_OpenHKCR, &r);
148         }
149
150         status = cli->dispatch(cli,
151                                 mem_ctx,
152                                 &ndr_table_winreg,
153                                 NDR_WINREG_OPENHKCR,
154                                 &r);
155
156         if (!NT_STATUS_IS_OK(status)) {
157                 return status;
158         }
159
160         if (DEBUGLEVEL >= 10) {
161                 NDR_PRINT_OUT_DEBUG(winreg_OpenHKCR, &r);
162         }
163
164         if (NT_STATUS_IS_ERR(status)) {
165                 return status;
166         }
167
168         /* Return variables */
169         *handle = *r.out.handle;
170
171         /* Return result */
172         if (werror) {
173                 *werror = r.out.result;
174         }
175
176         return werror_to_ntstatus(r.out.result);
177 }
178
179 struct rpccli_winreg_OpenHKCU_state {
180         struct winreg_OpenHKCU orig;
181         struct winreg_OpenHKCU tmp;
182         TALLOC_CTX *out_mem_ctx;
183         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
184 };
185
186 static void rpccli_winreg_OpenHKCU_done(struct tevent_req *subreq);
187
188 struct tevent_req *rpccli_winreg_OpenHKCU_send(TALLOC_CTX *mem_ctx,
189                                                struct tevent_context *ev,
190                                                struct rpc_pipe_client *cli,
191                                                uint16_t *_system_name /* [in] [unique] */,
192                                                uint32_t _access_mask /* [in]  */,
193                                                struct policy_handle *_handle /* [out] [ref] */)
194 {
195         struct tevent_req *req;
196         struct rpccli_winreg_OpenHKCU_state *state;
197         struct tevent_req *subreq;
198
199         req = tevent_req_create(mem_ctx, &state,
200                                 struct rpccli_winreg_OpenHKCU_state);
201         if (req == NULL) {
202                 return NULL;
203         }
204         state->out_mem_ctx = NULL;
205         state->dispatch_recv = cli->dispatch_recv;
206
207         /* In parameters */
208         state->orig.in.system_name = _system_name;
209         state->orig.in.access_mask = _access_mask;
210
211         /* Out parameters */
212         state->orig.out.handle = _handle;
213
214         /* Result */
215         ZERO_STRUCT(state->orig.out.result);
216
217         if (DEBUGLEVEL >= 10) {
218                 NDR_PRINT_IN_DEBUG(winreg_OpenHKCU, &state->orig);
219         }
220
221         state->out_mem_ctx = talloc_named_const(state, 0,
222                              "rpccli_winreg_OpenHKCU_out_memory");
223         if (tevent_req_nomem(state->out_mem_ctx, req)) {
224                 return tevent_req_post(req, ev);
225         }
226
227         /* make a temporary copy, that we pass to the dispatch function */
228         state->tmp = state->orig;
229
230         subreq = cli->dispatch_send(state, ev, cli,
231                                     &ndr_table_winreg,
232                                     NDR_WINREG_OPENHKCU,
233                                     &state->tmp);
234         if (tevent_req_nomem(subreq, req)) {
235                 return tevent_req_post(req, ev);
236         }
237         tevent_req_set_callback(subreq, rpccli_winreg_OpenHKCU_done, req);
238         return req;
239 }
240
241 static void rpccli_winreg_OpenHKCU_done(struct tevent_req *subreq)
242 {
243         struct tevent_req *req = tevent_req_callback_data(
244                 subreq, struct tevent_req);
245         struct rpccli_winreg_OpenHKCU_state *state = tevent_req_data(
246                 req, struct rpccli_winreg_OpenHKCU_state);
247         NTSTATUS status;
248         TALLOC_CTX *mem_ctx;
249
250         if (state->out_mem_ctx) {
251                 mem_ctx = state->out_mem_ctx;
252         } else {
253                 mem_ctx = state;
254         }
255
256         status = state->dispatch_recv(subreq, mem_ctx);
257         TALLOC_FREE(subreq);
258         if (!NT_STATUS_IS_OK(status)) {
259                 tevent_req_nterror(req, status);
260                 return;
261         }
262
263         /* Copy out parameters */
264         *state->orig.out.handle = *state->tmp.out.handle;
265
266         /* Copy result */
267         state->orig.out.result = state->tmp.out.result;
268
269         /* Reset temporary structure */
270         ZERO_STRUCT(state->tmp);
271
272         if (DEBUGLEVEL >= 10) {
273                 NDR_PRINT_OUT_DEBUG(winreg_OpenHKCU, &state->orig);
274         }
275
276         tevent_req_done(req);
277 }
278
279 NTSTATUS rpccli_winreg_OpenHKCU_recv(struct tevent_req *req,
280                                      TALLOC_CTX *mem_ctx,
281                                      WERROR *result)
282 {
283         struct rpccli_winreg_OpenHKCU_state *state = tevent_req_data(
284                 req, struct rpccli_winreg_OpenHKCU_state);
285         NTSTATUS status;
286
287         if (tevent_req_is_nterror(req, &status)) {
288                 tevent_req_received(req);
289                 return status;
290         }
291
292         /* Steal possbile out parameters to the callers context */
293         talloc_steal(mem_ctx, state->out_mem_ctx);
294
295         /* Return result */
296         *result = state->orig.out.result;
297
298         tevent_req_received(req);
299         return NT_STATUS_OK;
300 }
301
302 NTSTATUS rpccli_winreg_OpenHKCU(struct rpc_pipe_client *cli,
303                                 TALLOC_CTX *mem_ctx,
304                                 uint16_t *system_name /* [in] [unique] */,
305                                 uint32_t access_mask /* [in]  */,
306                                 struct policy_handle *handle /* [out] [ref] */,
307                                 WERROR *werror)
308 {
309         struct winreg_OpenHKCU r;
310         NTSTATUS status;
311
312         /* In parameters */
313         r.in.system_name = system_name;
314         r.in.access_mask = access_mask;
315
316         if (DEBUGLEVEL >= 10) {
317                 NDR_PRINT_IN_DEBUG(winreg_OpenHKCU, &r);
318         }
319
320         status = cli->dispatch(cli,
321                                 mem_ctx,
322                                 &ndr_table_winreg,
323                                 NDR_WINREG_OPENHKCU,
324                                 &r);
325
326         if (!NT_STATUS_IS_OK(status)) {
327                 return status;
328         }
329
330         if (DEBUGLEVEL >= 10) {
331                 NDR_PRINT_OUT_DEBUG(winreg_OpenHKCU, &r);
332         }
333
334         if (NT_STATUS_IS_ERR(status)) {
335                 return status;
336         }
337
338         /* Return variables */
339         *handle = *r.out.handle;
340
341         /* Return result */
342         if (werror) {
343                 *werror = r.out.result;
344         }
345
346         return werror_to_ntstatus(r.out.result);
347 }
348
349 struct rpccli_winreg_OpenHKLM_state {
350         struct winreg_OpenHKLM orig;
351         struct winreg_OpenHKLM tmp;
352         TALLOC_CTX *out_mem_ctx;
353         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
354 };
355
356 static void rpccli_winreg_OpenHKLM_done(struct tevent_req *subreq);
357
358 struct tevent_req *rpccli_winreg_OpenHKLM_send(TALLOC_CTX *mem_ctx,
359                                                struct tevent_context *ev,
360                                                struct rpc_pipe_client *cli,
361                                                uint16_t *_system_name /* [in] [unique] */,
362                                                uint32_t _access_mask /* [in]  */,
363                                                struct policy_handle *_handle /* [out] [ref] */)
364 {
365         struct tevent_req *req;
366         struct rpccli_winreg_OpenHKLM_state *state;
367         struct tevent_req *subreq;
368
369         req = tevent_req_create(mem_ctx, &state,
370                                 struct rpccli_winreg_OpenHKLM_state);
371         if (req == NULL) {
372                 return NULL;
373         }
374         state->out_mem_ctx = NULL;
375         state->dispatch_recv = cli->dispatch_recv;
376
377         /* In parameters */
378         state->orig.in.system_name = _system_name;
379         state->orig.in.access_mask = _access_mask;
380
381         /* Out parameters */
382         state->orig.out.handle = _handle;
383
384         /* Result */
385         ZERO_STRUCT(state->orig.out.result);
386
387         if (DEBUGLEVEL >= 10) {
388                 NDR_PRINT_IN_DEBUG(winreg_OpenHKLM, &state->orig);
389         }
390
391         state->out_mem_ctx = talloc_named_const(state, 0,
392                              "rpccli_winreg_OpenHKLM_out_memory");
393         if (tevent_req_nomem(state->out_mem_ctx, req)) {
394                 return tevent_req_post(req, ev);
395         }
396
397         /* make a temporary copy, that we pass to the dispatch function */
398         state->tmp = state->orig;
399
400         subreq = cli->dispatch_send(state, ev, cli,
401                                     &ndr_table_winreg,
402                                     NDR_WINREG_OPENHKLM,
403                                     &state->tmp);
404         if (tevent_req_nomem(subreq, req)) {
405                 return tevent_req_post(req, ev);
406         }
407         tevent_req_set_callback(subreq, rpccli_winreg_OpenHKLM_done, req);
408         return req;
409 }
410
411 static void rpccli_winreg_OpenHKLM_done(struct tevent_req *subreq)
412 {
413         struct tevent_req *req = tevent_req_callback_data(
414                 subreq, struct tevent_req);
415         struct rpccli_winreg_OpenHKLM_state *state = tevent_req_data(
416                 req, struct rpccli_winreg_OpenHKLM_state);
417         NTSTATUS status;
418         TALLOC_CTX *mem_ctx;
419
420         if (state->out_mem_ctx) {
421                 mem_ctx = state->out_mem_ctx;
422         } else {
423                 mem_ctx = state;
424         }
425
426         status = state->dispatch_recv(subreq, mem_ctx);
427         TALLOC_FREE(subreq);
428         if (!NT_STATUS_IS_OK(status)) {
429                 tevent_req_nterror(req, status);
430                 return;
431         }
432
433         /* Copy out parameters */
434         *state->orig.out.handle = *state->tmp.out.handle;
435
436         /* Copy result */
437         state->orig.out.result = state->tmp.out.result;
438
439         /* Reset temporary structure */
440         ZERO_STRUCT(state->tmp);
441
442         if (DEBUGLEVEL >= 10) {
443                 NDR_PRINT_OUT_DEBUG(winreg_OpenHKLM, &state->orig);
444         }
445
446         tevent_req_done(req);
447 }
448
449 NTSTATUS rpccli_winreg_OpenHKLM_recv(struct tevent_req *req,
450                                      TALLOC_CTX *mem_ctx,
451                                      WERROR *result)
452 {
453         struct rpccli_winreg_OpenHKLM_state *state = tevent_req_data(
454                 req, struct rpccli_winreg_OpenHKLM_state);
455         NTSTATUS status;
456
457         if (tevent_req_is_nterror(req, &status)) {
458                 tevent_req_received(req);
459                 return status;
460         }
461
462         /* Steal possbile out parameters to the callers context */
463         talloc_steal(mem_ctx, state->out_mem_ctx);
464
465         /* Return result */
466         *result = state->orig.out.result;
467
468         tevent_req_received(req);
469         return NT_STATUS_OK;
470 }
471
472 NTSTATUS rpccli_winreg_OpenHKLM(struct rpc_pipe_client *cli,
473                                 TALLOC_CTX *mem_ctx,
474                                 uint16_t *system_name /* [in] [unique] */,
475                                 uint32_t access_mask /* [in]  */,
476                                 struct policy_handle *handle /* [out] [ref] */,
477                                 WERROR *werror)
478 {
479         struct winreg_OpenHKLM r;
480         NTSTATUS status;
481
482         /* In parameters */
483         r.in.system_name = system_name;
484         r.in.access_mask = access_mask;
485
486         if (DEBUGLEVEL >= 10) {
487                 NDR_PRINT_IN_DEBUG(winreg_OpenHKLM, &r);
488         }
489
490         status = cli->dispatch(cli,
491                                 mem_ctx,
492                                 &ndr_table_winreg,
493                                 NDR_WINREG_OPENHKLM,
494                                 &r);
495
496         if (!NT_STATUS_IS_OK(status)) {
497                 return status;
498         }
499
500         if (DEBUGLEVEL >= 10) {
501                 NDR_PRINT_OUT_DEBUG(winreg_OpenHKLM, &r);
502         }
503
504         if (NT_STATUS_IS_ERR(status)) {
505                 return status;
506         }
507
508         /* Return variables */
509         *handle = *r.out.handle;
510
511         /* Return result */
512         if (werror) {
513                 *werror = r.out.result;
514         }
515
516         return werror_to_ntstatus(r.out.result);
517 }
518
519 struct rpccli_winreg_OpenHKPD_state {
520         struct winreg_OpenHKPD orig;
521         struct winreg_OpenHKPD tmp;
522         TALLOC_CTX *out_mem_ctx;
523         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
524 };
525
526 static void rpccli_winreg_OpenHKPD_done(struct tevent_req *subreq);
527
528 struct tevent_req *rpccli_winreg_OpenHKPD_send(TALLOC_CTX *mem_ctx,
529                                                struct tevent_context *ev,
530                                                struct rpc_pipe_client *cli,
531                                                uint16_t *_system_name /* [in] [unique] */,
532                                                uint32_t _access_mask /* [in]  */,
533                                                struct policy_handle *_handle /* [out] [ref] */)
534 {
535         struct tevent_req *req;
536         struct rpccli_winreg_OpenHKPD_state *state;
537         struct tevent_req *subreq;
538
539         req = tevent_req_create(mem_ctx, &state,
540                                 struct rpccli_winreg_OpenHKPD_state);
541         if (req == NULL) {
542                 return NULL;
543         }
544         state->out_mem_ctx = NULL;
545         state->dispatch_recv = cli->dispatch_recv;
546
547         /* In parameters */
548         state->orig.in.system_name = _system_name;
549         state->orig.in.access_mask = _access_mask;
550
551         /* Out parameters */
552         state->orig.out.handle = _handle;
553
554         /* Result */
555         ZERO_STRUCT(state->orig.out.result);
556
557         if (DEBUGLEVEL >= 10) {
558                 NDR_PRINT_IN_DEBUG(winreg_OpenHKPD, &state->orig);
559         }
560
561         state->out_mem_ctx = talloc_named_const(state, 0,
562                              "rpccli_winreg_OpenHKPD_out_memory");
563         if (tevent_req_nomem(state->out_mem_ctx, req)) {
564                 return tevent_req_post(req, ev);
565         }
566
567         /* make a temporary copy, that we pass to the dispatch function */
568         state->tmp = state->orig;
569
570         subreq = cli->dispatch_send(state, ev, cli,
571                                     &ndr_table_winreg,
572                                     NDR_WINREG_OPENHKPD,
573                                     &state->tmp);
574         if (tevent_req_nomem(subreq, req)) {
575                 return tevent_req_post(req, ev);
576         }
577         tevent_req_set_callback(subreq, rpccli_winreg_OpenHKPD_done, req);
578         return req;
579 }
580
581 static void rpccli_winreg_OpenHKPD_done(struct tevent_req *subreq)
582 {
583         struct tevent_req *req = tevent_req_callback_data(
584                 subreq, struct tevent_req);
585         struct rpccli_winreg_OpenHKPD_state *state = tevent_req_data(
586                 req, struct rpccli_winreg_OpenHKPD_state);
587         NTSTATUS status;
588         TALLOC_CTX *mem_ctx;
589
590         if (state->out_mem_ctx) {
591                 mem_ctx = state->out_mem_ctx;
592         } else {
593                 mem_ctx = state;
594         }
595
596         status = state->dispatch_recv(subreq, mem_ctx);
597         TALLOC_FREE(subreq);
598         if (!NT_STATUS_IS_OK(status)) {
599                 tevent_req_nterror(req, status);
600                 return;
601         }
602
603         /* Copy out parameters */
604         *state->orig.out.handle = *state->tmp.out.handle;
605
606         /* Copy result */
607         state->orig.out.result = state->tmp.out.result;
608
609         /* Reset temporary structure */
610         ZERO_STRUCT(state->tmp);
611
612         if (DEBUGLEVEL >= 10) {
613                 NDR_PRINT_OUT_DEBUG(winreg_OpenHKPD, &state->orig);
614         }
615
616         tevent_req_done(req);
617 }
618
619 NTSTATUS rpccli_winreg_OpenHKPD_recv(struct tevent_req *req,
620                                      TALLOC_CTX *mem_ctx,
621                                      WERROR *result)
622 {
623         struct rpccli_winreg_OpenHKPD_state *state = tevent_req_data(
624                 req, struct rpccli_winreg_OpenHKPD_state);
625         NTSTATUS status;
626
627         if (tevent_req_is_nterror(req, &status)) {
628                 tevent_req_received(req);
629                 return status;
630         }
631
632         /* Steal possbile out parameters to the callers context */
633         talloc_steal(mem_ctx, state->out_mem_ctx);
634
635         /* Return result */
636         *result = state->orig.out.result;
637
638         tevent_req_received(req);
639         return NT_STATUS_OK;
640 }
641
642 NTSTATUS rpccli_winreg_OpenHKPD(struct rpc_pipe_client *cli,
643                                 TALLOC_CTX *mem_ctx,
644                                 uint16_t *system_name /* [in] [unique] */,
645                                 uint32_t access_mask /* [in]  */,
646                                 struct policy_handle *handle /* [out] [ref] */,
647                                 WERROR *werror)
648 {
649         struct winreg_OpenHKPD r;
650         NTSTATUS status;
651
652         /* In parameters */
653         r.in.system_name = system_name;
654         r.in.access_mask = access_mask;
655
656         if (DEBUGLEVEL >= 10) {
657                 NDR_PRINT_IN_DEBUG(winreg_OpenHKPD, &r);
658         }
659
660         status = cli->dispatch(cli,
661                                 mem_ctx,
662                                 &ndr_table_winreg,
663                                 NDR_WINREG_OPENHKPD,
664                                 &r);
665
666         if (!NT_STATUS_IS_OK(status)) {
667                 return status;
668         }
669
670         if (DEBUGLEVEL >= 10) {
671                 NDR_PRINT_OUT_DEBUG(winreg_OpenHKPD, &r);
672         }
673
674         if (NT_STATUS_IS_ERR(status)) {
675                 return status;
676         }
677
678         /* Return variables */
679         *handle = *r.out.handle;
680
681         /* Return result */
682         if (werror) {
683                 *werror = r.out.result;
684         }
685
686         return werror_to_ntstatus(r.out.result);
687 }
688
689 struct rpccli_winreg_OpenHKU_state {
690         struct winreg_OpenHKU orig;
691         struct winreg_OpenHKU tmp;
692         TALLOC_CTX *out_mem_ctx;
693         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
694 };
695
696 static void rpccli_winreg_OpenHKU_done(struct tevent_req *subreq);
697
698 struct tevent_req *rpccli_winreg_OpenHKU_send(TALLOC_CTX *mem_ctx,
699                                               struct tevent_context *ev,
700                                               struct rpc_pipe_client *cli,
701                                               uint16_t *_system_name /* [in] [unique] */,
702                                               uint32_t _access_mask /* [in]  */,
703                                               struct policy_handle *_handle /* [out] [ref] */)
704 {
705         struct tevent_req *req;
706         struct rpccli_winreg_OpenHKU_state *state;
707         struct tevent_req *subreq;
708
709         req = tevent_req_create(mem_ctx, &state,
710                                 struct rpccli_winreg_OpenHKU_state);
711         if (req == NULL) {
712                 return NULL;
713         }
714         state->out_mem_ctx = NULL;
715         state->dispatch_recv = cli->dispatch_recv;
716
717         /* In parameters */
718         state->orig.in.system_name = _system_name;
719         state->orig.in.access_mask = _access_mask;
720
721         /* Out parameters */
722         state->orig.out.handle = _handle;
723
724         /* Result */
725         ZERO_STRUCT(state->orig.out.result);
726
727         if (DEBUGLEVEL >= 10) {
728                 NDR_PRINT_IN_DEBUG(winreg_OpenHKU, &state->orig);
729         }
730
731         state->out_mem_ctx = talloc_named_const(state, 0,
732                              "rpccli_winreg_OpenHKU_out_memory");
733         if (tevent_req_nomem(state->out_mem_ctx, req)) {
734                 return tevent_req_post(req, ev);
735         }
736
737         /* make a temporary copy, that we pass to the dispatch function */
738         state->tmp = state->orig;
739
740         subreq = cli->dispatch_send(state, ev, cli,
741                                     &ndr_table_winreg,
742                                     NDR_WINREG_OPENHKU,
743                                     &state->tmp);
744         if (tevent_req_nomem(subreq, req)) {
745                 return tevent_req_post(req, ev);
746         }
747         tevent_req_set_callback(subreq, rpccli_winreg_OpenHKU_done, req);
748         return req;
749 }
750
751 static void rpccli_winreg_OpenHKU_done(struct tevent_req *subreq)
752 {
753         struct tevent_req *req = tevent_req_callback_data(
754                 subreq, struct tevent_req);
755         struct rpccli_winreg_OpenHKU_state *state = tevent_req_data(
756                 req, struct rpccli_winreg_OpenHKU_state);
757         NTSTATUS status;
758         TALLOC_CTX *mem_ctx;
759
760         if (state->out_mem_ctx) {
761                 mem_ctx = state->out_mem_ctx;
762         } else {
763                 mem_ctx = state;
764         }
765
766         status = state->dispatch_recv(subreq, mem_ctx);
767         TALLOC_FREE(subreq);
768         if (!NT_STATUS_IS_OK(status)) {
769                 tevent_req_nterror(req, status);
770                 return;
771         }
772
773         /* Copy out parameters */
774         *state->orig.out.handle = *state->tmp.out.handle;
775
776         /* Copy result */
777         state->orig.out.result = state->tmp.out.result;
778
779         /* Reset temporary structure */
780         ZERO_STRUCT(state->tmp);
781
782         if (DEBUGLEVEL >= 10) {
783                 NDR_PRINT_OUT_DEBUG(winreg_OpenHKU, &state->orig);
784         }
785
786         tevent_req_done(req);
787 }
788
789 NTSTATUS rpccli_winreg_OpenHKU_recv(struct tevent_req *req,
790                                     TALLOC_CTX *mem_ctx,
791                                     WERROR *result)
792 {
793         struct rpccli_winreg_OpenHKU_state *state = tevent_req_data(
794                 req, struct rpccli_winreg_OpenHKU_state);
795         NTSTATUS status;
796
797         if (tevent_req_is_nterror(req, &status)) {
798                 tevent_req_received(req);
799                 return status;
800         }
801
802         /* Steal possbile out parameters to the callers context */
803         talloc_steal(mem_ctx, state->out_mem_ctx);
804
805         /* Return result */
806         *result = state->orig.out.result;
807
808         tevent_req_received(req);
809         return NT_STATUS_OK;
810 }
811
812 NTSTATUS rpccli_winreg_OpenHKU(struct rpc_pipe_client *cli,
813                                TALLOC_CTX *mem_ctx,
814                                uint16_t *system_name /* [in] [unique] */,
815                                uint32_t access_mask /* [in]  */,
816                                struct policy_handle *handle /* [out] [ref] */,
817                                WERROR *werror)
818 {
819         struct winreg_OpenHKU r;
820         NTSTATUS status;
821
822         /* In parameters */
823         r.in.system_name = system_name;
824         r.in.access_mask = access_mask;
825
826         if (DEBUGLEVEL >= 10) {
827                 NDR_PRINT_IN_DEBUG(winreg_OpenHKU, &r);
828         }
829
830         status = cli->dispatch(cli,
831                                 mem_ctx,
832                                 &ndr_table_winreg,
833                                 NDR_WINREG_OPENHKU,
834                                 &r);
835
836         if (!NT_STATUS_IS_OK(status)) {
837                 return status;
838         }
839
840         if (DEBUGLEVEL >= 10) {
841                 NDR_PRINT_OUT_DEBUG(winreg_OpenHKU, &r);
842         }
843
844         if (NT_STATUS_IS_ERR(status)) {
845                 return status;
846         }
847
848         /* Return variables */
849         *handle = *r.out.handle;
850
851         /* Return result */
852         if (werror) {
853                 *werror = r.out.result;
854         }
855
856         return werror_to_ntstatus(r.out.result);
857 }
858
859 struct rpccli_winreg_CloseKey_state {
860         struct winreg_CloseKey orig;
861         struct winreg_CloseKey tmp;
862         TALLOC_CTX *out_mem_ctx;
863         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
864 };
865
866 static void rpccli_winreg_CloseKey_done(struct tevent_req *subreq);
867
868 struct tevent_req *rpccli_winreg_CloseKey_send(TALLOC_CTX *mem_ctx,
869                                                struct tevent_context *ev,
870                                                struct rpc_pipe_client *cli,
871                                                struct policy_handle *_handle /* [in,out] [ref] */)
872 {
873         struct tevent_req *req;
874         struct rpccli_winreg_CloseKey_state *state;
875         struct tevent_req *subreq;
876
877         req = tevent_req_create(mem_ctx, &state,
878                                 struct rpccli_winreg_CloseKey_state);
879         if (req == NULL) {
880                 return NULL;
881         }
882         state->out_mem_ctx = NULL;
883         state->dispatch_recv = cli->dispatch_recv;
884
885         /* In parameters */
886         state->orig.in.handle = _handle;
887
888         /* Out parameters */
889         state->orig.out.handle = _handle;
890
891         /* Result */
892         ZERO_STRUCT(state->orig.out.result);
893
894         if (DEBUGLEVEL >= 10) {
895                 NDR_PRINT_IN_DEBUG(winreg_CloseKey, &state->orig);
896         }
897
898         state->out_mem_ctx = talloc_named_const(state, 0,
899                              "rpccli_winreg_CloseKey_out_memory");
900         if (tevent_req_nomem(state->out_mem_ctx, req)) {
901                 return tevent_req_post(req, ev);
902         }
903
904         /* make a temporary copy, that we pass to the dispatch function */
905         state->tmp = state->orig;
906
907         subreq = cli->dispatch_send(state, ev, cli,
908                                     &ndr_table_winreg,
909                                     NDR_WINREG_CLOSEKEY,
910                                     &state->tmp);
911         if (tevent_req_nomem(subreq, req)) {
912                 return tevent_req_post(req, ev);
913         }
914         tevent_req_set_callback(subreq, rpccli_winreg_CloseKey_done, req);
915         return req;
916 }
917
918 static void rpccli_winreg_CloseKey_done(struct tevent_req *subreq)
919 {
920         struct tevent_req *req = tevent_req_callback_data(
921                 subreq, struct tevent_req);
922         struct rpccli_winreg_CloseKey_state *state = tevent_req_data(
923                 req, struct rpccli_winreg_CloseKey_state);
924         NTSTATUS status;
925         TALLOC_CTX *mem_ctx;
926
927         if (state->out_mem_ctx) {
928                 mem_ctx = state->out_mem_ctx;
929         } else {
930                 mem_ctx = state;
931         }
932
933         status = state->dispatch_recv(subreq, mem_ctx);
934         TALLOC_FREE(subreq);
935         if (!NT_STATUS_IS_OK(status)) {
936                 tevent_req_nterror(req, status);
937                 return;
938         }
939
940         /* Copy out parameters */
941         *state->orig.out.handle = *state->tmp.out.handle;
942
943         /* Copy result */
944         state->orig.out.result = state->tmp.out.result;
945
946         /* Reset temporary structure */
947         ZERO_STRUCT(state->tmp);
948
949         if (DEBUGLEVEL >= 10) {
950                 NDR_PRINT_OUT_DEBUG(winreg_CloseKey, &state->orig);
951         }
952
953         tevent_req_done(req);
954 }
955
956 NTSTATUS rpccli_winreg_CloseKey_recv(struct tevent_req *req,
957                                      TALLOC_CTX *mem_ctx,
958                                      WERROR *result)
959 {
960         struct rpccli_winreg_CloseKey_state *state = tevent_req_data(
961                 req, struct rpccli_winreg_CloseKey_state);
962         NTSTATUS status;
963
964         if (tevent_req_is_nterror(req, &status)) {
965                 tevent_req_received(req);
966                 return status;
967         }
968
969         /* Steal possbile out parameters to the callers context */
970         talloc_steal(mem_ctx, state->out_mem_ctx);
971
972         /* Return result */
973         *result = state->orig.out.result;
974
975         tevent_req_received(req);
976         return NT_STATUS_OK;
977 }
978
979 NTSTATUS rpccli_winreg_CloseKey(struct rpc_pipe_client *cli,
980                                 TALLOC_CTX *mem_ctx,
981                                 struct policy_handle *handle /* [in,out] [ref] */,
982                                 WERROR *werror)
983 {
984         struct winreg_CloseKey r;
985         NTSTATUS status;
986
987         /* In parameters */
988         r.in.handle = handle;
989
990         if (DEBUGLEVEL >= 10) {
991                 NDR_PRINT_IN_DEBUG(winreg_CloseKey, &r);
992         }
993
994         status = cli->dispatch(cli,
995                                 mem_ctx,
996                                 &ndr_table_winreg,
997                                 NDR_WINREG_CLOSEKEY,
998                                 &r);
999
1000         if (!NT_STATUS_IS_OK(status)) {
1001                 return status;
1002         }
1003
1004         if (DEBUGLEVEL >= 10) {
1005                 NDR_PRINT_OUT_DEBUG(winreg_CloseKey, &r);
1006         }
1007
1008         if (NT_STATUS_IS_ERR(status)) {
1009                 return status;
1010         }
1011
1012         /* Return variables */
1013         *handle = *r.out.handle;
1014
1015         /* Return result */
1016         if (werror) {
1017                 *werror = r.out.result;
1018         }
1019
1020         return werror_to_ntstatus(r.out.result);
1021 }
1022
1023 struct rpccli_winreg_CreateKey_state {
1024         struct winreg_CreateKey orig;
1025         struct winreg_CreateKey tmp;
1026         TALLOC_CTX *out_mem_ctx;
1027         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1028 };
1029
1030 static void rpccli_winreg_CreateKey_done(struct tevent_req *subreq);
1031
1032 struct tevent_req *rpccli_winreg_CreateKey_send(TALLOC_CTX *mem_ctx,
1033                                                 struct tevent_context *ev,
1034                                                 struct rpc_pipe_client *cli,
1035                                                 struct policy_handle *_handle /* [in] [ref] */,
1036                                                 struct winreg_String _name /* [in]  */,
1037                                                 struct winreg_String _keyclass /* [in]  */,
1038                                                 uint32_t _options /* [in]  */,
1039                                                 uint32_t _access_mask /* [in]  */,
1040                                                 struct winreg_SecBuf *_secdesc /* [in] [unique] */,
1041                                                 struct policy_handle *_new_handle /* [out] [ref] */,
1042                                                 enum winreg_CreateAction *_action_taken /* [in,out] [unique] */)
1043 {
1044         struct tevent_req *req;
1045         struct rpccli_winreg_CreateKey_state *state;
1046         struct tevent_req *subreq;
1047
1048         req = tevent_req_create(mem_ctx, &state,
1049                                 struct rpccli_winreg_CreateKey_state);
1050         if (req == NULL) {
1051                 return NULL;
1052         }
1053         state->out_mem_ctx = NULL;
1054         state->dispatch_recv = cli->dispatch_recv;
1055
1056         /* In parameters */
1057         state->orig.in.handle = _handle;
1058         state->orig.in.name = _name;
1059         state->orig.in.keyclass = _keyclass;
1060         state->orig.in.options = _options;
1061         state->orig.in.access_mask = _access_mask;
1062         state->orig.in.secdesc = _secdesc;
1063         state->orig.in.action_taken = _action_taken;
1064
1065         /* Out parameters */
1066         state->orig.out.new_handle = _new_handle;
1067         state->orig.out.action_taken = _action_taken;
1068
1069         /* Result */
1070         ZERO_STRUCT(state->orig.out.result);
1071
1072         if (DEBUGLEVEL >= 10) {
1073                 NDR_PRINT_IN_DEBUG(winreg_CreateKey, &state->orig);
1074         }
1075
1076         state->out_mem_ctx = talloc_named_const(state, 0,
1077                              "rpccli_winreg_CreateKey_out_memory");
1078         if (tevent_req_nomem(state->out_mem_ctx, req)) {
1079                 return tevent_req_post(req, ev);
1080         }
1081
1082         /* make a temporary copy, that we pass to the dispatch function */
1083         state->tmp = state->orig;
1084
1085         subreq = cli->dispatch_send(state, ev, cli,
1086                                     &ndr_table_winreg,
1087                                     NDR_WINREG_CREATEKEY,
1088                                     &state->tmp);
1089         if (tevent_req_nomem(subreq, req)) {
1090                 return tevent_req_post(req, ev);
1091         }
1092         tevent_req_set_callback(subreq, rpccli_winreg_CreateKey_done, req);
1093         return req;
1094 }
1095
1096 static void rpccli_winreg_CreateKey_done(struct tevent_req *subreq)
1097 {
1098         struct tevent_req *req = tevent_req_callback_data(
1099                 subreq, struct tevent_req);
1100         struct rpccli_winreg_CreateKey_state *state = tevent_req_data(
1101                 req, struct rpccli_winreg_CreateKey_state);
1102         NTSTATUS status;
1103         TALLOC_CTX *mem_ctx;
1104
1105         if (state->out_mem_ctx) {
1106                 mem_ctx = state->out_mem_ctx;
1107         } else {
1108                 mem_ctx = state;
1109         }
1110
1111         status = state->dispatch_recv(subreq, mem_ctx);
1112         TALLOC_FREE(subreq);
1113         if (!NT_STATUS_IS_OK(status)) {
1114                 tevent_req_nterror(req, status);
1115                 return;
1116         }
1117
1118         /* Copy out parameters */
1119         *state->orig.out.new_handle = *state->tmp.out.new_handle;
1120         if (state->orig.out.action_taken && state->tmp.out.action_taken) {
1121                 *state->orig.out.action_taken = *state->tmp.out.action_taken;
1122         }
1123
1124         /* Copy result */
1125         state->orig.out.result = state->tmp.out.result;
1126
1127         /* Reset temporary structure */
1128         ZERO_STRUCT(state->tmp);
1129
1130         if (DEBUGLEVEL >= 10) {
1131                 NDR_PRINT_OUT_DEBUG(winreg_CreateKey, &state->orig);
1132         }
1133
1134         tevent_req_done(req);
1135 }
1136
1137 NTSTATUS rpccli_winreg_CreateKey_recv(struct tevent_req *req,
1138                                       TALLOC_CTX *mem_ctx,
1139                                       WERROR *result)
1140 {
1141         struct rpccli_winreg_CreateKey_state *state = tevent_req_data(
1142                 req, struct rpccli_winreg_CreateKey_state);
1143         NTSTATUS status;
1144
1145         if (tevent_req_is_nterror(req, &status)) {
1146                 tevent_req_received(req);
1147                 return status;
1148         }
1149
1150         /* Steal possbile out parameters to the callers context */
1151         talloc_steal(mem_ctx, state->out_mem_ctx);
1152
1153         /* Return result */
1154         *result = state->orig.out.result;
1155
1156         tevent_req_received(req);
1157         return NT_STATUS_OK;
1158 }
1159
1160 NTSTATUS rpccli_winreg_CreateKey(struct rpc_pipe_client *cli,
1161                                  TALLOC_CTX *mem_ctx,
1162                                  struct policy_handle *handle /* [in] [ref] */,
1163                                  struct winreg_String name /* [in]  */,
1164                                  struct winreg_String keyclass /* [in]  */,
1165                                  uint32_t options /* [in]  */,
1166                                  uint32_t access_mask /* [in]  */,
1167                                  struct winreg_SecBuf *secdesc /* [in] [unique] */,
1168                                  struct policy_handle *new_handle /* [out] [ref] */,
1169                                  enum winreg_CreateAction *action_taken /* [in,out] [unique] */,
1170                                  WERROR *werror)
1171 {
1172         struct winreg_CreateKey r;
1173         NTSTATUS status;
1174
1175         /* In parameters */
1176         r.in.handle = handle;
1177         r.in.name = name;
1178         r.in.keyclass = keyclass;
1179         r.in.options = options;
1180         r.in.access_mask = access_mask;
1181         r.in.secdesc = secdesc;
1182         r.in.action_taken = action_taken;
1183
1184         if (DEBUGLEVEL >= 10) {
1185                 NDR_PRINT_IN_DEBUG(winreg_CreateKey, &r);
1186         }
1187
1188         status = cli->dispatch(cli,
1189                                 mem_ctx,
1190                                 &ndr_table_winreg,
1191                                 NDR_WINREG_CREATEKEY,
1192                                 &r);
1193
1194         if (!NT_STATUS_IS_OK(status)) {
1195                 return status;
1196         }
1197
1198         if (DEBUGLEVEL >= 10) {
1199                 NDR_PRINT_OUT_DEBUG(winreg_CreateKey, &r);
1200         }
1201
1202         if (NT_STATUS_IS_ERR(status)) {
1203                 return status;
1204         }
1205
1206         /* Return variables */
1207         *new_handle = *r.out.new_handle;
1208         if (action_taken && r.out.action_taken) {
1209                 *action_taken = *r.out.action_taken;
1210         }
1211
1212         /* Return result */
1213         if (werror) {
1214                 *werror = r.out.result;
1215         }
1216
1217         return werror_to_ntstatus(r.out.result);
1218 }
1219
1220 struct rpccli_winreg_DeleteKey_state {
1221         struct winreg_DeleteKey orig;
1222         struct winreg_DeleteKey tmp;
1223         TALLOC_CTX *out_mem_ctx;
1224         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1225 };
1226
1227 static void rpccli_winreg_DeleteKey_done(struct tevent_req *subreq);
1228
1229 struct tevent_req *rpccli_winreg_DeleteKey_send(TALLOC_CTX *mem_ctx,
1230                                                 struct tevent_context *ev,
1231                                                 struct rpc_pipe_client *cli,
1232                                                 struct policy_handle *_handle /* [in] [ref] */,
1233                                                 struct winreg_String _key /* [in]  */)
1234 {
1235         struct tevent_req *req;
1236         struct rpccli_winreg_DeleteKey_state *state;
1237         struct tevent_req *subreq;
1238
1239         req = tevent_req_create(mem_ctx, &state,
1240                                 struct rpccli_winreg_DeleteKey_state);
1241         if (req == NULL) {
1242                 return NULL;
1243         }
1244         state->out_mem_ctx = NULL;
1245         state->dispatch_recv = cli->dispatch_recv;
1246
1247         /* In parameters */
1248         state->orig.in.handle = _handle;
1249         state->orig.in.key = _key;
1250
1251         /* Out parameters */
1252
1253         /* Result */
1254         ZERO_STRUCT(state->orig.out.result);
1255
1256         if (DEBUGLEVEL >= 10) {
1257                 NDR_PRINT_IN_DEBUG(winreg_DeleteKey, &state->orig);
1258         }
1259
1260         /* make a temporary copy, that we pass to the dispatch function */
1261         state->tmp = state->orig;
1262
1263         subreq = cli->dispatch_send(state, ev, cli,
1264                                     &ndr_table_winreg,
1265                                     NDR_WINREG_DELETEKEY,
1266                                     &state->tmp);
1267         if (tevent_req_nomem(subreq, req)) {
1268                 return tevent_req_post(req, ev);
1269         }
1270         tevent_req_set_callback(subreq, rpccli_winreg_DeleteKey_done, req);
1271         return req;
1272 }
1273
1274 static void rpccli_winreg_DeleteKey_done(struct tevent_req *subreq)
1275 {
1276         struct tevent_req *req = tevent_req_callback_data(
1277                 subreq, struct tevent_req);
1278         struct rpccli_winreg_DeleteKey_state *state = tevent_req_data(
1279                 req, struct rpccli_winreg_DeleteKey_state);
1280         NTSTATUS status;
1281         TALLOC_CTX *mem_ctx;
1282
1283         if (state->out_mem_ctx) {
1284                 mem_ctx = state->out_mem_ctx;
1285         } else {
1286                 mem_ctx = state;
1287         }
1288
1289         status = state->dispatch_recv(subreq, mem_ctx);
1290         TALLOC_FREE(subreq);
1291         if (!NT_STATUS_IS_OK(status)) {
1292                 tevent_req_nterror(req, status);
1293                 return;
1294         }
1295
1296         /* Copy out parameters */
1297
1298         /* Copy result */
1299         state->orig.out.result = state->tmp.out.result;
1300
1301         /* Reset temporary structure */
1302         ZERO_STRUCT(state->tmp);
1303
1304         if (DEBUGLEVEL >= 10) {
1305                 NDR_PRINT_OUT_DEBUG(winreg_DeleteKey, &state->orig);
1306         }
1307
1308         tevent_req_done(req);
1309 }
1310
1311 NTSTATUS rpccli_winreg_DeleteKey_recv(struct tevent_req *req,
1312                                       TALLOC_CTX *mem_ctx,
1313                                       WERROR *result)
1314 {
1315         struct rpccli_winreg_DeleteKey_state *state = tevent_req_data(
1316                 req, struct rpccli_winreg_DeleteKey_state);
1317         NTSTATUS status;
1318
1319         if (tevent_req_is_nterror(req, &status)) {
1320                 tevent_req_received(req);
1321                 return status;
1322         }
1323
1324         /* Steal possbile out parameters to the callers context */
1325         talloc_steal(mem_ctx, state->out_mem_ctx);
1326
1327         /* Return result */
1328         *result = state->orig.out.result;
1329
1330         tevent_req_received(req);
1331         return NT_STATUS_OK;
1332 }
1333
1334 NTSTATUS rpccli_winreg_DeleteKey(struct rpc_pipe_client *cli,
1335                                  TALLOC_CTX *mem_ctx,
1336                                  struct policy_handle *handle /* [in] [ref] */,
1337                                  struct winreg_String key /* [in]  */,
1338                                  WERROR *werror)
1339 {
1340         struct winreg_DeleteKey r;
1341         NTSTATUS status;
1342
1343         /* In parameters */
1344         r.in.handle = handle;
1345         r.in.key = key;
1346
1347         if (DEBUGLEVEL >= 10) {
1348                 NDR_PRINT_IN_DEBUG(winreg_DeleteKey, &r);
1349         }
1350
1351         status = cli->dispatch(cli,
1352                                 mem_ctx,
1353                                 &ndr_table_winreg,
1354                                 NDR_WINREG_DELETEKEY,
1355                                 &r);
1356
1357         if (!NT_STATUS_IS_OK(status)) {
1358                 return status;
1359         }
1360
1361         if (DEBUGLEVEL >= 10) {
1362                 NDR_PRINT_OUT_DEBUG(winreg_DeleteKey, &r);
1363         }
1364
1365         if (NT_STATUS_IS_ERR(status)) {
1366                 return status;
1367         }
1368
1369         /* Return variables */
1370
1371         /* Return result */
1372         if (werror) {
1373                 *werror = r.out.result;
1374         }
1375
1376         return werror_to_ntstatus(r.out.result);
1377 }
1378
1379 struct rpccli_winreg_DeleteValue_state {
1380         struct winreg_DeleteValue orig;
1381         struct winreg_DeleteValue tmp;
1382         TALLOC_CTX *out_mem_ctx;
1383         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1384 };
1385
1386 static void rpccli_winreg_DeleteValue_done(struct tevent_req *subreq);
1387
1388 struct tevent_req *rpccli_winreg_DeleteValue_send(TALLOC_CTX *mem_ctx,
1389                                                   struct tevent_context *ev,
1390                                                   struct rpc_pipe_client *cli,
1391                                                   struct policy_handle *_handle /* [in] [ref] */,
1392                                                   struct winreg_String _value /* [in]  */)
1393 {
1394         struct tevent_req *req;
1395         struct rpccli_winreg_DeleteValue_state *state;
1396         struct tevent_req *subreq;
1397
1398         req = tevent_req_create(mem_ctx, &state,
1399                                 struct rpccli_winreg_DeleteValue_state);
1400         if (req == NULL) {
1401                 return NULL;
1402         }
1403         state->out_mem_ctx = NULL;
1404         state->dispatch_recv = cli->dispatch_recv;
1405
1406         /* In parameters */
1407         state->orig.in.handle = _handle;
1408         state->orig.in.value = _value;
1409
1410         /* Out parameters */
1411
1412         /* Result */
1413         ZERO_STRUCT(state->orig.out.result);
1414
1415         if (DEBUGLEVEL >= 10) {
1416                 NDR_PRINT_IN_DEBUG(winreg_DeleteValue, &state->orig);
1417         }
1418
1419         /* make a temporary copy, that we pass to the dispatch function */
1420         state->tmp = state->orig;
1421
1422         subreq = cli->dispatch_send(state, ev, cli,
1423                                     &ndr_table_winreg,
1424                                     NDR_WINREG_DELETEVALUE,
1425                                     &state->tmp);
1426         if (tevent_req_nomem(subreq, req)) {
1427                 return tevent_req_post(req, ev);
1428         }
1429         tevent_req_set_callback(subreq, rpccli_winreg_DeleteValue_done, req);
1430         return req;
1431 }
1432
1433 static void rpccli_winreg_DeleteValue_done(struct tevent_req *subreq)
1434 {
1435         struct tevent_req *req = tevent_req_callback_data(
1436                 subreq, struct tevent_req);
1437         struct rpccli_winreg_DeleteValue_state *state = tevent_req_data(
1438                 req, struct rpccli_winreg_DeleteValue_state);
1439         NTSTATUS status;
1440         TALLOC_CTX *mem_ctx;
1441
1442         if (state->out_mem_ctx) {
1443                 mem_ctx = state->out_mem_ctx;
1444         } else {
1445                 mem_ctx = state;
1446         }
1447
1448         status = state->dispatch_recv(subreq, mem_ctx);
1449         TALLOC_FREE(subreq);
1450         if (!NT_STATUS_IS_OK(status)) {
1451                 tevent_req_nterror(req, status);
1452                 return;
1453         }
1454
1455         /* Copy out parameters */
1456
1457         /* Copy result */
1458         state->orig.out.result = state->tmp.out.result;
1459
1460         /* Reset temporary structure */
1461         ZERO_STRUCT(state->tmp);
1462
1463         if (DEBUGLEVEL >= 10) {
1464                 NDR_PRINT_OUT_DEBUG(winreg_DeleteValue, &state->orig);
1465         }
1466
1467         tevent_req_done(req);
1468 }
1469
1470 NTSTATUS rpccli_winreg_DeleteValue_recv(struct tevent_req *req,
1471                                         TALLOC_CTX *mem_ctx,
1472                                         WERROR *result)
1473 {
1474         struct rpccli_winreg_DeleteValue_state *state = tevent_req_data(
1475                 req, struct rpccli_winreg_DeleteValue_state);
1476         NTSTATUS status;
1477
1478         if (tevent_req_is_nterror(req, &status)) {
1479                 tevent_req_received(req);
1480                 return status;
1481         }
1482
1483         /* Steal possbile out parameters to the callers context */
1484         talloc_steal(mem_ctx, state->out_mem_ctx);
1485
1486         /* Return result */
1487         *result = state->orig.out.result;
1488
1489         tevent_req_received(req);
1490         return NT_STATUS_OK;
1491 }
1492
1493 NTSTATUS rpccli_winreg_DeleteValue(struct rpc_pipe_client *cli,
1494                                    TALLOC_CTX *mem_ctx,
1495                                    struct policy_handle *handle /* [in] [ref] */,
1496                                    struct winreg_String value /* [in]  */,
1497                                    WERROR *werror)
1498 {
1499         struct winreg_DeleteValue r;
1500         NTSTATUS status;
1501
1502         /* In parameters */
1503         r.in.handle = handle;
1504         r.in.value = value;
1505
1506         if (DEBUGLEVEL >= 10) {
1507                 NDR_PRINT_IN_DEBUG(winreg_DeleteValue, &r);
1508         }
1509
1510         status = cli->dispatch(cli,
1511                                 mem_ctx,
1512                                 &ndr_table_winreg,
1513                                 NDR_WINREG_DELETEVALUE,
1514                                 &r);
1515
1516         if (!NT_STATUS_IS_OK(status)) {
1517                 return status;
1518         }
1519
1520         if (DEBUGLEVEL >= 10) {
1521                 NDR_PRINT_OUT_DEBUG(winreg_DeleteValue, &r);
1522         }
1523
1524         if (NT_STATUS_IS_ERR(status)) {
1525                 return status;
1526         }
1527
1528         /* Return variables */
1529
1530         /* Return result */
1531         if (werror) {
1532                 *werror = r.out.result;
1533         }
1534
1535         return werror_to_ntstatus(r.out.result);
1536 }
1537
1538 struct rpccli_winreg_EnumKey_state {
1539         struct winreg_EnumKey orig;
1540         struct winreg_EnumKey tmp;
1541         TALLOC_CTX *out_mem_ctx;
1542         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1543 };
1544
1545 static void rpccli_winreg_EnumKey_done(struct tevent_req *subreq);
1546
1547 struct tevent_req *rpccli_winreg_EnumKey_send(TALLOC_CTX *mem_ctx,
1548                                               struct tevent_context *ev,
1549                                               struct rpc_pipe_client *cli,
1550                                               struct policy_handle *_handle /* [in] [ref] */,
1551                                               uint32_t _enum_index /* [in]  */,
1552                                               struct winreg_StringBuf *_name /* [in,out] [ref] */,
1553                                               struct winreg_StringBuf *_keyclass /* [in,out] [unique] */,
1554                                               NTTIME *_last_changed_time /* [in,out] [unique] */)
1555 {
1556         struct tevent_req *req;
1557         struct rpccli_winreg_EnumKey_state *state;
1558         struct tevent_req *subreq;
1559
1560         req = tevent_req_create(mem_ctx, &state,
1561                                 struct rpccli_winreg_EnumKey_state);
1562         if (req == NULL) {
1563                 return NULL;
1564         }
1565         state->out_mem_ctx = NULL;
1566         state->dispatch_recv = cli->dispatch_recv;
1567
1568         /* In parameters */
1569         state->orig.in.handle = _handle;
1570         state->orig.in.enum_index = _enum_index;
1571         state->orig.in.name = _name;
1572         state->orig.in.keyclass = _keyclass;
1573         state->orig.in.last_changed_time = _last_changed_time;
1574
1575         /* Out parameters */
1576         state->orig.out.name = _name;
1577         state->orig.out.keyclass = _keyclass;
1578         state->orig.out.last_changed_time = _last_changed_time;
1579
1580         /* Result */
1581         ZERO_STRUCT(state->orig.out.result);
1582
1583         if (DEBUGLEVEL >= 10) {
1584                 NDR_PRINT_IN_DEBUG(winreg_EnumKey, &state->orig);
1585         }
1586
1587         state->out_mem_ctx = talloc_named_const(state, 0,
1588                              "rpccli_winreg_EnumKey_out_memory");
1589         if (tevent_req_nomem(state->out_mem_ctx, req)) {
1590                 return tevent_req_post(req, ev);
1591         }
1592
1593         /* make a temporary copy, that we pass to the dispatch function */
1594         state->tmp = state->orig;
1595
1596         subreq = cli->dispatch_send(state, ev, cli,
1597                                     &ndr_table_winreg,
1598                                     NDR_WINREG_ENUMKEY,
1599                                     &state->tmp);
1600         if (tevent_req_nomem(subreq, req)) {
1601                 return tevent_req_post(req, ev);
1602         }
1603         tevent_req_set_callback(subreq, rpccli_winreg_EnumKey_done, req);
1604         return req;
1605 }
1606
1607 static void rpccli_winreg_EnumKey_done(struct tevent_req *subreq)
1608 {
1609         struct tevent_req *req = tevent_req_callback_data(
1610                 subreq, struct tevent_req);
1611         struct rpccli_winreg_EnumKey_state *state = tevent_req_data(
1612                 req, struct rpccli_winreg_EnumKey_state);
1613         NTSTATUS status;
1614         TALLOC_CTX *mem_ctx;
1615
1616         if (state->out_mem_ctx) {
1617                 mem_ctx = state->out_mem_ctx;
1618         } else {
1619                 mem_ctx = state;
1620         }
1621
1622         status = state->dispatch_recv(subreq, mem_ctx);
1623         TALLOC_FREE(subreq);
1624         if (!NT_STATUS_IS_OK(status)) {
1625                 tevent_req_nterror(req, status);
1626                 return;
1627         }
1628
1629         /* Copy out parameters */
1630         *state->orig.out.name = *state->tmp.out.name;
1631         if (state->orig.out.keyclass && state->tmp.out.keyclass) {
1632                 *state->orig.out.keyclass = *state->tmp.out.keyclass;
1633         }
1634         if (state->orig.out.last_changed_time && state->tmp.out.last_changed_time) {
1635                 *state->orig.out.last_changed_time = *state->tmp.out.last_changed_time;
1636         }
1637
1638         /* Copy result */
1639         state->orig.out.result = state->tmp.out.result;
1640
1641         /* Reset temporary structure */
1642         ZERO_STRUCT(state->tmp);
1643
1644         if (DEBUGLEVEL >= 10) {
1645                 NDR_PRINT_OUT_DEBUG(winreg_EnumKey, &state->orig);
1646         }
1647
1648         tevent_req_done(req);
1649 }
1650
1651 NTSTATUS rpccli_winreg_EnumKey_recv(struct tevent_req *req,
1652                                     TALLOC_CTX *mem_ctx,
1653                                     WERROR *result)
1654 {
1655         struct rpccli_winreg_EnumKey_state *state = tevent_req_data(
1656                 req, struct rpccli_winreg_EnumKey_state);
1657         NTSTATUS status;
1658
1659         if (tevent_req_is_nterror(req, &status)) {
1660                 tevent_req_received(req);
1661                 return status;
1662         }
1663
1664         /* Steal possbile out parameters to the callers context */
1665         talloc_steal(mem_ctx, state->out_mem_ctx);
1666
1667         /* Return result */
1668         *result = state->orig.out.result;
1669
1670         tevent_req_received(req);
1671         return NT_STATUS_OK;
1672 }
1673
1674 NTSTATUS rpccli_winreg_EnumKey(struct rpc_pipe_client *cli,
1675                                TALLOC_CTX *mem_ctx,
1676                                struct policy_handle *handle /* [in] [ref] */,
1677                                uint32_t enum_index /* [in]  */,
1678                                struct winreg_StringBuf *name /* [in,out] [ref] */,
1679                                struct winreg_StringBuf *keyclass /* [in,out] [unique] */,
1680                                NTTIME *last_changed_time /* [in,out] [unique] */,
1681                                WERROR *werror)
1682 {
1683         struct winreg_EnumKey r;
1684         NTSTATUS status;
1685
1686         /* In parameters */
1687         r.in.handle = handle;
1688         r.in.enum_index = enum_index;
1689         r.in.name = name;
1690         r.in.keyclass = keyclass;
1691         r.in.last_changed_time = last_changed_time;
1692
1693         if (DEBUGLEVEL >= 10) {
1694                 NDR_PRINT_IN_DEBUG(winreg_EnumKey, &r);
1695         }
1696
1697         status = cli->dispatch(cli,
1698                                 mem_ctx,
1699                                 &ndr_table_winreg,
1700                                 NDR_WINREG_ENUMKEY,
1701                                 &r);
1702
1703         if (!NT_STATUS_IS_OK(status)) {
1704                 return status;
1705         }
1706
1707         if (DEBUGLEVEL >= 10) {
1708                 NDR_PRINT_OUT_DEBUG(winreg_EnumKey, &r);
1709         }
1710
1711         if (NT_STATUS_IS_ERR(status)) {
1712                 return status;
1713         }
1714
1715         /* Return variables */
1716         *name = *r.out.name;
1717         if (keyclass && r.out.keyclass) {
1718                 *keyclass = *r.out.keyclass;
1719         }
1720         if (last_changed_time && r.out.last_changed_time) {
1721                 *last_changed_time = *r.out.last_changed_time;
1722         }
1723
1724         /* Return result */
1725         if (werror) {
1726                 *werror = r.out.result;
1727         }
1728
1729         return werror_to_ntstatus(r.out.result);
1730 }
1731
1732 struct rpccli_winreg_EnumValue_state {
1733         struct winreg_EnumValue orig;
1734         struct winreg_EnumValue tmp;
1735         TALLOC_CTX *out_mem_ctx;
1736         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1737 };
1738
1739 static void rpccli_winreg_EnumValue_done(struct tevent_req *subreq);
1740
1741 struct tevent_req *rpccli_winreg_EnumValue_send(TALLOC_CTX *mem_ctx,
1742                                                 struct tevent_context *ev,
1743                                                 struct rpc_pipe_client *cli,
1744                                                 struct policy_handle *_handle /* [in] [ref] */,
1745                                                 uint32_t _enum_index /* [in]  */,
1746                                                 struct winreg_ValNameBuf *_name /* [in,out] [ref] */,
1747                                                 enum winreg_Type *_type /* [in,out] [unique] */,
1748                                                 uint8_t *_value /* [in,out] [unique,length_is(*length),size_is(*size)] */,
1749                                                 uint32_t *_size /* [in,out] [unique] */,
1750                                                 uint32_t *_length /* [in,out] [unique] */)
1751 {
1752         struct tevent_req *req;
1753         struct rpccli_winreg_EnumValue_state *state;
1754         struct tevent_req *subreq;
1755
1756         req = tevent_req_create(mem_ctx, &state,
1757                                 struct rpccli_winreg_EnumValue_state);
1758         if (req == NULL) {
1759                 return NULL;
1760         }
1761         state->out_mem_ctx = NULL;
1762         state->dispatch_recv = cli->dispatch_recv;
1763
1764         /* In parameters */
1765         state->orig.in.handle = _handle;
1766         state->orig.in.enum_index = _enum_index;
1767         state->orig.in.name = _name;
1768         state->orig.in.type = _type;
1769         state->orig.in.value = _value;
1770         state->orig.in.size = _size;
1771         state->orig.in.length = _length;
1772
1773         /* Out parameters */
1774         state->orig.out.name = _name;
1775         state->orig.out.type = _type;
1776         state->orig.out.value = _value;
1777         state->orig.out.size = _size;
1778         state->orig.out.length = _length;
1779
1780         /* Result */
1781         ZERO_STRUCT(state->orig.out.result);
1782
1783         if (DEBUGLEVEL >= 10) {
1784                 NDR_PRINT_IN_DEBUG(winreg_EnumValue, &state->orig);
1785         }
1786
1787         state->out_mem_ctx = talloc_named_const(state, 0,
1788                              "rpccli_winreg_EnumValue_out_memory");
1789         if (tevent_req_nomem(state->out_mem_ctx, req)) {
1790                 return tevent_req_post(req, ev);
1791         }
1792
1793         /* make a temporary copy, that we pass to the dispatch function */
1794         state->tmp = state->orig;
1795
1796         subreq = cli->dispatch_send(state, ev, cli,
1797                                     &ndr_table_winreg,
1798                                     NDR_WINREG_ENUMVALUE,
1799                                     &state->tmp);
1800         if (tevent_req_nomem(subreq, req)) {
1801                 return tevent_req_post(req, ev);
1802         }
1803         tevent_req_set_callback(subreq, rpccli_winreg_EnumValue_done, req);
1804         return req;
1805 }
1806
1807 static void rpccli_winreg_EnumValue_done(struct tevent_req *subreq)
1808 {
1809         struct tevent_req *req = tevent_req_callback_data(
1810                 subreq, struct tevent_req);
1811         struct rpccli_winreg_EnumValue_state *state = tevent_req_data(
1812                 req, struct rpccli_winreg_EnumValue_state);
1813         NTSTATUS status;
1814         TALLOC_CTX *mem_ctx;
1815
1816         if (state->out_mem_ctx) {
1817                 mem_ctx = state->out_mem_ctx;
1818         } else {
1819                 mem_ctx = state;
1820         }
1821
1822         status = state->dispatch_recv(subreq, mem_ctx);
1823         TALLOC_FREE(subreq);
1824         if (!NT_STATUS_IS_OK(status)) {
1825                 tevent_req_nterror(req, status);
1826                 return;
1827         }
1828
1829         /* Copy out parameters */
1830         *state->orig.out.name = *state->tmp.out.name;
1831         if (state->orig.out.type && state->tmp.out.type) {
1832                 *state->orig.out.type = *state->tmp.out.type;
1833         }
1834         if (state->orig.out.value && state->tmp.out.value) {
1835                 memcpy(state->orig.out.value, state->tmp.out.value, *state->tmp.in.size * sizeof(*state->orig.out.value));
1836         }
1837         if (state->orig.out.size && state->tmp.out.size) {
1838                 *state->orig.out.size = *state->tmp.out.size;
1839         }
1840         if (state->orig.out.length && state->tmp.out.length) {
1841                 *state->orig.out.length = *state->tmp.out.length;
1842         }
1843
1844         /* Copy result */
1845         state->orig.out.result = state->tmp.out.result;
1846
1847         /* Reset temporary structure */
1848         ZERO_STRUCT(state->tmp);
1849
1850         if (DEBUGLEVEL >= 10) {
1851                 NDR_PRINT_OUT_DEBUG(winreg_EnumValue, &state->orig);
1852         }
1853
1854         tevent_req_done(req);
1855 }
1856
1857 NTSTATUS rpccli_winreg_EnumValue_recv(struct tevent_req *req,
1858                                       TALLOC_CTX *mem_ctx,
1859                                       WERROR *result)
1860 {
1861         struct rpccli_winreg_EnumValue_state *state = tevent_req_data(
1862                 req, struct rpccli_winreg_EnumValue_state);
1863         NTSTATUS status;
1864
1865         if (tevent_req_is_nterror(req, &status)) {
1866                 tevent_req_received(req);
1867                 return status;
1868         }
1869
1870         /* Steal possbile out parameters to the callers context */
1871         talloc_steal(mem_ctx, state->out_mem_ctx);
1872
1873         /* Return result */
1874         *result = state->orig.out.result;
1875
1876         tevent_req_received(req);
1877         return NT_STATUS_OK;
1878 }
1879
1880 NTSTATUS rpccli_winreg_EnumValue(struct rpc_pipe_client *cli,
1881                                  TALLOC_CTX *mem_ctx,
1882                                  struct policy_handle *handle /* [in] [ref] */,
1883                                  uint32_t enum_index /* [in]  */,
1884                                  struct winreg_ValNameBuf *name /* [in,out] [ref] */,
1885                                  enum winreg_Type *type /* [in,out] [unique] */,
1886                                  uint8_t *value /* [in,out] [unique,length_is(*length),size_is(*size)] */,
1887                                  uint32_t *size /* [in,out] [unique] */,
1888                                  uint32_t *length /* [in,out] [unique] */,
1889                                  WERROR *werror)
1890 {
1891         struct winreg_EnumValue r;
1892         NTSTATUS status;
1893
1894         /* In parameters */
1895         r.in.handle = handle;
1896         r.in.enum_index = enum_index;
1897         r.in.name = name;
1898         r.in.type = type;
1899         r.in.value = value;
1900         r.in.size = size;
1901         r.in.length = length;
1902
1903         if (DEBUGLEVEL >= 10) {
1904                 NDR_PRINT_IN_DEBUG(winreg_EnumValue, &r);
1905         }
1906
1907         status = cli->dispatch(cli,
1908                                 mem_ctx,
1909                                 &ndr_table_winreg,
1910                                 NDR_WINREG_ENUMVALUE,
1911                                 &r);
1912
1913         if (!NT_STATUS_IS_OK(status)) {
1914                 return status;
1915         }
1916
1917         if (DEBUGLEVEL >= 10) {
1918                 NDR_PRINT_OUT_DEBUG(winreg_EnumValue, &r);
1919         }
1920
1921         if (NT_STATUS_IS_ERR(status)) {
1922                 return status;
1923         }
1924
1925         /* Return variables */
1926         *name = *r.out.name;
1927         if (type && r.out.type) {
1928                 *type = *r.out.type;
1929         }
1930         if (value && r.out.value) {
1931                 memcpy(value, r.out.value, *r.in.size * sizeof(*value));
1932         }
1933         if (size && r.out.size) {
1934                 *size = *r.out.size;
1935         }
1936         if (length && r.out.length) {
1937                 *length = *r.out.length;
1938         }
1939
1940         /* Return result */
1941         if (werror) {
1942                 *werror = r.out.result;
1943         }
1944
1945         return werror_to_ntstatus(r.out.result);
1946 }
1947
1948 struct rpccli_winreg_FlushKey_state {
1949         struct winreg_FlushKey orig;
1950         struct winreg_FlushKey tmp;
1951         TALLOC_CTX *out_mem_ctx;
1952         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
1953 };
1954
1955 static void rpccli_winreg_FlushKey_done(struct tevent_req *subreq);
1956
1957 struct tevent_req *rpccli_winreg_FlushKey_send(TALLOC_CTX *mem_ctx,
1958                                                struct tevent_context *ev,
1959                                                struct rpc_pipe_client *cli,
1960                                                struct policy_handle *_handle /* [in] [ref] */)
1961 {
1962         struct tevent_req *req;
1963         struct rpccli_winreg_FlushKey_state *state;
1964         struct tevent_req *subreq;
1965
1966         req = tevent_req_create(mem_ctx, &state,
1967                                 struct rpccli_winreg_FlushKey_state);
1968         if (req == NULL) {
1969                 return NULL;
1970         }
1971         state->out_mem_ctx = NULL;
1972         state->dispatch_recv = cli->dispatch_recv;
1973
1974         /* In parameters */
1975         state->orig.in.handle = _handle;
1976
1977         /* Out parameters */
1978
1979         /* Result */
1980         ZERO_STRUCT(state->orig.out.result);
1981
1982         if (DEBUGLEVEL >= 10) {
1983                 NDR_PRINT_IN_DEBUG(winreg_FlushKey, &state->orig);
1984         }
1985
1986         /* make a temporary copy, that we pass to the dispatch function */
1987         state->tmp = state->orig;
1988
1989         subreq = cli->dispatch_send(state, ev, cli,
1990                                     &ndr_table_winreg,
1991                                     NDR_WINREG_FLUSHKEY,
1992                                     &state->tmp);
1993         if (tevent_req_nomem(subreq, req)) {
1994                 return tevent_req_post(req, ev);
1995         }
1996         tevent_req_set_callback(subreq, rpccli_winreg_FlushKey_done, req);
1997         return req;
1998 }
1999
2000 static void rpccli_winreg_FlushKey_done(struct tevent_req *subreq)
2001 {
2002         struct tevent_req *req = tevent_req_callback_data(
2003                 subreq, struct tevent_req);
2004         struct rpccli_winreg_FlushKey_state *state = tevent_req_data(
2005                 req, struct rpccli_winreg_FlushKey_state);
2006         NTSTATUS status;
2007         TALLOC_CTX *mem_ctx;
2008
2009         if (state->out_mem_ctx) {
2010                 mem_ctx = state->out_mem_ctx;
2011         } else {
2012                 mem_ctx = state;
2013         }
2014
2015         status = state->dispatch_recv(subreq, mem_ctx);
2016         TALLOC_FREE(subreq);
2017         if (!NT_STATUS_IS_OK(status)) {
2018                 tevent_req_nterror(req, status);
2019                 return;
2020         }
2021
2022         /* Copy out parameters */
2023
2024         /* Copy result */
2025         state->orig.out.result = state->tmp.out.result;
2026
2027         /* Reset temporary structure */
2028         ZERO_STRUCT(state->tmp);
2029
2030         if (DEBUGLEVEL >= 10) {
2031                 NDR_PRINT_OUT_DEBUG(winreg_FlushKey, &state->orig);
2032         }
2033
2034         tevent_req_done(req);
2035 }
2036
2037 NTSTATUS rpccli_winreg_FlushKey_recv(struct tevent_req *req,
2038                                      TALLOC_CTX *mem_ctx,
2039                                      WERROR *result)
2040 {
2041         struct rpccli_winreg_FlushKey_state *state = tevent_req_data(
2042                 req, struct rpccli_winreg_FlushKey_state);
2043         NTSTATUS status;
2044
2045         if (tevent_req_is_nterror(req, &status)) {
2046                 tevent_req_received(req);
2047                 return status;
2048         }
2049
2050         /* Steal possbile out parameters to the callers context */
2051         talloc_steal(mem_ctx, state->out_mem_ctx);
2052
2053         /* Return result */
2054         *result = state->orig.out.result;
2055
2056         tevent_req_received(req);
2057         return NT_STATUS_OK;
2058 }
2059
2060 NTSTATUS rpccli_winreg_FlushKey(struct rpc_pipe_client *cli,
2061                                 TALLOC_CTX *mem_ctx,
2062                                 struct policy_handle *handle /* [in] [ref] */,
2063                                 WERROR *werror)
2064 {
2065         struct winreg_FlushKey r;
2066         NTSTATUS status;
2067
2068         /* In parameters */
2069         r.in.handle = handle;
2070
2071         if (DEBUGLEVEL >= 10) {
2072                 NDR_PRINT_IN_DEBUG(winreg_FlushKey, &r);
2073         }
2074
2075         status = cli->dispatch(cli,
2076                                 mem_ctx,
2077                                 &ndr_table_winreg,
2078                                 NDR_WINREG_FLUSHKEY,
2079                                 &r);
2080
2081         if (!NT_STATUS_IS_OK(status)) {
2082                 return status;
2083         }
2084
2085         if (DEBUGLEVEL >= 10) {
2086                 NDR_PRINT_OUT_DEBUG(winreg_FlushKey, &r);
2087         }
2088
2089         if (NT_STATUS_IS_ERR(status)) {
2090                 return status;
2091         }
2092
2093         /* Return variables */
2094
2095         /* Return result */
2096         if (werror) {
2097                 *werror = r.out.result;
2098         }
2099
2100         return werror_to_ntstatus(r.out.result);
2101 }
2102
2103 struct rpccli_winreg_GetKeySecurity_state {
2104         struct winreg_GetKeySecurity orig;
2105         struct winreg_GetKeySecurity tmp;
2106         TALLOC_CTX *out_mem_ctx;
2107         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2108 };
2109
2110 static void rpccli_winreg_GetKeySecurity_done(struct tevent_req *subreq);
2111
2112 struct tevent_req *rpccli_winreg_GetKeySecurity_send(TALLOC_CTX *mem_ctx,
2113                                                      struct tevent_context *ev,
2114                                                      struct rpc_pipe_client *cli,
2115                                                      struct policy_handle *_handle /* [in] [ref] */,
2116                                                      uint32_t _sec_info /* [in]  */,
2117                                                      struct KeySecurityData *_sd /* [in,out] [ref] */)
2118 {
2119         struct tevent_req *req;
2120         struct rpccli_winreg_GetKeySecurity_state *state;
2121         struct tevent_req *subreq;
2122
2123         req = tevent_req_create(mem_ctx, &state,
2124                                 struct rpccli_winreg_GetKeySecurity_state);
2125         if (req == NULL) {
2126                 return NULL;
2127         }
2128         state->out_mem_ctx = NULL;
2129         state->dispatch_recv = cli->dispatch_recv;
2130
2131         /* In parameters */
2132         state->orig.in.handle = _handle;
2133         state->orig.in.sec_info = _sec_info;
2134         state->orig.in.sd = _sd;
2135
2136         /* Out parameters */
2137         state->orig.out.sd = _sd;
2138
2139         /* Result */
2140         ZERO_STRUCT(state->orig.out.result);
2141
2142         if (DEBUGLEVEL >= 10) {
2143                 NDR_PRINT_IN_DEBUG(winreg_GetKeySecurity, &state->orig);
2144         }
2145
2146         state->out_mem_ctx = talloc_named_const(state, 0,
2147                              "rpccli_winreg_GetKeySecurity_out_memory");
2148         if (tevent_req_nomem(state->out_mem_ctx, req)) {
2149                 return tevent_req_post(req, ev);
2150         }
2151
2152         /* make a temporary copy, that we pass to the dispatch function */
2153         state->tmp = state->orig;
2154
2155         subreq = cli->dispatch_send(state, ev, cli,
2156                                     &ndr_table_winreg,
2157                                     NDR_WINREG_GETKEYSECURITY,
2158                                     &state->tmp);
2159         if (tevent_req_nomem(subreq, req)) {
2160                 return tevent_req_post(req, ev);
2161         }
2162         tevent_req_set_callback(subreq, rpccli_winreg_GetKeySecurity_done, req);
2163         return req;
2164 }
2165
2166 static void rpccli_winreg_GetKeySecurity_done(struct tevent_req *subreq)
2167 {
2168         struct tevent_req *req = tevent_req_callback_data(
2169                 subreq, struct tevent_req);
2170         struct rpccli_winreg_GetKeySecurity_state *state = tevent_req_data(
2171                 req, struct rpccli_winreg_GetKeySecurity_state);
2172         NTSTATUS status;
2173         TALLOC_CTX *mem_ctx;
2174
2175         if (state->out_mem_ctx) {
2176                 mem_ctx = state->out_mem_ctx;
2177         } else {
2178                 mem_ctx = state;
2179         }
2180
2181         status = state->dispatch_recv(subreq, mem_ctx);
2182         TALLOC_FREE(subreq);
2183         if (!NT_STATUS_IS_OK(status)) {
2184                 tevent_req_nterror(req, status);
2185                 return;
2186         }
2187
2188         /* Copy out parameters */
2189         *state->orig.out.sd = *state->tmp.out.sd;
2190
2191         /* Copy result */
2192         state->orig.out.result = state->tmp.out.result;
2193
2194         /* Reset temporary structure */
2195         ZERO_STRUCT(state->tmp);
2196
2197         if (DEBUGLEVEL >= 10) {
2198                 NDR_PRINT_OUT_DEBUG(winreg_GetKeySecurity, &state->orig);
2199         }
2200
2201         tevent_req_done(req);
2202 }
2203
2204 NTSTATUS rpccli_winreg_GetKeySecurity_recv(struct tevent_req *req,
2205                                            TALLOC_CTX *mem_ctx,
2206                                            WERROR *result)
2207 {
2208         struct rpccli_winreg_GetKeySecurity_state *state = tevent_req_data(
2209                 req, struct rpccli_winreg_GetKeySecurity_state);
2210         NTSTATUS status;
2211
2212         if (tevent_req_is_nterror(req, &status)) {
2213                 tevent_req_received(req);
2214                 return status;
2215         }
2216
2217         /* Steal possbile out parameters to the callers context */
2218         talloc_steal(mem_ctx, state->out_mem_ctx);
2219
2220         /* Return result */
2221         *result = state->orig.out.result;
2222
2223         tevent_req_received(req);
2224         return NT_STATUS_OK;
2225 }
2226
2227 NTSTATUS rpccli_winreg_GetKeySecurity(struct rpc_pipe_client *cli,
2228                                       TALLOC_CTX *mem_ctx,
2229                                       struct policy_handle *handle /* [in] [ref] */,
2230                                       uint32_t sec_info /* [in]  */,
2231                                       struct KeySecurityData *sd /* [in,out] [ref] */,
2232                                       WERROR *werror)
2233 {
2234         struct winreg_GetKeySecurity r;
2235         NTSTATUS status;
2236
2237         /* In parameters */
2238         r.in.handle = handle;
2239         r.in.sec_info = sec_info;
2240         r.in.sd = sd;
2241
2242         if (DEBUGLEVEL >= 10) {
2243                 NDR_PRINT_IN_DEBUG(winreg_GetKeySecurity, &r);
2244         }
2245
2246         status = cli->dispatch(cli,
2247                                 mem_ctx,
2248                                 &ndr_table_winreg,
2249                                 NDR_WINREG_GETKEYSECURITY,
2250                                 &r);
2251
2252         if (!NT_STATUS_IS_OK(status)) {
2253                 return status;
2254         }
2255
2256         if (DEBUGLEVEL >= 10) {
2257                 NDR_PRINT_OUT_DEBUG(winreg_GetKeySecurity, &r);
2258         }
2259
2260         if (NT_STATUS_IS_ERR(status)) {
2261                 return status;
2262         }
2263
2264         /* Return variables */
2265         *sd = *r.out.sd;
2266
2267         /* Return result */
2268         if (werror) {
2269                 *werror = r.out.result;
2270         }
2271
2272         return werror_to_ntstatus(r.out.result);
2273 }
2274
2275 struct rpccli_winreg_LoadKey_state {
2276         struct winreg_LoadKey orig;
2277         struct winreg_LoadKey tmp;
2278         TALLOC_CTX *out_mem_ctx;
2279         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2280 };
2281
2282 static void rpccli_winreg_LoadKey_done(struct tevent_req *subreq);
2283
2284 struct tevent_req *rpccli_winreg_LoadKey_send(TALLOC_CTX *mem_ctx,
2285                                               struct tevent_context *ev,
2286                                               struct rpc_pipe_client *cli,
2287                                               struct policy_handle *_handle /* [in] [ref] */,
2288                                               struct winreg_String *_keyname /* [in] [unique] */,
2289                                               struct winreg_String *_filename /* [in] [unique] */)
2290 {
2291         struct tevent_req *req;
2292         struct rpccli_winreg_LoadKey_state *state;
2293         struct tevent_req *subreq;
2294
2295         req = tevent_req_create(mem_ctx, &state,
2296                                 struct rpccli_winreg_LoadKey_state);
2297         if (req == NULL) {
2298                 return NULL;
2299         }
2300         state->out_mem_ctx = NULL;
2301         state->dispatch_recv = cli->dispatch_recv;
2302
2303         /* In parameters */
2304         state->orig.in.handle = _handle;
2305         state->orig.in.keyname = _keyname;
2306         state->orig.in.filename = _filename;
2307
2308         /* Out parameters */
2309
2310         /* Result */
2311         ZERO_STRUCT(state->orig.out.result);
2312
2313         if (DEBUGLEVEL >= 10) {
2314                 NDR_PRINT_IN_DEBUG(winreg_LoadKey, &state->orig);
2315         }
2316
2317         /* make a temporary copy, that we pass to the dispatch function */
2318         state->tmp = state->orig;
2319
2320         subreq = cli->dispatch_send(state, ev, cli,
2321                                     &ndr_table_winreg,
2322                                     NDR_WINREG_LOADKEY,
2323                                     &state->tmp);
2324         if (tevent_req_nomem(subreq, req)) {
2325                 return tevent_req_post(req, ev);
2326         }
2327         tevent_req_set_callback(subreq, rpccli_winreg_LoadKey_done, req);
2328         return req;
2329 }
2330
2331 static void rpccli_winreg_LoadKey_done(struct tevent_req *subreq)
2332 {
2333         struct tevent_req *req = tevent_req_callback_data(
2334                 subreq, struct tevent_req);
2335         struct rpccli_winreg_LoadKey_state *state = tevent_req_data(
2336                 req, struct rpccli_winreg_LoadKey_state);
2337         NTSTATUS status;
2338         TALLOC_CTX *mem_ctx;
2339
2340         if (state->out_mem_ctx) {
2341                 mem_ctx = state->out_mem_ctx;
2342         } else {
2343                 mem_ctx = state;
2344         }
2345
2346         status = state->dispatch_recv(subreq, mem_ctx);
2347         TALLOC_FREE(subreq);
2348         if (!NT_STATUS_IS_OK(status)) {
2349                 tevent_req_nterror(req, status);
2350                 return;
2351         }
2352
2353         /* Copy out parameters */
2354
2355         /* Copy result */
2356         state->orig.out.result = state->tmp.out.result;
2357
2358         /* Reset temporary structure */
2359         ZERO_STRUCT(state->tmp);
2360
2361         if (DEBUGLEVEL >= 10) {
2362                 NDR_PRINT_OUT_DEBUG(winreg_LoadKey, &state->orig);
2363         }
2364
2365         tevent_req_done(req);
2366 }
2367
2368 NTSTATUS rpccli_winreg_LoadKey_recv(struct tevent_req *req,
2369                                     TALLOC_CTX *mem_ctx,
2370                                     WERROR *result)
2371 {
2372         struct rpccli_winreg_LoadKey_state *state = tevent_req_data(
2373                 req, struct rpccli_winreg_LoadKey_state);
2374         NTSTATUS status;
2375
2376         if (tevent_req_is_nterror(req, &status)) {
2377                 tevent_req_received(req);
2378                 return status;
2379         }
2380
2381         /* Steal possbile out parameters to the callers context */
2382         talloc_steal(mem_ctx, state->out_mem_ctx);
2383
2384         /* Return result */
2385         *result = state->orig.out.result;
2386
2387         tevent_req_received(req);
2388         return NT_STATUS_OK;
2389 }
2390
2391 NTSTATUS rpccli_winreg_LoadKey(struct rpc_pipe_client *cli,
2392                                TALLOC_CTX *mem_ctx,
2393                                struct policy_handle *handle /* [in] [ref] */,
2394                                struct winreg_String *keyname /* [in] [unique] */,
2395                                struct winreg_String *filename /* [in] [unique] */,
2396                                WERROR *werror)
2397 {
2398         struct winreg_LoadKey r;
2399         NTSTATUS status;
2400
2401         /* In parameters */
2402         r.in.handle = handle;
2403         r.in.keyname = keyname;
2404         r.in.filename = filename;
2405
2406         if (DEBUGLEVEL >= 10) {
2407                 NDR_PRINT_IN_DEBUG(winreg_LoadKey, &r);
2408         }
2409
2410         status = cli->dispatch(cli,
2411                                 mem_ctx,
2412                                 &ndr_table_winreg,
2413                                 NDR_WINREG_LOADKEY,
2414                                 &r);
2415
2416         if (!NT_STATUS_IS_OK(status)) {
2417                 return status;
2418         }
2419
2420         if (DEBUGLEVEL >= 10) {
2421                 NDR_PRINT_OUT_DEBUG(winreg_LoadKey, &r);
2422         }
2423
2424         if (NT_STATUS_IS_ERR(status)) {
2425                 return status;
2426         }
2427
2428         /* Return variables */
2429
2430         /* Return result */
2431         if (werror) {
2432                 *werror = r.out.result;
2433         }
2434
2435         return werror_to_ntstatus(r.out.result);
2436 }
2437
2438 struct rpccli_winreg_NotifyChangeKeyValue_state {
2439         struct winreg_NotifyChangeKeyValue orig;
2440         struct winreg_NotifyChangeKeyValue tmp;
2441         TALLOC_CTX *out_mem_ctx;
2442         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2443 };
2444
2445 static void rpccli_winreg_NotifyChangeKeyValue_done(struct tevent_req *subreq);
2446
2447 struct tevent_req *rpccli_winreg_NotifyChangeKeyValue_send(TALLOC_CTX *mem_ctx,
2448                                                            struct tevent_context *ev,
2449                                                            struct rpc_pipe_client *cli,
2450                                                            struct policy_handle *_handle /* [in] [ref] */,
2451                                                            uint8_t _watch_subtree /* [in]  */,
2452                                                            uint32_t _notify_filter /* [in]  */,
2453                                                            uint32_t _unknown /* [in]  */,
2454                                                            struct winreg_String _string1 /* [in]  */,
2455                                                            struct winreg_String _string2 /* [in]  */,
2456                                                            uint32_t _unknown2 /* [in]  */)
2457 {
2458         struct tevent_req *req;
2459         struct rpccli_winreg_NotifyChangeKeyValue_state *state;
2460         struct tevent_req *subreq;
2461
2462         req = tevent_req_create(mem_ctx, &state,
2463                                 struct rpccli_winreg_NotifyChangeKeyValue_state);
2464         if (req == NULL) {
2465                 return NULL;
2466         }
2467         state->out_mem_ctx = NULL;
2468         state->dispatch_recv = cli->dispatch_recv;
2469
2470         /* In parameters */
2471         state->orig.in.handle = _handle;
2472         state->orig.in.watch_subtree = _watch_subtree;
2473         state->orig.in.notify_filter = _notify_filter;
2474         state->orig.in.unknown = _unknown;
2475         state->orig.in.string1 = _string1;
2476         state->orig.in.string2 = _string2;
2477         state->orig.in.unknown2 = _unknown2;
2478
2479         /* Out parameters */
2480
2481         /* Result */
2482         ZERO_STRUCT(state->orig.out.result);
2483
2484         if (DEBUGLEVEL >= 10) {
2485                 NDR_PRINT_IN_DEBUG(winreg_NotifyChangeKeyValue, &state->orig);
2486         }
2487
2488         /* make a temporary copy, that we pass to the dispatch function */
2489         state->tmp = state->orig;
2490
2491         subreq = cli->dispatch_send(state, ev, cli,
2492                                     &ndr_table_winreg,
2493                                     NDR_WINREG_NOTIFYCHANGEKEYVALUE,
2494                                     &state->tmp);
2495         if (tevent_req_nomem(subreq, req)) {
2496                 return tevent_req_post(req, ev);
2497         }
2498         tevent_req_set_callback(subreq, rpccli_winreg_NotifyChangeKeyValue_done, req);
2499         return req;
2500 }
2501
2502 static void rpccli_winreg_NotifyChangeKeyValue_done(struct tevent_req *subreq)
2503 {
2504         struct tevent_req *req = tevent_req_callback_data(
2505                 subreq, struct tevent_req);
2506         struct rpccli_winreg_NotifyChangeKeyValue_state *state = tevent_req_data(
2507                 req, struct rpccli_winreg_NotifyChangeKeyValue_state);
2508         NTSTATUS status;
2509         TALLOC_CTX *mem_ctx;
2510
2511         if (state->out_mem_ctx) {
2512                 mem_ctx = state->out_mem_ctx;
2513         } else {
2514                 mem_ctx = state;
2515         }
2516
2517         status = state->dispatch_recv(subreq, mem_ctx);
2518         TALLOC_FREE(subreq);
2519         if (!NT_STATUS_IS_OK(status)) {
2520                 tevent_req_nterror(req, status);
2521                 return;
2522         }
2523
2524         /* Copy out parameters */
2525
2526         /* Copy result */
2527         state->orig.out.result = state->tmp.out.result;
2528
2529         /* Reset temporary structure */
2530         ZERO_STRUCT(state->tmp);
2531
2532         if (DEBUGLEVEL >= 10) {
2533                 NDR_PRINT_OUT_DEBUG(winreg_NotifyChangeKeyValue, &state->orig);
2534         }
2535
2536         tevent_req_done(req);
2537 }
2538
2539 NTSTATUS rpccli_winreg_NotifyChangeKeyValue_recv(struct tevent_req *req,
2540                                                  TALLOC_CTX *mem_ctx,
2541                                                  WERROR *result)
2542 {
2543         struct rpccli_winreg_NotifyChangeKeyValue_state *state = tevent_req_data(
2544                 req, struct rpccli_winreg_NotifyChangeKeyValue_state);
2545         NTSTATUS status;
2546
2547         if (tevent_req_is_nterror(req, &status)) {
2548                 tevent_req_received(req);
2549                 return status;
2550         }
2551
2552         /* Steal possbile out parameters to the callers context */
2553         talloc_steal(mem_ctx, state->out_mem_ctx);
2554
2555         /* Return result */
2556         *result = state->orig.out.result;
2557
2558         tevent_req_received(req);
2559         return NT_STATUS_OK;
2560 }
2561
2562 NTSTATUS rpccli_winreg_NotifyChangeKeyValue(struct rpc_pipe_client *cli,
2563                                             TALLOC_CTX *mem_ctx,
2564                                             struct policy_handle *handle /* [in] [ref] */,
2565                                             uint8_t watch_subtree /* [in]  */,
2566                                             uint32_t notify_filter /* [in]  */,
2567                                             uint32_t unknown /* [in]  */,
2568                                             struct winreg_String string1 /* [in]  */,
2569                                             struct winreg_String string2 /* [in]  */,
2570                                             uint32_t unknown2 /* [in]  */,
2571                                             WERROR *werror)
2572 {
2573         struct winreg_NotifyChangeKeyValue r;
2574         NTSTATUS status;
2575
2576         /* In parameters */
2577         r.in.handle = handle;
2578         r.in.watch_subtree = watch_subtree;
2579         r.in.notify_filter = notify_filter;
2580         r.in.unknown = unknown;
2581         r.in.string1 = string1;
2582         r.in.string2 = string2;
2583         r.in.unknown2 = unknown2;
2584
2585         if (DEBUGLEVEL >= 10) {
2586                 NDR_PRINT_IN_DEBUG(winreg_NotifyChangeKeyValue, &r);
2587         }
2588
2589         status = cli->dispatch(cli,
2590                                 mem_ctx,
2591                                 &ndr_table_winreg,
2592                                 NDR_WINREG_NOTIFYCHANGEKEYVALUE,
2593                                 &r);
2594
2595         if (!NT_STATUS_IS_OK(status)) {
2596                 return status;
2597         }
2598
2599         if (DEBUGLEVEL >= 10) {
2600                 NDR_PRINT_OUT_DEBUG(winreg_NotifyChangeKeyValue, &r);
2601         }
2602
2603         if (NT_STATUS_IS_ERR(status)) {
2604                 return status;
2605         }
2606
2607         /* Return variables */
2608
2609         /* Return result */
2610         if (werror) {
2611                 *werror = r.out.result;
2612         }
2613
2614         return werror_to_ntstatus(r.out.result);
2615 }
2616
2617 struct rpccli_winreg_OpenKey_state {
2618         struct winreg_OpenKey orig;
2619         struct winreg_OpenKey tmp;
2620         TALLOC_CTX *out_mem_ctx;
2621         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2622 };
2623
2624 static void rpccli_winreg_OpenKey_done(struct tevent_req *subreq);
2625
2626 struct tevent_req *rpccli_winreg_OpenKey_send(TALLOC_CTX *mem_ctx,
2627                                               struct tevent_context *ev,
2628                                               struct rpc_pipe_client *cli,
2629                                               struct policy_handle *_parent_handle /* [in] [ref] */,
2630                                               struct winreg_String _keyname /* [in]  */,
2631                                               uint32_t _unknown /* [in]  */,
2632                                               uint32_t _access_mask /* [in]  */,
2633                                               struct policy_handle *_handle /* [out] [ref] */)
2634 {
2635         struct tevent_req *req;
2636         struct rpccli_winreg_OpenKey_state *state;
2637         struct tevent_req *subreq;
2638
2639         req = tevent_req_create(mem_ctx, &state,
2640                                 struct rpccli_winreg_OpenKey_state);
2641         if (req == NULL) {
2642                 return NULL;
2643         }
2644         state->out_mem_ctx = NULL;
2645         state->dispatch_recv = cli->dispatch_recv;
2646
2647         /* In parameters */
2648         state->orig.in.parent_handle = _parent_handle;
2649         state->orig.in.keyname = _keyname;
2650         state->orig.in.unknown = _unknown;
2651         state->orig.in.access_mask = _access_mask;
2652
2653         /* Out parameters */
2654         state->orig.out.handle = _handle;
2655
2656         /* Result */
2657         ZERO_STRUCT(state->orig.out.result);
2658
2659         if (DEBUGLEVEL >= 10) {
2660                 NDR_PRINT_IN_DEBUG(winreg_OpenKey, &state->orig);
2661         }
2662
2663         state->out_mem_ctx = talloc_named_const(state, 0,
2664                              "rpccli_winreg_OpenKey_out_memory");
2665         if (tevent_req_nomem(state->out_mem_ctx, req)) {
2666                 return tevent_req_post(req, ev);
2667         }
2668
2669         /* make a temporary copy, that we pass to the dispatch function */
2670         state->tmp = state->orig;
2671
2672         subreq = cli->dispatch_send(state, ev, cli,
2673                                     &ndr_table_winreg,
2674                                     NDR_WINREG_OPENKEY,
2675                                     &state->tmp);
2676         if (tevent_req_nomem(subreq, req)) {
2677                 return tevent_req_post(req, ev);
2678         }
2679         tevent_req_set_callback(subreq, rpccli_winreg_OpenKey_done, req);
2680         return req;
2681 }
2682
2683 static void rpccli_winreg_OpenKey_done(struct tevent_req *subreq)
2684 {
2685         struct tevent_req *req = tevent_req_callback_data(
2686                 subreq, struct tevent_req);
2687         struct rpccli_winreg_OpenKey_state *state = tevent_req_data(
2688                 req, struct rpccli_winreg_OpenKey_state);
2689         NTSTATUS status;
2690         TALLOC_CTX *mem_ctx;
2691
2692         if (state->out_mem_ctx) {
2693                 mem_ctx = state->out_mem_ctx;
2694         } else {
2695                 mem_ctx = state;
2696         }
2697
2698         status = state->dispatch_recv(subreq, mem_ctx);
2699         TALLOC_FREE(subreq);
2700         if (!NT_STATUS_IS_OK(status)) {
2701                 tevent_req_nterror(req, status);
2702                 return;
2703         }
2704
2705         /* Copy out parameters */
2706         *state->orig.out.handle = *state->tmp.out.handle;
2707
2708         /* Copy result */
2709         state->orig.out.result = state->tmp.out.result;
2710
2711         /* Reset temporary structure */
2712         ZERO_STRUCT(state->tmp);
2713
2714         if (DEBUGLEVEL >= 10) {
2715                 NDR_PRINT_OUT_DEBUG(winreg_OpenKey, &state->orig);
2716         }
2717
2718         tevent_req_done(req);
2719 }
2720
2721 NTSTATUS rpccli_winreg_OpenKey_recv(struct tevent_req *req,
2722                                     TALLOC_CTX *mem_ctx,
2723                                     WERROR *result)
2724 {
2725         struct rpccli_winreg_OpenKey_state *state = tevent_req_data(
2726                 req, struct rpccli_winreg_OpenKey_state);
2727         NTSTATUS status;
2728
2729         if (tevent_req_is_nterror(req, &status)) {
2730                 tevent_req_received(req);
2731                 return status;
2732         }
2733
2734         /* Steal possbile out parameters to the callers context */
2735         talloc_steal(mem_ctx, state->out_mem_ctx);
2736
2737         /* Return result */
2738         *result = state->orig.out.result;
2739
2740         tevent_req_received(req);
2741         return NT_STATUS_OK;
2742 }
2743
2744 NTSTATUS rpccli_winreg_OpenKey(struct rpc_pipe_client *cli,
2745                                TALLOC_CTX *mem_ctx,
2746                                struct policy_handle *parent_handle /* [in] [ref] */,
2747                                struct winreg_String keyname /* [in]  */,
2748                                uint32_t unknown /* [in]  */,
2749                                uint32_t access_mask /* [in]  */,
2750                                struct policy_handle *handle /* [out] [ref] */,
2751                                WERROR *werror)
2752 {
2753         struct winreg_OpenKey r;
2754         NTSTATUS status;
2755
2756         /* In parameters */
2757         r.in.parent_handle = parent_handle;
2758         r.in.keyname = keyname;
2759         r.in.unknown = unknown;
2760         r.in.access_mask = access_mask;
2761
2762         if (DEBUGLEVEL >= 10) {
2763                 NDR_PRINT_IN_DEBUG(winreg_OpenKey, &r);
2764         }
2765
2766         status = cli->dispatch(cli,
2767                                 mem_ctx,
2768                                 &ndr_table_winreg,
2769                                 NDR_WINREG_OPENKEY,
2770                                 &r);
2771
2772         if (!NT_STATUS_IS_OK(status)) {
2773                 return status;
2774         }
2775
2776         if (DEBUGLEVEL >= 10) {
2777                 NDR_PRINT_OUT_DEBUG(winreg_OpenKey, &r);
2778         }
2779
2780         if (NT_STATUS_IS_ERR(status)) {
2781                 return status;
2782         }
2783
2784         /* Return variables */
2785         *handle = *r.out.handle;
2786
2787         /* Return result */
2788         if (werror) {
2789                 *werror = r.out.result;
2790         }
2791
2792         return werror_to_ntstatus(r.out.result);
2793 }
2794
2795 struct rpccli_winreg_QueryInfoKey_state {
2796         struct winreg_QueryInfoKey orig;
2797         struct winreg_QueryInfoKey tmp;
2798         TALLOC_CTX *out_mem_ctx;
2799         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
2800 };
2801
2802 static void rpccli_winreg_QueryInfoKey_done(struct tevent_req *subreq);
2803
2804 struct tevent_req *rpccli_winreg_QueryInfoKey_send(TALLOC_CTX *mem_ctx,
2805                                                    struct tevent_context *ev,
2806                                                    struct rpc_pipe_client *cli,
2807                                                    struct policy_handle *_handle /* [in] [ref] */,
2808                                                    struct winreg_String *_classname /* [in,out] [ref] */,
2809                                                    uint32_t *_num_subkeys /* [out] [ref] */,
2810                                                    uint32_t *_max_subkeylen /* [out] [ref] */,
2811                                                    uint32_t *_max_classlen /* [out] [ref] */,
2812                                                    uint32_t *_num_values /* [out] [ref] */,
2813                                                    uint32_t *_max_valnamelen /* [out] [ref] */,
2814                                                    uint32_t *_max_valbufsize /* [out] [ref] */,
2815                                                    uint32_t *_secdescsize /* [out] [ref] */,
2816                                                    NTTIME *_last_changed_time /* [out] [ref] */)
2817 {
2818         struct tevent_req *req;
2819         struct rpccli_winreg_QueryInfoKey_state *state;
2820         struct tevent_req *subreq;
2821
2822         req = tevent_req_create(mem_ctx, &state,
2823                                 struct rpccli_winreg_QueryInfoKey_state);
2824         if (req == NULL) {
2825                 return NULL;
2826         }
2827         state->out_mem_ctx = NULL;
2828         state->dispatch_recv = cli->dispatch_recv;
2829
2830         /* In parameters */
2831         state->orig.in.handle = _handle;
2832         state->orig.in.classname = _classname;
2833
2834         /* Out parameters */
2835         state->orig.out.classname = _classname;
2836         state->orig.out.num_subkeys = _num_subkeys;
2837         state->orig.out.max_subkeylen = _max_subkeylen;
2838         state->orig.out.max_classlen = _max_classlen;
2839         state->orig.out.num_values = _num_values;
2840         state->orig.out.max_valnamelen = _max_valnamelen;
2841         state->orig.out.max_valbufsize = _max_valbufsize;
2842         state->orig.out.secdescsize = _secdescsize;
2843         state->orig.out.last_changed_time = _last_changed_time;
2844
2845         /* Result */
2846         ZERO_STRUCT(state->orig.out.result);
2847
2848         if (DEBUGLEVEL >= 10) {
2849                 NDR_PRINT_IN_DEBUG(winreg_QueryInfoKey, &state->orig);
2850         }
2851
2852         state->out_mem_ctx = talloc_named_const(state, 0,
2853                              "rpccli_winreg_QueryInfoKey_out_memory");
2854         if (tevent_req_nomem(state->out_mem_ctx, req)) {
2855                 return tevent_req_post(req, ev);
2856         }
2857
2858         /* make a temporary copy, that we pass to the dispatch function */
2859         state->tmp = state->orig;
2860
2861         subreq = cli->dispatch_send(state, ev, cli,
2862                                     &ndr_table_winreg,
2863                                     NDR_WINREG_QUERYINFOKEY,
2864                                     &state->tmp);
2865         if (tevent_req_nomem(subreq, req)) {
2866                 return tevent_req_post(req, ev);
2867         }
2868         tevent_req_set_callback(subreq, rpccli_winreg_QueryInfoKey_done, req);
2869         return req;
2870 }
2871
2872 static void rpccli_winreg_QueryInfoKey_done(struct tevent_req *subreq)
2873 {
2874         struct tevent_req *req = tevent_req_callback_data(
2875                 subreq, struct tevent_req);
2876         struct rpccli_winreg_QueryInfoKey_state *state = tevent_req_data(
2877                 req, struct rpccli_winreg_QueryInfoKey_state);
2878         NTSTATUS status;
2879         TALLOC_CTX *mem_ctx;
2880
2881         if (state->out_mem_ctx) {
2882                 mem_ctx = state->out_mem_ctx;
2883         } else {
2884                 mem_ctx = state;
2885         }
2886
2887         status = state->dispatch_recv(subreq, mem_ctx);
2888         TALLOC_FREE(subreq);
2889         if (!NT_STATUS_IS_OK(status)) {
2890                 tevent_req_nterror(req, status);
2891                 return;
2892         }
2893
2894         /* Copy out parameters */
2895         *state->orig.out.classname = *state->tmp.out.classname;
2896         *state->orig.out.num_subkeys = *state->tmp.out.num_subkeys;
2897         *state->orig.out.max_subkeylen = *state->tmp.out.max_subkeylen;
2898         *state->orig.out.max_classlen = *state->tmp.out.max_classlen;
2899         *state->orig.out.num_values = *state->tmp.out.num_values;
2900         *state->orig.out.max_valnamelen = *state->tmp.out.max_valnamelen;
2901         *state->orig.out.max_valbufsize = *state->tmp.out.max_valbufsize;
2902         *state->orig.out.secdescsize = *state->tmp.out.secdescsize;
2903         *state->orig.out.last_changed_time = *state->tmp.out.last_changed_time;
2904
2905         /* Copy result */
2906         state->orig.out.result = state->tmp.out.result;
2907
2908         /* Reset temporary structure */
2909         ZERO_STRUCT(state->tmp);
2910
2911         if (DEBUGLEVEL >= 10) {
2912                 NDR_PRINT_OUT_DEBUG(winreg_QueryInfoKey, &state->orig);
2913         }
2914
2915         tevent_req_done(req);
2916 }
2917
2918 NTSTATUS rpccli_winreg_QueryInfoKey_recv(struct tevent_req *req,
2919                                          TALLOC_CTX *mem_ctx,
2920                                          WERROR *result)
2921 {
2922         struct rpccli_winreg_QueryInfoKey_state *state = tevent_req_data(
2923                 req, struct rpccli_winreg_QueryInfoKey_state);
2924         NTSTATUS status;
2925
2926         if (tevent_req_is_nterror(req, &status)) {
2927                 tevent_req_received(req);
2928                 return status;
2929         }
2930
2931         /* Steal possbile out parameters to the callers context */
2932         talloc_steal(mem_ctx, state->out_mem_ctx);
2933
2934         /* Return result */
2935         *result = state->orig.out.result;
2936
2937         tevent_req_received(req);
2938         return NT_STATUS_OK;
2939 }
2940
2941 NTSTATUS rpccli_winreg_QueryInfoKey(struct rpc_pipe_client *cli,
2942                                     TALLOC_CTX *mem_ctx,
2943                                     struct policy_handle *handle /* [in] [ref] */,
2944                                     struct winreg_String *classname /* [in,out] [ref] */,
2945                                     uint32_t *num_subkeys /* [out] [ref] */,
2946                                     uint32_t *max_subkeylen /* [out] [ref] */,
2947                                     uint32_t *max_classlen /* [out] [ref] */,
2948                                     uint32_t *num_values /* [out] [ref] */,
2949                                     uint32_t *max_valnamelen /* [out] [ref] */,
2950                                     uint32_t *max_valbufsize /* [out] [ref] */,
2951                                     uint32_t *secdescsize /* [out] [ref] */,
2952                                     NTTIME *last_changed_time /* [out] [ref] */,
2953                                     WERROR *werror)
2954 {
2955         struct winreg_QueryInfoKey r;
2956         NTSTATUS status;
2957
2958         /* In parameters */
2959         r.in.handle = handle;
2960         r.in.classname = classname;
2961
2962         if (DEBUGLEVEL >= 10) {
2963                 NDR_PRINT_IN_DEBUG(winreg_QueryInfoKey, &r);
2964         }
2965
2966         status = cli->dispatch(cli,
2967                                 mem_ctx,
2968                                 &ndr_table_winreg,
2969                                 NDR_WINREG_QUERYINFOKEY,
2970                                 &r);
2971
2972         if (!NT_STATUS_IS_OK(status)) {
2973                 return status;
2974         }
2975
2976         if (DEBUGLEVEL >= 10) {
2977                 NDR_PRINT_OUT_DEBUG(winreg_QueryInfoKey, &r);
2978         }
2979
2980         if (NT_STATUS_IS_ERR(status)) {
2981                 return status;
2982         }
2983
2984         /* Return variables */
2985         *classname = *r.out.classname;
2986         *num_subkeys = *r.out.num_subkeys;
2987         *max_subkeylen = *r.out.max_subkeylen;
2988         *max_classlen = *r.out.max_classlen;
2989         *num_values = *r.out.num_values;
2990         *max_valnamelen = *r.out.max_valnamelen;
2991         *max_valbufsize = *r.out.max_valbufsize;
2992         *secdescsize = *r.out.secdescsize;
2993         *last_changed_time = *r.out.last_changed_time;
2994
2995         /* Return result */
2996         if (werror) {
2997                 *werror = r.out.result;
2998         }
2999
3000         return werror_to_ntstatus(r.out.result);
3001 }
3002
3003 struct rpccli_winreg_QueryValue_state {
3004         struct winreg_QueryValue orig;
3005         struct winreg_QueryValue tmp;
3006         TALLOC_CTX *out_mem_ctx;
3007         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
3008 };
3009
3010 static void rpccli_winreg_QueryValue_done(struct tevent_req *subreq);
3011
3012 struct tevent_req *rpccli_winreg_QueryValue_send(TALLOC_CTX *mem_ctx,
3013                                                  struct tevent_context *ev,
3014                                                  struct rpc_pipe_client *cli,
3015                                                  struct policy_handle *_handle /* [in] [ref] */,
3016                                                  struct winreg_String *_value_name /* [in] [ref] */,
3017                                                  enum winreg_Type *_type /* [in,out] [unique] */,
3018                                                  uint8_t *_data /* [in,out] [unique,length_is(*data_length),size_is(*data_size)] */,
3019                                                  uint32_t *_data_size /* [in,out] [unique] */,
3020                                                  uint32_t *_data_length /* [in,out] [unique] */)
3021 {
3022         struct tevent_req *req;
3023         struct rpccli_winreg_QueryValue_state *state;
3024         struct tevent_req *subreq;
3025
3026         req = tevent_req_create(mem_ctx, &state,
3027                                 struct rpccli_winreg_QueryValue_state);
3028         if (req == NULL) {
3029                 return NULL;
3030         }
3031         state->out_mem_ctx = NULL;
3032         state->dispatch_recv = cli->dispatch_recv;
3033
3034         /* In parameters */
3035         state->orig.in.handle = _handle;
3036         state->orig.in.value_name = _value_name;
3037         state->orig.in.type = _type;
3038         state->orig.in.data = _data;
3039         state->orig.in.data_size = _data_size;
3040         state->orig.in.data_length = _data_length;
3041
3042         /* Out parameters */
3043         state->orig.out.type = _type;
3044         state->orig.out.data = _data;
3045         state->orig.out.data_size = _data_size;
3046         state->orig.out.data_length = _data_length;
3047
3048         /* Result */
3049         ZERO_STRUCT(state->orig.out.result);
3050
3051         if (DEBUGLEVEL >= 10) {
3052                 NDR_PRINT_IN_DEBUG(winreg_QueryValue, &state->orig);
3053         }
3054
3055         state->out_mem_ctx = talloc_named_const(state, 0,
3056                              "rpccli_winreg_QueryValue_out_memory");
3057         if (tevent_req_nomem(state->out_mem_ctx, req)) {
3058                 return tevent_req_post(req, ev);
3059         }
3060
3061         /* make a temporary copy, that we pass to the dispatch function */
3062         state->tmp = state->orig;
3063
3064         subreq = cli->dispatch_send(state, ev, cli,
3065                                     &ndr_table_winreg,
3066                                     NDR_WINREG_QUERYVALUE,
3067                                     &state->tmp);
3068         if (tevent_req_nomem(subreq, req)) {
3069                 return tevent_req_post(req, ev);
3070         }
3071         tevent_req_set_callback(subreq, rpccli_winreg_QueryValue_done, req);
3072         return req;
3073 }
3074
3075 static void rpccli_winreg_QueryValue_done(struct tevent_req *subreq)
3076 {
3077         struct tevent_req *req = tevent_req_callback_data(
3078                 subreq, struct tevent_req);
3079         struct rpccli_winreg_QueryValue_state *state = tevent_req_data(
3080                 req, struct rpccli_winreg_QueryValue_state);
3081         NTSTATUS status;
3082         TALLOC_CTX *mem_ctx;
3083
3084         if (state->out_mem_ctx) {
3085                 mem_ctx = state->out_mem_ctx;
3086         } else {
3087                 mem_ctx = state;
3088         }
3089
3090         status = state->dispatch_recv(subreq, mem_ctx);
3091         TALLOC_FREE(subreq);
3092         if (!NT_STATUS_IS_OK(status)) {
3093                 tevent_req_nterror(req, status);
3094                 return;
3095         }
3096
3097         /* Copy out parameters */
3098         if (state->orig.out.type && state->tmp.out.type) {
3099                 *state->orig.out.type = *state->tmp.out.type;
3100         }
3101         if (state->orig.out.data && state->tmp.out.data) {
3102                 memcpy(state->orig.out.data, state->tmp.out.data, *state->tmp.in.data_size * sizeof(*state->orig.out.data));
3103         }
3104         if (state->orig.out.data_size && state->tmp.out.data_size) {
3105                 *state->orig.out.data_size = *state->tmp.out.data_size;
3106         }
3107         if (state->orig.out.data_length && state->tmp.out.data_length) {
3108                 *state->orig.out.data_length = *state->tmp.out.data_length;
3109         }
3110
3111         /* Copy result */
3112         state->orig.out.result = state->tmp.out.result;
3113
3114         /* Reset temporary structure */
3115         ZERO_STRUCT(state->tmp);
3116
3117         if (DEBUGLEVEL >= 10) {
3118                 NDR_PRINT_OUT_DEBUG(winreg_QueryValue, &state->orig);
3119         }
3120
3121         tevent_req_done(req);
3122 }
3123
3124 NTSTATUS rpccli_winreg_QueryValue_recv(struct tevent_req *req,
3125                                        TALLOC_CTX *mem_ctx,
3126                                        WERROR *result)
3127 {
3128         struct rpccli_winreg_QueryValue_state *state = tevent_req_data(
3129                 req, struct rpccli_winreg_QueryValue_state);
3130         NTSTATUS status;
3131
3132         if (tevent_req_is_nterror(req, &status)) {
3133                 tevent_req_received(req);
3134                 return status;
3135         }
3136
3137         /* Steal possbile out parameters to the callers context */
3138         talloc_steal(mem_ctx, state->out_mem_ctx);
3139
3140         /* Return result */
3141         *result = state->orig.out.result;
3142
3143         tevent_req_received(req);
3144         return NT_STATUS_OK;
3145 }
3146
3147 NTSTATUS rpccli_winreg_QueryValue(struct rpc_pipe_client *cli,
3148                                   TALLOC_CTX *mem_ctx,
3149                                   struct policy_handle *handle /* [in] [ref] */,
3150                                   struct winreg_String *value_name /* [in] [ref] */,
3151                                   enum winreg_Type *type /* [in,out] [unique] */,
3152                                   uint8_t *data /* [in,out] [unique,length_is(*data_length),size_is(*data_size)] */,
3153                                   uint32_t *data_size /* [in,out] [unique] */,
3154                                   uint32_t *data_length /* [in,out] [unique] */,
3155                                   WERROR *werror)
3156 {
3157         struct winreg_QueryValue r;
3158         NTSTATUS status;
3159
3160         /* In parameters */
3161         r.in.handle = handle;
3162         r.in.value_name = value_name;
3163         r.in.type = type;
3164         r.in.data = data;
3165         r.in.data_size = data_size;
3166         r.in.data_length = data_length;
3167
3168         if (DEBUGLEVEL >= 10) {
3169                 NDR_PRINT_IN_DEBUG(winreg_QueryValue, &r);
3170         }
3171
3172         status = cli->dispatch(cli,
3173                                 mem_ctx,
3174                                 &ndr_table_winreg,
3175                                 NDR_WINREG_QUERYVALUE,
3176                                 &r);
3177
3178         if (!NT_STATUS_IS_OK(status)) {
3179                 return status;
3180         }
3181
3182         if (DEBUGLEVEL >= 10) {
3183                 NDR_PRINT_OUT_DEBUG(winreg_QueryValue, &r);
3184         }
3185
3186         if (NT_STATUS_IS_ERR(status)) {
3187                 return status;
3188         }
3189
3190         /* Return variables */
3191         if (type && r.out.type) {
3192                 *type = *r.out.type;
3193         }
3194         if (data && r.out.data) {
3195                 memcpy(data, r.out.data, *r.in.data_size * sizeof(*data));
3196         }
3197         if (data_size && r.out.data_size) {
3198                 *data_size = *r.out.data_size;
3199         }
3200         if (data_length && r.out.data_length) {
3201                 *data_length = *r.out.data_length;
3202         }
3203
3204         /* Return result */
3205         if (werror) {
3206                 *werror = r.out.result;
3207         }
3208
3209         return werror_to_ntstatus(r.out.result);
3210 }
3211
3212 struct rpccli_winreg_ReplaceKey_state {
3213         struct winreg_ReplaceKey orig;
3214         struct winreg_ReplaceKey tmp;
3215         TALLOC_CTX *out_mem_ctx;
3216         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
3217 };
3218
3219 static void rpccli_winreg_ReplaceKey_done(struct tevent_req *subreq);
3220
3221 struct tevent_req *rpccli_winreg_ReplaceKey_send(TALLOC_CTX *mem_ctx,
3222                                                  struct tevent_context *ev,
3223                                                  struct rpc_pipe_client *cli)
3224 {
3225         struct tevent_req *req;
3226         struct rpccli_winreg_ReplaceKey_state *state;
3227         struct tevent_req *subreq;
3228
3229         req = tevent_req_create(mem_ctx, &state,
3230                                 struct rpccli_winreg_ReplaceKey_state);
3231         if (req == NULL) {
3232                 return NULL;
3233         }
3234         state->out_mem_ctx = NULL;
3235         state->dispatch_recv = cli->dispatch_recv;
3236
3237         /* In parameters */
3238
3239         /* Out parameters */
3240
3241         /* Result */
3242         ZERO_STRUCT(state->orig.out.result);
3243
3244         if (DEBUGLEVEL >= 10) {
3245                 NDR_PRINT_IN_DEBUG(winreg_ReplaceKey, &state->orig);
3246         }
3247
3248         /* make a temporary copy, that we pass to the dispatch function */
3249         state->tmp = state->orig;
3250
3251         subreq = cli->dispatch_send(state, ev, cli,
3252                                     &ndr_table_winreg,
3253                                     NDR_WINREG_REPLACEKEY,
3254                                     &state->tmp);
3255         if (tevent_req_nomem(subreq, req)) {
3256                 return tevent_req_post(req, ev);
3257         }
3258         tevent_req_set_callback(subreq, rpccli_winreg_ReplaceKey_done, req);
3259         return req;
3260 }
3261
3262 static void rpccli_winreg_ReplaceKey_done(struct tevent_req *subreq)
3263 {
3264         struct tevent_req *req = tevent_req_callback_data(
3265                 subreq, struct tevent_req);
3266         struct rpccli_winreg_ReplaceKey_state *state = tevent_req_data(
3267                 req, struct rpccli_winreg_ReplaceKey_state);
3268         NTSTATUS status;
3269         TALLOC_CTX *mem_ctx;
3270
3271         if (state->out_mem_ctx) {
3272                 mem_ctx = state->out_mem_ctx;
3273         } else {
3274                 mem_ctx = state;
3275         }
3276
3277         status = state->dispatch_recv(subreq, mem_ctx);
3278         TALLOC_FREE(subreq);
3279         if (!NT_STATUS_IS_OK(status)) {
3280                 tevent_req_nterror(req, status);
3281                 return;
3282         }
3283
3284         /* Copy out parameters */
3285
3286         /* Copy result */
3287         state->orig.out.result = state->tmp.out.result;
3288
3289         /* Reset temporary structure */
3290         ZERO_STRUCT(state->tmp);
3291
3292         if (DEBUGLEVEL >= 10) {
3293                 NDR_PRINT_OUT_DEBUG(winreg_ReplaceKey, &state->orig);
3294         }
3295
3296         tevent_req_done(req);
3297 }
3298
3299 NTSTATUS rpccli_winreg_ReplaceKey_recv(struct tevent_req *req,
3300                                        TALLOC_CTX *mem_ctx,
3301                                        WERROR *result)
3302 {
3303         struct rpccli_winreg_ReplaceKey_state *state = tevent_req_data(
3304                 req, struct rpccli_winreg_ReplaceKey_state);
3305         NTSTATUS status;
3306
3307         if (tevent_req_is_nterror(req, &status)) {
3308                 tevent_req_received(req);
3309                 return status;
3310         }
3311
3312         /* Steal possbile out parameters to the callers context */
3313         talloc_steal(mem_ctx, state->out_mem_ctx);
3314
3315         /* Return result */
3316         *result = state->orig.out.result;
3317
3318         tevent_req_received(req);
3319         return NT_STATUS_OK;
3320 }
3321
3322 NTSTATUS rpccli_winreg_ReplaceKey(struct rpc_pipe_client *cli,
3323                                   TALLOC_CTX *mem_ctx,
3324                                   WERROR *werror)
3325 {
3326         struct winreg_ReplaceKey r;
3327         NTSTATUS status;
3328
3329         /* In parameters */
3330
3331         if (DEBUGLEVEL >= 10) {
3332                 NDR_PRINT_IN_DEBUG(winreg_ReplaceKey, &r);
3333         }
3334
3335         status = cli->dispatch(cli,
3336                                 mem_ctx,
3337                                 &ndr_table_winreg,
3338                                 NDR_WINREG_REPLACEKEY,
3339                                 &r);
3340
3341         if (!NT_STATUS_IS_OK(status)) {
3342                 return status;
3343         }
3344
3345         if (DEBUGLEVEL >= 10) {
3346                 NDR_PRINT_OUT_DEBUG(winreg_ReplaceKey, &r);
3347         }
3348
3349         if (NT_STATUS_IS_ERR(status)) {
3350                 return status;
3351         }
3352
3353         /* Return variables */
3354
3355         /* Return result */
3356         if (werror) {
3357                 *werror = r.out.result;
3358         }
3359
3360         return werror_to_ntstatus(r.out.result);
3361 }
3362
3363 struct rpccli_winreg_RestoreKey_state {
3364         struct winreg_RestoreKey orig;
3365         struct winreg_RestoreKey tmp;
3366         TALLOC_CTX *out_mem_ctx;
3367         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
3368 };
3369
3370 static void rpccli_winreg_RestoreKey_done(struct tevent_req *subreq);
3371
3372 struct tevent_req *rpccli_winreg_RestoreKey_send(TALLOC_CTX *mem_ctx,
3373                                                  struct tevent_context *ev,
3374                                                  struct rpc_pipe_client *cli,
3375                                                  struct policy_handle *_handle /* [in] [ref] */,
3376                                                  struct winreg_String *_filename /* [in] [ref] */,
3377                                                  uint32_t _flags /* [in]  */)
3378 {
3379         struct tevent_req *req;
3380         struct rpccli_winreg_RestoreKey_state *state;
3381         struct tevent_req *subreq;
3382
3383         req = tevent_req_create(mem_ctx, &state,
3384                                 struct rpccli_winreg_RestoreKey_state);
3385         if (req == NULL) {
3386                 return NULL;
3387         }
3388         state->out_mem_ctx = NULL;
3389         state->dispatch_recv = cli->dispatch_recv;
3390
3391         /* In parameters */
3392         state->orig.in.handle = _handle;
3393         state->orig.in.filename = _filename;
3394         state->orig.in.flags = _flags;
3395
3396         /* Out parameters */
3397
3398         /* Result */
3399         ZERO_STRUCT(state->orig.out.result);
3400
3401         if (DEBUGLEVEL >= 10) {
3402                 NDR_PRINT_IN_DEBUG(winreg_RestoreKey, &state->orig);
3403         }
3404
3405         /* make a temporary copy, that we pass to the dispatch function */
3406         state->tmp = state->orig;
3407
3408         subreq = cli->dispatch_send(state, ev, cli,
3409                                     &ndr_table_winreg,
3410                                     NDR_WINREG_RESTOREKEY,
3411                                     &state->tmp);
3412         if (tevent_req_nomem(subreq, req)) {
3413                 return tevent_req_post(req, ev);
3414         }
3415         tevent_req_set_callback(subreq, rpccli_winreg_RestoreKey_done, req);
3416         return req;
3417 }
3418
3419 static void rpccli_winreg_RestoreKey_done(struct tevent_req *subreq)
3420 {
3421         struct tevent_req *req = tevent_req_callback_data(
3422                 subreq, struct tevent_req);
3423         struct rpccli_winreg_RestoreKey_state *state = tevent_req_data(
3424                 req, struct rpccli_winreg_RestoreKey_state);
3425         NTSTATUS status;
3426         TALLOC_CTX *mem_ctx;
3427
3428         if (state->out_mem_ctx) {
3429                 mem_ctx = state->out_mem_ctx;
3430         } else {
3431                 mem_ctx = state;
3432         }
3433
3434         status = state->dispatch_recv(subreq, mem_ctx);
3435         TALLOC_FREE(subreq);
3436         if (!NT_STATUS_IS_OK(status)) {
3437                 tevent_req_nterror(req, status);
3438                 return;
3439         }
3440
3441         /* Copy out parameters */
3442
3443         /* Copy result */
3444         state->orig.out.result = state->tmp.out.result;
3445
3446         /* Reset temporary structure */
3447         ZERO_STRUCT(state->tmp);
3448
3449         if (DEBUGLEVEL >= 10) {
3450                 NDR_PRINT_OUT_DEBUG(winreg_RestoreKey, &state->orig);
3451         }
3452
3453         tevent_req_done(req);
3454 }
3455
3456 NTSTATUS rpccli_winreg_RestoreKey_recv(struct tevent_req *req,
3457                                        TALLOC_CTX *mem_ctx,
3458                                        WERROR *result)
3459 {
3460         struct rpccli_winreg_RestoreKey_state *state = tevent_req_data(
3461                 req, struct rpccli_winreg_RestoreKey_state);
3462         NTSTATUS status;
3463
3464         if (tevent_req_is_nterror(req, &status)) {
3465                 tevent_req_received(req);
3466                 return status;
3467         }
3468
3469         /* Steal possbile out parameters to the callers context */
3470         talloc_steal(mem_ctx, state->out_mem_ctx);
3471
3472         /* Return result */
3473         *result = state->orig.out.result;
3474
3475         tevent_req_received(req);
3476         return NT_STATUS_OK;
3477 }
3478
3479 NTSTATUS rpccli_winreg_RestoreKey(struct rpc_pipe_client *cli,
3480                                   TALLOC_CTX *mem_ctx,
3481                                   struct policy_handle *handle /* [in] [ref] */,
3482                                   struct winreg_String *filename /* [in] [ref] */,
3483                                   uint32_t flags /* [in]  */,
3484                                   WERROR *werror)
3485 {
3486         struct winreg_RestoreKey r;
3487         NTSTATUS status;
3488
3489         /* In parameters */
3490         r.in.handle = handle;
3491         r.in.filename = filename;
3492         r.in.flags = flags;
3493
3494         if (DEBUGLEVEL >= 10) {
3495                 NDR_PRINT_IN_DEBUG(winreg_RestoreKey, &r);
3496         }
3497
3498         status = cli->dispatch(cli,
3499                                 mem_ctx,
3500                                 &ndr_table_winreg,
3501                                 NDR_WINREG_RESTOREKEY,
3502                                 &r);
3503
3504         if (!NT_STATUS_IS_OK(status)) {
3505                 return status;
3506         }
3507
3508         if (DEBUGLEVEL >= 10) {
3509                 NDR_PRINT_OUT_DEBUG(winreg_RestoreKey, &r);
3510         }
3511
3512         if (NT_STATUS_IS_ERR(status)) {
3513                 return status;
3514         }
3515
3516         /* Return variables */
3517
3518         /* Return result */
3519         if (werror) {
3520                 *werror = r.out.result;
3521         }
3522
3523         return werror_to_ntstatus(r.out.result);
3524 }
3525
3526 struct rpccli_winreg_SaveKey_state {
3527         struct winreg_SaveKey orig;
3528         struct winreg_SaveKey tmp;
3529         TALLOC_CTX *out_mem_ctx;
3530         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
3531 };
3532
3533 static void rpccli_winreg_SaveKey_done(struct tevent_req *subreq);
3534
3535 struct tevent_req *rpccli_winreg_SaveKey_send(TALLOC_CTX *mem_ctx,
3536                                               struct tevent_context *ev,
3537                                               struct rpc_pipe_client *cli,
3538                                               struct policy_handle *_handle /* [in] [ref] */,
3539                                               struct winreg_String *_filename /* [in] [ref] */,
3540                                               struct KeySecurityAttribute *_sec_attrib /* [in] [unique] */)
3541 {
3542         struct tevent_req *req;
3543         struct rpccli_winreg_SaveKey_state *state;
3544         struct tevent_req *subreq;
3545
3546         req = tevent_req_create(mem_ctx, &state,
3547                                 struct rpccli_winreg_SaveKey_state);
3548         if (req == NULL) {
3549                 return NULL;
3550         }
3551         state->out_mem_ctx = NULL;
3552         state->dispatch_recv = cli->dispatch_recv;
3553
3554         /* In parameters */
3555         state->orig.in.handle = _handle;
3556         state->orig.in.filename = _filename;
3557         state->orig.in.sec_attrib = _sec_attrib;
3558
3559         /* Out parameters */
3560
3561         /* Result */
3562         ZERO_STRUCT(state->orig.out.result);
3563
3564         if (DEBUGLEVEL >= 10) {
3565                 NDR_PRINT_IN_DEBUG(winreg_SaveKey, &state->orig);
3566         }
3567
3568         /* make a temporary copy, that we pass to the dispatch function */
3569         state->tmp = state->orig;
3570
3571         subreq = cli->dispatch_send(state, ev, cli,
3572                                     &ndr_table_winreg,
3573                                     NDR_WINREG_SAVEKEY,
3574                                     &state->tmp);
3575         if (tevent_req_nomem(subreq, req)) {
3576                 return tevent_req_post(req, ev);
3577         }
3578         tevent_req_set_callback(subreq, rpccli_winreg_SaveKey_done, req);
3579         return req;
3580 }
3581
3582 static void rpccli_winreg_SaveKey_done(struct tevent_req *subreq)
3583 {
3584         struct tevent_req *req = tevent_req_callback_data(
3585                 subreq, struct tevent_req);
3586         struct rpccli_winreg_SaveKey_state *state = tevent_req_data(
3587                 req, struct rpccli_winreg_SaveKey_state);
3588         NTSTATUS status;
3589         TALLOC_CTX *mem_ctx;
3590
3591         if (state->out_mem_ctx) {
3592                 mem_ctx = state->out_mem_ctx;
3593         } else {
3594                 mem_ctx = state;
3595         }
3596
3597         status = state->dispatch_recv(subreq, mem_ctx);
3598         TALLOC_FREE(subreq);
3599         if (!NT_STATUS_IS_OK(status)) {
3600                 tevent_req_nterror(req, status);
3601                 return;
3602         }
3603
3604         /* Copy out parameters */
3605
3606         /* Copy result */
3607         state->orig.out.result = state->tmp.out.result;
3608
3609         /* Reset temporary structure */
3610         ZERO_STRUCT(state->tmp);
3611
3612         if (DEBUGLEVEL >= 10) {
3613                 NDR_PRINT_OUT_DEBUG(winreg_SaveKey, &state->orig);
3614         }
3615
3616         tevent_req_done(req);
3617 }
3618
3619 NTSTATUS rpccli_winreg_SaveKey_recv(struct tevent_req *req,
3620                                     TALLOC_CTX *mem_ctx,
3621                                     WERROR *result)
3622 {
3623         struct rpccli_winreg_SaveKey_state *state = tevent_req_data(
3624                 req, struct rpccli_winreg_SaveKey_state);
3625         NTSTATUS status;
3626
3627         if (tevent_req_is_nterror(req, &status)) {
3628                 tevent_req_received(req);
3629                 return status;
3630         }
3631
3632         /* Steal possbile out parameters to the callers context */
3633         talloc_steal(mem_ctx, state->out_mem_ctx);
3634
3635         /* Return result */
3636         *result = state->orig.out.result;
3637
3638         tevent_req_received(req);
3639         return NT_STATUS_OK;
3640 }
3641
3642 NTSTATUS rpccli_winreg_SaveKey(struct rpc_pipe_client *cli,
3643                                TALLOC_CTX *mem_ctx,
3644                                struct policy_handle *handle /* [in] [ref] */,
3645                                struct winreg_String *filename /* [in] [ref] */,
3646                                struct KeySecurityAttribute *sec_attrib /* [in] [unique] */,
3647                                WERROR *werror)
3648 {
3649         struct winreg_SaveKey r;
3650         NTSTATUS status;
3651
3652         /* In parameters */
3653         r.in.handle = handle;
3654         r.in.filename = filename;
3655         r.in.sec_attrib = sec_attrib;
3656
3657         if (DEBUGLEVEL >= 10) {
3658                 NDR_PRINT_IN_DEBUG(winreg_SaveKey, &r);
3659         }
3660
3661         status = cli->dispatch(cli,
3662                                 mem_ctx,
3663                                 &ndr_table_winreg,
3664                                 NDR_WINREG_SAVEKEY,
3665                                 &r);
3666
3667         if (!NT_STATUS_IS_OK(status)) {
3668                 return status;
3669         }
3670
3671         if (DEBUGLEVEL >= 10) {
3672                 NDR_PRINT_OUT_DEBUG(winreg_SaveKey, &r);
3673         }
3674
3675         if (NT_STATUS_IS_ERR(status)) {
3676                 return status;
3677         }
3678
3679         /* Return variables */
3680
3681         /* Return result */
3682         if (werror) {
3683                 *werror = r.out.result;
3684         }
3685
3686         return werror_to_ntstatus(r.out.result);
3687 }
3688
3689 struct rpccli_winreg_SetKeySecurity_state {
3690         struct winreg_SetKeySecurity orig;
3691         struct winreg_SetKeySecurity tmp;
3692         TALLOC_CTX *out_mem_ctx;
3693         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
3694 };
3695
3696 static void rpccli_winreg_SetKeySecurity_done(struct tevent_req *subreq);
3697
3698 struct tevent_req *rpccli_winreg_SetKeySecurity_send(TALLOC_CTX *mem_ctx,
3699                                                      struct tevent_context *ev,
3700                                                      struct rpc_pipe_client *cli,
3701                                                      struct policy_handle *_handle /* [in] [ref] */,
3702                                                      uint32_t _sec_info /* [in]  */,
3703                                                      struct KeySecurityData *_sd /* [in] [ref] */)
3704 {
3705         struct tevent_req *req;
3706         struct rpccli_winreg_SetKeySecurity_state *state;
3707         struct tevent_req *subreq;
3708
3709         req = tevent_req_create(mem_ctx, &state,
3710                                 struct rpccli_winreg_SetKeySecurity_state);
3711         if (req == NULL) {
3712                 return NULL;
3713         }
3714         state->out_mem_ctx = NULL;
3715         state->dispatch_recv = cli->dispatch_recv;
3716
3717         /* In parameters */
3718         state->orig.in.handle = _handle;
3719         state->orig.in.sec_info = _sec_info;
3720         state->orig.in.sd = _sd;
3721
3722         /* Out parameters */
3723
3724         /* Result */
3725         ZERO_STRUCT(state->orig.out.result);
3726
3727         if (DEBUGLEVEL >= 10) {
3728                 NDR_PRINT_IN_DEBUG(winreg_SetKeySecurity, &state->orig);
3729         }
3730
3731         /* make a temporary copy, that we pass to the dispatch function */
3732         state->tmp = state->orig;
3733
3734         subreq = cli->dispatch_send(state, ev, cli,
3735                                     &ndr_table_winreg,
3736                                     NDR_WINREG_SETKEYSECURITY,
3737                                     &state->tmp);
3738         if (tevent_req_nomem(subreq, req)) {
3739                 return tevent_req_post(req, ev);
3740         }
3741         tevent_req_set_callback(subreq, rpccli_winreg_SetKeySecurity_done, req);
3742         return req;
3743 }
3744
3745 static void rpccli_winreg_SetKeySecurity_done(struct tevent_req *subreq)
3746 {
3747         struct tevent_req *req = tevent_req_callback_data(
3748                 subreq, struct tevent_req);
3749         struct rpccli_winreg_SetKeySecurity_state *state = tevent_req_data(
3750                 req, struct rpccli_winreg_SetKeySecurity_state);
3751         NTSTATUS status;
3752         TALLOC_CTX *mem_ctx;
3753
3754         if (state->out_mem_ctx) {
3755                 mem_ctx = state->out_mem_ctx;
3756         } else {
3757                 mem_ctx = state;
3758         }
3759
3760         status = state->dispatch_recv(subreq, mem_ctx);
3761         TALLOC_FREE(subreq);
3762         if (!NT_STATUS_IS_OK(status)) {
3763                 tevent_req_nterror(req, status);
3764                 return;
3765         }
3766
3767         /* Copy out parameters */
3768
3769         /* Copy result */
3770         state->orig.out.result = state->tmp.out.result;
3771
3772         /* Reset temporary structure */
3773         ZERO_STRUCT(state->tmp);
3774
3775         if (DEBUGLEVEL >= 10) {
3776                 NDR_PRINT_OUT_DEBUG(winreg_SetKeySecurity, &state->orig);
3777         }
3778
3779         tevent_req_done(req);
3780 }
3781
3782 NTSTATUS rpccli_winreg_SetKeySecurity_recv(struct tevent_req *req,
3783                                            TALLOC_CTX *mem_ctx,
3784                                            WERROR *result)
3785 {
3786         struct rpccli_winreg_SetKeySecurity_state *state = tevent_req_data(
3787                 req, struct rpccli_winreg_SetKeySecurity_state);
3788         NTSTATUS status;
3789
3790         if (tevent_req_is_nterror(req, &status)) {
3791                 tevent_req_received(req);
3792                 return status;
3793         }
3794
3795         /* Steal possbile out parameters to the callers context */
3796         talloc_steal(mem_ctx, state->out_mem_ctx);
3797
3798         /* Return result */
3799         *result = state->orig.out.result;
3800
3801         tevent_req_received(req);
3802         return NT_STATUS_OK;
3803 }
3804
3805 NTSTATUS rpccli_winreg_SetKeySecurity(struct rpc_pipe_client *cli,
3806                                       TALLOC_CTX *mem_ctx,
3807                                       struct policy_handle *handle /* [in] [ref] */,
3808                                       uint32_t sec_info /* [in]  */,
3809                                       struct KeySecurityData *sd /* [in] [ref] */,
3810                                       WERROR *werror)
3811 {
3812         struct winreg_SetKeySecurity r;
3813         NTSTATUS status;
3814
3815         /* In parameters */
3816         r.in.handle = handle;
3817         r.in.sec_info = sec_info;
3818         r.in.sd = sd;
3819
3820         if (DEBUGLEVEL >= 10) {
3821                 NDR_PRINT_IN_DEBUG(winreg_SetKeySecurity, &r);
3822         }
3823
3824         status = cli->dispatch(cli,
3825                                 mem_ctx,
3826                                 &ndr_table_winreg,
3827                                 NDR_WINREG_SETKEYSECURITY,
3828                                 &r);
3829
3830         if (!NT_STATUS_IS_OK(status)) {
3831                 return status;
3832         }
3833
3834         if (DEBUGLEVEL >= 10) {
3835                 NDR_PRINT_OUT_DEBUG(winreg_SetKeySecurity, &r);
3836         }
3837
3838         if (NT_STATUS_IS_ERR(status)) {
3839                 return status;
3840         }
3841
3842         /* Return variables */
3843
3844         /* Return result */
3845         if (werror) {
3846                 *werror = r.out.result;
3847         }
3848
3849         return werror_to_ntstatus(r.out.result);
3850 }
3851
3852 struct rpccli_winreg_SetValue_state {
3853         struct winreg_SetValue orig;
3854         struct winreg_SetValue tmp;
3855         TALLOC_CTX *out_mem_ctx;
3856         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
3857 };
3858
3859 static void rpccli_winreg_SetValue_done(struct tevent_req *subreq);
3860
3861 struct tevent_req *rpccli_winreg_SetValue_send(TALLOC_CTX *mem_ctx,
3862                                                struct tevent_context *ev,
3863                                                struct rpc_pipe_client *cli,
3864                                                struct policy_handle *_handle /* [in] [ref] */,
3865                                                struct winreg_String _name /* [in]  */,
3866                                                enum winreg_Type _type /* [in]  */,
3867                                                uint8_t *_data /* [in] [ref,size_is(size)] */,
3868                                                uint32_t _size /* [in]  */)
3869 {
3870         struct tevent_req *req;
3871         struct rpccli_winreg_SetValue_state *state;
3872         struct tevent_req *subreq;
3873
3874         req = tevent_req_create(mem_ctx, &state,
3875                                 struct rpccli_winreg_SetValue_state);
3876         if (req == NULL) {
3877                 return NULL;
3878         }
3879         state->out_mem_ctx = NULL;
3880         state->dispatch_recv = cli->dispatch_recv;
3881
3882         /* In parameters */
3883         state->orig.in.handle = _handle;
3884         state->orig.in.name = _name;
3885         state->orig.in.type = _type;
3886         state->orig.in.data = _data;
3887         state->orig.in.size = _size;
3888
3889         /* Out parameters */
3890
3891         /* Result */
3892         ZERO_STRUCT(state->orig.out.result);
3893
3894         if (DEBUGLEVEL >= 10) {
3895                 NDR_PRINT_IN_DEBUG(winreg_SetValue, &state->orig);
3896         }
3897
3898         /* make a temporary copy, that we pass to the dispatch function */
3899         state->tmp = state->orig;
3900
3901         subreq = cli->dispatch_send(state, ev, cli,
3902                                     &ndr_table_winreg,
3903                                     NDR_WINREG_SETVALUE,
3904                                     &state->tmp);
3905         if (tevent_req_nomem(subreq, req)) {
3906                 return tevent_req_post(req, ev);
3907         }
3908         tevent_req_set_callback(subreq, rpccli_winreg_SetValue_done, req);
3909         return req;
3910 }
3911
3912 static void rpccli_winreg_SetValue_done(struct tevent_req *subreq)
3913 {
3914         struct tevent_req *req = tevent_req_callback_data(
3915                 subreq, struct tevent_req);
3916         struct rpccli_winreg_SetValue_state *state = tevent_req_data(
3917                 req, struct rpccli_winreg_SetValue_state);
3918         NTSTATUS status;
3919         TALLOC_CTX *mem_ctx;
3920
3921         if (state->out_mem_ctx) {
3922                 mem_ctx = state->out_mem_ctx;
3923         } else {
3924                 mem_ctx = state;
3925         }
3926
3927         status = state->dispatch_recv(subreq, mem_ctx);
3928         TALLOC_FREE(subreq);
3929         if (!NT_STATUS_IS_OK(status)) {
3930                 tevent_req_nterror(req, status);
3931                 return;
3932         }
3933
3934         /* Copy out parameters */
3935
3936         /* Copy result */
3937         state->orig.out.result = state->tmp.out.result;
3938
3939         /* Reset temporary structure */
3940         ZERO_STRUCT(state->tmp);
3941
3942         if (DEBUGLEVEL >= 10) {
3943                 NDR_PRINT_OUT_DEBUG(winreg_SetValue, &state->orig);
3944         }
3945
3946         tevent_req_done(req);
3947 }
3948
3949 NTSTATUS rpccli_winreg_SetValue_recv(struct tevent_req *req,
3950                                      TALLOC_CTX *mem_ctx,
3951                                      WERROR *result)
3952 {
3953         struct rpccli_winreg_SetValue_state *state = tevent_req_data(
3954                 req, struct rpccli_winreg_SetValue_state);
3955         NTSTATUS status;
3956
3957         if (tevent_req_is_nterror(req, &status)) {
3958                 tevent_req_received(req);
3959                 return status;
3960         }
3961
3962         /* Steal possbile out parameters to the callers context */
3963         talloc_steal(mem_ctx, state->out_mem_ctx);
3964
3965         /* Return result */
3966         *result = state->orig.out.result;
3967
3968         tevent_req_received(req);
3969         return NT_STATUS_OK;
3970 }
3971
3972 NTSTATUS rpccli_winreg_SetValue(struct rpc_pipe_client *cli,
3973                                 TALLOC_CTX *mem_ctx,
3974                                 struct policy_handle *handle /* [in] [ref] */,
3975                                 struct winreg_String name /* [in]  */,
3976                                 enum winreg_Type type /* [in]  */,
3977                                 uint8_t *data /* [in] [ref,size_is(size)] */,
3978                                 uint32_t size /* [in]  */,
3979                                 WERROR *werror)
3980 {
3981         struct winreg_SetValue r;
3982         NTSTATUS status;
3983
3984         /* In parameters */
3985         r.in.handle = handle;
3986         r.in.name = name;
3987         r.in.type = type;
3988         r.in.data = data;
3989         r.in.size = size;
3990
3991         if (DEBUGLEVEL >= 10) {
3992                 NDR_PRINT_IN_DEBUG(winreg_SetValue, &r);
3993         }
3994
3995         status = cli->dispatch(cli,
3996                                 mem_ctx,
3997                                 &ndr_table_winreg,
3998                                 NDR_WINREG_SETVALUE,
3999                                 &r);
4000
4001         if (!NT_STATUS_IS_OK(status)) {
4002                 return status;
4003         }
4004
4005         if (DEBUGLEVEL >= 10) {
4006                 NDR_PRINT_OUT_DEBUG(winreg_SetValue, &r);
4007         }
4008
4009         if (NT_STATUS_IS_ERR(status)) {
4010                 return status;
4011         }
4012
4013         /* Return variables */
4014
4015         /* Return result */
4016         if (werror) {
4017                 *werror = r.out.result;
4018         }
4019
4020         return werror_to_ntstatus(r.out.result);
4021 }
4022
4023 struct rpccli_winreg_UnLoadKey_state {
4024         struct winreg_UnLoadKey orig;
4025         struct winreg_UnLoadKey tmp;
4026         TALLOC_CTX *out_mem_ctx;
4027         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
4028 };
4029
4030 static void rpccli_winreg_UnLoadKey_done(struct tevent_req *subreq);
4031
4032 struct tevent_req *rpccli_winreg_UnLoadKey_send(TALLOC_CTX *mem_ctx,
4033                                                 struct tevent_context *ev,
4034                                                 struct rpc_pipe_client *cli)
4035 {
4036         struct tevent_req *req;
4037         struct rpccli_winreg_UnLoadKey_state *state;
4038         struct tevent_req *subreq;
4039
4040         req = tevent_req_create(mem_ctx, &state,
4041                                 struct rpccli_winreg_UnLoadKey_state);
4042         if (req == NULL) {
4043                 return NULL;
4044         }
4045         state->out_mem_ctx = NULL;
4046         state->dispatch_recv = cli->dispatch_recv;
4047
4048         /* In parameters */
4049
4050         /* Out parameters */
4051
4052         /* Result */
4053         ZERO_STRUCT(state->orig.out.result);
4054
4055         if (DEBUGLEVEL >= 10) {
4056                 NDR_PRINT_IN_DEBUG(winreg_UnLoadKey, &state->orig);
4057         }
4058
4059         /* make a temporary copy, that we pass to the dispatch function */
4060         state->tmp = state->orig;
4061
4062         subreq = cli->dispatch_send(state, ev, cli,
4063                                     &ndr_table_winreg,
4064                                     NDR_WINREG_UNLOADKEY,
4065                                     &state->tmp);
4066         if (tevent_req_nomem(subreq, req)) {
4067                 return tevent_req_post(req, ev);
4068         }
4069         tevent_req_set_callback(subreq, rpccli_winreg_UnLoadKey_done, req);
4070         return req;
4071 }
4072
4073 static void rpccli_winreg_UnLoadKey_done(struct tevent_req *subreq)
4074 {
4075         struct tevent_req *req = tevent_req_callback_data(
4076                 subreq, struct tevent_req);
4077         struct rpccli_winreg_UnLoadKey_state *state = tevent_req_data(
4078                 req, struct rpccli_winreg_UnLoadKey_state);
4079         NTSTATUS status;
4080         TALLOC_CTX *mem_ctx;
4081
4082         if (state->out_mem_ctx) {
4083                 mem_ctx = state->out_mem_ctx;
4084         } else {
4085                 mem_ctx = state;
4086         }
4087
4088         status = state->dispatch_recv(subreq, mem_ctx);
4089         TALLOC_FREE(subreq);
4090         if (!NT_STATUS_IS_OK(status)) {
4091                 tevent_req_nterror(req, status);
4092                 return;
4093         }
4094
4095         /* Copy out parameters */
4096
4097         /* Copy result */
4098         state->orig.out.result = state->tmp.out.result;
4099
4100         /* Reset temporary structure */
4101         ZERO_STRUCT(state->tmp);
4102
4103         if (DEBUGLEVEL >= 10) {
4104                 NDR_PRINT_OUT_DEBUG(winreg_UnLoadKey, &state->orig);
4105         }
4106
4107         tevent_req_done(req);
4108 }
4109
4110 NTSTATUS rpccli_winreg_UnLoadKey_recv(struct tevent_req *req,
4111                                       TALLOC_CTX *mem_ctx,
4112                                       WERROR *result)
4113 {
4114         struct rpccli_winreg_UnLoadKey_state *state = tevent_req_data(
4115                 req, struct rpccli_winreg_UnLoadKey_state);
4116         NTSTATUS status;
4117
4118         if (tevent_req_is_nterror(req, &status)) {
4119                 tevent_req_received(req);
4120                 return status;
4121         }
4122
4123         /* Steal possbile out parameters to the callers context */
4124         talloc_steal(mem_ctx, state->out_mem_ctx);
4125
4126         /* Return result */
4127         *result = state->orig.out.result;
4128
4129         tevent_req_received(req);
4130         return NT_STATUS_OK;
4131 }
4132
4133 NTSTATUS rpccli_winreg_UnLoadKey(struct rpc_pipe_client *cli,
4134                                  TALLOC_CTX *mem_ctx,
4135                                  WERROR *werror)
4136 {
4137         struct winreg_UnLoadKey r;
4138         NTSTATUS status;
4139
4140         /* In parameters */
4141
4142         if (DEBUGLEVEL >= 10) {
4143                 NDR_PRINT_IN_DEBUG(winreg_UnLoadKey, &r);
4144         }
4145
4146         status = cli->dispatch(cli,
4147                                 mem_ctx,
4148                                 &ndr_table_winreg,
4149                                 NDR_WINREG_UNLOADKEY,
4150                                 &r);
4151
4152         if (!NT_STATUS_IS_OK(status)) {
4153                 return status;
4154         }
4155
4156         if (DEBUGLEVEL >= 10) {
4157                 NDR_PRINT_OUT_DEBUG(winreg_UnLoadKey, &r);
4158         }
4159
4160         if (NT_STATUS_IS_ERR(status)) {
4161                 return status;
4162         }
4163
4164         /* Return variables */
4165
4166         /* Return result */
4167         if (werror) {
4168                 *werror = r.out.result;
4169         }
4170
4171         return werror_to_ntstatus(r.out.result);
4172 }
4173
4174 struct rpccli_winreg_InitiateSystemShutdown_state {
4175         struct winreg_InitiateSystemShutdown orig;
4176         struct winreg_InitiateSystemShutdown tmp;
4177         TALLOC_CTX *out_mem_ctx;
4178         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
4179 };
4180
4181 static void rpccli_winreg_InitiateSystemShutdown_done(struct tevent_req *subreq);
4182
4183 struct tevent_req *rpccli_winreg_InitiateSystemShutdown_send(TALLOC_CTX *mem_ctx,
4184                                                              struct tevent_context *ev,
4185                                                              struct rpc_pipe_client *cli,
4186                                                              uint16_t *_hostname /* [in] [unique] */,
4187                                                              struct lsa_StringLarge *_message /* [in] [unique] */,
4188                                                              uint32_t _timeout /* [in]  */,
4189                                                              uint8_t _force_apps /* [in]  */,
4190                                                              uint8_t _do_reboot /* [in]  */)
4191 {
4192         struct tevent_req *req;
4193         struct rpccli_winreg_InitiateSystemShutdown_state *state;
4194         struct tevent_req *subreq;
4195
4196         req = tevent_req_create(mem_ctx, &state,
4197                                 struct rpccli_winreg_InitiateSystemShutdown_state);
4198         if (req == NULL) {
4199                 return NULL;
4200         }
4201         state->out_mem_ctx = NULL;
4202         state->dispatch_recv = cli->dispatch_recv;
4203
4204         /* In parameters */
4205         state->orig.in.hostname = _hostname;
4206         state->orig.in.message = _message;
4207         state->orig.in.timeout = _timeout;
4208         state->orig.in.force_apps = _force_apps;
4209         state->orig.in.do_reboot = _do_reboot;
4210
4211         /* Out parameters */
4212
4213         /* Result */
4214         ZERO_STRUCT(state->orig.out.result);
4215
4216         if (DEBUGLEVEL >= 10) {
4217                 NDR_PRINT_IN_DEBUG(winreg_InitiateSystemShutdown, &state->orig);
4218         }
4219
4220         /* make a temporary copy, that we pass to the dispatch function */
4221         state->tmp = state->orig;
4222
4223         subreq = cli->dispatch_send(state, ev, cli,
4224                                     &ndr_table_winreg,
4225                                     NDR_WINREG_INITIATESYSTEMSHUTDOWN,
4226                                     &state->tmp);
4227         if (tevent_req_nomem(subreq, req)) {
4228                 return tevent_req_post(req, ev);
4229         }
4230         tevent_req_set_callback(subreq, rpccli_winreg_InitiateSystemShutdown_done, req);
4231         return req;
4232 }
4233
4234 static void rpccli_winreg_InitiateSystemShutdown_done(struct tevent_req *subreq)
4235 {
4236         struct tevent_req *req = tevent_req_callback_data(
4237                 subreq, struct tevent_req);
4238         struct rpccli_winreg_InitiateSystemShutdown_state *state = tevent_req_data(
4239                 req, struct rpccli_winreg_InitiateSystemShutdown_state);
4240         NTSTATUS status;
4241         TALLOC_CTX *mem_ctx;
4242
4243         if (state->out_mem_ctx) {
4244                 mem_ctx = state->out_mem_ctx;
4245         } else {
4246                 mem_ctx = state;
4247         }
4248
4249         status = state->dispatch_recv(subreq, mem_ctx);
4250         TALLOC_FREE(subreq);
4251         if (!NT_STATUS_IS_OK(status)) {
4252                 tevent_req_nterror(req, status);
4253                 return;
4254         }
4255
4256         /* Copy out parameters */
4257
4258         /* Copy result */
4259         state->orig.out.result = state->tmp.out.result;
4260
4261         /* Reset temporary structure */
4262         ZERO_STRUCT(state->tmp);
4263
4264         if (DEBUGLEVEL >= 10) {
4265                 NDR_PRINT_OUT_DEBUG(winreg_InitiateSystemShutdown, &state->orig);
4266         }
4267
4268         tevent_req_done(req);
4269 }
4270
4271 NTSTATUS rpccli_winreg_InitiateSystemShutdown_recv(struct tevent_req *req,
4272                                                    TALLOC_CTX *mem_ctx,
4273                                                    WERROR *result)
4274 {
4275         struct rpccli_winreg_InitiateSystemShutdown_state *state = tevent_req_data(
4276                 req, struct rpccli_winreg_InitiateSystemShutdown_state);
4277         NTSTATUS status;
4278
4279         if (tevent_req_is_nterror(req, &status)) {
4280                 tevent_req_received(req);
4281                 return status;
4282         }
4283
4284         /* Steal possbile out parameters to the callers context */
4285         talloc_steal(mem_ctx, state->out_mem_ctx);
4286
4287         /* Return result */
4288         *result = state->orig.out.result;
4289
4290         tevent_req_received(req);
4291         return NT_STATUS_OK;
4292 }
4293
4294 NTSTATUS rpccli_winreg_InitiateSystemShutdown(struct rpc_pipe_client *cli,
4295                                               TALLOC_CTX *mem_ctx,
4296                                               uint16_t *hostname /* [in] [unique] */,
4297                                               struct lsa_StringLarge *message /* [in] [unique] */,
4298                                               uint32_t timeout /* [in]  */,
4299                                               uint8_t force_apps /* [in]  */,
4300                                               uint8_t do_reboot /* [in]  */,
4301                                               WERROR *werror)
4302 {
4303         struct winreg_InitiateSystemShutdown r;
4304         NTSTATUS status;
4305
4306         /* In parameters */
4307         r.in.hostname = hostname;
4308         r.in.message = message;
4309         r.in.timeout = timeout;
4310         r.in.force_apps = force_apps;
4311         r.in.do_reboot = do_reboot;
4312
4313         if (DEBUGLEVEL >= 10) {
4314                 NDR_PRINT_IN_DEBUG(winreg_InitiateSystemShutdown, &r);
4315         }
4316
4317         status = cli->dispatch(cli,
4318                                 mem_ctx,
4319                                 &ndr_table_winreg,
4320                                 NDR_WINREG_INITIATESYSTEMSHUTDOWN,
4321                                 &r);
4322
4323         if (!NT_STATUS_IS_OK(status)) {
4324                 return status;
4325         }
4326
4327         if (DEBUGLEVEL >= 10) {
4328                 NDR_PRINT_OUT_DEBUG(winreg_InitiateSystemShutdown, &r);
4329         }
4330
4331         if (NT_STATUS_IS_ERR(status)) {
4332                 return status;
4333         }
4334
4335         /* Return variables */
4336
4337         /* Return result */
4338         if (werror) {
4339                 *werror = r.out.result;
4340         }
4341
4342         return werror_to_ntstatus(r.out.result);
4343 }
4344
4345 struct rpccli_winreg_AbortSystemShutdown_state {
4346         struct winreg_AbortSystemShutdown orig;
4347         struct winreg_AbortSystemShutdown tmp;
4348         TALLOC_CTX *out_mem_ctx;
4349         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
4350 };
4351
4352 static void rpccli_winreg_AbortSystemShutdown_done(struct tevent_req *subreq);
4353
4354 struct tevent_req *rpccli_winreg_AbortSystemShutdown_send(TALLOC_CTX *mem_ctx,
4355                                                           struct tevent_context *ev,
4356                                                           struct rpc_pipe_client *cli,
4357                                                           uint16_t *_server /* [in] [unique] */)
4358 {
4359         struct tevent_req *req;
4360         struct rpccli_winreg_AbortSystemShutdown_state *state;
4361         struct tevent_req *subreq;
4362
4363         req = tevent_req_create(mem_ctx, &state,
4364                                 struct rpccli_winreg_AbortSystemShutdown_state);
4365         if (req == NULL) {
4366                 return NULL;
4367         }
4368         state->out_mem_ctx = NULL;
4369         state->dispatch_recv = cli->dispatch_recv;
4370
4371         /* In parameters */
4372         state->orig.in.server = _server;
4373
4374         /* Out parameters */
4375
4376         /* Result */
4377         ZERO_STRUCT(state->orig.out.result);
4378
4379         if (DEBUGLEVEL >= 10) {
4380                 NDR_PRINT_IN_DEBUG(winreg_AbortSystemShutdown, &state->orig);
4381         }
4382
4383         /* make a temporary copy, that we pass to the dispatch function */
4384         state->tmp = state->orig;
4385
4386         subreq = cli->dispatch_send(state, ev, cli,
4387                                     &ndr_table_winreg,
4388                                     NDR_WINREG_ABORTSYSTEMSHUTDOWN,
4389                                     &state->tmp);
4390         if (tevent_req_nomem(subreq, req)) {
4391                 return tevent_req_post(req, ev);
4392         }
4393         tevent_req_set_callback(subreq, rpccli_winreg_AbortSystemShutdown_done, req);
4394         return req;
4395 }
4396
4397 static void rpccli_winreg_AbortSystemShutdown_done(struct tevent_req *subreq)
4398 {
4399         struct tevent_req *req = tevent_req_callback_data(
4400                 subreq, struct tevent_req);
4401         struct rpccli_winreg_AbortSystemShutdown_state *state = tevent_req_data(
4402                 req, struct rpccli_winreg_AbortSystemShutdown_state);
4403         NTSTATUS status;
4404         TALLOC_CTX *mem_ctx;
4405
4406         if (state->out_mem_ctx) {
4407                 mem_ctx = state->out_mem_ctx;
4408         } else {
4409                 mem_ctx = state;
4410         }
4411
4412         status = state->dispatch_recv(subreq, mem_ctx);
4413         TALLOC_FREE(subreq);
4414         if (!NT_STATUS_IS_OK(status)) {
4415                 tevent_req_nterror(req, status);
4416                 return;
4417         }
4418
4419         /* Copy out parameters */
4420
4421         /* Copy result */
4422         state->orig.out.result = state->tmp.out.result;
4423
4424         /* Reset temporary structure */
4425         ZERO_STRUCT(state->tmp);
4426
4427         if (DEBUGLEVEL >= 10) {
4428                 NDR_PRINT_OUT_DEBUG(winreg_AbortSystemShutdown, &state->orig);
4429         }
4430
4431         tevent_req_done(req);
4432 }
4433
4434 NTSTATUS rpccli_winreg_AbortSystemShutdown_recv(struct tevent_req *req,
4435                                                 TALLOC_CTX *mem_ctx,
4436                                                 WERROR *result)
4437 {
4438         struct rpccli_winreg_AbortSystemShutdown_state *state = tevent_req_data(
4439                 req, struct rpccli_winreg_AbortSystemShutdown_state);
4440         NTSTATUS status;
4441
4442         if (tevent_req_is_nterror(req, &status)) {
4443                 tevent_req_received(req);
4444                 return status;
4445         }
4446
4447         /* Steal possbile out parameters to the callers context */
4448         talloc_steal(mem_ctx, state->out_mem_ctx);
4449
4450         /* Return result */
4451         *result = state->orig.out.result;
4452
4453         tevent_req_received(req);
4454         return NT_STATUS_OK;
4455 }
4456
4457 NTSTATUS rpccli_winreg_AbortSystemShutdown(struct rpc_pipe_client *cli,
4458                                            TALLOC_CTX *mem_ctx,
4459                                            uint16_t *server /* [in] [unique] */,
4460                                            WERROR *werror)
4461 {
4462         struct winreg_AbortSystemShutdown r;
4463         NTSTATUS status;
4464
4465         /* In parameters */
4466         r.in.server = server;
4467
4468         if (DEBUGLEVEL >= 10) {
4469                 NDR_PRINT_IN_DEBUG(winreg_AbortSystemShutdown, &r);
4470         }
4471
4472         status = cli->dispatch(cli,
4473                                 mem_ctx,
4474                                 &ndr_table_winreg,
4475                                 NDR_WINREG_ABORTSYSTEMSHUTDOWN,
4476                                 &r);
4477
4478         if (!NT_STATUS_IS_OK(status)) {
4479                 return status;
4480         }
4481
4482         if (DEBUGLEVEL >= 10) {
4483                 NDR_PRINT_OUT_DEBUG(winreg_AbortSystemShutdown, &r);
4484         }
4485
4486         if (NT_STATUS_IS_ERR(status)) {
4487                 return status;
4488         }
4489
4490         /* Return variables */
4491
4492         /* Return result */
4493         if (werror) {
4494                 *werror = r.out.result;
4495         }
4496
4497         return werror_to_ntstatus(r.out.result);
4498 }
4499
4500 struct rpccli_winreg_GetVersion_state {
4501         struct winreg_GetVersion orig;
4502         struct winreg_GetVersion tmp;
4503         TALLOC_CTX *out_mem_ctx;
4504         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
4505 };
4506
4507 static void rpccli_winreg_GetVersion_done(struct tevent_req *subreq);
4508
4509 struct tevent_req *rpccli_winreg_GetVersion_send(TALLOC_CTX *mem_ctx,
4510                                                  struct tevent_context *ev,
4511                                                  struct rpc_pipe_client *cli,
4512                                                  struct policy_handle *_handle /* [in] [ref] */,
4513                                                  uint32_t *_version /* [out] [ref] */)
4514 {
4515         struct tevent_req *req;
4516         struct rpccli_winreg_GetVersion_state *state;
4517         struct tevent_req *subreq;
4518
4519         req = tevent_req_create(mem_ctx, &state,
4520                                 struct rpccli_winreg_GetVersion_state);
4521         if (req == NULL) {
4522                 return NULL;
4523         }
4524         state->out_mem_ctx = NULL;
4525         state->dispatch_recv = cli->dispatch_recv;
4526
4527         /* In parameters */
4528         state->orig.in.handle = _handle;
4529
4530         /* Out parameters */
4531         state->orig.out.version = _version;
4532
4533         /* Result */
4534         ZERO_STRUCT(state->orig.out.result);
4535
4536         if (DEBUGLEVEL >= 10) {
4537                 NDR_PRINT_IN_DEBUG(winreg_GetVersion, &state->orig);
4538         }
4539
4540         state->out_mem_ctx = talloc_named_const(state, 0,
4541                              "rpccli_winreg_GetVersion_out_memory");
4542         if (tevent_req_nomem(state->out_mem_ctx, req)) {
4543                 return tevent_req_post(req, ev);
4544         }
4545
4546         /* make a temporary copy, that we pass to the dispatch function */
4547         state->tmp = state->orig;
4548
4549         subreq = cli->dispatch_send(state, ev, cli,
4550                                     &ndr_table_winreg,
4551                                     NDR_WINREG_GETVERSION,
4552                                     &state->tmp);
4553         if (tevent_req_nomem(subreq, req)) {
4554                 return tevent_req_post(req, ev);
4555         }
4556         tevent_req_set_callback(subreq, rpccli_winreg_GetVersion_done, req);
4557         return req;
4558 }
4559
4560 static void rpccli_winreg_GetVersion_done(struct tevent_req *subreq)
4561 {
4562         struct tevent_req *req = tevent_req_callback_data(
4563                 subreq, struct tevent_req);
4564         struct rpccli_winreg_GetVersion_state *state = tevent_req_data(
4565                 req, struct rpccli_winreg_GetVersion_state);
4566         NTSTATUS status;
4567         TALLOC_CTX *mem_ctx;
4568
4569         if (state->out_mem_ctx) {
4570                 mem_ctx = state->out_mem_ctx;
4571         } else {
4572                 mem_ctx = state;
4573         }
4574
4575         status = state->dispatch_recv(subreq, mem_ctx);
4576         TALLOC_FREE(subreq);
4577         if (!NT_STATUS_IS_OK(status)) {
4578                 tevent_req_nterror(req, status);
4579                 return;
4580         }
4581
4582         /* Copy out parameters */
4583         *state->orig.out.version = *state->tmp.out.version;
4584
4585         /* Copy result */
4586         state->orig.out.result = state->tmp.out.result;
4587
4588         /* Reset temporary structure */
4589         ZERO_STRUCT(state->tmp);
4590
4591         if (DEBUGLEVEL >= 10) {
4592                 NDR_PRINT_OUT_DEBUG(winreg_GetVersion, &state->orig);
4593         }
4594
4595         tevent_req_done(req);
4596 }
4597
4598 NTSTATUS rpccli_winreg_GetVersion_recv(struct tevent_req *req,
4599                                        TALLOC_CTX *mem_ctx,
4600                                        WERROR *result)
4601 {
4602         struct rpccli_winreg_GetVersion_state *state = tevent_req_data(
4603                 req, struct rpccli_winreg_GetVersion_state);
4604         NTSTATUS status;
4605
4606         if (tevent_req_is_nterror(req, &status)) {
4607                 tevent_req_received(req);
4608                 return status;
4609         }
4610
4611         /* Steal possbile out parameters to the callers context */
4612         talloc_steal(mem_ctx, state->out_mem_ctx);
4613
4614         /* Return result */
4615         *result = state->orig.out.result;
4616
4617         tevent_req_received(req);
4618         return NT_STATUS_OK;
4619 }
4620
4621 NTSTATUS rpccli_winreg_GetVersion(struct rpc_pipe_client *cli,
4622                                   TALLOC_CTX *mem_ctx,
4623                                   struct policy_handle *handle /* [in] [ref] */,
4624                                   uint32_t *version /* [out] [ref] */,
4625                                   WERROR *werror)
4626 {
4627         struct winreg_GetVersion r;
4628         NTSTATUS status;
4629
4630         /* In parameters */
4631         r.in.handle = handle;
4632
4633         if (DEBUGLEVEL >= 10) {
4634                 NDR_PRINT_IN_DEBUG(winreg_GetVersion, &r);
4635         }
4636
4637         status = cli->dispatch(cli,
4638                                 mem_ctx,
4639                                 &ndr_table_winreg,
4640                                 NDR_WINREG_GETVERSION,
4641                                 &r);
4642
4643         if (!NT_STATUS_IS_OK(status)) {
4644                 return status;
4645         }
4646
4647         if (DEBUGLEVEL >= 10) {
4648                 NDR_PRINT_OUT_DEBUG(winreg_GetVersion, &r);
4649         }
4650
4651         if (NT_STATUS_IS_ERR(status)) {
4652                 return status;
4653         }
4654
4655         /* Return variables */
4656         *version = *r.out.version;
4657
4658         /* Return result */
4659         if (werror) {
4660                 *werror = r.out.result;
4661         }
4662
4663         return werror_to_ntstatus(r.out.result);
4664 }
4665
4666 struct rpccli_winreg_OpenHKCC_state {
4667         struct winreg_OpenHKCC orig;
4668         struct winreg_OpenHKCC tmp;
4669         TALLOC_CTX *out_mem_ctx;
4670         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
4671 };
4672
4673 static void rpccli_winreg_OpenHKCC_done(struct tevent_req *subreq);
4674
4675 struct tevent_req *rpccli_winreg_OpenHKCC_send(TALLOC_CTX *mem_ctx,
4676                                                struct tevent_context *ev,
4677                                                struct rpc_pipe_client *cli,
4678                                                uint16_t *_system_name /* [in] [unique] */,
4679                                                uint32_t _access_mask /* [in]  */,
4680                                                struct policy_handle *_handle /* [out] [ref] */)
4681 {
4682         struct tevent_req *req;
4683         struct rpccli_winreg_OpenHKCC_state *state;
4684         struct tevent_req *subreq;
4685
4686         req = tevent_req_create(mem_ctx, &state,
4687                                 struct rpccli_winreg_OpenHKCC_state);
4688         if (req == NULL) {
4689                 return NULL;
4690         }
4691         state->out_mem_ctx = NULL;
4692         state->dispatch_recv = cli->dispatch_recv;
4693
4694         /* In parameters */
4695         state->orig.in.system_name = _system_name;
4696         state->orig.in.access_mask = _access_mask;
4697
4698         /* Out parameters */
4699         state->orig.out.handle = _handle;
4700
4701         /* Result */
4702         ZERO_STRUCT(state->orig.out.result);
4703
4704         if (DEBUGLEVEL >= 10) {
4705                 NDR_PRINT_IN_DEBUG(winreg_OpenHKCC, &state->orig);
4706         }
4707
4708         state->out_mem_ctx = talloc_named_const(state, 0,
4709                              "rpccli_winreg_OpenHKCC_out_memory");
4710         if (tevent_req_nomem(state->out_mem_ctx, req)) {
4711                 return tevent_req_post(req, ev);
4712         }
4713
4714         /* make a temporary copy, that we pass to the dispatch function */
4715         state->tmp = state->orig;
4716
4717         subreq = cli->dispatch_send(state, ev, cli,
4718                                     &ndr_table_winreg,
4719                                     NDR_WINREG_OPENHKCC,
4720                                     &state->tmp);
4721         if (tevent_req_nomem(subreq, req)) {
4722                 return tevent_req_post(req, ev);
4723         }
4724         tevent_req_set_callback(subreq, rpccli_winreg_OpenHKCC_done, req);
4725         return req;
4726 }
4727
4728 static void rpccli_winreg_OpenHKCC_done(struct tevent_req *subreq)
4729 {
4730         struct tevent_req *req = tevent_req_callback_data(
4731                 subreq, struct tevent_req);
4732         struct rpccli_winreg_OpenHKCC_state *state = tevent_req_data(
4733                 req, struct rpccli_winreg_OpenHKCC_state);
4734         NTSTATUS status;
4735         TALLOC_CTX *mem_ctx;
4736
4737         if (state->out_mem_ctx) {
4738                 mem_ctx = state->out_mem_ctx;
4739         } else {
4740                 mem_ctx = state;
4741         }
4742
4743         status = state->dispatch_recv(subreq, mem_ctx);
4744         TALLOC_FREE(subreq);
4745         if (!NT_STATUS_IS_OK(status)) {
4746                 tevent_req_nterror(req, status);
4747                 return;
4748         }
4749
4750         /* Copy out parameters */
4751         *state->orig.out.handle = *state->tmp.out.handle;
4752
4753         /* Copy result */
4754         state->orig.out.result = state->tmp.out.result;
4755
4756         /* Reset temporary structure */
4757         ZERO_STRUCT(state->tmp);
4758
4759         if (DEBUGLEVEL >= 10) {
4760                 NDR_PRINT_OUT_DEBUG(winreg_OpenHKCC, &state->orig);
4761         }
4762
4763         tevent_req_done(req);
4764 }
4765
4766 NTSTATUS rpccli_winreg_OpenHKCC_recv(struct tevent_req *req,
4767                                      TALLOC_CTX *mem_ctx,
4768                                      WERROR *result)
4769 {
4770         struct rpccli_winreg_OpenHKCC_state *state = tevent_req_data(
4771                 req, struct rpccli_winreg_OpenHKCC_state);
4772         NTSTATUS status;
4773
4774         if (tevent_req_is_nterror(req, &status)) {
4775                 tevent_req_received(req);
4776                 return status;
4777         }
4778
4779         /* Steal possbile out parameters to the callers context */
4780         talloc_steal(mem_ctx, state->out_mem_ctx);
4781
4782         /* Return result */
4783         *result = state->orig.out.result;
4784
4785         tevent_req_received(req);
4786         return NT_STATUS_OK;
4787 }
4788
4789 NTSTATUS rpccli_winreg_OpenHKCC(struct rpc_pipe_client *cli,
4790                                 TALLOC_CTX *mem_ctx,
4791                                 uint16_t *system_name /* [in] [unique] */,
4792                                 uint32_t access_mask /* [in]  */,
4793                                 struct policy_handle *handle /* [out] [ref] */,
4794                                 WERROR *werror)
4795 {
4796         struct winreg_OpenHKCC r;
4797         NTSTATUS status;
4798
4799         /* In parameters */
4800         r.in.system_name = system_name;
4801         r.in.access_mask = access_mask;
4802
4803         if (DEBUGLEVEL >= 10) {
4804                 NDR_PRINT_IN_DEBUG(winreg_OpenHKCC, &r);
4805         }
4806
4807         status = cli->dispatch(cli,
4808                                 mem_ctx,
4809                                 &ndr_table_winreg,
4810                                 NDR_WINREG_OPENHKCC,
4811                                 &r);
4812
4813         if (!NT_STATUS_IS_OK(status)) {
4814                 return status;
4815         }
4816
4817         if (DEBUGLEVEL >= 10) {
4818                 NDR_PRINT_OUT_DEBUG(winreg_OpenHKCC, &r);
4819         }
4820
4821         if (NT_STATUS_IS_ERR(status)) {
4822                 return status;
4823         }
4824
4825         /* Return variables */
4826         *handle = *r.out.handle;
4827
4828         /* Return result */
4829         if (werror) {
4830                 *werror = r.out.result;
4831         }
4832
4833         return werror_to_ntstatus(r.out.result);
4834 }
4835
4836 struct rpccli_winreg_OpenHKDD_state {
4837         struct winreg_OpenHKDD orig;
4838         struct winreg_OpenHKDD tmp;
4839         TALLOC_CTX *out_mem_ctx;
4840         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
4841 };
4842
4843 static void rpccli_winreg_OpenHKDD_done(struct tevent_req *subreq);
4844
4845 struct tevent_req *rpccli_winreg_OpenHKDD_send(TALLOC_CTX *mem_ctx,
4846                                                struct tevent_context *ev,
4847                                                struct rpc_pipe_client *cli,
4848                                                uint16_t *_system_name /* [in] [unique] */,
4849                                                uint32_t _access_mask /* [in]  */,
4850                                                struct policy_handle *_handle /* [out] [ref] */)
4851 {
4852         struct tevent_req *req;
4853         struct rpccli_winreg_OpenHKDD_state *state;
4854         struct tevent_req *subreq;
4855
4856         req = tevent_req_create(mem_ctx, &state,
4857                                 struct rpccli_winreg_OpenHKDD_state);
4858         if (req == NULL) {
4859                 return NULL;
4860         }
4861         state->out_mem_ctx = NULL;
4862         state->dispatch_recv = cli->dispatch_recv;
4863
4864         /* In parameters */
4865         state->orig.in.system_name = _system_name;
4866         state->orig.in.access_mask = _access_mask;
4867
4868         /* Out parameters */
4869         state->orig.out.handle = _handle;
4870
4871         /* Result */
4872         ZERO_STRUCT(state->orig.out.result);
4873
4874         if (DEBUGLEVEL >= 10) {
4875                 NDR_PRINT_IN_DEBUG(winreg_OpenHKDD, &state->orig);
4876         }
4877
4878         state->out_mem_ctx = talloc_named_const(state, 0,
4879                              "rpccli_winreg_OpenHKDD_out_memory");
4880         if (tevent_req_nomem(state->out_mem_ctx, req)) {
4881                 return tevent_req_post(req, ev);
4882         }
4883
4884         /* make a temporary copy, that we pass to the dispatch function */
4885         state->tmp = state->orig;
4886
4887         subreq = cli->dispatch_send(state, ev, cli,
4888                                     &ndr_table_winreg,
4889                                     NDR_WINREG_OPENHKDD,
4890                                     &state->tmp);
4891         if (tevent_req_nomem(subreq, req)) {
4892                 return tevent_req_post(req, ev);
4893         }
4894         tevent_req_set_callback(subreq, rpccli_winreg_OpenHKDD_done, req);
4895         return req;
4896 }
4897
4898 static void rpccli_winreg_OpenHKDD_done(struct tevent_req *subreq)
4899 {
4900         struct tevent_req *req = tevent_req_callback_data(
4901                 subreq, struct tevent_req);
4902         struct rpccli_winreg_OpenHKDD_state *state = tevent_req_data(
4903                 req, struct rpccli_winreg_OpenHKDD_state);
4904         NTSTATUS status;
4905         TALLOC_CTX *mem_ctx;
4906
4907         if (state->out_mem_ctx) {
4908                 mem_ctx = state->out_mem_ctx;
4909         } else {
4910                 mem_ctx = state;
4911         }
4912
4913         status = state->dispatch_recv(subreq, mem_ctx);
4914         TALLOC_FREE(subreq);
4915         if (!NT_STATUS_IS_OK(status)) {
4916                 tevent_req_nterror(req, status);
4917                 return;
4918         }
4919
4920         /* Copy out parameters */
4921         *state->orig.out.handle = *state->tmp.out.handle;
4922
4923         /* Copy result */
4924         state->orig.out.result = state->tmp.out.result;
4925
4926         /* Reset temporary structure */
4927         ZERO_STRUCT(state->tmp);
4928
4929         if (DEBUGLEVEL >= 10) {
4930                 NDR_PRINT_OUT_DEBUG(winreg_OpenHKDD, &state->orig);
4931         }
4932
4933         tevent_req_done(req);
4934 }
4935
4936 NTSTATUS rpccli_winreg_OpenHKDD_recv(struct tevent_req *req,
4937                                      TALLOC_CTX *mem_ctx,
4938                                      WERROR *result)
4939 {
4940         struct rpccli_winreg_OpenHKDD_state *state = tevent_req_data(
4941                 req, struct rpccli_winreg_OpenHKDD_state);
4942         NTSTATUS status;
4943
4944         if (tevent_req_is_nterror(req, &status)) {
4945                 tevent_req_received(req);
4946                 return status;
4947         }
4948
4949         /* Steal possbile out parameters to the callers context */
4950         talloc_steal(mem_ctx, state->out_mem_ctx);
4951
4952         /* Return result */
4953         *result = state->orig.out.result;
4954
4955         tevent_req_received(req);
4956         return NT_STATUS_OK;
4957 }
4958
4959 NTSTATUS rpccli_winreg_OpenHKDD(struct rpc_pipe_client *cli,
4960                                 TALLOC_CTX *mem_ctx,
4961                                 uint16_t *system_name /* [in] [unique] */,
4962                                 uint32_t access_mask /* [in]  */,
4963                                 struct policy_handle *handle /* [out] [ref] */,
4964                                 WERROR *werror)
4965 {
4966         struct winreg_OpenHKDD r;
4967         NTSTATUS status;
4968
4969         /* In parameters */
4970         r.in.system_name = system_name;
4971         r.in.access_mask = access_mask;
4972
4973         if (DEBUGLEVEL >= 10) {
4974                 NDR_PRINT_IN_DEBUG(winreg_OpenHKDD, &r);
4975         }
4976
4977         status = cli->dispatch(cli,
4978                                 mem_ctx,
4979                                 &ndr_table_winreg,
4980                                 NDR_WINREG_OPENHKDD,
4981                                 &r);
4982
4983         if (!NT_STATUS_IS_OK(status)) {
4984                 return status;
4985         }
4986
4987         if (DEBUGLEVEL >= 10) {
4988                 NDR_PRINT_OUT_DEBUG(winreg_OpenHKDD, &r);
4989         }
4990
4991         if (NT_STATUS_IS_ERR(status)) {
4992                 return status;
4993         }
4994
4995         /* Return variables */
4996         *handle = *r.out.handle;
4997
4998         /* Return result */
4999         if (werror) {
5000                 *werror = r.out.result;
5001         }
5002
5003         return werror_to_ntstatus(r.out.result);
5004 }
5005
5006 struct rpccli_winreg_QueryMultipleValues_state {
5007         struct winreg_QueryMultipleValues orig;
5008         struct winreg_QueryMultipleValues tmp;
5009         TALLOC_CTX *out_mem_ctx;
5010         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
5011 };
5012
5013 static void rpccli_winreg_QueryMultipleValues_done(struct tevent_req *subreq);
5014
5015 struct tevent_req *rpccli_winreg_QueryMultipleValues_send(TALLOC_CTX *mem_ctx,
5016                                                           struct tevent_context *ev,
5017                                                           struct rpc_pipe_client *cli,
5018                                                           struct policy_handle *_key_handle /* [in] [ref] */,
5019                                                           struct QueryMultipleValue *_values /* [in,out] [ref,length_is(num_values),size_is(num_values)] */,
5020                                                           uint32_t _num_values /* [in]  */,
5021                                                           uint8_t *_buffer /* [in,out] [unique,length_is(*buffer_size),size_is(*buffer_size)] */,
5022                                                           uint32_t *_buffer_size /* [in,out] [ref] */)
5023 {
5024         struct tevent_req *req;
5025         struct rpccli_winreg_QueryMultipleValues_state *state;
5026         struct tevent_req *subreq;
5027
5028         req = tevent_req_create(mem_ctx, &state,
5029                                 struct rpccli_winreg_QueryMultipleValues_state);
5030         if (req == NULL) {
5031                 return NULL;
5032         }
5033         state->out_mem_ctx = NULL;
5034         state->dispatch_recv = cli->dispatch_recv;
5035
5036         /* In parameters */
5037         state->orig.in.key_handle = _key_handle;
5038         state->orig.in.values = _values;
5039         state->orig.in.num_values = _num_values;
5040         state->orig.in.buffer = _buffer;
5041         state->orig.in.buffer_size = _buffer_size;
5042
5043         /* Out parameters */
5044         state->orig.out.values = _values;
5045         state->orig.out.buffer = _buffer;
5046         state->orig.out.buffer_size = _buffer_size;
5047
5048         /* Result */
5049         ZERO_STRUCT(state->orig.out.result);
5050
5051         if (DEBUGLEVEL >= 10) {
5052                 NDR_PRINT_IN_DEBUG(winreg_QueryMultipleValues, &state->orig);
5053         }
5054
5055         state->out_mem_ctx = talloc_named_const(state, 0,
5056                              "rpccli_winreg_QueryMultipleValues_out_memory");
5057         if (tevent_req_nomem(state->out_mem_ctx, req)) {
5058                 return tevent_req_post(req, ev);
5059         }
5060
5061         /* make a temporary copy, that we pass to the dispatch function */
5062         state->tmp = state->orig;
5063
5064         subreq = cli->dispatch_send(state, ev, cli,
5065                                     &ndr_table_winreg,
5066                                     NDR_WINREG_QUERYMULTIPLEVALUES,
5067                                     &state->tmp);
5068         if (tevent_req_nomem(subreq, req)) {
5069                 return tevent_req_post(req, ev);
5070         }
5071         tevent_req_set_callback(subreq, rpccli_winreg_QueryMultipleValues_done, req);
5072         return req;
5073 }
5074
5075 static void rpccli_winreg_QueryMultipleValues_done(struct tevent_req *subreq)
5076 {
5077         struct tevent_req *req = tevent_req_callback_data(
5078                 subreq, struct tevent_req);
5079         struct rpccli_winreg_QueryMultipleValues_state *state = tevent_req_data(
5080                 req, struct rpccli_winreg_QueryMultipleValues_state);
5081         NTSTATUS status;
5082         TALLOC_CTX *mem_ctx;
5083
5084         if (state->out_mem_ctx) {
5085                 mem_ctx = state->out_mem_ctx;
5086         } else {
5087                 mem_ctx = state;
5088         }
5089
5090         status = state->dispatch_recv(subreq, mem_ctx);
5091         TALLOC_FREE(subreq);
5092         if (!NT_STATUS_IS_OK(status)) {
5093                 tevent_req_nterror(req, status);
5094                 return;
5095         }
5096
5097         /* Copy out parameters */
5098         memcpy(state->orig.out.values, state->tmp.out.values, state->tmp.in.num_values * sizeof(*state->orig.out.values));
5099         if (state->orig.out.buffer && state->tmp.out.buffer) {
5100                 memcpy(state->orig.out.buffer, state->tmp.out.buffer, *state->tmp.in.buffer_size * sizeof(*state->orig.out.buffer));
5101         }
5102         *state->orig.out.buffer_size = *state->tmp.out.buffer_size;
5103
5104         /* Copy result */
5105         state->orig.out.result = state->tmp.out.result;
5106
5107         /* Reset temporary structure */
5108         ZERO_STRUCT(state->tmp);
5109
5110         if (DEBUGLEVEL >= 10) {
5111                 NDR_PRINT_OUT_DEBUG(winreg_QueryMultipleValues, &state->orig);
5112         }
5113
5114         tevent_req_done(req);
5115 }
5116
5117 NTSTATUS rpccli_winreg_QueryMultipleValues_recv(struct tevent_req *req,
5118                                                 TALLOC_CTX *mem_ctx,
5119                                                 WERROR *result)
5120 {
5121         struct rpccli_winreg_QueryMultipleValues_state *state = tevent_req_data(
5122                 req, struct rpccli_winreg_QueryMultipleValues_state);
5123         NTSTATUS status;
5124
5125         if (tevent_req_is_nterror(req, &status)) {
5126                 tevent_req_received(req);
5127                 return status;
5128         }
5129
5130         /* Steal possbile out parameters to the callers context */
5131         talloc_steal(mem_ctx, state->out_mem_ctx);
5132
5133         /* Return result */
5134         *result = state->orig.out.result;
5135
5136         tevent_req_received(req);
5137         return NT_STATUS_OK;
5138 }
5139
5140 NTSTATUS rpccli_winreg_QueryMultipleValues(struct rpc_pipe_client *cli,
5141                                            TALLOC_CTX *mem_ctx,
5142                                            struct policy_handle *key_handle /* [in] [ref] */,
5143                                            struct QueryMultipleValue *values /* [in,out] [ref,length_is(num_values),size_is(num_values)] */,
5144                                            uint32_t num_values /* [in]  */,
5145                                            uint8_t *buffer /* [in,out] [unique,length_is(*buffer_size),size_is(*buffer_size)] */,
5146                                            uint32_t *buffer_size /* [in,out] [ref] */,
5147                                            WERROR *werror)
5148 {
5149         struct winreg_QueryMultipleValues r;
5150         NTSTATUS status;
5151
5152         /* In parameters */
5153         r.in.key_handle = key_handle;
5154         r.in.values = values;
5155         r.in.num_values = num_values;
5156         r.in.buffer = buffer;
5157         r.in.buffer_size = buffer_size;
5158
5159         if (DEBUGLEVEL >= 10) {
5160                 NDR_PRINT_IN_DEBUG(winreg_QueryMultipleValues, &r);
5161         }
5162
5163         status = cli->dispatch(cli,
5164                                 mem_ctx,
5165                                 &ndr_table_winreg,
5166                                 NDR_WINREG_QUERYMULTIPLEVALUES,
5167                                 &r);
5168
5169         if (!NT_STATUS_IS_OK(status)) {
5170                 return status;
5171         }
5172
5173         if (DEBUGLEVEL >= 10) {
5174                 NDR_PRINT_OUT_DEBUG(winreg_QueryMultipleValues, &r);
5175         }
5176
5177         if (NT_STATUS_IS_ERR(status)) {
5178                 return status;
5179         }
5180
5181         /* Return variables */
5182         memcpy(values, r.out.values, r.in.num_values * sizeof(*values));
5183         if (buffer && r.out.buffer) {
5184                 memcpy(buffer, r.out.buffer, *r.in.buffer_size * sizeof(*buffer));
5185         }
5186         *buffer_size = *r.out.buffer_size;
5187
5188         /* Return result */
5189         if (werror) {
5190                 *werror = r.out.result;
5191         }
5192
5193         return werror_to_ntstatus(r.out.result);
5194 }
5195
5196 struct rpccli_winreg_InitiateSystemShutdownEx_state {
5197         struct winreg_InitiateSystemShutdownEx orig;
5198         struct winreg_InitiateSystemShutdownEx tmp;
5199         TALLOC_CTX *out_mem_ctx;
5200         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
5201 };
5202
5203 static void rpccli_winreg_InitiateSystemShutdownEx_done(struct tevent_req *subreq);
5204
5205 struct tevent_req *rpccli_winreg_InitiateSystemShutdownEx_send(TALLOC_CTX *mem_ctx,
5206                                                                struct tevent_context *ev,
5207                                                                struct rpc_pipe_client *cli,
5208                                                                uint16_t *_hostname /* [in] [unique] */,
5209                                                                struct lsa_StringLarge *_message /* [in] [unique] */,
5210                                                                uint32_t _timeout /* [in]  */,
5211                                                                uint8_t _force_apps /* [in]  */,
5212                                                                uint8_t _do_reboot /* [in]  */,
5213                                                                uint32_t _reason /* [in]  */)
5214 {
5215         struct tevent_req *req;
5216         struct rpccli_winreg_InitiateSystemShutdownEx_state *state;
5217         struct tevent_req *subreq;
5218
5219         req = tevent_req_create(mem_ctx, &state,
5220                                 struct rpccli_winreg_InitiateSystemShutdownEx_state);
5221         if (req == NULL) {
5222                 return NULL;
5223         }
5224         state->out_mem_ctx = NULL;
5225         state->dispatch_recv = cli->dispatch_recv;
5226
5227         /* In parameters */
5228         state->orig.in.hostname = _hostname;
5229         state->orig.in.message = _message;
5230         state->orig.in.timeout = _timeout;
5231         state->orig.in.force_apps = _force_apps;
5232         state->orig.in.do_reboot = _do_reboot;
5233         state->orig.in.reason = _reason;
5234
5235         /* Out parameters */
5236
5237         /* Result */
5238         ZERO_STRUCT(state->orig.out.result);
5239
5240         if (DEBUGLEVEL >= 10) {
5241                 NDR_PRINT_IN_DEBUG(winreg_InitiateSystemShutdownEx, &state->orig);
5242         }
5243
5244         /* make a temporary copy, that we pass to the dispatch function */
5245         state->tmp = state->orig;
5246
5247         subreq = cli->dispatch_send(state, ev, cli,
5248                                     &ndr_table_winreg,
5249                                     NDR_WINREG_INITIATESYSTEMSHUTDOWNEX,
5250                                     &state->tmp);
5251         if (tevent_req_nomem(subreq, req)) {
5252                 return tevent_req_post(req, ev);
5253         }
5254         tevent_req_set_callback(subreq, rpccli_winreg_InitiateSystemShutdownEx_done, req);
5255         return req;
5256 }
5257
5258 static void rpccli_winreg_InitiateSystemShutdownEx_done(struct tevent_req *subreq)
5259 {
5260         struct tevent_req *req = tevent_req_callback_data(
5261                 subreq, struct tevent_req);
5262         struct rpccli_winreg_InitiateSystemShutdownEx_state *state = tevent_req_data(
5263                 req, struct rpccli_winreg_InitiateSystemShutdownEx_state);
5264         NTSTATUS status;
5265         TALLOC_CTX *mem_ctx;
5266
5267         if (state->out_mem_ctx) {
5268                 mem_ctx = state->out_mem_ctx;
5269         } else {
5270                 mem_ctx = state;
5271         }
5272
5273         status = state->dispatch_recv(subreq, mem_ctx);
5274         TALLOC_FREE(subreq);
5275         if (!NT_STATUS_IS_OK(status)) {
5276                 tevent_req_nterror(req, status);
5277                 return;
5278         }
5279
5280         /* Copy out parameters */
5281
5282         /* Copy result */
5283         state->orig.out.result = state->tmp.out.result;
5284
5285         /* Reset temporary structure */
5286         ZERO_STRUCT(state->tmp);
5287
5288         if (DEBUGLEVEL >= 10) {
5289                 NDR_PRINT_OUT_DEBUG(winreg_InitiateSystemShutdownEx, &state->orig);
5290         }
5291
5292         tevent_req_done(req);
5293 }
5294
5295 NTSTATUS rpccli_winreg_InitiateSystemShutdownEx_recv(struct tevent_req *req,
5296                                                      TALLOC_CTX *mem_ctx,
5297                                                      WERROR *result)
5298 {
5299         struct rpccli_winreg_InitiateSystemShutdownEx_state *state = tevent_req_data(
5300                 req, struct rpccli_winreg_InitiateSystemShutdownEx_state);
5301         NTSTATUS status;
5302
5303         if (tevent_req_is_nterror(req, &status)) {
5304                 tevent_req_received(req);
5305                 return status;
5306         }
5307
5308         /* Steal possbile out parameters to the callers context */
5309         talloc_steal(mem_ctx, state->out_mem_ctx);
5310
5311         /* Return result */
5312         *result = state->orig.out.result;
5313
5314         tevent_req_received(req);
5315         return NT_STATUS_OK;
5316 }
5317
5318 NTSTATUS rpccli_winreg_InitiateSystemShutdownEx(struct rpc_pipe_client *cli,
5319                                                 TALLOC_CTX *mem_ctx,
5320                                                 uint16_t *hostname /* [in] [unique] */,
5321                                                 struct lsa_StringLarge *message /* [in] [unique] */,
5322                                                 uint32_t timeout /* [in]  */,
5323                                                 uint8_t force_apps /* [in]  */,
5324                                                 uint8_t do_reboot /* [in]  */,
5325                                                 uint32_t reason /* [in]  */,
5326                                                 WERROR *werror)
5327 {
5328         struct winreg_InitiateSystemShutdownEx r;
5329         NTSTATUS status;
5330
5331         /* In parameters */
5332         r.in.hostname = hostname;
5333         r.in.message = message;
5334         r.in.timeout = timeout;
5335         r.in.force_apps = force_apps;
5336         r.in.do_reboot = do_reboot;
5337         r.in.reason = reason;
5338
5339         if (DEBUGLEVEL >= 10) {
5340                 NDR_PRINT_IN_DEBUG(winreg_InitiateSystemShutdownEx, &r);
5341         }
5342
5343         status = cli->dispatch(cli,
5344                                 mem_ctx,
5345                                 &ndr_table_winreg,
5346                                 NDR_WINREG_INITIATESYSTEMSHUTDOWNEX,
5347                                 &r);
5348
5349         if (!NT_STATUS_IS_OK(status)) {
5350                 return status;
5351         }
5352
5353         if (DEBUGLEVEL >= 10) {
5354                 NDR_PRINT_OUT_DEBUG(winreg_InitiateSystemShutdownEx, &r);
5355         }
5356
5357         if (NT_STATUS_IS_ERR(status)) {
5358                 return status;
5359         }
5360
5361         /* Return variables */
5362
5363         /* Return result */
5364         if (werror) {
5365                 *werror = r.out.result;
5366         }
5367
5368         return werror_to_ntstatus(r.out.result);
5369 }
5370
5371 struct rpccli_winreg_SaveKeyEx_state {
5372         struct winreg_SaveKeyEx orig;
5373         struct winreg_SaveKeyEx tmp;
5374         TALLOC_CTX *out_mem_ctx;
5375         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
5376 };
5377
5378 static void rpccli_winreg_SaveKeyEx_done(struct tevent_req *subreq);
5379
5380 struct tevent_req *rpccli_winreg_SaveKeyEx_send(TALLOC_CTX *mem_ctx,
5381                                                 struct tevent_context *ev,
5382                                                 struct rpc_pipe_client *cli)
5383 {
5384         struct tevent_req *req;
5385         struct rpccli_winreg_SaveKeyEx_state *state;
5386         struct tevent_req *subreq;
5387
5388         req = tevent_req_create(mem_ctx, &state,
5389                                 struct rpccli_winreg_SaveKeyEx_state);
5390         if (req == NULL) {
5391                 return NULL;
5392         }
5393         state->out_mem_ctx = NULL;
5394         state->dispatch_recv = cli->dispatch_recv;
5395
5396         /* In parameters */
5397
5398         /* Out parameters */
5399
5400         /* Result */
5401         ZERO_STRUCT(state->orig.out.result);
5402
5403         if (DEBUGLEVEL >= 10) {
5404                 NDR_PRINT_IN_DEBUG(winreg_SaveKeyEx, &state->orig);
5405         }
5406
5407         /* make a temporary copy, that we pass to the dispatch function */
5408         state->tmp = state->orig;
5409
5410         subreq = cli->dispatch_send(state, ev, cli,
5411                                     &ndr_table_winreg,
5412                                     NDR_WINREG_SAVEKEYEX,
5413                                     &state->tmp);
5414         if (tevent_req_nomem(subreq, req)) {
5415                 return tevent_req_post(req, ev);
5416         }
5417         tevent_req_set_callback(subreq, rpccli_winreg_SaveKeyEx_done, req);
5418         return req;
5419 }
5420
5421 static void rpccli_winreg_SaveKeyEx_done(struct tevent_req *subreq)
5422 {
5423         struct tevent_req *req = tevent_req_callback_data(
5424                 subreq, struct tevent_req);
5425         struct rpccli_winreg_SaveKeyEx_state *state = tevent_req_data(
5426                 req, struct rpccli_winreg_SaveKeyEx_state);
5427         NTSTATUS status;
5428         TALLOC_CTX *mem_ctx;
5429
5430         if (state->out_mem_ctx) {
5431                 mem_ctx = state->out_mem_ctx;
5432         } else {
5433                 mem_ctx = state;
5434         }
5435
5436         status = state->dispatch_recv(subreq, mem_ctx);
5437         TALLOC_FREE(subreq);
5438         if (!NT_STATUS_IS_OK(status)) {
5439                 tevent_req_nterror(req, status);
5440                 return;
5441         }
5442
5443         /* Copy out parameters */
5444
5445         /* Copy result */
5446         state->orig.out.result = state->tmp.out.result;
5447
5448         /* Reset temporary structure */
5449         ZERO_STRUCT(state->tmp);
5450
5451         if (DEBUGLEVEL >= 10) {
5452                 NDR_PRINT_OUT_DEBUG(winreg_SaveKeyEx, &state->orig);
5453         }
5454
5455         tevent_req_done(req);
5456 }
5457
5458 NTSTATUS rpccli_winreg_SaveKeyEx_recv(struct tevent_req *req,
5459                                       TALLOC_CTX *mem_ctx,
5460                                       WERROR *result)
5461 {
5462         struct rpccli_winreg_SaveKeyEx_state *state = tevent_req_data(
5463                 req, struct rpccli_winreg_SaveKeyEx_state);
5464         NTSTATUS status;
5465
5466         if (tevent_req_is_nterror(req, &status)) {
5467                 tevent_req_received(req);
5468                 return status;
5469         }
5470
5471         /* Steal possbile out parameters to the callers context */
5472         talloc_steal(mem_ctx, state->out_mem_ctx);
5473
5474         /* Return result */
5475         *result = state->orig.out.result;
5476
5477         tevent_req_received(req);
5478         return NT_STATUS_OK;
5479 }
5480
5481 NTSTATUS rpccli_winreg_SaveKeyEx(struct rpc_pipe_client *cli,
5482                                  TALLOC_CTX *mem_ctx,
5483                                  WERROR *werror)
5484 {
5485         struct winreg_SaveKeyEx r;
5486         NTSTATUS status;
5487
5488         /* In parameters */
5489
5490         if (DEBUGLEVEL >= 10) {
5491                 NDR_PRINT_IN_DEBUG(winreg_SaveKeyEx, &r);
5492         }
5493
5494         status = cli->dispatch(cli,
5495                                 mem_ctx,
5496                                 &ndr_table_winreg,
5497                                 NDR_WINREG_SAVEKEYEX,
5498                                 &r);
5499
5500         if (!NT_STATUS_IS_OK(status)) {
5501                 return status;
5502         }
5503
5504         if (DEBUGLEVEL >= 10) {
5505                 NDR_PRINT_OUT_DEBUG(winreg_SaveKeyEx, &r);
5506         }
5507
5508         if (NT_STATUS_IS_ERR(status)) {
5509                 return status;
5510         }
5511
5512         /* Return variables */
5513
5514         /* Return result */
5515         if (werror) {
5516                 *werror = r.out.result;
5517         }
5518
5519         return werror_to_ntstatus(r.out.result);
5520 }
5521
5522 struct rpccli_winreg_OpenHKPT_state {
5523         struct winreg_OpenHKPT orig;
5524         struct winreg_OpenHKPT tmp;
5525         TALLOC_CTX *out_mem_ctx;
5526         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
5527 };
5528
5529 static void rpccli_winreg_OpenHKPT_done(struct tevent_req *subreq);
5530
5531 struct tevent_req *rpccli_winreg_OpenHKPT_send(TALLOC_CTX *mem_ctx,
5532                                                struct tevent_context *ev,
5533                                                struct rpc_pipe_client *cli,
5534                                                uint16_t *_system_name /* [in] [unique] */,
5535                                                uint32_t _access_mask /* [in]  */,
5536                                                struct policy_handle *_handle /* [out] [ref] */)
5537 {
5538         struct tevent_req *req;
5539         struct rpccli_winreg_OpenHKPT_state *state;
5540         struct tevent_req *subreq;
5541
5542         req = tevent_req_create(mem_ctx, &state,
5543                                 struct rpccli_winreg_OpenHKPT_state);
5544         if (req == NULL) {
5545                 return NULL;
5546         }
5547         state->out_mem_ctx = NULL;
5548         state->dispatch_recv = cli->dispatch_recv;
5549
5550         /* In parameters */
5551         state->orig.in.system_name = _system_name;
5552         state->orig.in.access_mask = _access_mask;
5553
5554         /* Out parameters */
5555         state->orig.out.handle = _handle;
5556
5557         /* Result */
5558         ZERO_STRUCT(state->orig.out.result);
5559
5560         if (DEBUGLEVEL >= 10) {
5561                 NDR_PRINT_IN_DEBUG(winreg_OpenHKPT, &state->orig);
5562         }
5563
5564         state->out_mem_ctx = talloc_named_const(state, 0,
5565                              "rpccli_winreg_OpenHKPT_out_memory");
5566         if (tevent_req_nomem(state->out_mem_ctx, req)) {
5567                 return tevent_req_post(req, ev);
5568         }
5569
5570         /* make a temporary copy, that we pass to the dispatch function */
5571         state->tmp = state->orig;
5572
5573         subreq = cli->dispatch_send(state, ev, cli,
5574                                     &ndr_table_winreg,
5575                                     NDR_WINREG_OPENHKPT,
5576                                     &state->tmp);
5577         if (tevent_req_nomem(subreq, req)) {
5578                 return tevent_req_post(req, ev);
5579         }
5580         tevent_req_set_callback(subreq, rpccli_winreg_OpenHKPT_done, req);
5581         return req;
5582 }
5583
5584 static void rpccli_winreg_OpenHKPT_done(struct tevent_req *subreq)
5585 {
5586         struct tevent_req *req = tevent_req_callback_data(
5587                 subreq, struct tevent_req);
5588         struct rpccli_winreg_OpenHKPT_state *state = tevent_req_data(
5589                 req, struct rpccli_winreg_OpenHKPT_state);
5590         NTSTATUS status;
5591         TALLOC_CTX *mem_ctx;
5592
5593         if (state->out_mem_ctx) {
5594                 mem_ctx = state->out_mem_ctx;
5595         } else {
5596                 mem_ctx = state;
5597         }
5598
5599         status = state->dispatch_recv(subreq, mem_ctx);
5600         TALLOC_FREE(subreq);
5601         if (!NT_STATUS_IS_OK(status)) {
5602                 tevent_req_nterror(req, status);
5603                 return;
5604         }
5605
5606         /* Copy out parameters */
5607         *state->orig.out.handle = *state->tmp.out.handle;
5608
5609         /* Copy result */
5610         state->orig.out.result = state->tmp.out.result;
5611
5612         /* Reset temporary structure */
5613         ZERO_STRUCT(state->tmp);
5614
5615         if (DEBUGLEVEL >= 10) {
5616                 NDR_PRINT_OUT_DEBUG(winreg_OpenHKPT, &state->orig);
5617         }
5618
5619         tevent_req_done(req);
5620 }
5621
5622 NTSTATUS rpccli_winreg_OpenHKPT_recv(struct tevent_req *req,
5623                                      TALLOC_CTX *mem_ctx,
5624                                      WERROR *result)
5625 {
5626         struct rpccli_winreg_OpenHKPT_state *state = tevent_req_data(
5627                 req, struct rpccli_winreg_OpenHKPT_state);
5628         NTSTATUS status;
5629
5630         if (tevent_req_is_nterror(req, &status)) {
5631                 tevent_req_received(req);
5632                 return status;
5633         }
5634
5635         /* Steal possbile out parameters to the callers context */
5636         talloc_steal(mem_ctx, state->out_mem_ctx);
5637
5638         /* Return result */
5639         *result = state->orig.out.result;
5640
5641         tevent_req_received(req);
5642         return NT_STATUS_OK;
5643 }
5644
5645 NTSTATUS rpccli_winreg_OpenHKPT(struct rpc_pipe_client *cli,
5646                                 TALLOC_CTX *mem_ctx,
5647                                 uint16_t *system_name /* [in] [unique] */,
5648                                 uint32_t access_mask /* [in]  */,
5649                                 struct policy_handle *handle /* [out] [ref] */,
5650                                 WERROR *werror)
5651 {
5652         struct winreg_OpenHKPT r;
5653         NTSTATUS status;
5654
5655         /* In parameters */
5656         r.in.system_name = system_name;
5657         r.in.access_mask = access_mask;
5658
5659         if (DEBUGLEVEL >= 10) {
5660                 NDR_PRINT_IN_DEBUG(winreg_OpenHKPT, &r);
5661         }
5662
5663         status = cli->dispatch(cli,
5664                                 mem_ctx,
5665                                 &ndr_table_winreg,
5666                                 NDR_WINREG_OPENHKPT,
5667                                 &r);
5668
5669         if (!NT_STATUS_IS_OK(status)) {
5670                 return status;
5671         }
5672
5673         if (DEBUGLEVEL >= 10) {
5674                 NDR_PRINT_OUT_DEBUG(winreg_OpenHKPT, &r);
5675         }
5676
5677         if (NT_STATUS_IS_ERR(status)) {
5678                 return status;
5679         }
5680
5681         /* Return variables */
5682         *handle = *r.out.handle;
5683
5684         /* Return result */
5685         if (werror) {
5686                 *werror = r.out.result;
5687         }
5688
5689         return werror_to_ntstatus(r.out.result);
5690 }
5691
5692 struct rpccli_winreg_OpenHKPN_state {
5693         struct winreg_OpenHKPN orig;
5694         struct winreg_OpenHKPN tmp;
5695         TALLOC_CTX *out_mem_ctx;
5696         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
5697 };
5698
5699 static void rpccli_winreg_OpenHKPN_done(struct tevent_req *subreq);
5700
5701 struct tevent_req *rpccli_winreg_OpenHKPN_send(TALLOC_CTX *mem_ctx,
5702                                                struct tevent_context *ev,
5703                                                struct rpc_pipe_client *cli,
5704                                                uint16_t *_system_name /* [in] [unique] */,
5705                                                uint32_t _access_mask /* [in]  */,
5706                                                struct policy_handle *_handle /* [out] [ref] */)
5707 {
5708         struct tevent_req *req;
5709         struct rpccli_winreg_OpenHKPN_state *state;
5710         struct tevent_req *subreq;
5711
5712         req = tevent_req_create(mem_ctx, &state,
5713                                 struct rpccli_winreg_OpenHKPN_state);
5714         if (req == NULL) {
5715                 return NULL;
5716         }
5717         state->out_mem_ctx = NULL;
5718         state->dispatch_recv = cli->dispatch_recv;
5719
5720         /* In parameters */
5721         state->orig.in.system_name = _system_name;
5722         state->orig.in.access_mask = _access_mask;
5723
5724         /* Out parameters */
5725         state->orig.out.handle = _handle;
5726
5727         /* Result */
5728         ZERO_STRUCT(state->orig.out.result);
5729
5730         if (DEBUGLEVEL >= 10) {
5731                 NDR_PRINT_IN_DEBUG(winreg_OpenHKPN, &state->orig);
5732         }
5733
5734         state->out_mem_ctx = talloc_named_const(state, 0,
5735                              "rpccli_winreg_OpenHKPN_out_memory");
5736         if (tevent_req_nomem(state->out_mem_ctx, req)) {
5737                 return tevent_req_post(req, ev);
5738         }
5739
5740         /* make a temporary copy, that we pass to the dispatch function */
5741         state->tmp = state->orig;
5742
5743         subreq = cli->dispatch_send(state, ev, cli,
5744                                     &ndr_table_winreg,
5745                                     NDR_WINREG_OPENHKPN,
5746                                     &state->tmp);
5747         if (tevent_req_nomem(subreq, req)) {
5748                 return tevent_req_post(req, ev);
5749         }
5750         tevent_req_set_callback(subreq, rpccli_winreg_OpenHKPN_done, req);
5751         return req;
5752 }
5753
5754 static void rpccli_winreg_OpenHKPN_done(struct tevent_req *subreq)
5755 {
5756         struct tevent_req *req = tevent_req_callback_data(
5757                 subreq, struct tevent_req);
5758         struct rpccli_winreg_OpenHKPN_state *state = tevent_req_data(
5759                 req, struct rpccli_winreg_OpenHKPN_state);
5760         NTSTATUS status;
5761         TALLOC_CTX *mem_ctx;
5762
5763         if (state->out_mem_ctx) {
5764                 mem_ctx = state->out_mem_ctx;
5765         } else {
5766                 mem_ctx = state;
5767         }
5768
5769         status = state->dispatch_recv(subreq, mem_ctx);
5770         TALLOC_FREE(subreq);
5771         if (!NT_STATUS_IS_OK(status)) {
5772                 tevent_req_nterror(req, status);
5773                 return;
5774         }
5775
5776         /* Copy out parameters */
5777         *state->orig.out.handle = *state->tmp.out.handle;
5778
5779         /* Copy result */
5780         state->orig.out.result = state->tmp.out.result;
5781
5782         /* Reset temporary structure */
5783         ZERO_STRUCT(state->tmp);
5784
5785         if (DEBUGLEVEL >= 10) {
5786                 NDR_PRINT_OUT_DEBUG(winreg_OpenHKPN, &state->orig);
5787         }
5788
5789         tevent_req_done(req);
5790 }
5791
5792 NTSTATUS rpccli_winreg_OpenHKPN_recv(struct tevent_req *req,
5793                                      TALLOC_CTX *mem_ctx,
5794                                      WERROR *result)
5795 {
5796         struct rpccli_winreg_OpenHKPN_state *state = tevent_req_data(
5797                 req, struct rpccli_winreg_OpenHKPN_state);
5798         NTSTATUS status;
5799
5800         if (tevent_req_is_nterror(req, &status)) {
5801                 tevent_req_received(req);
5802                 return status;
5803         }
5804
5805         /* Steal possbile out parameters to the callers context */
5806         talloc_steal(mem_ctx, state->out_mem_ctx);
5807
5808         /* Return result */
5809         *result = state->orig.out.result;
5810
5811         tevent_req_received(req);
5812         return NT_STATUS_OK;
5813 }
5814
5815 NTSTATUS rpccli_winreg_OpenHKPN(struct rpc_pipe_client *cli,
5816                                 TALLOC_CTX *mem_ctx,
5817                                 uint16_t *system_name /* [in] [unique] */,
5818                                 uint32_t access_mask /* [in]  */,
5819                                 struct policy_handle *handle /* [out] [ref] */,
5820                                 WERROR *werror)
5821 {
5822         struct winreg_OpenHKPN r;
5823         NTSTATUS status;
5824
5825         /* In parameters */
5826         r.in.system_name = system_name;
5827         r.in.access_mask = access_mask;
5828
5829         if (DEBUGLEVEL >= 10) {
5830                 NDR_PRINT_IN_DEBUG(winreg_OpenHKPN, &r);
5831         }
5832
5833         status = cli->dispatch(cli,
5834                                 mem_ctx,
5835                                 &ndr_table_winreg,
5836                                 NDR_WINREG_OPENHKPN,
5837                                 &r);
5838
5839         if (!NT_STATUS_IS_OK(status)) {
5840                 return status;
5841         }
5842
5843         if (DEBUGLEVEL >= 10) {
5844                 NDR_PRINT_OUT_DEBUG(winreg_OpenHKPN, &r);
5845         }
5846
5847         if (NT_STATUS_IS_ERR(status)) {
5848                 return status;
5849         }
5850
5851         /* Return variables */
5852         *handle = *r.out.handle;
5853
5854         /* Return result */
5855         if (werror) {
5856                 *werror = r.out.result;
5857         }
5858
5859         return werror_to_ntstatus(r.out.result);
5860 }
5861
5862 struct rpccli_winreg_QueryMultipleValues2_state {
5863         struct winreg_QueryMultipleValues2 orig;
5864         struct winreg_QueryMultipleValues2 tmp;
5865         TALLOC_CTX *out_mem_ctx;
5866         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
5867 };
5868
5869 static void rpccli_winreg_QueryMultipleValues2_done(struct tevent_req *subreq);
5870
5871 struct tevent_req *rpccli_winreg_QueryMultipleValues2_send(TALLOC_CTX *mem_ctx,
5872                                                            struct tevent_context *ev,
5873                                                            struct rpc_pipe_client *cli)
5874 {
5875         struct tevent_req *req;
5876         struct rpccli_winreg_QueryMultipleValues2_state *state;
5877         struct tevent_req *subreq;
5878
5879         req = tevent_req_create(mem_ctx, &state,
5880                                 struct rpccli_winreg_QueryMultipleValues2_state);
5881         if (req == NULL) {
5882                 return NULL;
5883         }
5884         state->out_mem_ctx = NULL;
5885         state->dispatch_recv = cli->dispatch_recv;
5886
5887         /* In parameters */
5888
5889         /* Out parameters */
5890
5891         /* Result */
5892         ZERO_STRUCT(state->orig.out.result);
5893
5894         if (DEBUGLEVEL >= 10) {
5895                 NDR_PRINT_IN_DEBUG(winreg_QueryMultipleValues2, &state->orig);
5896         }
5897
5898         /* make a temporary copy, that we pass to the dispatch function */
5899         state->tmp = state->orig;
5900
5901         subreq = cli->dispatch_send(state, ev, cli,
5902                                     &ndr_table_winreg,
5903                                     NDR_WINREG_QUERYMULTIPLEVALUES2,
5904                                     &state->tmp);
5905         if (tevent_req_nomem(subreq, req)) {
5906                 return tevent_req_post(req, ev);
5907         }
5908         tevent_req_set_callback(subreq, rpccli_winreg_QueryMultipleValues2_done, req);
5909         return req;
5910 }
5911
5912 static void rpccli_winreg_QueryMultipleValues2_done(struct tevent_req *subreq)
5913 {
5914         struct tevent_req *req = tevent_req_callback_data(
5915                 subreq, struct tevent_req);
5916         struct rpccli_winreg_QueryMultipleValues2_state *state = tevent_req_data(
5917                 req, struct rpccli_winreg_QueryMultipleValues2_state);
5918         NTSTATUS status;
5919         TALLOC_CTX *mem_ctx;
5920
5921         if (state->out_mem_ctx) {
5922                 mem_ctx = state->out_mem_ctx;
5923         } else {
5924                 mem_ctx = state;
5925         }
5926
5927         status = state->dispatch_recv(subreq, mem_ctx);
5928         TALLOC_FREE(subreq);
5929         if (!NT_STATUS_IS_OK(status)) {
5930                 tevent_req_nterror(req, status);
5931                 return;
5932         }
5933
5934         /* Copy out parameters */
5935
5936         /* Copy result */
5937         state->orig.out.result = state->tmp.out.result;
5938
5939         /* Reset temporary structure */
5940         ZERO_STRUCT(state->tmp);
5941
5942         if (DEBUGLEVEL >= 10) {
5943                 NDR_PRINT_OUT_DEBUG(winreg_QueryMultipleValues2, &state->orig);
5944         }
5945
5946         tevent_req_done(req);
5947 }
5948
5949 NTSTATUS rpccli_winreg_QueryMultipleValues2_recv(struct tevent_req *req,
5950                                                  TALLOC_CTX *mem_ctx,
5951                                                  WERROR *result)
5952 {
5953         struct rpccli_winreg_QueryMultipleValues2_state *state = tevent_req_data(
5954                 req, struct rpccli_winreg_QueryMultipleValues2_state);
5955         NTSTATUS status;
5956
5957         if (tevent_req_is_nterror(req, &status)) {
5958                 tevent_req_received(req);
5959                 return status;
5960         }
5961
5962         /* Steal possbile out parameters to the callers context */
5963         talloc_steal(mem_ctx, state->out_mem_ctx);
5964
5965         /* Return result */
5966         *result = state->orig.out.result;
5967
5968         tevent_req_received(req);
5969         return NT_STATUS_OK;
5970 }
5971
5972 NTSTATUS rpccli_winreg_QueryMultipleValues2(struct rpc_pipe_client *cli,
5973                                             TALLOC_CTX *mem_ctx,
5974                                             WERROR *werror)
5975 {
5976         struct winreg_QueryMultipleValues2 r;
5977         NTSTATUS status;
5978
5979         /* In parameters */
5980
5981         if (DEBUGLEVEL >= 10) {
5982                 NDR_PRINT_IN_DEBUG(winreg_QueryMultipleValues2, &r);
5983         }
5984
5985         status = cli->dispatch(cli,
5986                                 mem_ctx,
5987                                 &ndr_table_winreg,
5988                                 NDR_WINREG_QUERYMULTIPLEVALUES2,
5989                                 &r);
5990
5991         if (!NT_STATUS_IS_OK(status)) {
5992                 return status;
5993         }
5994
5995         if (DEBUGLEVEL >= 10) {
5996                 NDR_PRINT_OUT_DEBUG(winreg_QueryMultipleValues2, &r);
5997         }
5998
5999         if (NT_STATUS_IS_ERR(status)) {
6000                 return status;
6001         }
6002
6003         /* Return variables */
6004
6005         /* Return result */
6006         if (werror) {
6007                 *werror = r.out.result;
6008         }
6009
6010         return werror_to_ntstatus(r.out.result);
6011 }
6012