r6051: finish off
[tprouty/samba.git] / source / include / rpc_svcctl.h
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
6    
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.
11    
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.
16    
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.
20 */
21
22 #ifndef _RPC_SVCCTL_H /* _RPC_SVCCTL_H */
23 #define _RPC_SVCCTL_H 
24
25
26 /* svcctl pipe */
27
28 #define SVCCTL_CLOSE_SERVICE                    0x00
29 #define SVCCTL_CONTROL_SERVICE                  0x01
30 #define SVCCTL_QUERY_STATUS                     0x06
31 #define SVCCTL_ENUM_DEPENDENT_SERVICES_W        0x0d
32 #define SVCCTL_ENUM_SERVICES_STATUS_W           0x0e
33 #define SVCCTL_OPEN_SCMANAGER_W                 0x0f
34 #define SVCCTL_OPEN_SERVICE_W                   0x10
35 #define SVCCTL_QUERY_SERVICE_CONFIG_W           0x11
36 #define SVCCTL_START_SERVICE_W                  0x13
37 #define SVCCTL_GET_DISPLAY_NAME                 0x14
38 #define SVCCTL_QUERY_SERVICE_CONFIG2_W          0x27
39
40 /* ANSI versions not implemented currently 
41 #define SVCCTL_ENUM_SERVICES_STATUS_A           0x0e
42 #define SVCCTL_OPEN_SCMANAGER_A                 0x1b
43 */
44
45 /* SERVER_STATUS - type */
46
47 #define SVCCTL_TYPE_WIN32               0x00000030
48 #define SVCCTL_TYPE_DRIVER              0x0000000f
49
50 /* SERVER_STATUS - state */
51 #define SVCCTL_STATE_ACTIVE             0x00000001
52 #define SVCCTL_STATE_INACTIVE           0x00000002
53 #define SVCCTL_STATE_ALL                ( SVCCTL_STATE_ACTIVE | SVCCTL_STATE_INACTIVE )
54
55 /* SERVER_STATUS - CurrentState */
56
57 #define SVCCTL_STOPPED                  0x00000001
58 #define SVCCTL_START_PENDING            0x00000002
59 #define SVCCTL_STOP_PENDING             0x00000003
60 #define SVCCTL_RUNNING                  0x00000004
61 #define SVCCTL_CONTINUE_PENDING         0x00000005
62 #define SVCCTL_PAUSE_PENDING            0x00000006
63 #define SVCCTL_PAUSED                   0x00000007
64
65 /* SERVER_STATUS - ControlAccepted */
66
67 #define SVCCTL_ACCEPT_STOP                      0x00000001
68 #define SVCCTL_ACCEPT_PAUSE_CONTINUE            0x00000002
69 #define SVCCTL_ACCEPT_SHUTDOWN                  0x00000004
70 #define SVCCTL_ACCEPT_PARAMCHANGE               0x00000008
71 #define SVCCTL_ACCEPT_NETBINDCHANGE             0x00000010
72 #define SVCCTL_ACCEPT_HARDWAREPROFILECHANGE     0x00000020
73 #define SVCCTL_ACCEPT_POWEREVENT                0x00000040
74
75 /* Service Controls */
76
77 #define SVCCTL_CONTROL_STOP                     0x00000001
78 #define SVCCTL_CONTROL_PAUSE                    0x00000002
79 #define SVCCTL_CONTROL_CONTINUE                 0x00000003
80
81 /* utility structures for RPCs */
82
83 typedef struct {
84         uint32 type;
85         uint32 state;
86         uint32 controls_accepted;
87         uint32 win32_exit_code;
88         uint32 service_exit_code;
89         uint32 check_point;
90         uint32 wait_hint;
91 } SERVICE_STATUS;
92
93 typedef struct {
94         UNISTR servicename;
95         UNISTR displayname;
96         SERVICE_STATUS status;
97 } ENUM_SERVICES_STATUS;
98
99 typedef struct {
100         uint32 service_type;
101         uint32 start_type;
102         uint32 error_control;
103         UNISTR2 *executablepath;
104         UNISTR2 *loadordergroup;
105         uint32 tag_id;
106         UNISTR2 *dependencies;
107         UNISTR2 *startname;
108         UNISTR2 *displayname;
109 } SERVICE_CONFIG;
110
111
112 /* rpc structures */
113
114 /**************************/
115
116 typedef struct {
117         POLICY_HND handle;
118 } SVCCTL_Q_CLOSE_SERVICE;
119
120 typedef struct {
121         WERROR status;
122 } SVCCTL_R_CLOSE_SERVICE;
123
124 /**************************/
125
126 typedef struct {
127         UNISTR2 *servername;
128         UNISTR2 *database; 
129         uint32 access;
130 } SVCCTL_Q_OPEN_SCMANAGER;
131
132 typedef struct {
133         POLICY_HND handle;
134         WERROR status;
135 } SVCCTL_R_OPEN_SCMANAGER;
136
137 /**************************/
138
139 typedef struct {
140         POLICY_HND handle;
141         UNISTR2 servicename;
142         uint32  display_name_len;
143 } SVCCTL_Q_GET_DISPLAY_NAME;
144
145 typedef struct {
146         UNISTR2 displayname;
147         uint32 display_name_len;
148         WERROR status;
149 } SVCCTL_R_GET_DISPLAY_NAME;
150
151 /**************************/
152
153 typedef struct {
154         POLICY_HND handle;
155         UNISTR2 servicename;
156         uint32 access;
157 } SVCCTL_Q_OPEN_SERVICE;
158
159 typedef struct {
160         POLICY_HND handle;
161         WERROR status;
162 } SVCCTL_R_OPEN_SERVICE;
163
164 /**************************/
165
166 typedef struct {
167         POLICY_HND handle;
168         uint32 parmcount;
169         UNISTR2_ARRAY parameters;
170 } SVCCTL_Q_START_SERVICE;
171
172 typedef struct {
173         WERROR status;
174 } SVCCTL_R_START_SERVICE;
175
176 /**************************/
177
178 typedef struct {
179         POLICY_HND handle;
180         uint32 control;
181 } SVCCTL_Q_CONTROL_SERVICE;
182
183 typedef struct {
184         SERVICE_STATUS svc_status;
185         WERROR status;
186 } SVCCTL_R_CONTROL_SERVICE;
187
188 /**************************/
189
190 typedef struct {
191         POLICY_HND handle;
192 } SVCCTL_Q_QUERY_STATUS;
193
194 typedef struct {
195         SERVICE_STATUS svc_status;
196         WERROR status;
197 } SVCCTL_R_QUERY_STATUS;
198
199 /**************************/
200
201 typedef struct {
202         POLICY_HND handle;
203         uint32 type;
204         uint32 state;
205         uint32 buffer_size;
206         uint32 *resume;
207 } SVCCTL_Q_ENUM_SERVICES_STATUS;
208
209 typedef struct {
210         RPC_BUFFER buffer;
211         uint32 needed;
212         uint32 returned;
213         uint32 *resume;
214         WERROR status;
215 } SVCCTL_R_ENUM_SERVICES_STATUS;
216
217 /**************************/
218
219 typedef struct {
220         POLICY_HND handle;
221         uint32 state;
222         uint32 buffer_size;
223 } SVCCTL_Q_ENUM_DEPENDENT_SERVICES;
224
225 typedef struct {
226         RPC_BUFFER buffer;
227         uint32 needed;
228         uint32 returned;
229         WERROR status;
230 } SVCCTL_R_ENUM_DEPENDENT_SERVICES;
231
232 /**************************/
233
234 typedef struct {
235         POLICY_HND handle;
236         uint32 buffer_size;
237 } SVCCTL_Q_QUERY_SERVICE_CONFIG;
238
239 typedef struct {
240         SERVICE_CONFIG config;
241         uint32 needed;
242         WERROR status;
243 } SVCCTL_R_QUERY_SERVICE_CONFIG;
244
245 #endif /* _RPC_SVCCTL_H */
246