Artifact 1045de9392b75c75eb14ce61d494a49cc771c640:
- File
src/win32/winsvc.d
-
2015-05-05 06:49:05
- part of checkin
[9b639cf2d6]
on branch trunk
- Working version for update to 2.067.
The problem was __gshared. Replacing it with TLS fixed the issue. Remaining problem is that "hack.d"'s CloseHandle hack is not working anymore.
(user: kinaba) [annotate]
-
2015-05-05 06:49:05
- part of checkin
[9b639cf2d6]
on branch trunk
- Working version for update to 2.067.
0000: 2f 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a /*************** 0010: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a **************** 0020: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a **************** 0030: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a **************** 0040: 2a 2a 2a 2a 2a 2a 2a 2a 5c 0d 0a 2a 20 20 20 20 ********\..* 0050: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0060: 20 20 20 20 20 20 20 20 20 20 20 20 77 69 6e 73 wins 0070: 76 63 2e 64 20 20 20 20 20 20 20 20 20 20 20 20 vc.d 0080: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0090: 20 20 20 2a 0d 0a 2a 20 20 20 20 20 20 20 20 20 *..* 00a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 00b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 00c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 00d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2a 0d *. 00e0: 0a 2a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .* 00f0: 20 20 20 20 20 20 20 20 20 57 69 6e 64 6f 77 73 Windows 0100: 20 41 50 49 20 68 65 61 64 65 72 20 6d 6f 64 75 API header modu 0110: 6c 65 20 20 20 20 20 20 20 20 20 20 20 20 20 20 le 0120: 20 20 20 20 20 20 20 20 20 2a 0d 0a 2a 20 20 20 *..* 0130: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0140: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0150: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0160: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0170: 20 20 20 20 2a 0d 0a 2a 20 20 20 20 20 20 20 20 *..* 0180: 20 20 20 20 20 20 20 20 20 54 72 61 6e 73 6c 61 Transla 0190: 74 65 64 20 66 72 6f 6d 20 4d 69 6e 47 57 20 57 ted from MinGW W 01a0: 69 6e 64 6f 77 73 20 68 65 61 64 65 72 73 20 20 indows headers 01b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2a * 01c0: 0d 0a 2a 20 20 20 20 20 20 20 20 20 20 20 20 20 ..* 01d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 79 by 01e0: 20 53 74 65 77 61 72 74 20 47 6f 72 64 6f 6e 20 Stewart Gordon 01f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0200: 20 20 20 20 20 20 20 20 20 20 2a 0d 0a 2a 20 20 *..* 0210: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0220: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0230: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0240: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0250: 20 20 20 20 20 2a 0d 0a 2a 20 20 20 20 20 20 20 *..* 0260: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0270: 50 6c 61 63 65 64 20 69 6e 74 6f 20 70 75 62 6c Placed into publ 0280: 69 63 20 64 6f 6d 61 69 6e 20 20 20 20 20 20 20 ic domain 0290: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 02a0: 2a 0d 0a 5c 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a *..\************ 02b0: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a **************** 02c0: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a **************** 02d0: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a **************** 02e0: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2f 0d 0a 6d 6f ***********/..mo 02f0: 64 75 6c 65 20 77 69 6e 33 32 2e 77 69 6e 73 76 dule win32.winsv 0300: 63 3b 0d 0a 70 72 61 67 6d 61 28 6c 69 62 2c 20 c;..pragma(lib, 0310: 22 61 64 76 61 70 69 33 32 22 29 3b 0d 0a 0d 0a "advapi32");.... 0320: 70 72 69 76 61 74 65 20 69 6d 70 6f 72 74 20 77 private import w 0330: 69 6e 33 32 2e 77 33 32 61 70 69 2c 20 77 69 6e in32.w32api, win 0340: 33 32 2e 77 69 6e 64 65 66 3b 0d 0a 0d 0a 2f 2f 32.windef;....// 0350: 20 46 49 58 4d 45 3a 20 63 68 65 63 6b 20 57 69 FIXME: check Wi 0360: 6e 64 6f 77 73 20 76 65 72 73 69 6f 6e 20 73 75 ndows version su 0370: 70 70 6f 72 74 0d 0a 0d 0a 63 6f 6e 73 74 20 54 pport....const T 0380: 43 48 41 52 5b 5d 0d 0a 09 53 45 52 56 49 43 45 CHAR[]...SERVICE 0390: 53 5f 41 43 54 49 56 45 5f 44 41 54 41 42 41 53 S_ACTIVE_DATABAS 03a0: 45 20 3d 20 22 53 65 72 76 69 63 65 73 41 63 74 E = "ServicesAct 03b0: 69 76 65 22 2c 0d 0a 09 53 45 52 56 49 43 45 53 ive",...SERVICES 03c0: 5f 46 41 49 4c 45 44 5f 44 41 54 41 42 41 53 45 _FAILED_DATABASE 03d0: 20 3d 20 22 53 65 72 76 69 63 65 73 46 61 69 6c = "ServicesFail 03e0: 65 64 22 3b 0d 0a 0d 0a 63 6f 6e 73 74 20 54 43 ed";....const TC 03f0: 48 41 52 20 53 43 5f 47 52 4f 55 50 5f 49 44 45 HAR SC_GROUP_IDE 0400: 4e 54 49 46 49 45 52 20 3d 20 27 2b 27 3b 0d 0a NTIFIER = '+';.. 0410: 0d 0a 63 6f 6e 73 74 20 44 57 4f 52 44 0d 0a 09 ..const DWORD... 0420: 53 43 5f 4d 41 4e 41 47 45 52 5f 41 4c 4c 5f 41 SC_MANAGER_ALL_A 0430: 43 43 45 53 53 20 20 20 20 20 20 20 20 20 3d 20 CCESS = 0440: 30 78 66 30 30 33 66 2c 0d 0a 09 53 43 5f 4d 41 0xf003f,...SC_MA 0450: 4e 41 47 45 52 5f 43 4f 4e 4e 45 43 54 20 20 20 NAGER_CONNECT 0460: 20 20 20 20 20 20 20 20 20 3d 20 20 31 2c 0d 0a = 1,.. 0470: 09 53 43 5f 4d 41 4e 41 47 45 52 5f 43 52 45 41 .SC_MANAGER_CREA 0480: 54 45 5f 53 45 52 56 49 43 45 20 20 20 20 20 3d TE_SERVICE = 0490: 20 20 32 2c 0d 0a 09 53 43 5f 4d 41 4e 41 47 45 2,...SC_MANAGE 04a0: 52 5f 45 4e 55 4d 45 52 41 54 45 5f 53 45 52 56 R_ENUMERATE_SERV 04b0: 49 43 45 20 20 3d 20 20 34 2c 0d 0a 09 53 43 5f ICE = 4,...SC_ 04c0: 4d 41 4e 41 47 45 52 5f 4c 4f 43 4b 20 20 20 20 MANAGER_LOCK 04d0: 20 20 20 20 20 20 20 20 20 20 20 3d 20 20 38 2c = 8, 04e0: 0d 0a 09 53 43 5f 4d 41 4e 41 47 45 52 5f 51 55 ...SC_MANAGER_QU 04f0: 45 52 59 5f 4c 4f 43 4b 5f 53 54 41 54 55 53 20 ERY_LOCK_STATUS 0500: 20 3d 20 31 36 2c 0d 0a 09 53 43 5f 4d 41 4e 41 = 16,...SC_MANA 0510: 47 45 52 5f 4d 4f 44 49 46 59 5f 42 4f 4f 54 5f GER_MODIFY_BOOT_ 0520: 43 4f 4e 46 49 47 20 3d 20 33 32 3b 0d 0a 0d 0a CONFIG = 32;.... 0530: 63 6f 6e 73 74 20 44 57 4f 52 44 20 53 45 52 56 const DWORD SERV 0540: 49 43 45 5f 4e 4f 5f 43 48 41 4e 47 45 20 3d 20 ICE_NO_CHANGE = 0550: 30 78 66 66 66 66 66 66 66 66 3b 0d 0a 0d 0a 65 0xffffffff;....e 0560: 6e 75 6d 20 3a 20 44 57 4f 52 44 20 7b 0d 0a 09 num : DWORD {... 0570: 53 45 52 56 49 43 45 5f 53 54 4f 50 50 45 44 20 SERVICE_STOPPED 0580: 3d 20 31 2c 0d 0a 09 53 45 52 56 49 43 45 5f 53 = 1,...SERVICE_S 0590: 54 41 52 54 5f 50 45 4e 44 49 4e 47 2c 0d 0a 09 TART_PENDING,... 05a0: 53 45 52 56 49 43 45 5f 53 54 4f 50 5f 50 45 4e SERVICE_STOP_PEN 05b0: 44 49 4e 47 2c 0d 0a 09 53 45 52 56 49 43 45 5f DING,...SERVICE_ 05c0: 52 55 4e 4e 49 4e 47 2c 0d 0a 09 53 45 52 56 49 RUNNING,...SERVI 05d0: 43 45 5f 43 4f 4e 54 49 4e 55 45 5f 50 45 4e 44 CE_CONTINUE_PEND 05e0: 49 4e 47 2c 0d 0a 09 53 45 52 56 49 43 45 5f 50 ING,...SERVICE_P 05f0: 41 55 53 45 5f 50 45 4e 44 49 4e 47 2c 0d 0a 09 AUSE_PENDING,... 0600: 53 45 52 56 49 43 45 5f 50 41 55 53 45 44 20 2f SERVICE_PAUSED / 0610: 2f 20 3d 20 37 0d 0a 7d 0d 0a 0d 0a 63 6f 6e 73 / = 7..}....cons 0620: 74 20 44 57 4f 52 44 0d 0a 09 53 45 52 56 49 43 t DWORD...SERVIC 0630: 45 5f 41 43 43 45 50 54 5f 53 54 4f 50 20 20 20 E_ACCEPT_STOP 0640: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3d = 0650: 20 20 20 31 2c 0d 0a 09 53 45 52 56 49 43 45 5f 1,...SERVICE_ 0660: 41 43 43 45 50 54 5f 50 41 55 53 45 5f 43 4f 4e ACCEPT_PAUSE_CON 0670: 54 49 4e 55 45 20 20 20 20 20 20 20 20 3d 20 20 TINUE = 0680: 20 32 2c 0d 0a 09 53 45 52 56 49 43 45 5f 41 43 2,...SERVICE_AC 0690: 43 45 50 54 5f 53 48 55 54 44 4f 57 4e 20 20 20 CEPT_SHUTDOWN 06a0: 20 20 20 20 20 20 20 20 20 20 20 3d 20 20 20 34 = 4 06b0: 2c 0d 0a 09 53 45 52 56 49 43 45 5f 41 43 43 45 ,...SERVICE_ACCE 06c0: 50 54 5f 50 41 52 41 4d 43 48 41 4e 47 45 20 20 PT_PARAMCHANGE 06d0: 20 20 20 20 20 20 20 20 20 3d 20 20 20 38 2c 0d = 8,. 06e0: 0a 09 53 45 52 56 49 43 45 5f 41 43 43 45 50 54 ..SERVICE_ACCEPT 06f0: 5f 4e 45 54 42 49 4e 44 43 48 41 4e 47 45 20 20 _NETBINDCHANGE 0700: 20 20 20 20 20 20 20 3d 20 20 31 36 2c 0d 0a 09 = 16,... 0710: 53 45 52 56 49 43 45 5f 41 43 43 45 50 54 5f 48 SERVICE_ACCEPT_H 0720: 41 52 44 57 41 52 45 50 52 4f 46 49 4c 45 43 48 ARDWAREPROFILECH 0730: 41 4e 47 45 20 3d 20 20 33 32 2c 0d 0a 09 53 45 ANGE = 32,...SE 0740: 52 56 49 43 45 5f 41 43 43 45 50 54 5f 50 4f 57 RVICE_ACCEPT_POW 0750: 45 52 45 56 45 4e 54 20 20 20 20 20 20 20 20 20 EREVENT 0760: 20 20 20 3d 20 20 36 34 2c 0d 0a 09 53 45 52 56 = 64,...SERV 0770: 49 43 45 5f 41 43 43 45 50 54 5f 53 45 53 53 49 ICE_ACCEPT_SESSI 0780: 4f 4e 43 48 41 4e 47 45 20 20 20 20 20 20 20 20 ONCHANGE 0790: 20 3d 20 31 32 38 3b 0d 0a 0d 0a 65 6e 75 6d 20 = 128;....enum 07a0: 3a 20 44 57 4f 52 44 20 7b 0d 0a 09 53 45 52 56 : DWORD {...SERV 07b0: 49 43 45 5f 43 4f 4e 54 52 4f 4c 5f 53 54 4f 50 ICE_CONTROL_STOP 07c0: 20 3d 20 31 2c 0d 0a 09 53 45 52 56 49 43 45 5f = 1,...SERVICE_ 07d0: 43 4f 4e 54 52 4f 4c 5f 50 41 55 53 45 2c 0d 0a CONTROL_PAUSE,.. 07e0: 09 53 45 52 56 49 43 45 5f 43 4f 4e 54 52 4f 4c .SERVICE_CONTROL 07f0: 5f 43 4f 4e 54 49 4e 55 45 2c 0d 0a 09 53 45 52 _CONTINUE,...SER 0800: 56 49 43 45 5f 43 4f 4e 54 52 4f 4c 5f 49 4e 54 VICE_CONTROL_INT 0810: 45 52 52 4f 47 41 54 45 2c 0d 0a 09 53 45 52 56 ERROGATE,...SERV 0820: 49 43 45 5f 43 4f 4e 54 52 4f 4c 5f 53 48 55 54 ICE_CONTROL_SHUT 0830: 44 4f 57 4e 2c 0d 0a 09 53 45 52 56 49 43 45 5f DOWN,...SERVICE_ 0840: 43 4f 4e 54 52 4f 4c 5f 50 41 52 41 4d 43 48 41 CONTROL_PARAMCHA 0850: 4e 47 45 2c 0d 0a 09 53 45 52 56 49 43 45 5f 43 NGE,...SERVICE_C 0860: 4f 4e 54 52 4f 4c 5f 4e 45 54 42 49 4e 44 41 44 ONTROL_NETBINDAD 0870: 44 2c 0d 0a 09 53 45 52 56 49 43 45 5f 43 4f 4e D,...SERVICE_CON 0880: 54 52 4f 4c 5f 4e 45 54 42 49 4e 44 52 45 4d 4f TROL_NETBINDREMO 0890: 56 45 2c 0d 0a 09 53 45 52 56 49 43 45 5f 43 4f VE,...SERVICE_CO 08a0: 4e 54 52 4f 4c 5f 4e 45 54 42 49 4e 44 45 4e 41 NTROL_NETBINDENA 08b0: 42 4c 45 2c 0d 0a 09 53 45 52 56 49 43 45 5f 43 BLE,...SERVICE_C 08c0: 4f 4e 54 52 4f 4c 5f 4e 45 54 42 49 4e 44 44 49 ONTROL_NETBINDDI 08d0: 53 41 42 4c 45 2c 0d 0a 09 53 45 52 56 49 43 45 SABLE,...SERVICE 08e0: 5f 43 4f 4e 54 52 4f 4c 5f 44 45 56 49 43 45 45 _CONTROL_DEVICEE 08f0: 56 45 4e 54 2c 0d 0a 09 53 45 52 56 49 43 45 5f VENT,...SERVICE_ 0900: 43 4f 4e 54 52 4f 4c 5f 48 41 52 44 57 41 52 45 CONTROL_HARDWARE 0910: 50 52 4f 46 49 4c 45 43 48 41 4e 47 45 2c 0d 0a PROFILECHANGE,.. 0920: 09 53 45 52 56 49 43 45 5f 43 4f 4e 54 52 4f 4c .SERVICE_CONTROL 0930: 5f 50 4f 57 45 52 45 56 45 4e 54 2c 0d 0a 09 53 _POWEREVENT,...S 0940: 45 52 56 49 43 45 5f 43 4f 4e 54 52 4f 4c 5f 53 ERVICE_CONTROL_S 0950: 45 53 53 49 4f 4e 43 48 41 4e 47 45 2c 20 2f 2f ESSIONCHANGE, // 0960: 20 3d 20 31 34 0d 0a 7d 0d 0a 0d 0a 65 6e 75 6d = 14..}....enum 0970: 20 3a 20 44 57 4f 52 44 20 7b 0d 0a 09 53 45 52 : DWORD {...SER 0980: 56 49 43 45 5f 41 43 54 49 56 45 20 3d 20 31 2c VICE_ACTIVE = 1, 0990: 0d 0a 09 53 45 52 56 49 43 45 5f 49 4e 41 43 54 ...SERVICE_INACT 09a0: 49 56 45 2c 0d 0a 09 53 45 52 56 49 43 45 5f 53 IVE,...SERVICE_S 09b0: 54 41 54 45 5f 41 4c 4c 0d 0a 7d 0d 0a 0d 0a 63 TATE_ALL..}....c 09c0: 6f 6e 73 74 20 44 57 4f 52 44 0d 0a 09 53 45 52 onst DWORD...SER 09d0: 56 49 43 45 5f 51 55 45 52 59 5f 43 4f 4e 46 49 VICE_QUERY_CONFI 09e0: 47 20 20 20 20 20 20 20 20 20 3d 20 30 78 30 30 G = 0x00 09f0: 30 31 2c 0d 0a 09 53 45 52 56 49 43 45 5f 43 48 01,...SERVICE_CH 0a00: 41 4e 47 45 5f 43 4f 4e 46 49 47 20 20 20 20 20 ANGE_CONFIG 0a10: 20 20 20 3d 20 30 78 30 30 30 32 2c 0d 0a 09 53 = 0x0002,...S 0a20: 45 52 56 49 43 45 5f 51 55 45 52 59 5f 53 54 41 ERVICE_QUERY_STA 0a30: 54 55 53 20 20 20 20 20 20 20 20 20 3d 20 30 78 TUS = 0x 0a40: 30 30 30 34 2c 0d 0a 09 53 45 52 56 49 43 45 5f 0004,...SERVICE_ 0a50: 45 4e 55 4d 45 52 41 54 45 5f 44 45 50 45 4e 44 ENUMERATE_DEPEND 0a60: 45 4e 54 53 20 3d 20 30 78 30 30 30 38 2c 0d 0a ENTS = 0x0008,.. 0a70: 09 53 45 52 56 49 43 45 5f 53 54 41 52 54 20 20 .SERVICE_START 0a80: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3d 20 = 0a90: 30 78 30 30 31 30 2c 0d 0a 09 53 45 52 56 49 43 0x0010,...SERVIC 0aa0: 45 5f 53 54 4f 50 20 20 20 20 20 20 20 20 20 20 E_STOP 0ab0: 20 20 20 20 20 20 20 3d 20 30 78 30 30 32 30 2c = 0x0020, 0ac0: 0d 0a 09 53 45 52 56 49 43 45 5f 50 41 55 53 45 ...SERVICE_PAUSE 0ad0: 5f 43 4f 4e 54 49 4e 55 45 20 20 20 20 20 20 20 _CONTINUE 0ae0: 3d 20 30 78 30 30 34 30 2c 0d 0a 09 53 45 52 56 = 0x0040,...SERV 0af0: 49 43 45 5f 49 4e 54 45 52 52 4f 47 41 54 45 20 ICE_INTERROGATE 0b00: 20 20 20 20 20 20 20 20 20 3d 20 30 78 30 30 38 = 0x008 0b10: 30 2c 0d 0a 09 53 45 52 56 49 43 45 5f 55 53 45 0,...SERVICE_USE 0b20: 52 5f 44 45 46 49 4e 45 44 5f 43 4f 4e 54 52 4f R_DEFINED_CONTRO 0b30: 4c 20 3d 20 30 78 30 31 30 30 2c 0d 0a 09 53 45 L = 0x0100,...SE 0b40: 52 56 49 43 45 5f 41 4c 4c 5f 41 43 43 45 53 53 RVICE_ALL_ACCESS 0b50: 20 20 20 20 20 20 20 20 20 20 20 3d 20 30 78 30 = 0x0 0b60: 31 46 46 20 7c 20 53 54 41 4e 44 41 52 44 5f 52 1FF | STANDARD_R 0b70: 49 47 48 54 53 5f 52 45 51 55 49 52 45 44 3b 0d IGHTS_REQUIRED;. 0b80: 0a 0d 0a 2f 2f 20 54 68 69 73 20 69 73 20 6e 6f ...// This is no 0b90: 74 20 64 6f 63 75 6d 65 6e 74 65 64 20 6f 6e 20 t documented on 0ba0: 74 68 65 20 4d 53 44 4e 20 73 69 74 65 0d 0a 63 the MSDN site..c 0bb0: 6f 6e 73 74 20 53 45 52 56 49 43 45 5f 52 55 4e onst SERVICE_RUN 0bc0: 53 5f 49 4e 5f 53 59 53 54 45 4d 5f 50 52 4f 43 S_IN_SYSTEM_PROC 0bd0: 45 53 53 20 3d 20 31 3b 0d 0a 0d 0a 65 6e 75 6d ESS = 1;....enum 0be0: 20 3a 20 44 57 4f 52 44 20 7b 0d 0a 09 53 45 52 : DWORD {...SER 0bf0: 56 49 43 45 5f 43 4f 4e 46 49 47 5f 44 45 53 43 VICE_CONFIG_DESC 0c00: 52 49 50 54 49 4f 4e 20 20 20 20 20 20 20 20 20 RIPTION 0c10: 3d 20 31 2c 0d 0a 09 53 45 52 56 49 43 45 5f 43 = 1,...SERVICE_C 0c20: 4f 4e 46 49 47 5f 46 41 49 4c 55 52 45 5f 41 43 ONFIG_FAILURE_AC 0c30: 54 49 4f 4e 53 2c 0d 0a 09 53 45 52 56 49 43 45 TIONS,...SERVICE 0c40: 5f 43 4f 4e 46 49 47 5f 44 45 4c 41 59 45 44 5f _CONFIG_DELAYED_ 0c50: 41 55 54 4f 5f 53 54 41 52 54 5f 49 4e 46 4f 2c AUTO_START_INFO, 0c60: 0d 0a 09 53 45 52 56 49 43 45 5f 43 4f 4e 46 49 ...SERVICE_CONFI 0c70: 47 5f 46 41 49 4c 55 52 45 5f 41 43 54 49 4f 4e G_FAILURE_ACTION 0c80: 53 5f 46 4c 41 47 2c 0d 0a 09 53 45 52 56 49 43 S_FLAG,...SERVIC 0c90: 45 5f 43 4f 4e 46 49 47 5f 53 45 52 56 49 43 45 E_CONFIG_SERVICE 0ca0: 5f 53 49 44 5f 49 4e 46 4f 2c 0d 0a 09 53 45 52 _SID_INFO,...SER 0cb0: 56 49 43 45 5f 43 4f 4e 46 49 47 5f 52 45 51 55 VICE_CONFIG_REQU 0cc0: 49 52 45 44 5f 50 52 49 56 49 4c 45 47 45 53 5f IRED_PRIVILEGES_ 0cd0: 49 4e 46 4f 2c 0d 0a 09 53 45 52 56 49 43 45 5f INFO,...SERVICE_ 0ce0: 43 4f 4e 46 49 47 5f 50 52 45 53 48 55 54 44 4f CONFIG_PRESHUTDO 0cf0: 57 4e 5f 49 4e 46 4f 20 2f 2f 20 3d 20 37 0d 0a WN_INFO // = 7.. 0d00: 7d 0d 0a 0d 0a 73 74 72 75 63 74 20 53 45 52 56 }....struct SERV 0d10: 49 43 45 5f 53 54 41 54 55 53 20 7b 0d 0a 09 44 ICE_STATUS {...D 0d20: 57 4f 52 44 20 64 77 53 65 72 76 69 63 65 54 79 WORD dwServiceTy 0d30: 70 65 3b 0d 0a 09 44 57 4f 52 44 20 64 77 43 75 pe;...DWORD dwCu 0d40: 72 72 65 6e 74 53 74 61 74 65 3b 0d 0a 09 44 57 rrentState;...DW 0d50: 4f 52 44 20 64 77 43 6f 6e 74 72 6f 6c 73 41 63 ORD dwControlsAc 0d60: 63 65 70 74 65 64 3b 0d 0a 09 44 57 4f 52 44 20 cepted;...DWORD 0d70: 64 77 57 69 6e 33 32 45 78 69 74 43 6f 64 65 3b dwWin32ExitCode; 0d80: 0d 0a 09 44 57 4f 52 44 20 64 77 53 65 72 76 69 ...DWORD dwServi 0d90: 63 65 53 70 65 63 69 66 69 63 45 78 69 74 43 6f ceSpecificExitCo 0da0: 64 65 3b 0d 0a 09 44 57 4f 52 44 20 64 77 43 68 de;...DWORD dwCh 0db0: 65 63 6b 50 6f 69 6e 74 3b 0d 0a 09 44 57 4f 52 eckPoint;...DWOR 0dc0: 44 20 64 77 57 61 69 74 48 69 6e 74 3b 0d 0a 7d D dwWaitHint;..} 0dd0: 0d 0a 61 6c 69 61 73 20 53 45 52 56 49 43 45 5f ..alias SERVICE_ 0de0: 53 54 41 54 55 53 2a 20 4c 50 53 45 52 56 49 43 STATUS* LPSERVIC 0df0: 45 5f 53 54 41 54 55 53 3b 0d 0a 0d 0a 73 74 72 E_STATUS;....str 0e00: 75 63 74 20 45 4e 55 4d 5f 53 45 52 56 49 43 45 uct ENUM_SERVICE 0e10: 5f 53 54 41 54 55 53 41 20 7b 0d 0a 09 4c 50 53 _STATUSA {...LPS 0e20: 54 52 20 20 20 20 20 20 20 20 20 20 6c 70 53 65 TR lpSe 0e30: 72 76 69 63 65 4e 61 6d 65 3b 0d 0a 09 4c 50 53 rviceName;...LPS 0e40: 54 52 20 20 20 20 20 20 20 20 20 20 6c 70 44 69 TR lpDi 0e50: 73 70 6c 61 79 4e 61 6d 65 3b 0d 0a 09 53 45 52 splayName;...SER 0e60: 56 49 43 45 5f 53 54 41 54 55 53 20 53 65 72 76 VICE_STATUS Serv 0e70: 69 63 65 53 74 61 74 75 73 3b 0d 0a 7d 0d 0a 61 iceStatus;..}..a 0e80: 6c 69 61 73 20 45 4e 55 4d 5f 53 45 52 56 49 43 lias ENUM_SERVIC 0e90: 45 5f 53 54 41 54 55 53 41 2a 20 4c 50 45 4e 55 E_STATUSA* LPENU 0ea0: 4d 5f 53 45 52 56 49 43 45 5f 53 54 41 54 55 53 M_SERVICE_STATUS 0eb0: 41 3b 0d 0a 0d 0a 73 74 72 75 63 74 20 45 4e 55 A;....struct ENU 0ec0: 4d 5f 53 45 52 56 49 43 45 5f 53 54 41 54 55 53 M_SERVICE_STATUS 0ed0: 57 20 7b 0d 0a 09 4c 50 57 53 54 52 20 20 20 20 W {...LPWSTR 0ee0: 20 20 20 20 20 6c 70 53 65 72 76 69 63 65 4e 61 lpServiceNa 0ef0: 6d 65 3b 0d 0a 09 4c 50 57 53 54 52 20 20 20 20 me;...LPWSTR 0f00: 20 20 20 20 20 6c 70 44 69 73 70 6c 61 79 4e 61 lpDisplayNa 0f10: 6d 65 3b 0d 0a 09 53 45 52 56 49 43 45 5f 53 54 me;...SERVICE_ST 0f20: 41 54 55 53 20 53 65 72 76 69 63 65 53 74 61 74 ATUS ServiceStat 0f30: 75 73 3b 0d 0a 7d 0d 0a 61 6c 69 61 73 20 45 4e us;..}..alias EN 0f40: 55 4d 5f 53 45 52 56 49 43 45 5f 53 54 41 54 55 UM_SERVICE_STATU 0f50: 53 57 2a 20 4c 50 45 4e 55 4d 5f 53 45 52 56 49 SW* LPENUM_SERVI 0f60: 43 45 5f 53 54 41 54 55 53 57 3b 0d 0a 0d 0a 73 CE_STATUSW;....s 0f70: 74 72 75 63 74 20 51 55 45 52 59 5f 53 45 52 56 truct QUERY_SERV 0f80: 49 43 45 5f 43 4f 4e 46 49 47 41 20 7b 0d 0a 09 ICE_CONFIGA {... 0f90: 44 57 4f 52 44 20 64 77 53 65 72 76 69 63 65 54 DWORD dwServiceT 0fa0: 79 70 65 3b 0d 0a 09 44 57 4f 52 44 20 64 77 53 ype;...DWORD dwS 0fb0: 74 61 72 74 54 79 70 65 3b 0d 0a 09 44 57 4f 52 tartType;...DWOR 0fc0: 44 20 64 77 45 72 72 6f 72 43 6f 6e 74 72 6f 6c D dwErrorControl 0fd0: 3b 0d 0a 09 4c 50 53 54 52 20 6c 70 42 69 6e 61 ;...LPSTR lpBina 0fe0: 72 79 50 61 74 68 4e 61 6d 65 3b 0d 0a 09 4c 50 ryPathName;...LP 0ff0: 53 54 52 20 6c 70 4c 6f 61 64 4f 72 64 65 72 47 STR lpLoadOrderG 1000: 72 6f 75 70 3b 0d 0a 09 44 57 4f 52 44 20 64 77 roup;...DWORD dw 1010: 54 61 67 49 64 3b 0d 0a 09 4c 50 53 54 52 20 6c TagId;...LPSTR l 1020: 70 44 65 70 65 6e 64 65 6e 63 69 65 73 3b 0d 0a pDependencies;.. 1030: 09 4c 50 53 54 52 20 6c 70 53 65 72 76 69 63 65 .LPSTR lpService 1040: 53 74 61 72 74 4e 61 6d 65 3b 0d 0a 09 4c 50 53 StartName;...LPS 1050: 54 52 20 6c 70 44 69 73 70 6c 61 79 4e 61 6d 65 TR lpDisplayName 1060: 3b 0d 0a 7d 0d 0a 61 6c 69 61 73 20 51 55 45 52 ;..}..alias QUER 1070: 59 5f 53 45 52 56 49 43 45 5f 43 4f 4e 46 49 47 Y_SERVICE_CONFIG 1080: 41 2a 20 4c 50 51 55 45 52 59 5f 53 45 52 56 49 A* LPQUERY_SERVI 1090: 43 45 5f 43 4f 4e 46 49 47 41 3b 0d 0a 0d 0a 73 CE_CONFIGA;....s 10a0: 74 72 75 63 74 20 51 55 45 52 59 5f 53 45 52 56 truct QUERY_SERV 10b0: 49 43 45 5f 43 4f 4e 46 49 47 57 20 7b 0d 0a 09 ICE_CONFIGW {... 10c0: 44 57 4f 52 44 20 20 64 77 53 65 72 76 69 63 65 DWORD dwService 10d0: 54 79 70 65 3b 0d 0a 09 44 57 4f 52 44 20 20 64 Type;...DWORD d 10e0: 77 53 74 61 72 74 54 79 70 65 3b 0d 0a 09 44 57 wStartType;...DW 10f0: 4f 52 44 20 20 64 77 45 72 72 6f 72 43 6f 6e 74 ORD dwErrorCont 1100: 72 6f 6c 3b 0d 0a 09 4c 50 57 53 54 52 20 6c 70 rol;...LPWSTR lp 1110: 42 69 6e 61 72 79 50 61 74 68 4e 61 6d 65 3b 0d BinaryPathName;. 1120: 0a 09 4c 50 57 53 54 52 20 6c 70 4c 6f 61 64 4f ..LPWSTR lpLoadO 1130: 72 64 65 72 47 72 6f 75 70 3b 0d 0a 09 44 57 4f rderGroup;...DWO 1140: 52 44 20 20 64 77 54 61 67 49 64 3b 0d 0a 09 4c RD dwTagId;...L 1150: 50 57 53 54 52 20 6c 70 44 65 70 65 6e 64 65 6e PWSTR lpDependen 1160: 63 69 65 73 3b 0d 0a 09 4c 50 57 53 54 52 20 6c cies;...LPWSTR l 1170: 70 53 65 72 76 69 63 65 53 74 61 72 74 4e 61 6d pServiceStartNam 1180: 65 3b 0d 0a 09 4c 50 57 53 54 52 20 6c 70 44 69 e;...LPWSTR lpDi 1190: 73 70 6c 61 79 4e 61 6d 65 3b 0d 0a 7d 0d 0a 61 splayName;..}..a 11a0: 6c 69 61 73 20 51 55 45 52 59 5f 53 45 52 56 49 lias QUERY_SERVI 11b0: 43 45 5f 43 4f 4e 46 49 47 57 2a 20 4c 50 51 55 CE_CONFIGW* LPQU 11c0: 45 52 59 5f 53 45 52 56 49 43 45 5f 43 4f 4e 46 ERY_SERVICE_CONF 11d0: 49 47 57 3b 0d 0a 0d 0a 73 74 72 75 63 74 20 51 IGW;....struct Q 11e0: 55 45 52 59 5f 53 45 52 56 49 43 45 5f 4c 4f 43 UERY_SERVICE_LOC 11f0: 4b 5f 53 54 41 54 55 53 41 20 7b 0d 0a 09 44 57 K_STATUSA {...DW 1200: 4f 52 44 20 66 49 73 4c 6f 63 6b 65 64 3b 0d 0a ORD fIsLocked;.. 1210: 09 4c 50 53 54 52 20 6c 70 4c 6f 63 6b 4f 77 6e .LPSTR lpLockOwn 1220: 65 72 3b 0d 0a 09 44 57 4f 52 44 20 64 77 4c 6f er;...DWORD dwLo 1230: 63 6b 44 75 72 61 74 69 6f 6e 3b 0d 0a 7d 0d 0a ckDuration;..}.. 1240: 61 6c 69 61 73 20 51 55 45 52 59 5f 53 45 52 56 alias QUERY_SERV 1250: 49 43 45 5f 4c 4f 43 4b 5f 53 54 41 54 55 53 41 ICE_LOCK_STATUSA 1260: 2a 20 4c 50 51 55 45 52 59 5f 53 45 52 56 49 43 * LPQUERY_SERVIC 1270: 45 5f 4c 4f 43 4b 5f 53 54 41 54 55 53 41 3b 0d E_LOCK_STATUSA;. 1280: 0a 0d 0a 73 74 72 75 63 74 20 51 55 45 52 59 5f ...struct QUERY_ 1290: 53 45 52 56 49 43 45 5f 4c 4f 43 4b 5f 53 54 41 SERVICE_LOCK_STA 12a0: 54 55 53 57 20 7b 0d 0a 09 44 57 4f 52 44 20 20 TUSW {...DWORD 12b0: 66 49 73 4c 6f 63 6b 65 64 3b 0d 0a 09 4c 50 57 fIsLocked;...LPW 12c0: 53 54 52 20 6c 70 4c 6f 63 6b 4f 77 6e 65 72 3b STR lpLockOwner; 12d0: 0d 0a 09 44 57 4f 52 44 20 20 64 77 4c 6f 63 6b ...DWORD dwLock 12e0: 44 75 72 61 74 69 6f 6e 3b 0d 0a 7d 0d 0a 61 6c Duration;..}..al 12f0: 69 61 73 20 51 55 45 52 59 5f 53 45 52 56 49 43 ias QUERY_SERVIC 1300: 45 5f 4c 4f 43 4b 5f 53 54 41 54 55 53 57 2a 20 E_LOCK_STATUSW* 1310: 4c 50 51 55 45 52 59 5f 53 45 52 56 49 43 45 5f LPQUERY_SERVICE_ 1320: 4c 4f 43 4b 5f 53 54 41 54 55 53 57 3b 0d 0a 0d LOCK_STATUSW;... 1330: 0a 65 78 74 65 72 6e 20 28 57 69 6e 64 6f 77 73 .extern (Windows 1340: 29 20 7b 0d 0a 09 61 6c 69 61 73 20 76 6f 69 64 ) {...alias void 1350: 20 66 75 6e 63 74 69 6f 6e 28 44 57 4f 52 44 2c function(DWORD, 1360: 20 4c 50 53 54 52 2a 29 20 20 4c 50 53 45 52 56 LPSTR*) LPSERV 1370: 49 43 45 5f 4d 41 49 4e 5f 46 55 4e 43 54 49 4f ICE_MAIN_FUNCTIO 1380: 4e 41 3b 0d 0a 09 61 6c 69 61 73 20 76 6f 69 64 NA;...alias void 1390: 20 66 75 6e 63 74 69 6f 6e 28 44 57 4f 52 44 2c function(DWORD, 13a0: 20 4c 50 57 53 54 52 2a 29 20 4c 50 53 45 52 56 LPWSTR*) LPSERV 13b0: 49 43 45 5f 4d 41 49 4e 5f 46 55 4e 43 54 49 4f ICE_MAIN_FUNCTIO 13c0: 4e 57 3b 0d 0a 7d 0d 0a 0d 0a 73 74 72 75 63 74 NW;..}....struct 13d0: 20 53 45 52 56 49 43 45 5f 54 41 42 4c 45 5f 45 SERVICE_TABLE_E 13e0: 4e 54 52 59 41 20 7b 0d 0a 09 4c 50 53 54 52 20 NTRYA {...LPSTR 13f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 1400: 20 20 20 6c 70 53 65 72 76 69 63 65 4e 61 6d 65 lpServiceName 1410: 3b 0d 0a 09 4c 50 53 45 52 56 49 43 45 5f 4d 41 ;...LPSERVICE_MA 1420: 49 4e 5f 46 55 4e 43 54 49 4f 4e 41 20 6c 70 53 IN_FUNCTIONA lpS 1430: 65 72 76 69 63 65 50 72 6f 63 3b 0d 0a 7d 0d 0a erviceProc;..}.. 1440: 61 6c 69 61 73 20 53 45 52 56 49 43 45 5f 54 41 alias SERVICE_TA 1450: 42 4c 45 5f 45 4e 54 52 59 41 2a 20 4c 50 53 45 BLE_ENTRYA* LPSE 1460: 52 56 49 43 45 5f 54 41 42 4c 45 5f 45 4e 54 52 RVICE_TABLE_ENTR 1470: 59 41 3b 0d 0a 0d 0a 73 74 72 75 63 74 20 53 45 YA;....struct SE 1480: 52 56 49 43 45 5f 54 41 42 4c 45 5f 45 4e 54 52 RVICE_TABLE_ENTR 1490: 59 57 20 7b 0d 0a 09 4c 50 57 53 54 52 20 20 20 YW {...LPWSTR 14a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 14b0: 6c 70 53 65 72 76 69 63 65 4e 61 6d 65 3b 0d 0a lpServiceName;.. 14c0: 09 4c 50 53 45 52 56 49 43 45 5f 4d 41 49 4e 5f .LPSERVICE_MAIN_ 14d0: 46 55 4e 43 54 49 4f 4e 57 20 6c 70 53 65 72 76 FUNCTIONW lpServ 14e0: 69 63 65 50 72 6f 63 3b 0d 0a 7d 0d 0a 61 6c 69 iceProc;..}..ali 14f0: 61 73 20 53 45 52 56 49 43 45 5f 54 41 42 4c 45 as SERVICE_TABLE 1500: 5f 45 4e 54 52 59 57 2a 20 4c 50 53 45 52 56 49 _ENTRYW* LPSERVI 1510: 43 45 5f 54 41 42 4c 45 5f 45 4e 54 52 59 57 3b CE_TABLE_ENTRYW; 1520: 0d 0a 0d 0a 6d 69 78 69 6e 20 44 45 43 4c 41 52 ....mixin DECLAR 1530: 45 5f 48 41 4e 44 4c 45 21 28 22 53 43 5f 48 41 E_HANDLE!("SC_HA 1540: 4e 44 4c 45 22 29 3b 0d 0a 61 6c 69 61 73 20 53 NDLE");..alias S 1550: 43 5f 48 41 4e 44 4c 45 2a 20 4c 50 53 43 5f 48 C_HANDLE* LPSC_H 1560: 41 4e 44 4c 45 3b 0d 0a 61 6c 69 61 73 20 76 6f ANDLE;..alias vo 1570: 69 64 2a 20 53 43 5f 4c 4f 43 4b 3b 0d 0a 6d 69 id* SC_LOCK;..mi 1580: 78 69 6e 20 44 45 43 4c 41 52 45 5f 48 41 4e 44 xin DECLARE_HAND 1590: 4c 45 21 28 22 53 45 52 56 49 43 45 5f 53 54 41 LE!("SERVICE_STA 15a0: 54 55 53 5f 48 41 4e 44 4c 45 22 29 3b 0d 0a 0d TUS_HANDLE");... 15b0: 0a 65 78 74 65 72 6e 20 28 57 69 6e 64 6f 77 73 .extern (Windows 15c0: 29 20 7b 0d 0a 09 61 6c 69 61 73 20 76 6f 69 64 ) {...alias void 15d0: 20 66 75 6e 63 74 69 6f 6e 28 44 57 4f 52 44 29 function(DWORD) 15e0: 20 4c 50 48 41 4e 44 4c 45 52 5f 46 55 4e 43 54 LPHANDLER_FUNCT 15f0: 49 4f 4e 3b 0d 0a 09 61 6c 69 61 73 20 44 57 4f ION;...alias DWO 1600: 52 44 20 66 75 6e 63 74 69 6f 6e 28 44 57 4f 52 RD function(DWOR 1610: 44 2c 20 44 57 4f 52 44 2c 20 4c 50 56 4f 49 44 D, DWORD, LPVOID 1620: 2c 20 4c 50 56 4f 49 44 29 20 4c 50 48 41 4e 44 , LPVOID) LPHAND 1630: 4c 45 52 5f 46 55 4e 43 54 49 4f 4e 5f 45 58 3b LER_FUNCTION_EX; 1640: 0d 0a 7d 0d 0a 0d 0a 73 74 61 74 69 63 20 69 66 ..}....static if 1650: 20 28 5f 57 49 4e 33 32 5f 57 49 4e 4e 54 20 3e (_WIN32_WINNT > 1660: 3d 20 30 78 35 30 30 29 20 7b 0d 0a 09 73 74 72 = 0x500) {...str 1670: 75 63 74 20 53 45 52 56 49 43 45 5f 53 54 41 54 uct SERVICE_STAT 1680: 55 53 5f 50 52 4f 43 45 53 53 20 7b 0d 0a 09 09 US_PROCESS {.... 1690: 44 57 4f 52 44 20 64 77 53 65 72 76 69 63 65 54 DWORD dwServiceT 16a0: 79 70 65 3b 0d 0a 09 09 44 57 4f 52 44 20 64 77 ype;....DWORD dw 16b0: 43 75 72 72 65 6e 74 53 74 61 74 65 3b 0d 0a 09 CurrentState;... 16c0: 09 44 57 4f 52 44 20 64 77 43 6f 6e 74 72 6f 6c .DWORD dwControl 16d0: 73 41 63 63 65 70 74 65 64 3b 0d 0a 09 09 44 57 sAccepted;....DW 16e0: 4f 52 44 20 64 77 57 69 6e 33 32 45 78 69 74 43 ORD dwWin32ExitC 16f0: 6f 64 65 3b 0d 0a 09 09 44 57 4f 52 44 20 64 77 ode;....DWORD dw 1700: 53 65 72 76 69 63 65 53 70 65 63 69 66 69 63 45 ServiceSpecificE 1710: 78 69 74 43 6f 64 65 3b 0d 0a 09 09 44 57 4f 52 xitCode;....DWOR 1720: 44 20 64 77 43 68 65 63 6b 50 6f 69 6e 74 3b 0d D dwCheckPoint;. 1730: 0a 09 09 44 57 4f 52 44 20 64 77 57 61 69 74 48 ...DWORD dwWaitH 1740: 69 6e 74 3b 0d 0a 09 09 44 57 4f 52 44 20 64 77 int;....DWORD dw 1750: 50 72 6f 63 65 73 73 49 64 3b 0d 0a 09 09 44 57 ProcessId;....DW 1760: 4f 52 44 20 64 77 53 65 72 76 69 63 65 46 6c 61 ORD dwServiceFla 1770: 67 73 3b 0d 0a 09 7d 0d 0a 09 61 6c 69 61 73 20 gs;...}...alias 1780: 53 45 52 56 49 43 45 5f 53 54 41 54 55 53 5f 50 SERVICE_STATUS_P 1790: 52 4f 43 45 53 53 2a 20 4c 50 53 45 52 56 49 43 ROCESS* LPSERVIC 17a0: 45 5f 53 54 41 54 55 53 5f 50 52 4f 43 45 53 53 E_STATUS_PROCESS 17b0: 3b 0d 0a 0d 0a 09 65 6e 75 6d 20 53 43 5f 53 54 ;.....enum SC_ST 17c0: 41 54 55 53 5f 54 59 50 45 20 7b 0d 0a 09 09 53 ATUS_TYPE {....S 17d0: 43 5f 53 54 41 54 55 53 5f 50 52 4f 43 45 53 53 C_STATUS_PROCESS 17e0: 5f 49 4e 46 4f 20 3d 20 30 0d 0a 09 7d 0d 0a 0d _INFO = 0...}... 17f0: 0a 09 65 6e 75 6d 20 53 43 5f 45 4e 55 4d 5f 54 ..enum SC_ENUM_T 1800: 59 50 45 20 7b 0d 0a 09 09 53 43 5f 45 4e 55 4d YPE {....SC_ENUM 1810: 5f 50 52 4f 43 45 53 53 5f 49 4e 46 4f 20 3d 20 _PROCESS_INFO = 1820: 30 0d 0a 09 7d 0d 0a 0d 0a 09 73 74 72 75 63 74 0...}.....struct 1830: 20 45 4e 55 4d 5f 53 45 52 56 49 43 45 5f 53 54 ENUM_SERVICE_ST 1840: 41 54 55 53 5f 50 52 4f 43 45 53 53 41 20 7b 0d ATUS_PROCESSA {. 1850: 0a 09 09 4c 50 53 54 52 20 20 20 20 20 20 20 20 ...LPSTR 1860: 20 20 20 20 20 20 20 20 20 20 6c 70 53 65 72 76 lpServ 1870: 69 63 65 4e 61 6d 65 3b 0d 0a 09 09 4c 50 53 54 iceName;....LPST 1880: 52 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 R 1890: 20 20 20 6c 70 44 69 73 70 6c 61 79 4e 61 6d 65 lpDisplayName 18a0: 3b 0d 0a 09 09 53 45 52 56 49 43 45 5f 53 54 41 ;....SERVICE_STA 18b0: 54 55 53 5f 50 52 4f 43 45 53 53 20 53 65 72 76 TUS_PROCESS Serv 18c0: 69 63 65 53 74 61 74 75 73 50 72 6f 63 65 73 73 iceStatusProcess 18d0: 3b 0d 0a 09 7d 0d 0a 09 61 6c 69 61 73 20 45 4e ;...}...alias EN 18e0: 55 4d 5f 53 45 52 56 49 43 45 5f 53 54 41 54 55 UM_SERVICE_STATU 18f0: 53 5f 50 52 4f 43 45 53 53 41 2a 20 4c 50 45 4e S_PROCESSA* LPEN 1900: 55 4d 5f 53 45 52 56 49 43 45 5f 53 54 41 54 55 UM_SERVICE_STATU 1910: 53 5f 50 52 4f 43 45 53 53 41 3b 0d 0a 0d 0a 09 S_PROCESSA;..... 1920: 73 74 72 75 63 74 20 45 4e 55 4d 5f 53 45 52 56 struct ENUM_SERV 1930: 49 43 45 5f 53 54 41 54 55 53 5f 50 52 4f 43 45 ICE_STATUS_PROCE 1940: 53 53 57 20 7b 0d 0a 09 09 4c 50 57 53 54 52 20 SSW {....LPWSTR 1950: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 1960: 6c 70 53 65 72 76 69 63 65 4e 61 6d 65 3b 0d 0a lpServiceName;.. 1970: 09 09 4c 50 57 53 54 52 20 20 20 20 20 20 20 20 ..LPWSTR 1980: 20 20 20 20 20 20 20 20 20 6c 70 44 69 73 70 6c lpDispl 1990: 61 79 4e 61 6d 65 3b 0d 0a 09 09 53 45 52 56 49 ayName;....SERVI 19a0: 43 45 5f 53 54 41 54 55 53 5f 50 52 4f 43 45 53 CE_STATUS_PROCES 19b0: 53 20 53 65 72 76 69 63 65 53 74 61 74 75 73 50 S ServiceStatusP 19c0: 72 6f 63 65 73 73 3b 0d 0a 09 7d 0d 0a 09 61 6c rocess;...}...al 19d0: 69 61 73 20 45 4e 55 4d 5f 53 45 52 56 49 43 45 ias ENUM_SERVICE 19e0: 5f 53 54 41 54 55 53 5f 50 52 4f 43 45 53 53 57 _STATUS_PROCESSW 19f0: 2a 20 4c 50 45 4e 55 4d 5f 53 45 52 56 49 43 45 * LPENUM_SERVICE 1a00: 5f 53 54 41 54 55 53 5f 50 52 4f 43 45 53 53 57 _STATUS_PROCESSW 1a10: 3b 0d 0a 0d 0a 09 73 74 72 75 63 74 20 53 45 52 ;.....struct SER 1a20: 56 49 43 45 5f 44 45 53 43 52 49 50 54 49 4f 4e VICE_DESCRIPTION 1a30: 41 20 7b 0d 0a 09 09 4c 50 53 54 52 20 6c 70 44 A {....LPSTR lpD 1a40: 65 73 63 72 69 70 74 69 6f 6e 3b 0d 0a 09 7d 0d escription;...}. 1a50: 0a 09 61 6c 69 61 73 20 53 45 52 56 49 43 45 5f ..alias SERVICE_ 1a60: 44 45 53 43 52 49 50 54 49 4f 4e 41 2a 20 4c 50 DESCRIPTIONA* LP 1a70: 53 45 52 56 49 43 45 5f 44 45 53 43 52 49 50 54 SERVICE_DESCRIPT 1a80: 49 4f 4e 41 3b 0d 0a 0d 0a 09 73 74 72 75 63 74 IONA;.....struct 1a90: 20 53 45 52 56 49 43 45 5f 44 45 53 43 52 49 50 SERVICE_DESCRIP 1aa0: 54 49 4f 4e 57 20 7b 0d 0a 09 09 4c 50 57 53 54 TIONW {....LPWST 1ab0: 52 20 6c 70 44 65 73 63 72 69 70 74 69 6f 6e 3b R lpDescription; 1ac0: 0d 0a 09 7d 0d 0a 09 61 6c 69 61 73 20 53 45 52 ...}...alias SER 1ad0: 56 49 43 45 5f 44 45 53 43 52 49 50 54 49 4f 4e VICE_DESCRIPTION 1ae0: 57 2a 20 4c 50 53 45 52 56 49 43 45 5f 44 45 53 W* LPSERVICE_DES 1af0: 43 52 49 50 54 49 4f 4e 57 3b 0d 0a 0d 0a 09 65 CRIPTIONW;.....e 1b00: 6e 75 6d 20 53 43 5f 41 43 54 49 4f 4e 5f 54 59 num SC_ACTION_TY 1b10: 50 45 20 7b 0d 0a 09 09 53 43 5f 41 43 54 49 4f PE {....SC_ACTIO 1b20: 4e 5f 4e 4f 4e 45 2c 0d 0a 09 09 53 43 5f 41 43 N_NONE,....SC_AC 1b30: 54 49 4f 4e 5f 52 45 53 54 41 52 54 2c 0d 0a 09 TION_RESTART,... 1b40: 09 53 43 5f 41 43 54 49 4f 4e 5f 52 45 42 4f 4f .SC_ACTION_REBOO 1b50: 54 2c 0d 0a 09 09 53 43 5f 41 43 54 49 4f 4e 5f T,....SC_ACTION_ 1b60: 52 55 4e 5f 43 4f 4d 4d 41 4e 44 0d 0a 09 7d 0d RUN_COMMAND...}. 1b70: 0a 0d 0a 09 73 74 72 75 63 74 20 53 43 5f 41 43 ....struct SC_AC 1b80: 54 49 4f 4e 20 7b 0d 0a 09 09 53 43 5f 41 43 54 TION {....SC_ACT 1b90: 49 4f 4e 5f 54 59 50 45 20 54 79 70 65 3b 0d 0a ION_TYPE Type;.. 1ba0: 09 09 44 57 4f 52 44 20 20 20 20 20 20 20 20 20 ..DWORD 1bb0: 20 44 65 6c 61 79 3b 0d 0a 09 7d 0d 0a 09 61 6c Delay;...}...al 1bc0: 69 61 73 20 53 43 5f 41 43 54 49 4f 4e 2a 20 4c ias SC_ACTION* L 1bd0: 50 53 43 5f 41 43 54 49 4f 4e 3b 0d 0a 0d 0a 09 PSC_ACTION;..... 1be0: 73 74 72 75 63 74 20 53 45 52 56 49 43 45 5f 46 struct SERVICE_F 1bf0: 41 49 4c 55 52 45 5f 41 43 54 49 4f 4e 53 41 20 AILURE_ACTIONSA 1c00: 7b 0d 0a 09 09 44 57 4f 52 44 20 20 20 20 20 20 {....DWORD 1c10: 64 77 52 65 73 65 74 50 65 72 69 6f 64 3b 0d 0a dwResetPeriod;.. 1c20: 09 09 4c 50 53 54 52 20 20 20 20 20 20 6c 70 52 ..LPSTR lpR 1c30: 65 62 6f 6f 74 4d 73 67 3b 0d 0a 09 09 4c 50 53 ebootMsg;....LPS 1c40: 54 52 20 20 20 20 20 20 6c 70 43 6f 6d 6d 61 6e TR lpComman 1c50: 64 3b 0d 0a 09 09 44 57 4f 52 44 20 20 20 20 20 d;....DWORD 1c60: 20 63 41 63 74 69 6f 6e 73 3b 0d 0a 09 09 53 43 cActions;....SC 1c70: 5f 41 43 54 49 4f 4e 2a 20 6c 70 73 61 41 63 74 _ACTION* lpsaAct 1c80: 69 6f 6e 73 3b 0d 0a 09 7d 0d 0a 09 61 6c 69 61 ions;...}...alia 1c90: 73 20 53 45 52 56 49 43 45 5f 46 41 49 4c 55 52 s SERVICE_FAILUR 1ca0: 45 5f 41 43 54 49 4f 4e 53 41 2a 20 4c 50 53 45 E_ACTIONSA* LPSE 1cb0: 52 56 49 43 45 5f 46 41 49 4c 55 52 45 5f 41 43 RVICE_FAILURE_AC 1cc0: 54 49 4f 4e 53 41 3b 0d 0a 0d 0a 09 73 74 72 75 TIONSA;.....stru 1cd0: 63 74 20 53 45 52 56 49 43 45 5f 46 41 49 4c 55 ct SERVICE_FAILU 1ce0: 52 45 5f 41 43 54 49 4f 4e 53 57 20 7b 0d 0a 09 RE_ACTIONSW {... 1cf0: 09 44 57 4f 52 44 20 20 20 20 20 20 64 77 52 65 .DWORD dwRe 1d00: 73 65 74 50 65 72 69 6f 64 3b 0d 0a 09 09 4c 50 setPeriod;....LP 1d10: 57 53 54 52 20 20 20 20 20 6c 70 52 65 62 6f 6f WSTR lpReboo 1d20: 74 4d 73 67 3b 0d 0a 09 09 4c 50 57 53 54 52 20 tMsg;....LPWSTR 1d30: 20 20 20 20 6c 70 43 6f 6d 6d 61 6e 64 3b 0d 0a lpCommand;.. 1d40: 09 09 44 57 4f 52 44 20 20 20 20 20 20 63 41 63 ..DWORD cAc 1d50: 74 69 6f 6e 73 3b 0d 0a 09 09 53 43 5f 41 43 54 tions;....SC_ACT 1d60: 49 4f 4e 2a 20 6c 70 73 61 41 63 74 69 6f 6e 73 ION* lpsaActions 1d70: 3b 0d 0a 09 7d 0d 0a 09 61 6c 69 61 73 20 53 45 ;...}...alias SE 1d80: 52 56 49 43 45 5f 46 41 49 4c 55 52 45 5f 41 43 RVICE_FAILURE_AC 1d90: 54 49 4f 4e 53 57 2a 20 4c 50 53 45 52 56 49 43 TIONSW* LPSERVIC 1da0: 45 5f 46 41 49 4c 55 52 45 5f 41 43 54 49 4f 4e E_FAILURE_ACTION 1db0: 53 57 3b 0d 0a 7d 0d 0a 0d 0a 65 78 74 65 72 6e SW;..}....extern 1dc0: 20 28 57 69 6e 64 6f 77 73 29 20 7b 0d 0a 09 42 (Windows) {...B 1dd0: 4f 4f 4c 20 43 68 61 6e 67 65 53 65 72 76 69 63 OOL ChangeServic 1de0: 65 43 6f 6e 66 69 67 41 28 53 43 5f 48 41 4e 44 eConfigA(SC_HAND 1df0: 4c 45 2c 20 44 57 4f 52 44 2c 20 44 57 4f 52 44 LE, DWORD, DWORD 1e00: 2c 20 44 57 4f 52 44 2c 20 4c 50 43 53 54 52 2c , DWORD, LPCSTR, 1e10: 0d 0a 09 20 20 4c 50 43 53 54 52 2c 20 4c 50 44 ... LPCSTR, LPD 1e20: 57 4f 52 44 2c 20 4c 50 43 53 54 52 2c 20 4c 50 WORD, LPCSTR, LP 1e30: 43 53 54 52 2c 20 4c 50 43 53 54 52 2c 20 4c 50 CSTR, LPCSTR, LP 1e40: 43 53 54 52 29 3b 0d 0a 09 42 4f 4f 4c 20 43 68 CSTR);...BOOL Ch 1e50: 61 6e 67 65 53 65 72 76 69 63 65 43 6f 6e 66 69 angeServiceConfi 1e60: 67 57 28 53 43 5f 48 41 4e 44 4c 45 2c 20 44 57 gW(SC_HANDLE, DW 1e70: 4f 52 44 2c 20 44 57 4f 52 44 2c 20 44 57 4f 52 ORD, DWORD, DWOR 1e80: 44 2c 20 4c 50 43 57 53 54 52 2c 0d 0a 09 20 20 D, LPCWSTR,... 1e90: 4c 50 43 57 53 54 52 2c 20 4c 50 44 57 4f 52 44 LPCWSTR, LPDWORD 1ea0: 2c 20 4c 50 43 57 53 54 52 2c 20 4c 50 43 57 53 , LPCWSTR, LPCWS 1eb0: 54 52 2c 20 4c 50 43 57 53 54 52 2c 20 4c 50 43 TR, LPCWSTR, LPC 1ec0: 57 53 54 52 29 3b 0d 0a 09 42 4f 4f 4c 20 43 6c WSTR);...BOOL Cl 1ed0: 6f 73 65 53 65 72 76 69 63 65 48 61 6e 64 6c 65 oseServiceHandle 1ee0: 28 53 43 5f 48 41 4e 44 4c 45 29 3b 0d 0a 09 42 (SC_HANDLE);...B 1ef0: 4f 4f 4c 20 43 6f 6e 74 72 6f 6c 53 65 72 76 69 OOL ControlServi 1f00: 63 65 28 53 43 5f 48 41 4e 44 4c 45 2c 20 44 57 ce(SC_HANDLE, DW 1f10: 4f 52 44 2c 20 4c 50 53 45 52 56 49 43 45 5f 53 ORD, LPSERVICE_S 1f20: 54 41 54 55 53 29 3b 0d 0a 09 53 43 5f 48 41 4e TATUS);...SC_HAN 1f30: 44 4c 45 20 43 72 65 61 74 65 53 65 72 76 69 63 DLE CreateServic 1f40: 65 41 28 53 43 5f 48 41 4e 44 4c 45 2c 20 4c 50 eA(SC_HANDLE, LP 1f50: 43 53 54 52 2c 20 4c 50 43 53 54 52 2c 20 44 57 CSTR, LPCSTR, DW 1f60: 4f 52 44 2c 20 44 57 4f 52 44 2c 0d 0a 09 20 20 ORD, DWORD,... 1f70: 44 57 4f 52 44 2c 20 44 57 4f 52 44 2c 20 4c 50 DWORD, DWORD, LP 1f80: 43 53 54 52 2c 20 4c 50 43 53 54 52 2c 20 50 44 CSTR, LPCSTR, PD 1f90: 57 4f 52 44 2c 20 4c 50 43 53 54 52 2c 20 4c 50 WORD, LPCSTR, LP 1fa0: 43 53 54 52 2c 20 4c 50 43 53 54 52 29 3b 0d 0a CSTR, LPCSTR);.. 1fb0: 09 53 43 5f 48 41 4e 44 4c 45 20 43 72 65 61 74 .SC_HANDLE Creat 1fc0: 65 53 65 72 76 69 63 65 57 28 53 43 5f 48 41 4e eServiceW(SC_HAN 1fd0: 44 4c 45 2c 20 4c 50 43 57 53 54 52 2c 20 4c 50 DLE, LPCWSTR, LP 1fe0: 43 57 53 54 52 2c 20 44 57 4f 52 44 2c 20 44 57 CWSTR, DWORD, DW 1ff0: 4f 52 44 2c 0d 0a 09 20 20 44 57 4f 52 44 2c 20 ORD,... DWORD, 2000: 44 57 4f 52 44 2c 20 4c 50 43 57 53 54 52 2c 20 DWORD, LPCWSTR, 2010: 4c 50 43 57 53 54 52 2c 20 50 44 57 4f 52 44 2c LPCWSTR, PDWORD, 2020: 20 4c 50 43 57 53 54 52 2c 20 4c 50 43 57 53 54 LPCWSTR, LPCWST 2030: 52 2c 20 4c 50 43 57 53 54 52 29 3b 0d 0a 09 42 R, LPCWSTR);...B 2040: 4f 4f 4c 20 44 65 6c 65 74 65 53 65 72 76 69 63 OOL DeleteServic 2050: 65 28 53 43 5f 48 41 4e 44 4c 45 29 3b 0d 0a 09 e(SC_HANDLE);... 2060: 42 4f 4f 4c 20 45 6e 75 6d 44 65 70 65 6e 64 65 BOOL EnumDepende 2070: 6e 74 53 65 72 76 69 63 65 73 41 28 53 43 5f 48 ntServicesA(SC_H 2080: 41 4e 44 4c 45 2c 20 44 57 4f 52 44 2c 20 4c 50 ANDLE, DWORD, LP 2090: 45 4e 55 4d 5f 53 45 52 56 49 43 45 5f 53 54 41 ENUM_SERVICE_STA 20a0: 54 55 53 41 2c 0d 0a 09 20 20 44 57 4f 52 44 2c TUSA,... DWORD, 20b0: 20 50 44 57 4f 52 44 2c 20 50 44 57 4f 52 44 29 PDWORD, PDWORD) 20c0: 3b 0d 0a 09 42 4f 4f 4c 20 45 6e 75 6d 44 65 70 ;...BOOL EnumDep 20d0: 65 6e 64 65 6e 74 53 65 72 76 69 63 65 73 57 28 endentServicesW( 20e0: 53 43 5f 48 41 4e 44 4c 45 2c 20 44 57 4f 52 44 SC_HANDLE, DWORD 20f0: 2c 20 4c 50 45 4e 55 4d 5f 53 45 52 56 49 43 45 , LPENUM_SERVICE 2100: 5f 53 54 41 54 55 53 57 2c 0d 0a 09 20 20 44 57 _STATUSW,... DW 2110: 4f 52 44 2c 20 50 44 57 4f 52 44 2c 20 50 44 57 ORD, PDWORD, PDW 2120: 4f 52 44 29 3b 0d 0a 09 42 4f 4f 4c 20 45 6e 75 ORD);...BOOL Enu 2130: 6d 53 65 72 76 69 63 65 73 53 74 61 74 75 73 41 mServicesStatusA 2140: 28 53 43 5f 48 41 4e 44 4c 45 2c 20 44 57 4f 52 (SC_HANDLE, DWOR 2150: 44 2c 20 44 57 4f 52 44 2c 20 4c 50 45 4e 55 4d D, DWORD, LPENUM 2160: 5f 53 45 52 56 49 43 45 5f 53 54 41 54 55 53 41 _SERVICE_STATUSA 2170: 2c 0d 0a 09 20 20 44 57 4f 52 44 2c 20 50 44 57 ,... DWORD, PDW 2180: 4f 52 44 2c 20 50 44 57 4f 52 44 2c 20 50 44 57 ORD, PDWORD, PDW 2190: 4f 52 44 29 3b 0d 0a 09 42 4f 4f 4c 20 45 6e 75 ORD);...BOOL Enu 21a0: 6d 53 65 72 76 69 63 65 73 53 74 61 74 75 73 57 mServicesStatusW 21b0: 28 53 43 5f 48 41 4e 44 4c 45 2c 20 44 57 4f 52 (SC_HANDLE, DWOR 21c0: 44 2c 20 44 57 4f 52 44 2c 20 4c 50 45 4e 55 4d D, DWORD, LPENUM 21d0: 5f 53 45 52 56 49 43 45 5f 53 54 41 54 55 53 57 _SERVICE_STATUSW 21e0: 2c 0d 0a 09 20 20 44 57 4f 52 44 2c 20 50 44 57 ,... DWORD, PDW 21f0: 4f 52 44 2c 20 50 44 57 4f 52 44 2c 20 50 44 57 ORD, PDWORD, PDW 2200: 4f 52 44 29 3b 0d 0a 09 42 4f 4f 4c 20 47 65 74 ORD);...BOOL Get 2210: 53 65 72 76 69 63 65 44 69 73 70 6c 61 79 4e 61 ServiceDisplayNa 2220: 6d 65 41 28 53 43 5f 48 41 4e 44 4c 45 2c 20 4c meA(SC_HANDLE, L 2230: 50 43 53 54 52 2c 20 4c 50 53 54 52 2c 20 50 44 PCSTR, LPSTR, PD 2240: 57 4f 52 44 29 3b 0d 0a 09 42 4f 4f 4c 20 47 65 WORD);...BOOL Ge 2250: 74 53 65 72 76 69 63 65 44 69 73 70 6c 61 79 4e tServiceDisplayN 2260: 61 6d 65 57 28 53 43 5f 48 41 4e 44 4c 45 2c 20 ameW(SC_HANDLE, 2270: 4c 50 43 57 53 54 52 2c 20 4c 50 57 53 54 52 2c LPCWSTR, LPWSTR, 2280: 20 50 44 57 4f 52 44 29 3b 0d 0a 09 42 4f 4f 4c PDWORD);...BOOL 2290: 20 47 65 74 53 65 72 76 69 63 65 4b 65 79 4e 61 GetServiceKeyNa 22a0: 6d 65 41 28 53 43 5f 48 41 4e 44 4c 45 2c 20 4c meA(SC_HANDLE, L 22b0: 50 43 53 54 52 2c 20 4c 50 53 54 52 2c 20 50 44 PCSTR, LPSTR, PD 22c0: 57 4f 52 44 29 3b 0d 0a 09 42 4f 4f 4c 20 47 65 WORD);...BOOL Ge 22d0: 74 53 65 72 76 69 63 65 4b 65 79 4e 61 6d 65 57 tServiceKeyNameW 22e0: 28 53 43 5f 48 41 4e 44 4c 45 2c 20 4c 50 43 57 (SC_HANDLE, LPCW 22f0: 53 54 52 2c 20 4c 50 57 53 54 52 2c 20 50 44 57 STR, LPWSTR, PDW 2300: 4f 52 44 29 3b 0d 0a 09 53 43 5f 4c 4f 43 4b 20 ORD);...SC_LOCK 2310: 4c 6f 63 6b 53 65 72 76 69 63 65 44 61 74 61 62 LockServiceDatab 2320: 61 73 65 28 53 43 5f 48 41 4e 44 4c 45 29 3b 0d ase(SC_HANDLE);. 2330: 0a 09 42 4f 4f 4c 20 4e 6f 74 69 66 79 42 6f 6f ..BOOL NotifyBoo 2340: 74 43 6f 6e 66 69 67 53 74 61 74 75 73 28 42 4f tConfigStatus(BO 2350: 4f 4c 29 3b 0d 0a 09 53 43 5f 48 41 4e 44 4c 45 OL);...SC_HANDLE 2360: 20 4f 70 65 6e 53 43 4d 61 6e 61 67 65 72 41 28 OpenSCManagerA( 2370: 4c 50 43 53 54 52 2c 20 4c 50 43 53 54 52 2c 20 LPCSTR, LPCSTR, 2380: 44 57 4f 52 44 29 3b 0d 0a 09 53 43 5f 48 41 4e DWORD);...SC_HAN 2390: 44 4c 45 20 4f 70 65 6e 53 43 4d 61 6e 61 67 65 DLE OpenSCManage 23a0: 72 57 28 4c 50 43 57 53 54 52 2c 20 4c 50 43 57 rW(LPCWSTR, LPCW 23b0: 53 54 52 2c 20 44 57 4f 52 44 29 3b 0d 0a 09 53 STR, DWORD);...S 23c0: 43 5f 48 41 4e 44 4c 45 20 4f 70 65 6e 53 65 72 C_HANDLE OpenSer 23d0: 76 69 63 65 41 28 53 43 5f 48 41 4e 44 4c 45 2c viceA(SC_HANDLE, 23e0: 20 4c 50 43 53 54 52 2c 20 44 57 4f 52 44 29 3b LPCSTR, DWORD); 23f0: 0d 0a 09 53 43 5f 48 41 4e 44 4c 45 20 4f 70 65 ...SC_HANDLE Ope 2400: 6e 53 65 72 76 69 63 65 57 28 53 43 5f 48 41 4e nServiceW(SC_HAN 2410: 44 4c 45 2c 20 4c 50 43 57 53 54 52 2c 20 44 57 DLE, LPCWSTR, DW 2420: 4f 52 44 29 3b 0d 0a 09 42 4f 4f 4c 20 51 75 65 ORD);...BOOL Que 2430: 72 79 53 65 72 76 69 63 65 43 6f 6e 66 69 67 41 ryServiceConfigA 2440: 28 53 43 5f 48 41 4e 44 4c 45 2c 20 4c 50 51 55 (SC_HANDLE, LPQU 2450: 45 52 59 5f 53 45 52 56 49 43 45 5f 43 4f 4e 46 ERY_SERVICE_CONF 2460: 49 47 41 2c 20 44 57 4f 52 44 2c 0d 0a 09 20 20 IGA, DWORD,... 2470: 50 44 57 4f 52 44 29 3b 0d 0a 09 42 4f 4f 4c 20 PDWORD);...BOOL 2480: 51 75 65 72 79 53 65 72 76 69 63 65 43 6f 6e 66 QueryServiceConf 2490: 69 67 57 28 53 43 5f 48 41 4e 44 4c 45 2c 20 4c igW(SC_HANDLE, L 24a0: 50 51 55 45 52 59 5f 53 45 52 56 49 43 45 5f 43 PQUERY_SERVICE_C 24b0: 4f 4e 46 49 47 57 2c 20 44 57 4f 52 44 2c 0d 0a ONFIGW, DWORD,.. 24c0: 09 20 20 50 44 57 4f 52 44 29 3b 0d 0a 09 42 4f . PDWORD);...BO 24d0: 4f 4c 20 51 75 65 72 79 53 65 72 76 69 63 65 4c OL QueryServiceL 24e0: 6f 63 6b 53 74 61 74 75 73 41 28 53 43 5f 48 41 ockStatusA(SC_HA 24f0: 4e 44 4c 45 2c 20 4c 50 51 55 45 52 59 5f 53 45 NDLE, LPQUERY_SE 2500: 52 56 49 43 45 5f 4c 4f 43 4b 5f 53 54 41 54 55 RVICE_LOCK_STATU 2510: 53 41 2c 0d 0a 09 20 20 44 57 4f 52 44 2c 20 50 SA,... DWORD, P 2520: 44 57 4f 52 44 29 3b 0d 0a 09 42 4f 4f 4c 20 51 DWORD);...BOOL Q 2530: 75 65 72 79 53 65 72 76 69 63 65 4c 6f 63 6b 53 ueryServiceLockS 2540: 74 61 74 75 73 57 28 53 43 5f 48 41 4e 44 4c 45 tatusW(SC_HANDLE 2550: 2c 20 4c 50 51 55 45 52 59 5f 53 45 52 56 49 43 , LPQUERY_SERVIC 2560: 45 5f 4c 4f 43 4b 5f 53 54 41 54 55 53 57 2c 0d E_LOCK_STATUSW,. 2570: 0a 09 20 20 44 57 4f 52 44 2c 20 50 44 57 4f 52 .. DWORD, PDWOR 2580: 44 29 3b 0d 0a 09 42 4f 4f 4c 20 51 75 65 72 79 D);...BOOL Query 2590: 53 65 72 76 69 63 65 4f 62 6a 65 63 74 53 65 63 ServiceObjectSec 25a0: 75 72 69 74 79 28 53 43 5f 48 41 4e 44 4c 45 2c urity(SC_HANDLE, 25b0: 20 53 45 43 55 52 49 54 59 5f 49 4e 46 4f 52 4d SECURITY_INFORM 25c0: 41 54 49 4f 4e 2c 0d 0a 09 20 20 50 53 45 43 55 ATION,... PSECU 25d0: 52 49 54 59 5f 44 45 53 43 52 49 50 54 4f 52 2c RITY_DESCRIPTOR, 25e0: 20 44 57 4f 52 44 2c 20 4c 50 44 57 4f 52 44 29 DWORD, LPDWORD) 25f0: 3b 0d 0a 09 42 4f 4f 4c 20 51 75 65 72 79 53 65 ;...BOOL QuerySe 2600: 72 76 69 63 65 53 74 61 74 75 73 28 53 43 5f 48 rviceStatus(SC_H 2610: 41 4e 44 4c 45 2c 20 4c 50 53 45 52 56 49 43 45 ANDLE, LPSERVICE 2620: 5f 53 54 41 54 55 53 29 3b 0d 0a 09 53 45 52 56 _STATUS);...SERV 2630: 49 43 45 5f 53 54 41 54 55 53 5f 48 41 4e 44 4c ICE_STATUS_HANDL 2640: 45 20 52 65 67 69 73 74 65 72 53 65 72 76 69 63 E RegisterServic 2650: 65 43 74 72 6c 48 61 6e 64 6c 65 72 41 28 4c 50 eCtrlHandlerA(LP 2660: 43 53 54 52 2c 0d 0a 09 20 20 4c 50 48 41 4e 44 CSTR,... LPHAND 2670: 4c 45 52 5f 46 55 4e 43 54 49 4f 4e 29 3b 0d 0a LER_FUNCTION);.. 2680: 09 53 45 52 56 49 43 45 5f 53 54 41 54 55 53 5f .SERVICE_STATUS_ 2690: 48 41 4e 44 4c 45 20 52 65 67 69 73 74 65 72 53 HANDLE RegisterS 26a0: 65 72 76 69 63 65 43 74 72 6c 48 61 6e 64 6c 65 erviceCtrlHandle 26b0: 72 57 28 4c 50 43 57 53 54 52 2c 0d 0a 09 20 20 rW(LPCWSTR,... 26c0: 4c 50 48 41 4e 44 4c 45 52 5f 46 55 4e 43 54 49 LPHANDLER_FUNCTI 26d0: 4f 4e 29 3b 0d 0a 09 42 4f 4f 4c 20 53 65 74 53 ON);...BOOL SetS 26e0: 65 72 76 69 63 65 4f 62 6a 65 63 74 53 65 63 75 erviceObjectSecu 26f0: 72 69 74 79 28 53 43 5f 48 41 4e 44 4c 45 2c 20 rity(SC_HANDLE, 2700: 53 45 43 55 52 49 54 59 5f 49 4e 46 4f 52 4d 41 SECURITY_INFORMA 2710: 54 49 4f 4e 2c 0d 0a 09 20 20 50 53 45 43 55 52 TION,... PSECUR 2720: 49 54 59 5f 44 45 53 43 52 49 50 54 4f 52 29 3b ITY_DESCRIPTOR); 2730: 0d 0a 09 42 4f 4f 4c 20 53 65 74 53 65 72 76 69 ...BOOL SetServi 2740: 63 65 53 74 61 74 75 73 28 53 45 52 56 49 43 45 ceStatus(SERVICE 2750: 5f 53 54 41 54 55 53 5f 48 41 4e 44 4c 45 2c 20 _STATUS_HANDLE, 2760: 4c 50 53 45 52 56 49 43 45 5f 53 54 41 54 55 53 LPSERVICE_STATUS 2770: 29 3b 0d 0a 09 42 4f 4f 4c 20 53 74 61 72 74 53 );...BOOL StartS 2780: 65 72 76 69 63 65 41 28 53 43 5f 48 41 4e 44 4c erviceA(SC_HANDL 2790: 45 2c 20 44 57 4f 52 44 2c 20 4c 50 43 53 54 52 E, DWORD, LPCSTR 27a0: 2a 29 3b 0d 0a 09 42 4f 4f 4c 20 53 74 61 72 74 *);...BOOL Start 27b0: 53 65 72 76 69 63 65 57 28 53 43 5f 48 41 4e 44 ServiceW(SC_HAND 27c0: 4c 45 2c 20 44 57 4f 52 44 2c 20 4c 50 43 57 53 LE, DWORD, LPCWS 27d0: 54 52 2a 29 3b 0d 0a 09 42 4f 4f 4c 20 53 74 61 TR*);...BOOL Sta 27e0: 72 74 53 65 72 76 69 63 65 43 74 72 6c 44 69 73 rtServiceCtrlDis 27f0: 70 61 74 63 68 65 72 41 28 4c 50 53 45 52 56 49 patcherA(LPSERVI 2800: 43 45 5f 54 41 42 4c 45 5f 45 4e 54 52 59 41 29 CE_TABLE_ENTRYA) 2810: 3b 0d 0a 09 42 4f 4f 4c 20 53 74 61 72 74 53 65 ;...BOOL StartSe 2820: 72 76 69 63 65 43 74 72 6c 44 69 73 70 61 74 63 rviceCtrlDispatc 2830: 68 65 72 57 28 4c 50 53 45 52 56 49 43 45 5f 54 herW(LPSERVICE_T 2840: 41 42 4c 45 5f 45 4e 54 52 59 57 29 3b 0d 0a 09 ABLE_ENTRYW);... 2850: 42 4f 4f 4c 20 55 6e 6c 6f 63 6b 53 65 72 76 69 BOOL UnlockServi 2860: 63 65 44 61 74 61 62 61 73 65 28 53 43 5f 4c 4f ceDatabase(SC_LO 2870: 43 4b 29 3b 0d 0a 0d 0a 09 73 74 61 74 69 63 20 CK);.....static 2880: 69 66 20 28 5f 57 49 4e 33 32 5f 57 49 4e 4e 54 if (_WIN32_WINNT 2890: 20 3e 3d 20 30 78 35 30 30 29 20 7b 0d 0a 09 09 >= 0x500) {.... 28a0: 42 4f 4f 4c 20 45 6e 75 6d 53 65 72 76 69 63 65 BOOL EnumService 28b0: 73 53 74 61 74 75 73 45 78 41 28 53 43 5f 48 41 sStatusExA(SC_HA 28c0: 4e 44 4c 45 2c 20 53 43 5f 45 4e 55 4d 5f 54 59 NDLE, SC_ENUM_TY 28d0: 50 45 2c 20 44 57 4f 52 44 2c 20 44 57 4f 52 44 PE, DWORD, DWORD 28e0: 2c 20 4c 50 42 59 54 45 2c 0d 0a 09 09 20 20 44 , LPBYTE,.... D 28f0: 57 4f 52 44 2c 20 4c 50 44 57 4f 52 44 2c 20 4c WORD, LPDWORD, L 2900: 50 44 57 4f 52 44 2c 20 4c 50 44 57 4f 52 44 2c PDWORD, LPDWORD, 2910: 20 4c 50 43 53 54 52 29 3b 0d 0a 09 09 42 4f 4f LPCSTR);....BOO 2920: 4c 20 45 6e 75 6d 53 65 72 76 69 63 65 73 53 74 L EnumServicesSt 2930: 61 74 75 73 45 78 57 28 53 43 5f 48 41 4e 44 4c atusExW(SC_HANDL 2940: 45 2c 20 53 43 5f 45 4e 55 4d 5f 54 59 50 45 2c E, SC_ENUM_TYPE, 2950: 20 44 57 4f 52 44 2c 20 44 57 4f 52 44 2c 20 4c DWORD, DWORD, L 2960: 50 42 59 54 45 2c 0d 0a 09 09 20 20 44 57 4f 52 PBYTE,.... DWOR 2970: 44 2c 20 4c 50 44 57 4f 52 44 2c 20 4c 50 44 57 D, LPDWORD, LPDW 2980: 4f 52 44 2c 20 4c 50 44 57 4f 52 44 2c 20 4c 50 ORD, LPDWORD, LP 2990: 43 57 53 54 52 29 3b 0d 0a 09 09 42 4f 4f 4c 20 CWSTR);....BOOL 29a0: 51 75 65 72 79 53 65 72 76 69 63 65 43 6f 6e 66 QueryServiceConf 29b0: 69 67 32 41 28 53 43 5f 48 41 4e 44 4c 45 2c 20 ig2A(SC_HANDLE, 29c0: 44 57 4f 52 44 2c 20 4c 50 42 59 54 45 2c 20 44 DWORD, LPBYTE, D 29d0: 57 4f 52 44 2c 20 4c 50 44 57 4f 52 44 29 3b 0d WORD, LPDWORD);. 29e0: 0a 09 09 42 4f 4f 4c 20 51 75 65 72 79 53 65 72 ...BOOL QuerySer 29f0: 76 69 63 65 43 6f 6e 66 69 67 32 57 28 53 43 5f viceConfig2W(SC_ 2a00: 48 41 4e 44 4c 45 2c 20 44 57 4f 52 44 2c 20 4c HANDLE, DWORD, L 2a10: 50 42 59 54 45 2c 20 44 57 4f 52 44 2c 20 4c 50 PBYTE, DWORD, LP 2a20: 44 57 4f 52 44 29 3b 0d 0a 09 09 42 4f 4f 4c 20 DWORD);....BOOL 2a30: 51 75 65 72 79 53 65 72 76 69 63 65 53 74 61 74 QueryServiceStat 2a40: 75 73 45 78 28 53 43 5f 48 41 4e 44 4c 45 2c 20 usEx(SC_HANDLE, 2a50: 53 43 5f 53 54 41 54 55 53 5f 54 59 50 45 2c 20 SC_STATUS_TYPE, 2a60: 4c 50 42 59 54 45 2c 20 44 57 4f 52 44 2c 0d 0a LPBYTE, DWORD,.. 2a70: 09 09 20 20 4c 50 44 57 4f 52 44 29 3b 0d 0a 09 .. LPDWORD);... 2a80: 09 53 45 52 56 49 43 45 5f 53 54 41 54 55 53 5f .SERVICE_STATUS_ 2a90: 48 41 4e 44 4c 45 20 52 65 67 69 73 74 65 72 53 HANDLE RegisterS 2aa0: 65 72 76 69 63 65 43 74 72 6c 48 61 6e 64 6c 65 erviceCtrlHandle 2ab0: 72 45 78 41 28 4c 50 43 53 54 52 2c 0d 0a 09 09 rExA(LPCSTR,.... 2ac0: 20 20 4c 50 48 41 4e 44 4c 45 52 5f 46 55 4e 43 LPHANDLER_FUNC 2ad0: 54 49 4f 4e 5f 45 58 2c 20 4c 50 56 4f 49 44 29 TION_EX, LPVOID) 2ae0: 3b 0d 0a 09 09 53 45 52 56 49 43 45 5f 53 54 41 ;....SERVICE_STA 2af0: 54 55 53 5f 48 41 4e 44 4c 45 20 52 65 67 69 73 TUS_HANDLE Regis 2b00: 74 65 72 53 65 72 76 69 63 65 43 74 72 6c 48 61 terServiceCtrlHa 2b10: 6e 64 6c 65 72 45 78 57 28 4c 50 43 57 53 54 52 ndlerExW(LPCWSTR 2b20: 2c 0d 0a 09 09 20 20 4c 50 48 41 4e 44 4c 45 52 ,.... LPHANDLER 2b30: 5f 46 55 4e 43 54 49 4f 4e 5f 45 58 2c 20 4c 50 _FUNCTION_EX, LP 2b40: 56 4f 49 44 29 3b 0d 0a 09 7d 0d 0a 0d 0a 09 73 VOID);...}.....s 2b50: 74 61 74 69 63 20 69 66 20 28 5f 57 49 4e 33 32 tatic if (_WIN32 2b60: 5f 57 49 4e 4e 54 20 3e 3d 20 30 78 35 30 31 29 _WINNT >= 0x501) 2b70: 20 7b 0d 0a 09 09 42 4f 4f 4c 20 43 68 61 6e 67 {....BOOL Chang 2b80: 65 53 65 72 76 69 63 65 43 6f 6e 66 69 67 32 41 eServiceConfig2A 2b90: 28 53 43 5f 48 41 4e 44 4c 45 2c 20 44 57 4f 52 (SC_HANDLE, DWOR 2ba0: 44 2c 20 4c 50 56 4f 49 44 29 3b 0d 0a 09 09 42 D, LPVOID);....B 2bb0: 4f 4f 4c 20 43 68 61 6e 67 65 53 65 72 76 69 63 OOL ChangeServic 2bc0: 65 43 6f 6e 66 69 67 32 57 28 53 43 5f 48 41 4e eConfig2W(SC_HAN 2bd0: 44 4c 45 2c 20 44 57 4f 52 44 2c 20 4c 50 56 4f DLE, DWORD, LPVO 2be0: 49 44 29 3b 0d 0a 09 7d 0d 0a 7d 0d 0a 0d 0a 76 ID);...}..}....v 2bf0: 65 72 73 69 6f 6e 20 28 55 6e 69 63 6f 64 65 29 ersion (Unicode) 2c00: 20 7b 0d 0a 09 61 6c 69 61 73 20 45 4e 55 4d 5f {...alias ENUM_ 2c10: 53 45 52 56 49 43 45 5f 53 54 41 54 55 53 57 20 SERVICE_STATUSW 2c20: 45 4e 55 4d 5f 53 45 52 56 49 43 45 5f 53 54 41 ENUM_SERVICE_STA 2c30: 54 55 53 3b 0d 0a 09 61 6c 69 61 73 20 51 55 45 TUS;...alias QUE 2c40: 52 59 5f 53 45 52 56 49 43 45 5f 43 4f 4e 46 49 RY_SERVICE_CONFI 2c50: 47 57 20 51 55 45 52 59 5f 53 45 52 56 49 43 45 GW QUERY_SERVICE 2c60: 5f 43 4f 4e 46 49 47 3b 0d 0a 09 61 6c 69 61 73 _CONFIG;...alias 2c70: 20 51 55 45 52 59 5f 53 45 52 56 49 43 45 5f 4c QUERY_SERVICE_L 2c80: 4f 43 4b 5f 53 54 41 54 55 53 57 20 51 55 45 52 OCK_STATUSW QUER 2c90: 59 5f 53 45 52 56 49 43 45 5f 4c 4f 43 4b 5f 53 Y_SERVICE_LOCK_S 2ca0: 54 41 54 55 53 3b 0d 0a 09 61 6c 69 61 73 20 4c TATUS;...alias L 2cb0: 50 53 45 52 56 49 43 45 5f 4d 41 49 4e 5f 46 55 PSERVICE_MAIN_FU 2cc0: 4e 43 54 49 4f 4e 57 20 4c 50 53 45 52 56 49 43 NCTIONW LPSERVIC 2cd0: 45 5f 4d 41 49 4e 5f 46 55 4e 43 54 49 4f 4e 3b E_MAIN_FUNCTION; 2ce0: 0d 0a 09 61 6c 69 61 73 20 53 45 52 56 49 43 45 ...alias SERVICE 2cf0: 5f 54 41 42 4c 45 5f 45 4e 54 52 59 57 20 53 45 _TABLE_ENTRYW SE 2d00: 52 56 49 43 45 5f 54 41 42 4c 45 5f 45 4e 54 52 RVICE_TABLE_ENTR 2d10: 59 3b 0d 0a 09 61 6c 69 61 73 20 43 68 61 6e 67 Y;...alias Chang 2d20: 65 53 65 72 76 69 63 65 43 6f 6e 66 69 67 57 20 eServiceConfigW 2d30: 43 68 61 6e 67 65 53 65 72 76 69 63 65 43 6f 6e ChangeServiceCon 2d40: 66 69 67 3b 0d 0a 09 61 6c 69 61 73 20 43 72 65 fig;...alias Cre 2d50: 61 74 65 53 65 72 76 69 63 65 57 20 43 72 65 61 ateServiceW Crea 2d60: 74 65 53 65 72 76 69 63 65 3b 0d 0a 09 61 6c 69 teService;...ali 2d70: 61 73 20 45 6e 75 6d 44 65 70 65 6e 64 65 6e 74 as EnumDependent 2d80: 53 65 72 76 69 63 65 73 57 20 45 6e 75 6d 44 65 ServicesW EnumDe 2d90: 70 65 6e 64 65 6e 74 53 65 72 76 69 63 65 73 3b pendentServices; 2da0: 0d 0a 09 61 6c 69 61 73 20 45 6e 75 6d 53 65 72 ...alias EnumSer 2db0: 76 69 63 65 73 53 74 61 74 75 73 57 20 45 6e 75 vicesStatusW Enu 2dc0: 6d 53 65 72 76 69 63 65 73 53 74 61 74 75 73 3b mServicesStatus; 2dd0: 0d 0a 09 61 6c 69 61 73 20 47 65 74 53 65 72 76 ...alias GetServ 2de0: 69 63 65 44 69 73 70 6c 61 79 4e 61 6d 65 57 20 iceDisplayNameW 2df0: 47 65 74 53 65 72 76 69 63 65 44 69 73 70 6c 61 GetServiceDispla 2e00: 79 4e 61 6d 65 3b 0d 0a 09 61 6c 69 61 73 20 47 yName;...alias G 2e10: 65 74 53 65 72 76 69 63 65 4b 65 79 4e 61 6d 65 etServiceKeyName 2e20: 57 20 47 65 74 53 65 72 76 69 63 65 4b 65 79 4e W GetServiceKeyN 2e30: 61 6d 65 3b 0d 0a 09 61 6c 69 61 73 20 4f 70 65 ame;...alias Ope 2e40: 6e 53 43 4d 61 6e 61 67 65 72 57 20 4f 70 65 6e nSCManagerW Open 2e50: 53 43 4d 61 6e 61 67 65 72 3b 0d 0a 09 61 6c 69 SCManager;...ali 2e60: 61 73 20 4f 70 65 6e 53 65 72 76 69 63 65 57 20 as OpenServiceW 2e70: 4f 70 65 6e 53 65 72 76 69 63 65 3b 0d 0a 09 61 OpenService;...a 2e80: 6c 69 61 73 20 51 75 65 72 79 53 65 72 76 69 63 lias QueryServic 2e90: 65 43 6f 6e 66 69 67 57 20 51 75 65 72 79 53 65 eConfigW QuerySe 2ea0: 72 76 69 63 65 43 6f 6e 66 69 67 3b 0d 0a 09 61 rviceConfig;...a 2eb0: 6c 69 61 73 20 51 75 65 72 79 53 65 72 76 69 63 lias QueryServic 2ec0: 65 4c 6f 63 6b 53 74 61 74 75 73 57 20 51 75 65 eLockStatusW Que 2ed0: 72 79 53 65 72 76 69 63 65 4c 6f 63 6b 53 74 61 ryServiceLockSta 2ee0: 74 75 73 3b 0d 0a 09 61 6c 69 61 73 20 52 65 67 tus;...alias Reg 2ef0: 69 73 74 65 72 53 65 72 76 69 63 65 43 74 72 6c isterServiceCtrl 2f00: 48 61 6e 64 6c 65 72 57 20 52 65 67 69 73 74 65 HandlerW Registe 2f10: 72 53 65 72 76 69 63 65 43 74 72 6c 48 61 6e 64 rServiceCtrlHand 2f20: 6c 65 72 3b 0d 0a 09 61 6c 69 61 73 20 53 74 61 ler;...alias Sta 2f30: 72 74 53 65 72 76 69 63 65 57 20 53 74 61 72 74 rtServiceW Start 2f40: 53 65 72 76 69 63 65 3b 0d 0a 09 61 6c 69 61 73 Service;...alias 2f50: 20 53 74 61 72 74 53 65 72 76 69 63 65 43 74 72 StartServiceCtr 2f60: 6c 44 69 73 70 61 74 63 68 65 72 57 20 53 74 61 lDispatcherW Sta 2f70: 72 74 53 65 72 76 69 63 65 43 74 72 6c 44 69 73 rtServiceCtrlDis 2f80: 70 61 74 63 68 65 72 3b 0d 0a 0d 0a 09 73 74 61 patcher;.....sta 2f90: 74 69 63 20 69 66 20 28 5f 57 49 4e 33 32 5f 57 tic if (_WIN32_W 2fa0: 49 4e 4e 54 20 3e 3d 20 30 78 35 30 30 29 20 7b INNT >= 0x500) { 2fb0: 0d 0a 09 09 61 6c 69 61 73 20 45 4e 55 4d 5f 53 ....alias ENUM_S 2fc0: 45 52 56 49 43 45 5f 53 54 41 54 55 53 5f 50 52 ERVICE_STATUS_PR 2fd0: 4f 43 45 53 53 57 20 45 4e 55 4d 5f 53 45 52 56 OCESSW ENUM_SERV 2fe0: 49 43 45 5f 53 54 41 54 55 53 5f 50 52 4f 43 45 ICE_STATUS_PROCE 2ff0: 53 53 3b 0d 0a 09 09 61 6c 69 61 73 20 53 45 52 SS;....alias SER 3000: 56 49 43 45 5f 44 45 53 43 52 49 50 54 49 4f 4e VICE_DESCRIPTION 3010: 57 20 53 45 52 56 49 43 45 5f 44 45 53 43 52 49 W SERVICE_DESCRI 3020: 50 54 49 4f 4e 3b 0d 0a 09 09 61 6c 69 61 73 20 PTION;....alias 3030: 53 45 52 56 49 43 45 5f 46 41 49 4c 55 52 45 5f SERVICE_FAILURE_ 3040: 41 43 54 49 4f 4e 53 57 20 53 45 52 56 49 43 45 ACTIONSW SERVICE 3050: 5f 46 41 49 4c 55 52 45 5f 41 43 54 49 4f 4e 53 _FAILURE_ACTIONS 3060: 3b 0d 0a 09 09 61 6c 69 61 73 20 45 6e 75 6d 53 ;....alias EnumS 3070: 65 72 76 69 63 65 73 53 74 61 74 75 73 45 78 57 ervicesStatusExW 3080: 20 45 6e 75 6d 53 65 72 76 69 63 65 73 53 74 61 EnumServicesSta 3090: 74 75 73 45 78 3b 0d 0a 09 09 61 6c 69 61 73 20 tusEx;....alias 30a0: 51 75 65 72 79 53 65 72 76 69 63 65 43 6f 6e 66 QueryServiceConf 30b0: 69 67 32 57 20 51 75 65 72 79 53 65 72 76 69 63 ig2W QueryServic 30c0: 65 43 6f 6e 66 69 67 32 3b 0d 0a 09 09 61 6c 69 eConfig2;....ali 30d0: 61 73 20 52 65 67 69 73 74 65 72 53 65 72 76 69 as RegisterServi 30e0: 63 65 43 74 72 6c 48 61 6e 64 6c 65 72 45 78 57 ceCtrlHandlerExW 30f0: 20 52 65 67 69 73 74 65 72 53 65 72 76 69 63 65 RegisterService 3100: 43 74 72 6c 48 61 6e 64 6c 65 72 45 78 3b 0d 0a CtrlHandlerEx;.. 3110: 09 7d 0d 0a 0d 0a 09 73 74 61 74 69 63 20 69 66 .}.....static if 3120: 20 28 5f 57 49 4e 33 32 5f 57 49 4e 4e 54 20 3e (_WIN32_WINNT > 3130: 3d 20 30 78 35 30 31 29 20 7b 0d 0a 09 09 61 6c = 0x501) {....al 3140: 69 61 73 20 43 68 61 6e 67 65 53 65 72 76 69 63 ias ChangeServic 3150: 65 43 6f 6e 66 69 67 32 57 20 43 68 61 6e 67 65 eConfig2W Change 3160: 53 65 72 76 69 63 65 43 6f 6e 66 69 67 32 3b 0d ServiceConfig2;. 3170: 0a 09 7d 0d 0a 0d 0a 7d 20 65 6c 73 65 20 7b 0d ..}....} else {. 3180: 0a 09 61 6c 69 61 73 20 45 4e 55 4d 5f 53 45 52 ..alias ENUM_SER 3190: 56 49 43 45 5f 53 54 41 54 55 53 41 20 45 4e 55 VICE_STATUSA ENU 31a0: 4d 5f 53 45 52 56 49 43 45 5f 53 54 41 54 55 53 M_SERVICE_STATUS 31b0: 3b 0d 0a 09 61 6c 69 61 73 20 51 55 45 52 59 5f ;...alias QUERY_ 31c0: 53 45 52 56 49 43 45 5f 43 4f 4e 46 49 47 41 20 SERVICE_CONFIGA 31d0: 51 55 45 52 59 5f 53 45 52 56 49 43 45 5f 43 4f QUERY_SERVICE_CO 31e0: 4e 46 49 47 3b 0d 0a 09 61 6c 69 61 73 20 51 55 NFIG;...alias QU 31f0: 45 52 59 5f 53 45 52 56 49 43 45 5f 4c 4f 43 4b ERY_SERVICE_LOCK 3200: 5f 53 54 41 54 55 53 41 20 51 55 45 52 59 5f 53 _STATUSA QUERY_S 3210: 45 52 56 49 43 45 5f 4c 4f 43 4b 5f 53 54 41 54 ERVICE_LOCK_STAT 3220: 55 53 3b 0d 0a 09 61 6c 69 61 73 20 4c 50 53 45 US;...alias LPSE 3230: 52 56 49 43 45 5f 4d 41 49 4e 5f 46 55 4e 43 54 RVICE_MAIN_FUNCT 3240: 49 4f 4e 41 20 4c 50 53 45 52 56 49 43 45 5f 4d IONA LPSERVICE_M 3250: 41 49 4e 5f 46 55 4e 43 54 49 4f 4e 3b 0d 0a 09 AIN_FUNCTION;... 3260: 61 6c 69 61 73 20 53 45 52 56 49 43 45 5f 54 41 alias SERVICE_TA 3270: 42 4c 45 5f 45 4e 54 52 59 41 20 53 45 52 56 49 BLE_ENTRYA SERVI 3280: 43 45 5f 54 41 42 4c 45 5f 45 4e 54 52 59 3b 0d CE_TABLE_ENTRY;. 3290: 0a 09 61 6c 69 61 73 20 43 68 61 6e 67 65 53 65 ..alias ChangeSe 32a0: 72 76 69 63 65 43 6f 6e 66 69 67 41 20 43 68 61 rviceConfigA Cha 32b0: 6e 67 65 53 65 72 76 69 63 65 43 6f 6e 66 69 67 ngeServiceConfig 32c0: 3b 0d 0a 09 61 6c 69 61 73 20 43 72 65 61 74 65 ;...alias Create 32d0: 53 65 72 76 69 63 65 41 20 43 72 65 61 74 65 53 ServiceA CreateS 32e0: 65 72 76 69 63 65 3b 0d 0a 09 61 6c 69 61 73 20 ervice;...alias 32f0: 45 6e 75 6d 44 65 70 65 6e 64 65 6e 74 53 65 72 EnumDependentSer 3300: 76 69 63 65 73 41 20 45 6e 75 6d 44 65 70 65 6e vicesA EnumDepen 3310: 64 65 6e 74 53 65 72 76 69 63 65 73 3b 0d 0a 09 dentServices;... 3320: 61 6c 69 61 73 20 45 6e 75 6d 53 65 72 76 69 63 alias EnumServic 3330: 65 73 53 74 61 74 75 73 41 20 45 6e 75 6d 53 65 esStatusA EnumSe 3340: 72 76 69 63 65 73 53 74 61 74 75 73 3b 0d 0a 09 rvicesStatus;... 3350: 61 6c 69 61 73 20 47 65 74 53 65 72 76 69 63 65 alias GetService 3360: 44 69 73 70 6c 61 79 4e 61 6d 65 41 20 47 65 74 DisplayNameA Get 3370: 53 65 72 76 69 63 65 44 69 73 70 6c 61 79 4e 61 ServiceDisplayNa 3380: 6d 65 3b 0d 0a 09 61 6c 69 61 73 20 47 65 74 53 me;...alias GetS 3390: 65 72 76 69 63 65 4b 65 79 4e 61 6d 65 41 20 47 erviceKeyNameA G 33a0: 65 74 53 65 72 76 69 63 65 4b 65 79 4e 61 6d 65 etServiceKeyName 33b0: 3b 0d 0a 09 61 6c 69 61 73 20 4f 70 65 6e 53 43 ;...alias OpenSC 33c0: 4d 61 6e 61 67 65 72 41 20 4f 70 65 6e 53 43 4d ManagerA OpenSCM 33d0: 61 6e 61 67 65 72 3b 0d 0a 09 61 6c 69 61 73 20 anager;...alias 33e0: 4f 70 65 6e 53 65 72 76 69 63 65 41 20 4f 70 65 OpenServiceA Ope 33f0: 6e 53 65 72 76 69 63 65 3b 0d 0a 09 61 6c 69 61 nService;...alia 3400: 73 20 51 75 65 72 79 53 65 72 76 69 63 65 43 6f s QueryServiceCo 3410: 6e 66 69 67 41 20 51 75 65 72 79 53 65 72 76 69 nfigA QueryServi 3420: 63 65 43 6f 6e 66 69 67 3b 0d 0a 09 61 6c 69 61 ceConfig;...alia 3430: 73 20 51 75 65 72 79 53 65 72 76 69 63 65 4c 6f s QueryServiceLo 3440: 63 6b 53 74 61 74 75 73 41 20 51 75 65 72 79 53 ckStatusA QueryS 3450: 65 72 76 69 63 65 4c 6f 63 6b 53 74 61 74 75 73 erviceLockStatus 3460: 3b 0d 0a 09 61 6c 69 61 73 20 52 65 67 69 73 74 ;...alias Regist 3470: 65 72 53 65 72 76 69 63 65 43 74 72 6c 48 61 6e erServiceCtrlHan 3480: 64 6c 65 72 41 20 52 65 67 69 73 74 65 72 53 65 dlerA RegisterSe 3490: 72 76 69 63 65 43 74 72 6c 48 61 6e 64 6c 65 72 rviceCtrlHandler 34a0: 3b 0d 0a 09 61 6c 69 61 73 20 53 74 61 72 74 53 ;...alias StartS 34b0: 65 72 76 69 63 65 41 20 53 74 61 72 74 53 65 72 erviceA StartSer 34c0: 76 69 63 65 3b 0d 0a 09 61 6c 69 61 73 20 53 74 vice;...alias St 34d0: 61 72 74 53 65 72 76 69 63 65 43 74 72 6c 44 69 artServiceCtrlDi 34e0: 73 70 61 74 63 68 65 72 41 20 53 74 61 72 74 53 spatcherA StartS 34f0: 65 72 76 69 63 65 43 74 72 6c 44 69 73 70 61 74 erviceCtrlDispat 3500: 63 68 65 72 3b 0d 0a 0d 0a 09 73 74 61 74 69 63 cher;.....static 3510: 20 69 66 20 28 5f 57 49 4e 33 32 5f 57 49 4e 4e if (_WIN32_WINN 3520: 54 20 3e 3d 20 30 78 35 30 30 29 20 7b 0d 0a 09 T >= 0x500) {... 3530: 09 61 6c 69 61 73 20 45 4e 55 4d 5f 53 45 52 56 .alias ENUM_SERV 3540: 49 43 45 5f 53 54 41 54 55 53 5f 50 52 4f 43 45 ICE_STATUS_PROCE 3550: 53 53 41 20 45 4e 55 4d 5f 53 45 52 56 49 43 45 SSA ENUM_SERVICE 3560: 5f 53 54 41 54 55 53 5f 50 52 4f 43 45 53 53 3b _STATUS_PROCESS; 3570: 0d 0a 09 09 61 6c 69 61 73 20 53 45 52 56 49 43 ....alias SERVIC 3580: 45 5f 44 45 53 43 52 49 50 54 49 4f 4e 41 20 53 E_DESCRIPTIONA S 3590: 45 52 56 49 43 45 5f 44 45 53 43 52 49 50 54 49 ERVICE_DESCRIPTI 35a0: 4f 4e 3b 0d 0a 09 09 61 6c 69 61 73 20 53 45 52 ON;....alias SER 35b0: 56 49 43 45 5f 46 41 49 4c 55 52 45 5f 41 43 54 VICE_FAILURE_ACT 35c0: 49 4f 4e 53 41 20 53 45 52 56 49 43 45 5f 46 41 IONSA SERVICE_FA 35d0: 49 4c 55 52 45 5f 41 43 54 49 4f 4e 53 3b 0d 0a ILURE_ACTIONS;.. 35e0: 09 09 61 6c 69 61 73 20 45 6e 75 6d 53 65 72 76 ..alias EnumServ 35f0: 69 63 65 73 53 74 61 74 75 73 45 78 41 20 45 6e icesStatusExA En 3600: 75 6d 53 65 72 76 69 63 65 73 53 74 61 74 75 73 umServicesStatus 3610: 45 78 3b 0d 0a 09 09 61 6c 69 61 73 20 51 75 65 Ex;....alias Que 3620: 72 79 53 65 72 76 69 63 65 43 6f 6e 66 69 67 32 ryServiceConfig2 3630: 41 20 51 75 65 72 79 53 65 72 76 69 63 65 43 6f A QueryServiceCo 3640: 6e 66 69 67 32 3b 0d 0a 09 09 61 6c 69 61 73 20 nfig2;....alias 3650: 52 65 67 69 73 74 65 72 53 65 72 76 69 63 65 43 RegisterServiceC 3660: 74 72 6c 48 61 6e 64 6c 65 72 45 78 41 20 52 65 trlHandlerExA Re 3670: 67 69 73 74 65 72 53 65 72 76 69 63 65 43 74 72 gisterServiceCtr 3680: 6c 48 61 6e 64 6c 65 72 45 78 3b 0d 0a 09 7d 0d lHandlerEx;...}. 3690: 0a 0d 0a 09 73 74 61 74 69 63 20 69 66 20 28 5f ....static if (_ 36a0: 57 49 4e 33 32 5f 57 49 4e 4e 54 20 3e 3d 20 30 WIN32_WINNT >= 0 36b0: 78 35 30 31 29 20 7b 0d 0a 09 09 61 6c 69 61 73 x501) {....alias 36c0: 20 43 68 61 6e 67 65 53 65 72 76 69 63 65 43 6f ChangeServiceCo 36d0: 6e 66 69 67 32 41 20 43 68 61 6e 67 65 53 65 72 nfig2A ChangeSer 36e0: 76 69 63 65 43 6f 6e 66 69 67 32 3b 0d 0a 09 7d viceConfig2;...} 36f0: 0d 0a 0d 0a 7d 0d 0a 0d 0a 61 6c 69 61 73 20 45 ....}....alias E 3700: 4e 55 4d 5f 53 45 52 56 49 43 45 5f 53 54 41 54 NUM_SERVICE_STAT 3710: 55 53 2a 20 4c 50 45 4e 55 4d 5f 53 45 52 56 49 US* LPENUM_SERVI 3720: 43 45 5f 53 54 41 54 55 53 3b 0d 0a 61 6c 69 61 CE_STATUS;..alia 3730: 73 20 51 55 45 52 59 5f 53 45 52 56 49 43 45 5f s QUERY_SERVICE_ 3740: 43 4f 4e 46 49 47 2a 20 4c 50 51 55 45 52 59 5f CONFIG* LPQUERY_ 3750: 53 45 52 56 49 43 45 5f 43 4f 4e 46 49 47 3b 0d SERVICE_CONFIG;. 3760: 0a 61 6c 69 61 73 20 51 55 45 52 59 5f 53 45 52 .alias QUERY_SER 3770: 56 49 43 45 5f 4c 4f 43 4b 5f 53 54 41 54 55 53 VICE_LOCK_STATUS 3780: 2a 20 4c 50 51 55 45 52 59 5f 53 45 52 56 49 43 * LPQUERY_SERVIC 3790: 45 5f 4c 4f 43 4b 5f 53 54 41 54 55 53 3b 0d 0a E_LOCK_STATUS;.. 37a0: 61 6c 69 61 73 20 53 45 52 56 49 43 45 5f 54 41 alias SERVICE_TA 37b0: 42 4c 45 5f 45 4e 54 52 59 2a 20 4c 50 53 45 52 BLE_ENTRY* LPSER 37c0: 56 49 43 45 5f 54 41 42 4c 45 5f 45 4e 54 52 59 VICE_TABLE_ENTRY 37d0: 3b 0d 0a 0d 0a 73 74 61 74 69 63 20 69 66 20 28 ;....static if ( 37e0: 5f 57 49 4e 33 32 5f 57 49 4e 4e 54 20 3e 3d 20 _WIN32_WINNT >= 37f0: 30 78 35 30 30 29 20 7b 0d 0a 09 61 6c 69 61 73 0x500) {...alias 3800: 20 45 4e 55 4d 5f 53 45 52 56 49 43 45 5f 53 54 ENUM_SERVICE_ST 3810: 41 54 55 53 5f 50 52 4f 43 45 53 53 2a 20 4c 50 ATUS_PROCESS* LP 3820: 45 4e 55 4d 5f 53 45 52 56 49 43 45 5f 53 54 41 ENUM_SERVICE_STA 3830: 54 55 53 5f 50 52 4f 43 45 53 53 3b 0d 0a 09 61 TUS_PROCESS;...a 3840: 6c 69 61 73 20 53 45 52 56 49 43 45 5f 44 45 53 lias SERVICE_DES 3850: 43 52 49 50 54 49 4f 4e 2a 20 4c 50 53 45 52 56 CRIPTION* LPSERV 3860: 49 43 45 5f 44 45 53 43 52 49 50 54 49 4f 4e 3b ICE_DESCRIPTION; 3870: 0d 0a 09 61 6c 69 61 73 20 53 45 52 56 49 43 45 ...alias SERVICE 3880: 5f 46 41 49 4c 55 52 45 5f 41 43 54 49 4f 4e 53 _FAILURE_ACTIONS 3890: 2a 20 4c 50 53 45 52 56 49 43 45 5f 46 41 49 4c * LPSERVICE_FAIL 38a0: 55 52 45 5f 41 43 54 49 4f 4e 53 3b 0d 0a 7d 0d URE_ACTIONS;..}. 38b0: 0a .