add another registry rpc (opnum 0x14). Have no idea what it's real name
authorGerald Carter <jerry@samba.org>
Mon, 29 Jul 2002 19:45:15 +0000 (19:45 +0000)
committerGerald Carter <jerry@samba.org>
Mon, 29 Jul 2002 19:45:15 +0000 (19:45 +0000)
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.

source/include/rpc_reg.h
source/rpc_parse/parse_reg.c
source/rpc_server/srv_reg.c
source/rpc_server/srv_reg_nt.c

index 41d332501585f2e7ce1459df8ec5b2cb97496658..92175cf287bd3983ba9e89f4d45da02ef6247d51 100644 (file)
@@ -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
 {
index 925d8b856e89c273f21ab8b00f235165a092288d..473e2554b40e0972f3390eaea3cf104863bcfc22 100644 (file)
@@ -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.
 ********************************************************************/
index cb96005db10df7f8aab376b8f8b3a262d388a117..d0aaf0199bd8e3280f293639c412b73a70b4633a 100644 (file)
@@ -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                     }
 };
 
index 7ebf940588c68b14a648f29d8cacf4210ac04ae0..cd9596d2a7280df2b0e473afbeb901d31bec4d97 100644 (file)
@@ -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;
+}
+