1 | /* $Id: service.cpp,v 1.4 1999-12-21 00:35:28 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 <win\winreg.h>
|
---|
27 | #include <win\winsvc.h>
|
---|
28 | #include <heapstring.h>
|
---|
29 |
|
---|
30 | ODINDEBUGCHANNEL(ADVAPI32-SERVICE)
|
---|
31 |
|
---|
32 | #define REG_SERVICE_TYPE "Start"
|
---|
33 | #define REG_SERVICE_TYPE_W (LPWSTR)L"Start"
|
---|
34 | #define REG_SERVICE_STARTTYPE "Type"
|
---|
35 | #define REG_SERVICE_STARTTYPE_W (LPWSTR)L"Type"
|
---|
36 | #define REG_SERVICE_ERRORCONTROL "ErrorControl"
|
---|
37 | #define REG_SERVICE_ERRORCONTROL_W (LPWSTR)L"ErrorControl"
|
---|
38 | #define REG_SERVICE_DISPLAYNAME "DisplayName"
|
---|
39 | #define REG_SERVICE_DISPLAYNAME_W (LPWSTR)L"DisplayName"
|
---|
40 | #define REG_SERVICE_LOADORDERGROUP "Group" //???
|
---|
41 | #define REG_SERVICE_LOADORDERGROUP_W (LPWSTR)L"Group" //???
|
---|
42 | #define REG_SERVICE_DEPENDENCIES "DependOnGroup"
|
---|
43 | #define REG_SERVICE_DEPENDENCIES_W (LPWSTR)L"DependOnGroup"
|
---|
44 | #define REG_SERVICE_IMAGEPATH "ImagePath"
|
---|
45 | #define REG_SERVICE_IMAGEPATH_W (LPWSTR)L"ImagePath"
|
---|
46 | #define REG_SERVICE_TAG "Tag"
|
---|
47 | #define REG_SERVICE_TAG_W (LPWSTR)L"Tag"
|
---|
48 | //Odin key
|
---|
49 | #define REG_SERVICE_STATUS "ServiceStatus"
|
---|
50 | #define REG_SERVICE_STATUS_W (LPWSTR)L"ServiceStatus"
|
---|
51 | //This key exists if DeleteService has been called for a specific service
|
---|
52 | #define REG_SERVICE_DELETEPENDING "DeletePending"
|
---|
53 |
|
---|
54 | //*****************************************************************************
|
---|
55 | //TODO: Faster way to checking this
|
---|
56 | //*****************************************************************************
|
---|
57 | BOOL CheckServiceHandle(SC_HANDLE hService)
|
---|
58 | {
|
---|
59 | HKEY keyThisService;
|
---|
60 |
|
---|
61 | if(RegOpenKeyA((HKEY)hService, NULL, &keyThisService) != 0) {
|
---|
62 | return FALSE;
|
---|
63 | }
|
---|
64 | RegCloseKey(keyThisService);
|
---|
65 | return TRUE;
|
---|
66 | }
|
---|
67 | /*****************************************************************************
|
---|
68 | * Name : OpenSCManagerA
|
---|
69 | * Purpose : The OpenSCManager function establishes a connection to the
|
---|
70 | * service control manager on the specified computer and opens the
|
---|
71 | * specified database.
|
---|
72 | * Parameters: LPCSTR lpszMachineName address of machine name string
|
---|
73 | * LPCSTR lpszDatabaseName address of database name string
|
---|
74 | * DWORD fdwDesiredAccess type of access
|
---|
75 | * Variables :
|
---|
76 | * Result :
|
---|
77 | * Remark :
|
---|
78 | * Status : UNTESTED STUB
|
---|
79 | *
|
---|
80 | * Author : SvL
|
---|
81 | *****************************************************************************/
|
---|
82 |
|
---|
83 | SC_HANDLE WIN32API OpenSCManagerA(LPCSTR lpszMachineName,
|
---|
84 | LPCSTR lpszDatabaseName,
|
---|
85 | DWORD fdwDesiredAccess)
|
---|
86 | {
|
---|
87 | dprintf(("ADVAPI32: OpenSCManagerA(%s,%s,%x) not correctly implemented.\n",
|
---|
88 | lpszMachineName,
|
---|
89 | lpszDatabaseName,
|
---|
90 | fdwDesiredAccess));
|
---|
91 |
|
---|
92 | if(!lpszMachineName && !lpszDatabaseName) {
|
---|
93 | HKEY keyServices;
|
---|
94 | if(RegCreateKeyA(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services", &keyServices) != 0) {
|
---|
95 | SetLastError(ERROR_INTERNAL_ERROR);
|
---|
96 | return 0;
|
---|
97 | }
|
---|
98 | return keyServices;
|
---|
99 | }
|
---|
100 | return 0;
|
---|
101 | }
|
---|
102 |
|
---|
103 |
|
---|
104 | /*****************************************************************************
|
---|
105 | * Name : OpenSCManagerW
|
---|
106 | * Purpose : The OpenSCManager function establishes a connection to the
|
---|
107 | * service control manager on the specified computer and opens the
|
---|
108 | * specified database.
|
---|
109 | * Parameters: LPCWSTR lpszMachineName address of machine name string
|
---|
110 | * LPCWSTR lpszDatabaseName address of database name string
|
---|
111 | * DWORD fdwDesiredAccess type of access
|
---|
112 | * Variables :
|
---|
113 | * Result :
|
---|
114 | * Remark :
|
---|
115 | * Status : UNTESTED STUB
|
---|
116 | *
|
---|
117 | * Author : SvL
|
---|
118 | *****************************************************************************/
|
---|
119 |
|
---|
120 | SC_HANDLE WIN32API OpenSCManagerW(LPCWSTR lpszMachineName,
|
---|
121 | LPCWSTR lpszDatabaseName,
|
---|
122 | DWORD fdwDesiredAccess)
|
---|
123 | {
|
---|
124 | LPSTR lpszDataBaseNameA = NULL, lpszMachineNameA = NULL;
|
---|
125 | SC_HANDLE hService;
|
---|
126 |
|
---|
127 | dprintf(("ADVAPI32: OpenSCManagerW(%x,%x,%x) not correctly implemented.\n",
|
---|
128 | lpszMachineName,
|
---|
129 | lpszDatabaseName,
|
---|
130 | fdwDesiredAccess));
|
---|
131 |
|
---|
132 | if(lpszMachineName)
|
---|
133 | lpszMachineNameA = HEAP_strdupWtoA(GetProcessHeap(), 0, lpszMachineName);
|
---|
134 | if(lpszDatabaseName)
|
---|
135 | lpszDataBaseNameA = HEAP_strdupWtoA(GetProcessHeap(), 0, lpszDatabaseName);
|
---|
136 |
|
---|
137 | hService = OpenSCManagerA(lpszMachineNameA, lpszDataBaseNameA, fdwDesiredAccess);
|
---|
138 |
|
---|
139 | if(lpszMachineNameA)
|
---|
140 | HeapFree(GetProcessHeap(), 0, lpszMachineNameA);
|
---|
141 | if(lpszDataBaseNameA)
|
---|
142 | HeapFree(GetProcessHeap(), 0, lpszDataBaseNameA);
|
---|
143 |
|
---|
144 | return hService;
|
---|
145 | }
|
---|
146 |
|
---|
147 |
|
---|
148 | /*****************************************************************************
|
---|
149 | * Name : OpenServiceA
|
---|
150 | * Purpose : The OpenService function opens a handle to an existing service.
|
---|
151 | * Parameters: SC_HANDLE schSCManager handle of service control manager database
|
---|
152 | * LPCSTR lpszServiceName address of name of service to start
|
---|
153 | * DWORD fdwDesiredAccess type of access to service
|
---|
154 | * Variables :
|
---|
155 | * Result :
|
---|
156 | * Remark :
|
---|
157 | * Status : UNTESTED STUB
|
---|
158 | *
|
---|
159 | * Author : SvL
|
---|
160 | *****************************************************************************/
|
---|
161 |
|
---|
162 | SC_HANDLE WIN32API OpenServiceA(SC_HANDLE schSCManager,
|
---|
163 | LPCSTR lpszServiceName,
|
---|
164 | DWORD fdwDesiredAccess)
|
---|
165 | {
|
---|
166 | dprintf(("ADVAPI32: OpenServiceA(%08xh,%s,%08xh) not correctly implemented.\n",
|
---|
167 | schSCManager,
|
---|
168 | lpszServiceName,
|
---|
169 | fdwDesiredAccess));
|
---|
170 |
|
---|
171 | if(CheckServiceHandle(schSCManager) == FALSE) {
|
---|
172 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
173 | return FALSE;
|
---|
174 | }
|
---|
175 |
|
---|
176 | if(lpszServiceName == NULL) {
|
---|
177 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
178 | return 0;
|
---|
179 | }
|
---|
180 | HKEY keyThisService;
|
---|
181 | if(RegOpenKeyA((HKEY)schSCManager, lpszServiceName, &keyThisService) != 0) {
|
---|
182 | SetLastError(ERROR_SERVICE_DOES_NOT_EXIST);
|
---|
183 | return 0;
|
---|
184 | }
|
---|
185 | return keyThisService;
|
---|
186 | }
|
---|
187 |
|
---|
188 |
|
---|
189 | /*****************************************************************************
|
---|
190 | * Name : OpenServiceW
|
---|
191 | * Purpose : The OpenService function opens a handle to an existing service.
|
---|
192 | * Parameters: SC_HANDLE schSCManager handle of service control manager database
|
---|
193 | * LPCWSTR lpszServiceName address of name of service to start
|
---|
194 | * DWORD fdwDesiredAccess type of access to service
|
---|
195 | * Variables :
|
---|
196 | * Result :
|
---|
197 | * Remark :
|
---|
198 | * Status : UNTESTED STUB
|
---|
199 | *
|
---|
200 | * Author : SvL
|
---|
201 | *****************************************************************************/
|
---|
202 |
|
---|
203 | SC_HANDLE WIN32API OpenServiceW(SC_HANDLE schSCManager,
|
---|
204 | LPCWSTR lpszServiceName,
|
---|
205 | DWORD fdwDesiredAccess)
|
---|
206 | {
|
---|
207 | LPSTR lpszServiceNameA = NULL;
|
---|
208 | SC_HANDLE hService;
|
---|
209 |
|
---|
210 | dprintf(("ADVAPI32: OpenServiceW(%08xh,%s,%08xh) not correctly implemented.\n",
|
---|
211 | schSCManager,
|
---|
212 | lpszServiceName,
|
---|
213 | fdwDesiredAccess));
|
---|
214 |
|
---|
215 | if(lpszServiceName == NULL) {
|
---|
216 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
217 | return 0;
|
---|
218 | }
|
---|
219 | lpszServiceNameA = HEAP_strdupWtoA(GetProcessHeap(), 0, lpszServiceName);
|
---|
220 | hService = OpenServiceA(schSCManager, lpszServiceNameA, fdwDesiredAccess);
|
---|
221 | HeapFree(GetProcessHeap(), 0, lpszServiceNameA);
|
---|
222 | return hService;
|
---|
223 | }
|
---|
224 |
|
---|
225 | /*****************************************************************************
|
---|
226 | * Name : QueryServiceConfigA
|
---|
227 | * Purpose : The QueryServiceConfig function retrieves the configuration
|
---|
228 | * parameters of the specified service.
|
---|
229 | * Parameters: SC_HANDLE schService handle of service
|
---|
230 | * LPQUERY_SERVICE_CONFIG lpqscServConfig address of service config. structure
|
---|
231 | * DWORD cbBufSize size of service configuration buffer
|
---|
232 | * LPDWORD lpcbBytesNeeded address of variable for bytes needed
|
---|
233 | * Variables :
|
---|
234 | * Result :
|
---|
235 | * Remark :
|
---|
236 | * Status : UNTESTED STUB
|
---|
237 | *
|
---|
238 | * Author : SvL
|
---|
239 | *****************************************************************************/
|
---|
240 |
|
---|
241 | BOOL WIN32API QueryServiceConfigA(SC_HANDLE schService,
|
---|
242 | LPQUERY_SERVICE_CONFIG lpqscServConfig,
|
---|
243 | DWORD cbBufSize,
|
---|
244 | LPDWORD lpcbBytesNeeded)
|
---|
245 | {
|
---|
246 | dprintf(("ADVAPI32: QueryServiceConfigA(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
---|
247 | schService,
|
---|
248 | lpqscServConfig,
|
---|
249 | cbBufSize,
|
---|
250 | lpcbBytesNeeded));
|
---|
251 |
|
---|
252 | return (FALSE); /* signal failure */
|
---|
253 | }
|
---|
254 |
|
---|
255 |
|
---|
256 | /*****************************************************************************
|
---|
257 | * Name : QueryServiceConfigW
|
---|
258 | * Purpose : The QueryServiceConfig function retrieves the configuration
|
---|
259 | * parameters of the specified service.
|
---|
260 | * Parameters: SC_HANDLE schService handle of service
|
---|
261 | * LPQUERY_SERVICE_CONFIG lpqscServConfig address of service config. structure
|
---|
262 | * DWORD cbBufSize size of service configuration buffer
|
---|
263 | * LPDWORD lpcbBytesNeeded address of variable for bytes needed
|
---|
264 | * Variables :
|
---|
265 | * Result :
|
---|
266 | * Remark :
|
---|
267 | * Status : UNTESTED STUB
|
---|
268 | *
|
---|
269 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
270 | *****************************************************************************/
|
---|
271 |
|
---|
272 | BOOL WIN32API QueryServiceConfigW(SC_HANDLE schService,
|
---|
273 | LPQUERY_SERVICE_CONFIG lpqscServConfig,
|
---|
274 | DWORD cbBufSize,
|
---|
275 | LPDWORD lpcbBytesNeeded)
|
---|
276 | {
|
---|
277 | dprintf(("ADVAPI32: QueryServiceConfigW(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
---|
278 | schService,
|
---|
279 | lpqscServConfig,
|
---|
280 | cbBufSize,
|
---|
281 | lpcbBytesNeeded));
|
---|
282 |
|
---|
283 | return (FALSE); /* signal failure */
|
---|
284 | }
|
---|
285 |
|
---|
286 |
|
---|
287 | /*****************************************************************************
|
---|
288 | * Name : QueryServiceLockStatusA
|
---|
289 | * Purpose : The QueryServiceLockStatus function retrieves the lock status
|
---|
290 | * of the specified service control manager database.
|
---|
291 | * Parameters: SC_HANDLE schSCManager handle of svc. ctrl. mgr. database
|
---|
292 | * LPQUERY_SERVICE_LOCK_STATUS lpqslsLockStat address of lock status structure
|
---|
293 | * DWORD cbBufSize size of service configuration buffer
|
---|
294 | * LPDWORD lpcbBytesNeeded address of variable for bytes needed
|
---|
295 | * Variables :
|
---|
296 | * Result :
|
---|
297 | * Remark :
|
---|
298 | * Status : UNTESTED STUB
|
---|
299 | *
|
---|
300 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
301 | *****************************************************************************/
|
---|
302 |
|
---|
303 | BOOL WIN32API QueryServiceLockStatusA(SC_HANDLE schSCManager,
|
---|
304 | LPQUERY_SERVICE_LOCK_STATUSA lpqslsLockStat,
|
---|
305 | DWORD cbBufSize,
|
---|
306 | LPDWORD lpcbBytesNeeded)
|
---|
307 | {
|
---|
308 | dprintf(("ADVAPI32: QueryServiceLockStatusA(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
---|
309 | schSCManager,
|
---|
310 | lpqslsLockStat,
|
---|
311 | cbBufSize,
|
---|
312 | lpcbBytesNeeded));
|
---|
313 |
|
---|
314 | return (FALSE); /* signal failure */
|
---|
315 | }
|
---|
316 |
|
---|
317 |
|
---|
318 | /*****************************************************************************
|
---|
319 | * Name : QueryServiceLockStatusW
|
---|
320 | * Purpose : The QueryServiceLockStatus function retrieves the lock status
|
---|
321 | * of the specified service control manager database.
|
---|
322 | * Parameters: SC_HANDLE schSCManager handle of svc. ctrl. mgr. database
|
---|
323 | * LPQUERY_SERVICE_LOCK_STATUS lpqslsLockStat address of lock status structure
|
---|
324 | * DWORD cbBufSize size of service configuration buffer
|
---|
325 | * LPDWORD lpcbBytesNeeded address of variable for bytes needed
|
---|
326 | * Variables :
|
---|
327 | * Result :
|
---|
328 | * Remark :
|
---|
329 | * Status : UNTESTED STUB
|
---|
330 | *
|
---|
331 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
332 | *****************************************************************************/
|
---|
333 |
|
---|
334 | BOOL WIN32API QueryServiceLockStatusW(SC_HANDLE schSCManager,
|
---|
335 | LPQUERY_SERVICE_LOCK_STATUSW lpqslsLockStat,
|
---|
336 | DWORD cbBufSize,
|
---|
337 | LPDWORD lpcbBytesNeeded)
|
---|
338 | {
|
---|
339 | dprintf(("ADVAPI32: QueryServiceLockStatusW(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
---|
340 | schSCManager,
|
---|
341 | lpqslsLockStat,
|
---|
342 | cbBufSize,
|
---|
343 | lpcbBytesNeeded));
|
---|
344 |
|
---|
345 | return (FALSE); /* signal failure */
|
---|
346 | }
|
---|
347 |
|
---|
348 | /*****************************************************************************
|
---|
349 | * Name : QueryServiceObjectSecurity
|
---|
350 | * Purpose : The QueryServiceObjectSecurity function retrieves a copy of the
|
---|
351 | * security descriptor protecting a service object.
|
---|
352 | * Parameters: SC_HANDLE schService handle of service
|
---|
353 | * SECURITY_INFORMATION fdwSecurityInfo type of security information requested
|
---|
354 | * PSECURITY_DESCRIPTOR psdSecurityDesc address of security descriptor
|
---|
355 | * DWORD cbBufSize size of security descriptor buffer
|
---|
356 | * LPDWORD lpcbBytesNeeded address of variable for bytes needed
|
---|
357 | * Variables :
|
---|
358 | * Result :
|
---|
359 | * Remark :
|
---|
360 | * Status : UNTESTED STUB
|
---|
361 | *
|
---|
362 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
363 | *****************************************************************************/
|
---|
364 |
|
---|
365 | BOOL WIN32API QueryServiceObjectSecurity(SC_HANDLE schService,
|
---|
366 | SECURITY_INFORMATION fdwSecurityInfo,
|
---|
367 | PSECURITY_DESCRIPTOR psdSecurityDesc,
|
---|
368 | DWORD cbBufSize,
|
---|
369 | LPDWORD lpcbBytesNeeded)
|
---|
370 | {
|
---|
371 | dprintf(("ADVAPI32: QueryServiceObjectSecurity(%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
---|
372 | schService,
|
---|
373 | fdwSecurityInfo,
|
---|
374 | psdSecurityDesc,
|
---|
375 | cbBufSize,
|
---|
376 | lpcbBytesNeeded));
|
---|
377 |
|
---|
378 | return (FALSE); /* signal failure */
|
---|
379 | }
|
---|
380 |
|
---|
381 |
|
---|
382 | /*****************************************************************************
|
---|
383 | * Name : SetServiceStatus
|
---|
384 | * Purpose : The SetServiceStatus function updates the service control
|
---|
385 | * manager's status information for the calling service.
|
---|
386 | * Parameters: SERVICE_STATUS_HANDLE sshServiceStatus service status handle
|
---|
387 | * LPSERVICE_STATUS lpssServiceStatus address of status structure
|
---|
388 | * Variables :
|
---|
389 | * Result :
|
---|
390 | * Remark :
|
---|
391 | * Status : UNTESTED STUB
|
---|
392 | *
|
---|
393 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
394 | *****************************************************************************/
|
---|
395 |
|
---|
396 | BOOL WIN32API SetServiceStatus(SERVICE_STATUS_HANDLE sshServiceStatus,
|
---|
397 | LPSERVICE_STATUS lpssServiceStatus)
|
---|
398 | {
|
---|
399 | dprintf(("ADVAPI32: SetServiceStatus(%08xh,%08xh) not implemented.\n",
|
---|
400 | sshServiceStatus,
|
---|
401 | lpssServiceStatus));
|
---|
402 |
|
---|
403 | if(CheckServiceHandle(sshServiceStatus) == FALSE) {
|
---|
404 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
405 | return FALSE;
|
---|
406 | }
|
---|
407 |
|
---|
408 | return (FALSE); /* signal failure */
|
---|
409 | }
|
---|
410 |
|
---|
411 | /*****************************************************************************
|
---|
412 | * Name : QueryServiceStatus
|
---|
413 | * Purpose : The QueryServiceStatus function retrieves the current status of
|
---|
414 | * the specified service.
|
---|
415 | * Parameters: SC_HANDLE schService handle of service
|
---|
416 | * LPSERVICE_STATUS lpssServiceStatus address of service status structure
|
---|
417 | * Variables :
|
---|
418 | * Result :
|
---|
419 | * Remark :
|
---|
420 | * Status : UNTESTED STUB
|
---|
421 | *
|
---|
422 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
423 | *****************************************************************************/
|
---|
424 |
|
---|
425 | BOOL WIN32API QueryServiceStatus(SC_HANDLE schService,
|
---|
426 | LPSERVICE_STATUS lpssServiceStatus)
|
---|
427 | {
|
---|
428 | DWORD size, keytype;
|
---|
429 |
|
---|
430 | dprintf(("ADVAPI32: QueryServiceStatus(%08xh,%08xh) not correctly implemented.\n",
|
---|
431 | schService,
|
---|
432 | lpssServiceStatus));
|
---|
433 |
|
---|
434 | if(CheckServiceHandle(schService) == FALSE) {
|
---|
435 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
436 | return FALSE;
|
---|
437 | }
|
---|
438 |
|
---|
439 | memset(lpssServiceStatus, 0, sizeof(SERVICE_STATUS));
|
---|
440 |
|
---|
441 | size = sizeof(DWORD);
|
---|
442 | keytype = REG_DWORD;
|
---|
443 | RegQueryValueExA((HKEY)schService, REG_SERVICE_TYPE, 0, &keytype, (LPBYTE)&lpssServiceStatus->dwServiceType, &size);
|
---|
444 |
|
---|
445 | size = sizeof(DWORD);
|
---|
446 | keytype = REG_DWORD;
|
---|
447 | RegQueryValueExA((HKEY)schService, REG_SERVICE_STATUS, 0, &keytype, (LPBYTE)&lpssServiceStatus->dwCurrentState, &size);
|
---|
448 |
|
---|
449 | //TODO: Should this be set by the service once it has started?
|
---|
450 | lpssServiceStatus->dwControlsAccepted = SERVICE_ACCEPT_STOP|SERVICE_ACCEPT_PAUSE_CONTINUE|SERVICE_ACCEPT_SHUTDOWN;
|
---|
451 | return TRUE;
|
---|
452 | }
|
---|
453 |
|
---|
454 | /*****************************************************************************
|
---|
455 | * Name : SetServiceObjectSecurity
|
---|
456 | * Purpose : The SetServiceObjectSecurity function sets the security
|
---|
457 | * descriptor of a service object.
|
---|
458 | * Parameters: SC_HANDLE schService handle of service
|
---|
459 | * SECURITY_INFORMATION fdwSecurityInfo type of security information requested
|
---|
460 | * PSECURITY_DESCRIPTOR psdSecurityDesc address of security descriptor
|
---|
461 | * Variables :
|
---|
462 | * Result :
|
---|
463 | * Remark :
|
---|
464 | * Status : UNTESTED STUB
|
---|
465 | *
|
---|
466 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
467 | *****************************************************************************/
|
---|
468 |
|
---|
469 | BOOL WIN32API SetServiceObjectSecurity(SC_HANDLE schService,
|
---|
470 | SECURITY_INFORMATION fdwSecurityInfo,
|
---|
471 | PSECURITY_DESCRIPTOR psdSecurityDesc)
|
---|
472 | {
|
---|
473 | dprintf(("ADVAPI32: SetServiceObjectSecurity(%08xh,%08xh,%08xh) not implemented.\n",
|
---|
474 | schService,
|
---|
475 | fdwSecurityInfo,
|
---|
476 | psdSecurityDesc));
|
---|
477 |
|
---|
478 | return (FALSE); /* signal failure */
|
---|
479 | }
|
---|
480 |
|
---|
481 | /*****************************************************************************
|
---|
482 | * Name : ChangeServiceConfigA
|
---|
483 | * Purpose : The ChangeServiceConfig function changes the configuration
|
---|
484 | * parameters of a service.
|
---|
485 | * Parameters: SC_HANDLE hService handle of service
|
---|
486 | * DWORD dwServiceType type of service
|
---|
487 | * DWORD dwStartType when to start service
|
---|
488 | * DWORD dwErrorControl severity if service fails to start
|
---|
489 | * LPCSTR lpBinaryPathName address of service binary file name
|
---|
490 | * LPCSTR lpLoadOrderGroup address of load ordering group name
|
---|
491 | * LPDWORD lpdwTagId address of variable to get tag identifier
|
---|
492 | * LPCSTR lpDependencies address of array of dependency names
|
---|
493 | * LPCSTR lpServiceStartName address of account name of service
|
---|
494 | * LPCSTR lpPassword address of password for service account
|
---|
495 | * LPCSTR lpDisplayName address of display name
|
---|
496 | * Variables :
|
---|
497 | * Result :
|
---|
498 | * Remark :
|
---|
499 | * Status : UNTESTED STUB
|
---|
500 | *
|
---|
501 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
502 | *****************************************************************************/
|
---|
503 |
|
---|
504 | BOOL WIN32API ChangeServiceConfigA(SC_HANDLE hService,
|
---|
505 | DWORD dwServiceType,
|
---|
506 | DWORD dwStartType,
|
---|
507 | DWORD dwErrorControl,
|
---|
508 | LPCSTR lpBinaryPathName,
|
---|
509 | LPCSTR lpLoadOrderGroup,
|
---|
510 | LPDWORD lpdwTagId,
|
---|
511 | LPCSTR lpDependencies,
|
---|
512 | LPCSTR lpServiceStartName,
|
---|
513 | LPCSTR lpPassword,
|
---|
514 | LPCSTR lpDisplayName)
|
---|
515 | {
|
---|
516 | dprintf(("ADVAPI32: ChangeServiceConfigA(%08xh,%08xh,%08xh,%08xh,%s,%s,%08xh,%s,%s,%s,%s) not implemented.\n",
|
---|
517 | hService,
|
---|
518 | dwServiceType,
|
---|
519 | dwStartType,
|
---|
520 | dwErrorControl,
|
---|
521 | lpBinaryPathName,
|
---|
522 | lpLoadOrderGroup,
|
---|
523 | lpdwTagId,
|
---|
524 | lpDependencies,
|
---|
525 | lpServiceStartName,
|
---|
526 | lpPassword,
|
---|
527 | lpDisplayName));
|
---|
528 |
|
---|
529 | return (FALSE); /* signal failure */
|
---|
530 | }
|
---|
531 |
|
---|
532 |
|
---|
533 | /*****************************************************************************
|
---|
534 | * Name : ChangeServiceConfigW
|
---|
535 | * Purpose : The ChangeServiceConfig function changes the configuration
|
---|
536 | * parameters of a service.
|
---|
537 | * Parameters: SC_HANDLE hService handle of service
|
---|
538 | * DWORD dwServiceType type of service
|
---|
539 | * DWORD dwStartType when to start service
|
---|
540 | * DWORD dwErrorControl severity if service fails to start
|
---|
541 | * LPCWSTR lpBinaryPathName address of service binary file name
|
---|
542 | * LPCWSTR lpLoadOrderGroup address of load ordering group name
|
---|
543 | * LPDWORD lpdwTagId address of variable to get tag identifier
|
---|
544 | * LPCWSTR lpDependencies address of array of dependency names
|
---|
545 | * LPCWSTR lpServiceStartName address of account name of service
|
---|
546 | * LPCWSTR lpPassword address of password for service account
|
---|
547 | * LPCWSTR lpDisplayName address of display name
|
---|
548 | * Variables :
|
---|
549 | * Result :
|
---|
550 | * Remark :
|
---|
551 | * Status : UNTESTED STUB
|
---|
552 | *
|
---|
553 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
554 | *****************************************************************************/
|
---|
555 |
|
---|
556 | BOOL WIN32API ChangeServiceConfigW(SC_HANDLE hService,
|
---|
557 | DWORD dwServiceType,
|
---|
558 | DWORD dwStartType,
|
---|
559 | DWORD dwErrorControl,
|
---|
560 | LPCWSTR lpBinaryPathName,
|
---|
561 | LPCWSTR lpLoadOrderGroup,
|
---|
562 | LPDWORD lpdwTagId,
|
---|
563 | LPCWSTR lpDependencies,
|
---|
564 | LPCWSTR lpServiceStartName,
|
---|
565 | LPCWSTR lpPassword,
|
---|
566 | LPCWSTR lpDisplayName)
|
---|
567 | {
|
---|
568 | dprintf(("ADVAPI32: ChangeServiceConfigW(%08xh,%08xh,%08xh,%08xh,%s,%s,%08xh,%s,%s,%s,%s) not implemented.\n",
|
---|
569 | hService,
|
---|
570 | dwServiceType,
|
---|
571 | dwStartType,
|
---|
572 | dwErrorControl,
|
---|
573 | lpBinaryPathName,
|
---|
574 | lpLoadOrderGroup,
|
---|
575 | lpdwTagId,
|
---|
576 | lpDependencies,
|
---|
577 | lpServiceStartName,
|
---|
578 | lpPassword,
|
---|
579 | lpDisplayName));
|
---|
580 |
|
---|
581 | return (FALSE); /* signal failure */
|
---|
582 | }
|
---|
583 |
|
---|
584 |
|
---|
585 | /*****************************************************************************
|
---|
586 | * Name : CloseServiceHandle
|
---|
587 | * Purpose : The CloseServiceHandle function closes a handle to a service
|
---|
588 | * control manager database as returned by the OpenSCManager function,
|
---|
589 | * or it closes a handle to a service object as returned by either
|
---|
590 | * the OpenService or CreateService function.
|
---|
591 | * Parameters: SC_HANDLE hSCObject handle of service or service control manager database
|
---|
592 | * Variables :
|
---|
593 | * Result :
|
---|
594 | * Remark :
|
---|
595 | * Status : UNTESTED STUB
|
---|
596 | *
|
---|
597 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
598 | *****************************************************************************/
|
---|
599 |
|
---|
600 | BOOL WIN32API CloseServiceHandle(SC_HANDLE hSCObject)
|
---|
601 | {
|
---|
602 | dprintf(("ADVAPI32: CloseServiceHandle(%08xh)",
|
---|
603 | hSCObject));
|
---|
604 |
|
---|
605 | if(CheckServiceHandle(hSCObject) == FALSE) {
|
---|
606 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
607 | return FALSE;
|
---|
608 | }
|
---|
609 |
|
---|
610 | DWORD deletepending, keytype = REG_DWORD, size = sizeof(DWORD);
|
---|
611 | if(!RegQueryValueExA((HKEY)hSCObject, REG_SERVICE_DELETEPENDING, 0, &keytype, (LPBYTE)&deletepending, &size)) {
|
---|
612 | FILETIME filetime;
|
---|
613 | DWORD bla, classsize;
|
---|
614 | CHAR szClassName[64];
|
---|
615 |
|
---|
616 | HKEY keyServices;
|
---|
617 | if(RegCreateKeyA(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services", &keyServices) != 0) {
|
---|
618 | SetLastError(ERROR_INTERNAL_ERROR);
|
---|
619 | return FALSE;
|
---|
620 | }
|
---|
621 |
|
---|
622 | //NOTE: Assumes for now there are no subkeys
|
---|
623 | //TODO: DOes not work
|
---|
624 | classsize = sizeof(szClassName);
|
---|
625 | RegQueryValueA((HKEY)hSCObject, NULL, szClassName, (LPLONG)&classsize);
|
---|
626 | RegCloseKey((HKEY)hSCObject);
|
---|
627 | RegDeleteKeyA(keyServices, szClassName);
|
---|
628 | }
|
---|
629 |
|
---|
630 | RegCloseKey((HKEY)hSCObject);
|
---|
631 | return TRUE;
|
---|
632 | }
|
---|
633 |
|
---|
634 | /*****************************************************************************
|
---|
635 | * Name : ControlService
|
---|
636 | * Purpose : The ControlService function sends a control code to a Win32 service.
|
---|
637 | * Parameters: SC_HANDLE hService handle of service
|
---|
638 | * DWORD dwControl control code
|
---|
639 | * LPSERVICE_STATUS lpServiceStatus address of service status structure
|
---|
640 | * Variables :
|
---|
641 | * Result :
|
---|
642 | * Remark :
|
---|
643 | * Status : UNTESTED STUB
|
---|
644 | *
|
---|
645 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
646 | *****************************************************************************/
|
---|
647 |
|
---|
648 | BOOL WIN32API ControlService(SC_HANDLE hService,
|
---|
649 | DWORD dwControl,
|
---|
650 | LPSERVICE_STATUS lpServiceStatus)
|
---|
651 | {
|
---|
652 | dprintf(("ADVAPI32: ControlService(%08xh,%08xh,%08xh) not correctly implemented.\n",
|
---|
653 | hService,
|
---|
654 | dwControl,
|
---|
655 | lpServiceStatus));
|
---|
656 | HKEY keyThisService;
|
---|
657 |
|
---|
658 | if(CheckServiceHandle(hService) == FALSE) {
|
---|
659 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
660 | return FALSE;
|
---|
661 | }
|
---|
662 | return TRUE;
|
---|
663 | }
|
---|
664 |
|
---|
665 |
|
---|
666 | /*****************************************************************************
|
---|
667 | * Name : CreateServiceA
|
---|
668 | * Purpose : The CreateService function creates a service object and adds it
|
---|
669 | * to the specified service control manager database.
|
---|
670 | * Parameters: SC_HANDLE hSCManager handle of service control manager database
|
---|
671 | * LPCSTR lpServiceName address of name of service to start
|
---|
672 | * LPCSTR lpDisplayName address of display name
|
---|
673 | * DWORD dwDesiredAccess type of access to service
|
---|
674 | * DWORD dwServiceType type of service
|
---|
675 | * DWORD dwStartType when to start service
|
---|
676 | * DWORD dwErrorControl severity if service fails to start
|
---|
677 | * LPCSTR lpBinaryPathName address of name of binary file
|
---|
678 | * LPCSTR lpLoadOrderGroup address of name of load ordering group
|
---|
679 | * LPDWORD lpdwTagId address of variable to get tag identifier
|
---|
680 | * LPCSTR lpDependencies address of array of dependency names
|
---|
681 | * LPCSTR lpServiceStartName address of account name of service
|
---|
682 | * LPCSTR lpPassword address of password for service account
|
---|
683 | * Variables :
|
---|
684 | * Result :
|
---|
685 | * Remark :
|
---|
686 | * Status : UNTESTED STUB
|
---|
687 | *
|
---|
688 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
689 | *****************************************************************************/
|
---|
690 |
|
---|
691 | SC_HANDLE WIN32API CreateServiceA(SC_HANDLE hSCManager,
|
---|
692 | LPCSTR lpServiceName,
|
---|
693 | LPCSTR lpDisplayName,
|
---|
694 | DWORD dwDesiredAccess,
|
---|
695 | DWORD dwServiceType,
|
---|
696 | DWORD dwStartType,
|
---|
697 | DWORD dwErrorControl,
|
---|
698 | LPCSTR lpBinaryPathName,
|
---|
699 | LPCSTR lpLoadOrderGroup,
|
---|
700 | LPDWORD lpdwTagId,
|
---|
701 | LPCSTR lpDependencies,
|
---|
702 | LPCSTR lpServiceStartName,
|
---|
703 | LPCSTR lpPassword)
|
---|
704 | {
|
---|
705 | HKEY keyServices, keyThisService;
|
---|
706 |
|
---|
707 | dprintf(("ADVAPI32: CreateServiceA(%08xh,%s,%s,%08xh,%08xh,%08xh,%08xh,%s,%s,%08xh,%s,%s,%s) not correctly implemented.\n",
|
---|
708 | hSCManager,
|
---|
709 | lpServiceName,
|
---|
710 | lpDisplayName,
|
---|
711 | dwDesiredAccess,
|
---|
712 | dwServiceType,
|
---|
713 | dwStartType,
|
---|
714 | dwErrorControl,
|
---|
715 | lpBinaryPathName,
|
---|
716 | lpLoadOrderGroup,
|
---|
717 | lpdwTagId,
|
---|
718 | lpDependencies,
|
---|
719 | lpServiceStartName,
|
---|
720 | lpPassword));
|
---|
721 |
|
---|
722 | //displayname too?
|
---|
723 | if(lpServiceName == NULL || lpBinaryPathName == NULL) {
|
---|
724 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
725 | return 0;
|
---|
726 | }
|
---|
727 |
|
---|
728 | if(RegCreateKeyA(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services", &keyServices) != 0) {
|
---|
729 | SetLastError(ERROR_INTERNAL_ERROR);
|
---|
730 | return 0;
|
---|
731 | }
|
---|
732 | if(RegCreateKeyA(keyServices, lpServiceName, &keyThisService) != 0) {
|
---|
733 | SetLastError(ERROR_INTERNAL_ERROR);
|
---|
734 | return 0;
|
---|
735 | }
|
---|
736 | RegSetValueExA(keyThisService, REG_SERVICE_TYPE, 0, REG_DWORD, (LPBYTE)&dwServiceType, sizeof(DWORD));
|
---|
737 | RegSetValueExA(keyThisService, REG_SERVICE_STARTTYPE, 0, REG_DWORD, (LPBYTE)&dwStartType, sizeof(DWORD));
|
---|
738 | RegSetValueExA(keyThisService, REG_SERVICE_ERRORCONTROL, 0, REG_DWORD, (LPBYTE)&dwErrorControl, sizeof(DWORD));
|
---|
739 | if(lpDisplayName)
|
---|
740 | RegSetValueExA(keyThisService, REG_SERVICE_DISPLAYNAME, 0, REG_SZ, (LPBYTE)lpDisplayName, strlen(lpDisplayName)+1);
|
---|
741 | if(lpLoadOrderGroup)
|
---|
742 | RegSetValueExA(keyThisService, REG_SERVICE_LOADORDERGROUP, 0, REG_SZ, (LPBYTE)lpDisplayName, strlen(lpLoadOrderGroup)+1);
|
---|
743 | if(lpDependencies) {
|
---|
744 | //seems to need an extra terminating '0'
|
---|
745 | int size = strlen(lpDependencies)+2;
|
---|
746 | char *dependencies = (char *)malloc(size);
|
---|
747 | memset(dependencies, 0, size);
|
---|
748 | strcpy(dependencies, lpDependencies);
|
---|
749 | RegSetValueExA(keyThisService, REG_SERVICE_DEPENDENCIES, 0, REG_BINARY, (LPBYTE)dependencies, size);
|
---|
750 | free(dependencies);
|
---|
751 | }
|
---|
752 | //TODO: %SystemRoot%
|
---|
753 | RegSetValueExA(keyThisService, REG_SERVICE_IMAGEPATH, 0, REG_SZ, (LPBYTE)lpBinaryPathName, strlen(lpBinaryPathName)+1);
|
---|
754 |
|
---|
755 | //Pointer to a variable that receives a tag value that is unique in the group specified in the
|
---|
756 | //lpLoadOrderGroup parameter. Specify NULL if you are not changing the existing tag.
|
---|
757 | DWORD tag = 1; //TODO!!
|
---|
758 | RegSetValueExA(keyThisService, REG_SERVICE_TAG, 0, REG_DWORD, (LPBYTE)&tag, sizeof(DWORD));
|
---|
759 | if(lpdwTagId)
|
---|
760 | *lpdwTagId = tag;
|
---|
761 |
|
---|
762 | DWORD state = SERVICE_STOPPED;
|
---|
763 | RegSetValueExA(keyThisService, REG_SERVICE_STATUS, 0, REG_DWORD, (LPBYTE)&state, sizeof(DWORD));
|
---|
764 |
|
---|
765 | //TODO: What else?
|
---|
766 |
|
---|
767 | RegCloseKey(keyServices);
|
---|
768 | return keyThisService;
|
---|
769 | }
|
---|
770 |
|
---|
771 |
|
---|
772 | /*****************************************************************************
|
---|
773 | * Name : CreateServiceW
|
---|
774 | * Purpose : The CreateService function creates a service object and adds it
|
---|
775 | * to the specified service control manager database.
|
---|
776 | * Parameters: SC_HANDLE hSCManager handle of service control manager database
|
---|
777 | * LPCWSTR lpServiceName address of name of service to start
|
---|
778 | * LPCWSTR lpDisplayName address of display name
|
---|
779 | * DWORD dwDesiredAccess type of access to service
|
---|
780 | * DWORD dwServiceType type of service
|
---|
781 | * DWORD dwStartType when to start service
|
---|
782 | * DWORD dwErrorControl severity if service fails to start
|
---|
783 | * LPCWSTR lpBinaryPathName address of name of binary file
|
---|
784 | * LPCWSTR lpLoadOrderGroup address of name of load ordering group
|
---|
785 | * LPDWORD lpdwTagId address of variable to get tag identifier
|
---|
786 | * LPCWSTR lpDependencies address of array of dependency names
|
---|
787 | * LPCWSTR lpServiceStartName address of account name of service
|
---|
788 | * LPCWSTR lpPassword address of password for service account
|
---|
789 | * Variables :
|
---|
790 | * Result :
|
---|
791 | * Remark :
|
---|
792 | * Status : UNTESTED STUB
|
---|
793 | *
|
---|
794 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
795 | *****************************************************************************/
|
---|
796 |
|
---|
797 | SC_HANDLE WIN32API CreateServiceW(SC_HANDLE hSCManager,
|
---|
798 | LPCWSTR lpServiceName,
|
---|
799 | LPCWSTR lpDisplayName,
|
---|
800 | DWORD dwDesiredAccess,
|
---|
801 | DWORD dwServiceType,
|
---|
802 | DWORD dwStartType,
|
---|
803 | DWORD dwErrorControl,
|
---|
804 | LPCWSTR lpBinaryPathName,
|
---|
805 | LPCWSTR lpLoadOrderGroup,
|
---|
806 | LPDWORD lpdwTagId,
|
---|
807 | LPCWSTR lpDependencies,
|
---|
808 | LPCWSTR lpServiceStartName,
|
---|
809 | LPCWSTR lpPassword)
|
---|
810 | {
|
---|
811 | LPSTR lpServiceNameA = NULL, lpDisplayNameA = NULL, lpBinaryPathNameA = NULL;
|
---|
812 | LPSTR lpDependenciesA = NULL, lpServiceStartNameA = NULL, lpPasswordA = NULL;
|
---|
813 | LPSTR lpLoadOrderGroupA = NULL;
|
---|
814 | SC_HANDLE hService;
|
---|
815 |
|
---|
816 | dprintf(("ADVAPI32: CreateServiceW(%08xh,%s,%s,%08xh,%08xh,%08xh,%08xh,%s,%s,%08xh,%s,%s,%s) not correctly implemented.\n",
|
---|
817 | hSCManager,
|
---|
818 | lpServiceName,
|
---|
819 | lpDisplayName,
|
---|
820 | dwDesiredAccess,
|
---|
821 | dwServiceType,
|
---|
822 | dwStartType,
|
---|
823 | dwErrorControl,
|
---|
824 | lpBinaryPathName,
|
---|
825 | lpLoadOrderGroup,
|
---|
826 | lpdwTagId,
|
---|
827 | lpDependencies,
|
---|
828 | lpServiceStartName,
|
---|
829 | lpPassword));
|
---|
830 |
|
---|
831 | if(lpServiceName)
|
---|
832 | lpServiceNameA = HEAP_strdupWtoA(GetProcessHeap(), 0, lpServiceName);
|
---|
833 | if(lpDisplayName)
|
---|
834 | lpDisplayNameA = HEAP_strdupWtoA(GetProcessHeap(), 0, lpDisplayName);
|
---|
835 | if(lpBinaryPathName)
|
---|
836 | lpBinaryPathNameA = HEAP_strdupWtoA(GetProcessHeap(), 0, lpBinaryPathName);
|
---|
837 | if(lpDependencies)
|
---|
838 | lpDependenciesA = HEAP_strdupWtoA(GetProcessHeap(), 0, lpDependencies);
|
---|
839 | if(lpServiceStartName)
|
---|
840 | lpServiceStartNameA = HEAP_strdupWtoA(GetProcessHeap(), 0, lpServiceStartName);
|
---|
841 | if(lpPassword)
|
---|
842 | lpPasswordA = HEAP_strdupWtoA(GetProcessHeap(), 0, lpPassword);
|
---|
843 | if(lpDisplayName)
|
---|
844 | lpDisplayNameA = HEAP_strdupWtoA(GetProcessHeap(), 0, lpDisplayName);
|
---|
845 | if(lpLoadOrderGroup)
|
---|
846 | lpLoadOrderGroupA = HEAP_strdupWtoA(GetProcessHeap(), 0, lpLoadOrderGroup);
|
---|
847 |
|
---|
848 | hService = CreateServiceA(hSCManager,lpServiceNameA, lpDisplayNameA,
|
---|
849 | dwDesiredAccess, dwServiceType, dwStartType,
|
---|
850 | dwErrorControl, lpBinaryPathNameA, lpLoadOrderGroupA,
|
---|
851 | lpdwTagId, lpDependenciesA, lpServiceStartNameA,
|
---|
852 | lpPasswordA);
|
---|
853 |
|
---|
854 | if(lpServiceNameA) HeapFree(GetProcessHeap(), 0, lpServiceNameA);
|
---|
855 | if(lpDisplayNameA) HeapFree(GetProcessHeap(), 0, lpDisplayNameA);
|
---|
856 | if(lpBinaryPathNameA) HeapFree(GetProcessHeap(), 0, lpBinaryPathNameA);
|
---|
857 | if(lpDependenciesA) HeapFree(GetProcessHeap(), 0, lpDependenciesA);
|
---|
858 | if(lpServiceStartNameA) HeapFree(GetProcessHeap(), 0, lpServiceStartNameA);
|
---|
859 | if(lpPasswordA) HeapFree(GetProcessHeap(), 0, lpPasswordA);
|
---|
860 | if(lpLoadOrderGroupA) HeapFree(GetProcessHeap(), 0, lpLoadOrderGroupA);
|
---|
861 |
|
---|
862 | return hService;
|
---|
863 | }
|
---|
864 |
|
---|
865 | /*****************************************************************************
|
---|
866 | * Name : StartServiceA
|
---|
867 | * Purpose : The StartService function starts the execution of a service.
|
---|
868 | * Parameters: SC_HANDLE schService handle of service
|
---|
869 | * DWORD dwNumServiceArgs number of arguments
|
---|
870 | * LPCSTR *lpszServiceArgs address of array of argument string pointers
|
---|
871 | * Variables :
|
---|
872 | * Result :
|
---|
873 | * Remark :
|
---|
874 | * Status : UNTESTED STUB
|
---|
875 | *
|
---|
876 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
877 | *****************************************************************************/
|
---|
878 |
|
---|
879 | BOOL WIN32API StartServiceA(SC_HANDLE schService,
|
---|
880 | DWORD dwNumServiceArgs,
|
---|
881 | LPCSTR *lpszServiceArgs)
|
---|
882 | {
|
---|
883 | dprintf(("ADVAPI32: StartServiceA(%08xh,%08xh,%s) not implemented.\n",
|
---|
884 | schService,
|
---|
885 | dwNumServiceArgs,
|
---|
886 | lpszServiceArgs));
|
---|
887 |
|
---|
888 | if(CheckServiceHandle(schService) == FALSE) {
|
---|
889 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
890 | return FALSE;
|
---|
891 | }
|
---|
892 |
|
---|
893 | DWORD state = SERVICE_RUNNING;
|
---|
894 | if(!RegSetValueExA((HKEY)schService, REG_SERVICE_STATUS, 0, REG_DWORD, (LPBYTE)&state, sizeof(DWORD))) {
|
---|
895 | return TRUE;
|
---|
896 | }
|
---|
897 |
|
---|
898 | return (FALSE); /* signal failure */
|
---|
899 | }
|
---|
900 |
|
---|
901 | /*****************************************************************************
|
---|
902 | * Name : StartServiceW
|
---|
903 | * Purpose : The StartService function starts the execution of a service.
|
---|
904 | * Parameters: SC_HANDLE schService handle of service
|
---|
905 | * DWORD dwNumServiceArgs number of arguments
|
---|
906 | * LPCWSTR *lpszServiceArgs address of array of argument string pointers
|
---|
907 | * Variables :
|
---|
908 | * Result :
|
---|
909 | * Remark :
|
---|
910 | * Status : UNTESTED STUB
|
---|
911 | *
|
---|
912 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
913 | *****************************************************************************/
|
---|
914 |
|
---|
915 | BOOL WIN32API StartServiceW(SC_HANDLE schService,
|
---|
916 | DWORD dwNumServiceArgs,
|
---|
917 | LPCWSTR *lpszServiceArgs)
|
---|
918 | {
|
---|
919 | dprintf(("ADVAPI32: StartServiceW(%08xh,%08xh,%s) not implemented.\n",
|
---|
920 | schService,
|
---|
921 | dwNumServiceArgs,
|
---|
922 | lpszServiceArgs));
|
---|
923 |
|
---|
924 | if(CheckServiceHandle(schService) == FALSE) {
|
---|
925 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
926 | return FALSE;
|
---|
927 | }
|
---|
928 |
|
---|
929 | DWORD state = SERVICE_RUNNING;
|
---|
930 | if(!RegSetValueExW((HKEY)schService, REG_SERVICE_STATUS_W, 0, REG_DWORD, (LPBYTE)&state, sizeof(DWORD))) {
|
---|
931 | return TRUE;
|
---|
932 | }
|
---|
933 | return (FALSE); /* signal failure */
|
---|
934 | }
|
---|
935 |
|
---|
936 | /*****************************************************************************
|
---|
937 | * Name : DeleteService
|
---|
938 | * Purpose : The DeleteService function marks the specified service for
|
---|
939 | * deletion from the service control manager database.
|
---|
940 | * Parameters: SC_HANDLE hService handle of service
|
---|
941 | * Variables :
|
---|
942 | * Result :
|
---|
943 | * Remark :
|
---|
944 | * Status : UNTESTED STUB
|
---|
945 | *
|
---|
946 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
947 | *****************************************************************************/
|
---|
948 |
|
---|
949 | BOOL WIN32API DeleteService(SC_HANDLE hService)
|
---|
950 | {
|
---|
951 | dprintf(("ADVAPI32: DeleteService(%08xh)", hService));
|
---|
952 |
|
---|
953 | if(CheckServiceHandle(hService) == FALSE) {
|
---|
954 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
955 | return FALSE;
|
---|
956 | }
|
---|
957 | DWORD deletepending = 1;
|
---|
958 | if(!RegSetValueExA((HKEY)hService, REG_SERVICE_DELETEPENDING, 0, REG_DWORD, (LPBYTE)&deletepending, sizeof(DWORD))) {
|
---|
959 | return TRUE;
|
---|
960 | }
|
---|
961 | return FALSE;
|
---|
962 | }
|
---|
963 |
|
---|
964 | /*****************************************************************************
|
---|
965 | * Name : GetServiceDisplayNameA
|
---|
966 | * Purpose : The GetServiceDisplayName function obtains the display name that
|
---|
967 | * is associated with a particular service name. The service name
|
---|
968 | * is the same as the service's registry key name.
|
---|
969 | * Parameters: SC_HANDLE hSCManager handle to a service control manager database
|
---|
970 | * LPCSTR lpServiceName the service name
|
---|
971 | * LPTSTR lpDisplayName buffer to receive the service's display name
|
---|
972 | * LPDWORD lpcchBuffer size of display name buffer and display name
|
---|
973 | * Variables :
|
---|
974 | * Result :
|
---|
975 | * Remark :
|
---|
976 | * Status : UNTESTED STUB
|
---|
977 | *
|
---|
978 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
979 | *****************************************************************************/
|
---|
980 |
|
---|
981 | BOOL WIN32API GetServiceDisplayNameA(SC_HANDLE hSCManager,
|
---|
982 | LPCSTR lpServiceName,
|
---|
983 | LPTSTR lpDisplayName,
|
---|
984 | LPDWORD lpcchBuffer)
|
---|
985 | {
|
---|
986 | HKEY keyThisService;
|
---|
987 | DWORD size, type;
|
---|
988 |
|
---|
989 | dprintf(("ADVAPI32: GetServiceDisplayNameA(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
---|
990 | hSCManager,
|
---|
991 | lpServiceName,
|
---|
992 | lpDisplayName,
|
---|
993 | lpcchBuffer));
|
---|
994 |
|
---|
995 | if(!lpServiceName || !lpDisplayName) {
|
---|
996 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
997 | return FALSE;
|
---|
998 | }
|
---|
999 | if(CheckServiceHandle(hSCManager) == FALSE) {
|
---|
1000 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
1001 | return FALSE;
|
---|
1002 | }
|
---|
1003 |
|
---|
1004 | if(RegOpenKeyA((HKEY)hSCManager, lpServiceName, &keyThisService) != 0) {
|
---|
1005 | SetLastError(ERROR_SERVICE_DOES_NOT_EXIST);
|
---|
1006 | return FALSE;
|
---|
1007 | }
|
---|
1008 | size = *lpcchBuffer;
|
---|
1009 | type = REG_SZ;
|
---|
1010 | if(RegQueryValueExA(keyThisService, REG_SERVICE_DISPLAYNAME, 0, &type, (LPBYTE)lpDisplayName, &size) == ERROR_MORE_DATA)
|
---|
1011 | {
|
---|
1012 | SetLastError(ERROR_MORE_DATA);
|
---|
1013 | *lpcchBuffer = size;
|
---|
1014 | return FALSE;
|
---|
1015 | }
|
---|
1016 | *lpcchBuffer = size;
|
---|
1017 | RegCloseKey(keyThisService);
|
---|
1018 | return TRUE;
|
---|
1019 | }
|
---|
1020 |
|
---|
1021 |
|
---|
1022 | /*****************************************************************************
|
---|
1023 | * Name : GetServiceDisplayNameW
|
---|
1024 | * Purpose : The GetServiceDisplayName function obtains the display name that
|
---|
1025 | * is associated with a particular service name. The service name
|
---|
1026 | * is the same as the service's registry key name.
|
---|
1027 | * Parameters: SC_HANDLE hSCManager handle to a service control manager database
|
---|
1028 | * LPCWSTR lpServiceName the service name
|
---|
1029 | * LPWSTR lpDisplayName buffer to receive the service's display name
|
---|
1030 | * LPDWORD lpcchBuffer size of display name buffer and display name
|
---|
1031 | * Variables :
|
---|
1032 | * Result :
|
---|
1033 | * Remark :
|
---|
1034 | * Status : UNTESTED STUB
|
---|
1035 | *
|
---|
1036 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
1037 | *****************************************************************************/
|
---|
1038 |
|
---|
1039 | BOOL WIN32API GetServiceDisplayNameW(SC_HANDLE hSCManager,
|
---|
1040 | LPCWSTR lpServiceName,
|
---|
1041 | LPWSTR lpDisplayName,
|
---|
1042 | LPDWORD lpcchBuffer)
|
---|
1043 | {
|
---|
1044 | HKEY keyThisService;
|
---|
1045 | DWORD size, type;
|
---|
1046 |
|
---|
1047 | dprintf(("ADVAPI32: GetServiceDisplayNameW(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
---|
1048 | hSCManager,
|
---|
1049 | lpServiceName,
|
---|
1050 | lpDisplayName,
|
---|
1051 | lpcchBuffer));
|
---|
1052 |
|
---|
1053 | if(!lpServiceName || !lpDisplayName) {
|
---|
1054 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
1055 | return FALSE;
|
---|
1056 | }
|
---|
1057 | if(CheckServiceHandle(hSCManager) == FALSE) {
|
---|
1058 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
1059 | return FALSE;
|
---|
1060 | }
|
---|
1061 |
|
---|
1062 | if(RegOpenKeyW((HKEY)hSCManager, lpServiceName, &keyThisService) != 0) {
|
---|
1063 | SetLastError(ERROR_SERVICE_DOES_NOT_EXIST);
|
---|
1064 | return FALSE;
|
---|
1065 | }
|
---|
1066 | size = *lpcchBuffer;
|
---|
1067 | type = REG_SZ;
|
---|
1068 | if(RegQueryValueExW(keyThisService, REG_SERVICE_DISPLAYNAME_W, 0, &type, (LPBYTE)lpDisplayName, &size) == ERROR_MORE_DATA)
|
---|
1069 | {
|
---|
1070 | SetLastError(ERROR_MORE_DATA);
|
---|
1071 | *lpcchBuffer = size;
|
---|
1072 | return FALSE;
|
---|
1073 | }
|
---|
1074 | *lpcchBuffer = size;
|
---|
1075 | RegCloseKey(keyThisService);
|
---|
1076 | return TRUE;
|
---|
1077 | }
|
---|
1078 |
|
---|
1079 | /*****************************************************************************
|
---|
1080 | * Name : EnumDependentServicesA
|
---|
1081 | * Purpose : The EnumDependentServices function enumerates services that
|
---|
1082 | * depend on another specified service; that is, the specified
|
---|
1083 | * service must be running before the enumerated services can run.
|
---|
1084 | * The name and status of each dependent service are provided.
|
---|
1085 | * Parameters: SC_HANDLE hService handle of service
|
---|
1086 | * DWORD dwServiceState state of services to enumerate
|
---|
1087 | * LPENUM_SERVICE_STATUS lpServices address of service status buffer
|
---|
1088 | * DWORD cbBufSize size of service status buffer
|
---|
1089 | * LPDWORD pcbBytesNeeded address of variable for bytes needed
|
---|
1090 | * LPDWORD lpServicesReturned address of variable for number returned
|
---|
1091 | * Variables :
|
---|
1092 | * Result :
|
---|
1093 | * Remark :
|
---|
1094 | * Status : UNTESTED STUB
|
---|
1095 | *
|
---|
1096 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
1097 | *****************************************************************************/
|
---|
1098 |
|
---|
1099 | BOOL WIN32API EnumDependentServicesA(SC_HANDLE hService,
|
---|
1100 | DWORD dwServiceState,
|
---|
1101 | LPENUM_SERVICE_STATUSA lpServices,
|
---|
1102 | DWORD cbBufSize,
|
---|
1103 | LPDWORD pcbBytesNeeded,
|
---|
1104 | LPDWORD lpServicesReturned)
|
---|
1105 | {
|
---|
1106 | dprintf(("ADVAPI32: EnumDependentServicesA(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
---|
1107 | hService,
|
---|
1108 | dwServiceState,
|
---|
1109 | lpServices,
|
---|
1110 | cbBufSize,
|
---|
1111 | pcbBytesNeeded,
|
---|
1112 | lpServicesReturned));
|
---|
1113 |
|
---|
1114 | return (FALSE); /* signal failure */
|
---|
1115 | }
|
---|
1116 |
|
---|
1117 |
|
---|
1118 | /*****************************************************************************
|
---|
1119 | * Name : EnumDependentServicesW
|
---|
1120 | * Purpose : The EnumDependentServices function enumerates services that
|
---|
1121 | * depend on another specified service; that is, the specified
|
---|
1122 | * service must be running before the enumerated services can run.
|
---|
1123 | * The name and status of each dependent service are provided.
|
---|
1124 | * Parameters: SC_HANDLE hService handle of service
|
---|
1125 | * DWORD dwServiceState state of services to enumerate
|
---|
1126 | * LPENUM_SERVICE_STATUS lpServices address of service status buffer
|
---|
1127 | * DWORD cbBufSize size of service status buffer
|
---|
1128 | * LPDWORD pcbBytesNeeded address of variable for bytes needed
|
---|
1129 | * LPDWORD lpServicesReturned address of variable for number returned
|
---|
1130 | * Variables :
|
---|
1131 | * Result :
|
---|
1132 | * Remark :
|
---|
1133 | * Status : UNTESTED STUB
|
---|
1134 | *
|
---|
1135 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
1136 | *****************************************************************************/
|
---|
1137 |
|
---|
1138 | BOOL WIN32API EnumDependentServicesW(SC_HANDLE hService,
|
---|
1139 | DWORD dwServiceState,
|
---|
1140 | LPENUM_SERVICE_STATUSW lpServices,
|
---|
1141 | DWORD cbBufSize,
|
---|
1142 | LPDWORD pcbBytesNeeded,
|
---|
1143 | LPDWORD lpServicesReturned)
|
---|
1144 | {
|
---|
1145 | dprintf(("ADVAPI32: EnumDependentServicesW(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
---|
1146 | hService,
|
---|
1147 | dwServiceState,
|
---|
1148 | lpServices,
|
---|
1149 | cbBufSize,
|
---|
1150 | pcbBytesNeeded,
|
---|
1151 | lpServicesReturned));
|
---|
1152 |
|
---|
1153 | return (FALSE); /* signal failure */
|
---|
1154 | }
|
---|
1155 |
|
---|
1156 |
|
---|
1157 | /*****************************************************************************
|
---|
1158 | * Name : EnumServicesStatusA
|
---|
1159 | * Purpose : The EnumServicesStatus function enumerates services in the specified
|
---|
1160 | * service control manager database. The name and status of each service are provided.
|
---|
1161 | * Parameters: SC_HANDLE hSCManager handle of service control manager database
|
---|
1162 | * DWORD dwServiceType type of services to enumerate
|
---|
1163 | * DWORD dwServiceState state of services to enumerate
|
---|
1164 | * LPENUM_SERVICE_STATUS lpServices address of service status buffer
|
---|
1165 | * DWORD cbBufSize size of service status buffer
|
---|
1166 | * LPDWORD pcbBytesNeeded address of variable for bytes needed
|
---|
1167 | * LPDWORD lpServicesReturned address of variable for number returned
|
---|
1168 | * LPDWORD lpResumeHandle address of variable for next entry
|
---|
1169 | * Variables :
|
---|
1170 | * Result :
|
---|
1171 | * Remark :
|
---|
1172 | * Status : UNTESTED STUB
|
---|
1173 | *
|
---|
1174 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
1175 | *****************************************************************************/
|
---|
1176 |
|
---|
1177 | BOOL WIN32API EnumServicesStatusA(SC_HANDLE hSCManager,
|
---|
1178 | DWORD dwServiceType,
|
---|
1179 | DWORD dwServiceState,
|
---|
1180 | LPENUM_SERVICE_STATUSA lpServices,
|
---|
1181 | DWORD cbBufSize,
|
---|
1182 | LPDWORD pcbBytesNeeded,
|
---|
1183 | LPDWORD lpServicesReturned,
|
---|
1184 | LPDWORD lpResumeHandle)
|
---|
1185 | {
|
---|
1186 | dprintf(("ADVAPI32: EnumServicesStatusA(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
---|
1187 | hSCManager,
|
---|
1188 | dwServiceType,
|
---|
1189 | dwServiceState,
|
---|
1190 | lpServices,
|
---|
1191 | cbBufSize,
|
---|
1192 | pcbBytesNeeded,
|
---|
1193 | lpServicesReturned,
|
---|
1194 | lpResumeHandle));
|
---|
1195 |
|
---|
1196 | return (FALSE); /* signal failure */
|
---|
1197 | }
|
---|
1198 |
|
---|
1199 |
|
---|
1200 | /*****************************************************************************
|
---|
1201 | * Name : EnumServicesStatusW
|
---|
1202 | * Purpose : The EnumServicesStatus function enumerates services in the specified
|
---|
1203 | * service control manager database. The name and status of each service are provided.
|
---|
1204 | * Parameters: SC_HANDLE hSCManager handle of service control manager database
|
---|
1205 | * DWORD dwServiceType type of services to enumerate
|
---|
1206 | * DWORD dwServiceState state of services to enumerate
|
---|
1207 | * LPENUM_SERVICE_STATUS lpServices address of service status buffer
|
---|
1208 | * DWORD cbBufSize size of service status buffer
|
---|
1209 | * LPDWORD pcbBytesNeeded address of variable for bytes needed
|
---|
1210 | * LPDWORD lpServicesReturned address of variable for number returned
|
---|
1211 | * LPDWORD lpResumeHandle address of variable for next entry
|
---|
1212 | * Variables :
|
---|
1213 | * Result :
|
---|
1214 | * Remark :
|
---|
1215 | * Status : UNTESTED STUB
|
---|
1216 | *
|
---|
1217 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
1218 | *****************************************************************************/
|
---|
1219 |
|
---|
1220 | BOOL WIN32API EnumServicesStatusW(SC_HANDLE hSCManager,
|
---|
1221 | DWORD dwServiceType,
|
---|
1222 | DWORD dwServiceState,
|
---|
1223 | LPENUM_SERVICE_STATUSW lpServices,
|
---|
1224 | DWORD cbBufSize,
|
---|
1225 | LPDWORD pcbBytesNeeded,
|
---|
1226 | LPDWORD lpServicesReturned,
|
---|
1227 | LPDWORD lpResumeHandle)
|
---|
1228 | {
|
---|
1229 | dprintf(("ADVAPI32: EnumServicesStatusW(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
---|
1230 | hSCManager,
|
---|
1231 | dwServiceType,
|
---|
1232 | dwServiceState,
|
---|
1233 | lpServices,
|
---|
1234 | cbBufSize,
|
---|
1235 | pcbBytesNeeded,
|
---|
1236 | lpServicesReturned,
|
---|
1237 | lpResumeHandle));
|
---|
1238 |
|
---|
1239 | return (FALSE); /* signal failure */
|
---|
1240 | }
|
---|
1241 |
|
---|
1242 | /*****************************************************************************
|
---|
1243 | * Name : GetServiceKeyNameA
|
---|
1244 | * Purpose : The GetServiceKeyName function obtains the service name that is
|
---|
1245 | * associated with a particular service's display name. The service
|
---|
1246 | * name is the same as the service's registry key name.
|
---|
1247 | * Parameters: SC_HANDLE hSCManager handle to a service control manager database
|
---|
1248 | * LPCSTR lpDisplayName the service's display name
|
---|
1249 | * LPTSTR lpServiceName buffer to receive the service name
|
---|
1250 | * LPDWORD lpcchBuffer size of service name buffer and service name
|
---|
1251 | * Variables :
|
---|
1252 | * Result :
|
---|
1253 | * Remark :
|
---|
1254 | * Status : UNTESTED STUB
|
---|
1255 | *
|
---|
1256 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
1257 | *****************************************************************************/
|
---|
1258 |
|
---|
1259 | BOOL WIN32API GetServiceKeyNameA(SC_HANDLE hSCManager,
|
---|
1260 | LPCSTR lpDisplayName,
|
---|
1261 | LPTSTR lpServiceName,
|
---|
1262 | LPDWORD lpcchBuffer)
|
---|
1263 | {
|
---|
1264 | dprintf(("ADVAPI32: GetServiceKeyNameA(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
---|
1265 | hSCManager,
|
---|
1266 | lpDisplayName,
|
---|
1267 | lpServiceName,
|
---|
1268 | lpcchBuffer));
|
---|
1269 |
|
---|
1270 | return (FALSE); /* signal failure */
|
---|
1271 | }
|
---|
1272 |
|
---|
1273 |
|
---|
1274 | /*****************************************************************************
|
---|
1275 | * Name : GetServiceKeyNameW
|
---|
1276 | * Purpose : The GetServiceKeyName function obtains the service name that is
|
---|
1277 | * associated with a particular service's display name. The service
|
---|
1278 | * name is the same as the service's registry key name.
|
---|
1279 | * Parameters: SC_HANDLE hSCManager handle to a service control manager database
|
---|
1280 | * LPCWSTR lpDisplayName the service's display name
|
---|
1281 | * LPWSTR lpServiceName buffer to receive the service name
|
---|
1282 | * LPDWORD lpcchBuffer size of service name buffer and service name
|
---|
1283 | * Variables :
|
---|
1284 | * Result :
|
---|
1285 | * Remark :
|
---|
1286 | * Status : UNTESTED STUB
|
---|
1287 | *
|
---|
1288 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
1289 | *****************************************************************************/
|
---|
1290 |
|
---|
1291 | BOOL WIN32API GetServiceKeyNameW(SC_HANDLE hSCManager,
|
---|
1292 | LPCWSTR lpDisplayName,
|
---|
1293 | LPWSTR lpServiceName,
|
---|
1294 | LPDWORD lpcchBuffer)
|
---|
1295 | {
|
---|
1296 | dprintf(("ADVAPI32: GetServiceKeyNameW(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
---|
1297 | hSCManager,
|
---|
1298 | lpDisplayName,
|
---|
1299 | lpServiceName,
|
---|
1300 | lpcchBuffer));
|
---|
1301 |
|
---|
1302 | return (FALSE); /* signal failure */
|
---|
1303 | }
|
---|
1304 |
|
---|
1305 | /*****************************************************************************
|
---|
1306 | * Name : LockServiceDatabase
|
---|
1307 | * Purpose : The LockServiceDatabase function locks a specified database.
|
---|
1308 | * Parameters: SC_HANDLE hSCManager handle of service control manager database
|
---|
1309 | * Variables :
|
---|
1310 | * Result :
|
---|
1311 | * Remark :
|
---|
1312 | * Status : UNTESTED STUB
|
---|
1313 | *
|
---|
1314 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
1315 | *****************************************************************************/
|
---|
1316 |
|
---|
1317 | SC_LOCK WIN32API LockServiceDatabase(SC_HANDLE hSCManager)
|
---|
1318 | {
|
---|
1319 | dprintf(("ADVAPI32: LockServiceDatabase(%08xh) not implemented.\n",
|
---|
1320 | hSCManager));
|
---|
1321 |
|
---|
1322 | return 0; /* signal failure */
|
---|
1323 | }
|
---|
1324 |
|
---|
1325 | /*****************************************************************************
|
---|
1326 | * Name : UnlockServiceDatabase
|
---|
1327 | * Purpose : The UnlockServiceDatabase function unlocks a service control
|
---|
1328 | * manager database by releasing the specified lock.
|
---|
1329 | * Parameters: SC_LOCK sclLock service control manager database lock to be released
|
---|
1330 | * Variables :
|
---|
1331 | * Result :
|
---|
1332 | * Remark :
|
---|
1333 | * Status : UNTESTED STUB
|
---|
1334 | *
|
---|
1335 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
1336 |
|
---|
1337 | *****************************************************************************/
|
---|
1338 |
|
---|
1339 | BOOL WIN32API UnlockServiceDatabase(SC_LOCK sclLock)
|
---|
1340 | {
|
---|
1341 | dprintf(("ADVAPI32: UnlockServiceDatabase(%08xh) not implemented.\n",
|
---|
1342 | sclLock));
|
---|
1343 |
|
---|
1344 | return (FALSE); /* signal failure */
|
---|
1345 | }
|
---|
1346 |
|
---|
1347 |
|
---|
1348 |
|
---|
1349 |
|
---|
1350 | /*****************************************************************************
|
---|
1351 | * Name : StartServiceCtrlDispatcherW
|
---|
1352 | * Purpose : The StartServiceCtrlDispatcher function connects the main thread
|
---|
1353 | * of a service process to the service control manager, which causes
|
---|
1354 | * the thread to be the service control dispatcher thread for the calling process.
|
---|
1355 | * Parameters: LPSERVICE_TABLE_ENTRY lpsteServiceTable address of service table
|
---|
1356 | * Variables :
|
---|
1357 | * Result :
|
---|
1358 | * Remark :
|
---|
1359 | * Status : UNTESTED STUB
|
---|
1360 | *
|
---|
1361 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
1362 | *****************************************************************************/
|
---|
1363 |
|
---|
1364 | BOOL WIN32API StartServiceCtrlDispatcherW(LPSERVICE_TABLE_ENTRYW lpsteServiceTable)
|
---|
1365 | {
|
---|
1366 | dprintf(("ADVAPI32: StartServiceCtrlDispatcherW(%08xh) not implemented.\n",
|
---|
1367 | lpsteServiceTable));
|
---|
1368 |
|
---|
1369 | return (FALSE); /* signal failure */
|
---|
1370 | }
|
---|
1371 |
|
---|
1372 |
|
---|
1373 | /*****************************************************************************
|
---|
1374 | * Name : StartServiceCtrlDispatcherA
|
---|
1375 | * Purpose : The StartServiceCtrlDispatcher function connects the main thread
|
---|
1376 | * of a service process to the service control manager, which causes
|
---|
1377 | * the thread to be the service control dispatcher thread for the calling process.
|
---|
1378 | * Parameters: LPSERVICE_TABLE_ENTRY lpsteServiceTable address of service table
|
---|
1379 | * Variables :
|
---|
1380 | * Result :
|
---|
1381 | * Remark :
|
---|
1382 | * Status : UNTESTED STUB
|
---|
1383 | *
|
---|
1384 | * Author : Patrick Haller [Tue, 1998/06/16 23:00]
|
---|
1385 | *****************************************************************************/
|
---|
1386 |
|
---|
1387 | BOOL WIN32API StartServiceCtrlDispatcherA(LPSERVICE_TABLE_ENTRYA lpsteServiceTable)
|
---|
1388 | {
|
---|
1389 | dprintf(("ADVAPI32: StartServiceCtrlDispatcherA(%08xh) not implemented.\n",
|
---|
1390 | lpsteServiceTable));
|
---|
1391 |
|
---|
1392 | return (FALSE); /* signal failure */
|
---|
1393 | }
|
---|
1394 |
|
---|
1395 |
|
---|