2 * Unix SMB/CIFS implementation.
3 * RPC Pipe client / server routines
4 * Copyright (C) Gerald Carter 2002.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 /* Implementation of registry frontend view functions. */
26 #define DBGC_CLASS DBGC_RPC_SRV
28 extern REGISTRY_OPS printing_ops
;
30 /* array of REGISTRY_HOOK's which are read into a tree for easy access */
33 REGISTRY_HOOK reg_hooks
[] = {
34 { KEY_PRINTING
, &printing_ops
},
39 /***********************************************************************
40 Open the registry database and initialize the REGISTRY_HOOK cache
41 ***********************************************************************/
43 BOOL
init_registry( void )
47 if ( !init_registry_db() ) {
48 DEBUG(0,("init_registry: failed to initialize the registry tdb!\n"));
52 /* build the cache tree of registry hooks */
56 for ( i
=0; reg_hooks
[i
].keyname
; i
++ ) {
57 if ( !reghook_cache_add(®_hooks
[i
]) )
61 reghook_dump_cache(20);
69 /***********************************************************************
70 High level wrapper function for storing registry subkeys
71 ***********************************************************************/
73 BOOL
store_reg_keys( REGISTRY_KEY
*key
, char **subkeys
, uint32 num_subkeys
)
75 return regdb_store_reg_keys( key
->name
, subkeys
, num_subkeys
);
79 /***********************************************************************
80 High level wrapper function for storing registry values
81 ***********************************************************************/
83 BOOL
store_reg_values( REGISTRY_KEY
*key
, REGISTRY_VALUE
**val
, uint32 num_values
)
89 /***********************************************************************
90 High level wrapper function for enumerating registry subkeys
91 ***********************************************************************/
93 int fetch_reg_keys( REGISTRY_KEY
*key
, char **subkeys
)
97 if ( key
->hook
&& key
->hook
->ops
&& key
->hook
->ops
->subkey_fn
)
98 num_subkeys
= key
->hook
->ops
->subkey_fn( key
->name
, subkeys
);
100 num_subkeys
= regdb_fetch_reg_keys( key
->name
, subkeys
);
105 /***********************************************************************
106 High level wrapper function for retreiving a specific registry subkey
108 ***********************************************************************/
110 BOOL
fetch_reg_keys_specific( REGISTRY_KEY
*key
, char** subkey
, uint32 key_index
)
114 if ( key
->hook
&& key
->hook
->ops
&& key
->hook
->ops
->subkey_specific_fn
)
115 result
= key
->hook
->ops
->subkey_specific_fn( key
->name
, subkey
, key_index
);
117 result
= regdb_fetch_reg_keys_specific( key
->name
, subkey
, key_index
);
123 /***********************************************************************
124 High level wrapper function for enumerating registry values
125 ***********************************************************************/
127 int fetch_reg_values( REGISTRY_KEY
*key
, REGISTRY_VALUE
**val
)
131 if ( key
->hook
&& key
->hook
->ops
&& key
->hook
->ops
->value_fn
)
132 num_values
= key
->hook
->ops
->value_fn( key
->name
, val
);
134 num_values
= regdb_fetch_reg_values( key
->name
, val
);