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))
112 /*******************************************************************
114 ********************************************************************/
116 static BOOL api_reg_open_entry(pipes_struct *p)
118 REG_Q_OPEN_ENTRY q_u;
119 REG_R_OPEN_ENTRY r_u;
120 prs_struct *data = &p->in_data.data;
121 prs_struct *rdata = &p->out_data.rdata;
126 /* grab the reg open entry */
127 if(!reg_io_q_open_entry("", &q_u, data, 0))
130 /* construct reply. */
131 r_u.status = _reg_open_entry(p, &q_u, &r_u);
133 if(!reg_io_r_open_entry("", &r_u, rdata, 0))
139 /*******************************************************************
141 ********************************************************************/
143 static BOOL api_reg_info(pipes_struct *p)
147 prs_struct *data = &p->in_data.data;
148 prs_struct *rdata = &p->out_data.rdata;
153 /* grab the reg unknown 0x11*/
154 if(!reg_io_q_info("", &q_u, data, 0))
157 r_u.status = _reg_info(p, &q_u, &r_u);
159 if(!reg_io_r_info("", &r_u, rdata, 0))
165 /*******************************************************************
167 ********************************************************************/
169 static BOOL api_reg_shutdown(pipes_struct *p)
173 prs_struct *data = &p->in_data.data;
174 prs_struct *rdata = &p->out_data.rdata;
179 /* grab the reg shutdown */
180 if(!reg_io_q_shutdown("", &q_u, data, 0))
183 r_u.status = _reg_shutdown(p, &q_u, &r_u);
185 if(!reg_io_r_shutdown("", &r_u, rdata, 0))
191 /*******************************************************************
192 api_reg_abort_shutdown
193 ********************************************************************/
195 static BOOL api_reg_abort_shutdown(pipes_struct *p)
197 REG_Q_ABORT_SHUTDOWN q_u;
198 REG_R_ABORT_SHUTDOWN r_u;
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_abort_shutdown("", &q_u, data, 0))
209 r_u.status = _reg_abort_shutdown(p, &q_u, &r_u);
211 if(!reg_io_r_abort_shutdown("", &r_u, rdata, 0))
218 /*******************************************************************
220 ********************************************************************/
222 static BOOL api_reg_query_key(pipes_struct *p)
226 prs_struct *data = &p->in_data.data;
227 prs_struct *rdata = &p->out_data.rdata;
232 if(!reg_io_q_query_key("", &q_u, data, 0))
235 r_u.status = _reg_query_key(p, &q_u, &r_u);
237 if(!reg_io_r_query_key("", &r_u, rdata, 0))
243 /*******************************************************************
245 ********************************************************************/
247 static BOOL api_reg_unknown_1a(pipes_struct *p)
249 REG_Q_UNKNOWN_1A q_u;
250 REG_R_UNKNOWN_1A r_u;
251 prs_struct *data = &p->in_data.data;
252 prs_struct *rdata = &p->out_data.rdata;
257 if(!reg_io_q_unknown_1a("", &q_u, data, 0))
260 r_u.status = _reg_unknown_1a(p, &q_u, &r_u);
262 if(!reg_io_r_unknown_1a("", &r_u, rdata, 0))
268 /*******************************************************************
270 ********************************************************************/
272 static BOOL api_reg_enum_key(pipes_struct *p)
276 prs_struct *data = &p->in_data.data;
277 prs_struct *rdata = &p->out_data.rdata;
282 if(!reg_io_q_enum_key("", &q_u, data, 0))
285 r_u.status = _reg_enum_key(p, &q_u, &r_u);
287 if(!reg_io_r_enum_key("", &r_u, rdata, 0))
295 /*******************************************************************
296 array of \PIPE\reg operations
297 ********************************************************************/
298 static struct api_struct api_reg_cmds[] =
300 { "REG_CLOSE" , REG_CLOSE , api_reg_close },
301 { "REG_OPEN_ENTRY" , REG_OPEN_ENTRY , api_reg_open_entry },
302 { "REG_OPEN_HKLM" , REG_OPEN_HKLM , api_reg_open_hklm },
303 { "REG_OPEN_HKU" , REG_OPEN_HKU , api_reg_open_hku },
304 { "REG_ENUM_KEY" , REG_ENUM_KEY , api_reg_enum_key },
305 { "REG_QUERY_KEY" , REG_QUERY_KEY , api_reg_query_key },
306 { "REG_INFO" , REG_INFO , api_reg_info },
307 { "REG_SHUTDOWN" , REG_SHUTDOWN , api_reg_shutdown },
308 { "REG_ABORT_SHUTDOWN" , REG_ABORT_SHUTDOWN , api_reg_abort_shutdown },
309 { "REG_UNKNOWN_1A" , REG_UNKNOWN_1A , api_reg_unknown_1a },
313 /*******************************************************************
314 receives a reg pipe and responds.
315 ********************************************************************/
317 BOOL api_reg_rpc(pipes_struct *p)
319 return api_rpcTNP(p, "api_reg_rpc", api_reg_cmds);