Implemented GetCPInfoExA/W.
[wine/hacks.git] / include / winsvc.h
blob963a883a91a8f01cb4f6c83ae83af4eebab1d0d7
1 /*
2 * Copyright (C) the Wine project
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #ifndef __WINE_WINSVC_H
20 #define __WINE_WINSVC_H
22 #ifdef __cplusplus
23 extern "C" {
24 #endif /* defined(__cplusplus) */
26 /* Controls */
27 #define SERVICE_CONTROL_STOP 0x00000001
28 #define SERVICE_CONTROL_PAUSE 0x00000002
29 #define SERVICE_CONTROL_CONTINUE 0x00000003
30 #define SERVICE_CONTROL_INTERROGATE 0x00000004
31 #define SERVICE_CONTROL_SHUTDOWN 0x00000005
32 #define SERVICE_CONTROL_PARAMCHANGE 0x00000006
33 #define SERVICE_CONTROL_NETBINDADD 0x00000007
34 #define SERVICE_CONTROL_NETBINDREMOVE 0x00000008
35 #define SERVICE_CONTROL_NETBINDENABLE 0x00000009
36 #define SERVICE_CONTROL_NETBINDDISABLE 0x0000000A
37 #define SERVICE_CONTROL_DEVICEEVENT 0x0000000B
38 #define SERVICE_CONTROL_HARDWAREPROFILECHANGE 0x0000000C
39 #define SERVICE_CONTROL_POWEREVENT 0x0000000D
41 /* Service State */
42 #define SERVICE_STOPPED 0x00000001
43 #define SERVICE_START_PENDING 0x00000002
44 #define SERVICE_STOP_PENDING 0x00000003
45 #define SERVICE_RUNNING 0x00000004
46 #define SERVICE_CONTINUE_PENDING 0x00000005
47 #define SERVICE_PAUSE_PENDING 0x00000006
48 #define SERVICE_PAUSED 0x00000007
50 /* Controls Accepted */
51 #define SERVICE_ACCEPT_STOP 0x00000001
52 #define SERVICE_ACCEPT_PAUSE_CONTINUE 0x00000002
53 #define SERVICE_ACCEPT_SHUTDOWN 0x00000004
54 #define SERVICE_ACCEPT_PARAMCHANGE 0x00000008
55 #define SERVICE_ACCEPT_NETBINDCHANGE 0x00000010
56 #define SERVICE_ACCEPT_HARDWAREPROFILECHANGE 0x00000020
57 #define SERVICE_ACCEPT_POWEREVENT 0x00000040
59 /* Service Control Manager Object access types */
60 #define SC_MANAGER_CONNECT 0x0001
61 #define SC_MANAGER_CREATE_SERVICE 0x0002
62 #define SC_MANAGER_ENUMERATE_SERVICE 0x0004
63 #define SC_MANAGER_LOCK 0x0008
64 #define SC_MANAGER_QUERY_LOCK_STATUS 0x0010
65 #define SC_MANAGER_MODIFY_BOOT_CONFIG 0x0020
66 #define SC_MANAGER_ALL_ACCESS ( STANDARD_RIGHTS_REQUIRED | \
67 SC_MANAGER_CONNECT | \
68 SC_MANAGER_CREATE_SERVICE | \
69 SC_MANAGER_ENUMERATE_SERVICE | \
70 SC_MANAGER_LOCK | \
71 SC_MANAGER_QUERY_LOCK_STATUS | \
72 SC_MANAGER_MODIFY_BOOT_CONFIG )
74 #define SERVICE_QUERY_CONFIG 0x0001
75 #define SERVICE_CHANGE_CONFIG 0x0002
76 #define SERVICE_QUERY_STATUS 0x0004
77 #define SERVICE_ENUMERATE_DEPENDENTS 0x0008
78 #define SERVICE_START 0x0010
79 #define SERVICE_STOP 0x0020
80 #define SERVICE_PAUSE_CONTINUE 0x0040
81 #define SERVICE_INTERROGATE 0x0080
82 #define SERVICE_USER_DEFINED_CONTROL 0x0100
84 #define SERVICE_ALL_ACCESS ( STANDARD_RIGHTS_REQUIRED | \
85 SERVICE_QUERY_CONFIG | \
86 SERVICE_CHANGE_CONFIG | \
87 SERVICE_QUERY_STATUS | \
88 SERVICE_ENUMERATE_DEPENDENTS | \
89 SERVICE_START | \
90 SERVICE_STOP | \
91 SERVICE_PAUSE_CONTINUE | \
92 SERVICE_INTERROGATE | \
93 SERVICE_USER_DEFINED_CONTROL )
97 /* Handle types */
99 typedef HANDLE SC_HANDLE, *LPSC_HANDLE;
100 typedef DWORD SERVICE_STATUS_HANDLE;
103 /* Service status structure */
105 typedef struct _SERVICE_STATUS {
106 DWORD dwServiceType;
107 DWORD dwCurrentState;
108 DWORD dwControlsAccepted;
109 DWORD dwWin32ExitCode;
110 DWORD dwServiceSpecificExitCode;
111 DWORD dwCheckPoint;
112 DWORD dwWaitHint;
113 } SERVICE_STATUS, *LPSERVICE_STATUS;
115 typedef enum _SC_STATUS_TYPE {
116 SC_STATUS_PROCESS_INFO = 0
117 } SC_STATUS_TYPE;
119 /* Service main function prototype */
121 typedef VOID (CALLBACK *LPSERVICE_MAIN_FUNCTIONA)(DWORD,LPSTR*);
122 typedef VOID (CALLBACK *LPSERVICE_MAIN_FUNCTIONW)(DWORD,LPWSTR*);
123 DECL_WINELIB_TYPE_AW(LPSERVICE_MAIN_FUNCTION)
125 /* Service start table */
127 typedef struct _SERVICE_TABLE_ENTRYA {
128 LPSTR lpServiceName;
129 LPSERVICE_MAIN_FUNCTIONA lpServiceProc;
130 } SERVICE_TABLE_ENTRYA, *LPSERVICE_TABLE_ENTRYA;
132 typedef struct _SERVICE_TABLE_ENTRYW {
133 LPWSTR lpServiceName;
134 LPSERVICE_MAIN_FUNCTIONW lpServiceProc;
135 } SERVICE_TABLE_ENTRYW, *LPSERVICE_TABLE_ENTRYW;
137 DECL_WINELIB_TYPE_AW(SERVICE_TABLE_ENTRY)
138 DECL_WINELIB_TYPE_AW(LPSERVICE_TABLE_ENTRY)
140 /* Service status enumeration structure */
142 typedef struct _ENUM_SERVICE_STATUSA {
143 LPSTR lpServiceName;
144 LPSTR lpDisplayName;
145 SERVICE_STATUS ServiceStatus;
146 } ENUM_SERVICE_STATUSA, *LPENUM_SERVICE_STATUSA;
148 typedef struct _ENUM_SERVICE_STATUSW {
149 LPWSTR lpServiceName;
150 LPWSTR lpDisplayName;
151 SERVICE_STATUS ServiceStatus;
152 } ENUM_SERVICE_STATUSW, *LPENUM_SERVICE_STATUSW;
154 DECL_WINELIB_TYPE_AW(ENUM_SERVICE_STATUS)
155 DECL_WINELIB_TYPE_AW(LPENUM_SERVICE_STATUS)
157 /* Service control handler function prototype */
159 typedef VOID (WINAPI *LPHANDLER_FUNCTION)(DWORD);
161 /* API function prototypes */
163 BOOL WINAPI CloseServiceHandle(SC_HANDLE);
164 BOOL WINAPI ControlService(SC_HANDLE,DWORD,LPSERVICE_STATUS);
165 SC_HANDLE WINAPI CreateServiceA(SC_HANDLE,LPCSTR,LPCSTR,DWORD,DWORD,DWORD,DWORD,LPCSTR,
166 LPCSTR,LPDWORD,LPCSTR,LPCSTR,LPCSTR);
167 SC_HANDLE WINAPI CreateServiceW(SC_HANDLE,LPCWSTR,LPCWSTR,DWORD,DWORD,DWORD,DWORD,LPCWSTR,
168 LPCWSTR,LPDWORD,LPCWSTR,LPCWSTR,LPCWSTR);
169 #define CreateService WINELIB_NAME_AW(CreateService)
170 BOOL WINAPI DeleteService(SC_HANDLE);
171 BOOL WINAPI EnumServicesStatusA(SC_HANDLE,DWORD,DWORD,LPENUM_SERVICE_STATUSA,
172 DWORD,LPDWORD,LPDWORD,LPDWORD);
173 BOOL WINAPI EnumServicesStatusW(SC_HANDLE,DWORD,DWORD,LPENUM_SERVICE_STATUSW,
174 DWORD,LPDWORD,LPDWORD,LPDWORD);
175 #define EnumServicesStatus WINELIB_NAME_AW(EnumServicesStatus)
176 SC_HANDLE WINAPI OpenSCManagerA(LPCSTR,LPCSTR,DWORD);
177 SC_HANDLE WINAPI OpenSCManagerW(LPCWSTR,LPCWSTR,DWORD);
178 #define OpenSCManager WINELIB_NAME_AW(OpenSCManager)
179 SC_HANDLE WINAPI OpenServiceA(SC_HANDLE,LPCSTR,DWORD);
180 SC_HANDLE WINAPI OpenServiceW(SC_HANDLE,LPCWSTR,DWORD);
181 #define OpenService WINELIB_NAME_AW(OpenService)
182 SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandlerA(LPCSTR,LPHANDLER_FUNCTION);
183 SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandlerW(LPCWSTR,LPHANDLER_FUNCTION);
184 #define RegisterServiceCtrlHandler WINELIB_NAME_AW(RegisterServiceCtrlHandler)
185 BOOL WINAPI SetServiceStatus(SERVICE_STATUS_HANDLE,LPSERVICE_STATUS);
186 BOOL WINAPI StartServiceA(SC_HANDLE,DWORD,LPCSTR*);
187 BOOL WINAPI StartServiceW(SC_HANDLE,DWORD,LPCWSTR*);
188 #define StartService WINELIB_NAME_AW(StartService)
189 BOOL WINAPI StartServiceCtrlDispatcherA(LPSERVICE_TABLE_ENTRYA);
190 BOOL WINAPI StartServiceCtrlDispatcherW(LPSERVICE_TABLE_ENTRYW);
191 #define StartServiceCtrlDispatcher WINELIB_NAME_AW(StartServiceCtrlDispatcher)
192 BOOL WINAPI QueryServiceStatus(SC_HANDLE,LPSERVICE_STATUS);
193 BOOL WINAPI QueryServiceStatusEx(SC_HANDLE,SC_STATUS_TYPE,LPBYTE,DWORD,LPDWORD);
194 #ifdef __cplusplus
195 } /* extern "C" */
196 #endif /* defined(__cplusplus) */
198 #endif /* !defined(__WINE_WINSVC_H) */