r25068: Older samba3 DCs will return DCERPC_FAULT_OP_RNG_ERROR for every opcode on the
[Samba.git] / source / include / reg_objects.h
blobb108d6d0824f6ae7ef97adc0c1a6a5c5103b607c
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 2 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, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #ifndef _REG_OBJECTS_H /* _REG_OBJECTS_H */
23 #define _REG_OBJECTS_H
25 /* structure to contain registry values */
27 typedef struct {
28 fstring valuename;
29 uint16 type;
30 /* this should be encapsulated in an RPC_DATA_BLOB */
31 uint32 size; /* in bytes */
32 uint8 *data_p;
33 } REGISTRY_VALUE;
36 * A REG_SZ string is not necessarily NULL terminated. When retrieving it from
37 * the net, we guarantee this however. A server might want to push it without
38 * the terminator though.
41 struct registry_string {
42 size_t len;
43 char *str;
46 struct registry_value {
47 enum winreg_Type type;
48 union {
49 uint32 dword;
50 uint64 qword;
51 struct registry_string sz;
52 struct {
53 uint32 num_strings;
54 char **strings;
55 } multi_sz;
56 DATA_BLOB binary;
57 } v;
60 /* container for registry values */
62 typedef struct {
63 uint32 num_values;
64 REGISTRY_VALUE **values;
65 } REGVAL_CTR;
67 /* container for registry subkey names */
69 typedef struct {
70 uint32 num_subkeys;
71 char **subkeys;
72 } REGSUBKEY_CTR;
76 * Macros that used to reside in rpc_reg.h
80 #define HKEY_CLASSES_ROOT 0x80000000
81 #define HKEY_CURRENT_USER 0x80000001
82 #define HKEY_LOCAL_MACHINE 0x80000002
83 #define HKEY_USERS 0x80000003
84 #define HKEY_PERFORMANCE_DATA 0x80000004
86 #define KEY_HKLM "HKLM"
87 #define KEY_HKU "HKU"
88 #define KEY_HKCC "HKCC"
89 #define KEY_HKCR "HKCR"
90 #define KEY_HKPD "HKPD"
91 #define KEY_HKPT "HKPT"
92 #define KEY_HKPN "HKPN"
93 #define KEY_HKCU "HKCU"
94 #define KEY_HKDD "HKDD"
95 #define KEY_SERVICES "HKLM\\SYSTEM\\CurrentControlSet\\Services"
96 #define KEY_PRINTING "HKLM\\SYSTEM\\CurrentControlSet\\Control\\Print"
97 #define KEY_PRINTING_2K "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Print\\Printers"
98 #define KEY_PRINTING_PORTS "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Ports"
99 #define KEY_EVENTLOG "HKLM\\SYSTEM\\CurrentControlSet\\Services\\Eventlog"
100 #define KEY_SHARES "HKLM\\SYSTEM\\CurrentControlSet\\Services\\LanmanServer\\Shares"
101 #define KEY_SMBCONF "HKLM\\SOFTWARE\\Samba\\smbconf"
102 #define KEY_TREE_ROOT ""
105 * Registry key types
106 * Most keys are going to be GENERIC -- may need a better name?
107 * HKPD and HKPT are used by reg_perfcount.c
108 * they are special keys that contain performance data
110 #define REG_KEY_GENERIC 0
111 #define REG_KEY_HKPD 1
112 #define REG_KEY_HKPT 2
115 * container for function pointers to enumeration routines
116 * for virtual registry view
119 typedef struct {
120 /* functions for enumerating subkeys and values */
121 int (*fetch_subkeys)( const char *key, REGSUBKEY_CTR *subkeys);
122 int (*fetch_values) ( const char *key, REGVAL_CTR *val );
123 BOOL (*store_subkeys)( const char *key, REGSUBKEY_CTR *subkeys );
124 BOOL (*store_values)( const char *key, REGVAL_CTR *val );
125 BOOL (*reg_access_check)( const char *keyname, uint32 requested,
126 uint32 *granted,
127 const NT_USER_TOKEN *token );
128 WERROR (*get_secdesc)(TALLOC_CTX *mem_ctx, const char *key,
129 struct security_descriptor **psecdesc);
130 WERROR (*set_secdesc)(const char *key,
131 struct security_descriptor *sec_desc);
132 } REGISTRY_OPS;
134 typedef struct {
135 const char *keyname; /* full path to name of key */
136 REGISTRY_OPS *ops; /* registry function hooks */
137 } REGISTRY_HOOK;
140 /* structure to store the registry handles */
142 typedef struct _RegistryKey {
143 uint32 type;
144 char *name; /* full name of registry key */
145 uint32 access_granted;
146 REGISTRY_HOOK *hook;
147 } REGISTRY_KEY;
149 struct registry_key {
150 REGISTRY_KEY *key;
151 REGSUBKEY_CTR *subkeys;
152 REGVAL_CTR *values;
153 struct nt_user_token *token;
156 #endif /* _REG_OBJECTS_H */