]> git.proxmox.com Git - rustc.git/blame - vendor/winapi/src/um/winsvc.rs
New upstream version 1.49.0+dfsg1
[rustc.git] / vendor / winapi / src / um / winsvc.rs
CommitLineData
ff7c6d11
XL
1// Licensed under the Apache License, Version 2.0
2// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
3// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
4// All files in the project carrying such notice may not be copied, modified, or distributed
5// except according to those terms.
6//! Header file for the Service Control Manager
ff7c6d11 7use shared::minwindef::{BOOL, DWORD, LPBYTE, LPDWORD, LPVOID};
8faf50e0
XL
8use um::winnt::{
9 HANDLE, LPCSTR, LPCWSTR, LPSTR, LPWSTR, PSECURITY_DESCRIPTOR, PVOID,
10 SECURITY_INFORMATION, STANDARD_RIGHTS_REQUIRED
11};
ff7c6d11
XL
12pub const SERVICE_NO_CHANGE: DWORD = 0xffffffff;
13pub const SERVICE_ACTIVE: DWORD = 0x00000001;
14pub const SERVICE_INACTIVE: DWORD = 0x00000002;
15pub const SERVICE_STATE_ALL: DWORD = SERVICE_ACTIVE | SERVICE_INACTIVE;
16pub const SERVICE_CONTROL_STOP: DWORD = 0x00000001;
17pub const SERVICE_CONTROL_PAUSE: DWORD = 0x00000002;
18pub const SERVICE_CONTROL_CONTINUE: DWORD = 0x00000003;
19pub const SERVICE_CONTROL_INTERROGATE: DWORD = 0x00000004;
20pub const SERVICE_CONTROL_SHUTDOWN: DWORD = 0x00000005;
21pub const SERVICE_CONTROL_PARAMCHANGE: DWORD = 0x00000006;
22pub const SERVICE_CONTROL_NETBINDADD: DWORD = 0x00000007;
23pub const SERVICE_CONTROL_NETBINDREMOVE: DWORD = 0x00000008;
24pub const SERVICE_CONTROL_NETBINDENABLE: DWORD = 0x00000009;
25pub const SERVICE_CONTROL_NETBINDDISABLE: DWORD = 0x0000000A;
26pub const SERVICE_CONTROL_DEVICEEVENT: DWORD = 0x0000000B;
27pub const SERVICE_CONTROL_HARDWAREPROFILECHANGE: DWORD = 0x0000000C;
28pub const SERVICE_CONTROL_POWEREVENT: DWORD = 0x0000000D;
29pub const SERVICE_CONTROL_SESSIONCHANGE: DWORD = 0x0000000E;
30pub const SERVICE_CONTROL_PRESHUTDOWN: DWORD = 0x0000000F;
31pub const SERVICE_CONTROL_TIMECHANGE: DWORD = 0x00000010;
32pub const SERVICE_CONTROL_TRIGGEREVENT: DWORD = 0x00000020;
33pub const SERVICE_STOPPED: DWORD = 0x00000001;
34pub const SERVICE_START_PENDING: DWORD = 0x00000002;
35pub const SERVICE_STOP_PENDING: DWORD = 0x00000003;
36pub const SERVICE_RUNNING: DWORD = 0x00000004;
37pub const SERVICE_CONTINUE_PENDING: DWORD = 0x00000005;
38pub const SERVICE_PAUSE_PENDING: DWORD = 0x00000006;
39pub const SERVICE_PAUSED: DWORD = 0x00000007;
40pub const SERVICE_ACCEPT_STOP: DWORD = 0x00000001;
41pub const SERVICE_ACCEPT_PAUSE_CONTINUE: DWORD = 0x00000002;
42pub const SERVICE_ACCEPT_SHUTDOWN: DWORD = 0x00000004;
43pub const SERVICE_ACCEPT_PARAMCHANGE: DWORD = 0x00000008;
44pub const SERVICE_ACCEPT_NETBINDCHANGE: DWORD = 0x00000010;
45pub const SERVICE_ACCEPT_HARDWAREPROFILECHANGE: DWORD = 0x00000020;
46pub const SERVICE_ACCEPT_POWEREVENT: DWORD = 0x00000040;
47pub const SERVICE_ACCEPT_SESSIONCHANGE: DWORD = 0x00000080;
48pub const SERVICE_ACCEPT_PRESHUTDOWN: DWORD = 0x00000100;
49pub const SERVICE_ACCEPT_TIMECHANGE: DWORD = 0x00000200;
50pub const SERVICE_ACCEPT_TRIGGEREVENT: DWORD = 0x00000400;
51// SERVICE_ACCEPT_USER_LOGOFF
52pub const SC_MANAGER_CONNECT: DWORD = 0x0001;
53pub const SC_MANAGER_CREATE_SERVICE: DWORD = 0x0002;
54pub const SC_MANAGER_ENUMERATE_SERVICE: DWORD = 0x0004;
55pub const SC_MANAGER_LOCK: DWORD = 0x0008;
56pub const SC_MANAGER_QUERY_LOCK_STATUS: DWORD = 0x0010;
57pub const SC_MANAGER_MODIFY_BOOT_CONFIG: DWORD = 0x0020;
58pub const SC_MANAGER_ALL_ACCESS: DWORD = STANDARD_RIGHTS_REQUIRED | SC_MANAGER_CONNECT
59 | SC_MANAGER_CREATE_SERVICE | SC_MANAGER_ENUMERATE_SERVICE | SC_MANAGER_LOCK
60 | SC_MANAGER_QUERY_LOCK_STATUS | SC_MANAGER_MODIFY_BOOT_CONFIG;
61pub const SERVICE_QUERY_CONFIG: DWORD = 0x0001;
62pub const SERVICE_CHANGE_CONFIG: DWORD = 0x0002;
63pub const SERVICE_QUERY_STATUS: DWORD = 0x0004;
64pub const SERVICE_ENUMERATE_DEPENDENTS: DWORD = 0x0008;
65pub const SERVICE_START: DWORD = 0x0010;
66pub const SERVICE_STOP: DWORD = 0x0020;
67pub const SERVICE_PAUSE_CONTINUE: DWORD = 0x0040;
68pub const SERVICE_INTERROGATE: DWORD = 0x0080;
69pub const SERVICE_USER_DEFINED_CONTROL: DWORD = 0x0100;
70pub const SERVICE_ALL_ACCESS: DWORD = STANDARD_RIGHTS_REQUIRED | SERVICE_QUERY_CONFIG
71 | SERVICE_CHANGE_CONFIG | SERVICE_QUERY_STATUS | SERVICE_ENUMERATE_DEPENDENTS | SERVICE_START
72 | SERVICE_STOP | SERVICE_PAUSE_CONTINUE | SERVICE_INTERROGATE | SERVICE_USER_DEFINED_CONTROL;
73pub const SERVICE_RUNS_IN_SYSTEM_PROCESS: DWORD = 0x00000001;
74pub const SERVICE_CONFIG_DESCRIPTION: DWORD = 1;
75pub const SERVICE_CONFIG_FAILURE_ACTIONS: DWORD = 2;
76pub const SERVICE_CONFIG_DELAYED_AUTO_START_INFO: DWORD = 3;
77pub const SERVICE_CONFIG_FAILURE_ACTIONS_FLAG: DWORD = 4;
78pub const SERVICE_CONFIG_SERVICE_SID_INFO: DWORD = 5;
79pub const SERVICE_CONFIG_REQUIRED_PRIVILEGES_INFO: DWORD = 6;
80pub const SERVICE_CONFIG_PRESHUTDOWN_INFO: DWORD = 7;
81pub const SERVICE_CONFIG_TRIGGER_INFO: DWORD = 8;
82pub const SERVICE_CONFIG_PREFERRED_NODE: DWORD = 9;
83pub const SERVICE_CONFIG_LAUNCH_PROTECTED: DWORD = 12;
84pub const SERVICE_NOTIFY_STATUS_CHANGE_1: DWORD = 1;
85pub const SERVICE_NOTIFY_STATUS_CHANGE_2: DWORD = 2;
86pub const SERVICE_NOTIFY_STATUS_CHANGE: DWORD = SERVICE_NOTIFY_STATUS_CHANGE_2;
87pub const SERVICE_NOTIFY_STOPPED: DWORD = 0x00000001;
88pub const SERVICE_NOTIFY_START_PENDING: DWORD = 0x00000002;
89pub const SERVICE_NOTIFY_STOP_PENDING: DWORD = 0x00000004;
90pub const SERVICE_NOTIFY_RUNNING: DWORD = 0x00000008;
91pub const SERVICE_NOTIFY_CONTINUE_PENDING: DWORD = 0x00000010;
92pub const SERVICE_NOTIFY_PAUSE_PENDING: DWORD = 0x00000020;
93pub const SERVICE_NOTIFY_PAUSED: DWORD = 0x00000040;
94pub const SERVICE_NOTIFY_CREATED: DWORD = 0x00000080;
95pub const SERVICE_NOTIFY_DELETED: DWORD = 0x00000100;
96pub const SERVICE_NOTIFY_DELETE_PENDING: DWORD = 0x00000200;
97pub const SERVICE_STOP_REASON_FLAG_MIN: DWORD = 0x00000000;
98pub const SERVICE_STOP_REASON_FLAG_UNPLANNED: DWORD = 0x10000000;
99pub const SERVICE_STOP_REASON_FLAG_CUSTOM: DWORD = 0x20000000;
100pub const SERVICE_STOP_REASON_FLAG_PLANNED: DWORD = 0x40000000;
101pub const SERVICE_STOP_REASON_FLAG_MAX: DWORD = 0x80000000;
102pub const SERVICE_STOP_REASON_MAJOR_MIN: DWORD = 0x00000000;
103pub const SERVICE_STOP_REASON_MAJOR_OTHER: DWORD = 0x00010000;
104pub const SERVICE_STOP_REASON_MAJOR_HARDWARE: DWORD = 0x00020000;
105pub const SERVICE_STOP_REASON_MAJOR_OPERATINGSYSTEM: DWORD = 0x00030000;
106pub const SERVICE_STOP_REASON_MAJOR_SOFTWARE: DWORD = 0x00040000;
107pub const SERVICE_STOP_REASON_MAJOR_APPLICATION: DWORD = 0x00050000;
108pub const SERVICE_STOP_REASON_MAJOR_NONE: DWORD = 0x00060000;
109pub const SERVICE_STOP_REASON_MAJOR_MAX: DWORD = 0x00070000;
110pub const SERVICE_STOP_REASON_MAJOR_MIN_CUSTOM: DWORD = 0x00400000;
111pub const SERVICE_STOP_REASON_MAJOR_MAX_CUSTOM: DWORD = 0x00ff0000;
112pub const SERVICE_STOP_REASON_MINOR_MIN: DWORD = 0x00000000;
113pub const SERVICE_STOP_REASON_MINOR_OTHER: DWORD = 0x00000001;
114pub const SERVICE_STOP_REASON_MINOR_MAINTENANCE: DWORD = 0x00000002;
115pub const SERVICE_STOP_REASON_MINOR_INSTALLATION: DWORD = 0x00000003;
116pub const SERVICE_STOP_REASON_MINOR_UPGRADE: DWORD = 0x00000004;
117pub const SERVICE_STOP_REASON_MINOR_RECONFIG: DWORD = 0x00000005;
118pub const SERVICE_STOP_REASON_MINOR_HUNG: DWORD = 0x00000006;
119pub const SERVICE_STOP_REASON_MINOR_UNSTABLE: DWORD = 0x00000007;
120pub const SERVICE_STOP_REASON_MINOR_DISK: DWORD = 0x00000008;
121pub const SERVICE_STOP_REASON_MINOR_NETWORKCARD: DWORD = 0x00000009;
122pub const SERVICE_STOP_REASON_MINOR_ENVIRONMENT: DWORD = 0x0000000a;
123pub const SERVICE_STOP_REASON_MINOR_HARDWARE_DRIVER: DWORD = 0x0000000b;
124pub const SERVICE_STOP_REASON_MINOR_OTHERDRIVER: DWORD = 0x0000000c;
125pub const SERVICE_STOP_REASON_MINOR_SERVICEPACK: DWORD = 0x0000000d;
126pub const SERVICE_STOP_REASON_MINOR_SOFTWARE_UPDATE: DWORD = 0x0000000e;
127pub const SERVICE_STOP_REASON_MINOR_SECURITYFIX: DWORD = 0x0000000f;
128pub const SERVICE_STOP_REASON_MINOR_SECURITY: DWORD = 0x00000010;
129pub const SERVICE_STOP_REASON_MINOR_NETWORK_CONNECTIVITY: DWORD = 0x00000011;
130pub const SERVICE_STOP_REASON_MINOR_WMI: DWORD = 0x00000012;
131pub const SERVICE_STOP_REASON_MINOR_SERVICEPACK_UNINSTALL: DWORD = 0x00000013;
132pub const SERVICE_STOP_REASON_MINOR_SOFTWARE_UPDATE_UNINSTALL: DWORD = 0x00000014;
133pub const SERVICE_STOP_REASON_MINOR_SECURITYFIX_UNINSTALL: DWORD = 0x00000015;
134pub const SERVICE_STOP_REASON_MINOR_MMC: DWORD = 0x00000016;
135pub const SERVICE_STOP_REASON_MINOR_NONE: DWORD = 0x00000017;
136pub const SERVICE_STOP_REASON_MINOR_MAX: DWORD = 0x00000018;
137pub const SERVICE_STOP_REASON_MINOR_MIN_CUSTOM: DWORD = 0x00000100;
138pub const SERVICE_STOP_REASON_MINOR_MAX_CUSTOM: DWORD = 0x0000FFFF;
139pub const SERVICE_CONTROL_STATUS_REASON_INFO: DWORD = 1;
140pub const SERVICE_SID_TYPE_NONE: DWORD = 0x00000000;
141pub const SERVICE_SID_TYPE_UNRESTRICTED: DWORD = 0x00000001;
142pub const SERVICE_SID_TYPE_RESTRICTED: DWORD = 0x00000002 | SERVICE_SID_TYPE_UNRESTRICTED;
143pub const SERVICE_TRIGGER_TYPE_DEVICE_INTERFACE_ARRIVAL: DWORD = 1;
144pub const SERVICE_TRIGGER_TYPE_IP_ADDRESS_AVAILABILITY: DWORD = 2;
145pub const SERVICE_TRIGGER_TYPE_DOMAIN_JOIN: DWORD = 3;
146pub const SERVICE_TRIGGER_TYPE_FIREWALL_PORT_EVENT: DWORD = 4;
147pub const SERVICE_TRIGGER_TYPE_GROUP_POLICY: DWORD = 5;
148pub const SERVICE_TRIGGER_TYPE_NETWORK_ENDPOINT: DWORD = 6;
149pub const SERVICE_TRIGGER_TYPE_CUSTOM_SYSTEM_STATE_CHANGE: DWORD = 7;
150pub const SERVICE_TRIGGER_TYPE_CUSTOM: DWORD = 20;
151pub const SERVICE_TRIGGER_DATA_TYPE_BINARY: DWORD = 1;
152pub const SERVICE_TRIGGER_DATA_TYPE_STRING: DWORD = 2;
153pub const SERVICE_TRIGGER_DATA_TYPE_LEVEL: DWORD = 3;
154pub const SERVICE_TRIGGER_DATA_TYPE_KEYWORD_ANY: DWORD = 4;
155pub const SERVICE_TRIGGER_DATA_TYPE_KEYWORD_ALL: DWORD = 5;
156pub const SERVICE_START_REASON_DEMAND: DWORD = 0x00000001;
157pub const SERVICE_START_REASON_AUTO: DWORD = 0x00000002;
158pub const SERVICE_START_REASON_TRIGGER: DWORD = 0x00000004;
159pub const SERVICE_START_REASON_RESTART_ON_FAILURE: DWORD = 0x00000008;
160pub const SERVICE_START_REASON_DELAYEDAUTO: DWORD = 0x00000010;
161pub const SERVICE_DYNAMIC_INFORMATION_LEVEL_START_REASON: DWORD = 1;
162pub const SERVICE_LAUNCH_PROTECTED_NONE: DWORD = 0;
163pub const SERVICE_LAUNCH_PROTECTED_WINDOWS: DWORD = 1;
164pub const SERVICE_LAUNCH_PROTECTED_WINDOWS_LIGHT: DWORD = 2;
165pub const SERVICE_LAUNCH_PROTECTED_ANTIMALWARE_LIGHT: DWORD = 3;
166DEFINE_GUID!{NETWORK_MANAGER_FIRST_IP_ADDRESS_ARRIVAL_GUID,
167 0x4f27f2de, 0x14e2, 0x430b, 0xa5, 0x49, 0x7c, 0xd4, 0x8c, 0xbc, 0x82, 0x45}
168DEFINE_GUID!{NETWORK_MANAGER_LAST_IP_ADDRESS_REMOVAL_GUID,
169 0xcc4ba62a, 0x162e, 0x4648, 0x84, 0x7a, 0xb6, 0xbd, 0xf9, 0x93, 0xe3, 0x35}
170DEFINE_GUID!{DOMAIN_JOIN_GUID,
171 0x1ce20aba, 0x9851, 0x4421, 0x94, 0x30, 0x1d, 0xde, 0xb7, 0x66, 0xe8, 0x09}
172DEFINE_GUID!{DOMAIN_LEAVE_GUID,
173 0xddaf516e, 0x58c2, 0x4866, 0x95, 0x74, 0xc3, 0xb6, 0x15, 0xd4, 0x2e, 0xa1}
174DEFINE_GUID!{FIREWALL_PORT_OPEN_GUID,
175 0xb7569e07, 0x8421, 0x4ee0, 0xad, 0x10, 0x86, 0x91, 0x5a, 0xfd, 0xad, 0x09}
176DEFINE_GUID!{FIREWALL_PORT_CLOSE_GUID,
177 0xa144ed38, 0x8e12, 0x4de4, 0x9d, 0x96, 0xe6, 0x47, 0x40, 0xb1, 0xa5, 0x24}
178DEFINE_GUID!{MACHINE_POLICY_PRESENT_GUID,
179 0x659fcae6, 0x5bdb, 0x4da9, 0xb1, 0xff, 0xca, 0x2a, 0x17, 0x8d, 0x46, 0xe0}
180DEFINE_GUID!{USER_POLICY_PRESENT_GUID,
181 0x54fb46c8, 0xf089, 0x464c, 0xb1, 0xfd, 0x59, 0xd1, 0xb6, 0x2c, 0x3b, 0x50}
182DEFINE_GUID!{RPC_INTERFACE_EVENT_GUID,
183 0xbc90d167, 0x9470, 0x4139, 0xa9, 0xba, 0xbe, 0x0b, 0xbb, 0xf5, 0xb7, 0x4d}
184DEFINE_GUID!{NAMED_PIPE_EVENT_GUID,
185 0x1f81d131, 0x3fac, 0x4537, 0x9e, 0x0c, 0x7e, 0x7b, 0x0c, 0x2f, 0x4b, 0x55}
186DEFINE_GUID!{CUSTOM_SYSTEM_STATE_CHANGE_EVENT_GUID,
187 0x2d7a2816, 0x0c5e, 0x45fc, 0x9c, 0xe7, 0x57, 0x0e, 0x5e, 0xcd, 0xe9, 0xc9}
72b1a166
FG
188ENUM!{enum SC_ACTION_TYPE {
189 SC_ACTION_NONE = 0,
190 SC_ACTION_RESTART = 1,
191 SC_ACTION_REBOOT = 2,
192 SC_ACTION_RUN_COMMAND = 3,
193}}
194STRUCT!{struct SC_ACTION {
195 Type: SC_ACTION_TYPE,
196 Delay: DWORD,
197}}
198pub type LPSC_ACTION = *mut SC_ACTION;
199STRUCT!{struct SERVICE_FAILURE_ACTIONSW {
200 dwResetPeriod: DWORD,
201 lpRebootMsg: LPWSTR,
202 lpCommand: LPWSTR,
203 cActions: DWORD,
204 lpsaActions: LPSC_ACTION,
205}}
206pub type LPSERVICE_FAILURE_ACTIONSW = *mut SERVICE_FAILURE_ACTIONSW;
207STRUCT!{struct SERVICE_FAILURE_ACTIONS_FLAG {
208 fFailureActionsOnNonCrashFailures: BOOL,
209}}
0bf4aa26 210DECLARE_HANDLE!{SC_HANDLE, SC_HANDLE__}
ff7c6d11 211pub type LPSC_HANDLE = *mut SC_HANDLE;
0bf4aa26 212DECLARE_HANDLE!{SERVICE_STATUS_HANDLE, SERVICE_STATUS_HANDLE__}
ff7c6d11
XL
213ENUM!{enum SC_STATUS_TYPE {
214 SC_STATUS_PROCESS_INFO = 0,
215}}
8faf50e0 216ENUM!{enum SC_ENUM_TYPE {
ff7c6d11
XL
217 SC_ENUM_PROCESS_INFO = 0,
218}}
219STRUCT!{struct SERVICE_STATUS {
220 dwServiceType: DWORD,
221 dwCurrentState: DWORD,
222 dwControlsAccepted: DWORD,
223 dwWin32ExitCode: DWORD,
224 dwServiceSpecificExitCode: DWORD,
225 dwCheckPoint: DWORD,
226 dwWaitHint: DWORD,
227}}
228pub type LPSERVICE_STATUS = *mut SERVICE_STATUS;
8faf50e0
XL
229STRUCT!{struct SERVICE_STATUS_PROCESS {
230 dwServiceType: DWORD,
231 dwCurrentState: DWORD,
232 dwControlsAccepted: DWORD,
233 dwWin32ExitCode: DWORD,
234 dwServiceSpecificExitCode: DWORD,
235 dwCheckPoint: DWORD,
236 dwWaitHint: DWORD,
237 dwProcessId: DWORD,
238 dwServiceFlags: DWORD,
239}}
240pub type LPSERVICE_STATUS_PROCESS = *mut SERVICE_STATUS_PROCESS;
241STRUCT!{struct ENUM_SERVICE_STATUSA {
242 lpServiceName: LPSTR,
243 lpDisplayName: LPSTR,
244 ServiceStatus: SERVICE_STATUS,
245}}
246pub type LPENUM_SERVICE_STATUSA = *mut ENUM_SERVICE_STATUSA;
247STRUCT!{struct ENUM_SERVICE_STATUSW {
248 lpServiceName: LPWSTR,
249 lpDisplayName: LPWSTR,
250 ServiceStatus: SERVICE_STATUS,
251}}
252pub type LPENUM_SERVICE_STATUSW = *mut ENUM_SERVICE_STATUSW;
253STRUCT!{struct ENUM_SERVICE_STATUS_PROCESSA {
254 lpServiceName: LPSTR,
255 lpDisplayName: LPSTR,
256 ServiceStatusProcess: SERVICE_STATUS_PROCESS,
257}}
258pub type LPENUM_SERVICE_STATUS_PROCESSA = *mut ENUM_SERVICE_STATUS_PROCESSA;
259STRUCT!{struct ENUM_SERVICE_STATUS_PROCESSW {
260 lpServiceName: LPWSTR,
261 lpDisplayName: LPWSTR,
262 ServiceStatusProcess: SERVICE_STATUS_PROCESS,
263}}
264pub type LPENUM_SERVICE_STATUS_PROCESSW = *mut ENUM_SERVICE_STATUS_PROCESSW;
265pub type SC_LOCK = LPVOID;
266STRUCT!{struct QUERY_SERVICE_LOCK_STATUSA {
267 fIsLocked: DWORD,
268 lpLockOwner: LPSTR,
269 dwLockDuration: DWORD,
270}}
271pub type LPQUERY_SERVICE_LOCK_STATUSA = *mut QUERY_SERVICE_LOCK_STATUSA;
272STRUCT!{struct QUERY_SERVICE_LOCK_STATUSW {
273 fIsLocked: DWORD,
274 lpLockOwner: LPWSTR,
275 dwLockDuration: DWORD,
276}}
277pub type LPQUERY_SERVICE_LOCK_STATUSW = *mut QUERY_SERVICE_LOCK_STATUSW;
278STRUCT!{struct QUERY_SERVICE_CONFIGA {
279 dwServiceType: DWORD,
280 dwStartType: DWORD,
281 dwErrorControl: DWORD,
282 lpBinaryPathName: LPSTR,
283 lpLoadOrderGroup: LPSTR,
284 dwTagId: DWORD,
285 lpDependencies: LPSTR,
286 lpServiceStartName: LPSTR,
287 lpDisplayName: LPSTR,
288}}
289pub type LPQUERY_SERVICE_CONFIGA = *mut QUERY_SERVICE_CONFIGA;
290STRUCT!{struct QUERY_SERVICE_CONFIGW {
291 dwServiceType: DWORD,
292 dwStartType: DWORD,
293 dwErrorControl: DWORD,
294 lpBinaryPathName: LPWSTR,
295 lpLoadOrderGroup: LPWSTR,
296 dwTagId: DWORD,
297 lpDependencies: LPWSTR,
298 lpServiceStartName: LPWSTR,
299 lpDisplayName: LPWSTR,
300}}
301pub type LPQUERY_SERVICE_CONFIGW = *mut QUERY_SERVICE_CONFIGW;
72b1a166
FG
302STRUCT!{struct SERVICE_DESCRIPTIONA {
303 lpDescription: LPSTR,
304}}
305pub type LPSERVICE_DESCRIPTIONA = *mut SERVICE_DESCRIPTIONA;
306STRUCT!{struct SERVICE_DESCRIPTIONW {
307 lpDescription: LPWSTR,
308}}
309pub type LPSERVICE_DESCRIPTIONW = *mut SERVICE_DESCRIPTIONW;
ff7c6d11
XL
310FN!{stdcall LPSERVICE_MAIN_FUNCTIONW(
311 dwNumServicesArgs: DWORD,
312 lpServiceArgVectors: *mut LPWSTR,
313) -> ()}
314FN!{stdcall LPSERVICE_MAIN_FUNCTIONA(
315 dwNumServicesArgs: DWORD,
316 lpServiceArgVectors: *mut LPSTR,
317) -> ()}
318STRUCT!{struct SERVICE_TABLE_ENTRYA {
319 lpServiceName: LPCSTR,
320 lpServiceProc: LPSERVICE_MAIN_FUNCTIONA,
321}}
322pub type LPSERVICE_TABLE_ENTRYA = *mut SERVICE_TABLE_ENTRYA;
323STRUCT!{struct SERVICE_TABLE_ENTRYW {
324 lpServiceName: LPCWSTR,
325 lpServiceProc: LPSERVICE_MAIN_FUNCTIONW,
326}}
327pub type LPSERVICE_TABLE_ENTRYW = *mut SERVICE_TABLE_ENTRYW;
328FN!{stdcall LPHANDLER_FUNCTION(
329 dwControl: DWORD,
330) -> ()}
331FN!{stdcall LPHANDLER_FUNCTION_EX(
332 dwControl: DWORD,
333 dwEventType: DWORD,
334 lpEventData: LPVOID,
335 lpContext: LPVOID,
336) -> DWORD}
8faf50e0
XL
337FN!{stdcall PFN_SC_NOTIFY_CALLBACK(
338 pParameter: PVOID,
339) -> ()}
340STRUCT!{struct SERVICE_NOTIFY_1 {
341 dwVersion: DWORD,
342 pfnNotifyCallback: PFN_SC_NOTIFY_CALLBACK,
343 pContext: PVOID,
344 dwNotificationStatus: DWORD,
345 ServiceStatus: SERVICE_STATUS_PROCESS,
346}}
347pub type PSERVICE_NOTIFY_1 = *mut SERVICE_NOTIFY_1;
348STRUCT!{struct SERVICE_NOTIFY_2A {
349 dwVersion: DWORD,
350 pfnNotifyCallback: PFN_SC_NOTIFY_CALLBACK,
351 pContext: PVOID,
352 dwNotificationStatus: DWORD,
353 ServiceStatus: SERVICE_STATUS_PROCESS,
354 dwNotificationTriggered: DWORD,
355 pszServiceNames: LPSTR,
356}}
357pub type PSERVICE_NOTIFY_2A = *mut SERVICE_NOTIFY_2A;
358STRUCT!{struct SERVICE_NOTIFY_2W {
359 dwVersion: DWORD,
360 pfnNotifyCallback: PFN_SC_NOTIFY_CALLBACK,
361 pContext: PVOID,
362 dwNotificationStatus: DWORD,
363 ServiceStatus: SERVICE_STATUS_PROCESS,
364 dwNotificationTriggered: DWORD,
365 pszServiceNames: LPWSTR,
366}}
367pub type PSERVICE_NOTIFY_2W = *mut SERVICE_NOTIFY_2W;
368pub type SERVICE_NOTIFYA = SERVICE_NOTIFY_2A;
369pub type PSERVICE_NOTIFYA = PSERVICE_NOTIFY_2A;
370pub type SERVICE_NOTIFYW = SERVICE_NOTIFY_2W;
371pub type PSERVICE_NOTIFYW = PSERVICE_NOTIFY_2W;
ff7c6d11 372extern "system" {
8faf50e0
XL
373 pub fn ChangeServiceConfigA(
374 hService: SC_HANDLE,
375 dwServiceType: DWORD,
376 dsStartType: DWORD,
377 dwErrorControl: DWORD,
378 lpBinaryPathName: LPCSTR,
379 lpLoadOrderGroup: LPCSTR,
380 lpdwTagId: LPDWORD,
381 lpDependencies: LPCSTR,
382 lpServiceStartName: LPCSTR,
383 lpPassword: LPCSTR,
384 lpDisplayName: LPCSTR,
385 ) -> BOOL;
386 pub fn ChangeServiceConfigW(
387 hService: SC_HANDLE,
388 dwServiceType: DWORD,
389 dsStartType: DWORD,
390 dwErrorControl: DWORD,
391 lpBinaryPathName: LPCWSTR,
392 lpLoadOrderGroup: LPCWSTR,
393 lpdwTagId: LPDWORD,
394 lpDependencies: LPCWSTR,
395 lpServiceStartName: LPCWSTR,
396 lpPassword: LPCWSTR,
397 lpDisplayName: LPCWSTR,
398 ) -> BOOL;
399 pub fn ChangeServiceConfig2A(
400 hService: SC_HANDLE,
401 dwInfoLevel: DWORD,
402 lpInfo: LPVOID,
403 ) -> BOOL;
404 pub fn ChangeServiceConfig2W(
405 hService: SC_HANDLE,
406 dwInfoLevel: DWORD,
407 lpInfo: LPVOID,
408 ) -> BOOL;
ff7c6d11
XL
409 pub fn CloseServiceHandle(
410 hSCObject: SC_HANDLE,
411 ) -> BOOL;
412 pub fn ControlService(
413 hService: SC_HANDLE,
414 dwControl: DWORD,
415 lpServiceStatus: LPSERVICE_STATUS,
416 ) -> BOOL;
417 pub fn CreateServiceA(
418 hSCManager: SC_HANDLE,
419 lpServiceName: LPCSTR,
420 lpDisplayName: LPCSTR,
421 dwDesiredAccess: DWORD,
422 dwServiceType: DWORD,
423 dwStartType: DWORD,
424 dwErrorControl: DWORD,
425 lpBinaryPathName: LPCSTR,
426 lpLoadOrderGroup: LPCSTR,
427 lpdwTagId: LPDWORD,
428 lpDependencies: LPCSTR,
429 lpServiceStartName: LPCSTR,
430 lpPassword: LPCSTR,
431 ) -> SC_HANDLE;
432 pub fn CreateServiceW(
433 hSCManager: SC_HANDLE,
434 lpServiceName: LPCWSTR,
435 lpDisplayName: LPCWSTR,
436 dwDesiredAccess: DWORD,
437 dwServiceType: DWORD,
438 dwStartType: DWORD,
439 dwErrorControl: DWORD,
440 lpBinaryPathName: LPCWSTR,
441 lpLoadOrderGroup: LPCWSTR,
442 lpdwTagId: LPDWORD,
443 lpDependencies: LPCWSTR,
444 lpServiceStartName: LPCWSTR,
445 lpPassword: LPCWSTR,
446 ) -> SC_HANDLE;
447 pub fn DeleteService(
448 hService: SC_HANDLE,
449 ) -> BOOL;
8faf50e0
XL
450 pub fn EnumDependentServicesA(
451 hService: SC_HANDLE,
452 dwServiceState: DWORD,
453 lpServices: LPENUM_SERVICE_STATUSA,
454 cbBufSize: DWORD,
455 pcbBytesNeeded: LPDWORD,
456 lpServicesReturned: LPDWORD,
457 ) -> BOOL;
458 pub fn EnumDependentServicesW(
459 hService: SC_HANDLE,
460 dwServiceState: DWORD,
461 lpServices: LPENUM_SERVICE_STATUSW,
462 cbBufSize: DWORD,
463 pcbBytesNeeded: LPDWORD,
464 lpServicesReturned: LPDWORD,
465 ) -> BOOL;
466 pub fn EnumServicesStatusA(
467 hSCManager: SC_HANDLE,
468 dwServiceType: DWORD,
469 dwServiceState: DWORD,
470 lpServices: LPENUM_SERVICE_STATUSA,
471 cbBufSize: DWORD,
472 pcbBytesNeeded: LPDWORD,
473 lpServicesReturned: LPDWORD,
474 lpResumeHandle: LPDWORD,
475 ) -> BOOL;
476 pub fn EnumServicesStatusW(
477 hSCManager: SC_HANDLE,
478 dwServiceType: DWORD,
479 dwServiceState: DWORD,
480 lpServices: LPENUM_SERVICE_STATUSW,
481 cbBufSize: DWORD,
482 pcbBytesNeeded: LPDWORD,
483 lpServicesReturned: LPDWORD,
484 lpResumeHandle: LPDWORD,
485 ) -> BOOL;
486 pub fn EnumServicesStatusExA(
487 hSCManager: SC_HANDLE,
488 InfoLevel: SC_ENUM_TYPE,
489 dwServiceType: DWORD,
490 dwServiceState: DWORD,
491 lpServices: LPBYTE,
492 cbBufSize: DWORD,
493 pcbBytesNeeded: LPDWORD,
494 lpServicesReturned: LPDWORD,
495 lpResumeHandle: LPDWORD,
496 pszGroupName: LPCSTR,
497 ) -> BOOL;
498 pub fn EnumServicesStatusExW(
499 hSCManager: SC_HANDLE,
500 InfoLevel: SC_ENUM_TYPE,
501 dwServiceType: DWORD,
502 dwServiceState: DWORD,
503 lpServices: LPBYTE,
504 cbBufSize: DWORD,
505 pcbBytesNeeded: LPDWORD,
506 lpServicesReturned: LPDWORD,
507 lpResumeHandle: LPDWORD,
508 pszGroupName: LPCWSTR,
509 ) -> BOOL;
510 pub fn GetServiceKeyNameA(
511 hSCManager: SC_HANDLE,
512 lpDisplayName: LPCSTR,
513 lpServiceName: LPSTR,
514 lpcchBuffer: LPDWORD,
515 ) -> BOOL;
516 pub fn GetServiceKeyNameW(
517 hSCManager: SC_HANDLE,
518 lpDisplayName: LPCWSTR,
519 lpServiceName: LPWSTR,
520 lpcchBuffer: LPDWORD,
521 ) -> BOOL;
522 pub fn GetServiceDisplayNameA(
523 hSCManager: SC_HANDLE,
524 lpServiceName: LPCSTR,
525 lpDisplayName: LPSTR,
526 lpcchBuffer: LPDWORD,
527 ) -> BOOL;
528 pub fn GetServiceDisplayNameW(
529 hSCManager: SC_HANDLE,
530 lpServiceName: LPCWSTR,
531 lpDisplayName: LPWSTR,
532 lpcchBuffer: LPDWORD,
533 ) -> BOOL;
534 pub fn LockServiceDatabase(
535 hSCManager: SC_HANDLE,
536 ) -> SC_LOCK;
537 pub fn NotifyBootConfigStatus(
538 BootAcceptable: BOOL,
539 ) -> BOOL;
ff7c6d11
XL
540 pub fn OpenSCManagerA(
541 lpMachineName: LPCSTR,
542 lpDatabaseName: LPCSTR,
543 dwDesiredAccess: DWORD,
544 ) -> SC_HANDLE;
545 pub fn OpenSCManagerW(
546 lpMachineName: LPCWSTR,
547 lpDatabaseName: LPCWSTR,
548 dwDesiredAccess: DWORD,
549 ) -> SC_HANDLE;
550 pub fn OpenServiceA(
551 hSCManager: SC_HANDLE,
552 lpServiceName: LPCSTR,
553 dwDesiredAccess: DWORD,
554 ) -> SC_HANDLE;
555 pub fn OpenServiceW(
556 hSCManager: SC_HANDLE,
557 lpServiceName: LPCWSTR,
558 dwDesiredAccess: DWORD,
559 ) -> SC_HANDLE;
8faf50e0
XL
560 pub fn QueryServiceConfigA(
561 hService: SC_HANDLE,
562 lpServiceConfig: LPQUERY_SERVICE_CONFIGA,
563 cbBufSize: DWORD,
564 pcbBytesNeeded: LPDWORD,
565 ) -> BOOL;
566 pub fn QueryServiceConfigW(
567 hService: SC_HANDLE,
568 lpServiceConfig: LPQUERY_SERVICE_CONFIGW,
569 cbBufSize: DWORD,
570 pcbBytesNeeded: LPDWORD,
571 ) -> BOOL;
572 pub fn QueryServiceConfig2A(
573 hService: SC_HANDLE,
574 dwInfoLevel: DWORD,
575 lpBuffer: LPBYTE,
576 cbBufSize: DWORD,
577 pcbBytesNeeded: LPDWORD,
578 ) -> BOOL;
579 pub fn QueryServiceConfig2W(
580 hService: SC_HANDLE,
581 dwInfoLevel: DWORD,
582 lpBuffer: LPBYTE,
583 cbBufSize: DWORD,
584 pcbBytesNeeded: LPDWORD,
585 ) -> BOOL;
586 pub fn QueryServiceLockStatusA(
587 hSCManager: SC_HANDLE,
588 lpLockStatus: LPQUERY_SERVICE_LOCK_STATUSA,
589 cbBufSize: DWORD,
590 pcbBytesNeeded: LPDWORD,
591 ) -> BOOL;
592 pub fn QueryServiceLockStatusW(
593 hSCManager: SC_HANDLE,
594 lpLockStatus: LPQUERY_SERVICE_LOCK_STATUSW,
595 cbBufSize: DWORD,
596 pcbBytesNeeded: LPDWORD,
597 ) -> BOOL;
598 pub fn QueryServiceObjectSecurity(
599 hService: SC_HANDLE,
600 dwSecurityInformation: SECURITY_INFORMATION,
601 lpSecurityDescriptor: PSECURITY_DESCRIPTOR,
602 cbBufSize: DWORD,
603 pcbBytesNeeded: LPDWORD,
604 ) -> BOOL;
ff7c6d11
XL
605 pub fn QueryServiceStatus(
606 hService: SC_HANDLE,
607 lpServiceStatus: LPSERVICE_STATUS,
608 ) -> BOOL;
609 pub fn QueryServiceStatusEx(
610 hService: SC_HANDLE,
611 InfoLevel: SC_STATUS_TYPE,
612 lpBuffer: LPBYTE,
613 cbBufSize: DWORD,
614 pcbBytesNeeded: LPDWORD,
615 ) -> BOOL;
616 pub fn RegisterServiceCtrlHandlerA(
617 lpServiceName: LPCSTR,
618 lpHandlerProc: LPHANDLER_FUNCTION,
619 ) -> SERVICE_STATUS_HANDLE;
620 pub fn RegisterServiceCtrlHandlerW(
621 lpServiceName: LPCWSTR,
622 lpHandlerProc: LPHANDLER_FUNCTION,
623 ) -> SERVICE_STATUS_HANDLE;
624 pub fn RegisterServiceCtrlHandlerExA(
625 lpServiceName: LPCSTR,
626 lpHandlerProc: LPHANDLER_FUNCTION_EX,
627 lpContext: LPVOID,
628 ) -> SERVICE_STATUS_HANDLE;
629 pub fn RegisterServiceCtrlHandlerExW(
630 lpServiceName: LPCWSTR,
631 lpHandlerProc: LPHANDLER_FUNCTION_EX,
632 lpContext: LPVOID,
633 ) -> SERVICE_STATUS_HANDLE;
8faf50e0
XL
634 pub fn SetServiceObjectSecurity(
635 hService: SC_HANDLE,
636 dwSecurityInformation: SECURITY_INFORMATION,
637 lpSecurityDescriptor: PSECURITY_DESCRIPTOR,
638 ) -> BOOL;
ff7c6d11
XL
639 pub fn SetServiceStatus(
640 hServiceStatus: SERVICE_STATUS_HANDLE,
641 lpServiceStatus: LPSERVICE_STATUS,
642 ) -> BOOL;
643 pub fn StartServiceCtrlDispatcherA(
644 lpServiceStartTable: *const SERVICE_TABLE_ENTRYA,
645 ) -> BOOL;
646 pub fn StartServiceCtrlDispatcherW(
647 lpServiceStartTable: *const SERVICE_TABLE_ENTRYW,
648 ) -> BOOL;
8faf50e0
XL
649 pub fn StartServiceA(
650 hService: SC_HANDLE,
651 dwNumServiceArgs: DWORD,
652 lpServiceArgVectors: *mut LPCSTR,
653 ) -> BOOL;
654 pub fn StartServiceW(
655 hService: SC_HANDLE,
656 dwNumServiceArgs: DWORD,
657 lpServiceArgVectors: *mut LPCWSTR,
658 ) -> BOOL;
659 pub fn UnlockServiceDatabase(
660 ScLock: SC_LOCK,
661 ) -> BOOL;
662 pub fn NotifyServiceStatusChangeA(
663 hService: SC_HANDLE,
664 dwNotifyMask: DWORD,
665 pNotifyBuffer: PSERVICE_NOTIFYA,
666 ) -> DWORD;
667 pub fn NotifyServiceStatusChangeW(
668 hService: SC_HANDLE,
669 dwNotifyMask: DWORD,
670 pNotifyBuffer: PSERVICE_NOTIFYW,
671 ) -> DWORD;
672 pub fn ControlServiceExA(
673 hService: SC_HANDLE,
674 dwControl: DWORD,
675 dwInfoLevel: DWORD,
676 pControlParams: PVOID,
677 ) -> BOOL;
678 pub fn ControlServiceExW(
679 hService: SC_HANDLE,
680 dwControl: DWORD,
681 dwInfoLevel: DWORD,
682 pControlParams: PVOID,
683 ) -> BOOL;
684 pub fn QueryServiceDynamicInformation(
685 hServiceStatus: SERVICE_STATUS_HANDLE,
686 dwInfoLevel: DWORD,
687 ppDynamicInfo: *mut PVOID,
688 ) -> BOOL;
689 pub fn WaitServiceState (
690 hService: SC_HANDLE,
691 dwNotify: DWORD,
692 dwTimeout: DWORD,
693 hCancelEvent: HANDLE,
694 ) -> DWORD;
ff7c6d11 695}