5 * A REG_SZ string is not necessarily NULL terminated. When retrieving it from
6 * the net, we guarantee this however. A server might want to push it without
7 * the terminator though.
10 struct registry_string {
15 struct registry_value {
16 enum winreg_Type type;
20 struct registry_string sz;
29 /* forward declarations. definitions in reg_objects.c */
34 * container for function pointers to enumeration routines
35 * for virtual registry view
39 /* functions for enumerating subkeys and values */
40 int (*fetch_subkeys)( const char *key, struct regsubkey_ctr *subkeys);
41 int (*fetch_values) ( const char *key, struct regval_ctr *val );
42 bool (*store_subkeys)( const char *key, struct regsubkey_ctr *subkeys );
43 WERROR (*create_subkey)(const char *key, const char *subkey);
44 WERROR (*delete_subkey)(const char *key, const char *subkey);
45 bool (*store_values)( const char *key, struct regval_ctr *val );
46 bool (*reg_access_check)( const char *keyname, uint32 requested,
48 const NT_USER_TOKEN *token );
49 WERROR (*get_secdesc)(TALLOC_CTX *mem_ctx, const char *key,
50 struct security_descriptor **psecdesc);
51 WERROR (*set_secdesc)(const char *key,
52 struct security_descriptor *sec_desc);
53 bool (*subkeys_need_update)(struct regsubkey_ctr *subkeys);
54 bool (*values_need_update)(struct regval_ctr *values);
57 /* structure to store the registry handles */
59 struct registry_key_handle {
61 char *name; /* full name of registry key */
62 uint32 access_granted;
63 struct registry_ops *ops;
67 struct registry_key_handle *key;
68 struct regsubkey_ctr *subkeys;
69 struct regval_ctr *values;
70 struct nt_user_token *token;
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"
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_EVENTLOG "HKLM\\SYSTEM\\CurrentControlSet\\Services\\Eventlog"
97 #define KEY_SHARES "HKLM\\SYSTEM\\CurrentControlSet\\Services\\LanmanServer\\Shares"
98 #define KEY_NETLOGON_PARAMS "HKLM\\SYSTEM\\CurrentControlSet\\Services\\Netlogon\\Parameters"
99 #define KEY_TCPIP_PARAMS "HKLM\\SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters"
100 #define KEY_PROD_OPTIONS "HKLM\\SYSTEM\\CurrentControlSet\\Control\\ProductOptions"
101 #define KEY_PRINTING "HKLM\\SYSTEM\\CurrentControlSet\\Control\\Print"
102 #define KEY_PRINTING_2K "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Print\\Printers"
103 #define KEY_PRINTING_PORTS "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Ports"
104 #define KEY_CURRENT_VERSION "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion"
105 #define KEY_PERFLIB "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Perflib"
106 #define KEY_PERFLIB_009 "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Perflib\\009"
107 #define KEY_GROUP_POLICY "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Group Policy"
108 #define KEY_WINLOGON "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon"
109 #define KEY_SMBCONF "HKLM\\SOFTWARE\\Samba\\smbconf"
110 #define KEY_SAMBA_GROUP_POLICY "HKLM\\SOFTWARE\\Samba\\Group Policy"
111 #define KEY_TREE_ROOT ""
113 #define KEY_GP_MACHINE_POLICY "HKLM\\Software\\Policies"
114 #define KEY_GP_MACHINE_WIN_POLICY "HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies"
115 #define KEY_GP_USER_POLICY "HKCU\\Software\\Policies"
116 #define KEY_GP_USER_WIN_POLICY "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies"
120 * Most keys are going to be GENERIC -- may need a better name?
121 * HKPD and HKPT are used by reg_perfcount.c
122 * they are special keys that contain performance data
124 #define REG_KEY_GENERIC 0
125 #define REG_KEY_HKPD 1
126 #define REG_KEY_HKPT 2
129 /* The following definitions come from registry/reg_api.c */
131 WERROR reg_openhive(TALLOC_CTX *mem_ctx, const char *hive,
132 uint32 desired_access,
133 const struct nt_user_token *token,
134 struct registry_key **pkey);
135 WERROR reg_openkey(TALLOC_CTX *mem_ctx, struct registry_key *parent,
136 const char *name, uint32 desired_access,
137 struct registry_key **pkey);
138 WERROR reg_enumkey(TALLOC_CTX *mem_ctx, struct registry_key *key,
139 uint32 idx, char **name, NTTIME *last_write_time);
140 WERROR reg_enumvalue(TALLOC_CTX *mem_ctx, struct registry_key *key,
141 uint32 idx, char **pname, struct registry_value **pval);
142 WERROR reg_queryvalue(TALLOC_CTX *mem_ctx, struct registry_key *key,
143 const char *name, struct registry_value **pval);
144 WERROR reg_queryinfokey(struct registry_key *key, uint32_t *num_subkeys,
145 uint32_t *max_subkeylen, uint32_t *max_subkeysize,
146 uint32_t *num_values, uint32_t *max_valnamelen,
147 uint32_t *max_valbufsize, uint32_t *secdescsize,
148 NTTIME *last_changed_time);
149 WERROR reg_createkey(TALLOC_CTX *ctx, struct registry_key *parent,
150 const char *subkeypath, uint32 desired_access,
151 struct registry_key **pkey,
152 enum winreg_CreateAction *paction);
153 WERROR reg_deletekey(struct registry_key *parent, const char *path);
154 WERROR reg_setvalue(struct registry_key *key, const char *name,
155 const struct registry_value *val);
156 WERROR reg_deletevalue(struct registry_key *key, const char *name);
157 WERROR reg_getkeysecurity(TALLOC_CTX *mem_ctx, struct registry_key *key,
158 struct security_descriptor **psecdesc);
159 WERROR reg_setkeysecurity(struct registry_key *key,
160 struct security_descriptor *psecdesc);
161 WERROR reg_getversion(uint32_t *version);
162 WERROR reg_restorekey(struct registry_key *key, const char *fname);
163 WERROR reg_savekey(struct registry_key *key, const char *fname);
164 WERROR reg_deleteallvalues(struct registry_key *key);
165 WERROR reg_open_path(TALLOC_CTX *mem_ctx, const char *orig_path,
166 uint32 desired_access, const struct nt_user_token *token,
167 struct registry_key **pkey);
168 WERROR reg_deletekey_recursive(TALLOC_CTX *ctx,
169 struct registry_key *parent,
171 WERROR reg_deletesubkeys_recursive(TALLOC_CTX *ctx,
172 struct registry_key *parent,
174 WERROR reg_create_path(TALLOC_CTX *mem_ctx, const char *orig_path,
175 uint32 desired_access,
176 const struct nt_user_token *token,
177 enum winreg_CreateAction *paction,
178 struct registry_key **pkey);
179 WERROR reg_delete_path(const struct nt_user_token *token,
180 const char *orig_path);
182 /* The following definitions come from registry/reg_init_basic.c */
184 WERROR registry_init_common(void);
185 WERROR registry_init_basic(void);
187 /* The following definitions come from registry/reg_init_full.c */
189 WERROR registry_init_full(void);
191 /* The following definitions come from registry/reg_init_smbconf.c */
193 WERROR registry_init_smbconf(const char *keyname);
195 #endif /* _REGISTRY_H */