summaryrefslogtreecommitdiff
path: root/source3/registry/reg_objects.c
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2005-06-25 17:31:40 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:58:03 -0500
commitbd509a81cb6c295988a1626adfe394c9778c005e (patch)
treeb502edb4ad16618ce557ac6e3de9769998657805 /source3/registry/reg_objects.c
parent433dcfc09e0c7b4023f1cfdb17a808811764179b (diff)
downloadsamba-bd509a81cb6c295988a1626adfe394c9778c005e.tar.gz
samba-bd509a81cb6c295988a1626adfe394c9778c005e.tar.bz2
samba-bd509a81cb6c295988a1626adfe394c9778c005e.zip
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)
Diffstat (limited to 'source3/registry/reg_objects.c')
-rw-r--r--source3/registry/reg_objects.c35
1 files changed, 23 insertions, 12 deletions
diff --git a/source3/registry/reg_objects.c b/source3/registry/reg_objects.c
index 582a696529..7ee2cd8414 100644
--- a/source3/registry/reg_objects.c
+++ b/source3/registry/reg_objects.c
@@ -114,7 +114,6 @@ BOOL regsubkey_ctr_key_exists( REGSUBKEY_CTR *ctr, const char *keyname )
}
return False;
-
}
/***********************************************************************
@@ -276,10 +275,24 @@ TALLOC_CTX* regval_ctr_getctx( REGVAL_CTR *val )
if ( !val )
return NULL;
- return val->ctx;
-}
+ return val->ctx; }
/***********************************************************************
+ Check for the existance of a value
+ **********************************************************************/
+
+BOOL regval_ctr_key_exists( REGVAL_CTR *ctr, const char *value )
+{
+ int i;
+
+ for ( i=0; i<ctr->num_values; i++ ) {
+ if ( strequal( ctr->values[i]->valuename, value) )
+ return True;
+ }
+
+ return False;
+}
+/***********************************************************************
Add a new registry value to the array
**********************************************************************/
@@ -291,6 +304,10 @@ int regval_ctr_addvalue( REGVAL_CTR *ctr, const char *name, uint16 type,
if ( !name )
return ctr->num_values;
+ /* Delete the current value (if it exists) and add the new one */
+
+ regval_ctr_delvalue( ctr, name );
+
/* allocate a slot in the array of pointers */
if ( ctr->num_values == 0 )
@@ -366,7 +383,7 @@ int regval_ctr_delvalue( REGVAL_CTR *ctr, const char *name )
return 0;
for ( i=0; i<ctr->num_values; i++ ) {
- if ( strcmp( ctr->values[i]->valuename, name ) == 0)
+ if ( strequal( ctr->values[i]->valuename, name ) )
break;
}
@@ -376,15 +393,9 @@ int regval_ctr_delvalue( REGVAL_CTR *ctr, const char *name )
return ctr->num_values;
/* just shift everything down one */
-
- for ( /* use previous i */; i<(ctr->num_values-1); i++ )
- memcpy( ctr->values[i], ctr->values[i+1], sizeof(REGISTRY_VALUE) );
-
- /* paranoia */
-
- ZERO_STRUCTP( ctr->values[i] );
-
ctr->num_values--;
+ if ( ctr->num_values )
+ memmove( ctr->values[i], ctr->values[i+1], sizeof(REGISTRY_VALUE)*(ctr->num_values-i) );
return ctr->num_values;
}