1 | /* $Id: service.cpp,v 1.2 1999-12-19 22:05:40 sandervl Exp $ */
|
---|
2 |
|
---|
3 | /*
|
---|
4 | * Win32 advanced API functions for OS/2
|
---|
5 | *
|
---|
6 | * 1998/06/12
|
---|
7 | *
|
---|
8 | * Copyright 1998 Sander van Leeuwen
|
---|
9 | * Copyright 1998 Patrick Haller
|
---|
10 | *
|
---|
11 | *
|
---|
12 | * NOTE: Uses registry key for service as handle
|
---|
13 | *
|
---|
14 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
15 | *
|
---|
16 | */
|
---|
17 |
|
---|
18 | #include <os2win.h>
|
---|
19 | #include <stdlib.h>
|
---|
20 | #include <stdarg.h>
|
---|
21 | #include <string.h>
|
---|
22 | #include <odinwrap.h>
|
---|
23 | #include "misc.h"
|
---|
24 | #include "advapi32.h"
|
---|
25 | #include "unicode.h"
|
---|
26 | #include "winreg.h"
|
---|
27 | #include <heapstring.h>
|
---|
28 |
|
---|
29 | ODINDEBUGCHANNEL(ADVAPI32-SERVICE)
|
---|
30 |
|
---|
31 | #define SC_HANDLE HANDLE
|
---|
32 | #define SC_LOCK DWORD
|
---|
33 |
|
---|
34 | //*****************************************************************************
|
---|
35 | //TODO: Faster way to checking this
|
---|
36 | //*****************************************************************************
|
---|
37 | BOOL CheckServiceHandle(SC_HANDLE hService)
|
---|
38 | {
|
---|
39 | HKEY keyThisService;
|
---|
40 |
|
---|
41 | if(RegOpenKeyA((HKEY)hService, NULL, &keyThisService) != 0) {
|
---|
42 | return FALSE;
|
---|
43 | }
|
---|
44 | RegCloseKey(keyThisService);
|
---|
45 | return TRUE;
|
---|
46 | }
|
---|
47 | /*****************************************************************************
|
---|
48 | * Name : OpenSCManagerA
|
---|
49 | * Purpose : The OpenSCManager function establishes a connection to the
|
---|
50 | * service control manager on the specified computer and opens the
|
---|
51 | * specified database.
|
---|
52 | * Parameters: LPCSTR lpszMachineName address of machine name string
|
---|
53 | * LPCSTR lpszDatabaseName address of database name string
|
---|
54 | * DWORD fdwDesiredAccess type of access
|
---|
55 | * Variables :
|
---|
56 | * Result :
|
---|
57 | * Remark :
|
---|
58 | * Status : UNTESTED STUB
|
---|
59 | *
|
---|
60 | * Author : SvL
|
---|
61 | *****************************************************************************/
|
---|
62 |
|
---|
63 | SC_HANDLE WIN32API OpenSCManagerA(LPCSTR lpszMachineName,
|
---|
64 | LPCSTR lpszDatabaseName,
|
---|
65 | DWORD fdwDesiredAccess)
|
---|
66 | {
|
---|
67 | dprintf(("ADVAPI32: OpenSCManagerA(%s,%s,%x) not correctly implemented.\n",
|
---|
68 | lpszMachineName,
|
---|
69 | lpszDatabaseName,
|
---|
70 | fdwDesiredAccess));
|
---|
71 |
|
---|
72 | if(!lpszMachineName && !lpszDatabaseName) {
|
---|
73 | HKEY keyServices;
|
---|
74 | if(RegCreateKeyA(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services", &keyServices) != 0) {
|
---|
75 | SetLastError(ERROR_INTERNAL_ERROR);
|
---|
76 | return 0;
|
---|
77 | }
|
---|
78 | return keyServices;
|
---|
79 | }
|
---|
80 | return 0;
|
---|
81 | }
|
---|
82 |
|
---|
83 |
|
---|
84 | /*****************************************************************************
|
---|
85 | * Name : OpenSCManagerW
|
---|
86 | * Purpose : The OpenSCManager function establishes a connection to the
|
---|
87 | * service control manager on the specified computer and opens the
|
---|
88 | * specified database.
|
---|
89 | * Parameters: LPCWSTR lpszMachineName address of machine name string
|
---|
90 | * LPCWSTR lpszDatabaseName address of database name string
|
---|
91 | * DWORD fdwDesiredAccess type of access
|
---|
92 | * Variables :
|
---|
93 | * Result :
|
---|
94 | * Remark :
|
---|
95 | * Status : UNTESTED STUB
|
---|
96 | *
|
---|
97 | * Author : SvL
|
---|
98 | *****************************************************************************/
|
---|
99 |
|
---|
100 | SC_HANDLE WIN32API OpenSCManagerW(LPCWSTR lpszMachineName,
|
---|
101 | LPCWSTR lpszDatabaseName,
|
---|
102 | DWORD fdwDesiredAccess)
|
---|
103 | {
|
---|
104 | LPSTR lpszDataBaseNameA = NULL, lpszMachineNameA = NULL;
|
---|
105 | SC_HANDLE hService;
|
---|
106 |
|
---|
107 | dprintf(("ADVAPI32: OpenSCManagerW(%x,%x,%x) not correctly implemented.\n",
|
---|
108 | lpszMachineName,
|
---|
109 | lpszDatabaseName,
|
---|
110 | fdwDesiredAccess));
|
---|
111 |
|
---|
112 | if(lpszMachineName)
|
---|
113 | lpszMachineNameA = HEAP_strdupWtoA(GetProcessHeap(), 0, lpszMachineName);
|
---|
114 | if(lpszDatabaseName)
|
---|
115 | lpszDataBaseNameA = HEAP_strdupWtoA(GetProcessHeap(), 0, lpszDatabaseName);
|
---|
116 |
|
---|
117 | hService = OpenSCManagerA(lpszMachineNameA, lpszDataBaseNameA, fdwDesiredAccess);
|
---|
118 |
|
---|
119 | if(lpszMachineNameA)
|
---|
120 | HeapFree(GetProcessHeap(), 0, lpszMachineNameA);
|
---|
121 | if(lpszDataBaseNameA)
|
---|
122 | HeapFree(GetProcessHeap(), 0, lpszDataBaseNameA);
|
---|
123 |
|
---|
124 | return hService;
|
---|
125 | }
|
---|
126 |
|
---|
127 |
|
---|
128 | /*****************************************************************************
|
---|
129 | * Name : OpenServiceA
|
---|
130 | * Purpose : The OpenService function opens a handle to an existing service.
|
---|
131 | * Parameters: SC_HANDLE schSCManager handle of service control manager database
|
---|
132 | * LPCSTR lpszServiceName address of name of service to start
|
---|
133 | * DWORD fdwDesiredAccess type of access to service
|
---|
134 | * Variables :
|
---|
135 | * Result :
|
---|
136 | * Remark :
|
---|
137 | * Status : UNTESTED STUB
|
---|
138 | *
|
---|
139 | * Author : SvL
|
---|
140 | *****************************************************************************/
|
---|
141 |
|
---|
142 | SC_HANDLE WIN32API OpenServiceA(SC_HANDLE schSCManager,
|
---|
143 | LPCSTR lpszServiceName,
|
---|
144 | DWORD fdwDesiredAccess)
|
---|
145 | {
|
---|
146 | dprintf(("ADVAPI32: OpenServiceA(%08xh,%s,%08xh) not correctly implemented.\n",
|
---|
147 | schSCManager,
|
---|
148 | lpszServiceName,
|
---|
149 | fdwDesiredAccess));
|
---|
150 |
|
---|
151 | if(CheckServiceHandle(schSCManager) == FALSE) {
|
---|
152 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
153 | return FALSE;
|
---|
154 | }
|
---|
155 |
|
---|
156 | if(lpszServiceName == NULL) {
|
---|
157 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
158 | return 0;
|
---|
159 | }
|
---|
160 | HKEY keyThisService;
|
---|
161 | if(RegOpenKeyA((HKEY)schSCManager, lpszServiceName, &keyThisService) != 0) {
|
---|
162 | SetLastError(ERROR_SERVICE_DOES_NOT_EXIST);
|
---|
163 | return 0;
|
---|
164 | }
|
---|
165 | return keyThisService;
|
---|
166 | }
|
---|
167 |
|
---|
168 |
|
---|
169 | /*****************************************************************************
|
---|
170 | * Name : OpenServiceW
|
---|
171 | * Purpose : The OpenService function opens a handle to an existing service.
|
---|
172 | * Parameters: SC_HANDLE schSCManager handle of service control manager database
|
---|
173 | * LPCWSTR lpszServiceName address of name of service to start
|
---|
174 | * DWORD fdwDesiredAccess type of access to service
|
---|
175 | * Variables :
|
---|
176 | * Result :
|
---|
177 | * Remark :
|
---|
178 | * Status : UNTESTED STUB
|
---|
179 | *
|
---|
180 | * Author : SvL
|
---|
181 | *****************************************************************************/
|
---|
182 |
|
---|
183 | SC_HANDLE WIN32API OpenServiceW(SC_HANDLE schSCManager,
|
---|
184 | LPCWSTR lpszServiceName,
|
---|
185 | DWORD fdwDesiredAccess)
|
---|
186 | {
|
---|
187 | LPSTR lpszServiceNameA = NULL;
|
---|
188 | SC_HANDLE hService;
|
---|
189 |
|
---|
190 | dprintf(("ADVAPI32: OpenServiceW(%08xh,%s,%08xh) not correctly implemented.\n",
|
---|
191 | schSCManager,
|
---|
192 | lpszServiceName,
|
---|
193 | fdwDesiredAccess));
|
---|
194 |
|
---|
195 | if(lpszServiceName == NULL) {
|
---|
196 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
197 | return 0;
|
---|
198 | }
|
---|
199 | lpszServiceNameA = HEAP_strdupWtoA(GetProcessHeap(), 0, lpszServiceName);
|
---|
200 | hService = OpenServiceA(schSCManager, lpszServiceNameA, fdwDesiredAccess);
|
---|
201 | HeapFree(GetProcessHeap(), 0, lpszServiceNameA);
|
---|
202 | return hService;
|
---|
203 | }
|
---|
204 |
|
---|
205 | /*****************************************************************************
|
---|
206 | * Name : QueryServiceConfigA
|
---|
207 | * Purpose : The QueryServiceConfig function retrieves the configuration
|
---|
208 | * parameters of the specified service.
|
---|
209 | * Parameters: SC_HANDLE schService handle of service
|
---|
210 | * LPQUERY_SERVICE_CONFIG lpqscServConfig address of service config. structure
|
---|
211 | * DWORD cbBufSize size of service configuration buffer
|
---|
212 | * LPDWORD lpcbBytesNeeded address of variable for bytes needed
|
---|
213 | * Variables :
|
---|
214 | * Result :
|
---|
215 | * Remark :
|
---|
216 | * Status : UNTESTED STUB
|
---|
217 | *
|
---|
218 | * Author : SvL
|
---|
219 | *****************************************************************************/
|
---|
220 |
|
---|
221 | #define LPQUERY_SERVICE_CONFIG LPVOID
|
---|
222 | BOOL WIN32API QueryServiceConfigA(SC_HANDLE schService,
|
---|
223 | LPQUERY_SERVICE_CONFIG lpqscServConfig,
|
---|
224 | DWORD cbBufSize,
|
---|
225 | LPDWORD lpcbBytesNeeded)
|
---|
226 | {
|
---|
227 | dprintf(("ADVAPI32: QueryServiceConfigA(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
---|
228 | schService,
|
---|
229 | lpqscServConfig,
|
---|
230 | cbBufSize,
|
---|
231 | lpcbBytesNeeded));
|
---|
232 |
|
---|
233 | return (FALSE); /* signal failure */
|
---|
234 | }
|
---|
235 |
|
---|
236 |
|
---|
237 | /*****************************************************************************
|
---|
238 | * Name : QueryServiceConfigW
|
---|
239 | * Purpose : The QueryServiceConfig function retrieves the configuration
|
---|
240 | * parameters of the specified service.
|
---|
241 | * Parameters: SC_HANDLE schService handle of service
|
---|
242 | * LPQUERY_SERVICE_CONFIG lpqscServConfig address of service config. structure
|
---|
243 | * DWORD cbBufSize size of service configuration buffer
|
---|
244 | * LPDWORD lpcbBytesNeeded address of variable for bytes needed
|
---|
245 | * Variables :
|
---|
246 | * Result :
|
---|
247 | * Remark :
|
---|
248 | * Status : UNTESTED STUB
|
---|
249 | *
|
---|
250 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
251 | *****************************************************************************/
|
---|
252 |
|
---|
253 | BOOL WIN32API QueryServiceConfigW(SC_HANDLE schService,
|
---|
254 | LPQUERY_SERVICE_CONFIG lpqscServConfig,
|
---|
255 | DWORD cbBufSize,
|
---|
256 | LPDWORD lpcbBytesNeeded)
|
---|
257 | {
|
---|
258 | dprintf(("ADVAPI32: QueryServiceConfigW(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
---|
259 | schService,
|
---|
260 | lpqscServConfig,
|
---|
261 | cbBufSize,
|
---|
262 | lpcbBytesNeeded));
|
---|
263 |
|
---|
264 | return (FALSE); /* signal failure */
|
---|
265 | }
|
---|
266 |
|
---|
267 |
|
---|
268 | /*****************************************************************************
|
---|
269 | * Name : QueryServiceLockStatusA
|
---|
270 | * Purpose : The QueryServiceLockStatus function retrieves the lock status
|
---|
271 | * of the specified service control manager database.
|
---|
272 | * Parameters: SC_HANDLE schSCManager handle of svc. ctrl. mgr. database
|
---|
273 | * LPQUERY_SERVICE_LOCK_STATUS lpqslsLockStat address of lock status structure
|
---|
274 | * DWORD cbBufSize size of service configuration buffer
|
---|
275 | * LPDWORD lpcbBytesNeeded address of variable for bytes needed
|
---|
276 | * Variables :
|
---|
277 | * Result :
|
---|
278 | * Remark :
|
---|
279 | * Status : UNTESTED STUB
|
---|
280 | *
|
---|
281 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
282 | *****************************************************************************/
|
---|
283 |
|
---|
284 | #define LPQUERY_SERVICE_LOCK_STATUS LPVOID
|
---|
285 | BOOL WIN32API QueryServiceLockStatusA(SC_HANDLE schSCManager,
|
---|
286 | LPQUERY_SERVICE_LOCK_STATUS lpqslsLockStat,
|
---|
287 | DWORD cbBufSize,
|
---|
288 | LPDWORD lpcbBytesNeeded)
|
---|
289 | {
|
---|
290 | dprintf(("ADVAPI32: QueryServiceLockStatusA(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
---|
291 | schSCManager,
|
---|
292 | lpqslsLockStat,
|
---|
293 | cbBufSize,
|
---|
294 | lpcbBytesNeeded));
|
---|
295 |
|
---|
296 | return (FALSE); /* signal failure */
|
---|
297 | }
|
---|
298 |
|
---|
299 |
|
---|
300 | /*****************************************************************************
|
---|
301 | * Name : QueryServiceLockStatusW
|
---|
302 | * Purpose : The QueryServiceLockStatus function retrieves the lock status
|
---|
303 | * of the specified service control manager database.
|
---|
304 | * Parameters: SC_HANDLE schSCManager handle of svc. ctrl. mgr. database
|
---|
305 | * LPQUERY_SERVICE_LOCK_STATUS lpqslsLockStat address of lock status structure
|
---|
306 | * DWORD cbBufSize size of service configuration buffer
|
---|
307 | * LPDWORD lpcbBytesNeeded address of variable for bytes needed
|
---|
308 | * Variables :
|
---|
309 | * Result :
|
---|
310 | * Remark :
|
---|
311 | * Status : UNTESTED STUB
|
---|
312 | *
|
---|
313 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
314 | *****************************************************************************/
|
---|
315 |
|
---|
316 | BOOL WIN32API QueryServiceLockStatusW(SC_HANDLE schSCManager,
|
---|
317 | LPQUERY_SERVICE_LOCK_STATUS lpqslsLockStat,
|
---|
318 | DWORD cbBufSize,
|
---|
319 | LPDWORD lpcbBytesNeeded)
|
---|
320 | {
|
---|
321 | dprintf(("ADVAPI32: QueryServiceLockStatusW(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
---|
322 | schSCManager,
|
---|
323 | lpqslsLockStat,
|
---|
324 | cbBufSize,
|
---|
325 | lpcbBytesNeeded));
|
---|
326 |
|
---|
327 | return (FALSE); /* signal failure */
|
---|
328 | }
|
---|
329 |
|
---|
330 | /*****************************************************************************
|
---|
331 | * Name : QueryServiceObjectSecurity
|
---|
332 | * Purpose : The QueryServiceObjectSecurity function retrieves a copy of the
|
---|
333 | * security descriptor protecting a service object.
|
---|
334 | * Parameters: SC_HANDLE schService handle of service
|
---|
335 | * SECURITY_INFORMATION fdwSecurityInfo type of security information requested
|
---|
336 | * PSECURITY_DESCRIPTOR psdSecurityDesc address of security descriptor
|
---|
337 | * DWORD cbBufSize size of security descriptor buffer
|
---|
338 | * LPDWORD lpcbBytesNeeded address of variable for bytes needed
|
---|
339 | * Variables :
|
---|
340 | * Result :
|
---|
341 | * Remark :
|
---|
342 | * Status : UNTESTED STUB
|
---|
343 | *
|
---|
344 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
345 | *****************************************************************************/
|
---|
346 |
|
---|
347 | BOOL WIN32API QueryServiceObjectSecurity(SC_HANDLE schService,
|
---|
348 | SECURITY_INFORMATION fdwSecurityInfo,
|
---|
349 | PSECURITY_DESCRIPTOR psdSecurityDesc,
|
---|
350 | DWORD cbBufSize,
|
---|
351 | LPDWORD lpcbBytesNeeded)
|
---|
352 | {
|
---|
353 | dprintf(("ADVAPI32: QueryServiceObjectSecurity(%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
---|
354 | schService,
|
---|
355 | fdwSecurityInfo,
|
---|
356 | psdSecurityDesc,
|
---|
357 | cbBufSize,
|
---|
358 | lpcbBytesNeeded));
|
---|
359 |
|
---|
360 | return (FALSE); /* signal failure */
|
---|
361 | }
|
---|
362 |
|
---|
363 |
|
---|
364 | /*****************************************************************************
|
---|
365 | * Name : QueryServiceStatus
|
---|
366 | * Purpose : The QueryServiceStatus function retrieves the current status of
|
---|
367 | * the specified service.
|
---|
368 | * Parameters: SC_HANDLE schService handle of service
|
---|
369 | * LPSERVICE_STATUS lpssServiceStatus address of service status structure
|
---|
370 | * Variables :
|
---|
371 | * Result :
|
---|
372 | * Remark :
|
---|
373 | * Status : UNTESTED STUB
|
---|
374 | *
|
---|
375 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
376 | *****************************************************************************/
|
---|
377 |
|
---|
378 | BOOL WIN32API QueryServiceStatus(SC_HANDLE schService,
|
---|
379 | LPSERVICE_STATUS lpssServiceStatus)
|
---|
380 | {
|
---|
381 | dprintf(("ADVAPI32: QueryServiceStatus(%08xh,%08xh) not correctly implemented.\n",
|
---|
382 | schService,
|
---|
383 | lpssServiceStatus));
|
---|
384 |
|
---|
385 | if(CheckServiceHandle(schService) == FALSE) {
|
---|
386 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
387 | return FALSE;
|
---|
388 | }
|
---|
389 |
|
---|
390 | memset(lpssServiceStatus, 0, sizeof(SERVICE_STATUS));
|
---|
391 | return TRUE;
|
---|
392 | }
|
---|
393 |
|
---|
394 | /*****************************************************************************
|
---|
395 | * Name : SetServiceObjectSecurity
|
---|
396 | * Purpose : The SetServiceObjectSecurity function sets the security
|
---|
397 | * descriptor of a service object.
|
---|
398 | * Parameters: SC_HANDLE schService handle of service
|
---|
399 | * SECURITY_INFORMATION fdwSecurityInfo type of security information requested
|
---|
400 | * PSECURITY_DESCRIPTOR psdSecurityDesc address of security descriptor
|
---|
401 | * Variables :
|
---|
402 | * Result :
|
---|
403 | * Remark :
|
---|
404 | * Status : UNTESTED STUB
|
---|
405 | *
|
---|
406 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
407 | *****************************************************************************/
|
---|
408 |
|
---|
409 | BOOL WIN32API SetServiceObjectSecurity(SC_HANDLE schService,
|
---|
410 | SECURITY_INFORMATION fdwSecurityInfo,
|
---|
411 | PSECURITY_DESCRIPTOR psdSecurityDesc)
|
---|
412 | {
|
---|
413 | dprintf(("ADVAPI32: SetServiceObjectSecurity(%08xh,%08xh,%08xh) not implemented.\n",
|
---|
414 | schService,
|
---|
415 | fdwSecurityInfo,
|
---|
416 | psdSecurityDesc));
|
---|
417 |
|
---|
418 | return (FALSE); /* signal failure */
|
---|
419 | }
|
---|
420 |
|
---|
421 | /*****************************************************************************
|
---|
422 | * Name : ChangeServiceConfigA
|
---|
423 | * Purpose : The ChangeServiceConfig function changes the configuration
|
---|
424 | * parameters of a service.
|
---|
425 | * Parameters: SC_HANDLE hService handle of service
|
---|
426 | * DWORD dwServiceType type of service
|
---|
427 | * DWORD dwStartType when to start service
|
---|
428 | * DWORD dwErrorControl severity if service fails to start
|
---|
429 | * LPCSTR lpBinaryPathName address of service binary file name
|
---|
430 | * LPCSTR lpLoadOrderGroup address of load ordering group name
|
---|
431 | * LPDWORD lpdwTagId address of variable to get tag identifier
|
---|
432 | * LPCSTR lpDependencies address of array of dependency names
|
---|
433 | * LPCSTR lpServiceStartName address of account name of service
|
---|
434 | * LPCSTR lpPassword address of password for service account
|
---|
435 | * LPCSTR lpDisplayName address of display name
|
---|
436 | * Variables :
|
---|
437 | * Result :
|
---|
438 | * Remark :
|
---|
439 | * Status : UNTESTED STUB
|
---|
440 | *
|
---|
441 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
442 | *****************************************************************************/
|
---|
443 |
|
---|
444 | BOOL WIN32API ChangeServiceConfigA(SC_HANDLE hService,
|
---|
445 | DWORD dwServiceType,
|
---|
446 | DWORD dwStartType,
|
---|
447 | DWORD dwErrorControl,
|
---|
448 | LPCSTR lpBinaryPathName,
|
---|
449 | LPCSTR lpLoadOrderGroup,
|
---|
450 | LPDWORD lpdwTagId,
|
---|
451 | LPCSTR lpDependencies,
|
---|
452 | LPCSTR lpServiceStartName,
|
---|
453 | LPCSTR lpPassword,
|
---|
454 | LPCSTR lpDisplayName)
|
---|
455 | {
|
---|
456 | dprintf(("ADVAPI32: ChangeServiceConfigA(%08xh,%08xh,%08xh,%08xh,%s,%s,%08xh,%s,%s,%s,%s) not implemented.\n",
|
---|
457 | hService,
|
---|
458 | dwServiceType,
|
---|
459 | dwStartType,
|
---|
460 | dwErrorControl,
|
---|
461 | lpBinaryPathName,
|
---|
462 | lpLoadOrderGroup,
|
---|
463 | lpdwTagId,
|
---|
464 | lpDependencies,
|
---|
465 | lpServiceStartName,
|
---|
466 | lpPassword,
|
---|
467 | lpDisplayName));
|
---|
468 |
|
---|
469 | return (FALSE); /* signal failure */
|
---|
470 | }
|
---|
471 |
|
---|
472 |
|
---|
473 | /*****************************************************************************
|
---|
474 | * Name : ChangeServiceConfigW
|
---|
475 | * Purpose : The ChangeServiceConfig function changes the configuration
|
---|
476 | * parameters of a service.
|
---|
477 | * Parameters: SC_HANDLE hService handle of service
|
---|
478 | * DWORD dwServiceType type of service
|
---|
479 | * DWORD dwStartType when to start service
|
---|
480 | * DWORD dwErrorControl severity if service fails to start
|
---|
481 | * LPCWSTR lpBinaryPathName address of service binary file name
|
---|
482 | * LPCWSTR lpLoadOrderGroup address of load ordering group name
|
---|
483 | * LPDWORD lpdwTagId address of variable to get tag identifier
|
---|
484 | * LPCWSTR lpDependencies address of array of dependency names
|
---|
485 | * LPCWSTR lpServiceStartName address of account name of service
|
---|
486 | * LPCWSTR lpPassword address of password for service account
|
---|
487 | * LPCWSTR lpDisplayName address of display name
|
---|
488 | * Variables :
|
---|
489 | * Result :
|
---|
490 | * Remark :
|
---|
491 | * Status : UNTESTED STUB
|
---|
492 | *
|
---|
493 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
494 | *****************************************************************************/
|
---|
495 |
|
---|
496 | BOOL WIN32API ChangeServiceConfigW(SC_HANDLE hService,
|
---|
497 | DWORD dwServiceType,
|
---|
498 | DWORD dwStartType,
|
---|
499 | DWORD dwErrorControl,
|
---|
500 | LPCWSTR lpBinaryPathName,
|
---|
501 | LPCWSTR lpLoadOrderGroup,
|
---|
502 | LPDWORD lpdwTagId,
|
---|
503 | LPCWSTR lpDependencies,
|
---|
504 | LPCWSTR lpServiceStartName,
|
---|
505 | LPCWSTR lpPassword,
|
---|
506 | LPCWSTR lpDisplayName)
|
---|
507 | {
|
---|
508 | dprintf(("ADVAPI32: ChangeServiceConfigW(%08xh,%08xh,%08xh,%08xh,%s,%s,%08xh,%s,%s,%s,%s) not implemented.\n",
|
---|
509 | hService,
|
---|
510 | dwServiceType,
|
---|
511 | dwStartType,
|
---|
512 | dwErrorControl,
|
---|
513 | lpBinaryPathName,
|
---|
514 | lpLoadOrderGroup,
|
---|
515 | lpdwTagId,
|
---|
516 | lpDependencies,
|
---|
517 | lpServiceStartName,
|
---|
518 | lpPassword,
|
---|
519 | lpDisplayName));
|
---|
520 |
|
---|
521 | return (FALSE); /* signal failure */
|
---|
522 | }
|
---|
523 |
|
---|
524 |
|
---|
525 | /*****************************************************************************
|
---|
526 | * Name : CloseServiceHandle
|
---|
527 | * Purpose : The CloseServiceHandle function closes a handle to a service
|
---|
528 | * control manager database as returned by the OpenSCManager function,
|
---|
529 | * or it closes a handle to a service object as returned by either
|
---|
530 | * the OpenService or CreateService function.
|
---|
531 | * Parameters: SC_HANDLE hSCObject handle of service or service control manager database
|
---|
532 | * Variables :
|
---|
533 | * Result :
|
---|
534 | * Remark :
|
---|
535 | * Status : UNTESTED STUB
|
---|
536 | *
|
---|
537 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
538 | *****************************************************************************/
|
---|
539 |
|
---|
540 | BOOL WIN32API CloseServiceHandle(SC_HANDLE hSCObject)
|
---|
541 | {
|
---|
542 | dprintf(("ADVAPI32: CloseServiceHandle(%08xh)",
|
---|
543 | hSCObject));
|
---|
544 |
|
---|
545 | if(CheckServiceHandle(hSCObject) == FALSE) {
|
---|
546 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
547 | return FALSE;
|
---|
548 | }
|
---|
549 |
|
---|
550 | RegCloseKey((HKEY)hSCObject);
|
---|
551 | return TRUE;
|
---|
552 | }
|
---|
553 |
|
---|
554 | /*****************************************************************************
|
---|
555 | * Name : ControlService
|
---|
556 | * Purpose : The ControlService function sends a control code to a Win32 service.
|
---|
557 | * Parameters: SC_HANDLE hService handle of service
|
---|
558 | * DWORD dwControl control code
|
---|
559 | * LPSERVICE_STATUS lpServiceStatus address of service status structure
|
---|
560 | * Variables :
|
---|
561 | * Result :
|
---|
562 | * Remark :
|
---|
563 | * Status : UNTESTED STUB
|
---|
564 | *
|
---|
565 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
566 | *****************************************************************************/
|
---|
567 |
|
---|
568 | BOOL WIN32API ControlService(SC_HANDLE hService,
|
---|
569 | DWORD dwControl,
|
---|
570 | LPSERVICE_STATUS lpServiceStatus)
|
---|
571 | {
|
---|
572 | dprintf(("ADVAPI32: ControlService(%08xh,%08xh,%08xh) not correctly implemented.\n",
|
---|
573 | hService,
|
---|
574 | dwControl,
|
---|
575 | lpServiceStatus));
|
---|
576 | HKEY keyThisService;
|
---|
577 |
|
---|
578 | if(CheckServiceHandle(hService) == FALSE) {
|
---|
579 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
580 | return FALSE;
|
---|
581 | }
|
---|
582 | return TRUE;
|
---|
583 | }
|
---|
584 |
|
---|
585 |
|
---|
586 | /*****************************************************************************
|
---|
587 | * Name : CreateServiceA
|
---|
588 | * Purpose : The CreateService function creates a service object and adds it
|
---|
589 | * to the specified service control manager database.
|
---|
590 | * Parameters: SC_HANDLE hSCManager handle of service control manager database
|
---|
591 | * LPCSTR lpServiceName address of name of service to start
|
---|
592 | * LPCSTR lpDisplayName address of display name
|
---|
593 | * DWORD dwDesiredAccess type of access to service
|
---|
594 | * DWORD dwServiceType type of service
|
---|
595 | * DWORD dwStartType when to start service
|
---|
596 | * DWORD dwErrorControl severity if service fails to start
|
---|
597 | * LPCSTR lpBinaryPathName address of name of binary file
|
---|
598 | * LPCSTR lpLoadOrderGroup address of name of load ordering group
|
---|
599 | * LPDWORD lpdwTagId address of variable to get tag identifier
|
---|
600 | * LPCSTR lpDependencies address of array of dependency names
|
---|
601 | * LPCSTR lpServiceStartName address of account name of service
|
---|
602 | * LPCSTR lpPassword address of password for service account
|
---|
603 | * Variables :
|
---|
604 | * Result :
|
---|
605 | * Remark :
|
---|
606 | * Status : UNTESTED STUB
|
---|
607 | *
|
---|
608 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
609 | *****************************************************************************/
|
---|
610 |
|
---|
611 | SC_HANDLE WIN32API CreateServiceA(SC_HANDLE hSCManager,
|
---|
612 | LPCSTR lpServiceName,
|
---|
613 | LPCSTR lpDisplayName,
|
---|
614 | DWORD dwDesiredAccess,
|
---|
615 | DWORD dwServiceType,
|
---|
616 | DWORD dwStartType,
|
---|
617 | DWORD dwErrorControl,
|
---|
618 | LPCSTR lpBinaryPathName,
|
---|
619 | LPCSTR lpLoadOrderGroup,
|
---|
620 | LPDWORD lpdwTagId,
|
---|
621 | LPCSTR lpDependencies,
|
---|
622 | LPCSTR lpServiceStartName,
|
---|
623 | LPCSTR lpPassword)
|
---|
624 | {
|
---|
625 | HKEY keyServices, keyThisService;
|
---|
626 |
|
---|
627 | dprintf(("ADVAPI32: CreateServiceA(%08xh,%s,%s,%08xh,%08xh,%08xh,%08xh,%s,%s,%08xh,%s,%s,%s) not correctly implemented.\n",
|
---|
628 | hSCManager,
|
---|
629 | lpServiceName,
|
---|
630 | lpDisplayName,
|
---|
631 | dwDesiredAccess,
|
---|
632 | dwServiceType,
|
---|
633 | dwStartType,
|
---|
634 | dwErrorControl,
|
---|
635 | lpBinaryPathName,
|
---|
636 | lpLoadOrderGroup,
|
---|
637 | lpdwTagId,
|
---|
638 | lpDependencies,
|
---|
639 | lpServiceStartName,
|
---|
640 | lpPassword));
|
---|
641 |
|
---|
642 | //displayname too?
|
---|
643 | if(lpServiceName == NULL || lpBinaryPathName == NULL) {
|
---|
644 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
645 | return 0;
|
---|
646 | }
|
---|
647 |
|
---|
648 | if(RegCreateKeyA(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services", &keyServices) != 0) {
|
---|
649 | SetLastError(ERROR_INTERNAL_ERROR);
|
---|
650 | return 0;
|
---|
651 | }
|
---|
652 | if(RegCreateKeyA(keyServices, lpServiceName, &keyThisService) != 0) {
|
---|
653 | SetLastError(ERROR_INTERNAL_ERROR);
|
---|
654 | return 0;
|
---|
655 | }
|
---|
656 | RegSetValueExA(keyThisService, "Start", 0, REG_DWORD, (LPBYTE)&dwServiceType, sizeof(DWORD));
|
---|
657 | RegSetValueExA(keyThisService, "Type", 0, REG_DWORD, (LPBYTE)&dwStartType, sizeof(DWORD));
|
---|
658 | RegSetValueExA(keyThisService, "ErrorControl", 0, REG_DWORD, (LPBYTE)&dwErrorControl, sizeof(DWORD));
|
---|
659 | if(lpDisplayName)
|
---|
660 | RegSetValueExA(keyThisService, "DisplayName", 0, REG_SZ, (LPBYTE)lpDisplayName, strlen(lpDisplayName)+1);
|
---|
661 | if(lpLoadOrderGroup)
|
---|
662 | RegSetValueExA(keyThisService, "lpLoadOrderGroup", 0, REG_SZ, (LPBYTE)lpDisplayName, strlen(lpLoadOrderGroup)+1);
|
---|
663 | if(lpLoadOrderGroup)
|
---|
664 | RegSetValueExA(keyThisService, "lpLoadOrderGroup", 0, REG_SZ, (LPBYTE)lpDisplayName, strlen(lpLoadOrderGroup)+1);
|
---|
665 | //TODO: %SystemRoot%
|
---|
666 | RegSetValueExA(keyThisService, "ImagePath", 0, REG_SZ, (LPBYTE)lpBinaryPathName, strlen(lpBinaryPathName)+1);
|
---|
667 |
|
---|
668 | //TODO: What else?
|
---|
669 |
|
---|
670 | RegCloseKey(keyServices);
|
---|
671 | return keyThisService;
|
---|
672 | }
|
---|
673 |
|
---|
674 |
|
---|
675 | /*****************************************************************************
|
---|
676 | * Name : CreateServiceW
|
---|
677 | * Purpose : The CreateService function creates a service object and adds it
|
---|
678 | * to the specified service control manager database.
|
---|
679 | * Parameters: SC_HANDLE hSCManager handle of service control manager database
|
---|
680 | * LPCWSTR lpServiceName address of name of service to start
|
---|
681 | * LPCWSTR lpDisplayName address of display name
|
---|
682 | * DWORD dwDesiredAccess type of access to service
|
---|
683 | * DWORD dwServiceType type of service
|
---|
684 | * DWORD dwStartType when to start service
|
---|
685 | * DWORD dwErrorControl severity if service fails to start
|
---|
686 | * LPCWSTR lpBinaryPathName address of name of binary file
|
---|
687 | * LPCWSTR lpLoadOrderGroup address of name of load ordering group
|
---|
688 | * LPDWORD lpdwTagId address of variable to get tag identifier
|
---|
689 | * LPCWSTR lpDependencies address of array of dependency names
|
---|
690 | * LPCWSTR lpServiceStartName address of account name of service
|
---|
691 | * LPCWSTR lpPassword address of password for service account
|
---|
692 | * Variables :
|
---|
693 | * Result :
|
---|
694 | * Remark :
|
---|
695 | * Status : UNTESTED STUB
|
---|
696 | *
|
---|
697 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
698 | *****************************************************************************/
|
---|
699 |
|
---|
700 | SC_HANDLE WIN32API CreateServiceW(SC_HANDLE hSCManager,
|
---|
701 | LPCWSTR lpServiceName,
|
---|
702 | LPCWSTR lpDisplayName,
|
---|
703 | DWORD dwDesiredAccess,
|
---|
704 | DWORD dwServiceType,
|
---|
705 | DWORD dwStartType,
|
---|
706 | DWORD dwErrorControl,
|
---|
707 | LPCWSTR lpBinaryPathName,
|
---|
708 | LPCWSTR lpLoadOrderGroup,
|
---|
709 | LPDWORD lpdwTagId,
|
---|
710 | LPCWSTR lpDependencies,
|
---|
711 | LPCWSTR lpServiceStartName,
|
---|
712 | LPCWSTR lpPassword)
|
---|
713 | {
|
---|
714 | LPSTR lpServiceNameA = NULL, lpDisplayNameA = NULL, lpBinaryPathNameA = NULL;
|
---|
715 | LPSTR lpDependenciesA = NULL, lpServiceStartNameA = NULL, lpPasswordA = NULL;
|
---|
716 | LPSTR lpLoadOrderGroupA = NULL;
|
---|
717 | SC_HANDLE hService;
|
---|
718 |
|
---|
719 | dprintf(("ADVAPI32: CreateServiceW(%08xh,%s,%s,%08xh,%08xh,%08xh,%08xh,%s,%s,%08xh,%s,%s,%s) not correctly implemented.\n",
|
---|
720 | hSCManager,
|
---|
721 | lpServiceName,
|
---|
722 | lpDisplayName,
|
---|
723 | dwDesiredAccess,
|
---|
724 | dwServiceType,
|
---|
725 | dwStartType,
|
---|
726 | dwErrorControl,
|
---|
727 | lpBinaryPathName,
|
---|
728 | lpLoadOrderGroup,
|
---|
729 | lpdwTagId,
|
---|
730 | lpDependencies,
|
---|
731 | lpServiceStartName,
|
---|
732 | lpPassword));
|
---|
733 |
|
---|
734 | if(lpServiceName)
|
---|
735 | lpServiceNameA = HEAP_strdupWtoA(GetProcessHeap(), 0, lpServiceName);
|
---|
736 | if(lpDisplayName)
|
---|
737 | lpDisplayNameA = HEAP_strdupWtoA(GetProcessHeap(), 0, lpDisplayName);
|
---|
738 | if(lpBinaryPathName)
|
---|
739 | lpBinaryPathNameA = HEAP_strdupWtoA(GetProcessHeap(), 0, lpBinaryPathName);
|
---|
740 | if(lpDependencies)
|
---|
741 | lpDependenciesA = HEAP_strdupWtoA(GetProcessHeap(), 0, lpDependencies);
|
---|
742 | if(lpServiceStartName)
|
---|
743 | lpServiceStartNameA = HEAP_strdupWtoA(GetProcessHeap(), 0, lpServiceStartName);
|
---|
744 | if(lpPassword)
|
---|
745 | lpPasswordA = HEAP_strdupWtoA(GetProcessHeap(), 0, lpPassword);
|
---|
746 | if(lpDisplayName)
|
---|
747 | lpDisplayNameA = HEAP_strdupWtoA(GetProcessHeap(), 0, lpDisplayName);
|
---|
748 | if(lpLoadOrderGroup)
|
---|
749 | lpLoadOrderGroupA = HEAP_strdupWtoA(GetProcessHeap(), 0, lpLoadOrderGroup);
|
---|
750 |
|
---|
751 | hService = CreateServiceA(hSCManager,lpServiceNameA, lpDisplayNameA,
|
---|
752 | dwDesiredAccess, dwServiceType, dwStartType,
|
---|
753 | dwErrorControl, lpBinaryPathNameA, lpLoadOrderGroupA,
|
---|
754 | lpdwTagId, lpDependenciesA, lpServiceStartNameA,
|
---|
755 | lpPasswordA);
|
---|
756 |
|
---|
757 | if(lpServiceNameA) HeapFree(GetProcessHeap(), 0, lpServiceNameA);
|
---|
758 | if(lpDisplayNameA) HeapFree(GetProcessHeap(), 0, lpDisplayNameA);
|
---|
759 | if(lpBinaryPathNameA) HeapFree(GetProcessHeap(), 0, lpBinaryPathNameA);
|
---|
760 | if(lpDependenciesA) HeapFree(GetProcessHeap(), 0, lpDependenciesA);
|
---|
761 | if(lpServiceStartNameA) HeapFree(GetProcessHeap(), 0, lpServiceStartNameA);
|
---|
762 | if(lpPasswordA) HeapFree(GetProcessHeap(), 0, lpPasswordA);
|
---|
763 | if(lpLoadOrderGroupA) HeapFree(GetProcessHeap(), 0, lpLoadOrderGroupA);
|
---|
764 |
|
---|
765 | return hService;
|
---|
766 | }
|
---|
767 |
|
---|
768 | /*****************************************************************************
|
---|
769 | * Name : DeleteService
|
---|
770 | * Purpose : The DeleteService function marks the specified service for
|
---|
771 | * deletion from the service control manager database.
|
---|
772 | * Parameters: SC_HANDLE hService handle of service
|
---|
773 | * Variables :
|
---|
774 | * Result :
|
---|
775 | * Remark :
|
---|
776 | * Status : UNTESTED STUB
|
---|
777 | *
|
---|
778 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
779 | *****************************************************************************/
|
---|
780 |
|
---|
781 | BOOL WIN32API DeleteService(SC_HANDLE hService)
|
---|
782 | {
|
---|
783 | dprintf(("ADVAPI32: DeleteService(%08xh) not implemented.\n",
|
---|
784 | hService));
|
---|
785 |
|
---|
786 | return FALSE;
|
---|
787 | }
|
---|
788 |
|
---|
789 | /*****************************************************************************
|
---|
790 | * Name : EnumDependentServicesA
|
---|
791 | * Purpose : The EnumDependentServices function enumerates services that
|
---|
792 | * depend on another specified service; that is, the specified
|
---|
793 | * service must be running before the enumerated services can run.
|
---|
794 | * The name and status of each dependent service are provided.
|
---|
795 | * Parameters: SC_HANDLE hService handle of service
|
---|
796 | * DWORD dwServiceState state of services to enumerate
|
---|
797 | * LPENUM_SERVICE_STATUS lpServices address of service status buffer
|
---|
798 | * DWORD cbBufSize size of service status buffer
|
---|
799 | * LPDWORD pcbBytesNeeded address of variable for bytes needed
|
---|
800 | * LPDWORD lpServicesReturned address of variable for number returned
|
---|
801 | * Variables :
|
---|
802 | * Result :
|
---|
803 | * Remark :
|
---|
804 | * Status : UNTESTED STUB
|
---|
805 | *
|
---|
806 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
807 | *****************************************************************************/
|
---|
808 |
|
---|
809 | #define LPENUM_SERVICE_STATUS LPVOID
|
---|
810 | BOOL WIN32API EnumDependentServicesA(SC_HANDLE hService,
|
---|
811 | DWORD dwServiceState,
|
---|
812 | LPENUM_SERVICE_STATUS lpServices,
|
---|
813 | DWORD cbBufSize,
|
---|
814 | LPDWORD pcbBytesNeeded,
|
---|
815 | LPDWORD lpServicesReturned)
|
---|
816 | {
|
---|
817 | dprintf(("ADVAPI32: EnumDependentServicesA(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
---|
818 | hService,
|
---|
819 | dwServiceState,
|
---|
820 | lpServices,
|
---|
821 | cbBufSize,
|
---|
822 | pcbBytesNeeded,
|
---|
823 | lpServicesReturned));
|
---|
824 |
|
---|
825 | return (FALSE); /* signal failure */
|
---|
826 | }
|
---|
827 |
|
---|
828 |
|
---|
829 | /*****************************************************************************
|
---|
830 | * Name : EnumDependentServicesW
|
---|
831 | * Purpose : The EnumDependentServices function enumerates services that
|
---|
832 | * depend on another specified service; that is, the specified
|
---|
833 | * service must be running before the enumerated services can run.
|
---|
834 | * The name and status of each dependent service are provided.
|
---|
835 | * Parameters: SC_HANDLE hService handle of service
|
---|
836 | * DWORD dwServiceState state of services to enumerate
|
---|
837 | * LPENUM_SERVICE_STATUS lpServices address of service status buffer
|
---|
838 | * DWORD cbBufSize size of service status buffer
|
---|
839 | * LPDWORD pcbBytesNeeded address of variable for bytes needed
|
---|
840 | * LPDWORD lpServicesReturned address of variable for number returned
|
---|
841 | * Variables :
|
---|
842 | * Result :
|
---|
843 | * Remark :
|
---|
844 | * Status : UNTESTED STUB
|
---|
845 | *
|
---|
846 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
847 | *****************************************************************************/
|
---|
848 |
|
---|
849 | BOOL WIN32API EnumDependentServicesW(SC_HANDLE hService,
|
---|
850 | DWORD dwServiceState,
|
---|
851 | LPENUM_SERVICE_STATUS lpServices,
|
---|
852 | DWORD cbBufSize,
|
---|
853 | LPDWORD pcbBytesNeeded,
|
---|
854 | LPDWORD lpServicesReturned)
|
---|
855 | {
|
---|
856 | dprintf(("ADVAPI32: EnumDependentServicesW(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
---|
857 | hService,
|
---|
858 | dwServiceState,
|
---|
859 | lpServices,
|
---|
860 | cbBufSize,
|
---|
861 | pcbBytesNeeded,
|
---|
862 | lpServicesReturned));
|
---|
863 |
|
---|
864 | return (FALSE); /* signal failure */
|
---|
865 | }
|
---|
866 |
|
---|
867 |
|
---|
868 | /*****************************************************************************
|
---|
869 | * Name : EnumServicesStatusA
|
---|
870 | * Purpose : The EnumServicesStatus function enumerates services in the specified
|
---|
871 | * service control manager database. The name and status of each service are provided.
|
---|
872 | * Parameters: SC_HANDLE hSCManager handle of service control manager database
|
---|
873 | * DWORD dwServiceType type of services to enumerate
|
---|
874 | * DWORD dwServiceState state of services to enumerate
|
---|
875 | * LPENUM_SERVICE_STATUS lpServices address of service status buffer
|
---|
876 | * DWORD cbBufSize size of service status buffer
|
---|
877 | * LPDWORD pcbBytesNeeded address of variable for bytes needed
|
---|
878 | * LPDWORD lpServicesReturned address of variable for number returned
|
---|
879 | * LPDWORD lpResumeHandle address of variable for next entry
|
---|
880 | * Variables :
|
---|
881 | * Result :
|
---|
882 | * Remark :
|
---|
883 | * Status : UNTESTED STUB
|
---|
884 | *
|
---|
885 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
886 | *****************************************************************************/
|
---|
887 |
|
---|
888 | BOOL WIN32API EnumServicesStatusA(SC_HANDLE hSCManager,
|
---|
889 | DWORD dwServiceType,
|
---|
890 | DWORD dwServiceState,
|
---|
891 | LPENUM_SERVICE_STATUS lpServices,
|
---|
892 | DWORD cbBufSize,
|
---|
893 | LPDWORD pcbBytesNeeded,
|
---|
894 | LPDWORD lpServicesReturned,
|
---|
895 | LPDWORD lpResumeHandle)
|
---|
896 | {
|
---|
897 | dprintf(("ADVAPI32: EnumServicesStatusA(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
---|
898 | hSCManager,
|
---|
899 | dwServiceType,
|
---|
900 | dwServiceState,
|
---|
901 | lpServices,
|
---|
902 | cbBufSize,
|
---|
903 | pcbBytesNeeded,
|
---|
904 | lpServicesReturned,
|
---|
905 | lpResumeHandle));
|
---|
906 |
|
---|
907 | return (FALSE); /* signal failure */
|
---|
908 | }
|
---|
909 |
|
---|
910 |
|
---|
911 | /*****************************************************************************
|
---|
912 | * Name : EnumServicesStatusW
|
---|
913 | * Purpose : The EnumServicesStatus function enumerates services in the specified
|
---|
914 | * service control manager database. The name and status of each service are provided.
|
---|
915 | * Parameters: SC_HANDLE hSCManager handle of service control manager database
|
---|
916 | * DWORD dwServiceType type of services to enumerate
|
---|
917 | * DWORD dwServiceState state of services to enumerate
|
---|
918 | * LPENUM_SERVICE_STATUS lpServices address of service status buffer
|
---|
919 | * DWORD cbBufSize size of service status buffer
|
---|
920 | * LPDWORD pcbBytesNeeded address of variable for bytes needed
|
---|
921 | * LPDWORD lpServicesReturned address of variable for number returned
|
---|
922 | * LPDWORD lpResumeHandle address of variable for next entry
|
---|
923 | * Variables :
|
---|
924 | * Result :
|
---|
925 | * Remark :
|
---|
926 | * Status : UNTESTED STUB
|
---|
927 | *
|
---|
928 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
929 | *****************************************************************************/
|
---|
930 |
|
---|
931 | BOOL WIN32API EnumServicesStatusW(SC_HANDLE hSCManager,
|
---|
932 | DWORD dwServiceType,
|
---|
933 | DWORD dwServiceState,
|
---|
934 | LPENUM_SERVICE_STATUS lpServices,
|
---|
935 | DWORD cbBufSize,
|
---|
936 | LPDWORD pcbBytesNeeded,
|
---|
937 | LPDWORD lpServicesReturned,
|
---|
938 | LPDWORD lpResumeHandle)
|
---|
939 | {
|
---|
940 | dprintf(("ADVAPI32: EnumServicesStatusW(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
---|
941 | hSCManager,
|
---|
942 | dwServiceType,
|
---|
943 | dwServiceState,
|
---|
944 | lpServices,
|
---|
945 | cbBufSize,
|
---|
946 | pcbBytesNeeded,
|
---|
947 | lpServicesReturned,
|
---|
948 | lpResumeHandle));
|
---|
949 |
|
---|
950 | return (FALSE); /* signal failure */
|
---|
951 | }
|
---|
952 |
|
---|
953 | /*****************************************************************************
|
---|
954 | * Name : GetServiceDisplayNameA
|
---|
955 | * Purpose : The GetServiceDisplayName function obtains the display name that
|
---|
956 | * is associated with a particular service name. The service name
|
---|
957 | * is the same as the service's registry key name.
|
---|
958 | * Parameters: SC_HANDLE hSCManager handle to a service control manager database
|
---|
959 | * LPCSTR lpServiceName the service name
|
---|
960 | * LPTSTR lpDisplayName buffer to receive the service's display name
|
---|
961 | * LPDWORD lpcchBuffer size of display name buffer and display name
|
---|
962 | * Variables :
|
---|
963 | * Result :
|
---|
964 | * Remark :
|
---|
965 | * Status : UNTESTED STUB
|
---|
966 | *
|
---|
967 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
968 | *****************************************************************************/
|
---|
969 |
|
---|
970 | BOOL WIN32API GetServiceDisplayNameA(SC_HANDLE hSCManager,
|
---|
971 | LPCSTR lpServiceName,
|
---|
972 | LPTSTR lpDisplayName,
|
---|
973 | LPDWORD lpcchBuffer)
|
---|
974 | {
|
---|
975 | dprintf(("ADVAPI32: GetServiceDisplayNameA(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
---|
976 | hSCManager,
|
---|
977 | lpServiceName,
|
---|
978 | lpDisplayName,
|
---|
979 | lpcchBuffer));
|
---|
980 |
|
---|
981 | return (FALSE); /* signal failure */
|
---|
982 | }
|
---|
983 |
|
---|
984 |
|
---|
985 | /*****************************************************************************
|
---|
986 | * Name : GetServiceDisplayNameW
|
---|
987 | * Purpose : The GetServiceDisplayName function obtains the display name that
|
---|
988 | * is associated with a particular service name. The service name
|
---|
989 | * is the same as the service's registry key name.
|
---|
990 | * Parameters: SC_HANDLE hSCManager handle to a service control manager database
|
---|
991 | * LPCWSTR lpServiceName the service name
|
---|
992 | * LPWSTR lpDisplayName buffer to receive the service's display name
|
---|
993 | * LPDWORD lpcchBuffer size of display name buffer and display name
|
---|
994 | * Variables :
|
---|
995 | * Result :
|
---|
996 | * Remark :
|
---|
997 | * Status : UNTESTED STUB
|
---|
998 | *
|
---|
999 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
1000 | *****************************************************************************/
|
---|
1001 |
|
---|
1002 | BOOL WIN32API GetServiceDisplayNameW(SC_HANDLE hSCManager,
|
---|
1003 | LPCWSTR lpServiceName,
|
---|
1004 | LPWSTR lpDisplayName,
|
---|
1005 | LPDWORD lpcchBuffer)
|
---|
1006 | {
|
---|
1007 | dprintf(("ADVAPI32: GetServiceDisplayNameW(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
---|
1008 | hSCManager,
|
---|
1009 | lpServiceName,
|
---|
1010 | lpDisplayName,
|
---|
1011 | lpcchBuffer));
|
---|
1012 |
|
---|
1013 | return (FALSE); /* signal failure */
|
---|
1014 | }
|
---|
1015 |
|
---|
1016 | /*****************************************************************************
|
---|
1017 | * Name : GetServiceKeyNameA
|
---|
1018 | * Purpose : The GetServiceKeyName function obtains the service name that is
|
---|
1019 | * associated with a particular service's display name. The service
|
---|
1020 | * name is the same as the service's registry key name.
|
---|
1021 | * Parameters: SC_HANDLE hSCManager handle to a service control manager database
|
---|
1022 | * LPCSTR lpDisplayName the service's display name
|
---|
1023 | * LPTSTR lpServiceName buffer to receive the service name
|
---|
1024 | * LPDWORD lpcchBuffer size of service name buffer and service name
|
---|
1025 | * Variables :
|
---|
1026 | * Result :
|
---|
1027 | * Remark :
|
---|
1028 | * Status : UNTESTED STUB
|
---|
1029 | *
|
---|
1030 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
1031 | *****************************************************************************/
|
---|
1032 |
|
---|
1033 | BOOL WIN32API GetServiceKeyNameA(SC_HANDLE hSCManager,
|
---|
1034 | LPCSTR lpDisplayName,
|
---|
1035 | LPTSTR lpServiceName,
|
---|
1036 | LPDWORD lpcchBuffer)
|
---|
1037 | {
|
---|
1038 | dprintf(("ADVAPI32: GetServiceKeyNameA(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
---|
1039 | hSCManager,
|
---|
1040 | lpDisplayName,
|
---|
1041 | lpServiceName,
|
---|
1042 | lpcchBuffer));
|
---|
1043 |
|
---|
1044 | return (FALSE); /* signal failure */
|
---|
1045 | }
|
---|
1046 |
|
---|
1047 |
|
---|
1048 | /*****************************************************************************
|
---|
1049 | * Name : GetServiceKeyNameW
|
---|
1050 | * Purpose : The GetServiceKeyName function obtains the service name that is
|
---|
1051 | * associated with a particular service's display name. The service
|
---|
1052 | * name is the same as the service's registry key name.
|
---|
1053 | * Parameters: SC_HANDLE hSCManager handle to a service control manager database
|
---|
1054 | * LPCWSTR lpDisplayName the service's display name
|
---|
1055 | * LPWSTR lpServiceName buffer to receive the service name
|
---|
1056 | * LPDWORD lpcchBuffer size of service name buffer and service name
|
---|
1057 | * Variables :
|
---|
1058 | * Result :
|
---|
1059 | * Remark :
|
---|
1060 | * Status : UNTESTED STUB
|
---|
1061 | *
|
---|
1062 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
1063 | *****************************************************************************/
|
---|
1064 |
|
---|
1065 | BOOL WIN32API GetServiceKeyNameW(SC_HANDLE hSCManager,
|
---|
1066 | LPCWSTR lpDisplayName,
|
---|
1067 | LPWSTR lpServiceName,
|
---|
1068 | LPDWORD lpcchBuffer)
|
---|
1069 | {
|
---|
1070 | dprintf(("ADVAPI32: GetServiceKeyNameW(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
---|
1071 | hSCManager,
|
---|
1072 | lpDisplayName,
|
---|
1073 | lpServiceName,
|
---|
1074 | lpcchBuffer));
|
---|
1075 |
|
---|
1076 | return (FALSE); /* signal failure */
|
---|
1077 | }
|
---|
1078 |
|
---|
1079 | /*****************************************************************************
|
---|
1080 | * Name : LockServiceDatabase
|
---|
1081 | * Purpose : The LockServiceDatabase function locks a specified database.
|
---|
1082 | * Parameters: SC_HANDLE hSCManager handle of service control manager database
|
---|
1083 | * Variables :
|
---|
1084 | * Result :
|
---|
1085 | * Remark :
|
---|
1086 | * Status : UNTESTED STUB
|
---|
1087 | *
|
---|
1088 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
1089 | *****************************************************************************/
|
---|
1090 |
|
---|
1091 | SC_LOCK WIN32API LockServiceDatabase(SC_HANDLE hSCManager)
|
---|
1092 | {
|
---|
1093 | dprintf(("ADVAPI32: LockServiceDatabase(%08xh) not implemented.\n",
|
---|
1094 | hSCManager));
|
---|
1095 |
|
---|
1096 | return (ERROR_ACCESS_DENIED); /* signal failure */
|
---|
1097 | }
|
---|
1098 |
|
---|
1099 | /*****************************************************************************
|
---|
1100 | * Name : UnlockServiceDatabase
|
---|
1101 | * Purpose : The UnlockServiceDatabase function unlocks a service control
|
---|
1102 | * manager database by releasing the specified lock.
|
---|
1103 | * Parameters: SC_LOCK sclLock service control manager database lock to be released
|
---|
1104 | * Variables :
|
---|
1105 | * Result :
|
---|
1106 | * Remark :
|
---|
1107 | * Status : UNTESTED STUB
|
---|
1108 | *
|
---|
1109 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
1110 |
|
---|
1111 | *****************************************************************************/
|
---|
1112 |
|
---|
1113 | BOOL WIN32API UnlockServiceDatabase(SC_LOCK sclLock)
|
---|
1114 | {
|
---|
1115 | dprintf(("ADVAPI32: UnlockServiceDatabase(%08xh) not implemented.\n",
|
---|
1116 | sclLock));
|
---|
1117 |
|
---|
1118 | return (FALSE); /* signal failure */
|
---|
1119 | }
|
---|
1120 |
|
---|
1121 | /*****************************************************************************
|
---|
1122 | * Name : StartServiceA
|
---|
1123 | * Purpose : The StartService function starts the execution of a service.
|
---|
1124 | * Parameters: SC_HANDLE schService handle of service
|
---|
1125 | * DWORD dwNumServiceArgs number of arguments
|
---|
1126 | * LPCSTR *lpszServiceArgs address of array of argument string pointers
|
---|
1127 | * Variables :
|
---|
1128 | * Result :
|
---|
1129 | * Remark :
|
---|
1130 | * Status : UNTESTED STUB
|
---|
1131 | *
|
---|
1132 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
1133 | *****************************************************************************/
|
---|
1134 |
|
---|
1135 | BOOL WIN32API StartServiceA(SC_HANDLE schService,
|
---|
1136 | DWORD dwNumServiceArgs,
|
---|
1137 | LPCSTR *lpszServiceArgs)
|
---|
1138 | {
|
---|
1139 | dprintf(("ADVAPI32: StartServiceA(%08xh,%08xh,%s) not implemented.\n",
|
---|
1140 | schService,
|
---|
1141 | dwNumServiceArgs,
|
---|
1142 | lpszServiceArgs));
|
---|
1143 |
|
---|
1144 | return (FALSE); /* signal failure */
|
---|
1145 | }
|
---|
1146 |
|
---|
1147 | /*****************************************************************************
|
---|
1148 | * Name : StartServiceW
|
---|
1149 | * Purpose : The StartService function starts the execution of a service.
|
---|
1150 | * Parameters: SC_HANDLE schService handle of service
|
---|
1151 | * DWORD dwNumServiceArgs number of arguments
|
---|
1152 | * LPCWSTR *lpszServiceArgs address of array of argument string pointers
|
---|
1153 | * Variables :
|
---|
1154 | * Result :
|
---|
1155 | * Remark :
|
---|
1156 | * Status : UNTESTED STUB
|
---|
1157 | *
|
---|
1158 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
1159 | *****************************************************************************/
|
---|
1160 |
|
---|
1161 | BOOL WIN32API StartServiceW(SC_HANDLE schService,
|
---|
1162 | DWORD dwNumServiceArgs,
|
---|
1163 | LPCWSTR *lpszServiceArgs)
|
---|
1164 | {
|
---|
1165 | dprintf(("ADVAPI32: StartServiceW(%08xh,%08xh,%s) not implemented.\n",
|
---|
1166 | schService,
|
---|
1167 | dwNumServiceArgs,
|
---|
1168 | lpszServiceArgs));
|
---|
1169 |
|
---|
1170 | return (FALSE); /* signal failure */
|
---|
1171 | }
|
---|
1172 |
|
---|