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 typedef HANDLE SC_HANDLE
, *LPSC_HANDLE
;
84 typedef DWORD SERVICE_STATUS_HANDLE
;
87 /* Service status structure */
89 typedef struct _SERVICE_STATUS
{
92 DWORD dwControlsAccepted
;
93 DWORD dwWin32ExitCode
;
94 DWORD dwServiceSpecificExitCode
;
97 } SERVICE_STATUS
, *LPSERVICE_STATUS
;
99 /* Service main function prototype */
101 typedef VOID
CALLBACK (*LPSERVICE_MAIN_FUNCTIONA
)(DWORD
,LPSTR
*);
102 typedef VOID
CALLBACK (*LPSERVICE_MAIN_FUNCTIONW
)(DWORD
,LPWSTR
*);
103 DECL_WINELIB_TYPE_AW(LPSERVICE_MAIN_FUNCTION
)
105 /* Service start table */
107 typedef struct _SERVICE_TABLE_ENTRYA
{
109 LPSERVICE_MAIN_FUNCTIONA lpServiceProc
;
110 } SERVICE_TABLE_ENTRYA
, *LPSERVICE_TABLE_ENTRYA
;
112 typedef struct _SERVICE_TABLE_ENTRYW
{
113 LPWSTR lpServiceName
;
114 LPSERVICE_MAIN_FUNCTIONW lpServiceProc
;
115 } SERVICE_TABLE_ENTRYW
, *LPSERVICE_TABLE_ENTRYW
;
117 DECL_WINELIB_TYPE_AW(SERVICE_TABLE_ENTRY
)
118 DECL_WINELIB_TYPE_AW(LPSERVICE_TABLE_ENTRY
)
120 /* Service status enumeration structure */
122 typedef struct _ENUM_SERVICE_STATUSA
{
125 SERVICE_STATUS ServiceStatus
;
126 } ENUM_SERVICE_STATUSA
, *LPENUM_SERVICE_STATUSA
;
128 typedef struct _ENUM_SERVICE_STATUSW
{
129 LPWSTR lpServiceName
;
130 LPWSTR lpDisplayName
;
131 SERVICE_STATUS ServiceStatus
;
132 } ENUM_SERVICE_STATUSW
, *LPENUM_SERVICE_STATUSW
;
134 DECL_WINELIB_TYPE_AW(ENUM_SERVICE_STATUS
)
135 DECL_WINELIB_TYPE_AW(LPENUM_SERVICE_STATUS
)
137 /* Service control handler function prototype */
139 typedef VOID (WINAPI
*LPHANDLER_FUNCTION
)(DWORD
);
141 /* API function prototypes */
143 BOOL WINAPI
CloseServiceHandle(SC_HANDLE
);
144 BOOL WINAPI
ControlService(SC_HANDLE
,DWORD
,LPSERVICE_STATUS
);
145 SC_HANDLE WINAPI
CreateServiceA(SC_HANDLE
,LPCSTR
,LPCSTR
,DWORD
,DWORD
,DWORD
,DWORD
,LPCSTR
,
146 LPCSTR
,LPDWORD
,LPCSTR
,LPCSTR
,LPCSTR
);
147 SC_HANDLE WINAPI
CreateServiceW(SC_HANDLE
,LPCWSTR
,LPCWSTR
,DWORD
,DWORD
,DWORD
,DWORD
,LPCWSTR
,
148 LPCWSTR
,LPDWORD
,LPCWSTR
,LPCWSTR
,LPCWSTR
);
149 #define CreateService WINELIB_NAME_AW(CreateService)
150 BOOL WINAPI
DeleteService(SC_HANDLE
);
151 BOOL WINAPI
EnumServicesStatusA(SC_HANDLE
,DWORD
,DWORD
,LPENUM_SERVICE_STATUSA
,
152 DWORD
,LPDWORD
,LPDWORD
,LPDWORD
);
153 BOOL WINAPI
EnumServicesStatusW(SC_HANDLE
,DWORD
,DWORD
,LPENUM_SERVICE_STATUSW
,
154 DWORD
,LPDWORD
,LPDWORD
,LPDWORD
);
155 #define EnumServicesStatus WINELIB_NAME_AW(EnumServicesStatus)
156 SC_HANDLE WINAPI
OpenSCManagerA(LPCSTR
,LPCSTR
,DWORD
);
157 SC_HANDLE WINAPI
OpenSCManagerW(LPCWSTR
,LPCWSTR
,DWORD
);
158 #define OpenSCManager WINELIB_NAME_AW(OpenSCManager)
159 SC_HANDLE WINAPI
OpenServiceA(SC_HANDLE
,LPCSTR
,DWORD
);
160 SC_HANDLE WINAPI
OpenServiceW(SC_HANDLE
,LPCWSTR
,DWORD
);
161 #define OpenService WINELIB_NAME_AW(OpenService)
162 SERVICE_STATUS_HANDLE WINAPI
RegisterServiceCtrlHandlerA(LPCSTR
,LPHANDLER_FUNCTION
);
163 SERVICE_STATUS_HANDLE WINAPI
RegisterServiceCtrlHandlerW(LPCWSTR
,LPHANDLER_FUNCTION
);
164 #define RegisterServiceCtrlHandler WINELIB_NAME_AW(RegisterServiceCtrlHandler)
165 BOOL WINAPI
SetServiceStatus(SERVICE_STATUS_HANDLE
,LPSERVICE_STATUS
);
166 BOOL WINAPI
StartServiceA(SC_HANDLE
,DWORD
,LPCSTR
*);
167 BOOL WINAPI
StartServiceW(SC_HANDLE
,DWORD
,LPCWSTR
*);
168 #define StartService WINELIB_NAME_AW(StartService)
169 BOOL WINAPI
StartServiceCtrlDispatcherA(LPSERVICE_TABLE_ENTRYA
);
170 BOOL WINAPI
StartServiceCtrlDispatcherW(LPSERVICE_TABLE_ENTRYW
);
171 #define StartServiceCtrlDispatcher WINELIB_NAME_AW(StartServiceCtrlDispatcher)
172 BOOL WINAPI
QueryServiceStatus(SC_HANDLE
,LPSERVICE_STATUS
);
176 #endif /* defined(__cplusplus) */
178 #endif /* !defined(__WINE_WINSVC_H) */