1 | /*
|
---|
2 | * Unix SMB/CIFS implementation.
|
---|
3 | * RPC Pipe client / server routines
|
---|
4 | * Copyright (C) Andrew Tridgell 1992-1997,
|
---|
5 | * Copyright (C) Luke Kenneth Casson Leighton 1996-1997,
|
---|
6 | * Copyright (C) Paul Ashton 1997,
|
---|
7 | * Copyright (C) Marc Jacobsen 2000,
|
---|
8 | * Copyright (C) Jeremy Allison 2001,
|
---|
9 | * Copyright (C) Gerald Carter 2002,
|
---|
10 | * Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2003.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or modify
|
---|
13 | * it under the terms of the GNU General Public License as published by
|
---|
14 | * the Free Software Foundation; either version 2 of the License, or
|
---|
15 | * (at your option) any later version.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful,
|
---|
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
20 | * GNU General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, write to the Free Software
|
---|
24 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
25 | */
|
---|
26 |
|
---|
27 | /* This is the interface for the registry functions. */
|
---|
28 |
|
---|
29 | #include "includes.h"
|
---|
30 |
|
---|
31 | #undef DBGC_CLASS
|
---|
32 | #define DBGC_CLASS DBGC_RPC_SRV
|
---|
33 |
|
---|
34 | /*******************************************************************
|
---|
35 | api_reg_close
|
---|
36 | ********************************************************************/
|
---|
37 |
|
---|
38 | static BOOL api_reg_close(pipes_struct *p)
|
---|
39 | {
|
---|
40 | REG_Q_CLOSE q_u;
|
---|
41 | REG_R_CLOSE r_u;
|
---|
42 | prs_struct *data = &p->in_data.data;
|
---|
43 | prs_struct *rdata = &p->out_data.rdata;
|
---|
44 |
|
---|
45 | ZERO_STRUCT(q_u);
|
---|
46 | ZERO_STRUCT(r_u);
|
---|
47 |
|
---|
48 | /* grab the reg unknown 1 */
|
---|
49 | if(!reg_io_q_close("", &q_u, data, 0))
|
---|
50 | return False;
|
---|
51 |
|
---|
52 | r_u.status = _reg_close(p, &q_u, &r_u);
|
---|
53 |
|
---|
54 | if(!reg_io_r_close("", &r_u, rdata, 0))
|
---|
55 | return False;
|
---|
56 |
|
---|
57 | return True;
|
---|
58 | }
|
---|
59 |
|
---|
60 | /*******************************************************************
|
---|
61 | api_reg_open_khlm
|
---|
62 | ********************************************************************/
|
---|
63 |
|
---|
64 | static BOOL api_reg_open_hklm(pipes_struct *p)
|
---|
65 | {
|
---|
66 | REG_Q_OPEN_HIVE q_u;
|
---|
67 | REG_R_OPEN_HIVE r_u;
|
---|
68 | prs_struct *data = &p->in_data.data;
|
---|
69 | prs_struct *rdata = &p->out_data.rdata;
|
---|
70 |
|
---|
71 | ZERO_STRUCT(q_u);
|
---|
72 | ZERO_STRUCT(r_u);
|
---|
73 |
|
---|
74 | /* grab the reg open */
|
---|
75 | if(!reg_io_q_open_hive("", &q_u, data, 0))
|
---|
76 | return False;
|
---|
77 |
|
---|
78 | r_u.status = _reg_open_hklm(p, &q_u, &r_u);
|
---|
79 |
|
---|
80 | if(!reg_io_r_open_hive("", &r_u, rdata, 0))
|
---|
81 | return False;
|
---|
82 |
|
---|
83 | return True;
|
---|
84 | }
|
---|
85 |
|
---|
86 | /*******************************************************************
|
---|
87 | api_reg_open_khu
|
---|
88 | ********************************************************************/
|
---|
89 |
|
---|
90 | static BOOL api_reg_open_hku(pipes_struct *p)
|
---|
91 | {
|
---|
92 | REG_Q_OPEN_HIVE q_u;
|
---|
93 | REG_R_OPEN_HIVE r_u;
|
---|
94 | prs_struct *data = &p->in_data.data;
|
---|
95 | prs_struct *rdata = &p->out_data.rdata;
|
---|
96 |
|
---|
97 | ZERO_STRUCT(q_u);
|
---|
98 | ZERO_STRUCT(r_u);
|
---|
99 |
|
---|
100 | /* grab the reg open */
|
---|
101 | if(!reg_io_q_open_hive("", &q_u, data, 0))
|
---|
102 | return False;
|
---|
103 |
|
---|
104 | r_u.status = _reg_open_hku(p, &q_u, &r_u);
|
---|
105 |
|
---|
106 | if(!reg_io_r_open_hive("", &r_u, rdata, 0))
|
---|
107 | return False;
|
---|
108 |
|
---|
109 | return True;
|
---|
110 | }
|
---|
111 |
|
---|
112 | /*******************************************************************
|
---|
113 | api_reg_open_khcr
|
---|
114 | ********************************************************************/
|
---|
115 |
|
---|
116 | static BOOL api_reg_open_hkcr(pipes_struct *p)
|
---|
117 | {
|
---|
118 | REG_Q_OPEN_HIVE q_u;
|
---|
119 | REG_R_OPEN_HIVE r_u;
|
---|
120 | prs_struct *data = &p->in_data.data;
|
---|
121 | prs_struct *rdata = &p->out_data.rdata;
|
---|
122 |
|
---|
123 | ZERO_STRUCT(q_u);
|
---|
124 | ZERO_STRUCT(r_u);
|
---|
125 |
|
---|
126 | /* grab the reg open */
|
---|
127 | if(!reg_io_q_open_hive("", &q_u, data, 0))
|
---|
128 | return False;
|
---|
129 |
|
---|
130 | r_u.status = _reg_open_hkcr(p, &q_u, &r_u);
|
---|
131 |
|
---|
132 | if(!reg_io_r_open_hive("", &r_u, rdata, 0))
|
---|
133 | return False;
|
---|
134 |
|
---|
135 | return True;
|
---|
136 | }
|
---|
137 |
|
---|
138 |
|
---|
139 | /*******************************************************************
|
---|
140 | api_reg_open_entry
|
---|
141 | ********************************************************************/
|
---|
142 |
|
---|
143 | static BOOL api_reg_open_entry(pipes_struct *p)
|
---|
144 | {
|
---|
145 | REG_Q_OPEN_ENTRY q_u;
|
---|
146 | REG_R_OPEN_ENTRY r_u;
|
---|
147 | prs_struct *data = &p->in_data.data;
|
---|
148 | prs_struct *rdata = &p->out_data.rdata;
|
---|
149 |
|
---|
150 | ZERO_STRUCT(q_u);
|
---|
151 | ZERO_STRUCT(r_u);
|
---|
152 |
|
---|
153 | /* grab the reg open entry */
|
---|
154 | if(!reg_io_q_open_entry("", &q_u, data, 0))
|
---|
155 | return False;
|
---|
156 |
|
---|
157 | /* construct reply. */
|
---|
158 | r_u.status = _reg_open_entry(p, &q_u, &r_u);
|
---|
159 |
|
---|
160 | if(!reg_io_r_open_entry("", &r_u, rdata, 0))
|
---|
161 | return False;
|
---|
162 |
|
---|
163 | return True;
|
---|
164 | }
|
---|
165 |
|
---|
166 | /*******************************************************************
|
---|
167 | api_reg_query_value
|
---|
168 | ********************************************************************/
|
---|
169 |
|
---|
170 | static BOOL api_reg_query_value(pipes_struct *p)
|
---|
171 | {
|
---|
172 | REG_Q_QUERY_VALUE q_u;
|
---|
173 | REG_R_QUERY_VALUE r_u;
|
---|
174 | prs_struct *data = &p->in_data.data;
|
---|
175 | prs_struct *rdata = &p->out_data.rdata;
|
---|
176 |
|
---|
177 | ZERO_STRUCT(q_u);
|
---|
178 | ZERO_STRUCT(r_u);
|
---|
179 |
|
---|
180 | /* grab the reg unknown 0x11*/
|
---|
181 | if(!reg_io_q_query_value("", &q_u, data, 0))
|
---|
182 | return False;
|
---|
183 |
|
---|
184 | r_u.status = _reg_query_value(p, &q_u, &r_u);
|
---|
185 |
|
---|
186 | if(!reg_io_r_query_value("", &r_u, rdata, 0))
|
---|
187 | return False;
|
---|
188 |
|
---|
189 | return True;
|
---|
190 | }
|
---|
191 |
|
---|
192 | /*******************************************************************
|
---|
193 | api_reg_shutdown
|
---|
194 | ********************************************************************/
|
---|
195 |
|
---|
196 | static BOOL api_reg_shutdown(pipes_struct *p)
|
---|
197 | {
|
---|
198 | REG_Q_SHUTDOWN q_u;
|
---|
199 | REG_R_SHUTDOWN r_u;
|
---|
200 | prs_struct *data = &p->in_data.data;
|
---|
201 | prs_struct *rdata = &p->out_data.rdata;
|
---|
202 |
|
---|
203 | ZERO_STRUCT(q_u);
|
---|
204 | ZERO_STRUCT(r_u);
|
---|
205 |
|
---|
206 | /* grab the reg shutdown */
|
---|
207 | if(!reg_io_q_shutdown("", &q_u, data, 0))
|
---|
208 | return False;
|
---|
209 |
|
---|
210 | r_u.status = _reg_shutdown(p, &q_u, &r_u);
|
---|
211 |
|
---|
212 | if(!reg_io_r_shutdown("", &r_u, rdata, 0))
|
---|
213 | return False;
|
---|
214 |
|
---|
215 | return True;
|
---|
216 | }
|
---|
217 |
|
---|
218 | /*******************************************************************
|
---|
219 | api_reg_shutdown_ex
|
---|
220 | ********************************************************************/
|
---|
221 |
|
---|
222 | static BOOL api_reg_shutdown_ex(pipes_struct *p)
|
---|
223 | {
|
---|
224 | REG_Q_SHUTDOWN_EX q_u;
|
---|
225 | REG_R_SHUTDOWN_EX r_u;
|
---|
226 | prs_struct *data = &p->in_data.data;
|
---|
227 | prs_struct *rdata = &p->out_data.rdata;
|
---|
228 |
|
---|
229 | ZERO_STRUCT(q_u);
|
---|
230 | ZERO_STRUCT(r_u);
|
---|
231 |
|
---|
232 | /* grab the reg shutdown ex */
|
---|
233 | if(!reg_io_q_shutdown_ex("", &q_u, data, 0))
|
---|
234 | return False;
|
---|
235 |
|
---|
236 | r_u.status = _reg_shutdown_ex(p, &q_u, &r_u);
|
---|
237 |
|
---|
238 | if(!reg_io_r_shutdown_ex("", &r_u, rdata, 0))
|
---|
239 | return False;
|
---|
240 |
|
---|
241 | return True;
|
---|
242 | }
|
---|
243 |
|
---|
244 | /*******************************************************************
|
---|
245 | api_reg_abort_shutdown
|
---|
246 | ********************************************************************/
|
---|
247 |
|
---|
248 | static BOOL api_reg_abort_shutdown(pipes_struct *p)
|
---|
249 | {
|
---|
250 | REG_Q_ABORT_SHUTDOWN q_u;
|
---|
251 | REG_R_ABORT_SHUTDOWN r_u;
|
---|
252 | prs_struct *data = &p->in_data.data;
|
---|
253 | prs_struct *rdata = &p->out_data.rdata;
|
---|
254 |
|
---|
255 | ZERO_STRUCT(q_u);
|
---|
256 | ZERO_STRUCT(r_u);
|
---|
257 |
|
---|
258 | /* grab the reg shutdown */
|
---|
259 | if(!reg_io_q_abort_shutdown("", &q_u, data, 0))
|
---|
260 | return False;
|
---|
261 |
|
---|
262 | r_u.status = _reg_abort_shutdown(p, &q_u, &r_u);
|
---|
263 |
|
---|
264 | if(!reg_io_r_abort_shutdown("", &r_u, rdata, 0))
|
---|
265 | return False;
|
---|
266 |
|
---|
267 | return True;
|
---|
268 | }
|
---|
269 |
|
---|
270 |
|
---|
271 | /*******************************************************************
|
---|
272 | api_reg_query_key
|
---|
273 | ********************************************************************/
|
---|
274 |
|
---|
275 | static BOOL api_reg_query_key(pipes_struct *p)
|
---|
276 | {
|
---|
277 | REG_Q_QUERY_KEY q_u;
|
---|
278 | REG_R_QUERY_KEY r_u;
|
---|
279 | prs_struct *data = &p->in_data.data;
|
---|
280 | prs_struct *rdata = &p->out_data.rdata;
|
---|
281 |
|
---|
282 | ZERO_STRUCT(q_u);
|
---|
283 | ZERO_STRUCT(r_u);
|
---|
284 |
|
---|
285 | if(!reg_io_q_query_key("", &q_u, data, 0))
|
---|
286 | return False;
|
---|
287 |
|
---|
288 | r_u.status = _reg_query_key(p, &q_u, &r_u);
|
---|
289 |
|
---|
290 | if(!reg_io_r_query_key("", &r_u, rdata, 0))
|
---|
291 | return False;
|
---|
292 |
|
---|
293 | return True;
|
---|
294 | }
|
---|
295 |
|
---|
296 | /*******************************************************************
|
---|
297 | api_reg_getversion
|
---|
298 | ********************************************************************/
|
---|
299 |
|
---|
300 | static BOOL api_reg_getversion(pipes_struct *p)
|
---|
301 | {
|
---|
302 | REG_Q_GETVERSION q_u;
|
---|
303 | REG_R_GETVERSION r_u;
|
---|
304 | prs_struct *data = &p->in_data.data;
|
---|
305 | prs_struct *rdata = &p->out_data.rdata;
|
---|
306 |
|
---|
307 | ZERO_STRUCT(q_u);
|
---|
308 | ZERO_STRUCT(r_u);
|
---|
309 |
|
---|
310 | if(!reg_io_q_getversion("", &q_u, data, 0))
|
---|
311 | return False;
|
---|
312 |
|
---|
313 | r_u.status = _reg_getversion(p, &q_u, &r_u);
|
---|
314 |
|
---|
315 | if(!reg_io_r_getversion("", &r_u, rdata, 0))
|
---|
316 | return False;
|
---|
317 |
|
---|
318 | return True;
|
---|
319 | }
|
---|
320 |
|
---|
321 | /*******************************************************************
|
---|
322 | api_reg_enum_key
|
---|
323 | ********************************************************************/
|
---|
324 |
|
---|
325 | static BOOL api_reg_enum_key(pipes_struct *p)
|
---|
326 | {
|
---|
327 | REG_Q_ENUM_KEY q_u;
|
---|
328 | REG_R_ENUM_KEY r_u;
|
---|
329 | prs_struct *data = &p->in_data.data;
|
---|
330 | prs_struct *rdata = &p->out_data.rdata;
|
---|
331 |
|
---|
332 | ZERO_STRUCT(q_u);
|
---|
333 | ZERO_STRUCT(r_u);
|
---|
334 |
|
---|
335 | if(!reg_io_q_enum_key("", &q_u, data, 0))
|
---|
336 | return False;
|
---|
337 |
|
---|
338 | r_u.status = _reg_enum_key(p, &q_u, &r_u);
|
---|
339 |
|
---|
340 | if(!reg_io_r_enum_key("", &r_u, rdata, 0))
|
---|
341 | return False;
|
---|
342 |
|
---|
343 | return True;
|
---|
344 | }
|
---|
345 |
|
---|
346 | /*******************************************************************
|
---|
347 | api_reg_enum_value
|
---|
348 | ********************************************************************/
|
---|
349 |
|
---|
350 | static BOOL api_reg_enum_value(pipes_struct *p)
|
---|
351 | {
|
---|
352 | REG_Q_ENUM_VALUE q_u;
|
---|
353 | REG_R_ENUM_VALUE r_u;
|
---|
354 | prs_struct *data = &p->in_data.data;
|
---|
355 | prs_struct *rdata = &p->out_data.rdata;
|
---|
356 |
|
---|
357 | ZERO_STRUCT(q_u);
|
---|
358 | ZERO_STRUCT(r_u);
|
---|
359 |
|
---|
360 | if(!reg_io_q_enum_val("", &q_u, data, 0))
|
---|
361 | return False;
|
---|
362 |
|
---|
363 | r_u.status = _reg_enum_value(p, &q_u, &r_u);
|
---|
364 |
|
---|
365 | if(!reg_io_r_enum_val("", &r_u, rdata, 0))
|
---|
366 | return False;
|
---|
367 |
|
---|
368 | return True;
|
---|
369 | }
|
---|
370 |
|
---|
371 | /*******************************************************************
|
---|
372 | ******************************************************************/
|
---|
373 |
|
---|
374 | static BOOL api_reg_restore_key(pipes_struct *p)
|
---|
375 | {
|
---|
376 | REG_Q_RESTORE_KEY q_u;
|
---|
377 | REG_R_RESTORE_KEY r_u;
|
---|
378 | prs_struct *data = &p->in_data.data;
|
---|
379 | prs_struct *rdata = &p->out_data.rdata;
|
---|
380 |
|
---|
381 | ZERO_STRUCT(q_u);
|
---|
382 | ZERO_STRUCT(r_u);
|
---|
383 |
|
---|
384 | if(!reg_io_q_restore_key("", &q_u, data, 0))
|
---|
385 | return False;
|
---|
386 |
|
---|
387 | r_u.status = _reg_restore_key(p, &q_u, &r_u);
|
---|
388 |
|
---|
389 | if(!reg_io_r_restore_key("", &r_u, rdata, 0))
|
---|
390 | return False;
|
---|
391 |
|
---|
392 | return True;
|
---|
393 | }
|
---|
394 |
|
---|
395 | /*******************************************************************
|
---|
396 | ********************************************************************/
|
---|
397 |
|
---|
398 | static BOOL api_reg_save_key(pipes_struct *p)
|
---|
399 | {
|
---|
400 | REG_Q_SAVE_KEY q_u;
|
---|
401 | REG_R_SAVE_KEY r_u;
|
---|
402 | prs_struct *data = &p->in_data.data;
|
---|
403 | prs_struct *rdata = &p->out_data.rdata;
|
---|
404 |
|
---|
405 | ZERO_STRUCT(q_u);
|
---|
406 | ZERO_STRUCT(r_u);
|
---|
407 |
|
---|
408 | if(!reg_io_q_save_key("", &q_u, data, 0))
|
---|
409 | return False;
|
---|
410 |
|
---|
411 | r_u.status = _reg_save_key(p, &q_u, &r_u);
|
---|
412 |
|
---|
413 | if(!reg_io_r_save_key("", &r_u, rdata, 0))
|
---|
414 | return False;
|
---|
415 |
|
---|
416 | return True;
|
---|
417 | }
|
---|
418 |
|
---|
419 | /*******************************************************************
|
---|
420 | api_reg_open_hkpd
|
---|
421 | ********************************************************************/
|
---|
422 |
|
---|
423 | static BOOL api_reg_open_hkpd(pipes_struct *p)
|
---|
424 | {
|
---|
425 | REG_Q_OPEN_HIVE q_u;
|
---|
426 | REG_R_OPEN_HIVE r_u;
|
---|
427 | prs_struct *data = &p->in_data.data;
|
---|
428 | prs_struct *rdata = &p->out_data.rdata;
|
---|
429 |
|
---|
430 | ZERO_STRUCT(q_u);
|
---|
431 | ZERO_STRUCT(r_u);
|
---|
432 |
|
---|
433 | /* grab the reg open */
|
---|
434 | if(!reg_io_q_open_hive("", &q_u, data, 0))
|
---|
435 | return False;
|
---|
436 |
|
---|
437 | r_u.status = _reg_open_hkpd(p, &q_u, &r_u);
|
---|
438 |
|
---|
439 | if(!reg_io_r_open_hive("", &r_u, rdata, 0))
|
---|
440 | return False;
|
---|
441 |
|
---|
442 | return True;
|
---|
443 | }
|
---|
444 |
|
---|
445 | /*******************************************************************
|
---|
446 | api_reg_open_hkpd
|
---|
447 | ********************************************************************/
|
---|
448 | static BOOL api_reg_open_hkpt(pipes_struct *p)
|
---|
449 | {
|
---|
450 | REG_Q_OPEN_HIVE q_u;
|
---|
451 | REG_R_OPEN_HIVE r_u;
|
---|
452 | prs_struct *data = &p->in_data.data;
|
---|
453 | prs_struct *rdata = &p->out_data.rdata;
|
---|
454 |
|
---|
455 | ZERO_STRUCT(q_u);
|
---|
456 | ZERO_STRUCT(r_u);
|
---|
457 |
|
---|
458 | /* grab the reg open */
|
---|
459 | if(!reg_io_q_open_hive("", &q_u, data, 0))
|
---|
460 | return False;
|
---|
461 |
|
---|
462 | r_u.status = _reg_open_hkpt(p, &q_u, &r_u);
|
---|
463 |
|
---|
464 | if(!reg_io_r_open_hive("", &r_u, rdata, 0))
|
---|
465 | return False;
|
---|
466 |
|
---|
467 | return True;
|
---|
468 | }
|
---|
469 |
|
---|
470 | /*******************************************************************
|
---|
471 | ******************************************************************/
|
---|
472 |
|
---|
473 | static BOOL api_reg_create_key_ex(pipes_struct *p)
|
---|
474 | {
|
---|
475 | REG_Q_CREATE_KEY_EX q_u;
|
---|
476 | REG_R_CREATE_KEY_EX r_u;
|
---|
477 | prs_struct *data = &p->in_data.data;
|
---|
478 | prs_struct *rdata = &p->out_data.rdata;
|
---|
479 |
|
---|
480 | ZERO_STRUCT(q_u);
|
---|
481 | ZERO_STRUCT(r_u);
|
---|
482 |
|
---|
483 | if(!reg_io_q_create_key_ex("", &q_u, data, 0))
|
---|
484 | return False;
|
---|
485 |
|
---|
486 | r_u.status = _reg_create_key_ex(p, &q_u, &r_u);
|
---|
487 |
|
---|
488 | if(!reg_io_r_create_key_ex("", &r_u, rdata, 0))
|
---|
489 | return False;
|
---|
490 |
|
---|
491 | return True;
|
---|
492 | }
|
---|
493 |
|
---|
494 | /*******************************************************************
|
---|
495 | ******************************************************************/
|
---|
496 |
|
---|
497 | static BOOL api_reg_set_value(pipes_struct *p)
|
---|
498 | {
|
---|
499 | REG_Q_SET_VALUE q_u;
|
---|
500 | REG_R_SET_VALUE r_u;
|
---|
501 | prs_struct *data = &p->in_data.data;
|
---|
502 | prs_struct *rdata = &p->out_data.rdata;
|
---|
503 |
|
---|
504 | ZERO_STRUCT(q_u);
|
---|
505 | ZERO_STRUCT(r_u);
|
---|
506 |
|
---|
507 | if(!reg_io_q_set_value("", &q_u, data, 0))
|
---|
508 | return False;
|
---|
509 |
|
---|
510 | r_u.status = _reg_set_value(p, &q_u, &r_u);
|
---|
511 |
|
---|
512 | if(!reg_io_r_set_value("", &r_u, rdata, 0))
|
---|
513 | return False;
|
---|
514 |
|
---|
515 | return True;
|
---|
516 | }
|
---|
517 |
|
---|
518 | /*******************************************************************
|
---|
519 | ******************************************************************/
|
---|
520 |
|
---|
521 | static BOOL api_reg_delete_key(pipes_struct *p)
|
---|
522 | {
|
---|
523 | REG_Q_DELETE_KEY q_u;
|
---|
524 | REG_R_DELETE_KEY r_u;
|
---|
525 | prs_struct *data = &p->in_data.data;
|
---|
526 | prs_struct *rdata = &p->out_data.rdata;
|
---|
527 |
|
---|
528 | ZERO_STRUCT(q_u);
|
---|
529 | ZERO_STRUCT(r_u);
|
---|
530 |
|
---|
531 | if(!reg_io_q_delete_key("", &q_u, data, 0))
|
---|
532 | return False;
|
---|
533 |
|
---|
534 | r_u.status = _reg_delete_key(p, &q_u, &r_u);
|
---|
535 |
|
---|
536 | if(!reg_io_r_delete_key("", &r_u, rdata, 0))
|
---|
537 | return False;
|
---|
538 |
|
---|
539 | return True;
|
---|
540 | }
|
---|
541 |
|
---|
542 | /*******************************************************************
|
---|
543 | ******************************************************************/
|
---|
544 |
|
---|
545 | static BOOL api_reg_delete_value(pipes_struct *p)
|
---|
546 | {
|
---|
547 | REG_Q_DELETE_VALUE q_u;
|
---|
548 | REG_R_DELETE_VALUE r_u;
|
---|
549 | prs_struct *data = &p->in_data.data;
|
---|
550 | prs_struct *rdata = &p->out_data.rdata;
|
---|
551 |
|
---|
552 | ZERO_STRUCT(q_u);
|
---|
553 | ZERO_STRUCT(r_u);
|
---|
554 |
|
---|
555 | if(!reg_io_q_delete_value("", &q_u, data, 0))
|
---|
556 | return False;
|
---|
557 |
|
---|
558 | r_u.status = _reg_delete_value(p, &q_u, &r_u);
|
---|
559 |
|
---|
560 | if(!reg_io_r_delete_value("", &r_u, rdata, 0))
|
---|
561 | return False;
|
---|
562 |
|
---|
563 | return True;
|
---|
564 | }
|
---|
565 |
|
---|
566 |
|
---|
567 | /*******************************************************************
|
---|
568 | ******************************************************************/
|
---|
569 |
|
---|
570 | static BOOL api_reg_get_key_sec(pipes_struct *p)
|
---|
571 | {
|
---|
572 | REG_Q_GET_KEY_SEC q_u;
|
---|
573 | REG_R_GET_KEY_SEC r_u;
|
---|
574 | prs_struct *data = &p->in_data.data;
|
---|
575 | prs_struct *rdata = &p->out_data.rdata;
|
---|
576 |
|
---|
577 | ZERO_STRUCT(q_u);
|
---|
578 | ZERO_STRUCT(r_u);
|
---|
579 |
|
---|
580 | if(!reg_io_q_get_key_sec("", &q_u, data, 0))
|
---|
581 | return False;
|
---|
582 |
|
---|
583 | r_u.status = _reg_get_key_sec(p, &q_u, &r_u);
|
---|
584 |
|
---|
585 | if(!reg_io_r_get_key_sec("", &r_u, rdata, 0))
|
---|
586 | return False;
|
---|
587 |
|
---|
588 | return True;
|
---|
589 | }
|
---|
590 |
|
---|
591 |
|
---|
592 | /*******************************************************************
|
---|
593 | ******************************************************************/
|
---|
594 |
|
---|
595 | static BOOL api_reg_set_key_sec(pipes_struct *p)
|
---|
596 | {
|
---|
597 | REG_Q_SET_KEY_SEC q_u;
|
---|
598 | REG_R_SET_KEY_SEC r_u;
|
---|
599 | prs_struct *data = &p->in_data.data;
|
---|
600 | prs_struct *rdata = &p->out_data.rdata;
|
---|
601 |
|
---|
602 | ZERO_STRUCT(q_u);
|
---|
603 | ZERO_STRUCT(r_u);
|
---|
604 |
|
---|
605 | if(!reg_io_q_set_key_sec("", &q_u, data, 0))
|
---|
606 | return False;
|
---|
607 |
|
---|
608 | r_u.status = _reg_set_key_sec(p, &q_u, &r_u);
|
---|
609 |
|
---|
610 | if(!reg_io_r_set_key_sec("", &r_u, rdata, 0))
|
---|
611 | return False;
|
---|
612 |
|
---|
613 | return True;
|
---|
614 | }
|
---|
615 |
|
---|
616 |
|
---|
617 | /*******************************************************************
|
---|
618 | array of \PIPE\reg operations
|
---|
619 | ********************************************************************/
|
---|
620 |
|
---|
621 | static struct api_struct api_reg_cmds[] =
|
---|
622 | {
|
---|
623 | { "REG_CLOSE" , REG_CLOSE , api_reg_close },
|
---|
624 | { "REG_OPEN_ENTRY" , REG_OPEN_ENTRY , api_reg_open_entry },
|
---|
625 | { "REG_OPEN_HKCR" , REG_OPEN_HKCR , api_reg_open_hkcr },
|
---|
626 | { "REG_OPEN_HKLM" , REG_OPEN_HKLM , api_reg_open_hklm },
|
---|
627 | { "REG_OPEN_HKPD" , REG_OPEN_HKPD , api_reg_open_hkpd },
|
---|
628 | { "REG_OPEN_HKPT" , REG_OPEN_HKPT , api_reg_open_hkpt },
|
---|
629 | { "REG_OPEN_HKU" , REG_OPEN_HKU , api_reg_open_hku },
|
---|
630 | { "REG_ENUM_KEY" , REG_ENUM_KEY , api_reg_enum_key },
|
---|
631 | { "REG_ENUM_VALUE" , REG_ENUM_VALUE , api_reg_enum_value },
|
---|
632 | { "REG_QUERY_KEY" , REG_QUERY_KEY , api_reg_query_key },
|
---|
633 | { "REG_QUERY_VALUE" , REG_QUERY_VALUE , api_reg_query_value },
|
---|
634 | { "REG_SHUTDOWN" , REG_SHUTDOWN , api_reg_shutdown },
|
---|
635 | { "REG_SHUTDOWN_EX" , REG_SHUTDOWN_EX , api_reg_shutdown_ex },
|
---|
636 | { "REG_ABORT_SHUTDOWN" , REG_ABORT_SHUTDOWN , api_reg_abort_shutdown },
|
---|
637 | { "REG_GETVERSION" , REG_GETVERSION , api_reg_getversion },
|
---|
638 | { "REG_SAVE_KEY" , REG_SAVE_KEY , api_reg_save_key },
|
---|
639 | { "REG_RESTORE_KEY" , REG_RESTORE_KEY , api_reg_restore_key },
|
---|
640 | { "REG_CREATE_KEY_EX" , REG_CREATE_KEY_EX , api_reg_create_key_ex },
|
---|
641 | { "REG_SET_VALUE" , REG_SET_VALUE , api_reg_set_value },
|
---|
642 | { "REG_DELETE_KEY" , REG_DELETE_KEY , api_reg_delete_key },
|
---|
643 | { "REG_DELETE_VALUE" , REG_DELETE_VALUE , api_reg_delete_value },
|
---|
644 | { "REG_GET_KEY_SEC" , REG_GET_KEY_SEC , api_reg_get_key_sec },
|
---|
645 | { "REG_SET_KEY_SEC" , REG_SET_KEY_SEC , api_reg_set_key_sec }
|
---|
646 | };
|
---|
647 |
|
---|
648 | void reg_get_pipe_fns( struct api_struct **fns, int *n_fns )
|
---|
649 | {
|
---|
650 | *fns = api_reg_cmds;
|
---|
651 | *n_fns = sizeof(api_reg_cmds) / sizeof(struct api_struct);
|
---|
652 | }
|
---|
653 |
|
---|
654 | NTSTATUS rpc_reg_init(void)
|
---|
655 | {
|
---|
656 |
|
---|
657 | return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "winreg", "winreg", api_reg_cmds,
|
---|
658 | sizeof(api_reg_cmds) / sizeof(struct api_struct));
|
---|
659 | }
|
---|