2 * Unix SMB/Netbios implementation.
4 * RPC Pipe client / server routines
5 * Copyright (C) Andrew Tridgell 1992-1997,
6 * Copyright (C) Luke Kenneth Casson Leighton 1996-1997,
7 * Copyright (C) Paul Ashton 1997.
8 * Copyright (C) Hewlett-Packard Company 1999.
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 extern int DEBUGLEVEL
;
31 /*******************************************************************
33 ********************************************************************/
35 void init_reg_q_open_hklm(REG_Q_OPEN_HKLM
*q_o
,
36 uint16 unknown_0
, uint32 level
)
39 q_o
->unknown_0
= unknown_0
;
40 q_o
->unknown_1
= 0x0; /* random - changes */
44 /*******************************************************************
45 reads or writes a structure.
46 ********************************************************************/
48 BOOL
reg_io_q_open_hklm(char *desc
, REG_Q_OPEN_HKLM
*r_q
, prs_struct
*ps
, int depth
)
53 prs_debug(ps
, depth
, desc
, "reg_io_q_open_hklm");
59 if(!prs_uint32("ptr ", ps
, depth
, &r_q
->ptr
))
63 if(!prs_uint16("unknown_0", ps
, depth
, &r_q
->unknown_0
))
65 if(!prs_uint16("unknown_1", ps
, depth
, &r_q
->unknown_1
))
67 if(!prs_uint32("level ", ps
, depth
, &r_q
->level
))
75 /*******************************************************************
76 reads or writes a structure.
77 ********************************************************************/
79 BOOL
reg_io_r_open_hklm(char *desc
, REG_R_OPEN_HKLM
*r_r
, prs_struct
*ps
, int depth
)
84 prs_debug(ps
, depth
, desc
, "reg_io_r_open_hklm");
90 if(!smb_io_pol_hnd("", &r_r
->pol
, ps
, depth
))
93 if(!prs_uint32("status", ps
, depth
, &r_r
->status
))
100 /*******************************************************************
102 ********************************************************************/
104 void init_reg_q_flush_key(REG_Q_FLUSH_KEY
*q_u
, POLICY_HND
*pol
)
106 memcpy(&q_u
->pol
, pol
, sizeof(q_u
->pol
));
109 /*******************************************************************
110 reads or writes a structure.
111 ********************************************************************/
113 BOOL
reg_io_q_flush_key(char *desc
, REG_Q_FLUSH_KEY
*r_q
, prs_struct
*ps
, int depth
)
118 prs_debug(ps
, depth
, desc
, "reg_io_q_flush_key");
124 if(!smb_io_pol_hnd("", &r_q
->pol
, ps
, depth
))
130 /*******************************************************************
131 reads or writes a structure.
132 ********************************************************************/
134 BOOL
reg_io_r_flush_key(char *desc
, REG_R_FLUSH_KEY
*r_r
, prs_struct
*ps
, int depth
)
139 prs_debug(ps
, depth
, desc
, "reg_io_r_flush_key");
145 if(!prs_uint32("status", ps
, depth
, &r_r
->status
))
151 /*******************************************************************
152 reads or writes SEC_DESC_BUF and SEC_DATA structures.
153 ********************************************************************/
155 static BOOL
reg_io_hdrbuf_sec(uint32 ptr
, uint32
*ptr3
, BUFHDR
*hdr_sec
, SEC_DESC_BUF
*data
, prs_struct
*ps
, int depth
)
160 if(!smb_io_hdrbuf_pre("hdr_sec", hdr_sec
, ps
, depth
, &hdr_offset
))
163 old_offset
= prs_offset(ps
);
166 if(!prs_uint32("ptr3", ps
, depth
, ptr3
))
170 if (ptr3
== NULL
|| *ptr3
!= 0) {
171 if(!sec_io_desc_buf("data ", &data
, ps
, depth
)) /* JRA - this line is probably wrong... */
175 if(!smb_io_hdrbuf_post("hdr_sec", hdr_sec
, ps
, depth
, hdr_offset
,
176 data
->max_len
, data
->len
))
178 if(!prs_set_offset(ps
, old_offset
+ data
->len
+ sizeof(uint32
) * ((ptr3
!= NULL
) ? 5 : 3)))
188 /*******************************************************************
190 ********************************************************************/
192 void init_reg_q_create_key(REG_Q_CREATE_KEY
*q_c
, POLICY_HND
*hnd
,
193 char *name
, char *class, SEC_ACCESS
*sam_access
,
194 SEC_DESC_BUF
*sec_buf
)
196 int len_name
= name
!= NULL
? strlen(name
) + 1: 0;
197 int len_class
= class != NULL
? strlen(class) + 1: 0;
201 memcpy(&q_c
->pnt_pol
, hnd
, sizeof(q_c
->pnt_pol
));
203 init_uni_hdr(&q_c
->hdr_name
, len_name
);
204 init_unistr2(&q_c
->uni_name
, name
, len_name
);
206 init_uni_hdr(&q_c
->hdr_class
, len_class
);
207 init_unistr2(&q_c
->uni_class
, class, len_class
);
209 q_c
->reserved
= 0x00000000;
210 memcpy(&q_c
->sam_access
, sam_access
, sizeof(q_c
->sam_access
));
213 q_c
->sec_info
= DACL_SECURITY_INFORMATION
| SACL_SECURITY_INFORMATION
;
217 init_buf_hdr(&q_c
->hdr_sec
, sec_buf
->len
, sec_buf
->len
);
219 q_c
->unknown_2
= 0x00000000;
222 /*******************************************************************
223 reads or writes a structure.
224 ********************************************************************/
226 BOOL
reg_io_q_create_key(char *desc
, REG_Q_CREATE_KEY
*r_q
, prs_struct
*ps
, int depth
)
231 prs_debug(ps
, depth
, desc
, "reg_io_q_create_key");
237 if(!smb_io_pol_hnd("", &r_q
->pnt_pol
, ps
, depth
))
240 if(!smb_io_unihdr ("", &r_q
->hdr_name
, ps
, depth
))
242 if(!smb_io_unistr2("", &r_q
->uni_name
, r_q
->hdr_name
.buffer
, ps
, depth
))
247 if(!smb_io_unihdr ("", &r_q
->hdr_class
, ps
, depth
))
249 if(!smb_io_unistr2("", &r_q
->uni_class
, r_q
->hdr_class
.buffer
, ps
, depth
))
254 if(!prs_uint32("reserved", ps
, depth
, &r_q
->reserved
))
256 if(!sec_io_access("sam_access", &r_q
->sam_access
, ps
, depth
))
259 if(!prs_uint32("ptr1", ps
, depth
, &r_q
->ptr1
))
262 if (r_q
->ptr1
!= 0) {
263 if(!prs_uint32("sec_info", ps
, depth
, &r_q
->sec_info
))
267 if(!prs_uint32("ptr2", ps
, depth
, &r_q
->ptr2
))
269 if(!reg_io_hdrbuf_sec(r_q
->ptr2
, &r_q
->ptr3
, &r_q
->hdr_sec
, r_q
->data
, ps
, depth
))
272 if(!prs_uint32("unknown_2", ps
, depth
, &r_q
->unknown_2
))
278 /*******************************************************************
279 reads or writes a structure.
280 ********************************************************************/
282 BOOL
reg_io_r_create_key(char *desc
, REG_R_CREATE_KEY
*r_r
, prs_struct
*ps
, int depth
)
287 prs_debug(ps
, depth
, desc
, "reg_io_r_create_key");
293 if(!smb_io_pol_hnd("", &r_r
->key_pol
, ps
, depth
))
295 if(!prs_uint32("unknown", ps
, depth
, &r_r
->unknown
))
298 if(!prs_uint32("status", ps
, depth
, &r_r
->status
))
305 /*******************************************************************
307 ********************************************************************/
309 void init_reg_q_delete_val(REG_Q_DELETE_VALUE
*q_c
, POLICY_HND
*hnd
,
312 int len_name
= name
!= NULL
? strlen(name
) + 1: 0;
315 memcpy(&q_c
->pnt_pol
, hnd
, sizeof(q_c
->pnt_pol
));
317 init_uni_hdr(&q_c
->hdr_name
, len_name
);
318 init_unistr2(&q_c
->uni_name
, name
, len_name
);
321 /*******************************************************************
322 reads or writes a structure.
323 ********************************************************************/
325 BOOL
reg_io_q_delete_val(char *desc
, REG_Q_DELETE_VALUE
*r_q
, prs_struct
*ps
, int depth
)
330 prs_debug(ps
, depth
, desc
, "reg_io_q_delete_val");
336 if(!smb_io_pol_hnd("", &r_q
->pnt_pol
, ps
, depth
))
339 if(!smb_io_unihdr ("", &r_q
->hdr_name
, ps
, depth
))
341 if(!smb_io_unistr2("", &r_q
->uni_name
, r_q
->hdr_name
.buffer
, ps
, depth
))
350 /*******************************************************************
351 reads or writes a structure.
352 ********************************************************************/
354 BOOL
reg_io_r_delete_val(char *desc
, REG_R_DELETE_VALUE
*r_r
, prs_struct
*ps
, int depth
)
359 prs_debug(ps
, depth
, desc
, "reg_io_r_delete_val");
365 if(!prs_uint32("status", ps
, depth
, &r_r
->status
))
371 /*******************************************************************
373 ********************************************************************/
375 void init_reg_q_delete_key(REG_Q_DELETE_KEY
*q_c
, POLICY_HND
*hnd
,
378 int len_name
= name
!= NULL
? strlen(name
) + 1: 0;
381 memcpy(&q_c
->pnt_pol
, hnd
, sizeof(q_c
->pnt_pol
));
383 init_uni_hdr(&q_c
->hdr_name
, len_name
);
384 init_unistr2(&q_c
->uni_name
, name
, len_name
);
387 /*******************************************************************
388 reads or writes a structure.
389 ********************************************************************/
391 BOOL
reg_io_q_delete_key(char *desc
, REG_Q_DELETE_KEY
*r_q
, prs_struct
*ps
, int depth
)
396 prs_debug(ps
, depth
, desc
, "reg_io_q_delete_key");
402 if(!smb_io_pol_hnd("", &r_q
->pnt_pol
, ps
, depth
))
405 if(!smb_io_unihdr ("", &r_q
->hdr_name
, ps
, depth
))
407 if(!smb_io_unistr2("", &r_q
->uni_name
, r_q
->hdr_name
.buffer
, ps
, depth
))
415 /*******************************************************************
416 reads or writes a structure.
417 ********************************************************************/
419 BOOL
reg_io_r_delete_key(char *desc
, REG_R_DELETE_KEY
*r_r
, prs_struct
*ps
, int depth
)
424 prs_debug(ps
, depth
, desc
, "reg_io_r_delete_key");
430 if(!prs_uint32("status", ps
, depth
, &r_r
->status
))
436 /*******************************************************************
438 ********************************************************************/
440 void init_reg_q_query_key(REG_Q_QUERY_KEY
*q_o
, POLICY_HND
*hnd
,
441 uint32 max_class_len
)
445 memcpy(&q_o
->pol
, hnd
, sizeof(q_o
->pol
));
446 init_uni_hdr(&q_o
->hdr_class
, max_class_len
);
447 q_o
->uni_class
.uni_max_len
= max_class_len
;
450 /*******************************************************************
451 reads or writes a structure.
452 ********************************************************************/
454 BOOL
reg_io_q_query_key(char *desc
, REG_Q_QUERY_KEY
*r_q
, prs_struct
*ps
, int depth
)
459 prs_debug(ps
, depth
, desc
, "reg_io_q_query_key");
465 if(!smb_io_pol_hnd("", &r_q
->pol
, ps
, depth
))
467 if(!smb_io_unihdr ("", &r_q
->hdr_class
, ps
, depth
))
469 if(!smb_io_unistr2("", &r_q
->uni_class
, r_q
->hdr_class
.buffer
, ps
, depth
))
479 /*******************************************************************
480 reads or writes a structure.
481 ********************************************************************/
483 BOOL
reg_io_r_query_key(char *desc
, REG_R_QUERY_KEY
*r_r
, prs_struct
*ps
, int depth
)
488 prs_debug(ps
, depth
, desc
, "reg_io_r_query_key");
494 if(!smb_io_unihdr ("", &r_r
->hdr_class
, ps
, depth
))
496 if(!smb_io_unistr2("", &r_r
->uni_class
, r_r
->hdr_class
.buffer
, ps
, depth
))
502 if(!prs_uint32("num_subkeys ", ps
, depth
, &r_r
->num_subkeys
))
504 if(!prs_uint32("max_subkeylen ", ps
, depth
, &r_r
->max_subkeylen
))
506 if(!prs_uint32("mak_subkeysize", ps
, depth
, &r_r
->max_subkeysize
))
508 if(!prs_uint32("num_values ", ps
, depth
, &r_r
->num_values
))
510 if(!prs_uint32("max_valnamelen", ps
, depth
, &r_r
->max_valnamelen
))
512 if(!prs_uint32("max_valbufsize", ps
, depth
, &r_r
->max_valbufsize
))
514 if(!prs_uint32("sec_desc ", ps
, depth
, &r_r
->sec_desc
))
516 if(!smb_io_time("mod_time ", &r_r
->mod_time
, ps
, depth
))
519 if(!prs_uint32("status", ps
, depth
, &r_r
->status
))
525 /*******************************************************************
527 ********************************************************************/
529 void init_reg_q_unk_1a(REG_Q_UNK_1A
*q_o
, POLICY_HND
*hnd
)
531 memcpy(&q_o
->pol
, hnd
, sizeof(q_o
->pol
));
534 /*******************************************************************
535 reads or writes a structure.
536 ********************************************************************/
538 BOOL
reg_io_q_unk_1a(char *desc
, REG_Q_UNK_1A
*r_q
, prs_struct
*ps
, int depth
)
543 prs_debug(ps
, depth
, desc
, "reg_io_q_unk_1a");
549 if(!smb_io_pol_hnd("", &r_q
->pol
, ps
, depth
))
555 /*******************************************************************
556 reads or writes a structure.
557 ********************************************************************/
559 BOOL
reg_io_r_unk_1a(char *desc
, REG_R_UNK_1A
*r_r
, prs_struct
*ps
, int depth
)
564 prs_debug(ps
, depth
, desc
, "reg_io_r_unk_1a");
570 if(!prs_uint32("unknown", ps
, depth
, &r_r
->unknown
))
572 if(!prs_uint32("status" , ps
, depth
, &r_r
->status
))
578 /*******************************************************************
580 ********************************************************************/
582 void init_reg_q_open_hku(REG_Q_OPEN_HKU
*q_o
,
583 uint16 unknown_0
, uint32 level
)
586 q_o
->unknown_0
= unknown_0
;
587 q_o
->unknown_1
= 0x0; /* random - changes */
591 /*******************************************************************
592 reads or writes a structure.
593 ********************************************************************/
595 BOOL
reg_io_q_open_hku(char *desc
, REG_Q_OPEN_HKU
*r_q
, prs_struct
*ps
, int depth
)
600 prs_debug(ps
, depth
, desc
, "reg_io_q_open_hku");
606 if(!prs_uint32("ptr ", ps
, depth
, &r_q
->ptr
))
609 if(!prs_uint16("unknown_0", ps
, depth
, &r_q
->unknown_0
))
611 if(!prs_uint16("unknown_1", ps
, depth
, &r_q
->unknown_1
))
613 if(!prs_uint32("level ", ps
, depth
, &r_q
->level
))
620 /*******************************************************************
621 reads or writes a structure.
622 ********************************************************************/
624 BOOL
reg_io_r_open_hku(char *desc
, REG_R_OPEN_HKU
*r_r
, prs_struct
*ps
, int depth
)
629 prs_debug(ps
, depth
, desc
, "reg_io_r_open_hku");
635 if(!smb_io_pol_hnd("", &r_r
->pol
, ps
, depth
))
638 if(!prs_uint32("status", ps
, depth
, &r_r
->status
))
644 /*******************************************************************
645 Inits an REG_Q_CLOSE structure.
646 ********************************************************************/
648 void init_reg_q_close(REG_Q_CLOSE
*q_c
, POLICY_HND
*hnd
)
650 DEBUG(5,("init_reg_q_close\n"));
652 memcpy(&q_c
->pol
, hnd
, sizeof(q_c
->pol
));
655 /*******************************************************************
656 reads or writes a structure.
657 ********************************************************************/
659 BOOL
reg_io_q_close(char *desc
, REG_Q_CLOSE
*q_u
, prs_struct
*ps
, int depth
)
664 prs_debug(ps
, depth
, desc
, "reg_io_q_unknown_1");
670 if(!smb_io_pol_hnd("", &q_u
->pol
, ps
, depth
))
678 /*******************************************************************
679 reads or writes a structure.
680 ********************************************************************/
682 BOOL
reg_io_r_close(char *desc
, REG_R_CLOSE
*r_u
, prs_struct
*ps
, int depth
)
687 prs_debug(ps
, depth
, desc
, "reg_io_r_unknown_1");
693 if(!smb_io_pol_hnd("", &r_u
->pol
, ps
, depth
))
698 if(!prs_uint32("status", ps
, depth
, &r_u
->status
))
704 /*******************************************************************
706 ********************************************************************/
708 void init_reg_q_set_key_sec(REG_Q_SET_KEY_SEC
*q_i
, POLICY_HND
*pol
, SEC_DESC_BUF
*sec_desc_buf
)
710 memcpy(&q_i
->pol
, pol
, sizeof(q_i
->pol
));
712 q_i
->sec_info
= DACL_SECURITY_INFORMATION
;
715 init_buf_hdr(&q_i
->hdr_sec
, sec_desc_buf
->len
, sec_desc_buf
->len
);
716 q_i
->data
= sec_desc_buf
;
719 /*******************************************************************
720 reads or writes a structure.
721 ********************************************************************/
723 BOOL
reg_io_q_set_key_sec(char *desc
, REG_Q_SET_KEY_SEC
*r_q
, prs_struct
*ps
, int depth
)
728 prs_debug(ps
, depth
, desc
, "reg_io_q_set_key_sec");
734 if(!smb_io_pol_hnd("", &r_q
->pol
, ps
, depth
))
737 if(!prs_uint32("sec_info", ps
, depth
, &r_q
->sec_info
))
739 if(!prs_uint32("ptr ", ps
, depth
, &r_q
->ptr
))
742 if(!reg_io_hdrbuf_sec(r_q
->ptr
, NULL
, &r_q
->hdr_sec
, r_q
->data
, ps
, depth
))
748 /*******************************************************************
749 reads or writes a structure.
750 ********************************************************************/
752 BOOL
reg_io_r_set_key_sec(char *desc
, REG_R_SET_KEY_SEC
*r_q
, prs_struct
*ps
, int depth
)
757 prs_debug(ps
, depth
, desc
, "reg_io_r_set_key_sec");
763 if(!prs_uint32("status", ps
, depth
, &r_q
->status
))
770 /*******************************************************************
772 ********************************************************************/
774 void init_reg_q_get_key_sec(REG_Q_GET_KEY_SEC
*q_i
, POLICY_HND
*pol
,
775 uint32 sec_buf_size
, SEC_DESC_BUF
*psdb
)
777 memcpy(&q_i
->pol
, pol
, sizeof(q_i
->pol
));
779 q_i
->sec_info
= OWNER_SECURITY_INFORMATION
|
780 GROUP_SECURITY_INFORMATION
|
781 DACL_SECURITY_INFORMATION
;
783 q_i
->ptr
= psdb
!= NULL
? 1 : 0;
786 init_buf_hdr(&q_i
->hdr_sec
, sec_buf_size
, 0);
789 /*******************************************************************
790 reads or writes a structure.
791 ********************************************************************/
793 BOOL
reg_io_q_get_key_sec(char *desc
, REG_Q_GET_KEY_SEC
*r_q
, prs_struct
*ps
, int depth
)
798 prs_debug(ps
, depth
, desc
, "reg_io_q_get_key_sec");
804 if(!smb_io_pol_hnd("", &r_q
->pol
, ps
, depth
))
807 if(!prs_uint32("sec_info", ps
, depth
, &r_q
->sec_info
))
809 if(!prs_uint32("ptr ", ps
, depth
, &r_q
->ptr
))
812 if(!reg_io_hdrbuf_sec(r_q
->ptr
, NULL
, &r_q
->hdr_sec
, r_q
->data
, ps
, depth
))
819 /*******************************************************************
821 ********************************************************************/
822 void init_reg_r_get_key_sec(REG_R_GET_KEY_SEC
*r_i
, POLICY_HND
*pol
,
823 uint32 buf_len
, uint8
*buf
,
827 init_buf_hdr(&r_i
->hdr_sec
, buf_len
, buf_len
);
828 init_sec_desc_buf(r_i
->data
, buf_len
, 1);
830 r_i
->status
= status
; /* 0x0000 0000 or 0x0000 007a */
834 /*******************************************************************
835 reads or writes a structure.
836 ********************************************************************/
838 BOOL
reg_io_r_get_key_sec(char *desc
, REG_R_GET_KEY_SEC
*r_q
, prs_struct
*ps
, int depth
)
843 prs_debug(ps
, depth
, desc
, "reg_io_r_get_key_sec");
849 if(!prs_uint32("ptr ", ps
, depth
, &r_q
->ptr
))
853 if(!smb_io_hdrbuf("", &r_q
->hdr_sec
, ps
, depth
))
855 if(!sec_io_desc_buf("", &r_q
->data
, ps
, depth
))
861 if(!prs_uint32("status", ps
, depth
, &r_q
->status
))
867 /*******************************************************************
869 ********************************************************************/
871 void init_reg_q_info(REG_Q_INFO
*q_i
, POLICY_HND
*pol
, char *product_type
,
872 time_t unix_time
, uint8 major
, uint8 minor
)
874 int len_type
= strlen(product_type
);
876 memcpy(&q_i
->pol
, pol
, sizeof(q_i
->pol
));
878 init_uni_hdr(&q_i
->hdr_type
, len_type
);
879 init_unistr2(&q_i
->uni_type
, product_type
, len_type
);
882 unix_to_nt_time(&q_i
->time
, unix_time
);
883 q_i
->major_version1
= major
;
884 q_i
->minor_version1
= minor
;
885 memset(q_i
->pad1
, 0, sizeof(q_i
->pad1
));
888 q_i
->major_version2
= major
;
889 q_i
->minor_version2
= minor
;
890 memset(q_i
->pad2
, 0, sizeof(q_i
->pad2
));
893 q_i
->unknown
= 0x00000000;
896 /*******************************************************************
897 reads or writes a structure.
898 ********************************************************************/
900 BOOL
reg_io_q_info(char *desc
, REG_Q_INFO
*r_q
, prs_struct
*ps
, int depth
)
905 prs_debug(ps
, depth
, desc
, "reg_io_q_info");
911 if(!smb_io_pol_hnd("", &r_q
->pol
, ps
, depth
))
913 if(!smb_io_unihdr ("", &r_q
->hdr_type
, ps
, depth
))
915 if(!smb_io_unistr2("", &r_q
->uni_type
, r_q
->hdr_type
.buffer
, ps
, depth
))
921 if(!prs_uint32("ptr1", ps
, depth
, &r_q
->ptr1
))
924 if (r_q
->ptr1
!= 0) {
925 if(!smb_io_time("", &r_q
->time
, ps
, depth
))
927 if(!prs_uint8 ("major_version1", ps
, depth
, &r_q
->major_version1
))
929 if(!prs_uint8 ("minor_version1", ps
, depth
, &r_q
->minor_version1
))
931 if(!prs_uint8s(False
, "pad1", ps
, depth
, r_q
->pad1
, sizeof(r_q
->pad1
)))
935 if(!prs_uint32("ptr2", ps
, depth
, &r_q
->ptr2
))
938 if (r_q
->ptr2
!= 0) {
939 if(!prs_uint8 ("major_version2", ps
, depth
, &r_q
->major_version2
))
941 if(!prs_uint8 ("minor_version2", ps
, depth
, &r_q
->minor_version2
))
943 if(!prs_uint8s(False
, "pad2", ps
, depth
, r_q
->pad2
, sizeof(r_q
->pad2
)))
947 if(!prs_uint32("ptr3", ps
, depth
, &r_q
->ptr3
))
950 if (r_q
->ptr3
!= 0) {
951 if(!prs_uint32("unknown", ps
, depth
, &r_q
->unknown
))
958 /*******************************************************************
960 ********************************************************************/
962 void init_reg_r_info(REG_R_INFO
*r_r
,
963 uint32 level
, char *os_type
,
964 uint32 unknown_0
, uint32 unknown_1
,
968 int len
= dos_struni2((char *)buf
, os_type
, sizeof(buf
));
974 init_buffer2(&r_r
->uni_type
, buf
, len
*2);
977 r_r
->unknown_0
= unknown_0
;
980 r_r
->unknown_1
= unknown_1
;
982 r_r
->status
= status
;
985 /*******************************************************************
986 reads or writes a structure.
987 ********************************************************************/
989 BOOL
reg_io_r_info(char *desc
, REG_R_INFO
*r_r
, prs_struct
*ps
, int depth
)
994 prs_debug(ps
, depth
, desc
, "reg_io_r_info");
1000 if(!prs_uint32("ptr1", ps
, depth
, &r_r
->ptr1
))
1003 if (r_r
->ptr1
!= 0) {
1004 if(!prs_uint32("level", ps
, depth
, &r_r
->level
))
1006 if(!prs_uint32("ptr_type", ps
, depth
, &r_r
->ptr_type
))
1009 if(!smb_io_buffer2("uni_type", &r_r
->uni_type
, r_r
->ptr_type
, ps
, depth
))
1014 if(!prs_uint32("ptr2", ps
, depth
, &r_r
->ptr2
))
1017 if (r_r
->ptr2
!= 0) {
1018 if(!prs_uint32("unknown_0", ps
, depth
, &r_r
->unknown_0
))
1022 if(!prs_uint32("ptr3", ps
, depth
, &r_r
->ptr3
))
1025 if (r_r
->ptr3
!= 0) {
1026 if(!prs_uint32("unknown_1", ps
, depth
, &r_r
->unknown_1
))
1031 if(!prs_uint32("status", ps
, depth
, &r_r
->status
))
1037 /*******************************************************************
1039 ********************************************************************/
1041 void init_reg_q_enum_val(REG_Q_ENUM_VALUE
*q_i
, POLICY_HND
*pol
,
1042 uint32 val_idx
, uint32 max_val_len
,
1047 memcpy(&q_i
->pol
, pol
, sizeof(q_i
->pol
));
1049 q_i
->val_index
= val_idx
;
1050 init_uni_hdr(&q_i
->hdr_name
, max_val_len
);
1051 q_i
->uni_name
.uni_max_len
= max_val_len
;
1057 q_i
->buf_value
.buf_max_len
= max_buf_len
;
1060 q_i
->len_value1
= max_buf_len
;
1063 q_i
->len_value2
= 0;
1066 /*******************************************************************
1067 reads or writes a structure.
1068 ********************************************************************/
1070 BOOL
reg_io_q_enum_val(char *desc
, REG_Q_ENUM_VALUE
*q_q
, prs_struct
*ps
, int depth
)
1075 prs_debug(ps
, depth
, desc
, "reg_io_q_enum_val");
1081 if(!smb_io_pol_hnd("", &q_q
->pol
, ps
, depth
))
1084 if(!prs_uint32("val_index", ps
, depth
, &q_q
->val_index
))
1086 if(!smb_io_unihdr ("hdr_name", &q_q
->hdr_name
, ps
, depth
))
1088 if(!smb_io_unistr2("uni_name", &q_q
->uni_name
, q_q
->hdr_name
.buffer
, ps
, depth
))
1093 if(!prs_uint32("ptr_type", ps
, depth
, &q_q
->ptr_type
))
1096 if (q_q
->ptr_type
!= 0) {
1097 if(!prs_uint32("type", ps
, depth
, &q_q
->type
))
1101 if(!prs_uint32("ptr_value", ps
, depth
, &q_q
->ptr_value
))
1103 if(!smb_io_buffer2("buf_value", &q_q
->buf_value
, q_q
->ptr_value
, ps
, depth
))
1108 if(!prs_uint32("ptr1", ps
, depth
, &q_q
->ptr1
))
1110 if (q_q
->ptr1
!= 0) {
1111 if(!prs_uint32("len_value1", ps
, depth
, &q_q
->len_value1
))
1114 if(!prs_uint32("ptr2", ps
, depth
, &q_q
->ptr2
))
1116 if (q_q
->ptr2
!= 0) {
1117 if(!prs_uint32("len_value2", ps
, depth
, &q_q
->len_value2
))
1124 /*******************************************************************
1125 reads or writes a structure.
1126 ********************************************************************/
1128 BOOL
reg_io_r_enum_val(char *desc
, REG_R_ENUM_VALUE
*r_q
, prs_struct
*ps
, int depth
)
1133 prs_debug(ps
, depth
, desc
, "reg_io_r_enum_val");
1139 if(!smb_io_unihdr ("hdr_name", &r_q
->hdr_name
, ps
, depth
))
1141 if(!smb_io_unistr2("uni_name", &r_q
->uni_name
, r_q
->hdr_name
.buffer
, ps
, depth
))
1146 if(!prs_uint32("ptr_type", ps
, depth
, &r_q
->ptr_type
))
1149 if (r_q
->ptr_type
!= 0) {
1150 if(!prs_uint32("type", ps
, depth
, &r_q
->type
))
1154 if(!prs_uint32("ptr_value", ps
, depth
, &r_q
->ptr_value
))
1156 if(!smb_io_buffer2("buf_value", r_q
->buf_value
, r_q
->ptr_value
, ps
, depth
))
1161 if(!prs_uint32("ptr1", ps
, depth
, &r_q
->ptr1
))
1163 if (r_q
->ptr1
!= 0) {
1164 if(!prs_uint32("len_value1", ps
, depth
, &r_q
->len_value1
))
1168 if(!prs_uint32("ptr2", ps
, depth
, &r_q
->ptr2
))
1170 if (r_q
->ptr2
!= 0) {
1171 if(!prs_uint32("len_value2", ps
, depth
, &r_q
->len_value2
))
1175 if(!prs_uint32("status", ps
, depth
, &r_q
->status
))
1181 /*******************************************************************
1183 ********************************************************************/
1185 void init_reg_q_create_val(REG_Q_CREATE_VALUE
*q_i
, POLICY_HND
*pol
,
1186 char *val_name
, uint32 type
,
1189 int val_len
= strlen(val_name
) + 1;
1193 memcpy(&q_i
->pol
, pol
, sizeof(q_i
->pol
));
1195 init_uni_hdr(&q_i
->hdr_name
, val_len
);
1196 init_unistr2(&q_i
->uni_name
, val_name
, val_len
);
1199 q_i
->buf_value
= val
;
1202 /*******************************************************************
1203 reads or writes a structure.
1204 ********************************************************************/
1206 BOOL
reg_io_q_create_val(char *desc
, REG_Q_CREATE_VALUE
*q_q
, prs_struct
*ps
, int depth
)
1211 prs_debug(ps
, depth
, desc
, "reg_io_q_create_val");
1217 if(!smb_io_pol_hnd("", &q_q
->pol
, ps
, depth
))
1220 if(!smb_io_unihdr ("hdr_name", &q_q
->hdr_name
, ps
, depth
))
1222 if(!smb_io_unistr2("uni_name", &q_q
->uni_name
, q_q
->hdr_name
.buffer
, ps
, depth
))
1227 if(!prs_uint32("type", ps
, depth
, &q_q
->type
))
1229 if(!smb_io_buffer3("buf_value", q_q
->buf_value
, ps
, depth
))
1237 /*******************************************************************
1238 reads or writes a structure.
1239 ********************************************************************/
1241 BOOL
reg_io_r_create_val(char *desc
, REG_R_CREATE_VALUE
*r_q
, prs_struct
*ps
, int depth
)
1246 prs_debug(ps
, depth
, desc
, "reg_io_r_create_val");
1252 if(!prs_uint32("status", ps
, depth
, &r_q
->status
))
1258 /*******************************************************************
1260 ********************************************************************/
1262 void init_reg_q_enum_key(REG_Q_ENUM_KEY
*q_i
, POLICY_HND
*pol
, uint32 key_idx
)
1264 memcpy(&q_i
->pol
, pol
, sizeof(q_i
->pol
));
1266 q_i
->key_index
= key_idx
;
1267 q_i
->key_name_len
= 0;
1268 q_i
->unknown_1
= 0x0414;
1271 q_i
->unknown_2
= 0x0000020A;
1272 memset(q_i
->pad1
, 0, sizeof(q_i
->pad1
));
1275 memset(q_i
->pad2
, 0, sizeof(q_i
->pad2
));
1278 unix_to_nt_time(&q_i
->time
, 0); /* current time? */
1281 /*******************************************************************
1282 reads or writes a structure.
1283 ********************************************************************/
1285 BOOL
reg_io_q_enum_key(char *desc
, REG_Q_ENUM_KEY
*q_q
, prs_struct
*ps
, int depth
)
1290 prs_debug(ps
, depth
, desc
, "reg_io_q_enum_key");
1296 if(!smb_io_pol_hnd("", &q_q
->pol
, ps
, depth
))
1299 if(!prs_uint32("key_index", ps
, depth
, &q_q
->key_index
))
1301 if(!prs_uint16("key_name_len", ps
, depth
, &q_q
->key_name_len
))
1303 if(!prs_uint16("unknown_1", ps
, depth
, &q_q
->unknown_1
))
1306 if(!prs_uint32("ptr1", ps
, depth
, &q_q
->ptr1
))
1309 if (q_q
->ptr1
!= 0) {
1310 if(!prs_uint32("unknown_2", ps
, depth
, &q_q
->unknown_2
))
1312 if(!prs_uint8s(False
, "pad1", ps
, depth
, q_q
->pad1
, sizeof(q_q
->pad1
)))
1316 if(!prs_uint32("ptr2", ps
, depth
, &q_q
->ptr2
))
1319 if (q_q
->ptr2
!= 0) {
1320 if(!prs_uint8s(False
, "pad2", ps
, depth
, q_q
->pad2
, sizeof(q_q
->pad2
)))
1324 if(!prs_uint32("ptr3", ps
, depth
, &q_q
->ptr3
))
1327 if (q_q
->ptr3
!= 0) {
1328 if(!smb_io_time("", &q_q
->time
, ps
, depth
))
1335 /*******************************************************************
1336 reads or writes a structure.
1337 ********************************************************************/
1339 BOOL
reg_io_r_enum_key(char *desc
, REG_R_ENUM_KEY
*r_q
, prs_struct
*ps
, int depth
)
1344 prs_debug(ps
, depth
, desc
, "reg_io_r_enum_key");
1350 if(!prs_uint16("key_name_len", ps
, depth
, &r_q
->key_name_len
))
1352 if(!prs_uint16("unknown_1", ps
, depth
, &r_q
->unknown_1
))
1355 if(!prs_uint32("ptr1", ps
, depth
, &r_q
->ptr1
))
1358 if (r_q
->ptr1
!= 0) {
1359 if(!prs_uint32("unknown_2", ps
, depth
, &r_q
->unknown_2
))
1361 if(!prs_uint32("unknown_3", ps
, depth
, &r_q
->unknown_3
))
1363 if(!smb_io_unistr3("key_name", &r_q
->key_name
, ps
, depth
))
1369 if(!prs_uint32("ptr2", ps
, depth
, &r_q
->ptr2
))
1372 if (r_q
->ptr2
!= 0) {
1373 if(!prs_uint8s(False
, "pad2", ps
, depth
, r_q
->pad2
, sizeof(r_q
->pad2
)))
1377 if(!prs_uint32("ptr3", ps
, depth
, &r_q
->ptr3
))
1380 if (r_q
->ptr3
!= 0) {
1381 if(!smb_io_time("", &r_q
->time
, ps
, depth
))
1385 if(!prs_uint32("status", ps
, depth
, &r_q
->status
))
1391 /*******************************************************************
1393 ********************************************************************/
1395 void init_reg_q_open_entry(REG_Q_OPEN_ENTRY
*r_q
, POLICY_HND
*pol
,
1396 char *key_name
, uint32 unk
)
1398 int len_name
= strlen(key_name
)+1;
1400 memcpy(&r_q
->pol
, pol
, sizeof(r_q
->pol
));
1402 init_uni_hdr(&r_q
->hdr_name
, len_name
);
1403 init_unistr2(&r_q
->uni_name
, key_name
, len_name
);
1405 r_q
->unknown_0
= 0x00000000;
1406 r_q
->unknown_1
= unk
;
1409 /*******************************************************************
1410 reads or writes a structure.
1411 ********************************************************************/
1413 BOOL
reg_io_q_open_entry(char *desc
, REG_Q_OPEN_ENTRY
*r_q
, prs_struct
*ps
, int depth
)
1418 prs_debug(ps
, depth
, desc
, "reg_io_q_entry");
1424 if(!smb_io_pol_hnd("", &r_q
->pol
, ps
, depth
))
1426 if(!smb_io_unihdr ("", &r_q
->hdr_name
, ps
, depth
))
1428 if(!smb_io_unistr2("", &r_q
->uni_name
, r_q
->hdr_name
.buffer
, ps
, depth
))
1434 if(!prs_uint32("unknown_0", ps
, depth
, &r_q
->unknown_0
))
1436 if(!prs_uint32("unknown_1", ps
, depth
, &r_q
->unknown_1
))
1442 /*******************************************************************
1444 ********************************************************************/
1446 void init_reg_r_open_entry(REG_R_OPEN_ENTRY
*r_r
,
1447 POLICY_HND
*pol
, uint32 status
)
1449 memcpy(&r_r
->pol
, pol
, sizeof(r_r
->pol
));
1450 r_r
->status
= status
;
1453 /*******************************************************************
1454 reads or writes a structure.
1455 ********************************************************************/
1457 BOOL
reg_io_r_open_entry(char *desc
, REG_R_OPEN_ENTRY
*r_r
, prs_struct
*ps
, int depth
)
1462 prs_debug(ps
, depth
, desc
, "reg_io_r_open_entry");
1468 if(!smb_io_pol_hnd("", &r_r
->pol
, ps
, depth
))
1471 if(!prs_uint32("status", ps
, depth
, &r_r
->status
))