Debian Codegraph @

third_party/rust/winapi/src/um/winsvc.rs

raw
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
7 use shared::minwindef::{BOOL, DWORD, LPBYTE, LPDWORD, LPVOID};
8 use um::winnt::{
9 HANDLE, LPCSTR, LPCWSTR, LPSTR, LPWSTR, PSECURITY_DESCRIPTOR, PVOID,
10 SECURITY_INFORMATION, STANDARD_RIGHTS_REQUIRED
11 };
12 pub const SERVICE_NO_CHANGE: DWORD = 0xffffffff;
13 pub const SERVICE_ACTIVE: DWORD = 0x00000001;
14 pub const SERVICE_INACTIVE: DWORD = 0x00000002;
15 pub const SERVICE_STATE_ALL: DWORD = SERVICE_ACTIVE | SERVICE_INACTIVE;
16 pub const SERVICE_CONTROL_STOP: DWORD = 0x00000001;
17 pub const SERVICE_CONTROL_PAUSE: DWORD = 0x00000002;
18 pub const SERVICE_CONTROL_CONTINUE: DWORD = 0x00000003;
19 pub const SERVICE_CONTROL_INTERROGATE: DWORD = 0x00000004;
20 pub const SERVICE_CONTROL_SHUTDOWN: DWORD = 0x00000005;
21 pub const SERVICE_CONTROL_PARAMCHANGE: DWORD = 0x00000006;
22 pub const SERVICE_CONTROL_NETBINDADD: DWORD = 0x00000007;
23 pub const SERVICE_CONTROL_NETBINDREMOVE: DWORD = 0x00000008;
24 pub const SERVICE_CONTROL_NETBINDENABLE: DWORD = 0x00000009;
25 pub const SERVICE_CONTROL_NETBINDDISABLE: DWORD = 0x0000000A;
26 pub const SERVICE_CONTROL_DEVICEEVENT: DWORD = 0x0000000B;
27 pub const SERVICE_CONTROL_HARDWAREPROFILECHANGE: DWORD = 0x0000000C;
28 pub const SERVICE_CONTROL_POWEREVENT: DWORD = 0x0000000D;
29 pub const SERVICE_CONTROL_SESSIONCHANGE: DWORD = 0x0000000E;
30 pub const SERVICE_CONTROL_PRESHUTDOWN: DWORD = 0x0000000F;
31 pub const SERVICE_CONTROL_TIMECHANGE: DWORD = 0x00000010;
32 pub const SERVICE_CONTROL_TRIGGEREVENT: DWORD = 0x00000020;
33 pub const SERVICE_STOPPED: DWORD = 0x00000001;
34 pub const SERVICE_START_PENDING: DWORD = 0x00000002;
35 pub const SERVICE_STOP_PENDING: DWORD = 0x00000003;
36 pub const SERVICE_RUNNING: DWORD = 0x00000004;
37 pub const SERVICE_CONTINUE_PENDING: DWORD = 0x00000005;
38 pub const SERVICE_PAUSE_PENDING: DWORD = 0x00000006;
39 pub const SERVICE_PAUSED: DWORD = 0x00000007;
40 pub const SERVICE_ACCEPT_STOP: DWORD = 0x00000001;
41 pub const SERVICE_ACCEPT_PAUSE_CONTINUE: DWORD = 0x00000002;
42 pub const SERVICE_ACCEPT_SHUTDOWN: DWORD = 0x00000004;
43 pub const SERVICE_ACCEPT_PARAMCHANGE: DWORD = 0x00000008;
44 pub const SERVICE_ACCEPT_NETBINDCHANGE: DWORD = 0x00000010;
45 pub const SERVICE_ACCEPT_HARDWAREPROFILECHANGE: DWORD = 0x00000020;
46 pub const SERVICE_ACCEPT_POWEREVENT: DWORD = 0x00000040;
47 pub const SERVICE_ACCEPT_SESSIONCHANGE: DWORD = 0x00000080;
48 pub const SERVICE_ACCEPT_PRESHUTDOWN: DWORD = 0x00000100;
49 pub const SERVICE_ACCEPT_TIMECHANGE: DWORD = 0x00000200;
50 pub const SERVICE_ACCEPT_TRIGGEREVENT: DWORD = 0x00000400;
51 // SERVICE_ACCEPT_USER_LOGOFF
52 pub const SC_MANAGER_CONNECT: DWORD = 0x0001;
53 pub const SC_MANAGER_CREATE_SERVICE: DWORD = 0x0002;
54 pub const SC_MANAGER_ENUMERATE_SERVICE: DWORD = 0x0004;
55 pub const SC_MANAGER_LOCK: DWORD = 0x0008;
56 pub const SC_MANAGER_QUERY_LOCK_STATUS: DWORD = 0x0010;
57 pub const SC_MANAGER_MODIFY_BOOT_CONFIG: DWORD = 0x0020;
58 pub 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;
61 pub const SERVICE_QUERY_CONFIG: DWORD = 0x0001;
62 pub const SERVICE_CHANGE_CONFIG: DWORD = 0x0002;
63 pub const SERVICE_QUERY_STATUS: DWORD = 0x0004;
64 pub const SERVICE_ENUMERATE_DEPENDENTS: DWORD = 0x0008;
65 pub const SERVICE_START: DWORD = 0x0010;
66 pub const SERVICE_STOP: DWORD = 0x0020;
67 pub const SERVICE_PAUSE_CONTINUE: DWORD = 0x0040;
68 pub const SERVICE_INTERROGATE: DWORD = 0x0080;
69 pub const SERVICE_USER_DEFINED_CONTROL: DWORD = 0x0100;
70 pub 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;
73 pub const SERVICE_RUNS_IN_SYSTEM_PROCESS: DWORD = 0x00000001;
74 pub const SERVICE_CONFIG_DESCRIPTION: DWORD = 1;
75 pub const SERVICE_CONFIG_FAILURE_ACTIONS: DWORD = 2;
76 pub const SERVICE_CONFIG_DELAYED_AUTO_START_INFO: DWORD = 3;
77 pub const SERVICE_CONFIG_FAILURE_ACTIONS_FLAG: DWORD = 4;
78 pub const SERVICE_CONFIG_SERVICE_SID_INFO: DWORD = 5;
79 pub const SERVICE_CONFIG_REQUIRED_PRIVILEGES_INFO: DWORD = 6;
80 pub const SERVICE_CONFIG_PRESHUTDOWN_INFO: DWORD = 7;
81 pub const SERVICE_CONFIG_TRIGGER_INFO: DWORD = 8;
82 pub const SERVICE_CONFIG_PREFERRED_NODE: DWORD = 9;
83 pub const SERVICE_CONFIG_LAUNCH_PROTECTED: DWORD = 12;
84 pub const SERVICE_NOTIFY_STATUS_CHANGE_1: DWORD = 1;
85 pub const SERVICE_NOTIFY_STATUS_CHANGE_2: DWORD = 2;
86 pub const SERVICE_NOTIFY_STATUS_CHANGE: DWORD = SERVICE_NOTIFY_STATUS_CHANGE_2;
87 pub const SERVICE_NOTIFY_STOPPED: DWORD = 0x00000001;
88 pub const SERVICE_NOTIFY_START_PENDING: DWORD = 0x00000002;
89 pub const SERVICE_NOTIFY_STOP_PENDING: DWORD = 0x00000004;
90 pub const SERVICE_NOTIFY_RUNNING: DWORD = 0x00000008;
91 pub const SERVICE_NOTIFY_CONTINUE_PENDING: DWORD = 0x00000010;
92 pub const SERVICE_NOTIFY_PAUSE_PENDING: DWORD = 0x00000020;
93 pub const SERVICE_NOTIFY_PAUSED: DWORD = 0x00000040;
94 pub const SERVICE_NOTIFY_CREATED: DWORD = 0x00000080;
95 pub const SERVICE_NOTIFY_DELETED: DWORD = 0x00000100;
96 pub const SERVICE_NOTIFY_DELETE_PENDING: DWORD = 0x00000200;
97 pub const SERVICE_STOP_REASON_FLAG_MIN: DWORD = 0x00000000;
98 pub const SERVICE_STOP_REASON_FLAG_UNPLANNED: DWORD = 0x10000000;
99 pub const SERVICE_STOP_REASON_FLAG_CUSTOM: DWORD = 0x20000000;
100 pub const SERVICE_STOP_REASON_FLAG_PLANNED: DWORD = 0x40000000;
101 pub const SERVICE_STOP_REASON_FLAG_MAX: DWORD = 0x80000000;
102 pub const SERVICE_STOP_REASON_MAJOR_MIN: DWORD = 0x00000000;
103 pub const SERVICE_STOP_REASON_MAJOR_OTHER: DWORD = 0x00010000;
104 pub const SERVICE_STOP_REASON_MAJOR_HARDWARE: DWORD = 0x00020000;
105 pub const SERVICE_STOP_REASON_MAJOR_OPERATINGSYSTEM: DWORD = 0x00030000;
106 pub const SERVICE_STOP_REASON_MAJOR_SOFTWARE: DWORD = 0x00040000;
107 pub const SERVICE_STOP_REASON_MAJOR_APPLICATION: DWORD = 0x00050000;
108 pub const SERVICE_STOP_REASON_MAJOR_NONE: DWORD = 0x00060000;
109 pub const SERVICE_STOP_REASON_MAJOR_MAX: DWORD = 0x00070000;
110 pub const SERVICE_STOP_REASON_MAJOR_MIN_CUSTOM: DWORD = 0x00400000;
111 pub const SERVICE_STOP_REASON_MAJOR_MAX_CUSTOM: DWORD = 0x00ff0000;
112 pub const SERVICE_STOP_REASON_MINOR_MIN: DWORD = 0x00000000;
113 pub const SERVICE_STOP_REASON_MINOR_OTHER: DWORD = 0x00000001;
114 pub const SERVICE_STOP_REASON_MINOR_MAINTENANCE: DWORD = 0x00000002;
115 pub const SERVICE_STOP_REASON_MINOR_INSTALLATION: DWORD = 0x00000003;
116 pub const SERVICE_STOP_REASON_MINOR_UPGRADE: DWORD = 0x00000004;
117 pub const SERVICE_STOP_REASON_MINOR_RECONFIG: DWORD = 0x00000005;
118 pub const SERVICE_STOP_REASON_MINOR_HUNG: DWORD = 0x00000006;
119 pub const SERVICE_STOP_REASON_MINOR_UNSTABLE: DWORD = 0x00000007;
120 pub const SERVICE_STOP_REASON_MINOR_DISK: DWORD = 0x00000008;
121 pub const SERVICE_STOP_REASON_MINOR_NETWORKCARD: DWORD = 0x00000009;
122 pub const SERVICE_STOP_REASON_MINOR_ENVIRONMENT: DWORD = 0x0000000a;
123 pub const SERVICE_STOP_REASON_MINOR_HARDWARE_DRIVER: DWORD = 0x0000000b;
124 pub const SERVICE_STOP_REASON_MINOR_OTHERDRIVER: DWORD = 0x0000000c;
125 pub const SERVICE_STOP_REASON_MINOR_SERVICEPACK: DWORD = 0x0000000d;
126 pub const SERVICE_STOP_REASON_MINOR_SOFTWARE_UPDATE: DWORD = 0x0000000e;
127 pub const SERVICE_STOP_REASON_MINOR_SECURITYFIX: DWORD = 0x0000000f;
128 pub const SERVICE_STOP_REASON_MINOR_SECURITY: DWORD = 0x00000010;
129 pub const SERVICE_STOP_REASON_MINOR_NETWORK_CONNECTIVITY: DWORD = 0x00000011;
130 pub const SERVICE_STOP_REASON_MINOR_WMI: DWORD = 0x00000012;
131 pub const SERVICE_STOP_REASON_MINOR_SERVICEPACK_UNINSTALL: DWORD = 0x00000013;
132 pub const SERVICE_STOP_REASON_MINOR_SOFTWARE_UPDATE_UNINSTALL: DWORD = 0x00000014;
133 pub const SERVICE_STOP_REASON_MINOR_SECURITYFIX_UNINSTALL: DWORD = 0x00000015;
134 pub const SERVICE_STOP_REASON_MINOR_MMC: DWORD = 0x00000016;
135 pub const SERVICE_STOP_REASON_MINOR_NONE: DWORD = 0x00000017;
136 pub const SERVICE_STOP_REASON_MINOR_MAX: DWORD = 0x00000018;
137 pub const SERVICE_STOP_REASON_MINOR_MIN_CUSTOM: DWORD = 0x00000100;
138 pub const SERVICE_STOP_REASON_MINOR_MAX_CUSTOM: DWORD = 0x0000FFFF;
139 pub const SERVICE_CONTROL_STATUS_REASON_INFO: DWORD = 1;
140 pub const SERVICE_SID_TYPE_NONE: DWORD = 0x00000000;
141 pub const SERVICE_SID_TYPE_UNRESTRICTED: DWORD = 0x00000001;
142 pub const SERVICE_SID_TYPE_RESTRICTED: DWORD = 0x00000002 | SERVICE_SID_TYPE_UNRESTRICTED;
143 pub const SERVICE_TRIGGER_TYPE_DEVICE_INTERFACE_ARRIVAL: DWORD = 1;
144 pub const SERVICE_TRIGGER_TYPE_IP_ADDRESS_AVAILABILITY: DWORD = 2;
145 pub const SERVICE_TRIGGER_TYPE_DOMAIN_JOIN: DWORD = 3;
146 pub const SERVICE_TRIGGER_TYPE_FIREWALL_PORT_EVENT: DWORD = 4;
147 pub const SERVICE_TRIGGER_TYPE_GROUP_POLICY: DWORD = 5;
148 pub const SERVICE_TRIGGER_TYPE_NETWORK_ENDPOINT: DWORD = 6;
149 pub const SERVICE_TRIGGER_TYPE_CUSTOM_SYSTEM_STATE_CHANGE: DWORD = 7;
150 pub const SERVICE_TRIGGER_TYPE_CUSTOM: DWORD = 20;
151 pub const SERVICE_TRIGGER_DATA_TYPE_BINARY: DWORD = 1;
152 pub const SERVICE_TRIGGER_DATA_TYPE_STRING: DWORD = 2;
153 pub const SERVICE_TRIGGER_DATA_TYPE_LEVEL: DWORD = 3;
154 pub const SERVICE_TRIGGER_DATA_TYPE_KEYWORD_ANY: DWORD = 4;
155 pub const SERVICE_TRIGGER_DATA_TYPE_KEYWORD_ALL: DWORD = 5;
156 pub const SERVICE_START_REASON_DEMAND: DWORD = 0x00000001;
157 pub const SERVICE_START_REASON_AUTO: DWORD = 0x00000002;
158 pub const SERVICE_START_REASON_TRIGGER: DWORD = 0x00000004;
159 pub const SERVICE_START_REASON_RESTART_ON_FAILURE: DWORD = 0x00000008;
160 pub const SERVICE_START_REASON_DELAYEDAUTO: DWORD = 0x00000010;
161 pub const SERVICE_DYNAMIC_INFORMATION_LEVEL_START_REASON: DWORD = 1;
162 pub const SERVICE_LAUNCH_PROTECTED_NONE: DWORD = 0;
163 pub const SERVICE_LAUNCH_PROTECTED_WINDOWS: DWORD = 1;
164 pub const SERVICE_LAUNCH_PROTECTED_WINDOWS_LIGHT: DWORD = 2;
165 pub const SERVICE_LAUNCH_PROTECTED_ANTIMALWARE_LIGHT: DWORD = 3;
166 DEFINE_GUID!{NETWORK_MANAGER_FIRST_IP_ADDRESS_ARRIVAL_GUID,
167 0x4f27f2de, 0x14e2, 0x430b, 0xa5, 0x49, 0x7c, 0xd4, 0x8c, 0xbc, 0x82, 0x45}
168 DEFINE_GUID!{NETWORK_MANAGER_LAST_IP_ADDRESS_REMOVAL_GUID,
169 0xcc4ba62a, 0x162e, 0x4648, 0x84, 0x7a, 0xb6, 0xbd, 0xf9, 0x93, 0xe3, 0x35}
170 DEFINE_GUID!{DOMAIN_JOIN_GUID,
171 0x1ce20aba, 0x9851, 0x4421, 0x94, 0x30, 0x1d, 0xde, 0xb7, 0x66, 0xe8, 0x09}
172 DEFINE_GUID!{DOMAIN_LEAVE_GUID,
173 0xddaf516e, 0x58c2, 0x4866, 0x95, 0x74, 0xc3, 0xb6, 0x15, 0xd4, 0x2e, 0xa1}
174 DEFINE_GUID!{FIREWALL_PORT_OPEN_GUID,
175 0xb7569e07, 0x8421, 0x4ee0, 0xad, 0x10, 0x86, 0x91, 0x5a, 0xfd, 0xad, 0x09}
176 DEFINE_GUID!{FIREWALL_PORT_CLOSE_GUID,
177 0xa144ed38, 0x8e12, 0x4de4, 0x9d, 0x96, 0xe6, 0x47, 0x40, 0xb1, 0xa5, 0x24}
178 DEFINE_GUID!{MACHINE_POLICY_PRESENT_GUID,
179 0x659fcae6, 0x5bdb, 0x4da9, 0xb1, 0xff, 0xca, 0x2a, 0x17, 0x8d, 0x46, 0xe0}
180 DEFINE_GUID!{USER_POLICY_PRESENT_GUID,
181 0x54fb46c8, 0xf089, 0x464c, 0xb1, 0xfd, 0x59, 0xd1, 0xb6, 0x2c, 0x3b, 0x50}
182 DEFINE_GUID!{RPC_INTERFACE_EVENT_GUID,
183 0xbc90d167, 0x9470, 0x4139, 0xa9, 0xba, 0xbe, 0x0b, 0xbb, 0xf5, 0xb7, 0x4d}
184 DEFINE_GUID!{NAMED_PIPE_EVENT_GUID,
185 0x1f81d131, 0x3fac, 0x4537, 0x9e, 0x0c, 0x7e, 0x7b, 0x0c, 0x2f, 0x4b, 0x55}
186 DEFINE_GUID!{CUSTOM_SYSTEM_STATE_CHANGE_EVENT_GUID,
187 0x2d7a2816, 0x0c5e, 0x45fc, 0x9c, 0xe7, 0x57, 0x0e, 0x5e, 0xcd, 0xe9, 0xc9}
188 ENUM!{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 }}
194 STRUCT!{struct SC_ACTION {
195 Type: SC_ACTION_TYPE,
196 Delay: DWORD,
197 }}
198 pub type LPSC_ACTION = *mut SC_ACTION;
199 STRUCT!{struct SERVICE_FAILURE_ACTIONSW {
200 dwResetPeriod: DWORD,
201 lpRebootMsg: LPWSTR,
202 lpCommand: LPWSTR,
203 cActions: DWORD,
204 lpsaActions: LPSC_ACTION,
205 }}
206 pub type LPSERVICE_FAILURE_ACTIONSW = *mut SERVICE_FAILURE_ACTIONSW;
207 STRUCT!{struct SERVICE_FAILURE_ACTIONS_FLAG {
208 fFailureActionsOnNonCrashFailures: BOOL,
209 }}
210 DECLARE_HANDLE!{SC_HANDLE, SC_HANDLE__}
211 pub type LPSC_HANDLE = *mut SC_HANDLE;
212 DECLARE_HANDLE!{SERVICE_STATUS_HANDLE, SERVICE_STATUS_HANDLE__}
213 ENUM!{enum SC_STATUS_TYPE {
214 SC_STATUS_PROCESS_INFO = 0,
215 }}
216 ENUM!{enum SC_ENUM_TYPE {
217 SC_ENUM_PROCESS_INFO = 0,
218 }}
219 STRUCT!{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 }}
228 pub type LPSERVICE_STATUS = *mut SERVICE_STATUS;
229 STRUCT!{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 }}
240 pub type LPSERVICE_STATUS_PROCESS = *mut SERVICE_STATUS_PROCESS;
241 STRUCT!{struct ENUM_SERVICE_STATUSA {
242 lpServiceName: LPSTR,
243 lpDisplayName: LPSTR,
244 ServiceStatus: SERVICE_STATUS,
245 }}
246 pub type LPENUM_SERVICE_STATUSA = *mut ENUM_SERVICE_STATUSA;
247 STRUCT!{struct ENUM_SERVICE_STATUSW {
248 lpServiceName: LPWSTR,
249 lpDisplayName: LPWSTR,
250 ServiceStatus: SERVICE_STATUS,
251 }}
252 pub type LPENUM_SERVICE_STATUSW = *mut ENUM_SERVICE_STATUSW;
253 STRUCT!{struct ENUM_SERVICE_STATUS_PROCESSA {
254 lpServiceName: LPSTR,
255 lpDisplayName: LPSTR,
256 ServiceStatusProcess: SERVICE_STATUS_PROCESS,
257 }}
258 pub type LPENUM_SERVICE_STATUS_PROCESSA = *mut ENUM_SERVICE_STATUS_PROCESSA;
259 STRUCT!{struct ENUM_SERVICE_STATUS_PROCESSW {
260 lpServiceName: LPWSTR,
261 lpDisplayName: LPWSTR,
262 ServiceStatusProcess: SERVICE_STATUS_PROCESS,
263 }}
264 pub type LPENUM_SERVICE_STATUS_PROCESSW = *mut ENUM_SERVICE_STATUS_PROCESSW;
265 pub type SC_LOCK = LPVOID;
266 STRUCT!{struct QUERY_SERVICE_LOCK_STATUSA {
267 fIsLocked: DWORD,
268 lpLockOwner: LPSTR,
269 dwLockDuration: DWORD,
270 }}
271 pub type LPQUERY_SERVICE_LOCK_STATUSA = *mut QUERY_SERVICE_LOCK_STATUSA;
272 STRUCT!{struct QUERY_SERVICE_LOCK_STATUSW {
273 fIsLocked: DWORD,
274 lpLockOwner: LPWSTR,
275 dwLockDuration: DWORD,
276 }}
277 pub type LPQUERY_SERVICE_LOCK_STATUSW = *mut QUERY_SERVICE_LOCK_STATUSW;
278 STRUCT!{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 }}
289 pub type LPQUERY_SERVICE_CONFIGA = *mut QUERY_SERVICE_CONFIGA;
290 STRUCT!{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 }}
301 pub type LPQUERY_SERVICE_CONFIGW = *mut QUERY_SERVICE_CONFIGW;
302 STRUCT!{struct SERVICE_DESCRIPTIONA {
303 lpDescription: LPSTR,
304 }}
305 pub type LPSERVICE_DESCRIPTIONA = *mut SERVICE_DESCRIPTIONA;
306 STRUCT!{struct SERVICE_DESCRIPTIONW {
307 lpDescription: LPWSTR,
308 }}
309 pub type LPSERVICE_DESCRIPTIONW = *mut SERVICE_DESCRIPTIONW;
310 FN!{stdcall LPSERVICE_MAIN_FUNCTIONW(
311 dwNumServicesArgs: DWORD,
312 lpServiceArgVectors: *mut LPWSTR,
313 ) -> ()}
314 FN!{stdcall LPSERVICE_MAIN_FUNCTIONA(
315 dwNumServicesArgs: DWORD,
316 lpServiceArgVectors: *mut LPSTR,
317 ) -> ()}
318 STRUCT!{struct SERVICE_TABLE_ENTRYA {
319 lpServiceName: LPCSTR,
320 lpServiceProc: LPSERVICE_MAIN_FUNCTIONA,
321 }}
322 pub type LPSERVICE_TABLE_ENTRYA = *mut SERVICE_TABLE_ENTRYA;
323 STRUCT!{struct SERVICE_TABLE_ENTRYW {
324 lpServiceName: LPCWSTR,
325 lpServiceProc: LPSERVICE_MAIN_FUNCTIONW,
326 }}
327 pub type LPSERVICE_TABLE_ENTRYW = *mut SERVICE_TABLE_ENTRYW;
328 FN!{stdcall LPHANDLER_FUNCTION(
329 dwControl: DWORD,
330 ) -> ()}
331 FN!{stdcall LPHANDLER_FUNCTION_EX(
332 dwControl: DWORD,
333 dwEventType: DWORD,
334 lpEventData: LPVOID,
335 lpContext: LPVOID,
336 ) -> DWORD}
337 FN!{stdcall PFN_SC_NOTIFY_CALLBACK(
338 pParameter: PVOID,
339 ) -> ()}
340 STRUCT!{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 }}
347 pub type PSERVICE_NOTIFY_1 = *mut SERVICE_NOTIFY_1;
348 STRUCT!{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 }}
357 pub type PSERVICE_NOTIFY_2A = *mut SERVICE_NOTIFY_2A;
358 STRUCT!{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 }}
367 pub type PSERVICE_NOTIFY_2W = *mut SERVICE_NOTIFY_2W;
368 pub type SERVICE_NOTIFYA = SERVICE_NOTIFY_2A;
369 pub type PSERVICE_NOTIFYA = PSERVICE_NOTIFY_2A;
370 pub type SERVICE_NOTIFYW = SERVICE_NOTIFY_2W;
371 pub type PSERVICE_NOTIFYW = PSERVICE_NOTIFY_2W;
372 extern "system" {
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;
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;
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;
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;
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;
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;
634 pub fn SetServiceObjectSecurity(
635 hService: SC_HANDLE,
636 dwSecurityInformation: SECURITY_INFORMATION,
637 lpSecurityDescriptor: PSECURITY_DESCRIPTOR,
638 ) -> BOOL;
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;
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;
695 }