tiny simplification
[Samba/gebeck_regimport.git] / source3 / include / reg_objects.h
blob3df701f61cced8fc79fe60fe062b1a45f721108c
1 /*
2 Samba's Internal Registry objects
4 SMB parameters and setup
5 Copyright (C) Gerald Carter 2002-2006.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #ifndef _REG_OBJECTS_H /* _REG_OBJECTS_H */
22 #define _REG_OBJECTS_H
24 /* structure to contain registry values */
26 typedef struct {
27 fstring valuename;
28 uint16 type;
29 /* this should be encapsulated in an RPC_DATA_BLOB */
30 uint32 size; /* in bytes */
31 uint8 *data_p;
32 } REGISTRY_VALUE;
35 * A REG_SZ string is not necessarily NULL terminated. When retrieving it from
36 * the net, we guarantee this however. A server might want to push it without
37 * the terminator though.
40 struct registry_string {
41 size_t len;
42 char *str;
45 struct registry_value {
46 enum winreg_Type type;
47 union {
48 uint32 dword;
49 uint64 qword;
50 struct registry_string sz;
51 struct {
52 uint32 num_strings;
53 char **strings;
54 } multi_sz;
55 DATA_BLOB binary;
56 } v;
59 /* container for registry values */
61 typedef struct {
62 uint32 num_values;
63 REGISTRY_VALUE **values;
64 int seqnum;
65 } REGVAL_CTR;
67 /* container for registry subkey names */
69 typedef struct {
70 uint32 num_subkeys;
71 char **subkeys;
72 int seqnum;
73 } REGSUBKEY_CTR;
77 * Macros that used to reside in rpc_reg.h
81 #define HKEY_CLASSES_ROOT 0x80000000
82 #define HKEY_CURRENT_USER 0x80000001
83 #define HKEY_LOCAL_MACHINE 0x80000002
84 #define HKEY_USERS 0x80000003
85 #define HKEY_PERFORMANCE_DATA 0x80000004
87 #define KEY_HKLM "HKLM"
88 #define KEY_HKU "HKU"
89 #define KEY_HKCC "HKCC"
90 #define KEY_HKCR "HKCR"
91 #define KEY_HKPD "HKPD"
92 #define KEY_HKPT "HKPT"
93 #define KEY_HKPN "HKPN"
94 #define KEY_HKCU "HKCU"
95 #define KEY_HKDD "HKDD"
96 #define KEY_SERVICES "HKLM\\SYSTEM\\CurrentControlSet\\Services"
97 #define KEY_EVENTLOG "HKLM\\SYSTEM\\CurrentControlSet\\Services\\Eventlog"
98 #define KEY_SHARES "HKLM\\SYSTEM\\CurrentControlSet\\Services\\LanmanServer\\Shares"
99 #define KEY_NETLOGON_PARAMS "HKLM\\SYSTEM\\CurrentControlSet\\Services\\Netlogon\\Parameters"
100 #define KEY_TCPIP_PARAMS "HKLM\\SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters"
101 #define KEY_PROD_OPTIONS "HKLM\\SYSTEM\\CurrentControlSet\\Control\\ProductOptions"
102 #define KEY_PRINTING "HKLM\\SYSTEM\\CurrentControlSet\\Control\\Print"
103 #define KEY_PRINTING_2K "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Print\\Printers"
104 #define KEY_PRINTING_PORTS "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Ports"
105 #define KEY_CURRENT_VERSION "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion"
106 #define KEY_PERFLIB "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Perflib"
107 #define KEY_PERFLIB_009 "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Perflib\\009"
108 #define KEY_SMBCONF "HKLM\\SOFTWARE\\Samba\\smbconf"
109 #define KEY_TREE_ROOT ""
112 * Registry key types
113 * Most keys are going to be GENERIC -- may need a better name?
114 * HKPD and HKPT are used by reg_perfcount.c
115 * they are special keys that contain performance data
117 #define REG_KEY_GENERIC 0
118 #define REG_KEY_HKPD 1
119 #define REG_KEY_HKPT 2
122 * container for function pointers to enumeration routines
123 * for virtual registry view
126 typedef struct {
127 /* functions for enumerating subkeys and values */
128 int (*fetch_subkeys)( const char *key, REGSUBKEY_CTR *subkeys);
129 int (*fetch_values) ( const char *key, REGVAL_CTR *val );
130 bool (*store_subkeys)( const char *key, REGSUBKEY_CTR *subkeys );
131 bool (*store_values)( const char *key, REGVAL_CTR *val );
132 bool (*reg_access_check)( const char *keyname, uint32 requested,
133 uint32 *granted,
134 const NT_USER_TOKEN *token );
135 WERROR (*get_secdesc)(TALLOC_CTX *mem_ctx, const char *key,
136 struct security_descriptor **psecdesc);
137 WERROR (*set_secdesc)(const char *key,
138 struct security_descriptor *sec_desc);
139 bool (*subkeys_need_update)(REGSUBKEY_CTR *subkeys);
140 bool (*values_need_update)(REGVAL_CTR *values);
141 } REGISTRY_OPS;
143 typedef struct {
144 const char *keyname; /* full path to name of key */
145 REGISTRY_OPS *ops; /* registry function hooks */
146 } REGISTRY_HOOK;
149 /* structure to store the registry handles */
151 typedef struct _RegistryKey {
152 uint32 type;
153 char *name; /* full name of registry key */
154 uint32 access_granted;
155 REGISTRY_HOOK *hook;
156 } REGISTRY_KEY;
158 struct registry_key {
159 REGISTRY_KEY *key;
160 REGSUBKEY_CTR *subkeys;
161 REGVAL_CTR *values;
162 struct nt_user_token *token;
165 #endif /* _REG_OBJECTS_H */