summaryrefslogtreecommitdiffstats
path: root/source/rpc_parse/parse_reg.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/rpc_parse/parse_reg.c')
-rw-r--r--source/rpc_parse/parse_reg.c276
1 files changed, 45 insertions, 231 deletions
diff --git a/source/rpc_parse/parse_reg.c b/source/rpc_parse/parse_reg.c
index 2698e824407..c26aaee3c30 100644
--- a/source/rpc_parse/parse_reg.c
+++ b/source/rpc_parse/parse_reg.c
@@ -1,12 +1,12 @@
-/*
- * Unix SMB/CIFS implementation.
+/*
+ * Unix SMB/Netbios implementation.
+ * Version 1.9.
* RPC Pipe client / server routines
* Copyright (C) Andrew Tridgell 1992-1997,
* Copyright (C) Luke Kenneth Casson Leighton 1996-1997,
* Copyright (C) Paul Ashton 1997.
* Copyright (C) Marc Jacobsen 1999.
* Copyright (C) Simo Sorce 2000.
- * Copyright (C) Gerald Carter 2002.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -25,26 +25,6 @@
#include "includes.h"
-#undef DBGC_CLASS
-#define DBGC_CLASS DBGC_RPC_PARSE
-
-/*******************************************************************
- Fill in a BUFFER2 for the data given a REGISTRY_VALUE
- *******************************************************************/
-
-static uint32 reg_init_buffer2( BUFFER2 *buf2, REGISTRY_VALUE *val )
-{
- uint32 real_size = 0;
-
- if ( !buf2 || !val )
- return 0;
-
- real_size = regval_size(val);
- init_buffer2( buf2, (char*)regval_data_p(val), real_size );
-
- return real_size;
-}
-
/*******************************************************************
Inits a structure.
********************************************************************/
@@ -147,11 +127,11 @@ BOOL reg_io_q_open_hklm(char *desc, REG_Q_OPEN_HKLM * r_q, prs_struct *ps,
if (r_q->ptr != 0)
{
if (!prs_uint16("unknown_0", ps, depth, &(r_q->unknown_0)))
- return False;
+ return False;
if (!prs_uint16("unknown_1", ps, depth, &(r_q->unknown_1)))
- return False;
+ return False;
if (!prs_uint32("access_mask", ps, depth, &(r_q->access_mask)))
- return False;
+ return False;
}
return True;
@@ -183,8 +163,6 @@ BOOL reg_io_r_open_hklm(char *desc, REG_R_OPEN_HKLM * r_r, prs_struct *ps,
}
-
-
/*******************************************************************
Inits a structure.
********************************************************************/
@@ -591,7 +569,7 @@ BOOL reg_io_r_query_key(char *desc, REG_R_QUERY_KEY *r_r, prs_struct *ps, int d
return False;
if(!prs_uint32("max_subkeylen ", ps, depth, &r_r->max_subkeylen))
return False;
- if(!prs_uint32("reserved ", ps, depth, &r_r->reserved))
+ if(!prs_uint32("mak_subkeysize", ps, depth, &r_r->max_subkeysize))
return False;
if(!prs_uint32("num_values ", ps, depth, &r_r->num_values))
return False;
@@ -603,7 +581,7 @@ BOOL reg_io_r_query_key(char *desc, REG_R_QUERY_KEY *r_r, prs_struct *ps, int d
return False;
if(!smb_io_time("mod_time ", &r_r->mod_time, ps, depth))
return False;
-
+
if(!prs_ntstatus("status", ps, depth, &r_r->status))
return False;
@@ -614,27 +592,26 @@ BOOL reg_io_r_query_key(char *desc, REG_R_QUERY_KEY *r_r, prs_struct *ps, int d
Inits a structure.
********************************************************************/
-void init_reg_q_unknown_1a(REG_Q_UNKNOWN_1A *q_o, POLICY_HND *hnd)
+void init_reg_q_unk_1a(REG_Q_UNK_1A *q_o, POLICY_HND *hnd)
{
memcpy(&q_o->pol, hnd, sizeof(q_o->pol));
}
-
/*******************************************************************
reads or writes a structure.
********************************************************************/
-BOOL reg_io_q_unknown_1a(char *desc, REG_Q_UNKNOWN_1A *r_q, prs_struct *ps, int depth)
+BOOL reg_io_q_unk_1a(char *desc, REG_Q_UNK_1A *r_q, prs_struct *ps, int depth)
{
if (r_q == NULL)
return False;
- prs_debug(ps, depth, desc, "reg_io_q_unknown_1a");
+ prs_debug(ps, depth, desc, "reg_io_q_unk_1a");
depth++;
if(!prs_align(ps))
return False;
-
+
if(!smb_io_pol_hnd("", &r_q->pol, ps, depth))
return False;
@@ -645,17 +622,17 @@ BOOL reg_io_q_unknown_1a(char *desc, REG_Q_UNKNOWN_1A *r_q, prs_struct *ps, int
reads or writes a structure.
********************************************************************/
-BOOL reg_io_r_unknown_1a(char *desc, REG_R_UNKNOWN_1A *r_r, prs_struct *ps, int depth)
+BOOL reg_io_r_unk_1a(char *desc, REG_R_UNK_1A *r_r, prs_struct *ps, int depth)
{
if (r_r == NULL)
return False;
- prs_debug(ps, depth, desc, "reg_io_r_unknown_1a");
+ prs_debug(ps, depth, desc, "reg_io_r_unk_1a");
depth++;
if(!prs_align(ps))
return False;
-
+
if(!prs_uint32("unknown", ps, depth, &r_r->unknown))
return False;
if(!prs_ntstatus("status" , ps, depth, &r_r->status))
@@ -664,68 +641,17 @@ BOOL reg_io_r_unknown_1a(char *desc, REG_R_UNKNOWN_1A *r_r, prs_struct *ps, int
return True;
}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-BOOL reg_io_q_save_key(char *desc, REG_Q_SAVE_KEY *r_q, prs_struct *ps, int depth)
-{
- if (r_q == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "reg_io_q_save_key");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("", &r_q->pol, ps, depth))
- return False;
-
- if(!smb_io_unihdr ("hdr_file", &r_q->hdr_file, ps, depth))
- return False;
- if(!smb_io_unistr2("uni_file", &r_q->uni_file, r_q->hdr_file.buffer, ps, depth))
- return False;
-
- if(!prs_uint32("unknown", ps, depth, &r_q->unknown))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-BOOL reg_io_r_save_key(char *desc, REG_R_SAVE_KEY *r_r, prs_struct *ps, int depth)
-{
- if (r_r == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "reg_io_r_save_key");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_ntstatus("status" , ps, depth, &r_r->status))
- return False;
-
- return True;
-}
-
/*******************************************************************
Inits a structure.
********************************************************************/
void init_reg_q_open_hku(REG_Q_OPEN_HKU *q_o,
- uint16 unknown_0, uint32 access_mask)
+ uint16 unknown_0, uint32 level)
{
q_o->ptr = 1;
q_o->unknown_0 = unknown_0;
q_o->unknown_1 = 0x0; /* random - changes */
- q_o->access_mask = access_mask;
+ q_o->level = level;
}
/*******************************************************************
@@ -746,11 +672,11 @@ BOOL reg_io_q_open_hku(char *desc, REG_Q_OPEN_HKU *r_q, prs_struct *ps, int dep
if(!prs_uint32("ptr ", ps, depth, &r_q->ptr))
return False;
if (r_q->ptr != 0) {
- if(!prs_uint16("unknown_0 ", ps, depth, &r_q->unknown_0))
+ if(!prs_uint16("unknown_0", ps, depth, &r_q->unknown_0))
return False;
- if(!prs_uint16("unknown_1 ", ps, depth, &r_q->unknown_1))
+ if(!prs_uint16("unknown_1", ps, depth, &r_q->unknown_1))
return False;
- if(!prs_uint32("access_mask ", ps, depth, &r_q->access_mask))
+ if(!prs_uint32("level ", ps, depth, &r_q->level))
return False;
}
@@ -801,7 +727,7 @@ BOOL reg_io_q_close(char *desc, REG_Q_CLOSE *q_u, prs_struct *ps, int depth)
if (q_u == NULL)
return False;
- prs_debug(ps, depth, desc, "reg_io_q_close");
+ prs_debug(ps, depth, desc, "reg_io_q_unknown_1");
depth++;
if(!prs_align(ps))
@@ -824,7 +750,7 @@ BOOL reg_io_r_close(char *desc, REG_R_CLOSE *r_u, prs_struct *ps, int depth)
if (r_u == NULL)
return False;
- prs_debug(ps, depth, desc, "reg_io_r_close");
+ prs_debug(ps, depth, desc, "reg_io_r_unknown_1");
depth++;
if(!prs_align(ps))
@@ -1097,77 +1023,33 @@ BOOL reg_io_q_info(char *desc, REG_Q_INFO *r_q, prs_struct *ps, int depth)
/*******************************************************************
Inits a structure.
- New version to replace older init_reg_r_info()
-********************************************************************/
-
-BOOL new_init_reg_r_info(uint32 include_keyval, REG_R_INFO *r_r,
- REGISTRY_VALUE *val, NTSTATUS status)
-{
- uint32 buf_len = 0;
- BUFFER2 buf2;
-
- if(r_r == NULL)
- return False;
-
- if ( !val )
- return False;
-
- r_r->ptr_type = 1;
- r_r->type = val->type;
-
- /* if include_keyval is not set, don't send the key value, just
- the buflen data. probably used by NT5 to allocate buffer space - SK */
-
- if ( include_keyval ) {
- r_r->ptr_uni_val = 1;
- buf_len = reg_init_buffer2( &r_r->uni_val, val );
-
- }
- else {
- /* dummy buffer used so we can get the size */
- r_r->ptr_uni_val = 0;
- buf_len = reg_init_buffer2( &buf2, val );
- }
-
- r_r->ptr_max_len = 1;
- r_r->buf_max_len = buf_len;
-
- r_r->ptr_len = 1;
- r_r->buf_len = buf_len;
-
- r_r->status = status;
-
- return True;
-}
-
-/*******************************************************************
- Inits a structure.
********************************************************************/
BOOL init_reg_r_info(uint32 include_keyval, REG_R_INFO *r_r,
BUFFER2* buf, uint32 type, NTSTATUS status)
{
- if(r_r == NULL)
- return False;
-
- r_r->ptr_type = 1;
- r_r->type = type;
+ if(r_r == NULL)
+ return False;
- /* if include_keyval is not set, don't send the key value, just
- the buflen data. probably used by NT5 to allocate buffer space - SK */
+
+ r_r->ptr_type = 1;
+ r_r->type = type;
- r_r->ptr_uni_val = include_keyval ? 1:0;
- r_r->uni_val = *buf;
+ /* if include_keyval is not set, don't send the key value, just
+ the buflen data. probably used by NT5 to allocate buffer space - SK */
+ r_r->ptr_uni_val = include_keyval ? 1:0;
+ r_r->uni_val = buf;
- r_r->ptr_max_len = 1;
- r_r->buf_max_len = r_r->uni_val.buf_max_len;
+ r_r->ptr_max_len = 1;
+ r_r->buf_max_len = r_r->uni_val->buf_max_len;
- r_r->ptr_len = 1;
- r_r->buf_len = r_r->uni_val.buf_len;
+ r_r->ptr_len = 1;
+ r_r->buf_len = r_r->uni_val->buf_len;
- r_r->status = status;
+ r_r->status = status;
- return True;
+ return True;
+
}
/*******************************************************************
@@ -1197,7 +1079,7 @@ BOOL reg_io_r_info(char *desc, REG_R_INFO *r_r, prs_struct *ps, int depth)
return False;
if(r_r->ptr_uni_val != 0) {
- if(!smb_io_buffer2("uni_val", &r_r->uni_val, r_r->ptr_uni_val, ps, depth))
+ if(!smb_io_buffer2("uni_val", r_r->uni_val, r_r->ptr_uni_val, ps, depth))
return False;
}
@@ -1255,46 +1137,6 @@ void init_reg_q_enum_val(REG_Q_ENUM_VALUE *q_i, POLICY_HND *pol,
}
/*******************************************************************
-makes a structure.
-********************************************************************/
-
-void init_reg_r_enum_val(REG_R_ENUM_VALUE *r_u, REGISTRY_VALUE *val )
-{
- uint32 real_size;
-
- DEBUG(8,("init_reg_r_enum_val: Enter\n"));
-
- ZERO_STRUCTP(r_u);
-
- /* value name */
-
- DEBUG(10,("init_reg_r_enum_val: Valuename => [%s]\n", val->valuename));
-
- init_uni_hdr( &r_u->hdr_name, strlen(val->valuename)+1 );
- init_unistr2( &r_u->uni_name, val->valuename, strlen(val->valuename)+1 );
-
- /* type */
-
- r_u->ptr_type = 1;
- r_u->type = val->type;
-
- /* REG_SZ & REG_MULTI_SZ must be converted to UNICODE */
-
- r_u->ptr_value = 1;
- real_size = reg_init_buffer2( &r_u->buf_value, val );
-
- /* lengths */
-
- r_u->ptr1 = 1;
- r_u->len_value1 = real_size;
-
- r_u->ptr2 = 1;
- r_u->len_value2 = real_size;
-
- DEBUG(8,("init_reg_r_enum_val: Exit\n"));
-}
-
-/*******************************************************************
reads or writes a structure.
********************************************************************/
@@ -1314,7 +1156,6 @@ BOOL reg_io_q_enum_val(char *desc, REG_Q_ENUM_VALUE *q_q, prs_struct *ps, int d
if(!prs_uint32("val_index", ps, depth, &q_q->val_index))
return False;
-
if(!smb_io_unihdr ("hdr_name", &q_q->hdr_name, ps, depth))
return False;
if(!smb_io_unistr2("uni_name", &q_q->uni_name, q_q->hdr_name.buffer, ps, depth))
@@ -1385,7 +1226,7 @@ BOOL reg_io_r_enum_val(char *desc, REG_R_ENUM_VALUE *r_q, prs_struct *ps, int d
if(!prs_uint32("ptr_value", ps, depth, &r_q->ptr_value))
return False;
- if(!smb_io_buffer2("buf_value", &r_q->buf_value, r_q->ptr_value, ps, depth))
+ if(!smb_io_buffer2("buf_value", r_q->buf_value, r_q->ptr_value, ps, depth))
return False;
if(!prs_align(ps))
return False;
@@ -1511,29 +1352,6 @@ void init_reg_q_enum_key(REG_Q_ENUM_KEY *q_i, POLICY_HND *pol, uint32 key_idx)
}
/*******************************************************************
-makes a reply structure.
-********************************************************************/
-
-void init_reg_r_enum_key(REG_R_ENUM_KEY *r_u, char *subkey, uint32 unknown_1,
- uint32 unknown_2)
-{
- if ( !r_u )
- return;
-
- r_u->unknown_1 = unknown_1;
- r_u->unknown_2 = unknown_2;
- r_u->unknown_3 = 0x0;
-
- r_u->key_name_len = (strlen(subkey)+1) * 2;
- if (r_u->key_name_len)
- r_u->ptr1 = 0x1;
- init_unistr3( &r_u->key_name, subkey );
-
- r_u->ptr2 = 0x1;
- r_u->ptr3 = 0x1;
-}
-
-/*******************************************************************
reads or writes a structure.
********************************************************************/
@@ -1648,7 +1466,7 @@ makes a structure.
********************************************************************/
void init_reg_q_open_entry(REG_Q_OPEN_ENTRY *r_q, POLICY_HND *pol,
- char *key_name, uint32 access_desired)
+ char *key_name, uint32 unk)
{
int len_name = strlen(key_name)+1;
@@ -1658,7 +1476,7 @@ void init_reg_q_open_entry(REG_Q_OPEN_ENTRY *r_q, POLICY_HND *pol,
init_unistr2(&r_q->uni_name, key_name, len_name);
r_q->unknown_0 = 0x00000000;
- r_q->access_desired = access_desired;
+ r_q->unknown_1 = unk;
}
/*******************************************************************
@@ -1686,9 +1504,9 @@ BOOL reg_io_q_open_entry(char *desc, REG_Q_OPEN_ENTRY *r_q, prs_struct *ps, int
if(!prs_align(ps))
return False;
- if(!prs_uint32("unknown_0 ", ps, depth, &r_q->unknown_0))
+ if(!prs_uint32("unknown_0", ps, depth, &r_q->unknown_0))
return False;
- if(!prs_uint32("access_desired ", ps, depth, &r_q->access_desired))
+ if(!prs_uint32("unknown_1", ps, depth, &r_q->unknown_1))
return False;
return True;
@@ -1701,11 +1519,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;
}