Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1006 lines
26 KiB

  1. /*++ BUILD Version: 0010 // Increment this if a change has global effects
  2. Copyright (c) 1995-1998 Microsoft Corporation
  3. Module Name:
  4. winsvc.h
  5. Abstract:
  6. Header file for the Service Control Manager
  7. Environment:
  8. User Mode - Win32
  9. --*/
  10. #ifndef _WINSVC_
  11. #define _WINSVC_
  12. //
  13. // Define API decoration for direct importing of DLL references.
  14. //
  15. #if !defined(WINADVAPI)
  16. #if !defined(_ADVAPI32_)
  17. #define WINADVAPI DECLSPEC_IMPORT
  18. #else
  19. #define WINADVAPI
  20. #endif
  21. #endif
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. //
  26. // Constants
  27. //
  28. //
  29. // Service database names
  30. //
  31. #define SERVICES_ACTIVE_DATABASEW L"ServicesActive"
  32. #define SERVICES_FAILED_DATABASEW L"ServicesFailed"
  33. #define SERVICES_ACTIVE_DATABASEA "ServicesActive"
  34. #define SERVICES_FAILED_DATABASEA "ServicesFailed"
  35. //
  36. // Character to designate that a name is a group
  37. //
  38. #define SC_GROUP_IDENTIFIERW L'+'
  39. #define SC_GROUP_IDENTIFIERA '+'
  40. #ifdef UNICODE
  41. #define SERVICES_ACTIVE_DATABASE SERVICES_ACTIVE_DATABASEW
  42. #define SERVICES_FAILED_DATABASE SERVICES_FAILED_DATABASEW
  43. #define SC_GROUP_IDENTIFIER SC_GROUP_IDENTIFIERW
  44. #else // ndef UNICODE
  45. #define SERVICES_ACTIVE_DATABASE SERVICES_ACTIVE_DATABASEA
  46. #define SERVICES_FAILED_DATABASE SERVICES_FAILED_DATABASEA
  47. #define SC_GROUP_IDENTIFIER SC_GROUP_IDENTIFIERA
  48. #endif // ndef UNICODE
  49. //
  50. // Value to indicate no change to an optional parameter
  51. //
  52. #define SERVICE_NO_CHANGE 0xffffffff
  53. //
  54. // Service State -- for Enum Requests (Bit Mask)
  55. //
  56. #define SERVICE_ACTIVE 0x00000001
  57. #define SERVICE_INACTIVE 0x00000002
  58. #define SERVICE_STATE_ALL (SERVICE_ACTIVE | \
  59. SERVICE_INACTIVE)
  60. //
  61. // Controls
  62. //
  63. #define SERVICE_CONTROL_STOP 0x00000001
  64. #define SERVICE_CONTROL_PAUSE 0x00000002
  65. #define SERVICE_CONTROL_CONTINUE 0x00000003
  66. #define SERVICE_CONTROL_INTERROGATE 0x00000004
  67. #define SERVICE_CONTROL_SHUTDOWN 0x00000005
  68. #define SERVICE_CONTROL_PARAMCHANGE 0x00000006
  69. #define SERVICE_CONTROL_NETBINDADD 0x00000007
  70. #define SERVICE_CONTROL_NETBINDREMOVE 0x00000008
  71. #define SERVICE_CONTROL_NETBINDENABLE 0x00000009
  72. #define SERVICE_CONTROL_NETBINDDISABLE 0x0000000A
  73. #define SERVICE_CONTROL_DEVICEEVENT 0x0000000B
  74. #define SERVICE_CONTROL_HARDWAREPROFILECHANGE 0x0000000C
  75. #define SERVICE_CONTROL_POWEREVENT 0x0000000D
  76. #define SERVICE_CONTROL_SESSIONCHANGE 0x0000000E
  77. //
  78. // Service State -- for CurrentState
  79. //
  80. #define SERVICE_STOPPED 0x00000001
  81. #define SERVICE_START_PENDING 0x00000002
  82. #define SERVICE_STOP_PENDING 0x00000003
  83. #define SERVICE_RUNNING 0x00000004
  84. #define SERVICE_CONTINUE_PENDING 0x00000005
  85. #define SERVICE_PAUSE_PENDING 0x00000006
  86. #define SERVICE_PAUSED 0x00000007
  87. //
  88. // Controls Accepted (Bit Mask)
  89. //
  90. #define SERVICE_ACCEPT_STOP 0x00000001
  91. #define SERVICE_ACCEPT_PAUSE_CONTINUE 0x00000002
  92. #define SERVICE_ACCEPT_SHUTDOWN 0x00000004
  93. #define SERVICE_ACCEPT_PARAMCHANGE 0x00000008
  94. #define SERVICE_ACCEPT_NETBINDCHANGE 0x00000010
  95. #define SERVICE_ACCEPT_HARDWAREPROFILECHANGE 0x00000020
  96. #define SERVICE_ACCEPT_POWEREVENT 0x00000040
  97. #define SERVICE_ACCEPT_SESSIONCHANGE 0x00000080
  98. //
  99. // Service Control Manager object specific access types
  100. //
  101. #define SC_MANAGER_CONNECT 0x0001
  102. #define SC_MANAGER_CREATE_SERVICE 0x0002
  103. #define SC_MANAGER_ENUMERATE_SERVICE 0x0004
  104. #define SC_MANAGER_LOCK 0x0008
  105. #define SC_MANAGER_QUERY_LOCK_STATUS 0x0010
  106. #define SC_MANAGER_MODIFY_BOOT_CONFIG 0x0020
  107. #define SC_MANAGER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | \
  108. SC_MANAGER_CONNECT | \
  109. SC_MANAGER_CREATE_SERVICE | \
  110. SC_MANAGER_ENUMERATE_SERVICE | \
  111. SC_MANAGER_LOCK | \
  112. SC_MANAGER_QUERY_LOCK_STATUS | \
  113. SC_MANAGER_MODIFY_BOOT_CONFIG)
  114. //
  115. // Service object specific access type
  116. //
  117. #define SERVICE_QUERY_CONFIG 0x0001
  118. #define SERVICE_CHANGE_CONFIG 0x0002
  119. #define SERVICE_QUERY_STATUS 0x0004
  120. #define SERVICE_ENUMERATE_DEPENDENTS 0x0008
  121. #define SERVICE_START 0x0010
  122. #define SERVICE_STOP 0x0020
  123. #define SERVICE_PAUSE_CONTINUE 0x0040
  124. #define SERVICE_INTERROGATE 0x0080
  125. #define SERVICE_USER_DEFINED_CONTROL 0x0100
  126. #define SERVICE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | \
  127. SERVICE_QUERY_CONFIG | \
  128. SERVICE_CHANGE_CONFIG | \
  129. SERVICE_QUERY_STATUS | \
  130. SERVICE_ENUMERATE_DEPENDENTS | \
  131. SERVICE_START | \
  132. SERVICE_STOP | \
  133. SERVICE_PAUSE_CONTINUE | \
  134. SERVICE_INTERROGATE | \
  135. SERVICE_USER_DEFINED_CONTROL)
  136. //
  137. // Service flags for QueryServiceStatusEx
  138. //
  139. #define SERVICE_RUNS_IN_SYSTEM_PROCESS 0x00000001
  140. //
  141. // Info levels for ChangeServiceConfig2 and QueryServiceConfig2
  142. //
  143. #define SERVICE_CONFIG_DESCRIPTION 1
  144. #define SERVICE_CONFIG_FAILURE_ACTIONS 2
  145. //
  146. // Service description string
  147. //
  148. typedef struct _SERVICE_DESCRIPTIONA {
  149. LPSTR lpDescription;
  150. } SERVICE_DESCRIPTIONA, *LPSERVICE_DESCRIPTIONA;
  151. //
  152. // Service description string
  153. //
  154. typedef struct _SERVICE_DESCRIPTIONW {
  155. LPWSTR lpDescription;
  156. } SERVICE_DESCRIPTIONW, *LPSERVICE_DESCRIPTIONW;
  157. #ifdef UNICODE
  158. typedef SERVICE_DESCRIPTIONW SERVICE_DESCRIPTION;
  159. typedef LPSERVICE_DESCRIPTIONW LPSERVICE_DESCRIPTION;
  160. #else
  161. typedef SERVICE_DESCRIPTIONA SERVICE_DESCRIPTION;
  162. typedef LPSERVICE_DESCRIPTIONA LPSERVICE_DESCRIPTION;
  163. #endif // UNICODE
  164. //
  165. // Actions to take on service failure
  166. //
  167. typedef enum _SC_ACTION_TYPE {
  168. SC_ACTION_NONE = 0,
  169. SC_ACTION_RESTART = 1,
  170. SC_ACTION_REBOOT = 2,
  171. SC_ACTION_RUN_COMMAND = 3
  172. } SC_ACTION_TYPE;
  173. typedef struct _SC_ACTION {
  174. SC_ACTION_TYPE Type;
  175. DWORD Delay;
  176. } SC_ACTION, *LPSC_ACTION;
  177. typedef struct _SERVICE_FAILURE_ACTIONSA {
  178. DWORD dwResetPeriod;
  179. LPSTR lpRebootMsg;
  180. LPSTR lpCommand;
  181. DWORD cActions;
  182. #ifdef MIDL_PASS
  183. [size_is(cActions)]
  184. #endif
  185. SC_ACTION * lpsaActions;
  186. } SERVICE_FAILURE_ACTIONSA, *LPSERVICE_FAILURE_ACTIONSA;
  187. typedef struct _SERVICE_FAILURE_ACTIONSW {
  188. DWORD dwResetPeriod;
  189. LPWSTR lpRebootMsg;
  190. LPWSTR lpCommand;
  191. DWORD cActions;
  192. #ifdef MIDL_PASS
  193. [size_is(cActions)]
  194. #endif
  195. SC_ACTION * lpsaActions;
  196. } SERVICE_FAILURE_ACTIONSW, *LPSERVICE_FAILURE_ACTIONSW;
  197. #ifdef UNICODE
  198. typedef SERVICE_FAILURE_ACTIONSW SERVICE_FAILURE_ACTIONS;
  199. typedef LPSERVICE_FAILURE_ACTIONSW LPSERVICE_FAILURE_ACTIONS;
  200. #else
  201. typedef SERVICE_FAILURE_ACTIONSA SERVICE_FAILURE_ACTIONS;
  202. typedef LPSERVICE_FAILURE_ACTIONSA LPSERVICE_FAILURE_ACTIONS;
  203. #endif // UNICODE
  204. //
  205. // Handle Types
  206. //
  207. DECLARE_HANDLE(SC_HANDLE);
  208. typedef SC_HANDLE *LPSC_HANDLE;
  209. DECLARE_HANDLE(SERVICE_STATUS_HANDLE);
  210. //
  211. // Info levels for QueryServiceStatusEx
  212. //
  213. typedef enum _SC_STATUS_TYPE {
  214. SC_STATUS_PROCESS_INFO = 0
  215. } SC_STATUS_TYPE;
  216. //
  217. // Info levels for EnumServicesStatusEx
  218. //
  219. typedef enum _SC_ENUM_TYPE {
  220. SC_ENUM_PROCESS_INFO = 0
  221. } SC_ENUM_TYPE;
  222. //
  223. // Service Status Structures
  224. //
  225. typedef struct _SERVICE_STATUS {
  226. DWORD dwServiceType;
  227. DWORD dwCurrentState;
  228. DWORD dwControlsAccepted;
  229. DWORD dwWin32ExitCode;
  230. DWORD dwServiceSpecificExitCode;
  231. DWORD dwCheckPoint;
  232. DWORD dwWaitHint;
  233. } SERVICE_STATUS, *LPSERVICE_STATUS;
  234. typedef struct _SERVICE_STATUS_PROCESS {
  235. DWORD dwServiceType;
  236. DWORD dwCurrentState;
  237. DWORD dwControlsAccepted;
  238. DWORD dwWin32ExitCode;
  239. DWORD dwServiceSpecificExitCode;
  240. DWORD dwCheckPoint;
  241. DWORD dwWaitHint;
  242. DWORD dwProcessId;
  243. DWORD dwServiceFlags;
  244. } SERVICE_STATUS_PROCESS, *LPSERVICE_STATUS_PROCESS;
  245. //
  246. // Service Status Enumeration Structure
  247. //
  248. typedef struct _ENUM_SERVICE_STATUSA {
  249. LPSTR lpServiceName;
  250. LPSTR lpDisplayName;
  251. SERVICE_STATUS ServiceStatus;
  252. } ENUM_SERVICE_STATUSA, *LPENUM_SERVICE_STATUSA;
  253. typedef struct _ENUM_SERVICE_STATUSW {
  254. LPWSTR lpServiceName;
  255. LPWSTR lpDisplayName;
  256. SERVICE_STATUS ServiceStatus;
  257. } ENUM_SERVICE_STATUSW, *LPENUM_SERVICE_STATUSW;
  258. #ifdef UNICODE
  259. typedef ENUM_SERVICE_STATUSW ENUM_SERVICE_STATUS;
  260. typedef LPENUM_SERVICE_STATUSW LPENUM_SERVICE_STATUS;
  261. #else
  262. typedef ENUM_SERVICE_STATUSA ENUM_SERVICE_STATUS;
  263. typedef LPENUM_SERVICE_STATUSA LPENUM_SERVICE_STATUS;
  264. #endif // UNICODE
  265. typedef struct _ENUM_SERVICE_STATUS_PROCESSA {
  266. LPSTR lpServiceName;
  267. LPSTR lpDisplayName;
  268. SERVICE_STATUS_PROCESS ServiceStatusProcess;
  269. } ENUM_SERVICE_STATUS_PROCESSA, *LPENUM_SERVICE_STATUS_PROCESSA;
  270. typedef struct _ENUM_SERVICE_STATUS_PROCESSW {
  271. LPWSTR lpServiceName;
  272. LPWSTR lpDisplayName;
  273. SERVICE_STATUS_PROCESS ServiceStatusProcess;
  274. } ENUM_SERVICE_STATUS_PROCESSW, *LPENUM_SERVICE_STATUS_PROCESSW;
  275. #ifdef UNICODE
  276. typedef ENUM_SERVICE_STATUS_PROCESSW ENUM_SERVICE_STATUS_PROCESS;
  277. typedef LPENUM_SERVICE_STATUS_PROCESSW LPENUM_SERVICE_STATUS_PROCESS;
  278. #else
  279. typedef ENUM_SERVICE_STATUS_PROCESSA ENUM_SERVICE_STATUS_PROCESS;
  280. typedef LPENUM_SERVICE_STATUS_PROCESSA LPENUM_SERVICE_STATUS_PROCESS;
  281. #endif // UNICODE
  282. //
  283. // Structures for the Lock API functions
  284. //
  285. typedef LPVOID SC_LOCK;
  286. typedef struct _QUERY_SERVICE_LOCK_STATUSA {
  287. DWORD fIsLocked;
  288. LPSTR lpLockOwner;
  289. DWORD dwLockDuration;
  290. } QUERY_SERVICE_LOCK_STATUSA, *LPQUERY_SERVICE_LOCK_STATUSA;
  291. typedef struct _QUERY_SERVICE_LOCK_STATUSW {
  292. DWORD fIsLocked;
  293. LPWSTR lpLockOwner;
  294. DWORD dwLockDuration;
  295. } QUERY_SERVICE_LOCK_STATUSW, *LPQUERY_SERVICE_LOCK_STATUSW;
  296. #ifdef UNICODE
  297. typedef QUERY_SERVICE_LOCK_STATUSW QUERY_SERVICE_LOCK_STATUS;
  298. typedef LPQUERY_SERVICE_LOCK_STATUSW LPQUERY_SERVICE_LOCK_STATUS;
  299. #else
  300. typedef QUERY_SERVICE_LOCK_STATUSA QUERY_SERVICE_LOCK_STATUS;
  301. typedef LPQUERY_SERVICE_LOCK_STATUSA LPQUERY_SERVICE_LOCK_STATUS;
  302. #endif // UNICODE
  303. //
  304. // Query Service Configuration Structure
  305. //
  306. typedef struct _QUERY_SERVICE_CONFIGA {
  307. DWORD dwServiceType;
  308. DWORD dwStartType;
  309. DWORD dwErrorControl;
  310. LPSTR lpBinaryPathName;
  311. LPSTR lpLoadOrderGroup;
  312. DWORD dwTagId;
  313. LPSTR lpDependencies;
  314. LPSTR lpServiceStartName;
  315. LPSTR lpDisplayName;
  316. } QUERY_SERVICE_CONFIGA, *LPQUERY_SERVICE_CONFIGA;
  317. typedef struct _QUERY_SERVICE_CONFIGW {
  318. DWORD dwServiceType;
  319. DWORD dwStartType;
  320. DWORD dwErrorControl;
  321. LPWSTR lpBinaryPathName;
  322. LPWSTR lpLoadOrderGroup;
  323. DWORD dwTagId;
  324. LPWSTR lpDependencies;
  325. LPWSTR lpServiceStartName;
  326. LPWSTR lpDisplayName;
  327. } QUERY_SERVICE_CONFIGW, *LPQUERY_SERVICE_CONFIGW;
  328. #ifdef UNICODE
  329. typedef QUERY_SERVICE_CONFIGW QUERY_SERVICE_CONFIG;
  330. typedef LPQUERY_SERVICE_CONFIGW LPQUERY_SERVICE_CONFIG;
  331. #else
  332. typedef QUERY_SERVICE_CONFIGA QUERY_SERVICE_CONFIG;
  333. typedef LPQUERY_SERVICE_CONFIGA LPQUERY_SERVICE_CONFIG;
  334. #endif // UNICODE
  335. //
  336. // Function Prototype for the Service Main Function
  337. //
  338. typedef VOID (WINAPI *LPSERVICE_MAIN_FUNCTIONW)(
  339. DWORD dwNumServicesArgs,
  340. LPWSTR *lpServiceArgVectors
  341. );
  342. typedef VOID (WINAPI *LPSERVICE_MAIN_FUNCTIONA)(
  343. DWORD dwNumServicesArgs,
  344. LPSTR *lpServiceArgVectors
  345. );
  346. #ifdef UNICODE
  347. #define LPSERVICE_MAIN_FUNCTION LPSERVICE_MAIN_FUNCTIONW
  348. #else
  349. #define LPSERVICE_MAIN_FUNCTION LPSERVICE_MAIN_FUNCTIONA
  350. #endif //UNICODE
  351. //
  352. // Service Start Table
  353. //
  354. typedef struct _SERVICE_TABLE_ENTRYA {
  355. LPSTR lpServiceName;
  356. LPSERVICE_MAIN_FUNCTIONA lpServiceProc;
  357. }SERVICE_TABLE_ENTRYA, *LPSERVICE_TABLE_ENTRYA;
  358. typedef struct _SERVICE_TABLE_ENTRYW {
  359. LPWSTR lpServiceName;
  360. LPSERVICE_MAIN_FUNCTIONW lpServiceProc;
  361. }SERVICE_TABLE_ENTRYW, *LPSERVICE_TABLE_ENTRYW;
  362. #ifdef UNICODE
  363. typedef SERVICE_TABLE_ENTRYW SERVICE_TABLE_ENTRY;
  364. typedef LPSERVICE_TABLE_ENTRYW LPSERVICE_TABLE_ENTRY;
  365. #else
  366. typedef SERVICE_TABLE_ENTRYA SERVICE_TABLE_ENTRY;
  367. typedef LPSERVICE_TABLE_ENTRYA LPSERVICE_TABLE_ENTRY;
  368. #endif // UNICODE
  369. //
  370. // Prototype for the Service Control Handler Function
  371. //
  372. typedef VOID (WINAPI *LPHANDLER_FUNCTION)(
  373. DWORD dwControl
  374. );
  375. typedef DWORD (WINAPI *LPHANDLER_FUNCTION_EX)(
  376. DWORD dwControl,
  377. DWORD dwEventType,
  378. LPVOID lpEventData,
  379. LPVOID lpContext
  380. );
  381. ///////////////////////////////////////////////////////////////////////////
  382. // API Function Prototypes
  383. ///////////////////////////////////////////////////////////////////////////
  384. WINADVAPI
  385. BOOL
  386. WINAPI
  387. ChangeServiceConfigA(
  388. SC_HANDLE hService,
  389. DWORD dwServiceType,
  390. DWORD dwStartType,
  391. DWORD dwErrorControl,
  392. LPCSTR lpBinaryPathName,
  393. LPCSTR lpLoadOrderGroup,
  394. LPDWORD lpdwTagId,
  395. LPCSTR lpDependencies,
  396. LPCSTR lpServiceStartName,
  397. LPCSTR lpPassword,
  398. LPCSTR lpDisplayName
  399. );
  400. WINADVAPI
  401. BOOL
  402. WINAPI
  403. ChangeServiceConfigW(
  404. SC_HANDLE hService,
  405. DWORD dwServiceType,
  406. DWORD dwStartType,
  407. DWORD dwErrorControl,
  408. LPCWSTR lpBinaryPathName,
  409. LPCWSTR lpLoadOrderGroup,
  410. LPDWORD lpdwTagId,
  411. LPCWSTR lpDependencies,
  412. LPCWSTR lpServiceStartName,
  413. LPCWSTR lpPassword,
  414. LPCWSTR lpDisplayName
  415. );
  416. #ifdef UNICODE
  417. #define ChangeServiceConfig ChangeServiceConfigW
  418. #else
  419. #define ChangeServiceConfig ChangeServiceConfigA
  420. #endif // !UNICODE
  421. WINADVAPI
  422. BOOL
  423. WINAPI
  424. ChangeServiceConfig2A(
  425. SC_HANDLE hService,
  426. DWORD dwInfoLevel,
  427. LPVOID lpInfo
  428. );
  429. WINADVAPI
  430. BOOL
  431. WINAPI
  432. ChangeServiceConfig2W(
  433. SC_HANDLE hService,
  434. DWORD dwInfoLevel,
  435. LPVOID lpInfo
  436. );
  437. #ifdef UNICODE
  438. #define ChangeServiceConfig2 ChangeServiceConfig2W
  439. #else
  440. #define ChangeServiceConfig2 ChangeServiceConfig2A
  441. #endif // !UNICODE
  442. WINADVAPI
  443. BOOL
  444. WINAPI
  445. CloseServiceHandle(
  446. SC_HANDLE hSCObject
  447. );
  448. WINADVAPI
  449. BOOL
  450. WINAPI
  451. ControlService(
  452. SC_HANDLE hService,
  453. DWORD dwControl,
  454. LPSERVICE_STATUS lpServiceStatus
  455. );
  456. WINADVAPI
  457. SC_HANDLE
  458. WINAPI
  459. CreateServiceA(
  460. SC_HANDLE hSCManager,
  461. LPCSTR lpServiceName,
  462. LPCSTR lpDisplayName,
  463. DWORD dwDesiredAccess,
  464. DWORD dwServiceType,
  465. DWORD dwStartType,
  466. DWORD dwErrorControl,
  467. LPCSTR lpBinaryPathName,
  468. LPCSTR lpLoadOrderGroup,
  469. LPDWORD lpdwTagId,
  470. LPCSTR lpDependencies,
  471. LPCSTR lpServiceStartName,
  472. LPCSTR lpPassword
  473. );
  474. WINADVAPI
  475. SC_HANDLE
  476. WINAPI
  477. CreateServiceW(
  478. SC_HANDLE hSCManager,
  479. LPCWSTR lpServiceName,
  480. LPCWSTR lpDisplayName,
  481. DWORD dwDesiredAccess,
  482. DWORD dwServiceType,
  483. DWORD dwStartType,
  484. DWORD dwErrorControl,
  485. LPCWSTR lpBinaryPathName,
  486. LPCWSTR lpLoadOrderGroup,
  487. LPDWORD lpdwTagId,
  488. LPCWSTR lpDependencies,
  489. LPCWSTR lpServiceStartName,
  490. LPCWSTR lpPassword
  491. );
  492. #ifdef UNICODE
  493. #define CreateService CreateServiceW
  494. #else
  495. #define CreateService CreateServiceA
  496. #endif // !UNICODE
  497. WINADVAPI
  498. BOOL
  499. WINAPI
  500. DeleteService(
  501. SC_HANDLE hService
  502. );
  503. WINADVAPI
  504. BOOL
  505. WINAPI
  506. EnumDependentServicesA(
  507. SC_HANDLE hService,
  508. DWORD dwServiceState,
  509. LPENUM_SERVICE_STATUSA lpServices,
  510. DWORD cbBufSize,
  511. LPDWORD pcbBytesNeeded,
  512. LPDWORD lpServicesReturned
  513. );
  514. WINADVAPI
  515. BOOL
  516. WINAPI
  517. EnumDependentServicesW(
  518. SC_HANDLE hService,
  519. DWORD dwServiceState,
  520. LPENUM_SERVICE_STATUSW lpServices,
  521. DWORD cbBufSize,
  522. LPDWORD pcbBytesNeeded,
  523. LPDWORD lpServicesReturned
  524. );
  525. #ifdef UNICODE
  526. #define EnumDependentServices EnumDependentServicesW
  527. #else
  528. #define EnumDependentServices EnumDependentServicesA
  529. #endif // !UNICODE
  530. WINADVAPI
  531. BOOL
  532. WINAPI
  533. EnumServicesStatusA(
  534. SC_HANDLE hSCManager,
  535. DWORD dwServiceType,
  536. DWORD dwServiceState,
  537. LPENUM_SERVICE_STATUSA lpServices,
  538. DWORD cbBufSize,
  539. LPDWORD pcbBytesNeeded,
  540. LPDWORD lpServicesReturned,
  541. LPDWORD lpResumeHandle
  542. );
  543. WINADVAPI
  544. BOOL
  545. WINAPI
  546. EnumServicesStatusW(
  547. SC_HANDLE hSCManager,
  548. DWORD dwServiceType,
  549. DWORD dwServiceState,
  550. LPENUM_SERVICE_STATUSW lpServices,
  551. DWORD cbBufSize,
  552. LPDWORD pcbBytesNeeded,
  553. LPDWORD lpServicesReturned,
  554. LPDWORD lpResumeHandle
  555. );
  556. #ifdef UNICODE
  557. #define EnumServicesStatus EnumServicesStatusW
  558. #else
  559. #define EnumServicesStatus EnumServicesStatusA
  560. #endif // !UNICODE
  561. WINADVAPI
  562. BOOL
  563. WINAPI
  564. EnumServicesStatusExA(
  565. SC_HANDLE hSCManager,
  566. SC_ENUM_TYPE InfoLevel,
  567. DWORD dwServiceType,
  568. DWORD dwServiceState,
  569. LPBYTE lpServices,
  570. DWORD cbBufSize,
  571. LPDWORD pcbBytesNeeded,
  572. LPDWORD lpServicesReturned,
  573. LPDWORD lpResumeHandle,
  574. LPCSTR pszGroupName
  575. );
  576. WINADVAPI
  577. BOOL
  578. WINAPI
  579. EnumServicesStatusExW(
  580. SC_HANDLE hSCManager,
  581. SC_ENUM_TYPE InfoLevel,
  582. DWORD dwServiceType,
  583. DWORD dwServiceState,
  584. LPBYTE lpServices,
  585. DWORD cbBufSize,
  586. LPDWORD pcbBytesNeeded,
  587. LPDWORD lpServicesReturned,
  588. LPDWORD lpResumeHandle,
  589. LPCWSTR pszGroupName
  590. );
  591. #ifdef UNICODE
  592. #define EnumServicesStatusEx EnumServicesStatusExW
  593. #else
  594. #define EnumServicesStatusEx EnumServicesStatusExA
  595. #endif // !UNICODE
  596. WINADVAPI
  597. BOOL
  598. WINAPI
  599. GetServiceKeyNameA(
  600. SC_HANDLE hSCManager,
  601. LPCSTR lpDisplayName,
  602. LPSTR lpServiceName,
  603. LPDWORD lpcchBuffer
  604. );
  605. WINADVAPI
  606. BOOL
  607. WINAPI
  608. GetServiceKeyNameW(
  609. SC_HANDLE hSCManager,
  610. LPCWSTR lpDisplayName,
  611. LPWSTR lpServiceName,
  612. LPDWORD lpcchBuffer
  613. );
  614. #ifdef UNICODE
  615. #define GetServiceKeyName GetServiceKeyNameW
  616. #else
  617. #define GetServiceKeyName GetServiceKeyNameA
  618. #endif // !UNICODE
  619. WINADVAPI
  620. BOOL
  621. WINAPI
  622. GetServiceDisplayNameA(
  623. SC_HANDLE hSCManager,
  624. LPCSTR lpServiceName,
  625. LPSTR lpDisplayName,
  626. LPDWORD lpcchBuffer
  627. );
  628. WINADVAPI
  629. BOOL
  630. WINAPI
  631. GetServiceDisplayNameW(
  632. SC_HANDLE hSCManager,
  633. LPCWSTR lpServiceName,
  634. LPWSTR lpDisplayName,
  635. LPDWORD lpcchBuffer
  636. );
  637. #ifdef UNICODE
  638. #define GetServiceDisplayName GetServiceDisplayNameW
  639. #else
  640. #define GetServiceDisplayName GetServiceDisplayNameA
  641. #endif // !UNICODE
  642. WINADVAPI
  643. SC_LOCK
  644. WINAPI
  645. LockServiceDatabase(
  646. SC_HANDLE hSCManager
  647. );
  648. WINADVAPI
  649. BOOL
  650. WINAPI
  651. NotifyBootConfigStatus(
  652. BOOL BootAcceptable
  653. );
  654. WINADVAPI
  655. SC_HANDLE
  656. WINAPI
  657. OpenSCManagerA(
  658. LPCSTR lpMachineName,
  659. LPCSTR lpDatabaseName,
  660. DWORD dwDesiredAccess
  661. );
  662. WINADVAPI
  663. SC_HANDLE
  664. WINAPI
  665. OpenSCManagerW(
  666. LPCWSTR lpMachineName,
  667. LPCWSTR lpDatabaseName,
  668. DWORD dwDesiredAccess
  669. );
  670. #ifdef UNICODE
  671. #define OpenSCManager OpenSCManagerW
  672. #else
  673. #define OpenSCManager OpenSCManagerA
  674. #endif // !UNICODE
  675. WINADVAPI
  676. SC_HANDLE
  677. WINAPI
  678. OpenServiceA(
  679. SC_HANDLE hSCManager,
  680. LPCSTR lpServiceName,
  681. DWORD dwDesiredAccess
  682. );
  683. WINADVAPI
  684. SC_HANDLE
  685. WINAPI
  686. OpenServiceW(
  687. SC_HANDLE hSCManager,
  688. LPCWSTR lpServiceName,
  689. DWORD dwDesiredAccess
  690. );
  691. #ifdef UNICODE
  692. #define OpenService OpenServiceW
  693. #else
  694. #define OpenService OpenServiceA
  695. #endif // !UNICODE
  696. WINADVAPI
  697. BOOL
  698. WINAPI
  699. QueryServiceConfigA(
  700. SC_HANDLE hService,
  701. LPQUERY_SERVICE_CONFIGA lpServiceConfig,
  702. DWORD cbBufSize,
  703. LPDWORD pcbBytesNeeded
  704. );
  705. WINADVAPI
  706. BOOL
  707. WINAPI
  708. QueryServiceConfigW(
  709. SC_HANDLE hService,
  710. LPQUERY_SERVICE_CONFIGW lpServiceConfig,
  711. DWORD cbBufSize,
  712. LPDWORD pcbBytesNeeded
  713. );
  714. #ifdef UNICODE
  715. #define QueryServiceConfig QueryServiceConfigW
  716. #else
  717. #define QueryServiceConfig QueryServiceConfigA
  718. #endif // !UNICODE
  719. WINADVAPI
  720. BOOL
  721. WINAPI
  722. QueryServiceConfig2A(
  723. SC_HANDLE hService,
  724. DWORD dwInfoLevel,
  725. LPBYTE lpBuffer,
  726. DWORD cbBufSize,
  727. LPDWORD pcbBytesNeeded
  728. );
  729. WINADVAPI
  730. BOOL
  731. WINAPI
  732. QueryServiceConfig2W(
  733. SC_HANDLE hService,
  734. DWORD dwInfoLevel,
  735. LPBYTE lpBuffer,
  736. DWORD cbBufSize,
  737. LPDWORD pcbBytesNeeded
  738. );
  739. #ifdef UNICODE
  740. #define QueryServiceConfig2 QueryServiceConfig2W
  741. #else
  742. #define QueryServiceConfig2 QueryServiceConfig2A
  743. #endif // !UNICODE
  744. WINADVAPI
  745. BOOL
  746. WINAPI
  747. QueryServiceLockStatusA(
  748. SC_HANDLE hSCManager,
  749. LPQUERY_SERVICE_LOCK_STATUSA lpLockStatus,
  750. DWORD cbBufSize,
  751. LPDWORD pcbBytesNeeded
  752. );
  753. WINADVAPI
  754. BOOL
  755. WINAPI
  756. QueryServiceLockStatusW(
  757. SC_HANDLE hSCManager,
  758. LPQUERY_SERVICE_LOCK_STATUSW lpLockStatus,
  759. DWORD cbBufSize,
  760. LPDWORD pcbBytesNeeded
  761. );
  762. #ifdef UNICODE
  763. #define QueryServiceLockStatus QueryServiceLockStatusW
  764. #else
  765. #define QueryServiceLockStatus QueryServiceLockStatusA
  766. #endif // !UNICODE
  767. WINADVAPI
  768. BOOL
  769. WINAPI
  770. QueryServiceObjectSecurity(
  771. SC_HANDLE hService,
  772. SECURITY_INFORMATION dwSecurityInformation,
  773. PSECURITY_DESCRIPTOR lpSecurityDescriptor,
  774. DWORD cbBufSize,
  775. LPDWORD pcbBytesNeeded
  776. );
  777. WINADVAPI
  778. BOOL
  779. WINAPI
  780. QueryServiceStatus(
  781. SC_HANDLE hService,
  782. LPSERVICE_STATUS lpServiceStatus
  783. );
  784. WINADVAPI
  785. BOOL
  786. WINAPI
  787. QueryServiceStatusEx(
  788. SC_HANDLE hService,
  789. SC_STATUS_TYPE InfoLevel,
  790. LPBYTE lpBuffer,
  791. DWORD cbBufSize,
  792. LPDWORD pcbBytesNeeded
  793. );
  794. WINADVAPI
  795. SERVICE_STATUS_HANDLE
  796. WINAPI
  797. RegisterServiceCtrlHandlerA(
  798. LPCSTR lpServiceName,
  799. LPHANDLER_FUNCTION lpHandlerProc
  800. );
  801. WINADVAPI
  802. SERVICE_STATUS_HANDLE
  803. WINAPI
  804. RegisterServiceCtrlHandlerW(
  805. LPCWSTR lpServiceName,
  806. LPHANDLER_FUNCTION lpHandlerProc
  807. );
  808. #ifdef UNICODE
  809. #define RegisterServiceCtrlHandler RegisterServiceCtrlHandlerW
  810. #else
  811. #define RegisterServiceCtrlHandler RegisterServiceCtrlHandlerA
  812. #endif // !UNICODE
  813. WINADVAPI
  814. SERVICE_STATUS_HANDLE
  815. WINAPI
  816. RegisterServiceCtrlHandlerExA(
  817. LPCSTR lpServiceName,
  818. LPHANDLER_FUNCTION_EX lpHandlerProc,
  819. LPVOID lpContext
  820. );
  821. WINADVAPI
  822. SERVICE_STATUS_HANDLE
  823. WINAPI
  824. RegisterServiceCtrlHandlerExW(
  825. LPCWSTR lpServiceName,
  826. LPHANDLER_FUNCTION_EX lpHandlerProc,
  827. LPVOID lpContext
  828. );
  829. #ifdef UNICODE
  830. #define RegisterServiceCtrlHandlerEx RegisterServiceCtrlHandlerExW
  831. #else
  832. #define RegisterServiceCtrlHandlerEx RegisterServiceCtrlHandlerExA
  833. #endif // !UNICODE
  834. WINADVAPI
  835. BOOL
  836. WINAPI
  837. SetServiceObjectSecurity(
  838. SC_HANDLE hService,
  839. SECURITY_INFORMATION dwSecurityInformation,
  840. PSECURITY_DESCRIPTOR lpSecurityDescriptor
  841. );
  842. WINADVAPI
  843. BOOL
  844. WINAPI
  845. SetServiceStatus(
  846. SERVICE_STATUS_HANDLE hServiceStatus,
  847. LPSERVICE_STATUS lpServiceStatus
  848. );
  849. WINADVAPI
  850. BOOL
  851. WINAPI
  852. StartServiceCtrlDispatcherA(
  853. CONST SERVICE_TABLE_ENTRYA *lpServiceStartTable
  854. );
  855. WINADVAPI
  856. BOOL
  857. WINAPI
  858. StartServiceCtrlDispatcherW(
  859. CONST SERVICE_TABLE_ENTRYW *lpServiceStartTable
  860. );
  861. #ifdef UNICODE
  862. #define StartServiceCtrlDispatcher StartServiceCtrlDispatcherW
  863. #else
  864. #define StartServiceCtrlDispatcher StartServiceCtrlDispatcherA
  865. #endif // !UNICODE
  866. WINADVAPI
  867. BOOL
  868. WINAPI
  869. StartServiceA(
  870. SC_HANDLE hService,
  871. DWORD dwNumServiceArgs,
  872. LPCSTR *lpServiceArgVectors
  873. );
  874. WINADVAPI
  875. BOOL
  876. WINAPI
  877. StartServiceW(
  878. SC_HANDLE hService,
  879. DWORD dwNumServiceArgs,
  880. LPCWSTR *lpServiceArgVectors
  881. );
  882. #ifdef UNICODE
  883. #define StartService StartServiceW
  884. #else
  885. #define StartService StartServiceA
  886. #endif // !UNICODE
  887. WINADVAPI
  888. BOOL
  889. WINAPI
  890. UnlockServiceDatabase(
  891. SC_LOCK ScLock
  892. );
  893. #ifdef __cplusplus
  894. }
  895. #endif
  896. #endif // _WINSVC_