1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-27 03:21:53 +03:00

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 66104a3614)
This commit is contained in:
Gerald Carter 2002-07-29 19:45:15 +00:00
parent 9f7e67c6f9
commit c17dc6c55c
4 changed files with 130 additions and 5 deletions

View 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
{

View 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.
********************************************************************/

View 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 }
};

View 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;
}