2 * Unix SMB/Netbios implementation.
4 * RPC Pipe client / server routines
5 * Copyright (C) Andrew Tridgell 1992-1997,
6 * Copyright (C) Luke Kenneth Casson Leighton 1996-1997,
7 * Copyright (C) Paul Ashton 1997.
8 * Copyright (C) Marc Jacobsen 2000.
9 * Copyright (C) Jeremy Allison 2001.
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. */
30 /*******************************************************************
32 ********************************************************************/
34 static BOOL
api_reg_close(pipes_struct
*p
)
38 prs_struct
*data
= &p
->in_data
.data
;
39 prs_struct
*rdata
= &p
->out_data
.rdata
;
44 /* grab the reg unknown 1 */
45 if(!reg_io_q_close("", &q_u
, data
, 0))
48 r_u
.status
= _reg_close(p
, &q_u
, &r_u
);
50 if(!reg_io_r_close("", &r_u
, rdata
, 0))
56 /*******************************************************************
58 ********************************************************************/
60 static BOOL
api_reg_open(pipes_struct
*p
)
64 prs_struct
*data
= &p
->in_data
.data
;
65 prs_struct
*rdata
= &p
->out_data
.rdata
;
70 /* grab the reg open */
71 if(!reg_io_q_open_hklm("", &q_u
, data
, 0))
74 r_u
.status
= _reg_open(p
, &q_u
, &r_u
);
76 if(!reg_io_r_open_hklm("", &r_u
, rdata
, 0))
82 /*******************************************************************
84 ********************************************************************/
86 static BOOL
api_reg_open_entry(pipes_struct
*p
)
90 prs_struct
*data
= &p
->in_data
.data
;
91 prs_struct
*rdata
= &p
->out_data
.rdata
;
96 /* grab the reg open entry */
97 if(!reg_io_q_open_entry("", &q_u
, data
, 0))
100 /* construct reply. */
101 r_u
.status
= _reg_open_entry(p
, &q_u
, &r_u
);
103 if(!reg_io_r_open_entry("", &r_u
, rdata
, 0))
109 /*******************************************************************
111 ********************************************************************/
113 static BOOL
api_reg_info(pipes_struct
*p
)
117 prs_struct
*data
= &p
->in_data
.data
;
118 prs_struct
*rdata
= &p
->out_data
.rdata
;
123 /* grab the reg unknown 0x11*/
124 if(!reg_io_q_info("", &q_u
, data
, 0))
127 r_u
.status
= _reg_info(p
, &q_u
, &r_u
);
129 if(!reg_io_r_info("", &r_u
, rdata
, 0))
136 /*******************************************************************
138 ********************************************************************/
140 static BOOL
api_reg_shutdown(pipes_struct
*p
)
144 prs_struct
*data
= &p
->in_data
.data
;
145 prs_struct
*rdata
= &p
->out_data
.rdata
;
150 /* grab the reg shutdown */
151 if(!reg_io_q_shutdown("", &q_u
, data
, 0))
154 r_u
.status
= _reg_shutdown(p
, &q_u
, &r_u
);
156 if(!reg_io_r_shutdown("", &r_u
, rdata
, 0))
162 /*******************************************************************
163 api_reg_abort_shutdown
164 ********************************************************************/
166 static BOOL
api_reg_abort_shutdown(pipes_struct
*p
)
168 REG_Q_ABORT_SHUTDOWN q_u
;
169 REG_R_ABORT_SHUTDOWN r_u
;
170 prs_struct
*data
= &p
->in_data
.data
;
171 prs_struct
*rdata
= &p
->out_data
.rdata
;
176 /* grab the reg shutdown */
177 if(!reg_io_q_abort_shutdown("", &q_u
, data
, 0))
180 r_u
.status
= _reg_abort_shutdown(p
, &q_u
, &r_u
);
182 if(!reg_io_r_abort_shutdown("", &r_u
, rdata
, 0))
189 /*******************************************************************
190 array of \PIPE\reg operations
191 ********************************************************************/
192 static struct api_struct api_reg_cmds
[] =
194 { "REG_CLOSE" , REG_CLOSE
, api_reg_close
},
195 { "REG_OPEN_ENTRY" , REG_OPEN_ENTRY
, api_reg_open_entry
},
196 { "REG_OPEN" , REG_OPEN_HKLM
, api_reg_open
},
197 { "REG_INFO" , REG_INFO
, api_reg_info
},
199 { "REG_SHUTDOWN" , REG_SHUTDOWN
, api_reg_shutdown
},
200 { "REG_ABORT_SHUTDOWN", REG_ABORT_SHUTDOWN
, api_reg_abort_shutdown
},
205 /*******************************************************************
206 receives a reg pipe and responds.
207 ********************************************************************/
209 BOOL
api_reg_rpc(pipes_struct
*p
)
211 return api_rpcTNP(p
, "api_reg_rpc", api_reg_cmds
);