2 * Unix SMB/CIFS implementation.
4 * WINREG client routines
6 * Copyright (c) 2011 Andreas Schneider <asn@samba.org>
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.
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.
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/>.
26 * @brief Query a key for the specified dword value.
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
32 * @param[in] mem_ctx The memory context to use.
34 * @param[in] h The binding handle for the rpc connection.
36 * @param[in] key_handle A handle to a key that MUST have been opened
39 * @param[in] value The name of the value to query.
41 * @param[out] data A pointer to store the data of the value.
43 * @param[out] pwerr A pointer to a WERROR to store result of the query.
45 * @return NT_STATUS_OK on success or a corresponding error if
46 * there was a problem on the connection.
48 NTSTATUS dcerpc_winreg_query_dword(TALLOC_CTX *mem_ctx,
49 struct dcerpc_binding_handle *h,
50 struct policy_handle *key_handle,
56 * @brief Query a key for the specified binary value.
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.
61 * @param[in] mem_ctx The memory context to use.
63 * @param[in] h The binding handle for the rpc connection.
65 * @param[in] key_handle A handle to a key that MUST have been opened
68 * @param[in] value The name of the value to query.
70 * @param[out] data A pointer to store the data of the value.
72 * @param[out] pwerr A pointer to a WERROR to store result of the query.
74 * @return NT_STATUS_OK on success or a corresponding error if
75 * there was a problem on the connection.
77 NTSTATUS dcerpc_winreg_query_binary(TALLOC_CTX *mem_ctx,
78 struct dcerpc_binding_handle *h,
79 struct policy_handle *key_handle,
85 * @brief Query a key for the specified multi sz value.
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.
90 * @param[in] mem_ctx The memory context to use.
92 * @param[in] h The binding handle for the rpc connection.
94 * @param[in] key_handle A handle to a key that MUST have been opened
97 * @param[in] value The name of the value to query.
99 * @param[out] data A pointer to store the data of the value.
101 * @param[out] pwerr A pointer to a WERROR to store result of the query.
103 * @return NT_STATUS_OK on success or a corresponding error if
104 * there was a problem on the connection.
106 NTSTATUS dcerpc_winreg_query_multi_sz(TALLOC_CTX *mem_ctx,
107 struct dcerpc_binding_handle *h,
108 struct policy_handle *key_handle,
114 * @brief Query a key for the specified sz value.
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.
119 * @param[in] mem_ctx The memory context to use.
121 * @param[in] h The binding handle for the rpc connection.
123 * @param[in] key_handle A handle to a key that MUST have been opened
126 * @param[in] value The name of the value to query.
128 * @param[out] data A pointer to store the data of the value.
130 * @param[out] pwerr A pointer to a WERROR to store result of the query.
132 * @return NT_STATUS_OK on success or a corresponding error if
133 * there was a problem on the connection.
135 NTSTATUS dcerpc_winreg_query_sz(TALLOC_CTX *mem_ctx,
136 struct dcerpc_binding_handle *h,
137 struct policy_handle *key_handle,
143 * @brief Set a value with the specified dword data.
145 * @param[in] mem_ctx The memory context to use.
147 * @param[in] h The binding handle for the rpc connection.
149 * @param[in] key_handle A handle to a key that MUST have been opened
152 * @param[in] value The name of the value to set.
154 * @param[in] data The data to store in the value.
156 * @param[out] pwerr A pointer to a WERROR to store result of the query.
158 * @return NT_STATUS_OK on success or a corresponding error if
159 * there was a problem on the connection.
161 NTSTATUS dcerpc_winreg_set_dword(TALLOC_CTX *mem_ctx,
162 struct dcerpc_binding_handle *h,
163 struct policy_handle *key_handle,
169 * @brief Set a value with the specified sz data.
171 * @param[in] mem_ctx The memory context to use.
173 * @param[in] h The binding handle for the rpc connection.
175 * @param[in] key_handle A handle to a key that MUST have been opened
178 * @param[in] value The name of the value to set.
180 * @param[in] data The data to store in the value.
182 * @param[out] pwerr A pointer to a WERROR to store result of the query.
184 * @return NT_STATUS_OK on success or a corresponding error if
185 * there was a problem on the connection.
187 NTSTATUS dcerpc_winreg_set_sz(TALLOC_CTX *mem_ctx,
188 struct dcerpc_binding_handle *h,
189 struct policy_handle *key_handle,
195 * @brief Set a value with the specified expand sz data.
197 * @param[in] mem_ctx The memory context to use.
199 * @param[in] h The binding handle for the rpc connection.
201 * @param[in] key_handle A handle to a key that MUST have been opened
204 * @param[in] value The name of the value to set.
206 * @param[in] data The data to store in the value.
208 * @param[out] pwerr A pointer to a WERROR to store result of the query.
210 * @return NT_STATUS_OK on success or a corresponding error if
211 * there was a problem on the connection.
213 NTSTATUS dcerpc_winreg_set_expand_sz(TALLOC_CTX *mem_ctx,
214 struct dcerpc_binding_handle *h,
215 struct policy_handle *key_handle,
221 * @brief Set a value with the specified multi sz data.
223 * @param[in] mem_ctx The memory context to use.
225 * @param[in] h The binding handle for the rpc connection.
227 * @param[in] key_handle A handle to a key that MUST have been opened
230 * @param[in] value The name of the value to set.
232 * @param[in] data The data to store in the value.
234 * @param[out] pwerr A pointer to a WERROR to store result of the query.
236 * @return NT_STATUS_OK on success or a corresponding error if
237 * there was a problem on the connection.
239 NTSTATUS dcerpc_winreg_set_multi_sz(TALLOC_CTX *mem_ctx,
240 struct dcerpc_binding_handle *h,
241 struct policy_handle *key_handle,
247 * @brief Set a value with the specified binary data.
249 * @param[in] mem_ctx The memory context to use.
251 * @param[in] h The binding handle for the rpc connection.
253 * @param[in] key_handle A handle to a key that MUST have been opened
256 * @param[in] value The name of the value to set.
258 * @param[in] data The data to store in the value.
260 * @param[out] pwerr A pointer to a WERROR to store result of the query.
262 * @return NT_STATUS_OK on success or a corresponding error if
263 * there was a problem on the connection.
265 NTSTATUS dcerpc_winreg_set_binary(TALLOC_CTX *mem_ctx,
266 struct dcerpc_binding_handle *h,
267 struct policy_handle *key_handle,
273 * @brief Set a value with the specified security descriptor.
275 * @param[in] mem_ctx The memory context to use.
277 * @param[in] h The binding handle for the rpc connection.
279 * @param[in] key_handle A handle to a key that MUST have been opened
282 * @param[in] value The name of the value to set.
284 * @param[in] data The security descriptor to store in the value.
286 * @param[out] pwerr A pointer to a WERROR to store result of the query.
288 * @return NT_STATUS_OK on success or a corresponding error if
289 * there was a problem on the connection.
291 NTSTATUS dcerpc_winreg_set_sd(TALLOC_CTX *mem_ctx,
292 struct dcerpc_binding_handle *h,
293 struct policy_handle *key_handle,
295 const struct security_descriptor *data,
299 * @brief Add a value to the multi sz data.
301 * This reads the multi sz data from the given value and adds the data to the
302 * multi sz. Then it saves it to the regsitry.
304 * @param[in] mem_ctx The memory context to use.
306 * @param[in] h The binding handle for the rpc connection.
308 * @param[in] key_handle A handle to a key that MUST have been opened
311 * @param[in] value The name of the value to set.
313 * @param[in] data The data to add.
315 * @param[out] pwerr A pointer to a WERROR to store result of the query.
317 * @return NT_STATUS_OK on success or a corresponding error if
318 * there was a problem on the connection.
320 NTSTATUS dcerpc_winreg_add_multi_sz(TALLOC_CTX *mem_ctx,
321 struct dcerpc_binding_handle *h,
322 struct policy_handle *key_handle,
328 * @brief Enumerate on the given keyhandle to get the subkey names.
330 * @param[in] mem_ctx The memory context to use.
332 * @param[in] h The binding handle for the rpc connection.
334 * @param[in] key_handle A handle to a key that MUST have been opened
337 * @param[out] pnum_subkeys A pointer to store the number of subkeys.
339 * @param[out] psubkeys A pointer to store the names of the subkeys.
341 * @param[out] pwerr A pointer to a WERROR to store result of the query.
343 * @return NT_STATUS_OK on success or a corresponding error if
344 * there was a problem on the connection.
346 NTSTATUS dcerpc_winreg_enum_keys(TALLOC_CTX *mem_ctx,
347 struct dcerpc_binding_handle *h,
348 struct policy_handle *key_hnd,
349 uint32_t *pnum_subkeys,
350 const char ***psubkeys,
353 #endif /* CLI_WINREG_H */
355 /* vim: set ts=8 sw=8 noet cindent syntax=c.doxygen: */