added the following message to all dce/rpc client/server code, except
[vlendec/samba-autobuild/.git] / source3 / rpc_parse / parse_reg.c
1
2 /*
3  * THIS CODE IS OUT-OF-DATE BY TWO YEARS, IS LEGACY DESIGN AND VERY, VERY,
4  * INCOMPLETE.  PLEASE DO NOT MAKE ANY FURTHER ENHANCEMENTS TO THIS CODE
5  * UNLESS THEY ARE ALSO CARRIED OUT IN THE SAMBA_TNG BRANCH.
6  *
7  * PLEASE DO NOT TREAT THIS CODE AS AUTHORITATIVE IN *ANY* WAY.
8  *
9  * REPEAT, PLEASE DO NOT MAKE ANY MODIFICATIONS TO THIS CODE WITHOUT
10  * FIRST CHECKING THE EQUIVALENT MODULE IN SAMBA_TNG, UPDATING THAT
11  * FIRST, *THEN* CONSIDER MAKING THE SAME MODIFICATION IN THIS BRANCH
12  *
13  * YOU WILL, ALMOST GUARANTEED, FIND THAT THE BUG-FIX OR ENHANCEMENT THAT
14  * YOU THINK IS NECESSARY, HAS ALREADY BEEN IMPLEMENTED IN SAMBA_TNG.
15  * IF IT HAS NOT, YOUR BUG-FIX OR ENHANCEMENT *MUST* GO INTO SAMBA_TNG
16  * AS THE SAMBA_TNG CODE WILL REPLACE THIS MODULE WITHOUT REFERENCE TO
17  * ANYTHING IN IT, WITH THE POSSIBLE RISK THAT THE BUG-FIX OR ENHANCEMENT
18  * MAY BE LOST.
19  *
20  * PLEASE OBSERVE AND RESPECT THIS SIMPLE REQUEST.
21  *
22  * THANK YOU.
23  *
24  * lkcl@samba.org
25  */
26
27 /* 
28  *  Unix SMB/Netbios implementation.
29  *  Version 1.9.
30  *  RPC Pipe client / server routines
31  *  Copyright (C) Andrew Tridgell              1992-1997,
32  *  Copyright (C) Luke Kenneth Casson Leighton 1996-1997,
33  *  Copyright (C) Paul Ashton                       1997.
34  *  Copyright (C) Hewlett-Packard Company           1999.
35  *  
36  *  This program is free software; you can redistribute it and/or modify
37  *  it under the terms of the GNU General Public License as published by
38  *  the Free Software Foundation; either version 2 of the License, or
39  *  (at your option) any later version.
40  *  
41  *  This program is distributed in the hope that it will be useful,
42  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
43  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
44  *  GNU General Public License for more details.
45  *  
46  *  You should have received a copy of the GNU General Public License
47  *  along with this program; if not, write to the Free Software
48  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
49  */
50
51
52 #include "includes.h"
53
54 extern int DEBUGLEVEL;
55
56
57 /*******************************************************************
58  Inits a structure.
59 ********************************************************************/
60
61 void init_reg_q_open_hklm(REG_Q_OPEN_HKLM *q_o,
62                                 uint16 unknown_0, uint32 level)
63 {
64         q_o->ptr = 1;
65         q_o->unknown_0 = unknown_0;
66         q_o->unknown_1 = 0x0; /* random - changes */
67         q_o->level = level;
68 }
69
70 /*******************************************************************
71 reads or writes a structure.
72 ********************************************************************/
73
74 BOOL reg_io_q_open_hklm(char *desc,  REG_Q_OPEN_HKLM *r_q, prs_struct *ps, int depth)
75 {
76         if (r_q == NULL)
77                 return False;
78
79         prs_debug(ps, depth, desc, "reg_io_q_open_hklm");
80         depth++;
81
82         if(!prs_align(ps))
83                 return False;
84
85         if(!prs_uint32("ptr      ", ps, depth, &r_q->ptr))
86                 return False;
87
88         if (r_q->ptr != 0) {
89                 if(!prs_uint16("unknown_0", ps, depth, &r_q->unknown_0))
90                         return False;
91                 if(!prs_uint16("unknown_1", ps, depth, &r_q->unknown_1))
92                         return False;
93                 if(!prs_uint32("level    ", ps, depth, &r_q->level))
94                         return False;
95         }
96
97         return True;
98 }
99
100
101 /*******************************************************************
102 reads or writes a structure.
103 ********************************************************************/
104
105 BOOL reg_io_r_open_hklm(char *desc,  REG_R_OPEN_HKLM *r_r, prs_struct *ps, int depth)
106 {
107         if (r_r == NULL)
108                 return False;
109
110         prs_debug(ps, depth, desc, "reg_io_r_open_hklm");
111         depth++;
112
113         if(!prs_align(ps))
114                 return False;
115         
116         if(!smb_io_pol_hnd("", &r_r->pol, ps, depth))
117                 return False;
118
119         if(!prs_uint32("status", ps, depth, &r_r->status))
120                 return False;
121
122         return True;
123 }
124
125
126 /*******************************************************************
127  Inits a structure.
128 ********************************************************************/
129
130 void init_reg_q_flush_key(REG_Q_FLUSH_KEY *q_u, POLICY_HND *pol)
131 {
132         memcpy(&q_u->pol, pol, sizeof(q_u->pol));
133 }
134
135 /*******************************************************************
136 reads or writes a structure.
137 ********************************************************************/
138
139 BOOL reg_io_q_flush_key(char *desc,  REG_Q_FLUSH_KEY *r_q, prs_struct *ps, int depth)
140 {
141         if (r_q == NULL)
142                 return False;
143
144         prs_debug(ps, depth, desc, "reg_io_q_flush_key");
145         depth++;
146
147         if(!prs_align(ps))
148                 return False;
149         
150         if(!smb_io_pol_hnd("", &r_q->pol, ps, depth))
151                 return False;
152
153         return True;
154 }
155
156 /*******************************************************************
157 reads or writes a structure.
158 ********************************************************************/
159
160 BOOL reg_io_r_flush_key(char *desc,  REG_R_FLUSH_KEY *r_r, prs_struct *ps, int depth)
161 {
162         if (r_r == NULL)
163                 return False;
164
165         prs_debug(ps, depth, desc, "reg_io_r_flush_key");
166         depth++;
167
168         if(!prs_align(ps))
169                 return False;
170         
171         if(!prs_uint32("status", ps, depth, &r_r->status))
172                 return False;
173
174         return True;
175 }
176
177 /*******************************************************************
178 reads or writes SEC_DESC_BUF and SEC_DATA structures.
179 ********************************************************************/
180
181 static BOOL reg_io_hdrbuf_sec(uint32 ptr, uint32 *ptr3, BUFHDR *hdr_sec, SEC_DESC_BUF *data, prs_struct *ps, int depth)
182 {
183         if (ptr != 0) {
184                 uint32 hdr_offset;
185                 uint32 old_offset;
186                 if(!smb_io_hdrbuf_pre("hdr_sec", hdr_sec, ps, depth, &hdr_offset))
187                         return False;
188
189                 old_offset = prs_offset(ps);
190
191                 if (ptr3 != NULL) {
192                         if(!prs_uint32("ptr3", ps, depth, ptr3))
193                                 return False;
194                 }
195
196                 if (ptr3 == NULL || *ptr3 != 0) {
197                         if(!sec_io_desc_buf("data   ", &data, ps, depth)) /* JRA - this line is probably wrong... */
198                                 return False;
199                 }
200
201                 if(!smb_io_hdrbuf_post("hdr_sec", hdr_sec, ps, depth, hdr_offset,
202                                    data->max_len, data->len))
203                                 return False;
204                 if(!prs_set_offset(ps, old_offset + data->len + sizeof(uint32) * ((ptr3 != NULL) ? 5 : 3)))
205                         return False;
206
207                 if(!prs_align(ps))
208                         return False;
209         }
210
211         return True;
212 }
213
214 /*******************************************************************
215  Inits a structure.
216 ********************************************************************/
217
218 void init_reg_q_create_key(REG_Q_CREATE_KEY *q_c, POLICY_HND *hnd,
219                                 char *name, char *class, SEC_ACCESS *sam_access,
220                                 SEC_DESC_BUF *sec_buf)
221 {
222         int len_name  = name  != NULL ? strlen(name ) + 1: 0;
223         int len_class = class != NULL ? strlen(class) + 1: 0;
224
225         ZERO_STRUCTP(q_c);
226
227         memcpy(&q_c->pnt_pol, hnd, sizeof(q_c->pnt_pol));
228
229         init_uni_hdr(&q_c->hdr_name, len_name);
230         init_unistr2(&q_c->uni_name, name, len_name);
231
232         init_uni_hdr(&q_c->hdr_class, len_class);
233         init_unistr2(&q_c->uni_class, class, len_class);
234
235         q_c->reserved = 0x00000000;
236         memcpy(&q_c->sam_access, sam_access, sizeof(q_c->sam_access));
237
238         q_c->ptr1 = 1;
239         q_c->sec_info = DACL_SECURITY_INFORMATION | SACL_SECURITY_INFORMATION;
240
241         q_c->data = sec_buf;
242         q_c->ptr2 = 1;
243         init_buf_hdr(&q_c->hdr_sec, sec_buf->len, sec_buf->len);
244         q_c->ptr3 = 1;
245         q_c->unknown_2 = 0x00000000;
246 }
247
248 /*******************************************************************
249 reads or writes a structure.
250 ********************************************************************/
251
252 BOOL reg_io_q_create_key(char *desc,  REG_Q_CREATE_KEY *r_q, prs_struct *ps, int depth)
253 {
254         if (r_q == NULL)
255                 return False;
256
257         prs_debug(ps, depth, desc, "reg_io_q_create_key");
258         depth++;
259
260         if(!prs_align(ps))
261                 return False;
262         
263         if(!smb_io_pol_hnd("", &r_q->pnt_pol, ps, depth))
264                 return False;
265
266         if(!smb_io_unihdr ("", &r_q->hdr_name, ps, depth))
267                 return False;
268         if(!smb_io_unistr2("", &r_q->uni_name, r_q->hdr_name.buffer, ps, depth))
269                 return False;
270         if(!prs_align(ps))
271                 return False;
272
273         if(!smb_io_unihdr ("", &r_q->hdr_class, ps, depth))
274                 return False;
275         if(!smb_io_unistr2("", &r_q->uni_class, r_q->hdr_class.buffer, ps, depth))
276                 return False;
277         if(!prs_align(ps))
278                 return False;
279
280         if(!prs_uint32("reserved", ps, depth, &r_q->reserved))
281                 return False;
282         if(!sec_io_access("sam_access", &r_q->sam_access, ps, depth))
283                 return False;
284
285         if(!prs_uint32("ptr1", ps, depth, &r_q->ptr1))
286                 return False;
287
288         if (r_q->ptr1 != 0) {
289                 if(!prs_uint32("sec_info", ps, depth, &r_q->sec_info))
290                         return False;
291         }
292
293         if(!prs_uint32("ptr2", ps, depth, &r_q->ptr2))
294                 return False;
295         if(!reg_io_hdrbuf_sec(r_q->ptr2, &r_q->ptr3, &r_q->hdr_sec, r_q->data, ps, depth))
296                 return False;
297
298         if(!prs_uint32("unknown_2", ps, depth, &r_q->unknown_2))
299                 return False;
300
301         return True;
302 }
303
304 /*******************************************************************
305 reads or writes a structure.
306 ********************************************************************/
307
308 BOOL reg_io_r_create_key(char *desc,  REG_R_CREATE_KEY *r_r, prs_struct *ps, int depth)
309 {
310         if (r_r == NULL)
311                 return False;
312
313         prs_debug(ps, depth, desc, "reg_io_r_create_key");
314         depth++;
315
316         if(!prs_align(ps))
317                 return False;
318         
319         if(!smb_io_pol_hnd("", &r_r->key_pol, ps, depth))
320                 return False;
321         if(!prs_uint32("unknown", ps, depth, &r_r->unknown))
322                 return False;
323
324         if(!prs_uint32("status", ps, depth, &r_r->status))
325                 return False;
326
327         return True;
328 }
329
330
331 /*******************************************************************
332  Inits a structure.
333 ********************************************************************/
334
335 void init_reg_q_delete_val(REG_Q_DELETE_VALUE *q_c, POLICY_HND *hnd,
336                                 char *name)
337 {
338         int len_name  = name  != NULL ? strlen(name ) + 1: 0;
339         ZERO_STRUCTP(q_c);
340
341         memcpy(&q_c->pnt_pol, hnd, sizeof(q_c->pnt_pol));
342
343         init_uni_hdr(&q_c->hdr_name, len_name);
344         init_unistr2(&q_c->uni_name, name, len_name);
345 }
346
347 /*******************************************************************
348 reads or writes a structure.
349 ********************************************************************/
350
351 BOOL reg_io_q_delete_val(char *desc,  REG_Q_DELETE_VALUE *r_q, prs_struct *ps, int depth)
352 {
353         if (r_q == NULL)
354                 return False;
355
356         prs_debug(ps, depth, desc, "reg_io_q_delete_val");
357         depth++;
358
359         if(!prs_align(ps))
360                 return False;
361         
362         if(!smb_io_pol_hnd("", &r_q->pnt_pol, ps, depth))
363                 return False;
364
365         if(!smb_io_unihdr ("", &r_q->hdr_name, ps, depth))
366                 return False;
367         if(!smb_io_unistr2("", &r_q->uni_name, r_q->hdr_name.buffer, ps, depth))
368                 return False;
369         if(!prs_align(ps))
370                 return False;
371
372         return True;
373 }
374
375
376 /*******************************************************************
377 reads or writes a structure.
378 ********************************************************************/
379
380 BOOL reg_io_r_delete_val(char *desc,  REG_R_DELETE_VALUE *r_r, prs_struct *ps, int depth)
381 {
382         if (r_r == NULL)
383                 return False;
384
385         prs_debug(ps, depth, desc, "reg_io_r_delete_val");
386         depth++;
387
388         if(!prs_align(ps))
389                 return False;
390         
391         if(!prs_uint32("status", ps, depth, &r_r->status))
392                 return False;
393
394         return True;
395 }
396
397 /*******************************************************************
398  Inits a structure.
399 ********************************************************************/
400
401 void init_reg_q_delete_key(REG_Q_DELETE_KEY *q_c, POLICY_HND *hnd,
402                                 char *name)
403 {
404         int len_name  = name  != NULL ? strlen(name ) + 1: 0;
405         ZERO_STRUCTP(q_c);
406
407         memcpy(&q_c->pnt_pol, hnd, sizeof(q_c->pnt_pol));
408
409         init_uni_hdr(&q_c->hdr_name, len_name);
410         init_unistr2(&q_c->uni_name, name, len_name);
411 }
412
413 /*******************************************************************
414 reads or writes a structure.
415 ********************************************************************/
416
417 BOOL reg_io_q_delete_key(char *desc,  REG_Q_DELETE_KEY *r_q, prs_struct *ps, int depth)
418 {
419         if (r_q == NULL)
420                 return False;
421
422         prs_debug(ps, depth, desc, "reg_io_q_delete_key");
423         depth++;
424
425         if(!prs_align(ps))
426                 return False;
427         
428         if(!smb_io_pol_hnd("", &r_q->pnt_pol, ps, depth))
429                 return False;
430
431         if(!smb_io_unihdr ("", &r_q->hdr_name, ps, depth))
432                 return False;
433         if(!smb_io_unistr2("", &r_q->uni_name, r_q->hdr_name.buffer, ps, depth))
434                 return False;
435         if(!prs_align(ps))
436                 return False;
437
438         return True;
439 }
440
441 /*******************************************************************
442 reads or writes a structure.
443 ********************************************************************/
444
445 BOOL reg_io_r_delete_key(char *desc,  REG_R_DELETE_KEY *r_r, prs_struct *ps, int depth)
446 {
447         if (r_r == NULL)
448                 return False;
449
450         prs_debug(ps, depth, desc, "reg_io_r_delete_key");
451         depth++;
452
453         if(!prs_align(ps))
454                 return False;
455         
456         if(!prs_uint32("status", ps, depth, &r_r->status))
457                 return False;
458
459         return True;
460 }
461
462 /*******************************************************************
463  Inits a structure.
464 ********************************************************************/
465
466 void init_reg_q_query_key(REG_Q_QUERY_KEY *q_o, POLICY_HND *hnd,
467                                 uint32 max_class_len)
468 {
469         ZERO_STRUCTP(q_o);
470
471         memcpy(&q_o->pol, hnd, sizeof(q_o->pol));
472         init_uni_hdr(&q_o->hdr_class, max_class_len);
473         q_o->uni_class.uni_max_len = max_class_len;
474 }
475
476 /*******************************************************************
477 reads or writes a structure.
478 ********************************************************************/
479
480 BOOL reg_io_q_query_key(char *desc,  REG_Q_QUERY_KEY *r_q, prs_struct *ps, int depth)
481 {
482         if (r_q == NULL)
483                 return False;
484
485         prs_debug(ps, depth, desc, "reg_io_q_query_key");
486         depth++;
487
488         if(!prs_align(ps))
489                 return False;
490         
491         if(!smb_io_pol_hnd("", &r_q->pol, ps, depth))
492                 return False;
493         if(!smb_io_unihdr ("", &r_q->hdr_class, ps, depth))
494                 return False;
495         if(!smb_io_unistr2("", &r_q->uni_class, r_q->hdr_class.buffer, ps, depth))
496                 return False;
497
498         if(!prs_align(ps))
499                 return False;
500
501         return True;
502 }
503
504
505 /*******************************************************************
506 reads or writes a structure.
507 ********************************************************************/
508
509 BOOL reg_io_r_query_key(char *desc,  REG_R_QUERY_KEY *r_r, prs_struct *ps, int depth)
510 {
511         if (r_r == NULL)
512                 return False;
513
514         prs_debug(ps, depth, desc, "reg_io_r_query_key");
515         depth++;
516
517         if(!prs_align(ps))
518                 return False;
519         
520         if(!smb_io_unihdr ("", &r_r->hdr_class, ps, depth))
521                 return False;
522         if(!smb_io_unistr2("", &r_r->uni_class, r_r->hdr_class.buffer, ps, depth))
523                 return False;
524
525         if(!prs_align(ps))
526                 return False;
527
528         if(!prs_uint32("num_subkeys   ", ps, depth, &r_r->num_subkeys))
529                 return False;
530         if(!prs_uint32("max_subkeylen ", ps, depth, &r_r->max_subkeylen))
531                 return False;
532         if(!prs_uint32("mak_subkeysize", ps, depth, &r_r->max_subkeysize))
533                 return False;
534         if(!prs_uint32("num_values    ", ps, depth, &r_r->num_values))
535                 return False;
536         if(!prs_uint32("max_valnamelen", ps, depth, &r_r->max_valnamelen))
537                 return False;
538         if(!prs_uint32("max_valbufsize", ps, depth, &r_r->max_valbufsize))
539                 return False;
540         if(!prs_uint32("sec_desc      ", ps, depth, &r_r->sec_desc))
541                 return False;
542         if(!smb_io_time("mod_time     ", &r_r->mod_time, ps, depth))
543                 return False;
544         
545         if(!prs_uint32("status", ps, depth, &r_r->status))
546                 return False;
547
548         return True;
549 }
550
551 /*******************************************************************
552  Inits a structure.
553 ********************************************************************/
554
555 void init_reg_q_unk_1a(REG_Q_UNK_1A *q_o, POLICY_HND *hnd)
556 {
557         memcpy(&q_o->pol, hnd, sizeof(q_o->pol));
558 }
559
560 /*******************************************************************
561 reads or writes a structure.
562 ********************************************************************/
563
564 BOOL reg_io_q_unk_1a(char *desc,  REG_Q_UNK_1A *r_q, prs_struct *ps, int depth)
565 {
566         if (r_q == NULL)
567                 return False;
568
569         prs_debug(ps, depth, desc, "reg_io_q_unk_1a");
570         depth++;
571
572         if(!prs_align(ps))
573                 return False;
574         
575         if(!smb_io_pol_hnd("", &r_q->pol, ps, depth))
576                 return False;
577
578         return True;
579 }
580
581 /*******************************************************************
582 reads or writes a structure.
583 ********************************************************************/
584
585 BOOL reg_io_r_unk_1a(char *desc,  REG_R_UNK_1A *r_r, prs_struct *ps, int depth)
586 {
587         if (r_r == NULL)
588                 return False;
589
590         prs_debug(ps, depth, desc, "reg_io_r_unk_1a");
591         depth++;
592
593         if(!prs_align(ps))
594                 return False;
595         
596         if(!prs_uint32("unknown", ps, depth, &r_r->unknown))
597                 return False;
598         if(!prs_uint32("status" , ps, depth, &r_r->status))
599                 return False;
600
601         return True;
602 }
603
604 /*******************************************************************
605  Inits a structure.
606 ********************************************************************/
607
608 void init_reg_q_open_hku(REG_Q_OPEN_HKU *q_o,
609                                 uint16 unknown_0, uint32 level)
610 {
611         q_o->ptr = 1;
612         q_o->unknown_0 = unknown_0;
613         q_o->unknown_1 = 0x0; /* random - changes */
614         q_o->level = level;
615 }
616
617 /*******************************************************************
618 reads or writes a structure.
619 ********************************************************************/
620
621 BOOL reg_io_q_open_hku(char *desc,  REG_Q_OPEN_HKU *r_q, prs_struct *ps, int depth)
622 {
623         if (r_q == NULL)
624                 return False;
625
626         prs_debug(ps, depth, desc, "reg_io_q_open_hku");
627         depth++;
628
629         if(!prs_align(ps))
630                 return False;
631         
632         if(!prs_uint32("ptr      ", ps, depth, &r_q->ptr))
633                 return False;
634         if (r_q->ptr != 0) {
635                 if(!prs_uint16("unknown_0", ps, depth, &r_q->unknown_0))
636                         return False;
637                 if(!prs_uint16("unknown_1", ps, depth, &r_q->unknown_1))
638                         return False;
639                 if(!prs_uint32("level    ", ps, depth, &r_q->level))
640                         return False;
641         }
642
643         return True;
644 }
645
646 /*******************************************************************
647 reads or writes a structure.
648 ********************************************************************/
649
650 BOOL reg_io_r_open_hku(char *desc,  REG_R_OPEN_HKU *r_r, prs_struct *ps, int depth)
651 {
652         if (r_r == NULL)
653                 return False;
654
655         prs_debug(ps, depth, desc, "reg_io_r_open_hku");
656         depth++;
657
658         if(!prs_align(ps))
659                 return False;
660         
661         if(!smb_io_pol_hnd("", &r_r->pol, ps, depth))
662                 return False;
663
664         if(!prs_uint32("status", ps, depth, &r_r->status))
665                 return False;
666
667         return True;
668 }
669
670 /*******************************************************************
671  Inits an REG_Q_CLOSE structure.
672 ********************************************************************/
673
674 void init_reg_q_close(REG_Q_CLOSE *q_c, POLICY_HND *hnd)
675 {
676         DEBUG(5,("init_reg_q_close\n"));
677
678         memcpy(&q_c->pol, hnd, sizeof(q_c->pol));
679 }
680
681 /*******************************************************************
682 reads or writes a structure.
683 ********************************************************************/
684
685 BOOL reg_io_q_close(char *desc,  REG_Q_CLOSE *q_u, prs_struct *ps, int depth)
686 {
687         if (q_u == NULL)
688                 return False;
689
690         prs_debug(ps, depth, desc, "reg_io_q_unknown_1");
691         depth++;
692
693         if(!prs_align(ps))
694                 return False;
695
696         if(!smb_io_pol_hnd("", &q_u->pol, ps, depth))
697                 return False;
698         if(!prs_align(ps))
699                 return False;
700
701         return True;
702 }
703
704 /*******************************************************************
705 reads or writes a structure.
706 ********************************************************************/
707
708 BOOL reg_io_r_close(char *desc,  REG_R_CLOSE *r_u, prs_struct *ps, int depth)
709 {
710         if (r_u == NULL)
711                 return False;
712
713         prs_debug(ps, depth, desc, "reg_io_r_unknown_1");
714         depth++;
715
716         if(!prs_align(ps))
717                 return False;
718
719         if(!smb_io_pol_hnd("", &r_u->pol, ps, depth))
720                 return False;
721         if(!prs_align(ps))
722                 return False;
723
724         if(!prs_uint32("status", ps, depth, &r_u->status))
725                 return False;
726
727         return True;
728 }
729
730 /*******************************************************************
731 makes a structure.
732 ********************************************************************/
733
734 void init_reg_q_set_key_sec(REG_Q_SET_KEY_SEC *q_i, POLICY_HND *pol, SEC_DESC_BUF *sec_desc_buf)
735 {
736         memcpy(&q_i->pol, pol, sizeof(q_i->pol));
737
738         q_i->sec_info = DACL_SECURITY_INFORMATION;
739
740         q_i->ptr = 1;
741         init_buf_hdr(&q_i->hdr_sec, sec_desc_buf->len, sec_desc_buf->len);
742         q_i->data = sec_desc_buf;
743 }
744
745 /*******************************************************************
746 reads or writes a structure.
747 ********************************************************************/
748
749 BOOL reg_io_q_set_key_sec(char *desc,  REG_Q_SET_KEY_SEC *r_q, prs_struct *ps, int depth)
750 {
751         if (r_q == NULL)
752                 return False;
753
754         prs_debug(ps, depth, desc, "reg_io_q_set_key_sec");
755         depth++;
756
757         if(!prs_align(ps))
758                 return False;
759         
760         if(!smb_io_pol_hnd("", &r_q->pol, ps, depth))
761                 return False;
762
763         if(!prs_uint32("sec_info", ps, depth, &r_q->sec_info))
764                 return False;
765         if(!prs_uint32("ptr    ", ps, depth, &r_q->ptr))
766                 return False;
767
768         if(!reg_io_hdrbuf_sec(r_q->ptr, NULL, &r_q->hdr_sec, r_q->data, ps, depth))
769                 return False;
770
771         return True;
772 }
773
774 /*******************************************************************
775 reads or writes a structure.
776 ********************************************************************/
777
778 BOOL reg_io_r_set_key_sec(char *desc, REG_R_SET_KEY_SEC *r_q, prs_struct *ps, int depth)
779 {
780         if (r_q == NULL)
781                 return False;
782
783         prs_debug(ps, depth, desc, "reg_io_r_set_key_sec");
784         depth++;
785
786         if(!prs_align(ps))
787                 return False;
788         
789         if(!prs_uint32("status", ps, depth, &r_q->status))
790                 return False;
791
792         return True;
793 }
794
795
796 /*******************************************************************
797 makes a structure.
798 ********************************************************************/
799
800 void init_reg_q_get_key_sec(REG_Q_GET_KEY_SEC *q_i, POLICY_HND *pol, 
801                                 uint32 sec_buf_size, SEC_DESC_BUF *psdb)
802 {
803         memcpy(&q_i->pol, pol, sizeof(q_i->pol));
804
805         q_i->sec_info = OWNER_SECURITY_INFORMATION |
806                         GROUP_SECURITY_INFORMATION |
807                         DACL_SECURITY_INFORMATION;
808
809         q_i->ptr = psdb != NULL ? 1 : 0;
810         q_i->data = psdb;
811
812         init_buf_hdr(&q_i->hdr_sec, sec_buf_size, 0);
813 }
814
815 /*******************************************************************
816 reads or writes a structure.
817 ********************************************************************/
818
819 BOOL reg_io_q_get_key_sec(char *desc,  REG_Q_GET_KEY_SEC *r_q, prs_struct *ps, int depth)
820 {
821         if (r_q == NULL)
822                 return False;
823
824         prs_debug(ps, depth, desc, "reg_io_q_get_key_sec");
825         depth++;
826
827         if(!prs_align(ps))
828                 return False;
829         
830         if(!smb_io_pol_hnd("", &r_q->pol, ps, depth))
831                 return False;
832
833         if(!prs_uint32("sec_info", ps, depth, &r_q->sec_info))
834                 return False;
835         if(!prs_uint32("ptr     ", ps, depth, &r_q->ptr))
836                 return False;
837
838         if(!reg_io_hdrbuf_sec(r_q->ptr, NULL, &r_q->hdr_sec, r_q->data, ps, depth))
839                 return False;
840
841         return True;
842 }
843
844 #if 0
845 /*******************************************************************
846 makes a structure.
847 ********************************************************************/
848  void init_reg_r_get_key_sec(REG_R_GET_KEY_SEC *r_i, POLICY_HND *pol, 
849                                 uint32 buf_len, uint8 *buf,
850                                 uint32 status)
851 {
852         r_i->ptr = 1;
853         init_buf_hdr(&r_i->hdr_sec, buf_len, buf_len);
854         init_sec_desc_buf(r_i->data, buf_len, 1);
855
856         r_i->status = status; /* 0x0000 0000 or 0x0000 007a */
857 }
858 #endif 
859
860 /*******************************************************************
861 reads or writes a structure.
862 ********************************************************************/
863
864 BOOL reg_io_r_get_key_sec(char *desc,  REG_R_GET_KEY_SEC *r_q, prs_struct *ps, int depth)
865 {
866         if (r_q == NULL)
867                 return False;
868
869         prs_debug(ps, depth, desc, "reg_io_r_get_key_sec");
870         depth++;
871
872         if(!prs_align(ps))
873                 return False;
874         
875         if(!prs_uint32("ptr      ", ps, depth, &r_q->ptr))
876                 return False;
877
878         if (r_q->ptr != 0) {
879                 if(!smb_io_hdrbuf("", &r_q->hdr_sec, ps, depth))
880                         return False;
881                 if(!sec_io_desc_buf("", &r_q->data, ps, depth))
882                         return False;
883                 if(!prs_align(ps))
884                         return False;
885         }
886
887         if(!prs_uint32("status", ps, depth, &r_q->status))
888                 return False;
889
890         return True;
891 }
892
893 /*******************************************************************
894 makes a structure.
895 ********************************************************************/
896
897 void init_reg_q_info(REG_Q_INFO *q_i, POLICY_HND *pol, char *product_type,
898                                 time_t unix_time, uint8 major, uint8 minor)
899 {
900         int len_type  = strlen(product_type);
901
902         memcpy(&q_i->pol, pol, sizeof(q_i->pol));
903
904         init_uni_hdr(&q_i->hdr_type, len_type);
905         init_unistr2(&q_i->uni_type, product_type, len_type);
906
907         q_i->ptr1 = 1;
908         unix_to_nt_time(&q_i->time, unix_time);
909         q_i->major_version1 = major;
910         q_i->minor_version1 = minor;
911         memset(q_i->pad1, 0, sizeof(q_i->pad1));
912
913         q_i->ptr2 = 1;
914         q_i->major_version2 = major;
915         q_i->minor_version2 = minor;
916         memset(q_i->pad2, 0, sizeof(q_i->pad2));
917
918         q_i->ptr3 = 1;
919         q_i->unknown = 0x00000000;
920 }
921
922 /*******************************************************************
923 reads or writes a structure.
924 ********************************************************************/
925
926 BOOL reg_io_q_info(char *desc,  REG_Q_INFO *r_q, prs_struct *ps, int depth)
927 {
928         if (r_q == NULL)
929                 return False;
930
931         prs_debug(ps, depth, desc, "reg_io_q_info");
932         depth++;
933
934         if(!prs_align(ps))
935                 return False;
936         
937         if(!smb_io_pol_hnd("", &r_q->pol, ps, depth))
938                 return False;
939         if(!smb_io_unihdr ("", &r_q->hdr_type, ps, depth))
940                 return False;
941         if(!smb_io_unistr2("", &r_q->uni_type, r_q->hdr_type.buffer, ps, depth))
942                 return False;
943
944         if(!prs_align(ps))
945                 return False;
946         
947         if(!prs_uint32("ptr1", ps, depth, &r_q->ptr1))
948                 return False;
949
950         if (r_q->ptr1 != 0) {
951                 if(!smb_io_time("", &r_q->time, ps, depth))
952                         return False;
953                 if(!prs_uint8 ("major_version1", ps, depth, &r_q->major_version1))
954                         return False;
955                 if(!prs_uint8 ("minor_version1", ps, depth, &r_q->minor_version1))
956                         return False;
957                 if(!prs_uint8s(False, "pad1", ps, depth, r_q->pad1, sizeof(r_q->pad1)))
958                         return False;
959         }
960
961         if(!prs_uint32("ptr2", ps, depth, &r_q->ptr2))
962                 return False;
963
964         if (r_q->ptr2 != 0) {
965                 if(!prs_uint8 ("major_version2", ps, depth, &r_q->major_version2))
966                         return False;
967                 if(!prs_uint8 ("minor_version2", ps, depth, &r_q->minor_version2))
968                         return False;
969                 if(!prs_uint8s(False, "pad2", ps, depth, r_q->pad2, sizeof(r_q->pad2)))
970                         return False;
971         }
972
973         if(!prs_uint32("ptr3", ps, depth, &r_q->ptr3))
974                 return False;
975
976         if (r_q->ptr3 != 0) {
977                 if(!prs_uint32("unknown", ps, depth, &r_q->unknown))
978                         return False;
979         }
980
981         return True;
982 }
983
984 /*******************************************************************
985  Inits a structure.
986 ********************************************************************/
987
988 void init_reg_r_info(REG_R_INFO *r_r,
989                                 uint32 level, char *os_type,
990                                 uint32 unknown_0, uint32 unknown_1,
991                                 uint32 status)
992 {
993         uint8 buf[512];
994         int len = dos_struni2((char *)buf, os_type, sizeof(buf));
995
996         r_r->ptr1 = 1;
997         r_r->level = level;
998
999         r_r->ptr_type = 1;
1000         init_buffer2(&r_r->uni_type, buf, len*2);
1001
1002         r_r->ptr2 = 1;
1003         r_r->unknown_0 = unknown_0;
1004
1005         r_r->ptr3 = 1;
1006         r_r->unknown_1 = unknown_1;
1007
1008         r_r->status = status;
1009 }
1010
1011 /*******************************************************************
1012 reads or writes a structure.
1013 ********************************************************************/
1014
1015 BOOL reg_io_r_info(char *desc, REG_R_INFO *r_r, prs_struct *ps, int depth)
1016 {
1017         if (r_r == NULL)
1018                 return False;
1019
1020         prs_debug(ps, depth, desc, "reg_io_r_info");
1021         depth++;
1022
1023         if(!prs_align(ps))
1024                 return False;
1025         
1026         if(!prs_uint32("ptr1", ps, depth, &r_r->ptr1))
1027                 return False;
1028
1029         if (r_r->ptr1 != 0) {
1030                 if(!prs_uint32("level", ps, depth, &r_r->level))
1031                         return False;
1032                 if(!prs_uint32("ptr_type", ps, depth, &r_r->ptr_type))
1033                         return False;
1034
1035                 if(!smb_io_buffer2("uni_type", &r_r->uni_type, r_r->ptr_type, ps, depth))
1036                         return False;
1037                 if(!prs_align(ps))
1038                         return False;
1039
1040                 if(!prs_uint32("ptr2", ps, depth, &r_r->ptr2))
1041                         return False;
1042
1043                 if (r_r->ptr2 != 0) {
1044                         if(!prs_uint32("unknown_0", ps, depth, &r_r->unknown_0))
1045                                 return False;
1046                 }
1047
1048                 if(!prs_uint32("ptr3", ps, depth, &r_r->ptr3))
1049                         return False;
1050
1051                 if (r_r->ptr3 != 0) {
1052                         if(!prs_uint32("unknown_1", ps, depth, &r_r->unknown_1))
1053                                 return False;
1054                 }
1055
1056         }
1057         if(!prs_uint32("status", ps, depth, &r_r->status))
1058                 return False;
1059
1060         return True;
1061 }
1062
1063 /*******************************************************************
1064 makes a structure.
1065 ********************************************************************/
1066
1067 void init_reg_q_enum_val(REG_Q_ENUM_VALUE *q_i, POLICY_HND *pol,
1068                                 uint32 val_idx, uint32 max_val_len,
1069                                 uint32 max_buf_len)
1070 {
1071         ZERO_STRUCTP(q_i);
1072
1073         memcpy(&q_i->pol, pol, sizeof(q_i->pol));
1074
1075         q_i->val_index = val_idx;
1076         init_uni_hdr(&q_i->hdr_name, max_val_len);
1077         q_i->uni_name.uni_max_len = max_val_len;
1078         
1079         q_i->ptr_type = 1;
1080         q_i->type = 0x0;
1081
1082         q_i->ptr_value = 1;
1083         q_i->buf_value.buf_max_len = max_buf_len;
1084
1085         q_i->ptr1 = 1;
1086         q_i->len_value1 = max_buf_len;
1087
1088         q_i->ptr2 = 1;
1089         q_i->len_value2 = 0;
1090 }
1091
1092 /*******************************************************************
1093 reads or writes a structure.
1094 ********************************************************************/
1095
1096 BOOL reg_io_q_enum_val(char *desc,  REG_Q_ENUM_VALUE *q_q, prs_struct *ps, int depth)
1097 {
1098         if (q_q == NULL)
1099                 return False;
1100
1101         prs_debug(ps, depth, desc, "reg_io_q_enum_val");
1102         depth++;
1103
1104         if(!prs_align(ps))
1105                 return False;
1106         
1107         if(!smb_io_pol_hnd("", &q_q->pol, ps, depth))
1108                 return False;
1109         
1110         if(!prs_uint32("val_index", ps, depth, &q_q->val_index))
1111                 return False;
1112         if(!smb_io_unihdr ("hdr_name", &q_q->hdr_name, ps, depth))
1113                 return False;
1114         if(!smb_io_unistr2("uni_name", &q_q->uni_name, q_q->hdr_name.buffer, ps, depth))
1115                 return False;
1116         if(!prs_align(ps))
1117                 return False;
1118
1119         if(!prs_uint32("ptr_type", ps, depth, &q_q->ptr_type))
1120                 return False;
1121
1122         if (q_q->ptr_type != 0) {
1123                 if(!prs_uint32("type", ps, depth, &q_q->type))
1124                         return False;
1125         }
1126
1127         if(!prs_uint32("ptr_value", ps, depth, &q_q->ptr_value))
1128                 return False;
1129         if(!smb_io_buffer2("buf_value", &q_q->buf_value, q_q->ptr_value, ps, depth))
1130                 return False;
1131         if(!prs_align(ps))
1132                 return False;
1133
1134         if(!prs_uint32("ptr1", ps, depth, &q_q->ptr1))
1135                 return False;
1136         if (q_q->ptr1 != 0) {
1137                 if(!prs_uint32("len_value1", ps, depth, &q_q->len_value1))
1138                         return False;
1139         }
1140         if(!prs_uint32("ptr2", ps, depth, &q_q->ptr2))
1141                 return False;
1142         if (q_q->ptr2 != 0) {
1143                 if(!prs_uint32("len_value2", ps, depth, &q_q->len_value2))
1144                         return False;
1145         }
1146
1147         return True;
1148 }
1149
1150 /*******************************************************************
1151 reads or writes a structure.
1152 ********************************************************************/
1153
1154 BOOL reg_io_r_enum_val(char *desc,  REG_R_ENUM_VALUE *r_q, prs_struct *ps, int depth)
1155 {
1156         if (r_q == NULL)
1157                 return False;
1158
1159         prs_debug(ps, depth, desc, "reg_io_r_enum_val");
1160         depth++;
1161
1162         if(!prs_align(ps))
1163                 return False;
1164         
1165         if(!smb_io_unihdr ("hdr_name", &r_q->hdr_name, ps, depth))
1166                 return False;
1167         if(!smb_io_unistr2("uni_name", &r_q->uni_name, r_q->hdr_name.buffer, ps, depth))
1168                 return False;
1169         if(!prs_align(ps))
1170                 return False;
1171
1172         if(!prs_uint32("ptr_type", ps, depth, &r_q->ptr_type))
1173                 return False;
1174
1175         if (r_q->ptr_type != 0) {
1176                 if(!prs_uint32("type", ps, depth, &r_q->type))
1177                         return False;
1178         }
1179
1180         if(!prs_uint32("ptr_value", ps, depth, &r_q->ptr_value))
1181                 return False;
1182         if(!smb_io_buffer2("buf_value", r_q->buf_value, r_q->ptr_value, ps, depth))
1183                 return False;
1184         if(!prs_align(ps))
1185                 return False;
1186
1187         if(!prs_uint32("ptr1", ps, depth, &r_q->ptr1))
1188                 return False;
1189         if (r_q->ptr1 != 0) {
1190                 if(!prs_uint32("len_value1", ps, depth, &r_q->len_value1))
1191                         return False;
1192         }
1193
1194         if(!prs_uint32("ptr2", ps, depth, &r_q->ptr2))
1195                 return False;
1196         if (r_q->ptr2 != 0) {
1197                 if(!prs_uint32("len_value2", ps, depth, &r_q->len_value2))
1198                         return False;
1199         }
1200
1201         if(!prs_uint32("status", ps, depth, &r_q->status))
1202                 return False;
1203
1204         return True;
1205 }
1206
1207 /*******************************************************************
1208 makes a structure.
1209 ********************************************************************/
1210
1211 void init_reg_q_create_val(REG_Q_CREATE_VALUE *q_i, POLICY_HND *pol,
1212                                 char *val_name, uint32 type,
1213                                 BUFFER3 *val)
1214 {
1215         int val_len = strlen(val_name) + 1;
1216
1217         ZERO_STRUCTP(q_i);
1218
1219         memcpy(&q_i->pol, pol, sizeof(q_i->pol));
1220
1221         init_uni_hdr(&q_i->hdr_name, val_len);
1222         init_unistr2(&q_i->uni_name, val_name, val_len);
1223         
1224         q_i->type      = type;
1225         q_i->buf_value = val;
1226 }
1227
1228 /*******************************************************************
1229 reads or writes a structure.
1230 ********************************************************************/
1231
1232 BOOL reg_io_q_create_val(char *desc,  REG_Q_CREATE_VALUE *q_q, prs_struct *ps, int depth)
1233 {
1234         if (q_q == NULL)
1235                 return False;
1236
1237         prs_debug(ps, depth, desc, "reg_io_q_create_val");
1238         depth++;
1239
1240         if(!prs_align(ps))
1241                 return False;
1242         
1243         if(!smb_io_pol_hnd("", &q_q->pol, ps, depth))
1244                 return False;
1245         
1246         if(!smb_io_unihdr ("hdr_name", &q_q->hdr_name, ps, depth))
1247                 return False;
1248         if(!smb_io_unistr2("uni_name", &q_q->uni_name, q_q->hdr_name.buffer, ps, depth))
1249                 return False;
1250         if(!prs_align(ps))
1251                 return False;
1252
1253         if(!prs_uint32("type", ps, depth, &q_q->type))
1254                 return False;
1255         if(!smb_io_buffer3("buf_value", q_q->buf_value, ps, depth))
1256                 return False;
1257         if(!prs_align(ps))
1258                 return False;
1259
1260         return True;
1261 }
1262
1263 /*******************************************************************
1264 reads or writes a structure.
1265 ********************************************************************/
1266
1267 BOOL reg_io_r_create_val(char *desc,  REG_R_CREATE_VALUE *r_q, prs_struct *ps, int depth)
1268 {
1269         if (r_q == NULL)
1270                 return False;
1271
1272         prs_debug(ps, depth, desc, "reg_io_r_create_val");
1273         depth++;
1274
1275         if(!prs_align(ps))
1276                 return False;
1277         
1278         if(!prs_uint32("status", ps, depth, &r_q->status))
1279                 return False;
1280
1281         return True;
1282 }
1283
1284 /*******************************************************************
1285 makes a structure.
1286 ********************************************************************/
1287
1288 void init_reg_q_enum_key(REG_Q_ENUM_KEY *q_i, POLICY_HND *pol, uint32 key_idx)
1289 {
1290         memcpy(&q_i->pol, pol, sizeof(q_i->pol));
1291
1292         q_i->key_index = key_idx;
1293         q_i->key_name_len = 0;
1294         q_i->unknown_1 = 0x0414;
1295
1296         q_i->ptr1 = 1;
1297         q_i->unknown_2 = 0x0000020A;
1298         memset(q_i->pad1, 0, sizeof(q_i->pad1));
1299
1300         q_i->ptr2 = 1;
1301         memset(q_i->pad2, 0, sizeof(q_i->pad2));
1302
1303         q_i->ptr3 = 1;
1304         unix_to_nt_time(&q_i->time, 0);            /* current time? */
1305 }
1306
1307 /*******************************************************************
1308 reads or writes a structure.
1309 ********************************************************************/
1310
1311 BOOL reg_io_q_enum_key(char *desc,  REG_Q_ENUM_KEY *q_q, prs_struct *ps, int depth)
1312 {
1313         if (q_q == NULL)
1314                 return False;
1315
1316         prs_debug(ps, depth, desc, "reg_io_q_enum_key");
1317         depth++;
1318
1319         if(!prs_align(ps))
1320                 return False;
1321         
1322         if(!smb_io_pol_hnd("", &q_q->pol, ps, depth))
1323                 return False;
1324         
1325         if(!prs_uint32("key_index", ps, depth, &q_q->key_index))
1326                 return False;
1327         if(!prs_uint16("key_name_len", ps, depth, &q_q->key_name_len))
1328                 return False;
1329         if(!prs_uint16("unknown_1", ps, depth, &q_q->unknown_1))
1330                 return False;
1331
1332         if(!prs_uint32("ptr1", ps, depth, &q_q->ptr1))
1333                 return False;
1334
1335         if (q_q->ptr1 != 0) {
1336                 if(!prs_uint32("unknown_2", ps, depth, &q_q->unknown_2))
1337                         return False;
1338                 if(!prs_uint8s(False, "pad1", ps, depth, q_q->pad1, sizeof(q_q->pad1)))
1339                         return False;
1340         }
1341
1342         if(!prs_uint32("ptr2", ps, depth, &q_q->ptr2))
1343                 return False;
1344
1345         if (q_q->ptr2 != 0) {
1346                 if(!prs_uint8s(False, "pad2", ps, depth, q_q->pad2, sizeof(q_q->pad2)))
1347                         return False;
1348         }
1349
1350         if(!prs_uint32("ptr3", ps, depth, &q_q->ptr3))
1351                 return False;
1352
1353         if (q_q->ptr3 != 0) {
1354                 if(!smb_io_time("", &q_q->time, ps, depth))
1355                         return False;
1356         }
1357
1358         return True;
1359 }
1360
1361 /*******************************************************************
1362 reads or writes a structure.
1363 ********************************************************************/
1364
1365 BOOL reg_io_r_enum_key(char *desc,  REG_R_ENUM_KEY *r_q, prs_struct *ps, int depth)
1366 {
1367         if (r_q == NULL)
1368                 return False;
1369
1370         prs_debug(ps, depth, desc, "reg_io_r_enum_key");
1371         depth++;
1372
1373         if(!prs_align(ps))
1374                 return False;
1375         
1376         if(!prs_uint16("key_name_len", ps, depth, &r_q->key_name_len))
1377                 return False;
1378         if(!prs_uint16("unknown_1", ps, depth, &r_q->unknown_1))
1379                 return False;
1380
1381         if(!prs_uint32("ptr1", ps, depth, &r_q->ptr1))
1382                 return False;
1383
1384         if (r_q->ptr1 != 0) {
1385                 if(!prs_uint32("unknown_2", ps, depth, &r_q->unknown_2))
1386                         return False;
1387                 if(!prs_uint32("unknown_3", ps, depth, &r_q->unknown_3))
1388                         return False;
1389                 if(!smb_io_unistr3("key_name", &r_q->key_name, ps, depth))
1390                         return False;
1391                 if(!prs_align(ps))
1392                         return False;
1393         }
1394
1395         if(!prs_uint32("ptr2", ps, depth, &r_q->ptr2))
1396                 return False;
1397
1398         if (r_q->ptr2 != 0) {
1399                 if(!prs_uint8s(False, "pad2", ps, depth, r_q->pad2, sizeof(r_q->pad2)))
1400                         return False;
1401         }
1402
1403         if(!prs_uint32("ptr3", ps, depth, &r_q->ptr3))
1404                 return False;
1405
1406         if (r_q->ptr3 != 0) {
1407                 if(!smb_io_time("", &r_q->time, ps, depth))
1408                         return False;
1409         }
1410
1411         if(!prs_uint32("status", ps, depth, &r_q->status))
1412                 return False;
1413
1414         return True;
1415 }
1416
1417 /*******************************************************************
1418 makes a structure.
1419 ********************************************************************/
1420
1421 void init_reg_q_open_entry(REG_Q_OPEN_ENTRY *r_q, POLICY_HND *pol,
1422                                 char *key_name, uint32 unk)
1423 {
1424         int len_name = strlen(key_name)+1;
1425
1426         memcpy(&r_q->pol, pol, sizeof(r_q->pol));
1427
1428         init_uni_hdr(&r_q->hdr_name, len_name);
1429         init_unistr2(&r_q->uni_name, key_name, len_name);
1430
1431         r_q->unknown_0 = 0x00000000;
1432         r_q->unknown_1 = unk;
1433 }
1434
1435 /*******************************************************************
1436 reads or writes a structure.
1437 ********************************************************************/
1438
1439 BOOL reg_io_q_open_entry(char *desc,  REG_Q_OPEN_ENTRY *r_q, prs_struct *ps, int depth)
1440 {
1441         if (r_q == NULL)
1442                 return False;
1443
1444         prs_debug(ps, depth, desc, "reg_io_q_entry");
1445         depth++;
1446
1447         if(!prs_align(ps))
1448                 return False;
1449         
1450         if(!smb_io_pol_hnd("", &r_q->pol, ps, depth))
1451                 return False;
1452         if(!smb_io_unihdr ("", &r_q->hdr_name, ps, depth))
1453                 return False;
1454         if(!smb_io_unistr2("", &r_q->uni_name, r_q->hdr_name.buffer, ps, depth))
1455                 return False;
1456
1457         if(!prs_align(ps))
1458                 return False;
1459         
1460         if(!prs_uint32("unknown_0", ps, depth, &r_q->unknown_0))
1461                 return False;
1462         if(!prs_uint32("unknown_1", ps, depth, &r_q->unknown_1))
1463                 return False;
1464
1465         return True;
1466 }
1467
1468 /*******************************************************************
1469  Inits a structure.
1470 ********************************************************************/
1471
1472 void init_reg_r_open_entry(REG_R_OPEN_ENTRY *r_r,
1473                                 POLICY_HND *pol, uint32 status)
1474 {
1475         memcpy(&r_r->pol, pol, sizeof(r_r->pol));
1476         r_r->status = status;
1477 }
1478
1479 /*******************************************************************
1480 reads or writes a structure.
1481 ********************************************************************/
1482
1483 BOOL reg_io_r_open_entry(char *desc,  REG_R_OPEN_ENTRY *r_r, prs_struct *ps, int depth)
1484 {
1485         if (r_r == NULL)
1486                 return False;
1487
1488         prs_debug(ps, depth, desc, "reg_io_r_open_entry");
1489         depth++;
1490
1491         if(!prs_align(ps))
1492                 return False;
1493         
1494         if(!smb_io_pol_hnd("", &r_r->pol, ps, depth))
1495                 return False;
1496
1497         if(!prs_uint32("status", ps, depth, &r_r->status))
1498                 return False;
1499
1500         return True;
1501 }