New registry backend(s)

Jelmer Vernooij jelmer at
Wed Sep 24 21:39:13 GMT 2003


For the past few hours, I've been working on restructuring Samba's
registry handling. Features are: 

- Call all three current registry backends(tdb,nt4,rpc) with the same calls
- Make it possible to create a registry library.

After this update, source/registry/ will contain the following files:

reg_cachehook.c - Caching of values for better performance (?)
reg_backend_nt4.c - TDB backend for registry
reg_backend_tdb.c - NT4 Registry Files backend by Richard Sharpe
reg_backend_rpc.c - Do remote registry management (calls rpc_client/
reg_frontend.c - Frontend used by Samba. Contains the 'hooks' stuff
	Jerry has written
reg_interface.c - Interface to the various backends.
reg_objects.c -  Fiddling with registry objects
reg_printing.c - Samba printing-related stuff.
reg_cmd_file.c - Parsing (and applying) of regedit (plaintext) command files. Used by editreg

The functions a registry backend should provide are: 

typedef struct {
	REG_HANDLE *open_registry (char *location);
	REG_KEY *open_root_key (REG_HANDLE *);
	REG_KEY *open_key_rel (REG_KEY *parent, char *name);
	/* if open_key_abs is set to NULL, a default implementation will be provided. */
	REG_KEY *open_key_abs (REG_HANDLE *, char *name);
	REG_KEY_LIST *get_children (REG_KEY *);
	REG_VAL_LIST *get_values (REG_KEY *);
	BOOL *add_key(REG_KEY *, REG_KEY *);
	BOOL *update_key(REG_KEY *);
	BOOL *del_key(REG_KEY *);
	BOOL *add_value(REG_KEY *, REG_VALUE *);
	BOOL *update_value(REG_VALUE *);
	BOOL *del_value(REG_VALUE *);
	REG_VAL *get_value (REG_KEY *, char *name);
	/* It is not guaranteed that no data has been stored before save() 
	 * has been called. This function is only useful for backends that 
	 * store the data in memory and then write out the whole registry at once */
	BOOL save(REG_HANDLE *, char *location);
	BOOL close_registry (REG_HANDLE *);

I will also rewrite editreg to use this interface. kregedit (and
perhaps gregedit?) will be a full regedit32 clone after this is all
finished (including management of remote registries).

Does anyone have objections against such an approach ?


More information about the samba-technical mailing list