1 #ifndef __WINE_WINSVC_H
2 #define __WINE_WINSVC_H
6 #endif /* defined(__cplusplus) */
11 #define SERVICE_CONTROL_STOP 0x00000001
12 #define SERVICE_CONTROL_PAUSE 0x00000002
13 #define SERVICE_CONTROL_CONTINUE 0x00000003
14 #define SERVICE_CONTROL_INTERROGATE 0x00000004
15 #define SERVICE_CONTROL_SHUTDOWN 0x00000005
16 #define SERVICE_CONTROL_PARAMCHANGE 0x00000006
17 #define SERVICE_CONTROL_NETBINDADD 0x00000007
18 #define SERVICE_CONTROL_NETBINDREMOVE 0x00000008
19 #define SERVICE_CONTROL_NETBINDENABLE 0x00000009
20 #define SERVICE_CONTROL_NETBINDDISABLE 0x0000000A
21 #define SERVICE_CONTROL_DEVICEEVENT 0x0000000B
22 #define SERVICE_CONTROL_HARDWAREPROFILECHANGE 0x0000000C
23 #define SERVICE_CONTROL_POWEREVENT 0x0000000D
26 #define SERVICE_STOPPED 0x00000001
27 #define SERVICE_START_PENDING 0x00000002
28 #define SERVICE_STOP_PENDING 0x00000003
29 #define SERVICE_RUNNING 0x00000004
30 #define SERVICE_CONTINUE_PENDING 0x00000005
31 #define SERVICE_PAUSE_PENDING 0x00000006
32 #define SERVICE_PAUSED 0x00000007
34 /* Controls Accepted */
35 #define SERVICE_ACCEPT_STOP 0x00000001
36 #define SERVICE_ACCEPT_PAUSE_CONTINUE 0x00000002
37 #define SERVICE_ACCEPT_SHUTDOWN 0x00000004
38 #define SERVICE_ACCEPT_PARAMCHANGE 0x00000008
39 #define SERVICE_ACCEPT_NETBINDCHANGE 0x00000010
40 #define SERVICE_ACCEPT_HARDWAREPROFILECHANGE 0x00000020
41 #define SERVICE_ACCEPT_POWEREVENT 0x00000040
43 /* Service Control Manager Object access types */
44 #define SC_MANAGER_CONNECT 0x0001
45 #define SC_MANAGER_CREATE_SERVICE 0x0002
46 #define SC_MANAGER_ENUMERATE_SERVICE 0x0004
47 #define SC_MANAGER_LOCK 0x0008
48 #define SC_MANAGER_QUERY_LOCK_STATUS 0x0010
49 #define SC_MANAGER_MODIFY_BOOT_CONFIG 0x0020
50 #define SC_MANAGER_ALL_ACCESS ( STANDARD_RIGHTS_REQUIRED | \
51 SC_MANAGER_CONNECT | \
52 SC_MANAGER_CREATE_SERVICE | \
53 SC_MANAGER_ENUMERATE_SERVICE | \
55 SC_MANAGER_QUERY_LOCK_STATUS | \
56 SC_MANAGER_MODIFY_BOOT_CONFIG )
58 #define SERVICE_QUERY_CONFIG 0x0001
59 #define SERVICE_CHANGE_CONFIG 0x0002
60 #define SERVICE_QUERY_STATUS 0x0004
61 #define SERVICE_ENUMERATE_DEPENDENTS 0x0008
62 #define SERVICE_START 0x0010
63 #define SERVICE_STOP 0x0020
64 #define SERVICE_PAUSE_CONTINUE 0x0040
65 #define SERVICE_INTERROGATE 0x0080
66 #define SERVICE_USER_DEFINED_CONTROL 0x0100
68 #define SERVICE_ALL_ACCESS ( STANDARD_RIGHTS_REQUIRED | \
69 SERVICE_QUERY_CONFIG | \
70 SERVICE_CHANGE_CONFIG | \
71 SERVICE_QUERY_STATUS | \
72 SERVICE_ENUMERATE_DEPENDENTS | \
75 SERVICE_PAUSE_CONTINUE | \
76 SERVICE_INTERROGATE | \
77 SERVICE_USER_DEFINED_CONTROL )
83 DECLARE_HANDLE(SC_HANDLE
);
85 DECLARE_HANDLE(SERVICE_STATUS_HANDLE
);
88 /* Service status structure */
90 typedef struct _SERVICE_STATUS
{
93 DWORD dwControlsAccepted
;
94 DWORD dwWin32ExitCode
;
95 DWORD dwServiceSpecificExitCode
;
98 } SERVICE_STATUS
, *LPSERVICE_STATUS
;
100 /* Service main function prototype */
102 typedef VOID
CALLBACK (*LPSERVICE_MAIN_FUNCTIONA
)(DWORD
,LPSTR
*);
103 typedef VOID
CALLBACK (*LPSERVICE_MAIN_FUNCTIONW
)(DWORD
,LPWSTR
*);
104 DECL_WINELIB_TYPE_AW(LPSERVICE_MAIN_FUNCTION
)
106 /* Service start table */
108 typedef struct _SERVICE_TABLE_ENTRYA
{
110 LPSERVICE_MAIN_FUNCTIONA lpServiceProc
;
111 } SERVICE_TABLE_ENTRYA
, *LPSERVICE_TABLE_ENTRYA
;
113 typedef struct _SERVICE_TABLE_ENTRYW
{
114 LPWSTR lpServiceName
;
115 LPSERVICE_MAIN_FUNCTIONW lpServiceProc
;
116 } SERVICE_TABLE_ENTRYW
, *LPSERVICE_TABLE_ENTRYW
;
118 DECL_WINELIB_TYPE_AW(SERVICE_TABLE_ENTRY
)
119 DECL_WINELIB_TYPE_AW(LPSERVICE_TABLE_ENTRY
)
121 /* Service status enumeration structure */
123 typedef struct _ENUM_SERVICE_STATUSA
{
126 SERVICE_STATUS ServiceStatus
;
127 } ENUM_SERVICE_STATUSA
, *LPENUM_SERVICE_STATUSA
;
129 typedef struct _ENUM_SERVICE_STATUSW
{
130 LPWSTR lpServiceName
;
131 LPWSTR lpDisplayName
;
132 SERVICE_STATUS ServiceStatus
;
133 } ENUM_SERVICE_STATUSW
, *LPENUM_SERVICE_STATUSW
;
135 DECL_WINELIB_TYPE_AW(ENUM_SERVICE_STATUS
)
136 DECL_WINELIB_TYPE_AW(LPENUM_SERVICE_STATUS
)
138 /* Service control handler function prototype */
140 typedef VOID (WINAPI
*LPHANDLER_FUNCTION
)(DWORD
);
142 /* API function prototypes */
144 BOOL WINAPI
CloseServiceHandle(SC_HANDLE
);
145 BOOL WINAPI
ControlService(SC_HANDLE
,DWORD
,LPSERVICE_STATUS
);
146 SC_HANDLE WINAPI
CreateServiceA(SC_HANDLE
,LPCSTR
,LPCSTR
,DWORD
,DWORD
,DWORD
,DWORD
,LPCSTR
,
147 LPCSTR
,LPDWORD
,LPCSTR
,LPCSTR
,LPCSTR
);
148 SC_HANDLE WINAPI
CreateServiceW(SC_HANDLE
,LPCWSTR
,LPCWSTR
,DWORD
,DWORD
,DWORD
,DWORD
,LPCWSTR
,
149 LPCWSTR
,LPDWORD
,LPCWSTR
,LPCWSTR
,LPCWSTR
);
150 #define CreateService WINELIB_NAME_AW(CreateService)
151 BOOL WINAPI
DeleteService(SC_HANDLE
);
152 BOOL WINAPI
EnumServicesStatusA(SC_HANDLE
,DWORD
,DWORD
,LPENUM_SERVICE_STATUSA
,
153 DWORD
,LPDWORD
,LPDWORD
,LPDWORD
);
154 BOOL WINAPI
EnumServicesStatusW(SC_HANDLE
,DWORD
,DWORD
,LPENUM_SERVICE_STATUSW
,
155 DWORD
,LPDWORD
,LPDWORD
,LPDWORD
);
156 #define EnumServicesStatus WINELIB_NAME_AW(EnumServicesStatus)
157 SC_HANDLE WINAPI
OpenSCManagerA(LPCSTR
,LPCSTR
,DWORD
);
158 SC_HANDLE WINAPI
OpenSCManagerW(LPCWSTR
,LPCWSTR
,DWORD
);
159 #define OpenSCManager WINELIB_NAME_AW(OpenSCManager)
160 SC_HANDLE WINAPI
OpenServiceA(SC_HANDLE
,LPCSTR
,DWORD
);
161 SC_HANDLE WINAPI
OpenServiceW(SC_HANDLE
,LPCWSTR
,DWORD
);
162 #define OpenService WINELIB_NAME_AW(OpenService)
163 SERVICE_STATUS_HANDLE WINAPI
RegisterServiceCtrlHandlerA(LPCSTR
,LPHANDLER_FUNCTION
);
164 SERVICE_STATUS_HANDLE WINAPI
RegisterServiceCtrlHandlerW(LPCWSTR
,LPHANDLER_FUNCTION
);
165 #define RegisterServiceCtrlHandler WINELIB_NAME_AW(RegisterServiceCtrlHandler)
166 BOOL WINAPI
SetServiceStatus(SERVICE_STATUS_HANDLE
,LPSERVICE_STATUS
);
167 BOOL WINAPI
StartServiceA(SC_HANDLE
,DWORD
,LPCSTR
*);
168 BOOL WINAPI
StartServiceW(SC_HANDLE
,DWORD
,LPCWSTR
*);
169 #define StartService WINELIB_NAME_AW(StartService)
170 BOOL WINAPI
StartServiceCtrlDispatcherA(LPSERVICE_TABLE_ENTRYA
);
171 BOOL WINAPI
StartServiceCtrlDispatcherW(LPSERVICE_TABLE_ENTRYW
);
172 #define StartServiceCtrlDispatcher WINELIB_NAME_AW(StartServiceCtrlDispatcher)
173 BOOL WINAPI
QueryServiceStatus(SC_HANDLE
,LPSERVICE_STATUS
);
177 #endif /* defined(__cplusplus) */
179 #endif /* !defined(__WINE_WINSVC_H) */