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