r10206: * QueryServiceConfig2() now works, but only for info level
[Samba.git] / source / include / rpc_svcctl.h
blob8f445e5c52a838837ed10c07ff9057b727931532
1 /*
2 Unix SMB/CIFS implementation.
3 SMB parameters and setup
4 Copyright (C) Andrew Tridgell 1992-1997,
5 Copyright (C) Gerald (Jerry) Carter 2005
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #ifndef _RPC_SVCCTL_H /* _RPC_SVCCTL_H */
23 #define _RPC_SVCCTL_H
25 /* svcctl pipe */
27 #define SVCCTL_CLOSE_SERVICE 0x00
28 #define SVCCTL_CONTROL_SERVICE 0x01
29 #define SVCCTL_QUERY_SERVICE_SEC 0x04 /* not impmenented */
30 #define SVCCTL_SET_SEVICE_SEC 0x05 /* not implemented */
31 #define SVCCTL_QUERY_STATUS 0x06
32 #define SVCCTL_ENUM_DEPENDENT_SERVICES_W 0x0d
33 #define SVCCTL_ENUM_SERVICES_STATUS_W 0x0e
34 #define SVCCTL_OPEN_SCMANAGER_W 0x0f
35 #define SVCCTL_OPEN_SERVICE_W 0x10
36 #define SVCCTL_QUERY_SERVICE_CONFIG_W 0x11
37 #define SVCCTL_START_SERVICE_W 0x13
38 #define SVCCTL_GET_DISPLAY_NAME 0x14
39 #define SVCCTL_QUERY_SERVICE_CONFIG2_W 0x27
40 #define SVCCTL_QUERY_SERVICE_STATUSEX_W 0x28
42 /* ANSI versions not implemented currently
43 #define SVCCTL_ENUM_SERVICES_STATUS_A 0x0e
44 #define SVCCTL_OPEN_SCMANAGER_A 0x1b
47 /* SERVER_STATUS - type */
49 #define SVCCTL_TYPE_WIN32 0x00000030
50 #define SVCCTL_TYPE_DRIVER 0x0000000f
52 /* SERVER_STATUS - state */
53 #define SVCCTL_STATE_ACTIVE 0x00000001
54 #define SVCCTL_STATE_INACTIVE 0x00000002
55 #define SVCCTL_STATE_ALL ( SVCCTL_STATE_ACTIVE | SVCCTL_STATE_INACTIVE )
57 /* SERVER_STATUS - CurrentState */
59 #define SVCCTL_STATE_UNKNOWN 0x00000000 /* only used internally to smbd */
60 #define SVCCTL_STOPPED 0x00000001
61 #define SVCCTL_START_PENDING 0x00000002
62 #define SVCCTL_STOP_PENDING 0x00000003
63 #define SVCCTL_RUNNING 0x00000004
64 #define SVCCTL_CONTINUE_PENDING 0x00000005
65 #define SVCCTL_PAUSE_PENDING 0x00000006
66 #define SVCCTL_PAUSED 0x00000007
68 /* SERVER_STATUS - ControlAccepted */
70 #define SVCCTL_ACCEPT_STOP 0x00000001
71 #define SVCCTL_ACCEPT_PAUSE_CONTINUE 0x00000002
72 #define SVCCTL_ACCEPT_SHUTDOWN 0x00000004
73 #define SVCCTL_ACCEPT_PARAMCHANGE 0x00000008
74 #define SVCCTL_ACCEPT_NETBINDCHANGE 0x00000010
75 #define SVCCTL_ACCEPT_HARDWAREPROFILECHANGE 0x00000020
76 #define SVCCTL_ACCEPT_POWEREVENT 0x00000040
78 /* SERVER_STATUS - ControlAccepted */
79 #define SVCCTL_SVC_ERROR_IGNORE 0x00000000
80 #define SVCCTL_SVC_ERROR_NORMAL 0x00000001
81 #define SVCCTL_SVC_ERROR_CRITICAL 0x00000002
82 #define SVCCTL_SVC_ERROR_SEVERE 0x00000003
84 /* QueryServiceConfig2 options */
85 #define SERVICE_CONFIG_DESCRIPTION 0x00000001
86 #define SERVICE_CONFIG_FAILURE_ACTIONS 0x00000002
89 /* Service Config - values for ServiceType field*/
91 #define SVCCTL_KERNEL_DRVR 0x00000001 /* doubtful we'll have these */
92 #define SVCCTL_FILE_SYSTEM_DRVR 0x00000002
93 #define SVCCTL_WIN32_OWN_PROC 0x00000010
94 #define SVCCTL_WIN32_SHARED_PROC 0x00000020
95 #define SVCCTL_WIN32_INTERACTIVE 0x00000100
97 /* Service Config - values for StartType field */
98 #define SVCCTL_BOOT_START 0x00000000
99 #define SVCCTL_SYSTEM_START 0x00000001
100 #define SVCCTL_AUTO_START 0x00000002
101 #define SVCCTL_DEMAND_START 0x00000003
102 #define SVCCTL_DISABLED 0x00000004
104 /* Service Controls */
106 #define SVCCTL_CONTROL_STOP 0x00000001
107 #define SVCCTL_CONTROL_PAUSE 0x00000002
108 #define SVCCTL_CONTROL_CONTINUE 0x00000003
109 #define SVCCTL_CONTROL_INTERROGATE 0x00000004
110 #define SVCCTL_CONTROL_SHUTDOWN 0x00000005
112 #define SVC_HANDLE_IS_SCM 0x0000001
113 #define SVC_HANDLE_IS_SERVICE 0x0000002
115 #define SVC_STATUS_PROCESS_INFO 0x00000000
117 /* where we assume the location of the service control scripts */
118 #define SVCCTL_SCRIPT_DIR "svcctl"
120 /* utility structures for RPCs */
122 typedef struct {
123 uint32 type;
124 uint32 state;
125 uint32 controls_accepted;
126 uint32 win32_exit_code;
127 uint32 service_exit_code;
128 uint32 check_point;
129 uint32 wait_hint;
130 } SERVICE_STATUS;
132 typedef struct {
133 SERVICE_STATUS status;
134 uint32 process_id;
135 uint32 service_flags;
136 } SERVICE_STATUS_PROCESS;
139 typedef struct {
140 UNISTR servicename;
141 UNISTR displayname;
142 SERVICE_STATUS status;
143 } ENUM_SERVICES_STATUS;
145 typedef struct {
146 uint32 service_type;
147 uint32 start_type;
148 uint32 error_control;
149 UNISTR2 *executablepath;
150 UNISTR2 *loadordergroup;
151 uint32 tag_id;
152 UNISTR2 *dependencies;
153 UNISTR2 *startname;
154 UNISTR2 *displayname;
155 } SERVICE_CONFIG;
157 typedef struct {
158 uint32 unknown;
159 UNISTR description;
160 } SERVICE_DESCRIPTION;
162 typedef struct {
163 uint32 type;
164 uint32 delay;
165 } SC_ACTION;
167 typedef struct {
168 uint32 reset_period;
169 UNISTR2 *rebootmsg;
170 UNISTR2 *command;
171 uint32 nActions;
172 SC_ACTION *saActions;
173 UNISTR2 *description;
174 } SERVICE_FAILURE_ACTIONS;
176 typedef struct Service_info_struct {
177 uint32 type; /* should be SVC_HANDLE_IS_SERVICE */
178 pstring servicename; /* the name of the service */
179 pstring servicetype; /* internal or external */
180 pstring filename; /* what file name we can find this in,
181 as well as the "index" for what the
182 service name is */
183 pstring provides;
184 pstring dependencies;
185 pstring shouldstart;
186 pstring shouldstop;
187 pstring requiredstart;
188 pstring requiredstop;
189 pstring shortdescription;
190 pstring description;
191 } Service_info;
194 * dispatch table of functions to handle the =ServiceControl API
197 typedef struct {
198 /* functions for enumerating subkeys and values */
199 WERROR (*stop_service)( SERVICE_STATUS *status );
200 WERROR (*start_service) ( void );
201 WERROR (*service_status)( SERVICE_STATUS *status );
202 } SERVICE_CONTROL_OPS;
204 /* structure to store the service handle information */
206 typedef struct _ServiceInfo {
207 uint8 type;
208 char *name;
209 uint32 access_granted;
210 SERVICE_CONTROL_OPS *ops;
211 } SERVICE_INFO;
214 /* rpc structures */
216 /**************************/
218 typedef struct {
219 POLICY_HND handle;
220 } SVCCTL_Q_CLOSE_SERVICE;
222 typedef struct {
223 POLICY_HND handle;
224 WERROR status;
225 } SVCCTL_R_CLOSE_SERVICE;
227 /**************************/
229 typedef struct {
230 UNISTR2 *servername;
231 UNISTR2 *database;
232 uint32 access;
233 } SVCCTL_Q_OPEN_SCMANAGER;
235 typedef struct {
236 POLICY_HND handle;
237 WERROR status;
238 } SVCCTL_R_OPEN_SCMANAGER;
240 /**************************/
242 typedef struct {
243 POLICY_HND handle;
244 UNISTR2 servicename;
245 uint32 display_name_len;
246 } SVCCTL_Q_GET_DISPLAY_NAME;
248 typedef struct {
249 UNISTR2 displayname;
250 uint32 display_name_len;
251 WERROR status;
252 } SVCCTL_R_GET_DISPLAY_NAME;
254 /**************************/
256 typedef struct {
257 POLICY_HND handle;
258 UNISTR2 servicename;
259 uint32 access;
260 } SVCCTL_Q_OPEN_SERVICE;
262 typedef struct {
263 POLICY_HND handle;
264 WERROR status;
265 } SVCCTL_R_OPEN_SERVICE;
267 /**************************/
269 typedef struct {
270 POLICY_HND handle;
271 uint32 parmcount;
272 UNISTR4_ARRAY *parameters;
273 } SVCCTL_Q_START_SERVICE;
275 typedef struct {
276 WERROR status;
277 } SVCCTL_R_START_SERVICE;
279 /**************************/
281 typedef struct {
282 POLICY_HND handle;
283 uint32 control;
284 } SVCCTL_Q_CONTROL_SERVICE;
286 typedef struct {
287 SERVICE_STATUS svc_status;
288 WERROR status;
289 } SVCCTL_R_CONTROL_SERVICE;
291 /**************************/
293 typedef struct {
294 POLICY_HND handle;
295 } SVCCTL_Q_QUERY_STATUS;
297 typedef struct {
298 SERVICE_STATUS svc_status;
299 WERROR status;
300 } SVCCTL_R_QUERY_STATUS;
302 /**************************/
304 typedef struct {
305 POLICY_HND handle;
306 uint32 type;
307 uint32 state;
308 uint32 buffer_size;
309 uint32 *resume;
310 } SVCCTL_Q_ENUM_SERVICES_STATUS;
312 typedef struct {
313 RPC_BUFFER buffer;
314 uint32 needed;
315 uint32 returned;
316 uint32 *resume;
317 WERROR status;
318 } SVCCTL_R_ENUM_SERVICES_STATUS;
320 /**************************/
322 typedef struct {
323 POLICY_HND handle;
324 uint32 state;
325 uint32 buffer_size;
326 } SVCCTL_Q_ENUM_DEPENDENT_SERVICES;
328 typedef struct {
329 RPC_BUFFER buffer;
330 uint32 needed;
331 uint32 returned;
332 WERROR status;
333 } SVCCTL_R_ENUM_DEPENDENT_SERVICES;
335 /**************************/
337 typedef struct {
338 POLICY_HND handle;
339 uint32 buffer_size;
340 } SVCCTL_Q_QUERY_SERVICE_CONFIG;
342 typedef struct {
343 SERVICE_CONFIG config;
344 uint32 needed;
345 WERROR status;
346 } SVCCTL_R_QUERY_SERVICE_CONFIG;
348 typedef struct {
349 POLICY_HND handle;
350 uint32 level;
351 uint32 buffer_size;
352 } SVCCTL_Q_QUERY_SERVICE_CONFIG2;
354 typedef struct {
355 RPC_BUFFER buffer;
356 uint32 needed;
357 WERROR status;
358 } SVCCTL_R_QUERY_SERVICE_CONFIG2;
360 typedef struct {
361 POLICY_HND handle;
362 uint32 level;
363 uint32 buffer_size;
364 } SVCCTL_Q_QUERY_SERVICE_STATUSEX;
366 typedef struct {
367 RPC_BUFFER buffer;
368 uint32 needed;
369 WERROR status;
370 } SVCCTL_R_QUERY_SERVICE_STATUSEX;
372 #endif /* _RPC_SVCCTL_H */