home *** CD-ROM | disk | FTP | other *** search
/ PC World 2001 May / PCWorld_2001-05_cd.bin / Software / Vyzkuste / devc / _SETUP.5 / Group3 / winsvc.h < prev    next >
C/C++ Source or Header  |  1999-11-07  |  9KB  |  203 lines

  1. #ifndef _WINSVC_H
  2. #define _WINSVC_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #define SERVICES_ACTIVE_DATABASEA "ServicesActive"
  7. #define SERVICES_ACTIVE_DATABASEW L"ServicesActive"
  8. #define SERVICES_FAILED_DATABASEA "ServicesFailed"
  9. #define SERVICES_FAILED_DATABASEW L"ServicesFailed"
  10. #define SC_GROUP_IDENTIFIERA '+'
  11. #define SC_GROUP_IDENTIFIERW L'+'
  12. #define SC_MANAGER_ALL_ACCESS    0xf003f
  13. #define SC_MANAGER_CONNECT    1
  14. #define SC_MANAGER_CREATE_SERVICE    2
  15. #define SC_MANAGER_ENUMERATE_SERVICE    4
  16. #define SC_MANAGER_LOCK    8
  17. #define SC_MANAGER_QUERY_LOCK_STATUS    16
  18. #define SC_MANAGER_MODIFY_BOOT_CONFIG    32
  19. #define SERVICE_NO_CHANGE    (-1)
  20. #define SERVICE_STOPPED    1
  21. #define SERVICE_START_PENDING    2
  22. #define SERVICE_STOP_PENDING    3
  23. #define SERVICE_RUNNING    4
  24. #define SERVICE_CONTINUE_PENDING    5
  25. #define SERVICE_PAUSE_PENDING    6
  26. #define SERVICE_PAUSED    7
  27. #define SERVICE_ACCEPT_STOP    1
  28. #define SERVICE_ACCEPT_PAUSE_CONTINUE    2
  29. #define SERVICE_ACCEPT_SHUTDOWN 4
  30. #define SERVICE_CONTROL_STOP    1
  31. #define SERVICE_CONTROL_PAUSE    2
  32. #define SERVICE_CONTROL_CONTINUE    3
  33. #define SERVICE_CONTROL_INTERROGATE    4
  34. #define SERVICE_CONTROL_SHUTDOWN    5
  35. #define SERVICE_ACTIVE 1
  36. #define SERVICE_INACTIVE 2
  37. #define SERVICE_STATE_ALL 3
  38. #define SERVICE_QUERY_CONFIG 1
  39. #define SERVICE_CHANGE_CONFIG 2
  40. #define SERVICE_QUERY_STATUS 4
  41. #define SERVICE_ENUMERATE_DEPENDENTS 8
  42. #define SERVICE_START 16
  43. #define SERVICE_STOP 32
  44. #define SERVICE_PAUSE_CONTINUE 64
  45. #define SERVICE_INTERROGATE 128
  46. #define SERVICE_USER_DEFINED_CONTROL 256
  47. #define SERVICE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SERVICE_QUERY_CONFIG|SERVICE_CHANGE_CONFIG|SERVICE_QUERY_STATUS|SERVICE_ENUMERATE_DEPENDENTS|SERVICE_START|SERVICE_STOP|SERVICE_PAUSE_CONTINUE|SERVICE_INTERROGATE|SERVICE_USER_DEFINED_CONTROL)
  48.  
  49.  
  50. typedef struct _SERVICE_STATUS {
  51.     DWORD dwServiceType;
  52.     DWORD dwCurrentState;
  53.     DWORD dwControlsAccepted;
  54.     DWORD dwWin32ExitCode;
  55.     DWORD dwServiceSpecificExitCode;
  56.     DWORD dwCheckPoint;
  57.     DWORD dwWaitHint;
  58. } SERVICE_STATUS,*LPSERVICE_STATUS;
  59. typedef struct _ENUM_SERVICE_STATUSA {
  60.     LPSTR lpServiceName;
  61.     LPSTR lpDisplayName;
  62.     SERVICE_STATUS ServiceStatus;
  63. } ENUM_SERVICE_STATUSA,*LPENUM_SERVICE_STATUSA;
  64. typedef struct _ENUM_SERVICE_STATUSW {
  65.     LPWSTR lpServiceName;
  66.     LPWSTR lpDisplayName;
  67.     SERVICE_STATUS ServiceStatus;
  68. } ENUM_SERVICE_STATUSW,*LPENUM_SERVICE_STATUSW;
  69. typedef struct _QUERY_SERVICE_CONFIGA {
  70.     DWORD dwServiceType;
  71.     DWORD dwStartType;
  72.     DWORD dwErrorControl;
  73.     LPSTR lpBinaryPathName;
  74.     LPSTR lpLoadOrderGroup;
  75.     DWORD dwTagId;
  76.     LPSTR lpDependencies;
  77.     LPSTR lpServiceStartName;
  78.     LPSTR lpDisplayName;
  79. } QUERY_SERVICE_CONFIGA,*LPQUERY_SERVICE_CONFIGA;
  80. typedef struct _QUERY_SERVICE_CONFIGW {
  81.     DWORD dwServiceType;
  82.     DWORD dwStartType;
  83.     DWORD dwErrorControl;
  84.     LPWSTR lpBinaryPathName;
  85.     LPWSTR lpLoadOrderGroup;
  86.     DWORD dwTagId;
  87.     LPWSTR lpDependencies;
  88.     LPWSTR lpServiceStartName;
  89.     LPWSTR lpDisplayName;
  90. } QUERY_SERVICE_CONFIGW,*LPQUERY_SERVICE_CONFIGW;
  91. typedef struct _QUERY_SERVICE_LOCK_STATUSA {
  92.     DWORD fIsLocked;
  93.     LPSTR lpLockOwner;
  94.     DWORD dwLockDuration;
  95. } QUERY_SERVICE_LOCK_STATUSA,*LPQUERY_SERVICE_LOCK_STATUSA;
  96. typedef struct _QUERY_SERVICE_LOCK_STATUSW {
  97.     DWORD fIsLocked;
  98.     LPWSTR lpLockOwner;
  99.     DWORD dwLockDuration;
  100. } QUERY_SERVICE_LOCK_STATUSW,*LPQUERY_SERVICE_LOCK_STATUSW;
  101. typedef void (WINAPI *LPSERVICE_MAIN_FUNCTIONA)(DWORD,LPSTR*);
  102. typedef void (WINAPI *LPSERVICE_MAIN_FUNCTIONW)(DWORD,LPWSTR*);
  103. typedef struct _SERVICE_TABLE_ENTRYA {
  104.     LPSTR lpServiceName;
  105.     LPSERVICE_MAIN_FUNCTIONA lpServiceProc;
  106. } SERVICE_TABLE_ENTRYA,*LPSERVICE_TABLE_ENTRYA;
  107. typedef struct _SERVICE_TABLE_ENTRYW {
  108.     LPWSTR lpServiceName;
  109.     LPSERVICE_MAIN_FUNCTIONW lpServiceProc;
  110. } SERVICE_TABLE_ENTRYW,*LPSERVICE_TABLE_ENTRYW;
  111. DECLARE_HANDLE(SC_HANDLE);
  112. typedef SC_HANDLE *LPSC_HANDLE;
  113. typedef PVOID SC_LOCK;
  114. typedef DWORD SERVICE_STATUS_HANDLE;
  115. typedef BOOL(CALLBACK *LPHANDLER_FUNCTION)(DWORD);
  116.  
  117. BOOL WINAPI ChangeServiceConfigA(SC_HANDLE,DWORD,DWORD,DWORD,LPCSTR,LPCSTR,LPDWORD,LPCSTR,LPCSTR,LPCSTR,LPCSTR);
  118. BOOL WINAPI ChangeServiceConfigW(SC_HANDLE,DWORD,DWORD,DWORD,LPCWSTR,LPCWSTR,LPDWORD,LPCWSTR,LPCWSTR,LPCWSTR,LPCWSTR);
  119. BOOL WINAPI CloseServiceHandle(SC_HANDLE);
  120. BOOL WINAPI ControlService(SC_HANDLE,DWORD,LPSERVICE_STATUS);
  121. SC_HANDLE WINAPI CreateServiceA(SC_HANDLE,LPCSTR,LPCSTR,DWORD,DWORD,DWORD,DWORD,LPCSTR,LPCSTR,PDWORD,LPCSTR,LPCSTR,LPCSTR);
  122. SC_HANDLE WINAPI CreateServiceW(SC_HANDLE,LPCWSTR,LPCWSTR,DWORD,DWORD,DWORD,DWORD,LPCWSTR,LPCWSTR,PDWORD,LPCWSTR,LPCWSTR,LPCWSTR);
  123. BOOL WINAPI DeleteService(SC_HANDLE);
  124. BOOL WINAPI EnumDependentServicesA(SC_HANDLE,DWORD,LPENUM_SERVICE_STATUSA,DWORD,PDWORD,PDWORD);
  125. BOOL WINAPI EnumDependentServicesW(SC_HANDLE,DWORD,LPENUM_SERVICE_STATUSW,DWORD,PDWORD,PDWORD);
  126. BOOL WINAPI EnumServicesStatusA(SC_HANDLE,DWORD,DWORD,LPENUM_SERVICE_STATUSA,DWORD,PDWORD,PDWORD,PDWORD);
  127. BOOL WINAPI EnumServicesStatusW(SC_HANDLE,DWORD,DWORD,LPENUM_SERVICE_STATUSW,DWORD,PDWORD,PDWORD,PDWORD);
  128. BOOL WINAPI GetServiceDisplayNameA(SC_HANDLE,LPCSTR,LPSTR,PDWORD);
  129. BOOL WINAPI GetServiceDisplayNameW(SC_HANDLE,LPCWSTR,LPWSTR,PDWORD);
  130. BOOL WINAPI GetServiceKeyNameA(SC_HANDLE,LPCSTR,LPSTR,PDWORD);
  131. BOOL WINAPI GetServiceKeyNameW(SC_HANDLE,LPCWSTR,LPWSTR,PDWORD);
  132. SC_LOCK WINAPI LockServiceDatabase(SC_HANDLE);
  133. BOOL WINAPI NotifyBootConfigStatus(BOOL);
  134. SC_HANDLE WINAPI OpenSCManagerA(LPCSTR,LPCSTR,DWORD);
  135. SC_HANDLE WINAPI OpenSCManagerW(LPCWSTR,LPCWSTR,DWORD);
  136. SC_HANDLE WINAPI OpenServiceA(SC_HANDLE,LPCSTR,DWORD);
  137. SC_HANDLE WINAPI OpenServiceW(SC_HANDLE,LPCWSTR,DWORD);
  138. BOOL WINAPI QueryServiceConfigA(SC_HANDLE,LPQUERY_SERVICE_CONFIGA,DWORD,PDWORD);
  139. BOOL WINAPI QueryServiceConfigW(SC_HANDLE,LPQUERY_SERVICE_CONFIGW,DWORD,PDWORD);
  140. BOOL WINAPI QueryServiceLockStatusA(SC_HANDLE,LPQUERY_SERVICE_LOCK_STATUSA,DWORD,PDWORD);
  141. BOOL WINAPI QueryServiceLockStatusW(SC_HANDLE,LPQUERY_SERVICE_LOCK_STATUSW,DWORD,PDWORD);
  142. BOOL WINAPI QueryServiceObjectSecurity(SC_HANDLE,SECURITY_INFORMATION,PSECURITY_DESCRIPTOR,DWORD,LPDWORD);
  143. BOOL WINAPI QueryServiceStatus(SC_HANDLE,LPSERVICE_STATUS);
  144. SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandlerA(LPCSTR,LPHANDLER_FUNCTION);
  145. SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandlerW(LPCWSTR,LPHANDLER_FUNCTION);
  146. BOOL WINAPI SetServiceObjectSecurity(SC_HANDLE,SECURITY_INFORMATION,PSECURITY_DESCRIPTOR);
  147. BOOL WINAPI SetServiceStatus(SERVICE_STATUS_HANDLE,LPSERVICE_STATUS);
  148. BOOL WINAPI StartServiceA(SC_HANDLE,DWORD,LPCSTR*);
  149. BOOL WINAPI StartServiceCtrlDispatcherA(LPSERVICE_TABLE_ENTRYA);
  150. BOOL WINAPI StartServiceCtrlDispatcherW(LPSERVICE_TABLE_ENTRYW);
  151. BOOL WINAPI StartServiceW(SC_HANDLE,DWORD,LPCWSTR);
  152. BOOL WINAPI UnlockServiceDatabase(SC_LOCK);
  153.  
  154. #ifdef UNICODE
  155. typedef ENUM_SERVICE_STATUSW ENUM_SERVICE_STATUS,*LPENUM_SERVICE_STATUS;
  156. typedef QUERY_SERVICE_CONFIGW QUERY_SERVICE_CONFIG,*LPQUERY_SERVICE_CONFIG;
  157. typedef QUERY_SERVICE_LOCK_STATUSW QUERY_SERVICE_LOCK_STATUS,*LPQUERY_SERVICE_LOCK_STATUS;
  158. typedef SERVICE_TABLE_ENTRYW SERVICE_TABLE_ENTRY,*LPSERVICE_TABLE_ENTRY;
  159. typedef LPSERVICE_MAIN_FUNCTIONW LPSERVICE_MAIN_FUNCTION;
  160. #define SERVICES_ACTIVE_DATABASE SERVICES_ACTIVE_DATABASEW
  161. #define SERVICES_FAILED_DATABASE SERVICES_FAILED_DATABASEW
  162. #define SC_GROUP_IDENTIFIER SC_GROUP_IDENTIFIERW
  163. #define ChangeServiceConfig ChangeServiceConfigW
  164. #define CreateService CreateServiceW
  165. #define EnumDependentServices EnumDependentServicesW
  166. #define EnumServicesStatus EnumServicesStatusW
  167. #define GetServiceDisplayName GetServiceDisplayNameW
  168. #define GetServiceKeyName GetServiceKeyNameW
  169. #define OpenSCManager OpenSCManagerW
  170. #define OpenService OpenServiceW
  171. #define QueryServiceConfig QueryServiceConfigW
  172. #define QueryServiceLockStatus QueryServiceLockStatusW
  173. #define RegisterServiceCtrlHandler RegisterServiceCtrlHandlerW
  174. #define StartService StartServiceW
  175. #define StartServiceCtrlDispatcher StartServiceCtrlDispatcherW
  176. #else
  177. typedef ENUM_SERVICE_STATUSA ENUM_SERVICE_STATUS,*LPENUM_SERVICE_STATUS;
  178. typedef QUERY_SERVICE_CONFIGA QUERY_SERVICE_CONFIG,*LPQUERY_SERVICE_CONFIG;
  179. typedef QUERY_SERVICE_LOCK_STATUSA QUERY_SERVICE_LOCK_STATUS,*LPQUERY_SERVICE_LOCK_STATUS;
  180. typedef SERVICE_TABLE_ENTRYA SERVICE_TABLE_ENTRY,*LPSERVICE_TABLE_ENTRY;
  181. typedef LPSERVICE_MAIN_FUNCTIONA LPSERVICE_MAIN_FUNCTION;
  182. #define SERVICES_ACTIVE_DATABASE SERVICES_ACTIVE_DATABASEA
  183. #define SERVICES_FAILED_DATABASE SERVICES_FAILED_DATABASEA
  184. #define SC_GROUP_IDENTIFIER SC_GROUP_IDENTIFIERA
  185. #define ChangeServiceConfig ChangeServiceConfigA
  186. #define CreateService CreateServiceA
  187. #define EnumDependentServices EnumDependentServicesA
  188. #define EnumServicesStatus EnumServicesStatusA
  189. #define GetServiceDisplayName GetServiceDisplayNameA
  190. #define GetServiceKeyName GetServiceKeyNameA
  191. #define OpenSCManager OpenSCManagerA
  192. #define OpenService OpenServiceA
  193. #define QueryServiceConfig QueryServiceConfigA
  194. #define QueryServiceLockStatus QueryServiceLockStatusA
  195. #define RegisterServiceCtrlHandler RegisterServiceCtrlHandlerA
  196. #define StartService StartServiceA
  197. #define StartServiceCtrlDispatcher StartServiceCtrlDispatcherA
  198. #endif
  199. #ifdef __cplusplus
  200. }
  201. #endif
  202. #endif /* _WINSVC_H */
  203.