diff options
Diffstat (limited to 'source3/registry/reg_frontend.c')
-rw-r--r-- | source3/registry/reg_frontend.c | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/source3/registry/reg_frontend.c b/source3/registry/reg_frontend.c index f31f675997..05bcd989b4 100644 --- a/source3/registry/reg_frontend.c +++ b/source3/registry/reg_frontend.c @@ -253,12 +253,9 @@ int regval_ctr_addvalue( REGVAL_CTR *ctr, char *name, uint16 type, char *data_p, size_t size ) { REGISTRY_VALUE **ppreg; - uint16 len; if ( name ) { - len = strlen( name ); - /* allocate a slot in the array of pointers */ if ( ctr->num_values == 0 ) @@ -286,6 +283,42 @@ int regval_ctr_addvalue( REGVAL_CTR *ctr, char *name, uint16 type, } /*********************************************************************** + Add a new registry value to the array + **********************************************************************/ + +int regval_ctr_copyvalue( REGVAL_CTR *ctr, REGISTRY_VALUE *val ) +{ + REGISTRY_VALUE **ppreg; + + if ( val ) + { + /* allocate a slot in the array of pointers */ + + if ( ctr->num_values == 0 ) + ctr->values = talloc( ctr->ctx, sizeof(REGISTRY_VALUE*) ); + else { + ppreg = talloc_realloc( ctr->ctx, ctr->values, sizeof(REGISTRY_VALUE*)*(ctr->num_values+1) ); + if ( ppreg ) + ctr->values = ppreg; + } + + /* allocate a new value and store the pointer in the arrya */ + + ctr->values[ctr->num_values] = talloc( ctr->ctx, sizeof(REGISTRY_VALUE) ); + + /* init the value */ + + fstrcpy( ctr->values[ctr->num_values]->valuename, val->valuename ); + ctr->values[ctr->num_values]->type = val->type; + ctr->values[ctr->num_values]->data_p = talloc_memdup( ctr->ctx, val->data_p, val->size ); + ctr->values[ctr->num_values]->size = val->size; + ctr->num_values++; + } + + return ctr->num_values; +} + +/*********************************************************************** Delete a single value from the registry container. No need to free memory since it is talloc'd. **********************************************************************/ |