1 | /*
|
---|
2 | * Unix SMB/CIFS implementation.
|
---|
3 | *
|
---|
4 | * WINREG client routines
|
---|
5 | *
|
---|
6 | * Copyright (c) 2011 Andreas Schneider <asn@samba.org>
|
---|
7 | *
|
---|
8 | * This program is free software; you can redistribute it and/or modify
|
---|
9 | * it under the terms of the GNU General Public License as published by
|
---|
10 | * the Free Software Foundation; either version 3 of the License, or
|
---|
11 | * (at your option) any later version.
|
---|
12 | *
|
---|
13 | * This program is distributed in the hope that it will be useful,
|
---|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
16 | * GNU General Public License for more details.
|
---|
17 | *
|
---|
18 | * You should have received a copy of the GNU General Public License
|
---|
19 | * along with this program; if not, see <http://www.gnu.org/licenses/>.
|
---|
20 | */
|
---|
21 |
|
---|
22 | #ifndef CLI_WINREG_H
|
---|
23 | #define CLI_WINREG_H
|
---|
24 |
|
---|
25 | /**
|
---|
26 | * @brief Query a key for the specified dword value.
|
---|
27 | *
|
---|
28 | * Get the data that is associated with the named value of a specified registry
|
---|
29 | * open key. This function ensures that the key is a dword and converts it
|
---|
30 | * corretly.
|
---|
31 | *
|
---|
32 | * @param[in] mem_ctx The memory context to use.
|
---|
33 | *
|
---|
34 | * @param[in] h The binding handle for the rpc connection.
|
---|
35 | *
|
---|
36 | * @param[in] key_handle A handle to a key that MUST have been opened
|
---|
37 | * previously.
|
---|
38 | *
|
---|
39 | * @param[in] value The name of the value to query.
|
---|
40 | *
|
---|
41 | * @param[out] data A pointer to store the data of the value.
|
---|
42 | *
|
---|
43 | * @param[out] pwerr A pointer to a WERROR to store result of the query.
|
---|
44 | *
|
---|
45 | * @return NT_STATUS_OK on success or a corresponding error if
|
---|
46 | * there was a problem on the connection.
|
---|
47 | */
|
---|
48 | NTSTATUS dcerpc_winreg_query_dword(TALLOC_CTX *mem_ctx,
|
---|
49 | struct dcerpc_binding_handle *h,
|
---|
50 | struct policy_handle *key_handle,
|
---|
51 | const char *value,
|
---|
52 | uint32_t *data,
|
---|
53 | WERROR *pwerr);
|
---|
54 |
|
---|
55 | /**
|
---|
56 | * @brief Query a key for the specified binary value.
|
---|
57 | *
|
---|
58 | * Get the data that is associated with the named value of a specified registry
|
---|
59 | * open key. This function ensures that the key is a binary value.
|
---|
60 | *
|
---|
61 | * @param[in] mem_ctx The memory context to use.
|
---|
62 | *
|
---|
63 | * @param[in] h The binding handle for the rpc connection.
|
---|
64 | *
|
---|
65 | * @param[in] key_handle A handle to a key that MUST have been opened
|
---|
66 | * previously.
|
---|
67 | *
|
---|
68 | * @param[in] value The name of the value to query.
|
---|
69 | *
|
---|
70 | * @param[out] data A pointer to store the data of the value.
|
---|
71 | *
|
---|
72 | * @param[out] pwerr A pointer to a WERROR to store result of the query.
|
---|
73 | *
|
---|
74 | * @return NT_STATUS_OK on success or a corresponding error if
|
---|
75 | * there was a problem on the connection.
|
---|
76 | */
|
---|
77 | NTSTATUS dcerpc_winreg_query_binary(TALLOC_CTX *mem_ctx,
|
---|
78 | struct dcerpc_binding_handle *h,
|
---|
79 | struct policy_handle *key_handle,
|
---|
80 | const char *value,
|
---|
81 | DATA_BLOB *data,
|
---|
82 | WERROR *pwerr);
|
---|
83 |
|
---|
84 | /**
|
---|
85 | * @brief Query a key for the specified multi sz value.
|
---|
86 | *
|
---|
87 | * Get the data that is associated with the named value of a specified registry
|
---|
88 | * open key. This function ensures that the key is a multi sz value.
|
---|
89 | *
|
---|
90 | * @param[in] mem_ctx The memory context to use.
|
---|
91 | *
|
---|
92 | * @param[in] h The binding handle for the rpc connection.
|
---|
93 | *
|
---|
94 | * @param[in] key_handle A handle to a key that MUST have been opened
|
---|
95 | * previously.
|
---|
96 | *
|
---|
97 | * @param[in] value The name of the value to query.
|
---|
98 | *
|
---|
99 | * @param[out] data A pointer to store the data of the value.
|
---|
100 | *
|
---|
101 | * @param[out] pwerr A pointer to a WERROR to store result of the query.
|
---|
102 | *
|
---|
103 | * @return NT_STATUS_OK on success or a corresponding error if
|
---|
104 | * there was a problem on the connection.
|
---|
105 | */
|
---|
106 | NTSTATUS dcerpc_winreg_query_multi_sz(TALLOC_CTX *mem_ctx,
|
---|
107 | struct dcerpc_binding_handle *h,
|
---|
108 | struct policy_handle *key_handle,
|
---|
109 | const char *value,
|
---|
110 | const char ***data,
|
---|
111 | WERROR *pwerr);
|
---|
112 |
|
---|
113 | /**
|
---|
114 | * @brief Query a key for the specified sz value.
|
---|
115 | *
|
---|
116 | * Get the data that is associated with the named value of a specified registry
|
---|
117 | * open key. This function ensures that the key is a multi sz value.
|
---|
118 | *
|
---|
119 | * @param[in] mem_ctx The memory context to use.
|
---|
120 | *
|
---|
121 | * @param[in] h The binding handle for the rpc connection.
|
---|
122 | *
|
---|
123 | * @param[in] key_handle A handle to a key that MUST have been opened
|
---|
124 | * previously.
|
---|
125 | *
|
---|
126 | * @param[in] value The name of the value to query.
|
---|
127 | *
|
---|
128 | * @param[out] data A pointer to store the data of the value.
|
---|
129 | *
|
---|
130 | * @param[out] pwerr A pointer to a WERROR to store result of the query.
|
---|
131 | *
|
---|
132 | * @return NT_STATUS_OK on success or a corresponding error if
|
---|
133 | * there was a problem on the connection.
|
---|
134 | */
|
---|
135 | NTSTATUS dcerpc_winreg_query_sz(TALLOC_CTX *mem_ctx,
|
---|
136 | struct dcerpc_binding_handle *h,
|
---|
137 | struct policy_handle *key_handle,
|
---|
138 | const char *value,
|
---|
139 | const char **data,
|
---|
140 | WERROR *pwerr);
|
---|
141 |
|
---|
142 | /**
|
---|
143 | * @brief Query a key for the specified security descriptor.
|
---|
144 | *
|
---|
145 | * Get the data that is associated with the named value of a specified registry
|
---|
146 | * open key. This function ensures that the key is a security descriptor.
|
---|
147 | *
|
---|
148 | * @param[in] mem_ctx The memory context to use.
|
---|
149 | *
|
---|
150 | * @param[in] h The binding handle for the rpc connection.
|
---|
151 | *
|
---|
152 | * @param[in] key_handle A handle to a key that MUST have been opened
|
---|
153 | * previously.
|
---|
154 | *
|
---|
155 | * @param[in] value The name of the value to query.
|
---|
156 | *
|
---|
157 | * @param[out] data A pointer to store the data of the value.
|
---|
158 | *
|
---|
159 | * @param[out] pwerr A pointer to a WERROR to store result of the query.
|
---|
160 | *
|
---|
161 | * @return NT_STATUS_OK on success or a corresponding error if
|
---|
162 | * there was a problem on the connection.
|
---|
163 | */
|
---|
164 | NTSTATUS dcerpc_winreg_query_sd(TALLOC_CTX *mem_ctx,
|
---|
165 | struct dcerpc_binding_handle *h,
|
---|
166 | struct policy_handle *key_handle,
|
---|
167 | const char *value,
|
---|
168 | struct security_descriptor **data,
|
---|
169 | WERROR *pwerr);
|
---|
170 |
|
---|
171 | /**
|
---|
172 | * @brief Set a value with the specified dword data.
|
---|
173 | *
|
---|
174 | * @param[in] mem_ctx The memory context to use.
|
---|
175 | *
|
---|
176 | * @param[in] h The binding handle for the rpc connection.
|
---|
177 | *
|
---|
178 | * @param[in] key_handle A handle to a key that MUST have been opened
|
---|
179 | * previously.
|
---|
180 | *
|
---|
181 | * @param[in] value The name of the value to set.
|
---|
182 | *
|
---|
183 | * @param[in] data The data to store in the value.
|
---|
184 | *
|
---|
185 | * @param[out] pwerr A pointer to a WERROR to store result of the query.
|
---|
186 | *
|
---|
187 | * @return NT_STATUS_OK on success or a corresponding error if
|
---|
188 | * there was a problem on the connection.
|
---|
189 | */
|
---|
190 | NTSTATUS dcerpc_winreg_set_dword(TALLOC_CTX *mem_ctx,
|
---|
191 | struct dcerpc_binding_handle *h,
|
---|
192 | struct policy_handle *key_handle,
|
---|
193 | const char *value,
|
---|
194 | uint32_t data,
|
---|
195 | WERROR *pwerr);
|
---|
196 |
|
---|
197 | /**
|
---|
198 | * @brief Set a value with the specified sz data.
|
---|
199 | *
|
---|
200 | * @param[in] mem_ctx The memory context to use.
|
---|
201 | *
|
---|
202 | * @param[in] h The binding handle for the rpc connection.
|
---|
203 | *
|
---|
204 | * @param[in] key_handle A handle to a key that MUST have been opened
|
---|
205 | * previously.
|
---|
206 | *
|
---|
207 | * @param[in] value The name of the value to set.
|
---|
208 | *
|
---|
209 | * @param[in] data The data to store in the value.
|
---|
210 | *
|
---|
211 | * @param[out] pwerr A pointer to a WERROR to store result of the query.
|
---|
212 | *
|
---|
213 | * @return NT_STATUS_OK on success or a corresponding error if
|
---|
214 | * there was a problem on the connection.
|
---|
215 | */
|
---|
216 | NTSTATUS dcerpc_winreg_set_sz(TALLOC_CTX *mem_ctx,
|
---|
217 | struct dcerpc_binding_handle *h,
|
---|
218 | struct policy_handle *key_handle,
|
---|
219 | const char *value,
|
---|
220 | const char *data,
|
---|
221 | WERROR *pwerr);
|
---|
222 |
|
---|
223 | /**
|
---|
224 | * @brief Set a value with the specified expand sz data.
|
---|
225 | *
|
---|
226 | * @param[in] mem_ctx The memory context to use.
|
---|
227 | *
|
---|
228 | * @param[in] h The binding handle for the rpc connection.
|
---|
229 | *
|
---|
230 | * @param[in] key_handle A handle to a key that MUST have been opened
|
---|
231 | * previously.
|
---|
232 | *
|
---|
233 | * @param[in] value The name of the value to set.
|
---|
234 | *
|
---|
235 | * @param[in] data The data to store in the value.
|
---|
236 | *
|
---|
237 | * @param[out] pwerr A pointer to a WERROR to store result of the query.
|
---|
238 | *
|
---|
239 | * @return NT_STATUS_OK on success or a corresponding error if
|
---|
240 | * there was a problem on the connection.
|
---|
241 | */
|
---|
242 | NTSTATUS dcerpc_winreg_set_expand_sz(TALLOC_CTX *mem_ctx,
|
---|
243 | struct dcerpc_binding_handle *h,
|
---|
244 | struct policy_handle *key_handle,
|
---|
245 | const char *value,
|
---|
246 | const char *data,
|
---|
247 | WERROR *pwerr);
|
---|
248 |
|
---|
249 | /**
|
---|
250 | * @brief Set a value with the specified multi sz data.
|
---|
251 | *
|
---|
252 | * @param[in] mem_ctx The memory context to use.
|
---|
253 | *
|
---|
254 | * @param[in] h The binding handle for the rpc connection.
|
---|
255 | *
|
---|
256 | * @param[in] key_handle A handle to a key that MUST have been opened
|
---|
257 | * previously.
|
---|
258 | *
|
---|
259 | * @param[in] value The name of the value to set.
|
---|
260 | *
|
---|
261 | * @param[in] data The data to store in the value.
|
---|
262 | *
|
---|
263 | * @param[out] pwerr A pointer to a WERROR to store result of the query.
|
---|
264 | *
|
---|
265 | * @return NT_STATUS_OK on success or a corresponding error if
|
---|
266 | * there was a problem on the connection.
|
---|
267 | */
|
---|
268 | NTSTATUS dcerpc_winreg_set_multi_sz(TALLOC_CTX *mem_ctx,
|
---|
269 | struct dcerpc_binding_handle *h,
|
---|
270 | struct policy_handle *key_handle,
|
---|
271 | const char *value,
|
---|
272 | const char **data,
|
---|
273 | WERROR *pwerr);
|
---|
274 |
|
---|
275 | /**
|
---|
276 | * @brief Set a value with the specified binary data.
|
---|
277 | *
|
---|
278 | * @param[in] mem_ctx The memory context to use.
|
---|
279 | *
|
---|
280 | * @param[in] h The binding handle for the rpc connection.
|
---|
281 | *
|
---|
282 | * @param[in] key_handle A handle to a key that MUST have been opened
|
---|
283 | * previously.
|
---|
284 | *
|
---|
285 | * @param[in] value The name of the value to set.
|
---|
286 | *
|
---|
287 | * @param[in] data The data to store in the value.
|
---|
288 | *
|
---|
289 | * @param[out] pwerr A pointer to a WERROR to store result of the query.
|
---|
290 | *
|
---|
291 | * @return NT_STATUS_OK on success or a corresponding error if
|
---|
292 | * there was a problem on the connection.
|
---|
293 | */
|
---|
294 | NTSTATUS dcerpc_winreg_set_binary(TALLOC_CTX *mem_ctx,
|
---|
295 | struct dcerpc_binding_handle *h,
|
---|
296 | struct policy_handle *key_handle,
|
---|
297 | const char *value,
|
---|
298 | DATA_BLOB *data,
|
---|
299 | WERROR *pwerr);
|
---|
300 |
|
---|
301 | /**
|
---|
302 | * @brief Set a value with the specified security descriptor.
|
---|
303 | *
|
---|
304 | * @param[in] mem_ctx The memory context to use.
|
---|
305 | *
|
---|
306 | * @param[in] h The binding handle for the rpc connection.
|
---|
307 | *
|
---|
308 | * @param[in] key_handle A handle to a key that MUST have been opened
|
---|
309 | * previously.
|
---|
310 | *
|
---|
311 | * @param[in] value The name of the value to set.
|
---|
312 | *
|
---|
313 | * @param[in] data The security descriptor to store in the value.
|
---|
314 | *
|
---|
315 | * @param[out] pwerr A pointer to a WERROR to store result of the query.
|
---|
316 | *
|
---|
317 | * @return NT_STATUS_OK on success or a corresponding error if
|
---|
318 | * there was a problem on the connection.
|
---|
319 | */
|
---|
320 | NTSTATUS dcerpc_winreg_set_sd(TALLOC_CTX *mem_ctx,
|
---|
321 | struct dcerpc_binding_handle *h,
|
---|
322 | struct policy_handle *key_handle,
|
---|
323 | const char *value,
|
---|
324 | const struct security_descriptor *data,
|
---|
325 | WERROR *pwerr);
|
---|
326 |
|
---|
327 | /**
|
---|
328 | * @brief Add a value to the multi sz data.
|
---|
329 | *
|
---|
330 | * This reads the multi sz data from the given value and adds the data to the
|
---|
331 | * multi sz. Then it saves it to the regsitry.
|
---|
332 | *
|
---|
333 | * @param[in] mem_ctx The memory context to use.
|
---|
334 | *
|
---|
335 | * @param[in] h The binding handle for the rpc connection.
|
---|
336 | *
|
---|
337 | * @param[in] key_handle A handle to a key that MUST have been opened
|
---|
338 | * previously.
|
---|
339 | *
|
---|
340 | * @param[in] value The name of the value to set.
|
---|
341 | *
|
---|
342 | * @param[in] data The data to add.
|
---|
343 | *
|
---|
344 | * @param[out] pwerr A pointer to a WERROR to store result of the query.
|
---|
345 | *
|
---|
346 | * @return NT_STATUS_OK on success or a corresponding error if
|
---|
347 | * there was a problem on the connection.
|
---|
348 | */
|
---|
349 | NTSTATUS dcerpc_winreg_add_multi_sz(TALLOC_CTX *mem_ctx,
|
---|
350 | struct dcerpc_binding_handle *h,
|
---|
351 | struct policy_handle *key_handle,
|
---|
352 | const char *value,
|
---|
353 | const char *data,
|
---|
354 | WERROR *pwerr);
|
---|
355 |
|
---|
356 | /**
|
---|
357 | * @brief Enumerate on the given keyhandle to get the subkey names.
|
---|
358 | *
|
---|
359 | * @param[in] mem_ctx The memory context to use.
|
---|
360 | *
|
---|
361 | * @param[in] h The binding handle for the rpc connection.
|
---|
362 | *
|
---|
363 | * @param[in] key_handle A handle to a key that MUST have been opened
|
---|
364 | * previously.
|
---|
365 | *
|
---|
366 | * @param[out] pnum_subkeys A pointer to store the number of subkeys.
|
---|
367 | *
|
---|
368 | * @param[out] psubkeys A pointer to store the names of the subkeys.
|
---|
369 | *
|
---|
370 | * @param[out] pwerr A pointer to a WERROR to store result of the query.
|
---|
371 | *
|
---|
372 | * @return NT_STATUS_OK on success or a corresponding error if
|
---|
373 | * there was a problem on the connection.
|
---|
374 | */
|
---|
375 | NTSTATUS dcerpc_winreg_enum_keys(TALLOC_CTX *mem_ctx,
|
---|
376 | struct dcerpc_binding_handle *h,
|
---|
377 | struct policy_handle *key_hnd,
|
---|
378 | uint32_t *pnum_subkeys,
|
---|
379 | const char ***psubkeys,
|
---|
380 | WERROR *pwerr);
|
---|
381 |
|
---|
382 | #endif /* CLI_WINREG_H */
|
---|
383 |
|
---|
384 | /* vim: set ts=8 sw=8 noet cindent syntax=c.doxygen: */
|
---|