From bd509a81cb6c295988a1626adfe394c9778c005e Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Sat, 25 Jun 2005 17:31:40 +0000 Subject: r7908: * change REGISTRY_HOOK api to use const (fix compiler warning in init_registry_data() * Add means of storing registry values in registry.tdb * add builtin_registry_values[] array for REG_DWORD and REG_SZ values needed during startup * Finish up RegDeleteValue() and RegSetValue() * Finish up regdb_store_reg_values() and regdb_fetch_reg_values() I can now create and retrieve values using regedit.exe on Win2k. bin/net -S rain -U% rpc registry enumerate 'hklm\software\samba' Valuename = Version Type = REG_SZ Data = 3.0.20 Next is to do the virtual writes in reg_printing.c and I'll be done with Print Migrator (yeah! finally) (This used to be commit 3d837e58db9ded64d6b85f047012c7d487be4627) --- source3/rpc_server/srv_reg_nt.c | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) (limited to 'source3/rpc_server/srv_reg_nt.c') diff --git a/source3/rpc_server/srv_reg_nt.c b/source3/rpc_server/srv_reg_nt.c index 3b25f11359..0e4c49aa48 100644 --- a/source3/rpc_server/srv_reg_nt.c +++ b/source3/rpc_server/srv_reg_nt.c @@ -464,6 +464,7 @@ WERROR _reg_query_value(pipes_struct *p, REG_Q_QUERY_VALUE *q_u, REG_R_QUERY_VAL regval_ctr_init( ®vals ); + /* FIXME!!! Move these to a dynmanic lookup in the reg_fetch_values() */ /* couple of hard coded registry values */ if ( strequal(name, "RefusePasswordChange") ) { @@ -544,20 +545,6 @@ WERROR _reg_query_value(pipes_struct *p, REG_Q_QUERY_VALUE *q_u, REG_R_QUERY_VAL goto out; } - /* "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion" */ - - if ( strequal( name, "SystemRoot") ) { - value_length = push_ucs2( value, value, "c:\\windows", sizeof(value), STR_TERMINATE|STR_NOALIGN); - regval_ctr_addvalue( ®vals, "SystemRoot", REG_SZ, value, value_length ); - - val = dup_registry_value( regval_ctr_specific_value( ®vals, 0 ) ); - - status = WERR_OK; - - goto out; - } - - /* else fall back to actually looking up the value */ for ( i=0; fetch_reg_values_specific(regkey, &val, i); i++ ) @@ -1311,6 +1298,7 @@ WERROR _reg_set_value(pipes_struct *p, REG_Q_SET_VALUE *q_u, REG_R_SET_VALUE *r REGISTRY_KEY *key = find_regkey_index_by_hnd(p, &q_u->handle); REGVAL_CTR values; BOOL write_result; + fstring valuename; if ( !key ) return WERR_BADFID; @@ -1320,12 +1308,16 @@ WERROR _reg_set_value(pipes_struct *p, REG_Q_SET_VALUE *q_u, REG_R_SET_VALUE *r if ( !(key->access_granted & SEC_RIGHTS_SET_VALUE) ) return WERR_ACCESS_DENIED; + rpcstr_pull( valuename, q_u->name.string->buffer, sizeof(valuename), q_u->name.string->uni_str_len*2, 0 ); + + regval_ctr_init( &values ); /* lookup the current values and add the new one */ fetch_reg_values( key, &values ); - /* FIXME!!!! regval_ctr_addvalue( &values, .... ); */ + + regval_ctr_addvalue( &values, valuename, q_u->type, q_u->value.buffer, q_u->value.buf_len ); /* now write to the registry backend */ @@ -1440,7 +1432,8 @@ WERROR _reg_delete_value(pipes_struct *p, REG_Q_DELETE_VALUE *q_u, REG_R_DELETE REGISTRY_KEY *key = find_regkey_index_by_hnd(p, &q_u->handle); REGVAL_CTR values; BOOL write_result; - + fstring valuename; + if ( !key ) return WERR_BADFID; @@ -1448,13 +1441,16 @@ WERROR _reg_delete_value(pipes_struct *p, REG_Q_DELETE_VALUE *q_u, REG_R_DELETE if ( !(key->access_granted & SEC_RIGHTS_SET_VALUE) ) return WERR_ACCESS_DENIED; - + + rpcstr_pull( valuename, q_u->name.string->buffer, sizeof(valuename), q_u->name.string->uni_str_len*2, 0 ); + regval_ctr_init( &values ); /* lookup the current values and add the new one */ fetch_reg_values( key, &values ); - /* FIXME!!!! regval_ctr_delval( &values, .... ); */ + + regval_ctr_delvalue( &values, valuename ); /* now write to the registry backend */ -- cgit