summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2005-06-30 02:59:29 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:58:08 -0500
commitb319bdd32f49f32b6d27681e1a23dfb6ba4bb878 (patch)
tree1cb0fe20571ccdc27f3927fc4d80532fa6cb2d50
parentaa3b0b190d4069c817f63e36e95b86f43a8a6067 (diff)
downloadsamba-b319bdd32f49f32b6d27681e1a23dfb6ba4bb878.tar.gz
samba-b319bdd32f49f32b6d27681e1a23dfb6ba4bb878.tar.bz2
samba-b319bdd32f49f32b6d27681e1a23dfb6ba4bb878.zip
r8007: * cleanup unused structure from reg_objects.h
* make regdb_store_XXX() and regdb_fetch_XXX() functions non-static * use case sensitive string lookups in reg_dynamic.c since the keys have already been normalized * move to new design for making printing related data available via the winreg pipe (with the intent of allowing writes) (This used to be commit 28c7293ee9e68b913faf8d74d63f73e09087169b)
-rw-r--r--source3/include/reg_objects.h13
-rw-r--r--source3/registry/reg_db.c60
-rw-r--r--source3/registry/reg_dynamic.c4
-rw-r--r--source3/registry/reg_printing.c461
4 files changed, 359 insertions, 179 deletions
diff --git a/source3/include/reg_objects.h b/source3/include/reg_objects.h
index 753425a7f9..f6716eba4f 100644
--- a/source3/include/reg_objects.h
+++ b/source3/include/reg_objects.h
@@ -47,18 +47,5 @@ typedef struct {
char **subkeys;
} REGSUBKEY_CTR;
-/* represent a registry key with all its subkeys and values */
-
-struct _regobj_key;
-
-typedef struct _regobj_key {
- TALLOC_CTX *ctx;
-
- char *name;
-
- REGVAL_CTR values;
- REGSUBKEY_CTR subkeys;
-} REGOBJ_KEY;
-
#endif /* _REG_OBJECTS_H */
diff --git a/source3/registry/reg_db.c b/source3/registry/reg_db.c
index 741bc4127b..ce9d68a264 100644
--- a/source3/registry/reg_db.c
+++ b/source3/registry/reg_db.c
@@ -29,14 +29,6 @@ static TDB_CONTEXT *tdb_reg;
#define VALUE_PREFIX "SAMBA_REGVAL"
-static BOOL regdb_store_reg_keys( const char *keyname, REGSUBKEY_CTR *subkeys );
-static BOOL regdb_store_reg_values( const char *keyname, REGVAL_CTR *values);
-static int regdb_fetch_reg_keys( const char* key, REGSUBKEY_CTR *subkeys );
-static int regdb_fetch_reg_values( const char* key, REGVAL_CTR *values );
-
-
-
-
/* List the deepest path into the registry. All part components will be created.*/
/* If you want to have a part of the path controlled by the tdb abd part by
@@ -129,10 +121,10 @@ static BOOL init_registry_data( void )
regsubkey_ctr_init( &subkeys );
- regdb_fetch_reg_keys( base, &subkeys );
+ regdb_fetch_keys( base, &subkeys );
if ( *subkeyname )
regsubkey_ctr_addkey( &subkeys, subkeyname );
- if ( !regdb_store_reg_keys( base, &subkeys ))
+ if ( !regdb_store_keys( base, &subkeys ))
return False;
regsubkey_ctr_destroy( &subkeys );
@@ -144,7 +136,7 @@ static BOOL init_registry_data( void )
for ( i=0; builtin_registry_values[i].path != NULL; i++ ) {
regval_ctr_init( &values );
- regdb_fetch_reg_values( builtin_registry_values[i].path, &values );
+ regdb_fetch_values( builtin_registry_values[i].path, &values );
switch( builtin_registry_values[i].type ) {
case REG_DWORD:
regval_ctr_addvalue( &values,
@@ -167,7 +159,7 @@ static BOOL init_registry_data( void )
DEBUG(0,("init_registry_data: invalid value type in builtin_registry_values [%d]\n",
builtin_registry_values[i].type));
}
- regdb_store_reg_values( builtin_registry_values[i].path, &values );
+ regdb_store_values( builtin_registry_values[i].path, &values );
regval_ctr_destroy( &values );
}
@@ -223,7 +215,7 @@ BOOL init_registry_db( void )
fstrings
***********************************************************************/
-static BOOL regdb_store_reg_keys_internal( const char *key, REGSUBKEY_CTR *ctr )
+static BOOL regdb_store_keys_internal( const char *key, REGSUBKEY_CTR *ctr )
{
TDB_DATA kbuf, dbuf;
char *buffer, *tmpbuf;
@@ -256,7 +248,7 @@ static BOOL regdb_store_reg_keys_internal( const char *key, REGSUBKEY_CTR *ctr )
if ( len > buflen ) {
/* allocate some extra space */
if ((tmpbuf = SMB_REALLOC( buffer, len*2 )) == NULL) {
- DEBUG(0,("regdb_store_reg_keys: Failed to realloc memory of size [%d]\n", len*2));
+ DEBUG(0,("regdb_store_keys: Failed to realloc memory of size [%d]\n", len*2));
ret = False;
goto done;
}
@@ -289,7 +281,7 @@ done:
do not currently exist
***********************************************************************/
-static BOOL regdb_store_reg_keys( const char *key, REGSUBKEY_CTR *ctr )
+BOOL regdb_store_keys( const char *key, REGSUBKEY_CTR *ctr )
{
int num_subkeys, i;
pstring path;
@@ -299,12 +291,12 @@ static BOOL regdb_store_reg_keys( const char *key, REGSUBKEY_CTR *ctr )
/* fetch a list of the old subkeys so we can determine if any were deleted */
regsubkey_ctr_init( &old_subkeys );
- regdb_fetch_reg_keys( key, &old_subkeys );
+ regdb_fetch_keys( key, &old_subkeys );
/* store the subkey list for the parent */
- if ( !regdb_store_reg_keys_internal( key, ctr ) ) {
- DEBUG(0,("regdb_store_reg_keys: Failed to store new subkey list for parent [%s}\n", key ));
+ if ( !regdb_store_keys_internal( key, ctr ) ) {
+ DEBUG(0,("regdb_store_keys: Failed to store new subkey list for parent [%s}\n", key ));
return False;
}
@@ -328,10 +320,10 @@ static BOOL regdb_store_reg_keys( const char *key, REGSUBKEY_CTR *ctr )
for ( i=0; i<num_subkeys; i++ ) {
pstr_sprintf( path, "%s%c%s", key, '/', regsubkey_ctr_specific_key( ctr, i ) );
regsubkey_ctr_init( &subkeys );
- if ( regdb_fetch_reg_keys( path, &subkeys ) == -1 ) {
+ if ( regdb_fetch_keys( path, &subkeys ) == -1 ) {
/* create a record with 0 subkeys */
- if ( !regdb_store_reg_keys_internal( path, &subkeys ) ) {
- DEBUG(0,("regdb_store_reg_keys: Failed to store new record for key [%s}\n", path ));
+ if ( !regdb_store_keys_internal( path, &subkeys ) ) {
+ DEBUG(0,("regdb_store_keys: Failed to store new record for key [%s}\n", path ));
regsubkey_ctr_destroy( &subkeys );
return False;
}
@@ -348,7 +340,7 @@ static BOOL regdb_store_reg_keys( const char *key, REGSUBKEY_CTR *ctr )
released by the caller.
***********************************************************************/
-static int regdb_fetch_reg_keys( const char* key, REGSUBKEY_CTR *ctr )
+int regdb_fetch_keys( const char* key, REGSUBKEY_CTR *ctr )
{
pstring path;
uint32 num_items;
@@ -358,7 +350,7 @@ static int regdb_fetch_reg_keys( const char* key, REGSUBKEY_CTR *ctr )
int i;
fstring subkeyname;
- DEBUG(10,("regdb_fetch_reg_keys: Enter key => [%s]\n", key ? key : "NULL"));
+ DEBUG(10,("regdb_fetch_keys: Enter key => [%s]\n", key ? key : "NULL"));
pstrcpy( path, key );
@@ -372,7 +364,7 @@ static int regdb_fetch_reg_keys( const char* key, REGSUBKEY_CTR *ctr )
buflen = dbuf.dsize;
if ( !buf ) {
- DEBUG(5,("regdb_fetch_reg_keys: tdb lookup failed to locate key [%s]\n", key));
+ DEBUG(5,("regdb_fetch_keys: tdb lookup failed to locate key [%s]\n", key));
return -1;
}
@@ -385,7 +377,7 @@ static int regdb_fetch_reg_keys( const char* key, REGSUBKEY_CTR *ctr )
SAFE_FREE( dbuf.dptr );
- DEBUG(10,("regdb_fetch_reg_keys: Exit [%d] items\n", num_items));
+ DEBUG(10,("regdb_fetch_keys: Exit [%d] items\n", num_items));
return num_items;
}
@@ -472,13 +464,13 @@ static int regdb_pack_values(REGVAL_CTR *values, char *buf, int buflen)
released by the caller.
***********************************************************************/
-static int regdb_fetch_reg_values( const char* key, REGVAL_CTR *values )
+int regdb_fetch_values( const char* key, REGVAL_CTR *values )
{
TDB_DATA data;
pstring keystr;
int len;
- DEBUG(10,("regdb_fetch_reg_values: Looking for value of key [%s] \n", key));
+ DEBUG(10,("regdb_fetch_values: Looking for value of key [%s] \n", key));
pstr_sprintf( keystr, "%s/%s", VALUE_PREFIX, key );
normalize_reg_path( keystr );
@@ -502,19 +494,19 @@ static int regdb_fetch_reg_values( const char* key, REGVAL_CTR *values )
values in the registry.tdb
***********************************************************************/
-static BOOL regdb_store_reg_values( const char *key, REGVAL_CTR *values )
+BOOL regdb_store_values( const char *key, REGVAL_CTR *values )
{
TDB_DATA data;
pstring keystr;
int len, ret;
- DEBUG(10,("regdb_store_reg_values: Looking for value of key [%s] \n", key));
+ DEBUG(10,("regdb_store_values: Looking for value of key [%s] \n", key));
ZERO_STRUCT( data );
len = regdb_pack_values( values, data.dptr, data.dsize );
if ( len <= 0 ) {
- DEBUG(0,("regdb_store_reg_values: unable to pack values. len <= 0\n"));
+ DEBUG(0,("regdb_store_values: unable to pack values. len <= 0\n"));
return False;
}
@@ -541,10 +533,10 @@ static BOOL regdb_store_reg_values( const char *key, REGVAL_CTR *values )
*/
REGISTRY_OPS regdb_ops = {
- regdb_fetch_reg_keys,
- regdb_fetch_reg_values,
- regdb_store_reg_keys,
- regdb_store_reg_values,
+ regdb_fetch_keys,
+ regdb_fetch_values,
+ regdb_store_keys,
+ regdb_store_values,
NULL
};
diff --git a/source3/registry/reg_dynamic.c b/source3/registry/reg_dynamic.c
index 926b96463a..7f8f664ec6 100644
--- a/source3/registry/reg_dynamic.c
+++ b/source3/registry/reg_dynamic.c
@@ -123,7 +123,7 @@ int fetch_dynamic_reg_values( REGISTRY_KEY *key, REGVAL_CTR *val )
normalize_reg_path( path );
for ( i=0; dynamic_values[i].path; i++ ) {
- if ( strequal( path, dynamic_values[i].path ) )
+ if ( strcmp( path, dynamic_values[i].path ) == 0 )
return dynamic_values[i].fetch_values( val );
}
@@ -143,7 +143,7 @@ BOOL check_dynamic_reg_values( REGISTRY_KEY *key )
for ( i=0; dynamic_values[i].path; i++ ) {
/* can't write to dynamic keys */
- if ( strequal( path, dynamic_values[i].path ) )
+ if ( strcmp( path, dynamic_values[i].path ) == 0 )
return True;
}
diff --git a/source3/registry/reg_printing.c b/source3/registry/reg_printing.c
index 6fedb524d6..275532b042 100644
--- a/source3/registry/reg_printing.c
+++ b/source3/registry/reg_printing.c
@@ -25,6 +25,19 @@
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_RPC_SRV
+struct reg_dyn_tree {
+ /* full key path in normalized form */
+ const char *path;
+
+ /* callbscks for fetch/store operations */
+ int ( *fetch_subkeys) ( const char *path, REGSUBKEY_CTR *subkeys );
+ BOOL (*store_subkeys) ( const char *path, REGSUBKEY_CTR *subkeys );
+ int (*fetch_values) ( const char *path, REGVAL_CTR *values );
+ BOOL (*store_values) ( const char *path, REGVAL_CTR *values );
+};
+
+#if 0 /* UNUSED */
+
#define MAX_TOP_LEVEL_KEYS 3
/* some symbolic indexes into the top_level_keys */
@@ -101,29 +114,6 @@ static char* trim_reg_path( const char *path )
}
/**********************************************************************
- *********************************************************************/
-
-static int fill_ports_values( REGVAL_CTR *values )
-{
- int numlines, i;
- char **lines;
- UNISTR2 data;
- WERROR result;
-
- result = enumports_hook( &numlines, &lines );
-
- if ( !W_ERROR_IS_OK(result) )
- return -1;
-
- init_unistr2( &data, "", UNI_STR_TERMINATE);
- for ( i=0; i<numlines; i++ )
- regval_ctr_addvalue( values, lines[i], REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) );
-
- return numlines;
-}
-
-
-/**********************************************************************
handle enumeration of subkeys below KEY_PRINTING\Environments
Environments\$ARCH\Print Processors
Environments\$ARCH\Drivers\{0,2,3}
@@ -457,84 +447,6 @@ static int print_subpath_forms( char *key, REGSUBKEY_CTR *subkeys )
}
/**********************************************************************
- handle enumeration of values below KEY_PRINTING\Forms
- *********************************************************************/
-
-static int print_subpath_values_forms( char *key, REGVAL_CTR *val )
-{
- int num_values = 0;
- uint32 data[8];
- int form_index = 1;
-
- DEBUG(10,("print_values_forms: key=>[%s]\n", key ? key : "NULL" ));
-
- /* handle ..\Forms\ */
-
- if ( !key )
- {
- nt_forms_struct *forms_list = NULL;
- nt_forms_struct *form = NULL;
- int i;
-
- if ( (num_values = get_ntforms( &forms_list )) == 0 )
- return 0;
-
- DEBUG(10,("print_subpath_values_forms: [%d] user defined forms returned\n",
- num_values));
-
- /* handle user defined forms */
-
- for ( i=0; i<num_values; i++ )
- {
- form = &forms_list[i];
-
- data[0] = form->width;
- data[1] = form->length;
- data[2] = form->left;
- data[3] = form->top;
- data[4] = form->right;
- data[5] = form->bottom;
- data[6] = form_index++;
- data[7] = form->flag;
-
- regval_ctr_addvalue( val, form->name, REG_BINARY, (char*)data, sizeof(data) );
-
- }
-
- SAFE_FREE( forms_list );
- forms_list = NULL;
-
- /* handle built-on forms */
-
- if ( (num_values = get_builtin_ntforms( &forms_list )) == 0 )
- return 0;
-
- DEBUG(10,("print_subpath_values_forms: [%d] built-in forms returned\n",
- num_values));
-
- for ( i=0; i<num_values; i++ )
- {
- form = &forms_list[i];
-
- data[0] = form->width;
- data[1] = form->length;
- data[2] = form->left;
- data[3] = form->top;
- data[4] = form->right;
- data[5] = form->bottom;
- data[6] = form_index++;
- data[7] = form->flag;
-
- regval_ctr_addvalue( val, form->name, REG_BINARY, (char*)data, sizeof(data) );
- }
-
- SAFE_FREE( forms_list );
- }
-
- return num_values;
-}
-
-/**********************************************************************
handle enumeration of subkeys below KEY_PRINTING\Printers
*********************************************************************/
@@ -867,65 +779,354 @@ static int printing_subkey_info( const char *key, REGSUBKEY_CTR *subkey_ctr )
return num_subkeys;
}
+#endif /* UNUSED */
+
/**********************************************************************
- Enumerate registry values given a registry path.
- Caller is responsible for freeing memory
*********************************************************************/
-static int printing_value_info( const char *key, REGVAL_CTR *val )
+static int key_forms_fetch_keys( const char *key, REGSUBKEY_CTR *subkeys )
{
- char *path;
- int num_values = 0;
+ return 0;
+}
+
+static BOOL key_forms_store_keys( const char *key, REGSUBKEY_CTR *subkeys )
+{
+ return True;
+}
+
+static int key_forms_fetch_values( const char *key, REGVAL_CTR *values )
+{
+ int num_values = 0;
+ uint32 data[8];
+ int form_index = 1;
+ int i;
- DEBUG(10,("printing_value_info: key=>[%s]\n", key));
+ DEBUG(10,("print_values_forms: key=>[%s]\n", key ? key : "NULL" ));
- path = trim_reg_path( key );
+ nt_forms_struct *forms_list = NULL;
+ nt_forms_struct *form = NULL;
- if ( path ) {
- num_values = handle_printing_subpath( path, NULL, val );
- SAFE_FREE( path );
- return num_values;
+ if ( (num_values = get_ntforms( &forms_list )) == 0 )
+ return 0;
+
+ DEBUG(10,("hive_forms_fetch_values: [%d] user defined forms returned\n",
+ num_values));
+
+ /* handle user defined forms */
+
+ for ( i=0; i<num_values; i++ ) {
+ form = &forms_list[i];
+
+ data[0] = form->width;
+ data[1] = form->length;
+ data[2] = form->left;
+ data[3] = form->top;
+ data[4] = form->right;
+ data[5] = form->bottom;
+ data[6] = form_index++;
+ data[7] = form->flag;
+
+ regval_ctr_addvalue( values, form->name, REG_BINARY, (char*)data, sizeof(data) );
}
+
+ SAFE_FREE( forms_list );
+ forms_list = NULL;
+
+ /* handle built-on forms */
+
+ if ( (num_values = get_builtin_ntforms( &forms_list )) == 0 )
+ return 0;
+
+ DEBUG(10,("print_subpath_values_forms: [%d] built-in forms returned\n",
+ num_values));
+
+ for ( i=0; i<num_values; i++ ) {
+ form = &forms_list[i];
+
+ data[0] = form->width;
+ data[1] = form->length;
+ data[2] = form->left;
+ data[3] = form->top;
+ data[4] = form->right;
+ data[5] = form->bottom;
+ data[6] = form_index++;
+ data[7] = form->flag;
+
+ regval_ctr_addvalue( values, form->name, REG_BINARY, (char*)data, sizeof(data) );
+ }
+
+ SAFE_FREE( forms_list );
- /* top level key */
-
- if ( strequal( key, KEY_PRINTING_PORTS ) )
- num_values = fill_ports_values( val );
-
- return num_values;
+ return regval_ctr_numvals( values );
+}
+
+static BOOL key_forms_store_values( const char *key, REGVAL_CTR *values )
+{
+ return True;
}
/**********************************************************************
- Stub function which always returns failure since we don't want
- people storing printing information directly via regostry calls
- (for now at least)
*********************************************************************/
-static BOOL printing_store_subkey( const char *key, REGSUBKEY_CTR *subkeys )
+static int key_printer_fetch_keys( const char *key, REGSUBKEY_CTR *subkeys )
+{
+ return 0;
+}
+
+static BOOL key_printer_store_keys( const char *key, REGSUBKEY_CTR *subkeys )
+{
+ return True;
+}
+
+static int key_printer_fetch_values( const char *key, REGVAL_CTR *values )
+{
+ return 0;
+}
+
+static BOOL key_printer_store_values( const char *key, REGVAL_CTR *values )
{
return True;
}
/**********************************************************************
- Stub function which always returns failure since we don't want
- people storing printing information directly via regostry calls
- (for now at least)
*********************************************************************/
-static BOOL printing_store_value( const char *key, REGVAL_CTR *val )
+static int key_driver_fetch_keys( const char *key, REGSUBKEY_CTR *subkeys )
+{
+ return 0;
+}
+
+static BOOL key_driver_store_keys( const char *key, REGSUBKEY_CTR *subkeys )
{
return True;
}
+static int key_driver_fetch_values( const char *key, REGVAL_CTR *values )
+{
+ return 0;
+}
+
+static BOOL key_driver_store_values( const char *key, REGVAL_CTR *values )
+{
+ return True;
+}
+
+/**********************************************************************
+ *********************************************************************/
+
+static int key_print_fetch_keys( const char *key, REGSUBKEY_CTR *subkeys )
+{
+ return 0;
+}
+
+static BOOL key_print_store_keys( const char *key, REGSUBKEY_CTR *subkeys )
+{
+ return True;
+}
+
+static int key_print_fetch_values( const char *key, REGVAL_CTR *values )
+{
+ return 0;
+}
+
+static BOOL key_print_store_values( const char *key, REGVAL_CTR *values )
+{
+ return True;
+}
+
+/**********************************************************************
+ *********************************************************************/
+
+static int key_ports_fetch_keys( const char *key, REGSUBKEY_CTR *subkeys )
+{
+ return 0;
+}
+
+static BOOL key_ports_store_keys( const char *key, REGSUBKEY_CTR *subkeys )
+{
+ return True;
+}
+
+static int key_ports_fetch_values( const char *key, REGVAL_CTR *values )
+{
+ int numlines, i;
+ char **lines;
+ UNISTR2 data;
+ WERROR result;
+
+ if ( !W_ERROR_IS_OK(result = enumports_hook( &numlines, &lines )) )
+ return -1;
+
+ init_unistr2( &data, "", UNI_STR_TERMINATE);
+ for ( i=0; i<numlines; i++ )
+ regval_ctr_addvalue( values, lines[i], REG_SZ, (char*)data.buffer, data.uni_str_len*sizeof(uint16) );
+
+ return regval_ctr_numvals( values );
+}
+
+static BOOL key_ports_store_values( const char *key, REGVAL_CTR *values )
+{
+ return True;
+}
+
+/**********************************************************************
+ *********************************************************************/
+
+static int key_monitor_fetch_keys( const char *key, REGSUBKEY_CTR *subkeys )
+{
+ return regdb_fetch_keys( key, subkeys );
+}
+
+static BOOL key_monitor_store_keys( const char *key, REGSUBKEY_CTR *subkeys )
+{
+ return regdb_store_keys( key, subkeys );
+}
+
+static int key_monitor_fetch_values( const char *key, REGVAL_CTR *values )
+{
+ return regdb_fetch_values( key, values );
+}
+
+static BOOL key_monitor_store_values( const char *key, REGVAL_CTR *values )
+{
+ return regdb_store_values( key, values );
+}
+
+/**********************************************************************
+ Structure to hold dispatch table of ops for various printer keys.
+ Make sure to always store deeper keys along the same path first so
+ we ge a more specific match.
+ *********************************************************************/
+
+static struct reg_dyn_tree print_registry[] = {
+{ "HKLM/SYSTEM/CURRENTCONTROLSET/CONTROL/PRINT/MONITORS",
+ &key_monitor_fetch_keys,
+ &key_monitor_store_keys,
+ &key_monitor_fetch_values,
+ &key_monitor_store_values },
+{ "HKLM/SYSTEM/CURRENTCONTROLSET/CONTROL/PRINT/FORMS",
+ &key_forms_fetch_keys,
+ &key_forms_store_keys,
+ &key_forms_fetch_values,
+ &key_forms_store_values },
+{ "HKLM/SYSTEM/CURRENTCONTROLSET/CONTROL/PRINT/PRINTERS",
+ &key_printer_fetch_keys,
+ &key_printer_store_keys,
+ &key_printer_fetch_values,
+ &key_printer_store_values },
+{ "HKLM/SYSTEM/CURRENTCONTROLSET/CONTROL/PRINT/ENVIRONMENTS",
+ &key_driver_fetch_keys,
+ &key_driver_store_keys,
+ &key_driver_fetch_values,
+ &key_driver_store_values },
+{ "HKLM/SYSTEM/CURRENTCONTROLSET/CONTROL/PRINT",
+ &key_print_fetch_keys,
+ &key_print_store_keys,
+ &key_print_fetch_values,
+ &key_print_store_values },
+{ "HKLM/SOFTWARE/MICROSOFT/WINDOWS NT/CURRENTVERSION/PRINT/PRINTERS",
+ &key_printer_fetch_keys,
+ &key_printer_store_keys,
+ &key_printer_fetch_values,
+ &key_printer_store_values },
+{ "HKLM/SOFTWARE/MICROSOFT/WINDOWS NT/CURRENTVERSION/PRINT",
+ &key_print_fetch_keys,
+ &key_print_store_keys,
+ &key_print_fetch_values,
+ &key_print_store_values },
+{ "HKLM/SOFTWARE/MICROSOFT/WINDOWS NT/CURRENTVERSION/PORTS",
+ &key_ports_fetch_keys,
+ &key_ports_store_keys,
+ &key_ports_fetch_values,
+ &key_ports_store_values },
+
+{ NULL, NULL, NULL, NULL, NULL }
+};
+
+
+/**********************************************************************
+ *********************************************************************/
+
+static int match_registry_path( const char *key )
+{
+ int i;
+ pstring path;
+
+ if ( !key )
+ return -1;
+
+ pstrcpy( path, key );
+ normalize_reg_path( path );
+
+ for ( i=0; print_registry[i].path; i++ ) {
+ if ( strncmp( path, print_registry[i].path, strlen(print_registry[i].path) ) == 0 )
+ return i;
+ }
+
+ return -1;
+}
+
+/**********************************************************************
+ *********************************************************************/
+
+static int regprint_fetch_reg_keys( const char *key, REGSUBKEY_CTR *subkeys )
+{
+ int i = match_registry_path( key );
+
+ if ( i == -1 )
+ return -1;
+
+ return print_registry[i].fetch_subkeys( key, subkeys );
+}
+
+/**********************************************************************
+ *********************************************************************/
+
+static BOOL regprint_store_reg_keys( const char *key, REGSUBKEY_CTR *subkeys )
+{
+ int i = match_registry_path( key );
+
+ if ( i == -1 )
+ return False;
+
+ return print_registry[i].store_subkeys( key, subkeys );
+}
+
+/**********************************************************************
+ *********************************************************************/
+
+static int regprint_fetch_reg_values( const char *key, REGVAL_CTR *values )
+{
+ int i = match_registry_path( key );
+
+ if ( i == -1 )
+ return -1;
+
+ return print_registry[i].fetch_values( key, values );
+}
+
+/**********************************************************************
+ *********************************************************************/
+
+static BOOL regprint_store_reg_values( const char *key, REGVAL_CTR *values )
+{
+ int i = match_registry_path( key );
+
+ if ( i == -1 )
+ return False;
+
+ return print_registry[i].store_values( key, values );
+}
+
/*
* Table of function pointers for accessing printing data
*/
REGISTRY_OPS printing_ops = {
- printing_subkey_info,
- printing_value_info,
- printing_store_subkey,
- printing_store_value,
+ regprint_fetch_reg_keys,
+ regprint_fetch_reg_values,
+ regprint_store_reg_keys,
+ regprint_store_reg_values,
NULL
};