diff options
Diffstat (limited to 'source3/registry')
-rw-r--r-- | source3/registry/reg_frontend.c | 91 | ||||
-rw-r--r-- | source3/registry/reg_printing.c | 6 |
2 files changed, 93 insertions, 4 deletions
diff --git a/source3/registry/reg_frontend.c b/source3/registry/reg_frontend.c index c0788c1b75..45c1f24001 100644 --- a/source3/registry/reg_frontend.c +++ b/source3/registry/reg_frontend.c @@ -188,6 +188,38 @@ void free_registry_value( REGISTRY_VALUE *val ) return; } +/********************************************************************** + *********************************************************************/ + +uint8* regval_data_p( REGISTRY_VALUE *val ) +{ + return val->data_p; +} + +/********************************************************************** + *********************************************************************/ + +int regval_size( REGISTRY_VALUE *val ) +{ + return val->size; +} + +/********************************************************************** + *********************************************************************/ + +char* regval_name( REGISTRY_VALUE *val ) +{ + return val->valuename; +} + +/********************************************************************** + *********************************************************************/ + +uint32 regval_type( REGISTRY_VALUE *val ) +{ + return val->type; +} + /*********************************************************************** Retreive a pointer to a specific value. Caller shoud dup the structure since this memory may go away with a regval_ctr_destroy() @@ -214,7 +246,7 @@ TALLOC_CTX* regval_ctr_getctx( REGVAL_CTR *val ) } /*********************************************************************** - Add a new regostry value to the array + Add a new registry value to the array **********************************************************************/ int regval_ctr_addvalue( REGVAL_CTR *ctr, char *name, uint16 type, @@ -237,7 +269,7 @@ int regval_ctr_addvalue( REGVAL_CTR *ctr, char *name, uint16 type, ctr->values = ppreg; } - /* allocate a new valuie and store the pointer in the arrya */ + /* allocate a new value and store the pointer in the arrya */ ctr->values[ctr->num_values] = talloc( ctr->ctx, sizeof(REGISTRY_VALUE) ); @@ -254,6 +286,61 @@ int regval_ctr_addvalue( REGVAL_CTR *ctr, char *name, uint16 type, } /*********************************************************************** + Delete a single value from the registry container. + No need to free memory since it is talloc'd. + **********************************************************************/ + +int regval_ctr_delvalue( REGVAL_CTR *ctr, char *name ) +{ + int i; + + /* search for the value */ + + for ( i=0; i<ctr->num_values; i++ ) { + if ( strcmp( ctr->values[i]->valuename, name ) == 0) + break; + } + + /* just return if we don't find it */ + + if ( i == ctr->num_values ) + 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--; + + return ctr->num_values; +} + +/*********************************************************************** + Delete a single value from the registry container. + No need to free memory since it is talloc'd. + **********************************************************************/ + +REGISTRY_VALUE* regval_ctr_getvalue( REGVAL_CTR *ctr, char *name ) +{ + int i; + + /* search for the value */ + + for ( i=0; i<ctr->num_values; i++ ) { + if ( strcmp( ctr->values[i]->valuename, name ) == 0) + return ctr->values[i]; + + } + + return NULL; +} + +/*********************************************************************** free memory held by a REGVAL_CTR structure **********************************************************************/ diff --git a/source3/registry/reg_printing.c b/source3/registry/reg_printing.c index 3fd3680489..8f53fe9ea5 100644 --- a/source3/registry/reg_printing.c +++ b/source3/registry/reg_printing.c @@ -492,7 +492,7 @@ static int print_subpath_printers( char *key, REGSUBKEY_CTR *subkeys ) free_a_printer( &printer, 2 ); - regsubkey_ctr_addkey( subkeys, "PrinterDriverData" ); + regsubkey_ctr_addkey( subkeys, SPOOL_PRINTERDATA_KEY ); } /* no other subkeys below here */ @@ -620,7 +620,7 @@ static int print_subpath_values_printers( char *key, REGVAL_CTR *val ) /* here should be no more path components here */ - if ( new_path || strcmp(base, "PrinterDriverData") ) + if ( new_path || strcmp(base, SPOOL_PRINTERDATA_KEY) ) goto done; /* now enumerate the PrinterDriverData key */ @@ -632,10 +632,12 @@ static int print_subpath_values_printers( char *key, REGVAL_CTR *val ) /* iterate over all printer data and fill the regval container */ +#if 0 /* JERRY */ for ( i=0; get_specific_param_by_index(*printer, 2, i, valuename, &data, &type, &data_len); i++ ) { regval_ctr_addvalue( val, valuename, type, data, data_len ); } +#endif free_a_printer( &printer, 2 ); |