1 {******************************************************************************}
2 { }
3 { Services API interface Unit for Object Pascal }
4 { }
5 { Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft }
6 { Corporation. All Rights Reserved. }
7 { }
8 { The original file is: winsvc.h, released June 2000. The original Pascal }
9 { code is: WinSvc.pas, released December 2000. The initial developer of the }
10 { Pascal code is Marcel van Brakel (brakelm att chello dott nl). }
11 { }
12 { Portions created by Marcel van Brakel are Copyright (C) 1999-2001 }
13 { Marcel van Brakel. All Rights Reserved. }
14 { }
15 { Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI) }
16 { }
17 { You may retrieve the latest version of this file at the Project JEDI }
18 { APILIB home page, located at http://jedi-apilib.sourceforge.net }
19 { }
20 { The contents of this file are used with permission, subject to the Mozilla }
21 { Public License Version 1.1 (the "License"); you may not use this file except }
22 { in compliance with the License. You may obtain a copy of the License at }
23 { http://www.mozilla.org/MPL/MPL-1.1.html }
24 { }
25 { Software distributed under the License is distributed on an "AS IS" basis, }
26 { WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
27 { the specific language governing rights and limitations under the License. }
28 { }
29 { Alternatively, the contents of this file may be used under the terms of the }
30 { GNU Lesser General Public License (the "LGPL License"), in which case the }
31 { provisions of the LGPL License are applicable instead of those above. }
32 { If you wish to allow use of your version of this file only under the terms }
33 { of the LGPL License and not to allow others to use your version of this file }
34 { under the MPL, indicate your decision by deleting the provisions above and }
35 { replace them with the notice and other provisions required by the LGPL }
36 { License. If you do not delete the provisions above, a recipient may use }
37 { your version of this file under either the MPL or the LGPL License. }
38 { }
39 { For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
40 { }
41 {******************************************************************************}
42
43 // $Id: JwaWinSvc.pas,v 1.12 2007/09/05 11:58:54 dezipaitor Exp $
44 {$IFNDEF JWA_OMIT_SECTIONS}
45 unit JwaWinSvc;
46
47 {$WEAKPACKAGEUNIT}
48 {$ENDIF JWA_OMIT_SECTIONS}
49
50 {$HPPEMIT ''}
51 {$HPPEMIT '#include "WinSvc.h"'}
52 {$HPPEMIT ''}
53
54 {$IFNDEF JWA_OMIT_SECTIONS}
55 {$I jediapilib.inc}
56
57 interface
58
59 uses
60 JwaWinNT, JwaWinType;
61 {$ENDIF JWA_OMIT_SECTIONS}
62
63 {$IFNDEF JWA_IMPLEMENTATIONSECTION}
64 //
65 // Service database names
66 //
67
68 const
69 SERVICES_ACTIVE_DATABASEW = 'ServicesActive';
70 {$EXTERNALSYM SERVICES_ACTIVE_DATABASEW}
71 SERVICES_FAILED_DATABASEW = 'ServicesFailed';
72 {$EXTERNALSYM SERVICES_FAILED_DATABASEW}
73
74 SERVICES_ACTIVE_DATABASEA = 'ServicesActive';
75 {$EXTERNALSYM SERVICES_ACTIVE_DATABASEA}
76 SERVICES_FAILED_DATABASEA = 'ServicesFailed';
77 {$EXTERNALSYM SERVICES_FAILED_DATABASEA}
78
79 //
80 // Character to designate that a name is a group
81 //
82
83 SC_GROUP_IDENTIFIERW = '+';
84 {$EXTERNALSYM SC_GROUP_IDENTIFIERW}
85 SC_GROUP_IDENTIFIERA = '+';
86 {$EXTERNALSYM SC_GROUP_IDENTIFIERA}
87
88 {$IFDEF UNICODE}
89
90 SERVICES_ACTIVE_DATABASE = SERVICES_ACTIVE_DATABASEW;
91 {$EXTERNALSYM SERVICES_ACTIVE_DATABASE}
92 SERVICES_FAILED_DATABASE = SERVICES_FAILED_DATABASEW;
93 {$EXTERNALSYM SERVICES_FAILED_DATABASE}
94
95 SC_GROUP_IDENTIFIER = SC_GROUP_IDENTIFIERW;
96 {$EXTERNALSYM SC_GROUP_IDENTIFIER}
97
98 {$ELSE}
99
100 SERVICES_ACTIVE_DATABASE = SERVICES_ACTIVE_DATABASEA;
101 {$EXTERNALSYM SERVICES_ACTIVE_DATABASE}
102 SERVICES_FAILED_DATABASE = SERVICES_FAILED_DATABASEA;
103 {$EXTERNALSYM SERVICES_FAILED_DATABASE}
104
105 SC_GROUP_IDENTIFIER = SC_GROUP_IDENTIFIERA;
106 {$EXTERNALSYM SC_GROUP_IDENTIFIER}
107
108 {$ENDIF UNICODE}
109
110 //
111 // Value to indicate no change to an optional parameter
112 //
113
114 SERVICE_NO_CHANGE = $ffffffff;
115 {$EXTERNALSYM SERVICE_NO_CHANGE}
116
117 //
118 // Service State -- for Enum Requests (Bit Mask)
119 //
120
121 SERVICE_ACTIVE = $00000001;
122 {$EXTERNALSYM SERVICE_ACTIVE}
123 SERVICE_INACTIVE = $00000002;
124 {$EXTERNALSYM SERVICE_INACTIVE}
125 SERVICE_STATE_ALL = SERVICE_ACTIVE or SERVICE_INACTIVE;
126 {$EXTERNALSYM SERVICE_STATE_ALL}
127
128 //
129 // Controls
130 //
131
132 SERVICE_CONTROL_STOP = $00000001;
133 {$EXTERNALSYM SERVICE_CONTROL_STOP}
134 SERVICE_CONTROL_PAUSE = $00000002;
135 {$EXTERNALSYM SERVICE_CONTROL_PAUSE}
136 SERVICE_CONTROL_CONTINUE = $00000003;
137 {$EXTERNALSYM SERVICE_CONTROL_CONTINUE}
138 SERVICE_CONTROL_INTERROGATE = $00000004;
139 {$EXTERNALSYM SERVICE_CONTROL_INTERROGATE}
140 SERVICE_CONTROL_SHUTDOWN = $00000005;
141 {$EXTERNALSYM SERVICE_CONTROL_SHUTDOWN}
142 SERVICE_CONTROL_PARAMCHANGE = $00000006;
143 {$EXTERNALSYM SERVICE_CONTROL_PARAMCHANGE}
144 SERVICE_CONTROL_NETBINDADD = $00000007;
145 {$EXTERNALSYM SERVICE_CONTROL_NETBINDADD}
146 SERVICE_CONTROL_NETBINDREMOVE = $00000008;
147 {$EXTERNALSYM SERVICE_CONTROL_NETBINDREMOVE}
148 SERVICE_CONTROL_NETBINDENABLE = $00000009;
149 {$EXTERNALSYM SERVICE_CONTROL_NETBINDENABLE}
150 SERVICE_CONTROL_NETBINDDISABLE = $0000000A;
151 {$EXTERNALSYM SERVICE_CONTROL_NETBINDDISABLE}
152 SERVICE_CONTROL_DEVICEEVENT = $0000000B;
153 {$EXTERNALSYM SERVICE_CONTROL_DEVICEEVENT}
154 SERVICE_CONTROL_HARDWAREPROFILECHANGE = $0000000C;
155 {$EXTERNALSYM SERVICE_CONTROL_HARDWAREPROFILECHANGE}
156 SERVICE_CONTROL_POWEREVENT = $0000000D;
157 {$EXTERNALSYM SERVICE_CONTROL_POWEREVENT}
158 SERVICE_CONTROL_SESSIONCHANGE = $0000000E;
159 {$EXTERNALSYM SERVICE_CONTROL_SESSIONCHANGE}
160 SERVICE_CONTROL_TIMECHANGE = $00000010;
161 {$EXTERNALSYM SERVICE_CONTROL_TIMECHANGE}
162 SERVICE_CONTROL_TRIGGEREVENT = $00000020;
163 {$EXTERNALSYM SERVICE_CONTROL_TRIGGEREVENT}
164 SERVICE_CONTROL_USERMODEREBOOT = $00000040;
165 {$EXTERNALSYM SERVICE_CONTROL_USERMODEREBOOT}
166
167 //
168 // Service State -- for CurrentState
169 //
170
171 SERVICE_STOPPED = $00000001;
172 {$EXTERNALSYM SERVICE_STOPPED}
173 SERVICE_START_PENDING = $00000002;
174 {$EXTERNALSYM SERVICE_START_PENDING}
175 SERVICE_STOP_PENDING = $00000003;
176 {$EXTERNALSYM SERVICE_STOP_PENDING}
177 SERVICE_RUNNING = $00000004;
178 {$EXTERNALSYM SERVICE_RUNNING}
179 SERVICE_CONTINUE_PENDING = $00000005;
180 {$EXTERNALSYM SERVICE_CONTINUE_PENDING}
181 SERVICE_PAUSE_PENDING = $00000006;
182 {$EXTERNALSYM SERVICE_PAUSE_PENDING}
183 SERVICE_PAUSED = $00000007;
184 {$EXTERNALSYM SERVICE_PAUSED}
185
186 //
187 // Controls Accepted (Bit Mask)
188 //
189
190 SERVICE_ACCEPT_STOP = $00000001;
191 {$EXTERNALSYM SERVICE_ACCEPT_STOP}
192 SERVICE_ACCEPT_PAUSE_CONTINUE = $00000002;
193 {$EXTERNALSYM SERVICE_ACCEPT_PAUSE_CONTINUE}
194 SERVICE_ACCEPT_SHUTDOWN = $00000004;
195 {$EXTERNALSYM SERVICE_ACCEPT_SHUTDOWN}
196 SERVICE_ACCEPT_PARAMCHANGE = $00000008;
197 {$EXTERNALSYM SERVICE_ACCEPT_PARAMCHANGE}
198 SERVICE_ACCEPT_NETBINDCHANGE = $00000010;
199 {$EXTERNALSYM SERVICE_ACCEPT_NETBINDCHANGE}
200 SERVICE_ACCEPT_HARDWAREPROFILECHANGE = $00000020;
201 {$EXTERNALSYM SERVICE_ACCEPT_HARDWAREPROFILECHANGE}
202 SERVICE_ACCEPT_POWEREVENT = $00000040;
203 {$EXTERNALSYM SERVICE_ACCEPT_POWEREVENT}
204 SERVICE_ACCEPT_SESSIONCHANGE = $00000080;
205 {$EXTERNALSYM SERVICE_ACCEPT_SESSIONCHANGE}
206 SERVICE_ACCEPT_TIMECHANGE = $00000200;
207 {$EXTERNALSYM SERVICE_ACCEPT_TIMECHANGE}
208 SERVICE_ACCEPT_TRIGGEREVENT = $00000400;
209 {$EXTERNALSYM SERVICE_ACCEPT_TRIGGEREVENT}
210 SERVICE_ACCEPT_USERMODEREBOOT = $00000800;
211 {$EXTERNALSYM SERVICE_ACCEPT_USERMODEREBOOT}
212
213
214 //
215 // Service Control Manager object specific access types
216 //
217
218 SC_MANAGER_CONNECT = $0001;
219 {$EXTERNALSYM SC_MANAGER_CONNECT}
220 SC_MANAGER_CREATE_SERVICE = $0002;
221 {$EXTERNALSYM SC_MANAGER_CREATE_SERVICE}
222 SC_MANAGER_ENUMERATE_SERVICE = $0004;
223 {$EXTERNALSYM SC_MANAGER_ENUMERATE_SERVICE}
224 SC_MANAGER_LOCK = $0008;
225 {$EXTERNALSYM SC_MANAGER_LOCK}
226 SC_MANAGER_QUERY_LOCK_STATUS = $0010;
227 {$EXTERNALSYM SC_MANAGER_QUERY_LOCK_STATUS}
228 SC_MANAGER_MODIFY_BOOT_CONFIG = $0020;
229 {$EXTERNALSYM SC_MANAGER_MODIFY_BOOT_CONFIG}
230
231 SC_MANAGER_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED or
232 SC_MANAGER_CONNECT or
233 SC_MANAGER_CREATE_SERVICE or
234 SC_MANAGER_ENUMERATE_SERVICE or
235 SC_MANAGER_LOCK or
236 SC_MANAGER_QUERY_LOCK_STATUS or
237 SC_MANAGER_MODIFY_BOOT_CONFIG;
238 {$EXTERNALSYM SC_MANAGER_ALL_ACCESS}
239
240 //
241 // Service object specific access type
242 //
243
244 SERVICE_QUERY_CONFIG = $0001;
245 {$EXTERNALSYM SERVICE_QUERY_CONFIG}
246 SERVICE_CHANGE_CONFIG = $0002;
247 {$EXTERNALSYM SERVICE_CHANGE_CONFIG}
248 SERVICE_QUERY_STATUS = $0004;
249 {$EXTERNALSYM SERVICE_QUERY_STATUS}
250 SERVICE_ENUMERATE_DEPENDENTS = $0008;
251 {$EXTERNALSYM SERVICE_ENUMERATE_DEPENDENTS}
252 SERVICE_START = $0010;
253 {$EXTERNALSYM SERVICE_START}
254 SERVICE_STOP = $0020;
255 {$EXTERNALSYM SERVICE_STOP}
256 SERVICE_PAUSE_CONTINUE = $0040;
257 {$EXTERNALSYM SERVICE_PAUSE_CONTINUE}
258 SERVICE_INTERROGATE = $0080;
259 {$EXTERNALSYM SERVICE_INTERROGATE}
260 SERVICE_USER_DEFINED_CONTROL = $0100;
261 {$EXTERNALSYM SERVICE_USER_DEFINED_CONTROL}
262
263 SERVICE_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED or
264 SERVICE_QUERY_CONFIG or
265 SERVICE_CHANGE_CONFIG or
266 SERVICE_QUERY_STATUS or
267 SERVICE_ENUMERATE_DEPENDENTS or
268 SERVICE_START or
269 SERVICE_STOP or
270 SERVICE_PAUSE_CONTINUE or
271 SERVICE_INTERROGATE or
272 SERVICE_USER_DEFINED_CONTROL;
273 {$EXTERNALSYM SERVICE_ALL_ACCESS}
274
275 //
276 // Service flags for QueryServiceStatusEx
277 //
278
279 SERVICE_RUNS_IN_SYSTEM_PROCESS = $00000001;
280 {$EXTERNALSYM SERVICE_RUNS_IN_SYSTEM_PROCESS}
281
282 //
283 // Info levels for ChangeServiceConfig2 and QueryServiceConfig2
284 //
285
286 SERVICE_CONFIG_DESCRIPTION = 1;
287 {$EXTERNALSYM SERVICE_CONFIG_DESCRIPTION}
288 SERVICE_CONFIG_FAILURE_ACTIONS = 2;
289 {$EXTERNALSYM SERVICE_CONFIG_FAILURE_ACTIONS}
290
291 //
292 // Service description string
293 //
294
295 type
296 LPSERVICE_DESCRIPTIONA = ^SERVICE_DESCRIPTIONA;
297 {$EXTERNALSYM LPSERVICE_DESCRIPTIONA}
298 _SERVICE_DESCRIPTIONA = record
299 lpDescription: LPSTR;
300 end;
301 {$EXTERNALSYM _SERVICE_DESCRIPTIONA}
302 SERVICE_DESCRIPTIONA = _SERVICE_DESCRIPTIONA;
303 {$EXTERNALSYM SERVICE_DESCRIPTIONA}
304 TServiceDescriptionA = SERVICE_DESCRIPTIONA;
305 PServiceDescriptionA = LPSERVICE_DESCRIPTIONA;
306
307 //
308 // Service description string
309 //
310
311 LPSERVICE_DESCRIPTIONW = ^SERVICE_DESCRIPTIONW;
312 {$EXTERNALSYM LPSERVICE_DESCRIPTIONW}
313 _SERVICE_DESCRIPTIONW = record
314 lpDescription: LPWSTR;
315 end;
316 {$EXTERNALSYM _SERVICE_DESCRIPTIONW}
317 SERVICE_DESCRIPTIONW = _SERVICE_DESCRIPTIONW;
318 {$EXTERNALSYM SERVICE_DESCRIPTIONW}
319 TServiceDescriptionW = SERVICE_DESCRIPTIONW;
320 PServiceDescriptionW = LPSERVICE_DESCRIPTIONW;
321
322 {$IFDEF UNICODE}
323 SERVICE_DESCRIPTION = SERVICE_DESCRIPTIONW;
324 {$EXTERNALSYM SERVICE_DESCRIPTION}
325 LPSERVICE_DESCRIPTION = LPSERVICE_DESCRIPTIONW;
326 {$EXTERNALSYM LPSERVICE_DESCRIPTION}
327 TServiceDescription = TServiceDescriptionW;
328 PServiceDescription = PServiceDescriptionW;
329 {$ELSE}
330 SERVICE_DESCRIPTION = SERVICE_DESCRIPTIONA;
331 {$EXTERNALSYM SERVICE_DESCRIPTION}
332 LPSERVICE_DESCRIPTION = LPSERVICE_DESCRIPTIONA;
333 {$EXTERNALSYM LPSERVICE_DESCRIPTION}
334 TServiceDescription = TServiceDescriptionA;
335 PServiceDescription = PServiceDescriptionA;
336 {$ENDIF UNICODE}
337
338 //
339 // Actions to take on service failure
340 //
341
342 _SC_ACTION_TYPE = (SC_ACTION_NONE, SC_ACTION_RESTART, SC_ACTION_REBOOT,
343 SC_ACTION_RUN_COMMAND);
344 {$EXTERNALSYM _SC_ACTION_TYPE}
345 SC_ACTION_TYPE = _SC_ACTION_TYPE;
346 {$EXTERNALSYM SC_ACTION_TYPE}
347 TScActionType = _SC_ACTION_TYPE;
348
349 LPSC_ACTION = ^SC_ACTION;
350 {$EXTERNALSYM LPSC_ACTION}
351 _SC_ACTION = record
352 Type_: SC_ACTION_TYPE;
353 Delay: DWORD;
354 end;
355 {$EXTERNALSYM _SC_ACTION}
356 SC_ACTION = _SC_ACTION;
357 {$EXTERNALSYM SC_ACTION}
358 TScAction = SC_ACTION;
359 PScAction = LPSC_ACTION;
360
361 LPSERVICE_FAILURE_ACTIONSA = ^SERVICE_FAILURE_ACTIONSA;
362 {$EXTERNALSYM LPSERVICE_FAILURE_ACTIONSA}
363 _SERVICE_FAILURE_ACTIONSA = record
364 dwResetPeriod: DWORD;
365 lpRebootMsg: LPSTR;
366 lpCommand: LPSTR;
367 cActions: DWORD;
368 lpsaActions: LPSC_ACTION;
369 end;
370 {$EXTERNALSYM _SERVICE_FAILURE_ACTIONSA}
371 SERVICE_FAILURE_ACTIONSA = _SERVICE_FAILURE_ACTIONSA;
372 {$EXTERNALSYM SERVICE_FAILURE_ACTIONSA}
373 TServiceFailureActionsA = SERVICE_FAILURE_ACTIONSA;
374 PServiceFailureActionsA = LPSERVICE_FAILURE_ACTIONSA;
375
376 LPSERVICE_FAILURE_ACTIONSW = ^SERVICE_FAILURE_ACTIONSW;
377 {$EXTERNALSYM LPSERVICE_FAILURE_ACTIONSW}
378 _SERVICE_FAILURE_ACTIONSW = record
379 dwResetPeriod: DWORD;
380 lpRebootMsg: LPWSTR;
381 lpCommand: LPWSTR;
382 cActions: DWORD;
383 lpsaActions: LPSC_ACTION;
384 end;
385 {$EXTERNALSYM _SERVICE_FAILURE_ACTIONSW}
386 SERVICE_FAILURE_ACTIONSW = _SERVICE_FAILURE_ACTIONSW;
387 {$EXTERNALSYM SERVICE_FAILURE_ACTIONSW}
388 TServiceFailureActionsW = SERVICE_FAILURE_ACTIONSW;
389 PServiceFailureActionsW = LPSERVICE_FAILURE_ACTIONSW;
390
391 {$IFDEF UNICODE}
392 SERVICE_FAILURE_ACTIONS = SERVICE_FAILURE_ACTIONSW;
393 {$EXTERNALSYM SERVICE_FAILURE_ACTIONS}
394 LPSERVICE_FAILURE_ACTIONS = LPSERVICE_FAILURE_ACTIONSW;
395 {$EXTERNALSYM LPSERVICE_FAILURE_ACTIONS}
396 TServiceFailureActions = TServiceFailureActionsW;
397 PServiceFailureActions = PServiceFailureActionsW;
398 {$ELSE}
399 SERVICE_FAILURE_ACTIONS = SERVICE_FAILURE_ACTIONSA;
400 {$EXTERNALSYM SERVICE_FAILURE_ACTIONS}
401 LPSERVICE_FAILURE_ACTIONS = LPSERVICE_FAILURE_ACTIONSA;
402 {$EXTERNALSYM LPSERVICE_FAILURE_ACTIONS}
403 TServiceFailureActions = TServiceFailureActionsA;
404 PServiceFailureActions = PServiceFailureActionsA;
405 {$ENDIF UNICODE}
406
407 //
408 // Handle Types
409 //
410
411 SC_HANDLE = HANDLE;
412 {$EXTERNALSYM SC_HANDLE}
413 LPSC_HANDLE = ^SC_HANDLE;
414 {$EXTERNALSYM LPSC_HANDLE}
415
416 SERVICE_STATUS_HANDLE = HANDLE;
417 {$EXTERNALSYM SERVICE_STATUS_HANDLE}
418
419 //
420 // Info levels for QueryServiceStatusEx
421 //
422
423 _SC_STATUS_TYPE = (SC_STATUS_PROCESS_INFO);
424 {$EXTERNALSYM _SC_STATUS_TYPE}
425 SC_STATUS_TYPE = _SC_STATUS_TYPE;
426 {$EXTERNALSYM SC_STATUS_TYPE}
427
428 //
429 // Info levels for EnumServicesStatusEx
430 //
431
432 _SC_ENUM_TYPE = (SC_ENUM_PROCESS_INFO);
433 {$EXTERNALSYM _SC_ENUM_TYPE}
434 SC_ENUM_TYPE = _SC_ENUM_TYPE;
435 {$EXTERNALSYM SC_ENUM_TYPE}
436
437 //
438 // Service Status Structures
439 //
440
441 LPSERVICE_STATUS = ^SERVICE_STATUS;
442 {$EXTERNALSYM LPSERVICE_STATUS}
443 _SERVICE_STATUS = record
444 dwServiceType: DWORD;
445 dwCurrentState: DWORD;
446 dwControlsAccepted: DWORD;
447 dwWin32ExitCode: DWORD;
448 dwServiceSpecificExitCode: DWORD;
449 dwCheckPoint: DWORD;
450 dwWaitHint: DWORD;
451 end;
452 {$EXTERNALSYM _SERVICE_STATUS}
453 SERVICE_STATUS = _SERVICE_STATUS;
454 {$EXTERNALSYM SERVICE_STATUS}
455 TServiceStatus = SERVICE_STATUS;
456 PServiceStatus = LPSERVICE_STATUS;
457
458 LPSERVICE_STATUS_PROCESS = ^SERVICE_STATUS_PROCESS;
459 {$EXTERNALSYM LPSERVICE_STATUS_PROCESS}
460 _SERVICE_STATUS_PROCESS = record
461 dwServiceType: DWORD;
462 dwCurrentState: DWORD;
463 dwControlsAccepted: DWORD;
464 dwWin32ExitCode: DWORD;
465 dwServiceSpecificExitCode: DWORD;
466 dwCheckPoint: DWORD;
467 dwWaitHint: DWORD;
468 dwProcessId: DWORD;
469 dwServiceFlags: DWORD;
470 end;
471 {$EXTERNALSYM _SERVICE_STATUS_PROCESS}
472 SERVICE_STATUS_PROCESS = _SERVICE_STATUS_PROCESS;
473 {$EXTERNALSYM SERVICE_STATUS_PROCESS}
474 TServiceStatusProcess = SERVICE_STATUS_PROCESS;
475 PServiceStatusProcess = LPSERVICE_STATUS_PROCESS;
476
477 //
478 // Service Status Enumeration Structure
479 //
480
481 LPENUM_SERVICE_STATUSA = ^ENUM_SERVICE_STATUSA;
482 {$EXTERNALSYM LPENUM_SERVICE_STATUSA}
483 _ENUM_SERVICE_STATUSA = record
484 lpServiceName: LPSTR;
485 lpDisplayName: LPSTR;
486 ServiceStatus: SERVICE_STATUS;
487 end;
488 {$EXTERNALSYM _ENUM_SERVICE_STATUSA}
489 ENUM_SERVICE_STATUSA = _ENUM_SERVICE_STATUSA;
490 {$EXTERNALSYM ENUM_SERVICE_STATUSA}
491 TEnumServiceStatusA = ENUM_SERVICE_STATUSA;
492 PEnumServiceStatusA = LPENUM_SERVICE_STATUSA;
493
494 LPENUM_SERVICE_STATUSW = ^ENUM_SERVICE_STATUSW;
495 {$EXTERNALSYM LPENUM_SERVICE_STATUSW}
496 _ENUM_SERVICE_STATUSW = record
497 lpServiceName: LPWSTR;
498 lpDisplayName: LPWSTR;
499 ServiceStatus: SERVICE_STATUS;
500 end;
501 {$EXTERNALSYM _ENUM_SERVICE_STATUSW}
502 ENUM_SERVICE_STATUSW = _ENUM_SERVICE_STATUSW;
503 {$EXTERNALSYM ENUM_SERVICE_STATUSW}
504 TEnumServiceStatusW = ENUM_SERVICE_STATUSW;
505 PEnumServiceStatusW = LPENUM_SERVICE_STATUSW;
506
507 {$IFDEF UNICODE}
508 ENUM_SERVICE_STATUS = ENUM_SERVICE_STATUSW;
509 {$EXTERNALSYM ENUM_SERVICE_STATUS}
510 LPENUM_SERVICE_STATUS = LPENUM_SERVICE_STATUSW;
511 {$EXTERNALSYM LPENUM_SERVICE_STATUS}
512 TEnumServiceStatus = TEnumServiceStatusW;
513 PEnumServiceStatus = PEnumServiceStatusW;
514 {$ELSE}
515 ENUM_SERVICE_STATUS = ENUM_SERVICE_STATUSA;
516 {$EXTERNALSYM ENUM_SERVICE_STATUS}
517 LPENUM_SERVICE_STATUS = LPENUM_SERVICE_STATUSA;
518 {$EXTERNALSYM LPENUM_SERVICE_STATUS}
519 TEnumServiceStatus = TEnumServiceStatusA;
520 PEnumServiceStatus = PEnumServiceStatusA;
521 {$ENDIF UNICODE}
522
523 LPENUM_SERVICE_STATUS_PROCESSA = ^ENUM_SERVICE_STATUS_PROCESSA;
524 {$EXTERNALSYM LPENUM_SERVICE_STATUS_PROCESSA}
525 _ENUM_SERVICE_STATUS_PROCESSA = record
526 lpServiceName: LPSTR;
527 lpDisplayName: LPSTR;
528 ServiceStatusProcess: SERVICE_STATUS_PROCESS;
529 end;
530 {$EXTERNALSYM _ENUM_SERVICE_STATUS_PROCESSA}
531 ENUM_SERVICE_STATUS_PROCESSA = _ENUM_SERVICE_STATUS_PROCESSA;
532 {$EXTERNALSYM ENUM_SERVICE_STATUS_PROCESSA}
533 TEnumServiceStatusProcessA = ENUM_SERVICE_STATUS_PROCESSA;
534 PEnumServiceStatusProcessA = LPENUM_SERVICE_STATUS_PROCESSA;
535
536 LPENUM_SERVICE_STATUS_PROCESSW = ^ENUM_SERVICE_STATUS_PROCESSW;
537 {$EXTERNALSYM LPENUM_SERVICE_STATUS_PROCESSW}
538 _ENUM_SERVICE_STATUS_PROCESSW = record
539 lpServiceName: LPWSTR;
540 lpDisplayName: LPWSTR;
541 ServiceStatusProcess: SERVICE_STATUS_PROCESS;
542 end;
543 {$EXTERNALSYM _ENUM_SERVICE_STATUS_PROCESSW}
544 ENUM_SERVICE_STATUS_PROCESSW = _ENUM_SERVICE_STATUS_PROCESSW;
545 {$EXTERNALSYM ENUM_SERVICE_STATUS_PROCESSW}
546 TEnumServiceStatusProcessW = ENUM_SERVICE_STATUS_PROCESSW;
547 PEnumServiceStatusProcessW = LPENUM_SERVICE_STATUS_PROCESSW;
548
549 {$IFDEF UNICODE}
550 ENUM_SERVICE_STATUS_PROCESS = ENUM_SERVICE_STATUS_PROCESSW;
551 {$EXTERNALSYM ENUM_SERVICE_STATUS_PROCESS}
552 LPENUM_SERVICE_STATUS_PROCESS = LPENUM_SERVICE_STATUS_PROCESSW;
553 {$EXTERNALSYM LPENUM_SERVICE_STATUS_PROCESS}
554 TEnumServiceStatusProcess = TEnumServiceStatusProcessW;
555 PEnumServiceStatusProcess = PEnumServiceStatusProcessW;
556 {$ELSE}
557 ENUM_SERVICE_STATUS_PROCESS = ENUM_SERVICE_STATUS_PROCESSA;
558 {$EXTERNALSYM ENUM_SERVICE_STATUS_PROCESS}
559 LPENUM_SERVICE_STATUS_PROCESS = LPENUM_SERVICE_STATUS_PROCESSA;
560 {$EXTERNALSYM LPENUM_SERVICE_STATUS_PROCESS}
561 TEnumServiceStatusProcess = TEnumServiceStatusProcessA;
562 PEnumServiceStatusProcess = PEnumServiceStatusProcessA;
563 {$ENDIF UNICODE}
564
565 //
566 // Structures for the Lock API functions
567 //
568
569 SC_LOCK = LPVOID;
570 {$EXTERNALSYM SC_LOCK}
571
572 LPQUERY_SERVICE_LOCK_STATUSA = ^QUERY_SERVICE_LOCK_STATUSA;
573 {$EXTERNALSYM LPQUERY_SERVICE_LOCK_STATUSA}
574 _QUERY_SERVICE_LOCK_STATUSA = record
575 fIsLocked: DWORD;
576 lpLockOwner: LPSTR;
577 dwLockDuration: DWORD;
578 end;
579 {$EXTERNALSYM _QUERY_SERVICE_LOCK_STATUSA}
580 QUERY_SERVICE_LOCK_STATUSA = _QUERY_SERVICE_LOCK_STATUSA;
581 {$EXTERNALSYM QUERY_SERVICE_LOCK_STATUSA}
582 TQueryServiceLockStatusA = QUERY_SERVICE_LOCK_STATUSA;
583 PQueryServiceLockStatusA = LPQUERY_SERVICE_LOCK_STATUSA;
584
585 LPQUERY_SERVICE_LOCK_STATUSW = ^QUERY_SERVICE_LOCK_STATUSW;
586 {$EXTERNALSYM LPQUERY_SERVICE_LOCK_STATUSW}
587 _QUERY_SERVICE_LOCK_STATUSW = record
588 fIsLocked: DWORD;
589 lpLockOwner: LPWSTR;
590 dwLockDuration: DWORD;
591 end;
592 {$EXTERNALSYM _QUERY_SERVICE_LOCK_STATUSW}
593 QUERY_SERVICE_LOCK_STATUSW = _QUERY_SERVICE_LOCK_STATUSW;
594 {$EXTERNALSYM QUERY_SERVICE_LOCK_STATUSW}
595 TQueryServiceLockStatusW = QUERY_SERVICE_LOCK_STATUSW;
596 PQueryServiceLockStatusW = LPQUERY_SERVICE_LOCK_STATUSW;
597
598 {$IFDEF UNICODE}
599 QUERY_SERVICE_LOCK_STATUS = QUERY_SERVICE_LOCK_STATUSW;
600 {$EXTERNALSYM QUERY_SERVICE_LOCK_STATUS}
601 LPQUERY_SERVICE_LOCK_STATUS = LPQUERY_SERVICE_LOCK_STATUSW;
602 {$EXTERNALSYM LPQUERY_SERVICE_LOCK_STATUS}
603 TQueryServiceLockStatus = TQueryServiceLockStatusW;
604 PQueryServiceLockStatus = PQueryServiceLockStatusW;
605 {$ELSE}
606 QUERY_SERVICE_LOCK_STATUS = QUERY_SERVICE_LOCK_STATUSA;
607 {$EXTERNALSYM QUERY_SERVICE_LOCK_STATUS}
608 LPQUERY_SERVICE_LOCK_STATUS = LPQUERY_SERVICE_LOCK_STATUSA;
609 {$EXTERNALSYM LPQUERY_SERVICE_LOCK_STATUS}
610 TQueryServiceLockStatus = TQueryServiceLockStatusA;
611 PQueryServiceLockStatus = PQueryServiceLockStatusA;
612 {$ENDIF UNICODE}
613
614 //
615 // Query Service Configuration Structure
616 //
617
618 LPQUERY_SERVICE_CONFIGA = ^QUERY_SERVICE_CONFIGA;
619 {$EXTERNALSYM LPQUERY_SERVICE_CONFIGA}
620 _QUERY_SERVICE_CONFIGA = record
621 dwServiceType: DWORD;
622 dwStartType: DWORD;
623 dwErrorControl: DWORD;
624 lpBinaryPathName: LPSTR;
625 lpLoadOrderGroup: LPSTR;
626 dwTagId: DWORD;
627 lpDependencies: LPSTR;
628 lpServiceStartName: LPSTR;
629 lpDisplayName: LPSTR;
630 end;
631 {$EXTERNALSYM _QUERY_SERVICE_CONFIGA}
632 QUERY_SERVICE_CONFIGA = _QUERY_SERVICE_CONFIGA;
633 {$EXTERNALSYM QUERY_SERVICE_CONFIGA}
634 TQueryServiceConfigA = QUERY_SERVICE_CONFIGA;
635 PQueryServiceConfigA = LPQUERY_SERVICE_CONFIGA;
636
637 LPQUERY_SERVICE_CONFIGW = ^QUERY_SERVICE_CONFIGW;
638 {$EXTERNALSYM LPQUERY_SERVICE_CONFIGW}
639 _QUERY_SERVICE_CONFIGW = record
640 dwServiceType: DWORD;
641 dwStartType: DWORD;
642 dwErrorControl: DWORD;
643 lpBinaryPathName: LPWSTR;
644 lpLoadOrderGroup: LPWSTR;
645 dwTagId: DWORD;
646 lpDependencies: LPWSTR;
647 lpServiceStartName: LPWSTR;
648 lpDisplayName: LPWSTR;
649 end;
650 {$EXTERNALSYM _QUERY_SERVICE_CONFIGW}
651 QUERY_SERVICE_CONFIGW = _QUERY_SERVICE_CONFIGW;
652 {$EXTERNALSYM QUERY_SERVICE_CONFIGW}
653 TQueryServiceConfigW = QUERY_SERVICE_CONFIGW;
654 PQueryServiceConfigW = LPQUERY_SERVICE_CONFIGW;
655
656 {$IFDEF UNICODE}
657 QUERY_SERVICE_CONFIG = QUERY_SERVICE_CONFIGW;
658 {$EXTERNALSYM QUERY_SERVICE_CONFIG}
659 LPQUERY_SERVICE_CONFIG = LPQUERY_SERVICE_CONFIGW;
660 {$EXTERNALSYM LPQUERY_SERVICE_CONFIG}
661 TQueryServiceConfig = TQueryServiceConfigW;
662 PQueryServiceConfig = PQueryServiceConfigW;
663 {$ELSE}
664 QUERY_SERVICE_CONFIG = QUERY_SERVICE_CONFIGA;
665 {$EXTERNALSYM QUERY_SERVICE_CONFIG}
666 LPQUERY_SERVICE_CONFIG = LPQUERY_SERVICE_CONFIGA;
667 {$EXTERNALSYM LPQUERY_SERVICE_CONFIG}
668 TQueryServiceConfig = TQueryServiceConfigA;
669 PQueryServiceConfig = PQueryServiceConfigA;
670 {$ENDIF UNICODE}
671
672 //
Prototypenull673 // Function Prototype for the Service Main Function
674 //
675
676 type
677 LPSERVICE_MAIN_FUNCTIONW = procedure(dwNumServicesArgs: DWORD;
678 lpServiceArgVectors: LPWSTR); stdcall;
679 {$EXTERNALSYM LPSERVICE_MAIN_FUNCTIONW}
680 LPSERVICE_MAIN_FUNCTIONA = procedure(dwNumServicesArgs: DWORD;
681 lpServiceArgVectors: LPSTR); stdcall;
682 {$EXTERNALSYM LPSERVICE_MAIN_FUNCTIONA}
683
684 TServiceMainFunctionA = LPSERVICE_MAIN_FUNCTIONA;
685 TServiceMainFunctionW = LPSERVICE_MAIN_FUNCTIONW;
686
687 {$IFDEF UNICODE}
688 LPSERVICE_MAIN_FUNCTION = LPSERVICE_MAIN_FUNCTIONW;
689 {$EXTERNALSYM LPSERVICE_MAIN_FUNCTION}
690 TServiceMainFunction = LPSERVICE_MAIN_FUNCTIONW;
691 {$ELSE}
692 LPSERVICE_MAIN_FUNCTION = LPSERVICE_MAIN_FUNCTIONA;
693 {$EXTERNALSYM LPSERVICE_MAIN_FUNCTION}
694 TServiceMainFunction = LPSERVICE_MAIN_FUNCTIONA;
695 {$ENDIF UNICODE}
696
697 //
698 // Service Start Table
699 //
700
701 LPSERVICE_TABLE_ENTRYA = ^SERVICE_TABLE_ENTRYA;
702 {$EXTERNALSYM LPSERVICE_TABLE_ENTRYA}
703 _SERVICE_TABLE_ENTRYA = record
704 lpServiceName: LPSTR;
705 lpServiceProc: LPSERVICE_MAIN_FUNCTIONA;
706 end;
707 {$EXTERNALSYM _SERVICE_TABLE_ENTRYA}
708 SERVICE_TABLE_ENTRYA = _SERVICE_TABLE_ENTRYA;
709 {$EXTERNALSYM SERVICE_TABLE_ENTRYA}
710 TServiceTableEntryA = SERVICE_TABLE_ENTRYA;
711 PServiceTableEntryA = LPSERVICE_TABLE_ENTRYA;
712
713 LPSERVICE_TABLE_ENTRYW = ^SERVICE_TABLE_ENTRYW;
714 {$EXTERNALSYM LPSERVICE_TABLE_ENTRYW}
715 _SERVICE_TABLE_ENTRYW = record
716 lpServiceName: LPWSTR;
717 lpServiceProc: LPSERVICE_MAIN_FUNCTIONW;
718 end;
719 {$EXTERNALSYM _SERVICE_TABLE_ENTRYW}
720 SERVICE_TABLE_ENTRYW = _SERVICE_TABLE_ENTRYW;
721 {$EXTERNALSYM SERVICE_TABLE_ENTRYW}
722 TServiceTableEntryW = SERVICE_TABLE_ENTRYW;
723 PServiceTableEntryW = LPSERVICE_TABLE_ENTRYW;
724
725 {$IFDEF UNICODE}
726 SERVICE_TABLE_ENTRY = SERVICE_TABLE_ENTRYW;
727 LPSERVICE_TABLE_ENTRY = LPSERVICE_TABLE_ENTRYW;
728 TServiceTableEntry = TServiceTableEntryW;
729 PServiceTableEntry = PServiceTableEntryW;
730 {$ELSE}
731 SERVICE_TABLE_ENTRY = SERVICE_TABLE_ENTRYA;
732 LPSERVICE_TABLE_ENTRY = LPSERVICE_TABLE_ENTRYA;
733 TServiceTableEntry = TServiceTableEntryA;
734 PServiceTableEntry = PServiceTableEntryA;
735 {$ENDIF UNICODE}
736
737 //
738 // Prototype for the Service Control Handler Function
739 //
740
741 LPHANDLER_FUNCTION = procedure(dwControl: DWORD); stdcall;
742 {$EXTERNALSYM LPHANDLER_FUNCTION}
743 THandlerFunction = LPHANDLER_FUNCTION;
744
wControlnull745 LPHANDLER_FUNCTION_EX = function(dwControl, dwEventType: DWORD;
746 lpEventData, lpContext: LPVOID): DWORD; stdcall;
747 {$EXTERNALSYM LPHANDLER_FUNCTION_EX}
748 THandlerFunctionEx = LPHANDLER_FUNCTION_EX;
749
750 ///////////////////////////////////////////////////////////////////////////
Prototypesnull751 // API Function Prototypes
752 ///////////////////////////////////////////////////////////////////////////
753
754 function ChangeServiceConfigA(hService: SC_HANDLE; dwServiceType, dwStartType,
755 dwErrorControl: DWORD; lpBinaryPathName, lpLoadOrderGroup: LPCSTR;
756 lpdwTagId: LPDWORD; lpDependencies, lpServiceStartName, lpPassword,
757 lpDisplayName: LPCSTR): BOOL; stdcall;
758 {$EXTERNALSYM ChangeServiceConfigA}
ChangeServiceConfigWnull759 function ChangeServiceConfigW(hService: SC_HANDLE; dwServiceType, dwStartType,
760 dwErrorControl: DWORD; lpBinaryPathName, lpLoadOrderGroup: LPCWSTR;
761 lpdwTagId: LPDWORD; lpDependencies, lpServiceStartName, lpPassword,
762 lpDisplayName: LPCWSTR): BOOL; stdcall;
763 {$EXTERNALSYM ChangeServiceConfigW}
ChangeServiceConfignull764 function ChangeServiceConfig(hService: SC_HANDLE; dwServiceType, dwStartType,
765 dwErrorControl: DWORD; lpBinaryPathName, lpLoadOrderGroup: LPCTSTR;
766 lpdwTagId: LPDWORD; lpDependencies, lpServiceStartName, lpPassword,
767 lpDisplayName: LPCTSTR): BOOL; stdcall;
768 {$EXTERNALSYM ChangeServiceConfig}
769
ChangeServiceConfig2Anull770 function ChangeServiceConfig2A(hService: SC_HANDLE; dwInfoLevel: DWORD;
771 lpInfo: LPVOID): BOOL; stdcall;
772 {$EXTERNALSYM ChangeServiceConfig2A}
ChangeServiceConfig2Wnull773 function ChangeServiceConfig2W(hService: SC_HANDLE; dwInfoLevel: DWORD;
774 lpInfo: LPVOID): BOOL; stdcall;
775 {$EXTERNALSYM ChangeServiceConfig2W}
ChangeServiceConfig2null776 function ChangeServiceConfig2(hService: SC_HANDLE; dwInfoLevel: DWORD;
777 lpInfo: LPVOID): BOOL; stdcall;
778 {$EXTERNALSYM ChangeServiceConfig2}
779
CloseServiceHandlenull780 function CloseServiceHandle(hSCObject: SC_HANDLE): BOOL; stdcall;
781 {$EXTERNALSYM CloseServiceHandle}
782
ControlServicenull783 function ControlService(hService: SC_HANDLE; dwControl: DWORD;
784 var lpServiceStatus: SERVICE_STATUS): BOOL; stdcall;
785 {$EXTERNALSYM ControlService}
786
CreateServiceAnull787 function CreateServiceA(hSCManager: SC_HANDLE; lpServiceName, lpDisplayName: LPCSTR;
788 dwDesiredAccess, dwServiceType, dwStartType, dwErrorControl: DWORD;
789 lpBinaryPathName, lpLoadOrderGroup: LPCSTR; lpdwTagId: LPDWORD;
790 lpDependencies, lpServiceStartName, lpPassword: LPCSTR): SC_HANDLE; stdcall;
791 {$EXTERNALSYM CreateServiceA}
CreateServiceWnull792 function CreateServiceW(hSCManager: SC_HANDLE; lpServiceName, lpDisplayName: LPCWSTR;
793 dwDesiredAccess, dwServiceType, dwStartType, dwErrorControl: DWORD;
794 lpBinaryPathName, lpLoadOrderGroup: LPCWSTR; lpdwTagId: LPDWORD;
795 lpDependencies, lpServiceStartName, lpPassword: LPCWSTR): SC_HANDLE; stdcall;
796 {$EXTERNALSYM CreateServiceW}
CreateServicenull797 function CreateService(hSCManager: SC_HANDLE; lpServiceName, lpDisplayName: LPCTSTR;
798 dwDesiredAccess, dwServiceType, dwStartType, dwErrorControl: DWORD;
799 lpBinaryPathName, lpLoadOrderGroup: LPCTSTR; lpdwTagId: LPDWORD;
800 lpDependencies, lpServiceStartName, lpPassword: LPCTSTR): SC_HANDLE; stdcall;
801 {$EXTERNALSYM CreateService}
802
DeleteServicenull803 function DeleteService(hService: SC_HANDLE): BOOL; stdcall;
804 {$EXTERNALSYM DeleteService}
805
EnumDependentServicesAnull806 function EnumDependentServicesA(hService: SC_HANDLE; dwServiceState: DWORD;
807 lpServices: LPENUM_SERVICE_STATUSA; cbBufSize: DWORD; var pcbBytesNeeded,
808 lpServicesReturned: DWORD): BOOL; stdcall;
809 {$EXTERNALSYM EnumDependentServicesA}
EnumDependentServicesWnull810 function EnumDependentServicesW(hService: SC_HANDLE; dwServiceState: DWORD;
811 lpServices: LPENUM_SERVICE_STATUSW; cbBufSize: DWORD; var pcbBytesNeeded,
812 lpServicesReturned: DWORD): BOOL; stdcall;
813 {$EXTERNALSYM EnumDependentServicesW}
EnumDependentServicesnull814 function EnumDependentServices(hService: SC_HANDLE; dwServiceState: DWORD;
815 lpServices: LPENUM_SERVICE_STATUS; cbBufSize: DWORD; var pcbBytesNeeded,
816 lpServicesReturned: DWORD): BOOL; stdcall;
817 {$EXTERNALSYM EnumDependentServices}
818
EnumServicesStatusAnull819 function EnumServicesStatusA(hSCManager: SC_HANDLE; dwServiceType: DWORD;
820 dwServiceState: DWORD; lpServices: LPENUM_SERVICE_STATUSA; cbBufSize: DWORD;
821 var pcbBytesNeeded, lpServicesReturned, lpResumeHandle: DWORD): BOOL; stdcall;
822 {$EXTERNALSYM EnumServicesStatusA}
EnumServicesStatusWnull823 function EnumServicesStatusW(hSCManager: SC_HANDLE; dwServiceType: DWORD;
824 dwServiceState: DWORD; lpServices: LPENUM_SERVICE_STATUSW; cbBufSize: DWORD;
825 var pcbBytesNeeded, lpServicesReturned, lpResumeHandle: DWORD): BOOL; stdcall;
826 {$EXTERNALSYM EnumServicesStatusW}
EnumServicesStatusnull827 function EnumServicesStatus(hSCManager: SC_HANDLE; dwServiceType: DWORD;
828 dwServiceState: DWORD; lpServices: LPENUM_SERVICE_STATUS; cbBufSize: DWORD;
829 var pcbBytesNeeded, lpServicesReturned, lpResumeHandle: DWORD): BOOL; stdcall;
830 {$EXTERNALSYM EnumServicesStatus}
831
EnumServicesStatusExAnull832 function EnumServicesStatusExA(hSCManager: SC_HANDLE; InfoLevel: SC_ENUM_TYPE;
833 dwServiceType: DWORD; dwServiceState: DWORD; lpServices: LPBYTE;
834 cbBufSize: DWORD; var pcbBytesNeeded, lpServicesReturned, lpResumeHandle: DWORD;
835 pszGroupName: LPCSTR): BOOL; stdcall;
836 {$EXTERNALSYM EnumServicesStatusExA}
EnumServicesStatusExWnull837 function EnumServicesStatusExW(hSCManager: SC_HANDLE; InfoLevel: SC_ENUM_TYPE;
838 dwServiceType: DWORD; dwServiceState: DWORD; lpServices: LPBYTE;
839 cbBufSize: DWORD; var pcbBytesNeeded, lpServicesReturned, lpResumeHandle: DWORD;
840 pszGroupName: LPCWSTR): BOOL; stdcall;
841 {$EXTERNALSYM EnumServicesStatusExW}
EnumServicesStatusExnull842 function EnumServicesStatusEx(hSCManager: SC_HANDLE; InfoLevel: SC_ENUM_TYPE;
843 dwServiceType: DWORD; dwServiceState: DWORD; lpServices: LPBYTE;
844 cbBufSize: DWORD; var pcbBytesNeeded, lpServicesReturned, lpResumeHandle: DWORD;
845 pszGroupName: LPCTSTR): BOOL; stdcall;
846 {$EXTERNALSYM EnumServicesStatusEx}
847
GetServiceKeyNameAnull848 function GetServiceKeyNameA(hSCManager: SC_HANDLE; lpDisplayName: LPCSTR;
849 lpServiceName: LPSTR; var lpcchBuffer: DWORD): BOOL; stdcall;
850 {$EXTERNALSYM GetServiceKeyNameA}
GetServiceKeyNameWnull851 function GetServiceKeyNameW(hSCManager: SC_HANDLE; lpDisplayName: LPCWSTR;
852 lpServiceName: LPWSTR; var lpcchBuffer: DWORD): BOOL; stdcall;
853 {$EXTERNALSYM GetServiceKeyNameW}
GetServiceKeyNamenull854 function GetServiceKeyName(hSCManager: SC_HANDLE; lpDisplayName: LPCTSTR;
855 lpServiceName: LPTSTR; var lpcchBuffer: DWORD): BOOL; stdcall;
856 {$EXTERNALSYM GetServiceKeyName}
857
GetServiceDisplayNameAnull858 function GetServiceDisplayNameA(hSCManager: SC_HANDLE; lpServiceName: LPCSTR;
859 lpDisplayName: LPSTR; var lpcchBuffer: DWORD): BOOL; stdcall;
860 {$EXTERNALSYM GetServiceDisplayNameA}
GetServiceDisplayNameWnull861 function GetServiceDisplayNameW(hSCManager: SC_HANDLE; lpServiceName: LPCWSTR;
862 lpDisplayName: LPWSTR; var lpcchBuffer: DWORD): BOOL; stdcall;
863 {$EXTERNALSYM GetServiceDisplayNameW}
GetServiceDisplayNamenull864 function GetServiceDisplayName(hSCManager: SC_HANDLE; lpServiceName: LPCTSTR;
865 lpDisplayName: LPTSTR; var lpcchBuffer: DWORD): BOOL; stdcall;
866 {$EXTERNALSYM GetServiceDisplayName}
867
LockServiceDatabasenull868 function LockServiceDatabase(hSCManager: SC_HANDLE): SC_LOCK; stdcall;
869 {$EXTERNALSYM LockServiceDatabase}
870
NotifyBootConfigStatusnull871 function NotifyBootConfigStatus(BootAcceptable: BOOL): BOOL; stdcall;
872 {$EXTERNALSYM NotifyBootConfigStatus}
873
OpenSCManagerAnull874 function OpenSCManagerA(lpMachineName: LPCSTR; lpDatabaseName: LPCSTR;
875 dwDesiredAccess: DWORD): SC_HANDLE; stdcall;
876 {$EXTERNALSYM OpenSCManagerA}
OpenSCManagerWnull877 function OpenSCManagerW(lpMachineName: LPCWSTR; lpDatabaseName: LPCWSTR;
878 dwDesiredAccess: DWORD): SC_HANDLE; stdcall;
879 {$EXTERNALSYM OpenSCManagerW}
OpenSCManagernull880 function OpenSCManager(lpMachineName: LPCTSTR; lpDatabaseName: LPCTSTR;
881 dwDesiredAccess: DWORD): SC_HANDLE; stdcall;
882 {$EXTERNALSYM OpenSCManager}
883
OpenServiceAnull884 function OpenServiceA(hSCManager: SC_HANDLE; lpServiceName: LPCSTR;
885 dwDesiredAccess: DWORD): SC_HANDLE; stdcall;
886 {$EXTERNALSYM OpenServiceA}
OpenServiceWnull887 function OpenServiceW(hSCManager: SC_HANDLE; lpServiceName: LPCWSTR;
888 dwDesiredAccess: DWORD): SC_HANDLE; stdcall;
889 {$EXTERNALSYM OpenServiceW}
OpenServicenull890 function OpenService(hSCManager: SC_HANDLE; lpServiceName: LPCTSTR;
891 dwDesiredAccess: DWORD): SC_HANDLE; stdcall;
892 {$EXTERNALSYM OpenService}
893
QueryServiceConfigAnull894 function QueryServiceConfigA(hService: SC_HANDLE;
895 lpServiceConfig: LPQUERY_SERVICE_CONFIGA; cbBufSize: DWORD;
896 var pcbBytesNeeded: DWORD): BOOL; stdcall;
897 {$EXTERNALSYM QueryServiceConfigA}
QueryServiceConfigWnull898 function QueryServiceConfigW(hService: SC_HANDLE;
899 lpServiceConfig: LPQUERY_SERVICE_CONFIGW; cbBufSize: DWORD;
900 var pcbBytesNeeded: DWORD): BOOL; stdcall;
901 {$EXTERNALSYM QueryServiceConfigW}
QueryServiceConfignull902 function QueryServiceConfig(hService: SC_HANDLE;
903 lpServiceConfig: LPQUERY_SERVICE_CONFIG; cbBufSize: DWORD;
904 var pcbBytesNeeded: DWORD): BOOL; stdcall;
905 {$EXTERNALSYM QueryServiceConfig}
906
QueryServiceConfig2Anull907 function QueryServiceConfig2A(hService: SC_HANDLE; dwInfoLevel: DWORD;
908 lpBuffer: LPBYTE; cbBufSize: DWORD; var pcbBytesNeeded: DWORD): BOOL; stdcall;
909 {$EXTERNALSYM QueryServiceConfig2A}
QueryServiceConfig2Wnull910 function QueryServiceConfig2W(hService: SC_HANDLE; dwInfoLevel: DWORD;
911 lpBuffer: LPBYTE; cbBufSize: DWORD; var pcbBytesNeeded: DWORD): BOOL; stdcall;
912 {$EXTERNALSYM QueryServiceConfig2W}
QueryServiceConfig2null913 function QueryServiceConfig2(hService: SC_HANDLE; dwInfoLevel: DWORD;
914 lpBuffer: LPBYTE; cbBufSize: DWORD; var pcbBytesNeeded: DWORD): BOOL; stdcall;
915 {$EXTERNALSYM QueryServiceConfig2}
916
QueryServiceLockStatusAnull917 function QueryServiceLockStatusA(hSCManager: SC_HANDLE;
918 lpLockStatus: LPQUERY_SERVICE_LOCK_STATUSA; cbBufSize: DWORD;
919 var pcbBytesNeeded: DWORD): BOOL; stdcall;
920 {$EXTERNALSYM QueryServiceLockStatusA}
QueryServiceLockStatusWnull921 function QueryServiceLockStatusW(hSCManager: SC_HANDLE;
922 lpLockStatus: LPQUERY_SERVICE_LOCK_STATUSW; cbBufSize: DWORD;
923 var pcbBytesNeeded: DWORD): BOOL; stdcall;
924 {$EXTERNALSYM QueryServiceLockStatusW}
QueryServiceLockStatusnull925 function QueryServiceLockStatus(hSCManager: SC_HANDLE;
926 lpLockStatus: LPQUERY_SERVICE_LOCK_STATUS; cbBufSize: DWORD;
927 var pcbBytesNeeded: DWORD): BOOL; stdcall;
928 {$EXTERNALSYM QueryServiceLockStatus}
929
QueryServiceObjectSecuritynull930 function QueryServiceObjectSecurity(hService: SC_HANDLE;
931 dwSecurityInformation: SECURITY_INFORMATION;
932 var lpSecurityDescriptor: SECURITY_DESCRIPTOR; cbBufSize: DWORD;
933 var pcbBytesNeeded: DWORD): BOOL; stdcall;
934 {$EXTERNALSYM QueryServiceObjectSecurity}
935
QueryServiceStatusnull936 function QueryServiceStatus(hService: SC_HANDLE;
937 var lpServiceStatus: SERVICE_STATUS): BOOL; stdcall;
938 {$EXTERNALSYM QueryServiceStatus}
939
QueryServiceStatusExnull940 function QueryServiceStatusEx(hService: SC_HANDLE; InfoLevel: SC_STATUS_TYPE;
941 lpBuffer: LPBYTE; cbBufSize: DWORD; var pcbBytesNeeded: DWORD): BOOL; stdcall;
942 {$EXTERNALSYM QueryServiceStatusEx}
943
RegisterServiceCtrlHandlerAnull944 function RegisterServiceCtrlHandlerA(lpServiceName: LPCSTR;
945 lpHandlerProc: LPHANDLER_FUNCTION): SERVICE_STATUS_HANDLE; stdcall;
946 {$EXTERNALSYM RegisterServiceCtrlHandlerA}
RegisterServiceCtrlHandlerWnull947 function RegisterServiceCtrlHandlerW(lpServiceName: LPCWSTR;
948 lpHandlerProc: LPHANDLER_FUNCTION): SERVICE_STATUS_HANDLE; stdcall;
949 {$EXTERNALSYM RegisterServiceCtrlHandlerW}
RegisterServiceCtrlHandlernull950 function RegisterServiceCtrlHandler(lpServiceName: LPCTSTR;
951 lpHandlerProc: LPHANDLER_FUNCTION): SERVICE_STATUS_HANDLE; stdcall;
952 {$EXTERNALSYM RegisterServiceCtrlHandler}
953
RegisterServiceCtrlHandlerExAnull954 function RegisterServiceCtrlHandlerExA(lpServiceName: LPCSTR;
955 lpHandlerProc: LPHANDLER_FUNCTION_EX; lpContext: LPVOID): SERVICE_STATUS_HANDLE; stdcall;
956 {$EXTERNALSYM RegisterServiceCtrlHandlerExA}
RegisterServiceCtrlHandlerExWnull957 function RegisterServiceCtrlHandlerExW(lpServiceName: LPCWSTR;
958 lpHandlerProc: LPHANDLER_FUNCTION_EX; lpContext: LPVOID): SERVICE_STATUS_HANDLE; stdcall;
959 {$EXTERNALSYM RegisterServiceCtrlHandlerExW}
RegisterServiceCtrlHandlerExnull960 function RegisterServiceCtrlHandlerEx(lpServiceName: LPCTSTR;
961 lpHandlerProc: LPHANDLER_FUNCTION_EX; lpContext: LPVOID): SERVICE_STATUS_HANDLE; stdcall;
962 {$EXTERNALSYM RegisterServiceCtrlHandlerEx}
963
964 // 9/4/2002 Changed last parameter from const to pointer - reported by James Ots.
965
SetServiceObjectSecuritynull966 function SetServiceObjectSecurity(hService: SC_HANDLE;
967 dwSecurityInformation: SECURITY_INFORMATION;
968 lpSecurityDescriptor: PSECURITY_DESCRIPTOR): BOOL; stdcall;
969 {$EXTERNALSYM SetServiceObjectSecurity}
970
SetServiceStatusnull971 function SetServiceStatus(hServiceStatus: SERVICE_STATUS_HANDLE;
972 const lpServiceStatus: SERVICE_STATUS): BOOL; stdcall;
973 {$EXTERNALSYM SetServiceStatus}
974
StartServiceCtrlDispatcherAnull975 function StartServiceCtrlDispatcherA(lpServiceStartTable: LPSERVICE_TABLE_ENTRYA): BOOL; stdcall;
976 {$EXTERNALSYM StartServiceCtrlDispatcherA}
StartServiceCtrlDispatcherWnull977 function StartServiceCtrlDispatcherW(lpServiceStartTable: LPSERVICE_TABLE_ENTRYW): BOOL; stdcall;
978 {$EXTERNALSYM StartServiceCtrlDispatcherW}
StartServiceCtrlDispatchernull979 function StartServiceCtrlDispatcher(lpServiceStartTable: LPSERVICE_TABLE_ENTRY): BOOL; stdcall;
980 {$EXTERNALSYM StartServiceCtrlDispatcher}
981
StartServiceAnull982 function StartServiceA(hService: SC_HANDLE; dwNumServiceArgs: DWORD;
983 lpServiceArgVectors: LPCSTR): BOOL; stdcall;
984 {$EXTERNALSYM StartServiceA}
StartServiceWnull985 function StartServiceW(hService: SC_HANDLE; dwNumServiceArgs: DWORD;
986 lpServiceArgVectors: LPCWSTR): BOOL; stdcall;
987 {$EXTERNALSYM StartServiceW}
StartServicenull988 function StartService(hService: SC_HANDLE; dwNumServiceArgs: DWORD;
989 lpServiceArgVectors: LPCTSTR): BOOL; stdcall;
990 {$EXTERNALSYM StartService}
991
UnlockServiceDatabasenull992 function UnlockServiceDatabase(ScLock: SC_LOCK): BOOL; stdcall;
993 {$EXTERNALSYM UnlockServiceDatabase}
994
995 {$ENDIF JWA_IMPLEMENTATIONSECTION}
996
997 {$IFNDEF JWA_OMIT_SECTIONS}
998 implementation
999 //uses ...
1000 {$ENDIF JWA_OMIT_SECTIONS}
1001
1002 {$IFNDEF JWA_INTERFACESECTION}
1003
1004 {$IFNDEF JWA_INCLUDEMODE}
1005 const
1006 advapi32 = 'advapi32.dll';
1007 {$IFDEF UNICODE}
1008 AWSuffix = 'W';
1009 {$ELSE}
1010 AWSuffix = 'A';
1011 {$ENDIF UNICODE}
1012 {$ENDIF JWA_INCLUDEMODE}
1013
1014 {$IFDEF DYNAMIC_LINK}
1015
1016 var
1017 _ChangeServiceConfigA: Pointer;
1018
ChangeServiceConfigAnull1019 function ChangeServiceConfigA;
1020 begin
1021 GetProcedureAddress(_ChangeServiceConfigA, advapi32, 'ChangeServiceConfigA');
1022 asm
1023 MOV ESP, EBP
1024 POP EBP
1025 JMP [_ChangeServiceConfigA]
1026 end;
1027 end;
1028
1029 var
1030 _ChangeServiceConfigW: Pointer;
1031
ChangeServiceConfigWnull1032 function ChangeServiceConfigW;
1033 begin
1034 GetProcedureAddress(_ChangeServiceConfigW, advapi32, 'ChangeServiceConfigW');
1035 asm
1036 MOV ESP, EBP
1037 POP EBP
1038 JMP [_ChangeServiceConfigW]
1039 end;
1040 end;
1041
1042 var
1043 _ChangeServiceConfig: Pointer;
1044
ChangeServiceConfignull1045 function ChangeServiceConfig;
1046 begin
1047 GetProcedureAddress(_ChangeServiceConfig, advapi32, 'ChangeServiceConfig' + AWSuffix);
1048 asm
1049 MOV ESP, EBP
1050 POP EBP
1051 JMP [_ChangeServiceConfig]
1052 end;
1053 end;
1054
1055 var
1056 _ChangeServiceConfig2A: Pointer;
1057
ChangeServiceConfig2Anull1058 function ChangeServiceConfig2A;
1059 begin
1060 GetProcedureAddress(_ChangeServiceConfig2A, advapi32, 'ChangeServiceConfig2A');
1061 asm
1062 MOV ESP, EBP
1063 POP EBP
1064 JMP [_ChangeServiceConfig2A]
1065 end;
1066 end;
1067
1068 var
1069 _ChangeServiceConfig2W: Pointer;
1070
ChangeServiceConfig2Wnull1071 function ChangeServiceConfig2W;
1072 begin
1073 GetProcedureAddress(_ChangeServiceConfig2W, advapi32, 'ChangeServiceConfig2W');
1074 asm
1075 MOV ESP, EBP
1076 POP EBP
1077 JMP [_ChangeServiceConfig2W]
1078 end;
1079 end;
1080
1081 var
1082 _ChangeServiceConfig2: Pointer;
1083
ChangeServiceConfig2null1084 function ChangeServiceConfig2;
1085 begin
1086 GetProcedureAddress(_ChangeServiceConfig2, advapi32, 'ChangeServiceConfig2' + AWSuffix);
1087 asm
1088 MOV ESP, EBP
1089 POP EBP
1090 JMP [_ChangeServiceConfig2]
1091 end;
1092 end;
1093
1094 var
1095 _CloseServiceHandle: Pointer;
1096
CloseServiceHandlenull1097 function CloseServiceHandle;
1098 begin
1099 GetProcedureAddress(_CloseServiceHandle, advapi32, 'CloseServiceHandle');
1100 asm
1101 MOV ESP, EBP
1102 POP EBP
1103 JMP [_CloseServiceHandle]
1104 end;
1105 end;
1106
1107 var
1108 _ControlService: Pointer;
1109
ControlServicenull1110 function ControlService;
1111 begin
1112 GetProcedureAddress(_ControlService, advapi32, 'ControlService');
1113 asm
1114 MOV ESP, EBP
1115 POP EBP
1116 JMP [_ControlService]
1117 end;
1118 end;
1119
1120 var
1121 _CreateServiceA: Pointer;
1122
CreateServiceAnull1123 function CreateServiceA;
1124 begin
1125 GetProcedureAddress(_CreateServiceA, advapi32, 'CreateServiceA');
1126 asm
1127 MOV ESP, EBP
1128 POP EBP
1129 JMP [_CreateServiceA]
1130 end;
1131 end;
1132
1133 var
1134 _CreateServiceW: Pointer;
1135
CreateServiceWnull1136 function CreateServiceW;
1137 begin
1138 GetProcedureAddress(_CreateServiceW, advapi32, 'CreateServiceW');
1139 asm
1140 MOV ESP, EBP
1141 POP EBP
1142 JMP [_CreateServiceW]
1143 end;
1144 end;
1145
1146 var
1147 _CreateService: Pointer;
1148
CreateServicenull1149 function CreateService;
1150 begin
1151 GetProcedureAddress(_CreateService, advapi32, 'CreateService' + AWSuffix);
1152 asm
1153 MOV ESP, EBP
1154 POP EBP
1155 JMP [_CreateService]
1156 end;
1157 end;
1158
1159 var
1160 _DeleteService: Pointer;
1161
DeleteServicenull1162 function DeleteService;
1163 begin
1164 GetProcedureAddress(_DeleteService, advapi32, 'DeleteService');
1165 asm
1166 MOV ESP, EBP
1167 POP EBP
1168 JMP [_DeleteService]
1169 end;
1170 end;
1171
1172 var
1173 _EnumDependentServicesA: Pointer;
1174
EnumDependentServicesAnull1175 function EnumDependentServicesA;
1176 begin
1177 GetProcedureAddress(_EnumDependentServicesA, advapi32, 'EnumDependentServicesA');
1178 asm
1179 MOV ESP, EBP
1180 POP EBP
1181 JMP [_EnumDependentServicesA]
1182 end;
1183 end;
1184
1185 var
1186 _EnumDependentServicesW: Pointer;
1187
EnumDependentServicesWnull1188 function EnumDependentServicesW;
1189 begin
1190 GetProcedureAddress(_EnumDependentServicesW, advapi32, 'EnumDependentServicesW');
1191 asm
1192 MOV ESP, EBP
1193 POP EBP
1194 JMP [_EnumDependentServicesW]
1195 end;
1196 end;
1197
1198 var
1199 _EnumDependentServices: Pointer;
1200
EnumDependentServicesnull1201 function EnumDependentServices;
1202 begin
1203 GetProcedureAddress(_EnumDependentServices, advapi32, 'EnumDependentServices' + AWSuffix);
1204 asm
1205 MOV ESP, EBP
1206 POP EBP
1207 JMP [_EnumDependentServices]
1208 end;
1209 end;
1210
1211 var
1212 _EnumServicesStatusA: Pointer;
1213
EnumServicesStatusAnull1214 function EnumServicesStatusA;
1215 begin
1216 GetProcedureAddress(_EnumServicesStatusA, advapi32, 'EnumServicesStatusA');
1217 asm
1218 MOV ESP, EBP
1219 POP EBP
1220 JMP [_EnumServicesStatusA]
1221 end;
1222 end;
1223
1224 var
1225 _EnumServicesStatusW: Pointer;
1226
EnumServicesStatusWnull1227 function EnumServicesStatusW;
1228 begin
1229 GetProcedureAddress(_EnumServicesStatusW, advapi32, 'EnumServicesStatusW');
1230 asm
1231 MOV ESP, EBP
1232 POP EBP
1233 JMP [_EnumServicesStatusW]
1234 end;
1235 end;
1236
1237 var
1238 _EnumServicesStatus: Pointer;
1239
EnumServicesStatusnull1240 function EnumServicesStatus;
1241 begin
1242 GetProcedureAddress(_EnumServicesStatus, advapi32, 'EnumServicesStatus' + AWSuffix);
1243 asm
1244 MOV ESP, EBP
1245 POP EBP
1246 JMP [_EnumServicesStatus]
1247 end;
1248 end;
1249
1250 var
1251 _EnumServicesStatusExA: Pointer;
1252
EnumServicesStatusExAnull1253 function EnumServicesStatusExA;
1254 begin
1255 GetProcedureAddress(_EnumServicesStatusExA, advapi32, 'EnumServicesStatusExA');
1256 asm
1257 MOV ESP, EBP
1258 POP EBP
1259 JMP [_EnumServicesStatusExA]
1260 end;
1261 end;
1262
1263 var
1264 _EnumServicesStatusExW: Pointer;
1265
EnumServicesStatusExWnull1266 function EnumServicesStatusExW;
1267 begin
1268 GetProcedureAddress(_EnumServicesStatusExW, advapi32, 'EnumServicesStatusExW');
1269 asm
1270 MOV ESP, EBP
1271 POP EBP
1272 JMP [_EnumServicesStatusExW]
1273 end;
1274 end;
1275
1276 var
1277 _EnumServicesStatusEx: Pointer;
1278
EnumServicesStatusExnull1279 function EnumServicesStatusEx;
1280 begin
1281 GetProcedureAddress(_EnumServicesStatusEx, advapi32, 'EnumServicesStatusEx' + AWSuffix);
1282 asm
1283 MOV ESP, EBP
1284 POP EBP
1285 JMP [_EnumServicesStatusEx]
1286 end;
1287 end;
1288
1289 var
1290 _GetServiceKeyNameA: Pointer;
1291
GetServiceKeyNameAnull1292 function GetServiceKeyNameA;
1293 begin
1294 GetProcedureAddress(_GetServiceKeyNameA, advapi32, 'GetServiceKeyNameA');
1295 asm
1296 MOV ESP, EBP
1297 POP EBP
1298 JMP [_GetServiceKeyNameA]
1299 end;
1300 end;
1301
1302 var
1303 _GetServiceKeyNameW: Pointer;
1304
GetServiceKeyNameWnull1305 function GetServiceKeyNameW;
1306 begin
1307 GetProcedureAddress(_GetServiceKeyNameW, advapi32, 'GetServiceKeyNameW');
1308 asm
1309 MOV ESP, EBP
1310 POP EBP
1311 JMP [_GetServiceKeyNameW]
1312 end;
1313 end;
1314
1315 var
1316 _GetServiceKeyName: Pointer;
1317
GetServiceKeyNamenull1318 function GetServiceKeyName;
1319 begin
1320 GetProcedureAddress(_GetServiceKeyName, advapi32, 'GetServiceKeyName' + AWSuffix);
1321 asm
1322 MOV ESP, EBP
1323 POP EBP
1324 JMP [_GetServiceKeyName]
1325 end;
1326 end;
1327
1328 var
1329 _GetServiceDisplayNameA: Pointer;
1330
GetServiceDisplayNameAnull1331 function GetServiceDisplayNameA;
1332 begin
1333 GetProcedureAddress(_GetServiceDisplayNameA, advapi32, 'GetServiceDisplayNameA');
1334 asm
1335 MOV ESP, EBP
1336 POP EBP
1337 JMP [_GetServiceDisplayNameA]
1338 end;
1339 end;
1340
1341 var
1342 _GetServiceDisplayNameW: Pointer;
1343
GetServiceDisplayNameWnull1344 function GetServiceDisplayNameW;
1345 begin
1346 GetProcedureAddress(_GetServiceDisplayNameW, advapi32, 'GetServiceDisplayNameW');
1347 asm
1348 MOV ESP, EBP
1349 POP EBP
1350 JMP [_GetServiceDisplayNameW]
1351 end;
1352 end;
1353
1354 var
1355 _GetServiceDisplayName: Pointer;
1356
GetServiceDisplayNamenull1357 function GetServiceDisplayName;
1358 begin
1359 GetProcedureAddress(_GetServiceDisplayName, advapi32, 'GetServiceDisplayName' + AWSuffix);
1360 asm
1361 MOV ESP, EBP
1362 POP EBP
1363 JMP [_GetServiceDisplayName]
1364 end;
1365 end;
1366
1367 var
1368 _LockServiceDatabase: Pointer;
1369
LockServiceDatabasenull1370 function LockServiceDatabase;
1371 begin
1372 GetProcedureAddress(_LockServiceDatabase, advapi32, 'LockServiceDatabase');
1373 asm
1374 MOV ESP, EBP
1375 POP EBP
1376 JMP [_LockServiceDatabase]
1377 end;
1378 end;
1379
1380 var
1381 _NotifyBootConfigStatus: Pointer;
1382
NotifyBootConfigStatusnull1383 function NotifyBootConfigStatus;
1384 begin
1385 GetProcedureAddress(_NotifyBootConfigStatus, advapi32, 'NotifyBootConfigStatus');
1386 asm
1387 MOV ESP, EBP
1388 POP EBP
1389 JMP [_NotifyBootConfigStatus]
1390 end;
1391 end;
1392
1393 var
1394 _OpenSCManagerA: Pointer;
1395
OpenSCManagerAnull1396 function OpenSCManagerA;
1397 begin
1398 GetProcedureAddress(_OpenSCManagerA, advapi32, 'OpenSCManagerA');
1399 asm
1400 MOV ESP, EBP
1401 POP EBP
1402 JMP [_OpenSCManagerA]
1403 end;
1404 end;
1405
1406 var
1407 _OpenSCManagerW: Pointer;
1408
OpenSCManagerWnull1409 function OpenSCManagerW;
1410 begin
1411 GetProcedureAddress(_OpenSCManagerW, advapi32, 'OpenSCManagerW');
1412 asm
1413 MOV ESP, EBP
1414 POP EBP
1415 JMP [_OpenSCManagerW]
1416 end;
1417 end;
1418
1419 var
1420 _OpenSCManager: Pointer;
1421
OpenSCManagernull1422 function OpenSCManager;
1423 begin
1424 GetProcedureAddress(_OpenSCManager, advapi32, 'OpenSCManager' + AWSuffix);
1425 asm
1426 MOV ESP, EBP
1427 POP EBP
1428 JMP [_OpenSCManager]
1429 end;
1430 end;
1431
1432 var
1433 _OpenServiceA: Pointer;
1434
OpenServiceAnull1435 function OpenServiceA;
1436 begin
1437 GetProcedureAddress(_OpenServiceA, advapi32, 'OpenServiceA');
1438 asm
1439 MOV ESP, EBP
1440 POP EBP
1441 JMP [_OpenServiceA]
1442 end;
1443 end;
1444
1445 var
1446 _OpenServiceW: Pointer;
1447
OpenServiceWnull1448 function OpenServiceW;
1449 begin
1450 GetProcedureAddress(_OpenServiceW, advapi32, 'OpenServiceW');
1451 asm
1452 MOV ESP, EBP
1453 POP EBP
1454 JMP [_OpenServiceW]
1455 end;
1456 end;
1457
1458 var
1459 _OpenService: Pointer;
1460
OpenServicenull1461 function OpenService;
1462 begin
1463 GetProcedureAddress(_OpenService, advapi32, 'OpenService' + AWSuffix);
1464 asm
1465 MOV ESP, EBP
1466 POP EBP
1467 JMP [_OpenService]
1468 end;
1469 end;
1470
1471 var
1472 _QueryServiceConfigA: Pointer;
1473
QueryServiceConfigAnull1474 function QueryServiceConfigA;
1475 begin
1476 GetProcedureAddress(_QueryServiceConfigA, advapi32, 'QueryServiceConfigA');
1477 asm
1478 MOV ESP, EBP
1479 POP EBP
1480 JMP [_QueryServiceConfigA]
1481 end;
1482 end;
1483
1484 var
1485 _QueryServiceConfigW: Pointer;
1486
QueryServiceConfigWnull1487 function QueryServiceConfigW;
1488 begin
1489 GetProcedureAddress(_QueryServiceConfigW, advapi32, 'QueryServiceConfigW');
1490 asm
1491 MOV ESP, EBP
1492 POP EBP
1493 JMP [_QueryServiceConfigW]
1494 end;
1495 end;
1496
1497 var
1498 _QueryServiceConfig: Pointer;
1499
QueryServiceConfignull1500 function QueryServiceConfig;
1501 begin
1502 GetProcedureAddress(_QueryServiceConfig, advapi32, 'QueryServiceConfig' + AWSuffix);
1503 asm
1504 MOV ESP, EBP
1505 POP EBP
1506 JMP [_QueryServiceConfig]
1507 end;
1508 end;
1509
1510 var
1511 _QueryServiceConfig2A: Pointer;
1512
QueryServiceConfig2Anull1513 function QueryServiceConfig2A;
1514 begin
1515 GetProcedureAddress(_QueryServiceConfig2A, advapi32, 'QueryServiceConfig2A');
1516 asm
1517 MOV ESP, EBP
1518 POP EBP
1519 JMP [_QueryServiceConfig2A]
1520 end;
1521 end;
1522
1523 var
1524 _QueryServiceConfig2W: Pointer;
1525
QueryServiceConfig2Wnull1526 function QueryServiceConfig2W;
1527 begin
1528 GetProcedureAddress(_QueryServiceConfig2W, advapi32, 'QueryServiceConfig2W');
1529 asm
1530 MOV ESP, EBP
1531 POP EBP
1532 JMP [_QueryServiceConfig2W]
1533 end;
1534 end;
1535
1536 var
1537 _QueryServiceConfig2: Pointer;
1538
QueryServiceConfig2null1539 function QueryServiceConfig2;
1540 begin
1541 GetProcedureAddress(_QueryServiceConfig2, advapi32, 'QueryServiceConfig2' + AWSuffix);
1542 asm
1543 MOV ESP, EBP
1544 POP EBP
1545 JMP [_QueryServiceConfig2]
1546 end;
1547 end;
1548
1549 var
1550 _QueryServiceLockStatusA: Pointer;
1551
QueryServiceLockStatusAnull1552 function QueryServiceLockStatusA;
1553 begin
1554 GetProcedureAddress(_QueryServiceLockStatusA, advapi32, 'QueryServiceLockStatusA');
1555 asm
1556 MOV ESP, EBP
1557 POP EBP
1558 JMP [_QueryServiceLockStatusA]
1559 end;
1560 end;
1561
1562 var
1563 _QueryServiceLockStatusW: Pointer;
1564
QueryServiceLockStatusWnull1565 function QueryServiceLockStatusW;
1566 begin
1567 GetProcedureAddress(_QueryServiceLockStatusW, advapi32, 'QueryServiceLockStatusW');
1568 asm
1569 MOV ESP, EBP
1570 POP EBP
1571 JMP [_QueryServiceLockStatusW]
1572 end;
1573 end;
1574
1575 var
1576 _QueryServiceLockStatus: Pointer;
1577
QueryServiceLockStatusnull1578 function QueryServiceLockStatus;
1579 begin
1580 GetProcedureAddress(_QueryServiceLockStatus, advapi32, 'QueryServiceLockStatus' + AWSuffix);
1581 asm
1582 MOV ESP, EBP
1583 POP EBP
1584 JMP [_QueryServiceLockStatus]
1585 end;
1586 end;
1587
1588 var
1589 _QueryServiceObjectSecurity: Pointer;
1590
QueryServiceObjectSecuritynull1591 function QueryServiceObjectSecurity;
1592 begin
1593 GetProcedureAddress(_QueryServiceObjectSecurity, advapi32, 'QueryServiceObjectSecurity');
1594 asm
1595 MOV ESP, EBP
1596 POP EBP
1597 JMP [_QueryServiceObjectSecurity]
1598 end;
1599 end;
1600
1601 var
1602 _QueryServiceStatus: Pointer;
1603
QueryServiceStatusnull1604 function QueryServiceStatus;
1605 begin
1606 GetProcedureAddress(_QueryServiceStatus, advapi32, 'QueryServiceStatus');
1607 asm
1608 MOV ESP, EBP
1609 POP EBP
1610 JMP [_QueryServiceStatus]
1611 end;
1612 end;
1613
1614 var
1615 _QueryServiceStatusEx: Pointer;
1616
QueryServiceStatusExnull1617 function QueryServiceStatusEx;
1618 begin
1619 GetProcedureAddress(_QueryServiceStatusEx, advapi32, 'QueryServiceStatusEx');
1620 asm
1621 MOV ESP, EBP
1622 POP EBP
1623 JMP [_QueryServiceStatusEx]
1624 end;
1625 end;
1626
1627 var
1628 _RegisterServiceCtrlHandlerA: Pointer;
1629
RegisterServiceCtrlHandlerAnull1630 function RegisterServiceCtrlHandlerA;
1631 begin
1632 GetProcedureAddress(_RegisterServiceCtrlHandlerA, advapi32, 'RegisterServiceCtrlHandlerA');
1633 asm
1634 MOV ESP, EBP
1635 POP EBP
1636 JMP [_RegisterServiceCtrlHandlerA]
1637 end;
1638 end;
1639
1640 var
1641 _RegisterServiceCtrlHandlerW: Pointer;
1642
RegisterServiceCtrlHandlerWnull1643 function RegisterServiceCtrlHandlerW;
1644 begin
1645 GetProcedureAddress(_RegisterServiceCtrlHandlerW, advapi32, 'RegisterServiceCtrlHandlerW');
1646 asm
1647 MOV ESP, EBP
1648 POP EBP
1649 JMP [_RegisterServiceCtrlHandlerW]
1650 end;
1651 end;
1652
1653 var
1654 _RegisterServiceCtrlHandler: Pointer;
1655
RegisterServiceCtrlHandlernull1656 function RegisterServiceCtrlHandler;
1657 begin
1658 GetProcedureAddress(_RegisterServiceCtrlHandler, advapi32, 'RegisterServiceCtrlHandler' + AWSuffix);
1659 asm
1660 MOV ESP, EBP
1661 POP EBP
1662 JMP [_RegisterServiceCtrlHandler]
1663 end;
1664 end;
1665
1666 var
1667 _RegisterServiceCtrlHandlerExA: Pointer;
1668
RegisterServiceCtrlHandlerExAnull1669 function RegisterServiceCtrlHandlerExA;
1670 begin
1671 GetProcedureAddress(_RegisterServiceCtrlHandlerExA, advapi32, 'RegisterServiceCtrlHandlerExA');
1672 asm
1673 MOV ESP, EBP
1674 POP EBP
1675 JMP [_RegisterServiceCtrlHandlerExA]
1676 end;
1677 end;
1678
1679 var
1680 _RegisterServiceCtrlHandlerExW: Pointer;
1681
RegisterServiceCtrlHandlerExWnull1682 function RegisterServiceCtrlHandlerExW;
1683 begin
1684 GetProcedureAddress(_RegisterServiceCtrlHandlerExW, advapi32, 'RegisterServiceCtrlHandlerExW');
1685 asm
1686 MOV ESP, EBP
1687 POP EBP
1688 JMP [_RegisterServiceCtrlHandlerExW]
1689 end;
1690 end;
1691
1692 var
1693 _RegisterServiceCtrlHandlerEx: Pointer;
1694
RegisterServiceCtrlHandlerExnull1695 function RegisterServiceCtrlHandlerEx;
1696 begin
1697 GetProcedureAddress(_RegisterServiceCtrlHandlerEx, advapi32, 'RegisterServiceCtrlHandlerEx' + AWSuffix);
1698 asm
1699 MOV ESP, EBP
1700 POP EBP
1701 JMP [_RegisterServiceCtrlHandlerEx]
1702 end;
1703 end;
1704
1705 var
1706 _SetServiceObjectSecurity: Pointer;
1707
SetServiceObjectSecuritynull1708 function SetServiceObjectSecurity;
1709 begin
1710 GetProcedureAddress(_SetServiceObjectSecurity, advapi32, 'SetServiceObjectSecurity');
1711 asm
1712 MOV ESP, EBP
1713 POP EBP
1714 JMP [_SetServiceObjectSecurity]
1715 end;
1716 end;
1717
1718 var
1719 _SetServiceStatus: Pointer;
1720
SetServiceStatusnull1721 function SetServiceStatus;
1722 begin
1723 GetProcedureAddress(_SetServiceStatus, advapi32, 'SetServiceStatus');
1724 asm
1725 MOV ESP, EBP
1726 POP EBP
1727 JMP [_SetServiceStatus]
1728 end;
1729 end;
1730
1731 var
1732 _StartServiceCtrlDispatcherA: Pointer;
1733
StartServiceCtrlDispatcherAnull1734 function StartServiceCtrlDispatcherA;
1735 begin
1736 GetProcedureAddress(_StartServiceCtrlDispatcherA, advapi32, 'StartServiceCtrlDispatcherA');
1737 asm
1738 MOV ESP, EBP
1739 POP EBP
1740 JMP [_StartServiceCtrlDispatcherA]
1741 end;
1742 end;
1743
1744 var
1745 _StartServiceCtrlDispatcherW: Pointer;
1746
StartServiceCtrlDispatcherWnull1747 function StartServiceCtrlDispatcherW;
1748 begin
1749 GetProcedureAddress(_StartServiceCtrlDispatcherW, advapi32, 'StartServiceCtrlDispatcherW');
1750 asm
1751 MOV ESP, EBP
1752 POP EBP
1753 JMP [_StartServiceCtrlDispatcherW]
1754 end;
1755 end;
1756
1757 var
1758 _StartServiceCtrlDispatcher: Pointer;
1759
StartServiceCtrlDispatchernull1760 function StartServiceCtrlDispatcher;
1761 begin
1762 GetProcedureAddress(_StartServiceCtrlDispatcher, advapi32, 'StartServiceCtrlDispatcher' + AWSuffix);
1763 asm
1764 MOV ESP, EBP
1765 POP EBP
1766 JMP [_StartServiceCtrlDispatcher]
1767 end;
1768 end;
1769
1770 var
1771 _StartServiceA: Pointer;
1772
StartServiceAnull1773 function StartServiceA;
1774 begin
1775 GetProcedureAddress(_StartServiceA, advapi32, 'StartServiceA');
1776 asm
1777 MOV ESP, EBP
1778 POP EBP
1779 JMP [_StartServiceA]
1780 end;
1781 end;
1782
1783 var
1784 _StartServiceW: Pointer;
1785
StartServiceWnull1786 function StartServiceW;
1787 begin
1788 GetProcedureAddress(_StartServiceW, advapi32, 'StartServiceW');
1789 asm
1790 MOV ESP, EBP
1791 POP EBP
1792 JMP [_StartServiceW]
1793 end;
1794 end;
1795
1796 var
1797 _StartService: Pointer;
1798
StartServicenull1799 function StartService;
1800 begin
1801 GetProcedureAddress(_StartService, advapi32, 'StartService' + AWSuffix);
1802 asm
1803 MOV ESP, EBP
1804 POP EBP
1805 JMP [_StartService]
1806 end;
1807 end;
1808
1809 var
1810 _UnlockServiceDatabase: Pointer;
1811
UnlockServiceDatabasenull1812 function UnlockServiceDatabase;
1813 begin
1814 GetProcedureAddress(_UnlockServiceDatabase, advapi32, 'UnlockServiceDatabase');
1815 asm
1816 MOV ESP, EBP
1817 POP EBP
1818 JMP [_UnlockServiceDatabase]
1819 end;
1820 end;
1821
1822 {$ELSE}
1823
ChangeServiceConfigAnull1824 function ChangeServiceConfigA; external advapi32 name 'ChangeServiceConfigA';
ChangeServiceConfigWnull1825 function ChangeServiceConfigW; external advapi32 name 'ChangeServiceConfigW';
ChangeServiceConfignull1826 function ChangeServiceConfig; external advapi32 name 'ChangeServiceConfig' + AWSuffix;
ChangeServiceConfig2Anull1827 function ChangeServiceConfig2A; external advapi32 name 'ChangeServiceConfig2A';
ChangeServiceConfig2Wnull1828 function ChangeServiceConfig2W; external advapi32 name 'ChangeServiceConfig2W';
ChangeServiceConfig2null1829 function ChangeServiceConfig2; external advapi32 name 'ChangeServiceConfig2' + AWSuffix;
CloseServiceHandlenull1830 function CloseServiceHandle; external advapi32 name 'CloseServiceHandle';
ControlServicenull1831 function ControlService; external advapi32 name 'ControlService';
CreateServiceAnull1832 function CreateServiceA; external advapi32 name 'CreateServiceA';
CreateServiceWnull1833 function CreateServiceW; external advapi32 name 'CreateServiceW';
CreateServicenull1834 function CreateService; external advapi32 name 'CreateService' + AWSuffix;
DeleteServicenull1835 function DeleteService; external advapi32 name 'DeleteService';
EnumDependentServicesAnull1836 function EnumDependentServicesA; external advapi32 name 'EnumDependentServicesA';
EnumDependentServicesWnull1837 function EnumDependentServicesW; external advapi32 name 'EnumDependentServicesW';
EnumDependentServicesnull1838 function EnumDependentServices; external advapi32 name 'EnumDependentServices' + AWSuffix;
EnumServicesStatusAnull1839 function EnumServicesStatusA; external advapi32 name 'EnumServicesStatusA';
EnumServicesStatusWnull1840 function EnumServicesStatusW; external advapi32 name 'EnumServicesStatusW';
EnumServicesStatusnull1841 function EnumServicesStatus; external advapi32 name 'EnumServicesStatus' + AWSuffix;
EnumServicesStatusExAnull1842 function EnumServicesStatusExA; external advapi32 name 'EnumServicesStatusExA';
EnumServicesStatusExWnull1843 function EnumServicesStatusExW; external advapi32 name 'EnumServicesStatusExW';
EnumServicesStatusExnull1844 function EnumServicesStatusEx; external advapi32 name 'EnumServicesStatusEx' + AWSuffix;
GetServiceKeyNameAnull1845 function GetServiceKeyNameA; external advapi32 name 'GetServiceKeyNameA';
GetServiceKeyNameWnull1846 function GetServiceKeyNameW; external advapi32 name 'GetServiceKeyNameW';
GetServiceKeyNamenull1847 function GetServiceKeyName; external advapi32 name 'GetServiceKeyName' + AWSuffix;
GetServiceDisplayNameAnull1848 function GetServiceDisplayNameA; external advapi32 name 'GetServiceDisplayNameA';
GetServiceDisplayNameWnull1849 function GetServiceDisplayNameW; external advapi32 name 'GetServiceDisplayNameW';
GetServiceDisplayNamenull1850 function GetServiceDisplayName; external advapi32 name 'GetServiceDisplayName' + AWSuffix;
LockServiceDatabasenull1851 function LockServiceDatabase; external advapi32 name 'LockServiceDatabase';
NotifyBootConfigStatusnull1852 function NotifyBootConfigStatus; external advapi32 name 'NotifyBootConfigStatus';
OpenSCManagerAnull1853 function OpenSCManagerA; external advapi32 name 'OpenSCManagerA';
OpenSCManagerWnull1854 function OpenSCManagerW; external advapi32 name 'OpenSCManagerW';
OpenSCManagernull1855 function OpenSCManager; external advapi32 name 'OpenSCManager' + AWSuffix;
OpenServiceAnull1856 function OpenServiceA; external advapi32 name 'OpenServiceA';
OpenServiceWnull1857 function OpenServiceW; external advapi32 name 'OpenServiceW';
OpenServicenull1858 function OpenService; external advapi32 name 'OpenService' + AWSuffix;
QueryServiceConfigAnull1859 function QueryServiceConfigA; external advapi32 name 'QueryServiceConfigA';
QueryServiceConfigWnull1860 function QueryServiceConfigW; external advapi32 name 'QueryServiceConfigW';
QueryServiceConfignull1861 function QueryServiceConfig; external advapi32 name 'QueryServiceConfig' + AWSuffix;
QueryServiceConfig2Anull1862 function QueryServiceConfig2A; external advapi32 name 'QueryServiceConfig2A';
QueryServiceConfig2Wnull1863 function QueryServiceConfig2W; external advapi32 name 'QueryServiceConfig2W';
QueryServiceConfig2null1864 function QueryServiceConfig2; external advapi32 name 'QueryServiceConfig2' + AWSuffix;
QueryServiceLockStatusAnull1865 function QueryServiceLockStatusA; external advapi32 name 'QueryServiceLockStatusA';
QueryServiceLockStatusWnull1866 function QueryServiceLockStatusW; external advapi32 name 'QueryServiceLockStatusW';
QueryServiceLockStatusnull1867 function QueryServiceLockStatus; external advapi32 name 'QueryServiceLockStatus' + AWSuffix;
QueryServiceObjectSecuritynull1868 function QueryServiceObjectSecurity; external advapi32 name 'QueryServiceObjectSecurity';
QueryServiceStatusnull1869 function QueryServiceStatus; external advapi32 name 'QueryServiceStatus';
QueryServiceStatusExnull1870 function QueryServiceStatusEx; external advapi32 name 'QueryServiceStatusEx';
RegisterServiceCtrlHandlerAnull1871 function RegisterServiceCtrlHandlerA; external advapi32 name 'RegisterServiceCtrlHandlerA';
RegisterServiceCtrlHandlerWnull1872 function RegisterServiceCtrlHandlerW; external advapi32 name 'RegisterServiceCtrlHandlerW';
RegisterServiceCtrlHandlernull1873 function RegisterServiceCtrlHandler; external advapi32 name 'RegisterServiceCtrlHandler' + AWSuffix;
RegisterServiceCtrlHandlerExAnull1874 function RegisterServiceCtrlHandlerExA; external advapi32 name 'RegisterServiceCtrlHandlerExA';
RegisterServiceCtrlHandlerExWnull1875 function RegisterServiceCtrlHandlerExW; external advapi32 name 'RegisterServiceCtrlHandlerExW';
RegisterServiceCtrlHandlerExnull1876 function RegisterServiceCtrlHandlerEx; external advapi32 name 'RegisterServiceCtrlHandlerEx' + AWSuffix;
SetServiceObjectSecuritynull1877 function SetServiceObjectSecurity; external advapi32 name 'SetServiceObjectSecurity';
SetServiceStatusnull1878 function SetServiceStatus; external advapi32 name 'SetServiceStatus';
StartServiceCtrlDispatcherAnull1879 function StartServiceCtrlDispatcherA; external advapi32 name 'StartServiceCtrlDispatcherA';
StartServiceCtrlDispatcherWnull1880 function StartServiceCtrlDispatcherW; external advapi32 name 'StartServiceCtrlDispatcherW';
StartServiceCtrlDispatchernull1881 function StartServiceCtrlDispatcher; external advapi32 name 'StartServiceCtrlDispatcher' + AWSuffix;
StartServiceAnull1882 function StartServiceA; external advapi32 name 'StartServiceA';
StartServiceWnull1883 function StartServiceW; external advapi32 name 'StartServiceW';
StartServicenull1884 function StartService; external advapi32 name 'StartService' + AWSuffix;
UnlockServiceDatabasenull1885 function UnlockServiceDatabase; external advapi32 name 'UnlockServiceDatabase';
1886
1887 {$ENDIF DYNAMIC_LINK}
1888
1889 {$ENDIF JWA_INTERFACESECTION}
1890
1891
1892 {$IFNDEF JWA_OMIT_SECTIONS}
1893 end.
1894 {$ENDIF JWA_OMIT_SECTIONS}
1895