r6014: rather large change set....
[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                ( SVC_STATE_ACTIVE | SVC_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
76 /* utility structures for RPCs */
77
78 typedef struct {
79         uint32 type;
80         uint32 state;
81         uint32 controls_accepted;
82         uint32 win32_exit_code;
83         uint32 service_exit_code;
84         uint32 check_point;
85         uint32 wait_hint;
86 } SERVICE_STATUS;
87
88 typedef struct {
89         UNISTR servicename;
90         UNISTR displayname;
91         SERVICE_STATUS status;
92 } ENUM_SERVICES_STATUS;
93
94 typedef struct {
95         uint32 service_type;
96         uint32 start_type;
97         uint32 error_control;
98         UNISTR2 *executablepath;
99         UNISTR2 *loadordergroup;
100         uint32 tag_id;
101         UNISTR2 *dependencies;
102         UNISTR2 *startname;
103         UNISTR2 *displayname;
104 } SERVICE_CONFIG;
105
106
107 /* rpc structures */
108
109 /**************************/
110
111 typedef struct {
112         POLICY_HND handle;
113 } SVCCTL_Q_CLOSE_SERVICE;
114
115 typedef struct {
116         WERROR status;
117 } SVCCTL_R_CLOSE_SERVICE;
118
119 /**************************/
120
121 typedef struct {
122         uint32 ptr_srv;
123         UNISTR2 servername;
124         uint32 ptr_db;
125         UNISTR2 database; 
126         uint32 access_mask;
127 } SVCCTL_Q_OPEN_SCMANAGER;
128
129 typedef struct {
130         POLICY_HND handle;
131         WERROR status;
132 } SVCCTL_R_OPEN_SCMANAGER;
133
134 /**************************/
135
136 typedef struct {
137         POLICY_HND handle;
138         UNISTR2 servicename;
139         uint32  display_name_len;
140 } SVCCTL_Q_GET_DISPLAY_NAME;
141
142 typedef struct {
143         UNISTR2 displayname;
144         uint32 display_name_len;
145         WERROR status;
146 } SVCCTL_R_GET_DISPLAY_NAME;
147
148 /**************************/
149
150 typedef struct {
151         POLICY_HND handle;
152         UNISTR2 servicename;
153         uint32 access_mask;
154 } SVCCTL_Q_OPEN_SERVICE;
155
156 typedef struct {
157         POLICY_HND handle;
158         WERROR status;
159 } SVCCTL_R_OPEN_SERVICE;
160
161 /**************************/
162
163 typedef struct {
164         POLICY_HND handle;
165         uint32 parmcount;
166         UNISTR2_ARRAY parameters;
167 } SVCCTL_Q_START_SERVICE;
168
169 typedef struct {
170         WERROR status;
171 } SVCCTL_R_START_SERVICE;
172
173 /**************************/
174
175 typedef struct {
176         POLICY_HND handle;
177         uint32 control;
178 } SVCCTL_Q_CONTROL_SERVICE;
179
180 typedef struct {
181         SERVICE_STATUS svc_status;
182         WERROR status;
183 } SVCCTL_R_CONTROL_SERVICE;
184
185 /**************************/
186
187 typedef struct {
188         POLICY_HND handle;
189 } SVCCTL_Q_QUERY_STATUS;
190
191 typedef struct {
192         SERVICE_STATUS svc_status;
193         WERROR status;
194 } SVCCTL_R_QUERY_STATUS;
195
196 /**************************/
197
198 typedef struct {
199         POLICY_HND handle;
200         uint32 type;
201         uint32 state;
202         uint32 buffer_size;
203         uint32 *resume;
204 } SVCCTL_Q_ENUM_SERVICES_STATUS;
205
206 typedef struct {
207         RPC_BUFFER buffer;
208         uint32 needed;
209         uint32 returned;
210         uint32 *resume;
211         WERROR status;
212 } SVCCTL_R_ENUM_SERVICES_STATUS;
213
214 /**************************/
215
216 typedef struct {
217         POLICY_HND handle;
218         uint32 state;
219         uint32 buffer_size;
220 } SVCCTL_Q_ENUM_DEPENDENT_SERVICES;
221
222 typedef struct {
223         RPC_BUFFER buffer;
224         uint32 needed;
225         uint32 returned;
226         WERROR status;
227 } SVCCTL_R_ENUM_DEPENDENT_SERVICES;
228
229 /**************************/
230
231 typedef struct {
232         POLICY_HND handle;
233         uint32 buffer_size;
234 } SVCCTL_Q_QUERY_SERVICE_CONFIG;
235
236 typedef struct {
237         SERVICE_CONFIG config;
238         uint32 needed;
239         WERROR status;
240 } SVCCTL_R_QUERY_SERVICE_CONFIG;
241
242 #endif /* _RPC_SVCCTL_H */
243