summaryrefslogtreecommitdiff
path: root/source3/rpc_parse/parse_reg.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/rpc_parse/parse_reg.c')
-rw-r--r--source3/rpc_parse/parse_reg.c76
1 files changed, 69 insertions, 7 deletions
diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c
index 2698e82440..365ad2dc70 100644
--- a/source3/rpc_parse/parse_reg.c
+++ b/source3/rpc_parse/parse_reg.c
@@ -34,13 +34,79 @@
static uint32 reg_init_buffer2( BUFFER2 *buf2, REGISTRY_VALUE *val )
{
+ UNISTR2 unistr;
uint32 real_size = 0;
+ char *string;
+ char *list = NULL;
+ char *list2 = NULL;
if ( !buf2 || !val )
return 0;
- real_size = regval_size(val);
- init_buffer2( buf2, (char*)regval_data_p(val), real_size );
+ real_size = val->size;
+
+ switch (val->type )
+ {
+ case REG_SZ:
+ string = (char*)val->data_p;
+ DEBUG(10,("reg_init_buffer2: REG_SZ string => [%s]\n", string));
+
+ init_unistr2( &unistr, (char*)val->data_p, strlen((char*)val->data_p)+1 );
+ init_buffer2( buf2, (char*)unistr.buffer, unistr.uni_str_len*2 );
+ real_size = unistr.uni_str_len*2;
+ break;
+
+ case REG_MULTI_SZ:
+ string = (char*)val->data_p;
+ real_size = 0;
+ while ( string && *string )
+ {
+ DEBUG(10,("reg_init_buffer2: REG_MULTI_SZ string => [%s], size => [%d]\n", string, real_size ));
+
+ init_unistr2( &unistr, string, strlen(string)+1 );
+
+ list2 = Realloc( list, real_size + unistr.uni_str_len*2 );
+ if ( !list2 )
+ break;
+ list = list2;
+
+ memcpy( list+real_size, unistr.buffer, unistr.uni_str_len*2 );
+
+ real_size += unistr.uni_str_len*2;
+
+ string += strlen(string)+1;
+ }
+
+ list2 = Realloc( list, real_size + 2 );
+ if ( !list2 )
+ break;
+ list = list2;
+ list[real_size++] = 0x0;
+ list[real_size++] = 0x0;
+
+ init_buffer2( buf2, (char*)list, real_size );
+
+ DEBUG(10,("reg_init_buffer2: REG_MULTI_SZ size => [%d]\n", real_size ));
+
+ break;
+
+ case REG_BINARY:
+ DEBUG(10,("reg_init_buffer2: REG_BINARY size => [%d]\n", val->size ));
+
+ init_buffer2( buf2, val->data_p, val->size );
+ break;
+
+ case REG_DWORD:
+ DEBUG(10,("reg_init_buffer2: REG_DWORD value => [%d]\n", *(uint32*)val->data_p));
+ init_buffer2( buf2, val->data_p, val->size );
+ break;
+
+ default:
+ DEBUG(0,("reg_init_buffer2: Unsupported registry data type [%d]\n", val->type));
+ break;
+ }
+
+ SAFE_FREE( list );
return real_size;
}
@@ -1701,11 +1767,7 @@ BOOL reg_io_q_open_entry(char *desc, REG_Q_OPEN_ENTRY *r_q, prs_struct *ps, int
void init_reg_r_open_entry(REG_R_OPEN_ENTRY *r_r,
POLICY_HND *pol, NTSTATUS status)
{
- if (NT_STATUS_IS_OK(status)) {
- memcpy(&r_r->pol, pol, sizeof(r_r->pol));
- } else {
- ZERO_STRUCT(r_r->pol);
- }
+ memcpy(&r_r->pol, pol, sizeof(r_r->pol));
r_r->status = status;
}