1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
|
#include "idl_types.h"
/*
svcctl interface definitions
*/
[ uuid(367abb81-9844-35f1-ad32-98f038001003),
version(2.0),
pointer_default(unique),
helpstring("Service Control")
] interface svcctl
{
typedef struct {
uint32 is_locked;
unistr *lock_owner;
uint32 lock_duration;
} SERVICE_LOCK_STATUS;
typedef struct {
uint32 type;
uint32 state;
uint32 controls_accepted;
uint32 win32_exit_code;
uint32 service_exit_code;
uint32 check_point;
uint32 wait_hint;
} SERVICE_STATUS;
typedef struct {
[relative] astring *service_name;
[relative] astring *display_name;
SERVICE_STATUS status;
} ENUM_SERVICE_STATUS;
typedef enum {
SERVICE_TYPE_KERNEL_DRIVER=0x01,
SERVICE_TYPE_FS_DRIVER=0x02,
SERVICE_TYPE_ADAPTER=0x04,
SERVICE_TYPE_RECOGNIZER_DRIVER=0x08,
SERVICE_TYPE_DRIVER=SERVICE_TYPE_KERNEL_DRIVER|SERVICE_TYPE_FS_DRIVER|SERVICE_TYPE_RECOGNIZER_DRIVER,
SERVICE_TYPE_WIN32_OWN_PROCESS=0x10,
SERVICE_TYPE_WIN32_SHARE_PROCESS=0x20,
SERVICE_TYPE_WIN32=SERVICE_TYPE_WIN32_OWN_PROCESS|SERVICE_TYPE_WIN32_SHARE_PROCESS
} ServiceType;
typedef enum {
SERVICE_STATE_ACTIVE=0x01,
SERVICE_STATE_INACTIVE=0x02,
SERVICE_STATE_ALL=0x03
} ServiceState;
typedef enum {
SV_TYPE_WORKSTATION =0x00000001,
SV_TYPE_SERVER =0x00000002,
SV_TYPE_DOMAIN_CTRL =0x00000008,
SV_TYPE_DOMAIN_BAKCTRL =0x00000010,
SV_TYPE_TIME_SOURCE =0x00000020,
SV_TYPE_AFP =0x00000040,
SV_TYPE_DOMAIN_MEMBER =0x00000100,
SV_TYPE_PRINTQ_SERVER =0x00000200,
SV_TYPE_DIALIN_SERVER =0x00000400,
SV_TYPE_XENIX_SERVER =0x00000800,
SV_TYPE_SERVER_UNIX =0x00000800,
SV_TYPE_NT =0x00001000,
SV_TYPE_WFW =0x00002000,
SV_TYPE_POTENTIAL_BROWSER =0x00010000,
SV_TYPE_BACKUP_BROWSER =0x00020000,
SV_TYPE_MASTER_BROWSER =0x00040000,
SV_TYPE_DOMAIN_MASTER =0x00080000,
SV_TYPE_LOCAL_LIST_ONLY =0x40000000,
SV_TYPE_DOMAIN_ENUM =0x80000000
} SERVICE_BITS;
/*****************/
/* Function 0x00 */
uint32 svcctl_CloseServiceHandle(
[in,out,ref] policy_handle *handle
);
/*****************/
/* Function 0x01 */
typedef enum {
FIXME=1
} SERVICE_CONTROL;
WERROR svcctl_ControlService(
[in,ref] policy_handle *handle,
[in] uint32 control,
[out] SERVICE_STATUS status
);
/*****************/
/* Function 0x02 */
WERROR svcctl_DeleteService([in,ref] policy_handle *handle);
/*****************/
/* Function 0x03 */
WERROR svcctl_LockServiceDatabase(
[in,ref] policy_handle *handle,
[out] policy_handle lock
);
/*****************/
/* Function 0x04 */
WERROR svcctl_QueryServiceObjectSecurity();
/*****************/
/* Function 0x05 */
WERROR svcctl_SetServiceObjectSecurity();
/*****************/
/* Function 0x06 */
WERROR svcctl_QueryServiceStatus(
[in,ref] policy_handle *handle,
[out,ref] SERVICE_STATUS *status);
/*****************/
/* Function 0x07 */
WERROR svcctl_SetServiceStatus();
/*****************/
/* Function 0x08 */
WERROR svcctl_UnlockServiceDatabase(
[in,out,ref] policy_handle *lock
);
/*****************/
/* Function 0x09 */
WERROR svcctl_NotifyBootConfigStatus();
/*****************/
/* Function 0x0a */
WERROR svcctl_SCSetServiceBitsW(
[in,ref] policy_handle *handle,
[in] uint32 bits,
[in] boolean32 bitson,
[in] boolean32 immediate);
/*****************/
/* Function 0x0b */
WERROR svcctl_ChangeServiceConfigW([in,ref] policy_handle *handle,
[in] uint32 type,
[in] uint32 start,
[in] uint32 error,
[in] unistr *binary_path,
[in] unistr *load_order_group,
[out] uint32 tag_id,
[in] unistr *dependencies,
[in] unistr *service_start_name,
[in] unistr *password,
[in] unistr *display_name);
/*****************/
/* Function 0x0c */
WERROR svcctl_CreateServiceW([in,ref] policy_handle *handle,
[in] unistr *ServiceName,
[in] unistr *DisplayName,
[in] uint32 desired_access,
[in] uint32 type,
[in] uint32 start_type,
[in] uint32 error_control,
[in] unistr *binary_path,
[in] unistr *LoadOrderGroupKey,
[out] uint32 *TagId,
[in] unistr *dependencies,
[in] unistr *service_start_name,
[in] unistr *password);
/*****************/
/* Function 0x0d */
WERROR svcctl_EnumDependentServicesW([in,ref] policy_handle *service,
[in] uint32 state,
[out] ENUM_SERVICE_STATUS *status,
[in] uint32 buf_size,
[out] uint32 bytes_needed,
[out] uint32 services_returned);
/*****************/
/* Function 0x0e */
WERROR svcctl_EnumServicesStatusW(
[in,ref] policy_handle *handle,
[in] uint32 type,
[in] uint32 state,
[in] uint32 buf_size,
[out,size_is(buf_size)] uint8 service[*],
[out] uint32 bytes_needed,
[out] uint32 services_returned,
[in,out] uint32 *resume_handle
);
/*****************/
/* Function 0x0f */
WERROR svcctl_OpenSCManagerW(
[in] unistr *MachineName,
[in] unistr *DatabaseName,
[in] uint32 access_mask,
[out,ref] policy_handle *handle);
/*****************/
/* Function 0x10 */
WERROR svcctl_OpenServiceW([in,ref] policy_handle *scmanager_handle,
[in] unistr *ServiceName,
[in] uint32 access_mask);
/*****************/
/* Function 0x11 */
WERROR svcctl_QueryServiceConfigW([in,ref] policy_handle *handle,
[out] uint8 query[buf_size], //QUERY_SERVICE_CONFIG
[in] uint32 buf_size,
[out] uint32 bytes_needed
);
/*****************/
/* Function 0x12 */
WERROR svcctl_QueryServiceLockStatusW(
[in,ref] policy_handle *handle,
[in] uint32 buf_size,
[out,ref] SERVICE_LOCK_STATUS *status,
[out,ref] uint32 *required_buf_size
);
/*****************/
/* Function 0x13 */
WERROR svcctl_StartServiceW(
[in,ref] policy_handle *handle,
[in] uint32 NumArgs,
[in,length_of(NumArgs)] unistr *Arguments);
/*****************/
/* Function 0x14 */
WERROR svcctl_GetServiceDisplayNameW([in,ref] policy_handle *handle,
[in] unistr *service_name,
[out] unistr *display_name,
[in,out] uint32 *display_name_length);
/*****************/
/* Function 0x15 */
WERROR svcctl_GetServiceKeyNameW([in,ref] policy_handle *handle,
[in] unistr *service_name,
[out] unistr *key_name,
[in,out] uint32 *display_name_length);
/*****************/
/* Function 0x16 */
WERROR svcctl_SCSetServiceBitsA(
[in,ref] policy_handle *handle,
[in] uint32 bits,
[in] boolean32 bitson,
[in] boolean32 immediate);
/*****************/
/* Function 0x17 */
WERROR svcctl_ChangeServiceConfigA([in,ref] policy_handle *handle,
[in] uint32 type,
[in] uint32 start,
[in] uint32 error,
[in] unistr *binary_path,
[in] unistr *load_order_group,
[out] uint32 tag_id,
[in] unistr *dependencies,
[in] unistr *service_start_name,
[in] unistr *password,
[in] unistr *display_name);
/*****************/
/* Function 0x18 */
WERROR svcctl_CreateServiceA([in,ref] policy_handle *handle,
[in] unistr *ServiceName,
[in] unistr *DisplayName,
[in] uint32 desired_access,
[in] uint32 type,
[in] uint32 start_type,
[in] uint32 error_control,
[in] unistr *binary_path,
[in] unistr *LoadOrderGroupKey,
[out] uint32 *TagId,
[in] unistr *dependencies,
[in] unistr *service_start_name,
[in] unistr *password);
/*****************/
/* Function 0x19 */
WERROR svcctl_EnumDependentServicesA([in,ref] policy_handle *service,
[in] uint32 state,
[out] ENUM_SERVICE_STATUS *status,
[in] uint32 buf_size,
[out] uint32 bytes_needed,
[out] uint32 services_returned);
/*****************/
/* Function 0x1a */
WERROR svcctl_EnumServicesStatusA(
[in,ref] policy_handle *handle,
[in] uint32 type,
[in] uint32 state,
[in] uint32 buf_size,
[out,size_is(buf_size)] uint8 service[*],
[out] uint32 bytes_needed,
[out] uint32 services_returned,
[in,out] uint32 *resume_handle
);
/*****************/
/* Function 0x1b */
WERROR svcctl_OpenSCManagerA(
[in] unistr *MachineName,
[in] unistr *DatabaseName,
[in] uint32 access_mask,
[out,ref] policy_handle *handle);
/*****************/
/* Function 0x1c */
WERROR svcctl_OpenServiceA([in,ref] policy_handle *scmanager_handle,
[in] unistr *ServiceName,
[in] uint32 access_mask);
/*****************/
/* Function 0x1d */
WERROR svcctl_QueryServiceConfigA([in,ref] policy_handle *handle,
[out] uint8 query[buf_size], //QUERYU_SERVICE_CONFIG
[in] uint32 buf_size,
[out] uint32 bytes_needed
);
/*****************/
/* Function 0x1e */
WERROR svcctl_QueryServiceLockStatusA(
[in,ref] policy_handle *handle,
[in] uint32 buf_size,
[out,ref] SERVICE_LOCK_STATUS *status,
[out,ref] uint32 *required_buf_size
);
/*****************/
/* Function 0x1f */
WERROR svcctl_StartServiceA(
[in,ref] policy_handle *handle,
[in] uint32 NumArgs,
[in,length_of(NumArgs)] unistr *Arguments);
/*****************/
/* Function 0x20 */
WERROR svcctl_GetServiceDisplayNameA([in,ref] policy_handle *handle,
[in] unistr *service_name,
[out] unistr *display_name,
[in,out] uint32 *display_name_length);
/*****************/
/* Function 0x21 */
WERROR svcctl_GetServiceKeyNameA([in,ref] policy_handle *handle,
[in] unistr *service_name,
[out] unistr *key_name,
[in,out] uint32 *display_name_length);
/*****************/
/* Function 0x22 */
WERROR svcctl_GetCurrentGroupeStateW();
/*****************/
/* Function 0x23 */
WERROR svcctl_EnumServiceGroupW();
/*****************/
/* Function 0x24 */
WERROR svcctl_ChangeServiceConfig2A([in,ref] policy_handle *handle,
[in] uint32 info_level,
[in] uint8 *info
);
/*****************/
/* Function 0x25 */
WERROR svcctl_ChangeServiceConfig2W([in,ref] policy_handle *handle,
[in] uint32 info_level,
[in] uint8 *info);
/*****************/
/* Function 0x26 */
WERROR svcctl_QueryServiceConfig2A(
[in,ref] policy_handle *handle,
[in] uint32 info_level,
[out] uint8 buffer[buf_size],
[in] uint32 buf_size,
[out] uint32 bytes_needed);
/*****************/
/* Function 0x27 */
WERROR svcctl_QueryServiceConfig2W(
[in,ref] policy_handle *handle,
[in] uint32 info_level,
[out] uint8 buffer[buf_size],
[in] uint32 buf_size,
[out] uint32 bytes_needed);
/*****************/
/* Function 0x28 */
WERROR svcctl_QueryServiceStatusEx(
[in,ref] policy_handle *handle,
[in] uint32 info_level,
[out] uint8 buffer[buf_size],
[in] uint32 buf_size,
[out] uint32 bytes_needed);
/*****************/
/* Function 0x29 */
WERROR EnumServicesStatusExA(
[in,ref] policy_handle *scmanager,
[in] uint32 info_level,
[in] uint32 type,
[in] uint32 state,
[out] uint8 services[buf_size],
[in] uint32 buf_size,
[out] uint32 bytes_needed,
[out] uint32 service_returned,
[in,out] uint32 *resume_handle,
[out] unistr *group_name);
/*****************/
/* Function 0x2a */
WERROR EnumServicesStatusExW(
[in,ref] policy_handle *scmanager,
[in] uint32 info_level,
[in] uint32 type,
[in] uint32 state,
[out] uint8 services[buf_size],
[in] uint32 buf_size,
[out] uint32 bytes_needed,
[out] uint32 service_returned,
[in,out] uint32 *resume_handle,
[out] unistr *group_name);
/*****************/
/* Function 0x2b */
WERROR svcctl_SCSendTSMessage();
}
|