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.
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 /* This is the interface for the registry functions. */
31 #define DBGC_CLASS DBGC_RPC_SRV
33 /*******************************************************************
35 ********************************************************************/
37 static BOOL
api_reg_close(pipes_struct
*p
)
41 prs_struct
*data
= &p
->in_data
.data
;
42 prs_struct
*rdata
= &p
->out_data
.rdata
;
47 /* grab the reg unknown 1 */
48 if(!reg_io_q_close("", &q_u
, data
, 0))
51 r_u
.status
= _reg_close(p
, &q_u
, &r_u
);
53 if(!reg_io_r_close("", &r_u
, rdata
, 0))
59 /*******************************************************************
61 ********************************************************************/
63 static BOOL
api_reg_open_hklm(pipes_struct
*p
)
67 prs_struct
*data
= &p
->in_data
.data
;
68 prs_struct
*rdata
= &p
->out_data
.rdata
;
73 /* grab the reg open */
74 if(!reg_io_q_open_hklm("", &q_u
, data
, 0))
77 r_u
.status
= _reg_open_hklm(p
, &q_u
, &r_u
);
79 if(!reg_io_r_open_hklm("", &r_u
, rdata
, 0))
85 /*******************************************************************
87 ********************************************************************/
89 static BOOL
api_reg_open_hku(pipes_struct
*p
)
93 prs_struct
*data
= &p
->in_data
.data
;
94 prs_struct
*rdata
= &p
->out_data
.rdata
;
99 /* grab the reg open */
100 if(!reg_io_q_open_hku("", &q_u
, data
, 0))
103 r_u
.status
= _reg_open_hku(p
, &q_u
, &r_u
);
105 if(!reg_io_r_open_hku("", &r_u
, rdata
, 0))
111 /*******************************************************************
113 ********************************************************************/
115 static BOOL
api_reg_open_hkcr(pipes_struct
*p
)
119 prs_struct
*data
= &p
->in_data
.data
;
120 prs_struct
*rdata
= &p
->out_data
.rdata
;
125 /* grab the reg open */
126 if(!reg_io_q_open_hkcr("", &q_u
, data
, 0))
129 r_u
.status
= _reg_open_hkcr(p
, &q_u
, &r_u
);
131 if(!reg_io_r_open_hkcr("", &r_u
, rdata
, 0))
138 /*******************************************************************
140 ********************************************************************/
142 static BOOL
api_reg_open_entry(pipes_struct
*p
)
144 REG_Q_OPEN_ENTRY q_u
;
145 REG_R_OPEN_ENTRY r_u
;
146 prs_struct
*data
= &p
->in_data
.data
;
147 prs_struct
*rdata
= &p
->out_data
.rdata
;
152 /* grab the reg open entry */
153 if(!reg_io_q_open_entry("", &q_u
, data
, 0))
156 /* construct reply. */
157 r_u
.status
= _reg_open_entry(p
, &q_u
, &r_u
);
159 if(!reg_io_r_open_entry("", &r_u
, rdata
, 0))
165 /*******************************************************************
167 ********************************************************************/
169 static BOOL
api_reg_info(pipes_struct
*p
)
173 prs_struct
*data
= &p
->in_data
.data
;
174 prs_struct
*rdata
= &p
->out_data
.rdata
;
179 /* grab the reg unknown 0x11*/
180 if(!reg_io_q_info("", &q_u
, data
, 0))
183 r_u
.status
= _reg_info(p
, &q_u
, &r_u
);
185 if(!reg_io_r_info("", &r_u
, rdata
, 0))
191 /*******************************************************************
193 ********************************************************************/
195 static BOOL
api_reg_shutdown(pipes_struct
*p
)
199 prs_struct
*data
= &p
->in_data
.data
;
200 prs_struct
*rdata
= &p
->out_data
.rdata
;
205 /* grab the reg shutdown */
206 if(!reg_io_q_shutdown("", &q_u
, data
, 0))
209 r_u
.status
= _reg_shutdown(p
, &q_u
, &r_u
);
211 if(!reg_io_r_shutdown("", &r_u
, rdata
, 0))
217 /*******************************************************************
218 api_reg_abort_shutdown
219 ********************************************************************/
221 static BOOL
api_reg_abort_shutdown(pipes_struct
*p
)
223 REG_Q_ABORT_SHUTDOWN q_u
;
224 REG_R_ABORT_SHUTDOWN r_u
;
225 prs_struct
*data
= &p
->in_data
.data
;
226 prs_struct
*rdata
= &p
->out_data
.rdata
;
231 /* grab the reg shutdown */
232 if(!reg_io_q_abort_shutdown("", &q_u
, data
, 0))
235 r_u
.status
= _reg_abort_shutdown(p
, &q_u
, &r_u
);
237 if(!reg_io_r_abort_shutdown("", &r_u
, rdata
, 0))
244 /*******************************************************************
246 ********************************************************************/
248 static BOOL
api_reg_query_key(pipes_struct
*p
)
252 prs_struct
*data
= &p
->in_data
.data
;
253 prs_struct
*rdata
= &p
->out_data
.rdata
;
258 if(!reg_io_q_query_key("", &q_u
, data
, 0))
261 r_u
.status
= _reg_query_key(p
, &q_u
, &r_u
);
263 if(!reg_io_r_query_key("", &r_u
, rdata
, 0))
269 /*******************************************************************
271 ********************************************************************/
273 static BOOL
api_reg_unknown_1a(pipes_struct
*p
)
275 REG_Q_UNKNOWN_1A q_u
;
276 REG_R_UNKNOWN_1A r_u
;
277 prs_struct
*data
= &p
->in_data
.data
;
278 prs_struct
*rdata
= &p
->out_data
.rdata
;
283 if(!reg_io_q_unknown_1a("", &q_u
, data
, 0))
286 r_u
.status
= _reg_unknown_1a(p
, &q_u
, &r_u
);
288 if(!reg_io_r_unknown_1a("", &r_u
, rdata
, 0))
294 /*******************************************************************
296 ********************************************************************/
298 static BOOL
api_reg_enum_key(pipes_struct
*p
)
302 prs_struct
*data
= &p
->in_data
.data
;
303 prs_struct
*rdata
= &p
->out_data
.rdata
;
308 if(!reg_io_q_enum_key("", &q_u
, data
, 0))
311 r_u
.status
= _reg_enum_key(p
, &q_u
, &r_u
);
313 if(!reg_io_r_enum_key("", &r_u
, rdata
, 0))
319 /*******************************************************************
321 ********************************************************************/
323 static BOOL
api_reg_enum_value(pipes_struct
*p
)
325 REG_Q_ENUM_VALUE q_u
;
326 REG_R_ENUM_VALUE r_u
;
327 prs_struct
*data
= &p
->in_data
.data
;
328 prs_struct
*rdata
= &p
->out_data
.rdata
;
333 if(!reg_io_q_enum_val("", &q_u
, data
, 0))
336 r_u
.status
= _reg_enum_value(p
, &q_u
, &r_u
);
338 if(!reg_io_r_enum_val("", &r_u
, rdata
, 0))
344 /*******************************************************************
346 ********************************************************************/
348 static BOOL
api_reg_save_key(pipes_struct
*p
)
352 prs_struct
*data
= &p
->in_data
.data
;
353 prs_struct
*rdata
= &p
->out_data
.rdata
;
358 if(!reg_io_q_save_key("", &q_u
, data
, 0))
361 r_u
.status
= _reg_save_key(p
, &q_u
, &r_u
);
363 if(!reg_io_r_save_key("", &r_u
, rdata
, 0))
371 /*******************************************************************
372 array of \PIPE\reg operations
373 ********************************************************************/
374 static struct api_struct api_reg_cmds
[] =
376 { "REG_CLOSE" , REG_CLOSE
, api_reg_close
},
377 { "REG_OPEN_ENTRY" , REG_OPEN_ENTRY
, api_reg_open_entry
},
378 { "REG_OPEN_HKCR" , REG_OPEN_HKCR
, api_reg_open_hkcr
},
379 { "REG_OPEN_HKLM" , REG_OPEN_HKLM
, api_reg_open_hklm
},
380 { "REG_OPEN_HKU" , REG_OPEN_HKU
, api_reg_open_hku
},
381 { "REG_ENUM_KEY" , REG_ENUM_KEY
, api_reg_enum_key
},
382 { "REG_ENUM_VALUE" , REG_ENUM_VALUE
, api_reg_enum_value
},
383 { "REG_QUERY_KEY" , REG_QUERY_KEY
, api_reg_query_key
},
384 { "REG_INFO" , REG_INFO
, api_reg_info
},
385 { "REG_SHUTDOWN" , REG_SHUTDOWN
, api_reg_shutdown
},
386 { "REG_ABORT_SHUTDOWN" , REG_ABORT_SHUTDOWN
, api_reg_abort_shutdown
},
387 { "REG_UNKNOWN_1A" , REG_UNKNOWN_1A
, api_reg_unknown_1a
},
388 { "REG_SAVE_KEY" , REG_SAVE_KEY
, api_reg_save_key
},
392 /*******************************************************************
393 receives a reg pipe and responds.
394 ********************************************************************/
396 BOOL
api_reg_rpc(pipes_struct
*p
)
398 return api_rpcTNP(p
, "api_reg_rpc", api_reg_cmds
);