1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
/*
* Unix SMB/CIFS implementation.
* RPC Pipe client / server routines
* Copyright (C) Gerald Carter 2002.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* Implementation of registry frontend view functions. */
#include "includes.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_RPC_SRV
extern REGISTRY_OPS printing_ops;
/* array of REGISTRY_HOOK's which are read into a tree for easy access */
REGISTRY_HOOK reg_hooks[] = {
{ KEY_PRINTING, &printing_ops },
{ NULL, NULL }
};
/***********************************************************************
Open the registry database and initialize the REGISTRY_HOOK cache
***********************************************************************/
BOOL init_registry( void )
{
int i;
if ( !init_registry_db() ) {
DEBUG(0,("init_registry: failed to initialize the registry tdb!\n"));
return False;
}
/* build the cache tree of registry hooks */
reghook_cache_init();
for ( i=0; reg_hooks[i].keyname; i++ ) {
if ( !reghook_cache_add(®_hooks[i]) )
return False;
}
reghook_dump_cache(20);
return True;
}
/***********************************************************************
High level wrapper function for storing registry subkeys
***********************************************************************/
BOOL store_reg_keys( REGISTRY_KEY *key, char **subkeys, uint32 num_subkeys )
{
return regdb_store_reg_keys( key->name, subkeys, num_subkeys );
}
/***********************************************************************
High level wrapper function for storing registry values
***********************************************************************/
BOOL store_reg_values( REGISTRY_KEY *key, REGISTRY_VALUE **val, uint32 num_values )
{
return True;
}
/***********************************************************************
High level wrapper function for enumerating registry subkeys
***********************************************************************/
int fetch_reg_keys( REGISTRY_KEY *key, char **subkeys )
{
int num_subkeys;
if ( key->hook && key->hook->ops && key->hook->ops->subkey_fn )
num_subkeys = key->hook->ops->subkey_fn( key->name, subkeys );
else
num_subkeys = regdb_fetch_reg_keys( key->name, subkeys );
return num_subkeys;
}
/***********************************************************************
High level wrapper function for retreiving a specific registry subkey
given and index.
***********************************************************************/
BOOL fetch_reg_keys_specific( REGISTRY_KEY *key, char** subkey, uint32 key_index )
{
BOOL result;
if ( key->hook && key->hook->ops && key->hook->ops->subkey_specific_fn )
result = key->hook->ops->subkey_specific_fn( key->name, subkey, key_index );
else
result = regdb_fetch_reg_keys_specific( key->name, subkey, key_index );
return result;
}
/***********************************************************************
High level wrapper function for enumerating registry values
***********************************************************************/
int fetch_reg_values( REGISTRY_KEY *key, REGISTRY_VALUE **val )
{
int num_values;
if ( key->hook && key->hook->ops && key->hook->ops->value_fn )
num_values = key->hook->ops->value_fn( key->name, val );
else
num_values = regdb_fetch_reg_values( key->name, val );
return num_values;
}
|