summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2002-07-29 19:45:15 +0000
committerGerald Carter <jerry@samba.org>2002-07-29 19:45:15 +0000
commitc17dc6c55c3a5a2912028a1d6a713f26b3b91c63 (patch)
tree6887d62732d1b9f10d164fd314ccf97de626a1d4
parent9f7e67c6f9eec4f21d5afbe323dc1c664ff52b54 (diff)
downloadsamba-c17dc6c55c3a5a2912028a1d6a713f26b3b91c63.tar.gz
samba-c17dc6c55c3a5a2912028a1d6a713f26b3b91c63.tar.bz2
samba-c17dc6c55c3a5a2912028a1d6a713f26b3b91c63.zip
add another registry rpc (opnum 0x14). Have no idea what it's real name
is. I'm calling it REG_SAVE_KEY, because 2k preps a regedt32.exe Registry->Save Key with this call. Done in the process of tracking down a PrinterDriverData issue. (This used to be commit 66104a361424f10cc986c597b91afa6f12b3cd8a)
-rw-r--r--source3/include/rpc_reg.h25
-rw-r--r--source3/rpc_parse/parse_reg.c60
-rw-r--r--source3/rpc_server/srv_reg.c26
-rw-r--r--source3/rpc_server/srv_reg_nt.c24
4 files changed, 130 insertions, 5 deletions
diff --git a/source3/include/rpc_reg.h b/source3/include/rpc_reg.h
index 41d3325015..92175cf287 100644
--- a/source3/include/rpc_reg.h
+++ b/source3/include/rpc_reg.h
@@ -38,7 +38,6 @@
#define _REG_UNK_0E 0x0e
#define _REG_UNK_12 0x12
#define _REG_UNK_13 0x13
-#define _REG_UNK_14 0x14
#define REG_SET_KEY_SEC 0x15
#define REG_CREATE_VALUE 0x16
#define _REG_UNK_17 0x17
@@ -56,6 +55,7 @@
#define REG_INFO 0x11
#define REG_SHUTDOWN 0x18
#define REG_ABORT_SHUTDOWN 0x19
+#define REG_SAVE_KEY 0x14 /* no idea what the real name is */
#define REG_UNKNOWN_1A 0x1a
@@ -455,6 +455,29 @@ typedef struct r_reg_unk_1a_info
} REG_R_UNKNOWN_1A;
+/* REG_Q_UNKNOWN_1A */
+typedef struct q_reg_unknown_14
+{
+ POLICY_HND pol; /* policy handle */
+
+ UNIHDR hdr_file; /* unicode product type header */
+ UNISTR2 uni_file; /* local filename to save key as from regedt32.exe */
+ /* e.g. "c:\temp\test.dat" */
+
+ uint32 unknown; /* 0x0000 0000 */
+
+} REG_Q_SAVE_KEY;
+
+
+/* REG_R_UNKNOWN_1A */
+typedef struct r_reg_unknown_14
+{
+ NTSTATUS status; /* return status */
+
+} REG_R_SAVE_KEY;
+
+
+
/* REG_Q_CLOSE */
typedef struct reg_q_close_info
{
diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c
index 925d8b856e..473e2554b4 100644
--- a/source3/rpc_parse/parse_reg.c
+++ b/source3/rpc_parse/parse_reg.c
@@ -1,4 +1,4 @@
-/*
+/*
* Unix SMB/CIFS implementation.
* RPC Pipe client / server routines
* Copyright (C) Andrew Tridgell 1992-1997,
@@ -669,7 +669,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;
@@ -685,6 +685,7 @@ void init_reg_q_unknown_1a(REG_Q_UNKNOWN_1A *q_o, POLICY_HND *hnd)
memcpy(&q_o->pol, hnd, sizeof(q_o->pol));
}
+
/*******************************************************************
reads or writes a structure.
********************************************************************/
@@ -699,7 +700,7 @@ BOOL reg_io_q_unknown_1a(char *desc, REG_Q_UNKNOWN_1A *r_q, prs_struct *ps, int
if(!prs_align(ps))
return False;
-
+
if(!smb_io_pol_hnd("", &r_q->pol, ps, depth))
return False;
@@ -720,7 +721,7 @@ BOOL reg_io_r_unknown_1a(char *desc, REG_R_UNKNOWN_1A *r_r, prs_struct *ps, int
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))
@@ -729,6 +730,57 @@ 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.
********************************************************************/
diff --git a/source3/rpc_server/srv_reg.c b/source3/rpc_server/srv_reg.c
index cb96005db1..d0aaf0199b 100644
--- a/source3/rpc_server/srv_reg.c
+++ b/source3/rpc_server/srv_reg.c
@@ -341,6 +341,31 @@ static BOOL api_reg_enum_value(pipes_struct *p)
return True;
}
+/*******************************************************************
+ api_reg_save_key
+ ********************************************************************/
+
+static BOOL api_reg_save_key(pipes_struct *p)
+{
+ REG_Q_SAVE_KEY q_u;
+ REG_R_SAVE_KEY r_u;
+ prs_struct *data = &p->in_data.data;
+ prs_struct *rdata = &p->out_data.rdata;
+
+ ZERO_STRUCT(q_u);
+ ZERO_STRUCT(r_u);
+
+ if(!reg_io_q_save_key("", &q_u, data, 0))
+ return False;
+
+ r_u.status = _reg_save_key(p, &q_u, &r_u);
+
+ if(!reg_io_r_save_key("", &r_u, rdata, 0))
+ return False;
+
+ return True;
+}
+
/*******************************************************************
@@ -360,6 +385,7 @@ static struct api_struct api_reg_cmds[] =
{ "REG_SHUTDOWN" , REG_SHUTDOWN , api_reg_shutdown },
{ "REG_ABORT_SHUTDOWN" , REG_ABORT_SHUTDOWN , api_reg_abort_shutdown },
{ "REG_UNKNOWN_1A" , REG_UNKNOWN_1A , api_reg_unknown_1a },
+ { "REG_SAVE_KEY" , REG_SAVE_KEY , api_reg_save_key },
{ NULL , 0 , NULL }
};
diff --git a/source3/rpc_server/srv_reg_nt.c b/source3/rpc_server/srv_reg_nt.c
index 7ebf940588..cd9596d2a7 100644
--- a/source3/rpc_server/srv_reg_nt.c
+++ b/source3/rpc_server/srv_reg_nt.c
@@ -622,4 +622,28 @@ NTSTATUS _reg_abort_shutdown(pipes_struct *p, REG_Q_ABORT_SHUTDOWN *q_u, REG_R_A
return status;
}
+/*******************************************************************
+ REG_SAVE_KEY (0x14)
+ ********************************************************************/
+
+NTSTATUS _reg_save_key(pipes_struct *p, REG_Q_SAVE_KEY *q_u, REG_R_SAVE_KEY *r_u)
+{
+ REGISTRY_KEY *regkey = find_regkey_index_by_hnd( p, &q_u->pol );
+
+ DEBUG(5,("_reg_save_key: Enter\n"));
+
+ /*
+ * basically this is a no op function which just gverifies
+ * that the client gave us a valid registry key handle
+ */
+
+ if ( !regkey )
+ return NT_STATUS_INVALID_HANDLE;
+
+ DEBUG(8,("_reg_save_key: berifying backup of key [%s]\n", regkey->name));
+
+
+ return NT_STATUS_OK;
+}
+