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) Marc Jacobsen 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 BOOL
init_reg_q_info(REG_Q_INFO
*q_i
, POLICY_HND
*pol
, char* val_name
)
873 int len_type
= val_name
!= NULL
? strlen(val_name
) + 1 : 0;
880 init_uni_hdr(&(q_i
->hdr_type
), len_type
);
881 init_unistr2(&(q_i
->uni_type
), val_name
, len_type
);
883 q_i
->ptr_reserved
= 1;
886 q_i
->ptr_bufsize
= 1;
894 q_i
->ptr_buflen2
= 1;
900 /*******************************************************************
901 reads or writes a structure.
902 ********************************************************************/
904 BOOL
reg_io_q_info(char *desc
, REG_Q_INFO
*r_q
, prs_struct
*ps
, int depth
)
909 prs_debug(ps
, depth
, desc
, "reg_io_q_info");
915 if(!smb_io_pol_hnd("", &r_q
->pol
, ps
, depth
))
917 if(!smb_io_unihdr ("", &r_q
->hdr_type
, ps
, depth
))
919 if(!smb_io_unistr2("", &r_q
->uni_type
, r_q
->hdr_type
.buffer
, ps
, depth
))
925 if(!prs_uint32("ptr_reserved", ps
, depth
, &(r_q
->ptr_reserved
)))
928 if(!prs_uint32("ptr_buf", ps
, depth
, &(r_q
->ptr_buf
)))
932 if(!prs_uint32("ptr_bufsize", ps
, depth
, &(r_q
->ptr_bufsize
)))
934 if(!prs_uint32("bufsize", ps
, depth
, &(r_q
->bufsize
)))
936 if(!prs_uint32("buf_unk", ps
, depth
, &(r_q
->buf_unk
)))
940 if(!prs_uint32("unk1", ps
, depth
, &(r_q
->unk1
)))
943 if(!prs_uint32("ptr_buflen", ps
, depth
, &(r_q
->ptr_buflen
)))
945 if(!prs_uint32("buflen", ps
, depth
, &(r_q
->buflen
)))
948 if(!prs_uint32("ptr_buflen2", ps
, depth
, &(r_q
->ptr_buflen2
)))
950 if(!prs_uint32("buflen2", ps
, depth
, &(r_q
->buflen2
)))
956 /*******************************************************************
958 ********************************************************************/
960 BOOL
init_reg_r_info(uint32 include_keyval
, REG_R_INFO
*r_r
,
961 BUFFER2
* buf
, uint32 type
, uint32 status
)
970 /* if include_keyval is not set, don't send the key value, just
971 the buflen data. probably used by NT5 to allocate buffer space - SK */
972 r_r
->ptr_uni_val
= include_keyval
? 1:0;
975 r_r
->ptr_max_len
= 1;
976 r_r
->buf_max_len
= r_r
->uni_val
->buf_max_len
;
979 r_r
->buf_len
= r_r
->uni_val
->buf_len
;
981 r_r
->status
= status
;
987 /*******************************************************************
988 reads or writes a structure.
989 ********************************************************************/
991 BOOL
reg_io_r_info(char *desc
, REG_R_INFO
*r_r
, prs_struct
*ps
, int depth
)
996 prs_debug(ps
, depth
, desc
, "reg_io_r_info");
1002 if(!prs_uint32("ptr_type", ps
, depth
, &(r_r
->ptr_type
)))
1005 if (r_r
->ptr_type
!= 0) {
1006 if(!prs_uint32("type", ps
, depth
, &r_r
->type
))
1010 if(!prs_uint32("ptr_uni_val", ps
, depth
, &(r_r
->ptr_uni_val
)))
1013 if(r_r
->ptr_uni_val
!= 0) {
1014 if(!smb_io_buffer2("uni_val", r_r
->uni_val
, r_r
->ptr_uni_val
, ps
, depth
))
1021 if(!prs_uint32("ptr_max_len", ps
, depth
, &(r_r
->ptr_max_len
)))
1024 if (r_r
->ptr_max_len
!= 0) {
1025 if(!prs_uint32("buf_max_len", ps
, depth
, &(r_r
->buf_max_len
)))
1029 if(!prs_uint32("ptr_len", ps
, depth
, &(r_r
->ptr_len
)))
1031 if (r_r
->ptr_len
!= 0) {
1032 if(!prs_uint32("buf_len", ps
, depth
, &(r_r
->buf_len
)))
1036 if(!prs_uint32("status", ps
, depth
, &r_r
->status
))
1042 /*******************************************************************
1044 ********************************************************************/
1046 void init_reg_q_enum_val(REG_Q_ENUM_VALUE
*q_i
, POLICY_HND
*pol
,
1047 uint32 val_idx
, uint32 max_val_len
,
1052 memcpy(&q_i
->pol
, pol
, sizeof(q_i
->pol
));
1054 q_i
->val_index
= val_idx
;
1055 init_uni_hdr(&q_i
->hdr_name
, max_val_len
);
1056 q_i
->uni_name
.uni_max_len
= max_val_len
;
1062 q_i
->buf_value
.buf_max_len
= max_buf_len
;
1065 q_i
->len_value1
= max_buf_len
;
1068 q_i
->len_value2
= 0;
1071 /*******************************************************************
1072 reads or writes a structure.
1073 ********************************************************************/
1075 BOOL
reg_io_q_enum_val(char *desc
, REG_Q_ENUM_VALUE
*q_q
, prs_struct
*ps
, int depth
)
1080 prs_debug(ps
, depth
, desc
, "reg_io_q_enum_val");
1086 if(!smb_io_pol_hnd("", &q_q
->pol
, ps
, depth
))
1089 if(!prs_uint32("val_index", ps
, depth
, &q_q
->val_index
))
1091 if(!smb_io_unihdr ("hdr_name", &q_q
->hdr_name
, ps
, depth
))
1093 if(!smb_io_unistr2("uni_name", &q_q
->uni_name
, q_q
->hdr_name
.buffer
, ps
, depth
))
1098 if(!prs_uint32("ptr_type", ps
, depth
, &q_q
->ptr_type
))
1101 if (q_q
->ptr_type
!= 0) {
1102 if(!prs_uint32("type", ps
, depth
, &q_q
->type
))
1106 if(!prs_uint32("ptr_value", ps
, depth
, &q_q
->ptr_value
))
1108 if(!smb_io_buffer2("buf_value", &q_q
->buf_value
, q_q
->ptr_value
, ps
, depth
))
1113 if(!prs_uint32("ptr1", ps
, depth
, &q_q
->ptr1
))
1115 if (q_q
->ptr1
!= 0) {
1116 if(!prs_uint32("len_value1", ps
, depth
, &q_q
->len_value1
))
1119 if(!prs_uint32("ptr2", ps
, depth
, &q_q
->ptr2
))
1121 if (q_q
->ptr2
!= 0) {
1122 if(!prs_uint32("len_value2", ps
, depth
, &q_q
->len_value2
))
1129 /*******************************************************************
1130 reads or writes a structure.
1131 ********************************************************************/
1133 BOOL
reg_io_r_enum_val(char *desc
, REG_R_ENUM_VALUE
*r_q
, prs_struct
*ps
, int depth
)
1138 prs_debug(ps
, depth
, desc
, "reg_io_r_enum_val");
1144 if(!smb_io_unihdr ("hdr_name", &r_q
->hdr_name
, ps
, depth
))
1146 if(!smb_io_unistr2("uni_name", &r_q
->uni_name
, r_q
->hdr_name
.buffer
, ps
, depth
))
1151 if(!prs_uint32("ptr_type", ps
, depth
, &r_q
->ptr_type
))
1154 if (r_q
->ptr_type
!= 0) {
1155 if(!prs_uint32("type", ps
, depth
, &r_q
->type
))
1159 if(!prs_uint32("ptr_value", ps
, depth
, &r_q
->ptr_value
))
1161 if(!smb_io_buffer2("buf_value", r_q
->buf_value
, r_q
->ptr_value
, ps
, depth
))
1166 if(!prs_uint32("ptr1", ps
, depth
, &r_q
->ptr1
))
1168 if (r_q
->ptr1
!= 0) {
1169 if(!prs_uint32("len_value1", ps
, depth
, &r_q
->len_value1
))
1173 if(!prs_uint32("ptr2", ps
, depth
, &r_q
->ptr2
))
1175 if (r_q
->ptr2
!= 0) {
1176 if(!prs_uint32("len_value2", ps
, depth
, &r_q
->len_value2
))
1180 if(!prs_uint32("status", ps
, depth
, &r_q
->status
))
1186 /*******************************************************************
1188 ********************************************************************/
1190 void init_reg_q_create_val(REG_Q_CREATE_VALUE
*q_i
, POLICY_HND
*pol
,
1191 char *val_name
, uint32 type
,
1194 int val_len
= strlen(val_name
) + 1;
1198 memcpy(&q_i
->pol
, pol
, sizeof(q_i
->pol
));
1200 init_uni_hdr(&q_i
->hdr_name
, val_len
);
1201 init_unistr2(&q_i
->uni_name
, val_name
, val_len
);
1204 q_i
->buf_value
= val
;
1207 /*******************************************************************
1208 reads or writes a structure.
1209 ********************************************************************/
1211 BOOL
reg_io_q_create_val(char *desc
, REG_Q_CREATE_VALUE
*q_q
, prs_struct
*ps
, int depth
)
1216 prs_debug(ps
, depth
, desc
, "reg_io_q_create_val");
1222 if(!smb_io_pol_hnd("", &q_q
->pol
, ps
, depth
))
1225 if(!smb_io_unihdr ("hdr_name", &q_q
->hdr_name
, ps
, depth
))
1227 if(!smb_io_unistr2("uni_name", &q_q
->uni_name
, q_q
->hdr_name
.buffer
, ps
, depth
))
1232 if(!prs_uint32("type", ps
, depth
, &q_q
->type
))
1234 if(!smb_io_buffer3("buf_value", q_q
->buf_value
, ps
, depth
))
1242 /*******************************************************************
1243 reads or writes a structure.
1244 ********************************************************************/
1246 BOOL
reg_io_r_create_val(char *desc
, REG_R_CREATE_VALUE
*r_q
, prs_struct
*ps
, int depth
)
1251 prs_debug(ps
, depth
, desc
, "reg_io_r_create_val");
1257 if(!prs_uint32("status", ps
, depth
, &r_q
->status
))
1263 /*******************************************************************
1265 ********************************************************************/
1267 void init_reg_q_enum_key(REG_Q_ENUM_KEY
*q_i
, POLICY_HND
*pol
, uint32 key_idx
)
1269 memcpy(&q_i
->pol
, pol
, sizeof(q_i
->pol
));
1271 q_i
->key_index
= key_idx
;
1272 q_i
->key_name_len
= 0;
1273 q_i
->unknown_1
= 0x0414;
1276 q_i
->unknown_2
= 0x0000020A;
1277 memset(q_i
->pad1
, 0, sizeof(q_i
->pad1
));
1280 memset(q_i
->pad2
, 0, sizeof(q_i
->pad2
));
1283 unix_to_nt_time(&q_i
->time
, 0); /* current time? */
1286 /*******************************************************************
1287 reads or writes a structure.
1288 ********************************************************************/
1290 BOOL
reg_io_q_enum_key(char *desc
, REG_Q_ENUM_KEY
*q_q
, prs_struct
*ps
, int depth
)
1295 prs_debug(ps
, depth
, desc
, "reg_io_q_enum_key");
1301 if(!smb_io_pol_hnd("", &q_q
->pol
, ps
, depth
))
1304 if(!prs_uint32("key_index", ps
, depth
, &q_q
->key_index
))
1306 if(!prs_uint16("key_name_len", ps
, depth
, &q_q
->key_name_len
))
1308 if(!prs_uint16("unknown_1", ps
, depth
, &q_q
->unknown_1
))
1311 if(!prs_uint32("ptr1", ps
, depth
, &q_q
->ptr1
))
1314 if (q_q
->ptr1
!= 0) {
1315 if(!prs_uint32("unknown_2", ps
, depth
, &q_q
->unknown_2
))
1317 if(!prs_uint8s(False
, "pad1", ps
, depth
, q_q
->pad1
, sizeof(q_q
->pad1
)))
1321 if(!prs_uint32("ptr2", ps
, depth
, &q_q
->ptr2
))
1324 if (q_q
->ptr2
!= 0) {
1325 if(!prs_uint8s(False
, "pad2", ps
, depth
, q_q
->pad2
, sizeof(q_q
->pad2
)))
1329 if(!prs_uint32("ptr3", ps
, depth
, &q_q
->ptr3
))
1332 if (q_q
->ptr3
!= 0) {
1333 if(!smb_io_time("", &q_q
->time
, ps
, depth
))
1340 /*******************************************************************
1341 reads or writes a structure.
1342 ********************************************************************/
1344 BOOL
reg_io_r_enum_key(char *desc
, REG_R_ENUM_KEY
*r_q
, prs_struct
*ps
, int depth
)
1349 prs_debug(ps
, depth
, desc
, "reg_io_r_enum_key");
1355 if(!prs_uint16("key_name_len", ps
, depth
, &r_q
->key_name_len
))
1357 if(!prs_uint16("unknown_1", ps
, depth
, &r_q
->unknown_1
))
1360 if(!prs_uint32("ptr1", ps
, depth
, &r_q
->ptr1
))
1363 if (r_q
->ptr1
!= 0) {
1364 if(!prs_uint32("unknown_2", ps
, depth
, &r_q
->unknown_2
))
1366 if(!prs_uint32("unknown_3", ps
, depth
, &r_q
->unknown_3
))
1368 if(!smb_io_unistr3("key_name", &r_q
->key_name
, ps
, depth
))
1374 if(!prs_uint32("ptr2", ps
, depth
, &r_q
->ptr2
))
1377 if (r_q
->ptr2
!= 0) {
1378 if(!prs_uint8s(False
, "pad2", ps
, depth
, r_q
->pad2
, sizeof(r_q
->pad2
)))
1382 if(!prs_uint32("ptr3", ps
, depth
, &r_q
->ptr3
))
1385 if (r_q
->ptr3
!= 0) {
1386 if(!smb_io_time("", &r_q
->time
, ps
, depth
))
1390 if(!prs_uint32("status", ps
, depth
, &r_q
->status
))
1396 /*******************************************************************
1398 ********************************************************************/
1400 void init_reg_q_open_entry(REG_Q_OPEN_ENTRY
*r_q
, POLICY_HND
*pol
,
1401 char *key_name
, uint32 unk
)
1403 int len_name
= strlen(key_name
)+1;
1405 memcpy(&r_q
->pol
, pol
, sizeof(r_q
->pol
));
1407 init_uni_hdr(&r_q
->hdr_name
, len_name
);
1408 init_unistr2(&r_q
->uni_name
, key_name
, len_name
);
1410 r_q
->unknown_0
= 0x00000000;
1411 r_q
->unknown_1
= unk
;
1414 /*******************************************************************
1415 reads or writes a structure.
1416 ********************************************************************/
1418 BOOL
reg_io_q_open_entry(char *desc
, REG_Q_OPEN_ENTRY
*r_q
, prs_struct
*ps
, int depth
)
1423 prs_debug(ps
, depth
, desc
, "reg_io_q_entry");
1429 if(!smb_io_pol_hnd("", &r_q
->pol
, ps
, depth
))
1431 if(!smb_io_unihdr ("", &r_q
->hdr_name
, ps
, depth
))
1433 if(!smb_io_unistr2("", &r_q
->uni_name
, r_q
->hdr_name
.buffer
, ps
, depth
))
1439 if(!prs_uint32("unknown_0", ps
, depth
, &r_q
->unknown_0
))
1441 if(!prs_uint32("unknown_1", ps
, depth
, &r_q
->unknown_1
))
1447 /*******************************************************************
1449 ********************************************************************/
1451 void init_reg_r_open_entry(REG_R_OPEN_ENTRY
*r_r
,
1452 POLICY_HND
*pol
, uint32 status
)
1454 memcpy(&r_r
->pol
, pol
, sizeof(r_r
->pol
));
1455 r_r
->status
= status
;
1458 /*******************************************************************
1459 reads or writes a structure.
1460 ********************************************************************/
1462 BOOL
reg_io_r_open_entry(char *desc
, REG_R_OPEN_ENTRY
*r_r
, prs_struct
*ps
, int depth
)
1467 prs_debug(ps
, depth
, desc
, "reg_io_r_open_entry");
1473 if(!smb_io_pol_hnd("", &r_r
->pol
, ps
, depth
))
1476 if(!prs_uint32("status", ps
, depth
, &r_r
->status
))