2 * svcctl interface definitions - exported by services.exe to access the
5 * Copyright 2007 Google (Mikolaj Zalewski)
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
25 * some defined for the C code
27 cpp_quote("#include \"winsvc.h\"")
28 cpp_quote("#define SVCCTL_TRANSPORT {'n','c','a','c','n','_','n','p',0}")
29 cpp_quote("#define SVCCTL_ENDPOINT {'\\\\','p','i','p','e','\\\\','s','v','c','c','t','l',0}")
31 /* Not the Windows event name - if needed the true one can be found in Inside Windows */
32 cpp_quote("#define SVCCTL_STARTED_EVENT {'_','_','w','i','n','e','_','S','v','c','c','t','l','S','t','a','r','t','e','d',0}")
34 /* Service startup protocol over control pipe - not compatible with Windows */
35 enum service_pipe_command
37 WINESERV_STARTINFO = 1,
38 WINESERV_SENDCONTROL = 2
41 typedef struct service_start_info_t
43 enum service_pipe_command cmd; /* request code */
44 DWORD total_size; /* total request size */
45 DWORD name_size; /* size of name in data buffer */
46 DWORD control; /* control code */
51 uuid(367abb81-9844-35f1-ad32-98f038001003),
53 pointer_default(unique),
54 endpoint("ncacn_np:[\\pipe\\svcctl]")
59 typedef [handle] LPCWSTR MACHINE_HANDLEW;
60 typedef [context_handle] void *SC_RPC_HANDLE;
61 typedef [context_handle] void *SC_RPC_LOCK;
63 /* undocumented access rights */
64 cpp_quote("#define SERVICE_SET_STATUS 0x8000")
66 cpp_quote("#if 0 /* already defined in winsvc.h */")
67 typedef struct _QUERY_SERVICE_CONFIGW {
71 [unique] LPWSTR lpBinaryPathName;
72 [unique] LPWSTR lpLoadOrderGroup;
74 [unique] LPWSTR lpDependencies;
75 [unique] LPWSTR lpServiceStartName;
76 [unique] LPWSTR lpDisplayName;
77 } QUERY_SERVICE_CONFIGW, *LPQUERY_SERVICE_CONFIGW;
79 typedef struct _SERVICE_STATUS {
82 DWORD dwControlsAccepted;
83 DWORD dwWin32ExitCode;
84 DWORD dwServiceSpecificExitCode;
87 } SERVICE_STATUS, *LPSERVICE_STATUS;
89 typedef enum _SC_STATUS_TYPE {
90 SC_STATUS_PROCESS_INFO = 0
95 /* Compatible with Windows function 0x00 */
96 DWORD svcctl_CloseServiceHandle(
97 [in,out] SC_RPC_HANDLE *handle
100 /* Compatible with Windows function 0x01 */
101 DWORD svcctl_ControlService(
102 [in] SC_RPC_HANDLE hService,
103 [in] DWORD dwControl,
104 [out] SERVICE_STATUS *lpServiceStatus
107 /* Compatible with Windows function 0x02 */
108 DWORD svcctl_DeleteService(
109 [in] SC_RPC_HANDLE hService
112 /* Compatible with Windows function 0x03 */
113 DWORD svcctl_LockServiceDatabase(
114 [in] SC_RPC_HANDLE hSCManager,
115 [out] SC_RPC_LOCK *phLock
118 /* Not compatible with Windows function 0x04 */
119 DWORD svcctl_QueryServiceObjectSecurity(/* FIXME */);
121 /* Not compatible with Windows function 0x05 */
122 DWORD svcctl_SetServiceObjectSecurity(/* FIXME */);
124 /* Not compatible with Windows function 0x06 */
125 DWORD svcctl_QueryServiceStatus(/* FIXME */);
127 /* Compatible with Windows function 0x07 */
128 DWORD svcctl_SetServiceStatus(
129 [in] SC_RPC_HANDLE hServiceStatus,
130 [in] LPSERVICE_STATUS lpServiceStatus
133 /* Compatible with Windows function 0x08 */
134 DWORD svcctl_UnlockServiceDatabase(
135 [in,out] SC_RPC_LOCK *phLock
138 /* Not compatible with Windows function 0x09 */
139 DWORD svcctl_NotifyBootConfigStatus(/* FIXME */);
141 /* Not compatible with Windows function 0x0a */
142 DWORD svcctl_SCSetServiceBitsW(/* FIXME */);
144 /* Compatible with Windows function 0x0b */
145 DWORD svcctl_ChangeServiceConfigW(
146 [in] SC_RPC_HANDLE hService,
147 [in] DWORD dwServiceType,
148 [in] DWORD dwStartType,
149 [in] DWORD dwErrorControl,
150 [in,unique] LPCWSTR lpBinaryPathName,
151 [in,unique] LPCWSTR lpLoadOrderGroupKey,
152 [in,out,unique] DWORD *lpdwTagId,
153 [in,unique,size_is(dwDependenciesSize)] const BYTE *lpDependencies,
154 [in] DWORD dwDependenciesSize,
155 [in,unique] LPCWSTR lpServiceStartName,
156 [in,unique,size_is(dwPasswordSize)] const BYTE *lpPassword,
157 [in] DWORD dwPasswordSize,
158 [in,unique] LPCWSTR lpDisplayName
161 /* Compatible with Windows function 0x0c */
162 DWORD svcctl_CreateServiceW(
163 [in] SC_RPC_HANDLE hSCManager,
164 [in] LPCWSTR lpServiceName,
165 [in,unique] LPCWSTR lpDisplayName,
166 [in] DWORD dwDesiredAccess,
167 [in] DWORD dwServiceType,
168 [in] DWORD dwStartType,
169 [in] DWORD dwErrorControl,
170 [in] LPCWSTR lpBinaryPathName,
171 [in,unique] LPCWSTR lpLoadOrderGroup,
172 [in,out,unique] DWORD *lpdwTagId,
173 [in,unique,size_is(dwDependenciesSize)] const BYTE *lpDependencies,
174 [in] DWORD dwDependenciesSize,
175 [in,unique] LPCWSTR lpServiceStartName,
176 [in,unique,size_is(dwPasswordSize)] const BYTE *lpPassword,
177 [in] DWORD dwPasswordSize,
178 [out] SC_RPC_HANDLE *phService
181 /* Not compatible with Windows function 0x0d */
182 DWORD svcctl_EnumDependentServicesW(/* FIXME */);
184 /* Not compatible with Windows function 0x0e */
185 DWORD svcctl_EnumServicesStatusW(/* FIXME */);
187 /* Compatible with Windows function 0x0f */
188 DWORD svcctl_OpenSCManagerW(
189 [in,unique] MACHINE_HANDLEW MachineName,
190 [in,unique] LPCWSTR DatabaseName,
191 [in] DWORD dwAccessMask,
192 [out] SC_RPC_HANDLE *handle
195 /* Compatible with Windows function 0x10 */
196 DWORD svcctl_OpenServiceW(
197 [in] SC_RPC_HANDLE hSCManager,
198 [in] LPCWSTR lpServiceName,
199 [in] DWORD dwDesiredAccess,
200 [out] SC_RPC_HANDLE *phService
203 /* Windows function 0x11 must be using a different prototype - not compatible */
204 DWORD svcctl_QueryServiceConfigW(
205 [in] SC_RPC_HANDLE hService,
206 [out] QUERY_SERVICE_CONFIGW *config);
208 /* Not compatible with Windows function 0x12 */
209 DWORD svcctl_QueryServiceLockStatusW(/* FIXME */);
211 /* Untested with Windows function 0x13 */
212 DWORD svcctl_StartServiceW(
213 [in] SC_RPC_HANDLE hService,
214 [in] DWORD dwNumServiceArgs,
215 [in,unique,size_is(dwNumServiceArgs)] LPCWSTR *lpServiceArgVectors
218 /* Compatible with Windows function 0x14 */
219 DWORD svcctl_GetServiceDisplayNameW(
220 [in] SC_RPC_HANDLE hSCManager,
221 [in] LPCWSTR lpServiceName,
222 [out,size_is(cchBufSize)] WCHAR lpBuffer[],
223 [in] DWORD cchBufSize,
224 [out] DWORD *cchLength);
226 /* Compatible with Windows function 0x15 */
227 DWORD svcctl_GetServiceKeyNameW(
228 [in] SC_RPC_HANDLE hSCManager,
229 [in] LPCWSTR lpServiceDisplayName,
230 [out,size_is(cchBufSize)] WCHAR lpBuffer[],
231 [in] DWORD cchBufSize,
232 [out] DWORD *cchLength);
234 /* Not compatible with Windows function 0x16 */
235 DWORD svcctl_SCSetServiceBitsA(/* FIXME */);
237 /* Not compatible with Windows function 0x17 */
238 DWORD svcctl_ChangeServiceConfigA(/* FIXME */);
240 /* Not compatible with Windows function 0x18 */
241 DWORD svcctl_CreateServiceA(/* FIXME */);
243 /* Not compatible with Windows function 0x19 */
244 DWORD svcctl_EnumDependentServicesA(/* FIXME */);
246 /* Not compatible with Windows function 0x1a */
247 DWORD svcctl_EnumServicesStatusA(/* FIXME */);
249 /* Not compatible with Windows function 0x1b */
250 DWORD svcctl_OpenSCManagerA(/* FIXME */);
252 /* Not compatible with Windows function 0x1c */
253 DWORD svcctl_OpenServiceA(/* FIXME */);
255 /* Not compatible with Windows function 0x1d */
256 DWORD svcctl_QueryServiceConfigA(/* FIXME */);
258 /* Not compatible with Windows function 0x1e */
259 DWORD svcctl_QueryServiceLockStatusA(/* FIXME */);
261 /* Not compatible with Windows function 0x1f */
262 DWORD svcctl_StartServiceA(/* FIXME */);
264 /* Not compatible with Windows function 0x20 */
265 DWORD svcctl_GetServiceDisplayNameA(/* FIXME */);
267 /* Not compatible with Windows function 0x21 */
268 DWORD svcctl_GetServiceKeyNameA(/* FIXME */);
270 /* Not compatible with Windows function 0x22 */
271 DWORD svcctl_GetCurrentGroupStateW(/* FIXME */);
273 /* Not compatible with Windows function 0x23 */
274 DWORD svcctl_EnumServiceGroupW(/* FIXME */);
276 /* Not compatible with Windows function 0x24 */
277 DWORD svcctl_ChangeServiceConfig2A(/* FIXME */);
279 /* Not compatible with Windows function 0x25 */
280 DWORD svcctl_ChangeServiceConfig2W(/* FIXME */);
282 /* Not compatible with Windows function 0x26 */
283 DWORD svcctl_QueryServiceConfig2A(/* FIXME */);
285 /* Not compatible with Windows function 0x27 */
286 DWORD svcctl_QueryServiceConfig2W(/* FIXME */);
288 /* Untested with Windows function 0x28 */
289 DWORD svcctl_QueryServiceStatusEx(
290 [in] SC_RPC_HANDLE hService,
291 [in] SC_STATUS_TYPE InfoLevel,
292 [out,size_is(cbBufSize)] BYTE *lpBuffer,
293 [in] DWORD cbBufSize,
294 [out] LPDWORD pcbBytesNeeded