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) Anthony Liguori 2003.
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.
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.
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.
27 /* This is the interface for the registry functions. */
32 #define DBGC_CLASS DBGC_RPC_SRV
34 /*******************************************************************
36 ********************************************************************/
38 static BOOL
api_reg_close(pipes_struct
*p
)
42 prs_struct
*data
= &p
->in_data
.data
;
43 prs_struct
*rdata
= &p
->out_data
.rdata
;
48 /* grab the reg unknown 1 */
49 if(!reg_io_q_close("", &q_u
, data
, 0))
52 r_u
.status
= _reg_close(p
, &q_u
, &r_u
);
54 if(!reg_io_r_close("", &r_u
, rdata
, 0))
60 /*******************************************************************
62 ********************************************************************/
64 static BOOL
api_reg_open_hklm(pipes_struct
*p
)
68 prs_struct
*data
= &p
->in_data
.data
;
69 prs_struct
*rdata
= &p
->out_data
.rdata
;
74 /* grab the reg open */
75 if(!reg_io_q_open_hklm("", &q_u
, data
, 0))
78 r_u
.status
= _reg_open_hklm(p
, &q_u
, &r_u
);
80 if(!reg_io_r_open_hklm("", &r_u
, rdata
, 0))
86 /*******************************************************************
88 ********************************************************************/
90 static BOOL
api_reg_open_hku(pipes_struct
*p
)
94 prs_struct
*data
= &p
->in_data
.data
;
95 prs_struct
*rdata
= &p
->out_data
.rdata
;
100 /* grab the reg open */
101 if(!reg_io_q_open_hku("", &q_u
, data
, 0))
104 r_u
.status
= _reg_open_hku(p
, &q_u
, &r_u
);
106 if(!reg_io_r_open_hku("", &r_u
, rdata
, 0))
112 /*******************************************************************
114 ********************************************************************/
116 static BOOL
api_reg_open_hkcr(pipes_struct
*p
)
120 prs_struct
*data
= &p
->in_data
.data
;
121 prs_struct
*rdata
= &p
->out_data
.rdata
;
126 /* grab the reg open */
127 if(!reg_io_q_open_hkcr("", &q_u
, data
, 0))
130 r_u
.status
= _reg_open_hkcr(p
, &q_u
, &r_u
);
132 if(!reg_io_r_open_hkcr("", &r_u
, rdata
, 0))
139 /*******************************************************************
141 ********************************************************************/
143 static BOOL
api_reg_open_entry(pipes_struct
*p
)
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
;
153 /* grab the reg open entry */
154 if(!reg_io_q_open_entry("", &q_u
, data
, 0))
157 /* construct reply. */
158 r_u
.status
= _reg_open_entry(p
, &q_u
, &r_u
);
160 if(!reg_io_r_open_entry("", &r_u
, rdata
, 0))
166 /*******************************************************************
168 ********************************************************************/
170 static BOOL
api_reg_info(pipes_struct
*p
)
174 prs_struct
*data
= &p
->in_data
.data
;
175 prs_struct
*rdata
= &p
->out_data
.rdata
;
180 /* grab the reg unknown 0x11*/
181 if(!reg_io_q_info("", &q_u
, data
, 0))
184 r_u
.status
= _reg_info(p
, &q_u
, &r_u
);
186 if(!reg_io_r_info("", &r_u
, rdata
, 0))
192 /*******************************************************************
194 ********************************************************************/
196 static BOOL
api_reg_shutdown(pipes_struct
*p
)
200 prs_struct
*data
= &p
->in_data
.data
;
201 prs_struct
*rdata
= &p
->out_data
.rdata
;
206 /* grab the reg shutdown */
207 if(!reg_io_q_shutdown("", &q_u
, data
, 0))
210 r_u
.status
= _reg_shutdown(p
, &q_u
, &r_u
);
212 if(!reg_io_r_shutdown("", &r_u
, rdata
, 0))
218 /*******************************************************************
219 api_reg_abort_shutdown
220 ********************************************************************/
222 static BOOL
api_reg_abort_shutdown(pipes_struct
*p
)
224 REG_Q_ABORT_SHUTDOWN q_u
;
225 REG_R_ABORT_SHUTDOWN r_u
;
226 prs_struct
*data
= &p
->in_data
.data
;
227 prs_struct
*rdata
= &p
->out_data
.rdata
;
232 /* grab the reg shutdown */
233 if(!reg_io_q_abort_shutdown("", &q_u
, data
, 0))
236 r_u
.status
= _reg_abort_shutdown(p
, &q_u
, &r_u
);
238 if(!reg_io_r_abort_shutdown("", &r_u
, rdata
, 0))
245 /*******************************************************************
247 ********************************************************************/
249 static BOOL
api_reg_query_key(pipes_struct
*p
)
253 prs_struct
*data
= &p
->in_data
.data
;
254 prs_struct
*rdata
= &p
->out_data
.rdata
;
259 if(!reg_io_q_query_key("", &q_u
, data
, 0))
262 r_u
.status
= _reg_query_key(p
, &q_u
, &r_u
);
264 if(!reg_io_r_query_key("", &r_u
, rdata
, 0))
270 /*******************************************************************
272 ********************************************************************/
274 static BOOL
api_reg_unknown_1a(pipes_struct
*p
)
276 REG_Q_UNKNOWN_1A q_u
;
277 REG_R_UNKNOWN_1A r_u
;
278 prs_struct
*data
= &p
->in_data
.data
;
279 prs_struct
*rdata
= &p
->out_data
.rdata
;
284 if(!reg_io_q_unknown_1a("", &q_u
, data
, 0))
287 r_u
.status
= _reg_unknown_1a(p
, &q_u
, &r_u
);
289 if(!reg_io_r_unknown_1a("", &r_u
, rdata
, 0))
295 /*******************************************************************
297 ********************************************************************/
299 static BOOL
api_reg_enum_key(pipes_struct
*p
)
303 prs_struct
*data
= &p
->in_data
.data
;
304 prs_struct
*rdata
= &p
->out_data
.rdata
;
309 if(!reg_io_q_enum_key("", &q_u
, data
, 0))
312 r_u
.status
= _reg_enum_key(p
, &q_u
, &r_u
);
314 if(!reg_io_r_enum_key("", &r_u
, rdata
, 0))
320 /*******************************************************************
322 ********************************************************************/
324 static BOOL
api_reg_enum_value(pipes_struct
*p
)
326 REG_Q_ENUM_VALUE q_u
;
327 REG_R_ENUM_VALUE r_u
;
328 prs_struct
*data
= &p
->in_data
.data
;
329 prs_struct
*rdata
= &p
->out_data
.rdata
;
334 if(!reg_io_q_enum_val("", &q_u
, data
, 0))
337 r_u
.status
= _reg_enum_value(p
, &q_u
, &r_u
);
339 if(!reg_io_r_enum_val("", &r_u
, rdata
, 0))
345 /*******************************************************************
347 ********************************************************************/
349 static BOOL
api_reg_save_key(pipes_struct
*p
)
353 prs_struct
*data
= &p
->in_data
.data
;
354 prs_struct
*rdata
= &p
->out_data
.rdata
;
359 if(!reg_io_q_save_key("", &q_u
, data
, 0))
362 r_u
.status
= _reg_save_key(p
, &q_u
, &r_u
);
364 if(!reg_io_r_save_key("", &r_u
, rdata
, 0))
372 /*******************************************************************
373 array of \PIPE\reg operations
374 ********************************************************************/
376 int rpc_reg_init(void)
378 static struct api_struct api_reg_cmds
[] =
380 { "REG_CLOSE" , REG_CLOSE
, api_reg_close
},
381 { "REG_OPEN_ENTRY" , REG_OPEN_ENTRY
, api_reg_open_entry
},
382 { "REG_OPEN_HKCR" , REG_OPEN_HKCR
, api_reg_open_hkcr
},
383 { "REG_OPEN_HKLM" , REG_OPEN_HKLM
, api_reg_open_hklm
},
384 { "REG_OPEN_HKU" , REG_OPEN_HKU
, api_reg_open_hku
},
385 { "REG_ENUM_KEY" , REG_ENUM_KEY
, api_reg_enum_key
},
386 { "REG_ENUM_VALUE" , REG_ENUM_VALUE
, api_reg_enum_value
},
387 { "REG_QUERY_KEY" , REG_QUERY_KEY
, api_reg_query_key
},
388 { "REG_INFO" , REG_INFO
, api_reg_info
},
389 { "REG_SHUTDOWN" , REG_SHUTDOWN
, api_reg_shutdown
},
390 { "REG_ABORT_SHUTDOWN" , REG_ABORT_SHUTDOWN
, api_reg_abort_shutdown
},
391 { "REG_UNKNOWN_1A" , REG_UNKNOWN_1A
, api_reg_unknown_1a
},
392 { "REG_SAVE_KEY" , REG_SAVE_KEY
, api_reg_save_key
}
394 return rpc_pipe_register_commands("winreg", "winreg", api_reg_cmds
,
395 sizeof(api_reg_cmds
) / sizeof(struct api_struct
));