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.
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 /* This is the interface for the registry functions. */
29 /*******************************************************************
31 ********************************************************************/
33 static BOOL api_reg_close(pipes_struct *p)
37 prs_struct *data = &p->in_data.data;
38 prs_struct *rdata = &p->out_data.rdata;
43 /* grab the reg unknown 1 */
44 if(!reg_io_q_close("", &q_u, data, 0))
47 r_u.status = _reg_close(p, &q_u, &r_u);
49 if(!reg_io_r_close("", &r_u, rdata, 0))
55 /*******************************************************************
57 ********************************************************************/
59 static BOOL api_reg_open(pipes_struct *p)
63 prs_struct *data = &p->in_data.data;
64 prs_struct *rdata = &p->out_data.rdata;
69 /* grab the reg open */
70 if(!reg_io_q_open_hklm("", &q_u, data, 0))
73 r_u.status = _reg_open(p, &q_u, &r_u);
75 if(!reg_io_r_open_hklm("", &r_u, rdata, 0))
81 /*******************************************************************
83 ********************************************************************/
85 static BOOL api_reg_open_entry(pipes_struct *p)
89 prs_struct *data = &p->in_data.data;
90 prs_struct *rdata = &p->out_data.rdata;
95 /* grab the reg open entry */
96 if(!reg_io_q_open_entry("", &q_u, data, 0))
99 /* construct reply. */
100 r_u.status = _reg_open_entry(p, &q_u, &r_u);
102 if(!reg_io_r_open_entry("", &r_u, rdata, 0))
108 /*******************************************************************
110 ********************************************************************/
112 static BOOL api_reg_info(pipes_struct *p)
116 prs_struct *data = &p->in_data.data;
117 prs_struct *rdata = &p->out_data.rdata;
122 /* grab the reg unknown 0x11*/
123 if(!reg_io_q_info("", &q_u, data, 0))
126 r_u.status = _reg_info(p, &q_u, &r_u);
128 if(!reg_io_r_info("", &r_u, rdata, 0))
134 /*******************************************************************
136 ********************************************************************/
138 static BOOL api_reg_shutdown(pipes_struct *p)
142 prs_struct *data = &p->in_data.data;
143 prs_struct *rdata = &p->out_data.rdata;
148 /* grab the reg shutdown */
149 if(!reg_io_q_shutdown("", &q_u, data, 0))
152 r_u.status = _reg_shutdown(p, &q_u, &r_u);
154 if(!reg_io_r_shutdown("", &r_u, rdata, 0))
160 /*******************************************************************
161 api_reg_abort_shutdown
162 ********************************************************************/
164 static BOOL api_reg_abort_shutdown(pipes_struct *p)
166 REG_Q_ABORT_SHUTDOWN q_u;
167 REG_R_ABORT_SHUTDOWN r_u;
168 prs_struct *data = &p->in_data.data;
169 prs_struct *rdata = &p->out_data.rdata;
174 /* grab the reg shutdown */
175 if(!reg_io_q_abort_shutdown("", &q_u, data, 0))
178 r_u.status = _reg_abort_shutdown(p, &q_u, &r_u);
180 if(!reg_io_r_abort_shutdown("", &r_u, rdata, 0))
187 /*******************************************************************
188 array of \PIPE\reg operations
189 ********************************************************************/
190 static struct api_struct api_reg_cmds[] =
192 { "REG_CLOSE" , REG_CLOSE , api_reg_close },
193 { "REG_OPEN_ENTRY" , REG_OPEN_ENTRY , api_reg_open_entry },
194 { "REG_OPEN" , REG_OPEN_HKLM , api_reg_open },
195 { "REG_INFO" , REG_INFO , api_reg_info },
196 { "REG_SHUTDOWN" , REG_SHUTDOWN , api_reg_shutdown },
197 { "REG_ABORT_SHUTDOWN", REG_ABORT_SHUTDOWN, api_reg_abort_shutdown },
201 /*******************************************************************
202 receives a reg pipe and responds.
203 ********************************************************************/
205 BOOL api_reg_rpc(pipes_struct *p)
207 return api_rpcTNP(p, "api_reg_rpc", api_reg_cmds);