source: trunk/src/advapi32/service.cpp@ 2172

Last change on this file since 2172 was 2172, checked in by sandervl, 26 years ago

service apis bugfixed & added

File size: 52.7 KB
Line 
1/* $Id: service.cpp,v 1.3 1999-12-21 00:31:38 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
30ODINDEBUGCHANNEL(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//*****************************************************************************
57BOOL 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
83SC_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
120SC_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
162SC_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
203SC_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
241BOOL 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
272BOOL 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
303BOOL 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
334BOOL 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
365BOOL 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 : QueryServiceStatus
384 * Purpose : The QueryServiceStatus function retrieves the current status of
385 * the specified service.
386 * Parameters: SC_HANDLE schService handle of service
387 * LPSERVICE_STATUS lpssServiceStatus address of service 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
396BOOL WIN32API QueryServiceStatus(SC_HANDLE schService,
397 LPSERVICE_STATUS lpssServiceStatus)
398{
399 DWORD size, keytype;
400
401 dprintf(("ADVAPI32: QueryServiceStatus(%08xh,%08xh) not correctly implemented.\n",
402 schService,
403 lpssServiceStatus));
404
405 if(CheckServiceHandle(schService) == FALSE) {
406 SetLastError(ERROR_INVALID_PARAMETER);
407 return FALSE;
408 }
409
410 memset(lpssServiceStatus, 0, sizeof(SERVICE_STATUS));
411
412 size = sizeof(DWORD);
413 keytype = REG_DWORD;
414 RegQueryValueExA((HKEY)schService, REG_SERVICE_TYPE, 0, &keytype, (LPBYTE)&lpssServiceStatus->dwServiceType, &size);
415
416 size = sizeof(DWORD);
417 keytype = REG_DWORD;
418 RegQueryValueExA((HKEY)schService, REG_SERVICE_STATUS, 0, &keytype, (LPBYTE)&lpssServiceStatus->dwCurrentState, &size);
419
420 //TODO: Should this be set by the service once it has started?
421 lpssServiceStatus->dwControlsAccepted = SERVICE_ACCEPT_STOP|SERVICE_ACCEPT_PAUSE_CONTINUE|SERVICE_ACCEPT_SHUTDOWN;
422 return TRUE;
423}
424
425/*****************************************************************************
426 * Name : SetServiceObjectSecurity
427 * Purpose : The SetServiceObjectSecurity function sets the security
428 * descriptor of a service object.
429 * Parameters: SC_HANDLE schService handle of service
430 * SECURITY_INFORMATION fdwSecurityInfo type of security information requested
431 * PSECURITY_DESCRIPTOR psdSecurityDesc address of security descriptor
432 * Variables :
433 * Result :
434 * Remark :
435 * Status : UNTESTED STUB
436 *
437 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
438 *****************************************************************************/
439
440BOOL WIN32API SetServiceObjectSecurity(SC_HANDLE schService,
441 SECURITY_INFORMATION fdwSecurityInfo,
442 PSECURITY_DESCRIPTOR psdSecurityDesc)
443{
444 dprintf(("ADVAPI32: SetServiceObjectSecurity(%08xh,%08xh,%08xh) not implemented.\n",
445 schService,
446 fdwSecurityInfo,
447 psdSecurityDesc));
448
449 return (FALSE); /* signal failure */
450}
451
452/*****************************************************************************
453 * Name : ChangeServiceConfigA
454 * Purpose : The ChangeServiceConfig function changes the configuration
455 * parameters of a service.
456 * Parameters: SC_HANDLE hService handle of service
457 * DWORD dwServiceType type of service
458 * DWORD dwStartType when to start service
459 * DWORD dwErrorControl severity if service fails to start
460 * LPCSTR lpBinaryPathName address of service binary file name
461 * LPCSTR lpLoadOrderGroup address of load ordering group name
462 * LPDWORD lpdwTagId address of variable to get tag identifier
463 * LPCSTR lpDependencies address of array of dependency names
464 * LPCSTR lpServiceStartName address of account name of service
465 * LPCSTR lpPassword address of password for service account
466 * LPCSTR lpDisplayName address of display name
467 * Variables :
468 * Result :
469 * Remark :
470 * Status : UNTESTED STUB
471 *
472 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
473 *****************************************************************************/
474
475BOOL WIN32API ChangeServiceConfigA(SC_HANDLE hService,
476 DWORD dwServiceType,
477 DWORD dwStartType,
478 DWORD dwErrorControl,
479 LPCSTR lpBinaryPathName,
480 LPCSTR lpLoadOrderGroup,
481 LPDWORD lpdwTagId,
482 LPCSTR lpDependencies,
483 LPCSTR lpServiceStartName,
484 LPCSTR lpPassword,
485 LPCSTR lpDisplayName)
486{
487 dprintf(("ADVAPI32: ChangeServiceConfigA(%08xh,%08xh,%08xh,%08xh,%s,%s,%08xh,%s,%s,%s,%s) not implemented.\n",
488 hService,
489 dwServiceType,
490 dwStartType,
491 dwErrorControl,
492 lpBinaryPathName,
493 lpLoadOrderGroup,
494 lpdwTagId,
495 lpDependencies,
496 lpServiceStartName,
497 lpPassword,
498 lpDisplayName));
499
500 return (FALSE); /* signal failure */
501}
502
503
504/*****************************************************************************
505 * Name : ChangeServiceConfigW
506 * Purpose : The ChangeServiceConfig function changes the configuration
507 * parameters of a service.
508 * Parameters: SC_HANDLE hService handle of service
509 * DWORD dwServiceType type of service
510 * DWORD dwStartType when to start service
511 * DWORD dwErrorControl severity if service fails to start
512 * LPCWSTR lpBinaryPathName address of service binary file name
513 * LPCWSTR lpLoadOrderGroup address of load ordering group name
514 * LPDWORD lpdwTagId address of variable to get tag identifier
515 * LPCWSTR lpDependencies address of array of dependency names
516 * LPCWSTR lpServiceStartName address of account name of service
517 * LPCWSTR lpPassword address of password for service account
518 * LPCWSTR lpDisplayName address of display name
519 * Variables :
520 * Result :
521 * Remark :
522 * Status : UNTESTED STUB
523 *
524 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
525 *****************************************************************************/
526
527BOOL WIN32API ChangeServiceConfigW(SC_HANDLE hService,
528 DWORD dwServiceType,
529 DWORD dwStartType,
530 DWORD dwErrorControl,
531 LPCWSTR lpBinaryPathName,
532 LPCWSTR lpLoadOrderGroup,
533 LPDWORD lpdwTagId,
534 LPCWSTR lpDependencies,
535 LPCWSTR lpServiceStartName,
536 LPCWSTR lpPassword,
537 LPCWSTR lpDisplayName)
538{
539 dprintf(("ADVAPI32: ChangeServiceConfigW(%08xh,%08xh,%08xh,%08xh,%s,%s,%08xh,%s,%s,%s,%s) not implemented.\n",
540 hService,
541 dwServiceType,
542 dwStartType,
543 dwErrorControl,
544 lpBinaryPathName,
545 lpLoadOrderGroup,
546 lpdwTagId,
547 lpDependencies,
548 lpServiceStartName,
549 lpPassword,
550 lpDisplayName));
551
552 return (FALSE); /* signal failure */
553}
554
555
556/*****************************************************************************
557 * Name : CloseServiceHandle
558 * Purpose : The CloseServiceHandle function closes a handle to a service
559 * control manager database as returned by the OpenSCManager function,
560 * or it closes a handle to a service object as returned by either
561 * the OpenService or CreateService function.
562 * Parameters: SC_HANDLE hSCObject handle of service or service control manager database
563 * Variables :
564 * Result :
565 * Remark :
566 * Status : UNTESTED STUB
567 *
568 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
569 *****************************************************************************/
570
571BOOL WIN32API CloseServiceHandle(SC_HANDLE hSCObject)
572{
573 dprintf(("ADVAPI32: CloseServiceHandle(%08xh)",
574 hSCObject));
575
576 if(CheckServiceHandle(hSCObject) == FALSE) {
577 SetLastError(ERROR_INVALID_PARAMETER);
578 return FALSE;
579 }
580
581 DWORD deletepending, keytype = REG_DWORD, size = sizeof(DWORD);
582 if(!RegQueryValueExA((HKEY)hSCObject, REG_SERVICE_DELETEPENDING, 0, &keytype, (LPBYTE)&deletepending, &size)) {
583 FILETIME filetime;
584 DWORD bla, classsize;
585 CHAR szClassName[64];
586
587 HKEY keyServices;
588 if(RegCreateKeyA(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services", &keyServices) != 0) {
589 SetLastError(ERROR_INTERNAL_ERROR);
590 return FALSE;
591 }
592
593 //NOTE: Assumes for now there are no subkeys
594 //TODO: DOes not work
595 classsize = sizeof(szClassName);
596 RegQueryValueA((HKEY)hSCObject, NULL, szClassName, (LPLONG)&classsize);
597 RegCloseKey((HKEY)hSCObject);
598 RegDeleteKeyA(keyServices, szClassName);
599 }
600
601 RegCloseKey((HKEY)hSCObject);
602 return TRUE;
603}
604
605/*****************************************************************************
606 * Name : ControlService
607 * Purpose : The ControlService function sends a control code to a Win32 service.
608 * Parameters: SC_HANDLE hService handle of service
609 * DWORD dwControl control code
610 * LPSERVICE_STATUS lpServiceStatus address of service status structure
611 * Variables :
612 * Result :
613 * Remark :
614 * Status : UNTESTED STUB
615 *
616 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
617 *****************************************************************************/
618
619BOOL WIN32API ControlService(SC_HANDLE hService,
620 DWORD dwControl,
621 LPSERVICE_STATUS lpServiceStatus)
622{
623 dprintf(("ADVAPI32: ControlService(%08xh,%08xh,%08xh) not correctly implemented.\n",
624 hService,
625 dwControl,
626 lpServiceStatus));
627 HKEY keyThisService;
628
629 if(CheckServiceHandle(hService) == FALSE) {
630 SetLastError(ERROR_INVALID_PARAMETER);
631 return FALSE;
632 }
633 return TRUE;
634}
635
636
637/*****************************************************************************
638 * Name : CreateServiceA
639 * Purpose : The CreateService function creates a service object and adds it
640 * to the specified service control manager database.
641 * Parameters: SC_HANDLE hSCManager handle of service control manager database
642 * LPCSTR lpServiceName address of name of service to start
643 * LPCSTR lpDisplayName address of display name
644 * DWORD dwDesiredAccess type of access to service
645 * DWORD dwServiceType type of service
646 * DWORD dwStartType when to start service
647 * DWORD dwErrorControl severity if service fails to start
648 * LPCSTR lpBinaryPathName address of name of binary file
649 * LPCSTR lpLoadOrderGroup address of name of load ordering group
650 * LPDWORD lpdwTagId address of variable to get tag identifier
651 * LPCSTR lpDependencies address of array of dependency names
652 * LPCSTR lpServiceStartName address of account name of service
653 * LPCSTR lpPassword address of password for service account
654 * Variables :
655 * Result :
656 * Remark :
657 * Status : UNTESTED STUB
658 *
659 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
660 *****************************************************************************/
661
662SC_HANDLE WIN32API CreateServiceA(SC_HANDLE hSCManager,
663 LPCSTR lpServiceName,
664 LPCSTR lpDisplayName,
665 DWORD dwDesiredAccess,
666 DWORD dwServiceType,
667 DWORD dwStartType,
668 DWORD dwErrorControl,
669 LPCSTR lpBinaryPathName,
670 LPCSTR lpLoadOrderGroup,
671 LPDWORD lpdwTagId,
672 LPCSTR lpDependencies,
673 LPCSTR lpServiceStartName,
674 LPCSTR lpPassword)
675{
676 HKEY keyServices, keyThisService;
677
678 dprintf(("ADVAPI32: CreateServiceA(%08xh,%s,%s,%08xh,%08xh,%08xh,%08xh,%s,%s,%08xh,%s,%s,%s) not correctly implemented.\n",
679 hSCManager,
680 lpServiceName,
681 lpDisplayName,
682 dwDesiredAccess,
683 dwServiceType,
684 dwStartType,
685 dwErrorControl,
686 lpBinaryPathName,
687 lpLoadOrderGroup,
688 lpdwTagId,
689 lpDependencies,
690 lpServiceStartName,
691 lpPassword));
692
693 //displayname too?
694 if(lpServiceName == NULL || lpBinaryPathName == NULL) {
695 SetLastError(ERROR_INVALID_PARAMETER);
696 return 0;
697 }
698
699 if(RegCreateKeyA(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services", &keyServices) != 0) {
700 SetLastError(ERROR_INTERNAL_ERROR);
701 return 0;
702 }
703 if(RegCreateKeyA(keyServices, lpServiceName, &keyThisService) != 0) {
704 SetLastError(ERROR_INTERNAL_ERROR);
705 return 0;
706 }
707 RegSetValueExA(keyThisService, REG_SERVICE_TYPE, 0, REG_DWORD, (LPBYTE)&dwServiceType, sizeof(DWORD));
708 RegSetValueExA(keyThisService, REG_SERVICE_STARTTYPE, 0, REG_DWORD, (LPBYTE)&dwStartType, sizeof(DWORD));
709 RegSetValueExA(keyThisService, REG_SERVICE_ERRORCONTROL, 0, REG_DWORD, (LPBYTE)&dwErrorControl, sizeof(DWORD));
710 if(lpDisplayName)
711 RegSetValueExA(keyThisService, REG_SERVICE_DISPLAYNAME, 0, REG_SZ, (LPBYTE)lpDisplayName, strlen(lpDisplayName)+1);
712 if(lpLoadOrderGroup)
713 RegSetValueExA(keyThisService, REG_SERVICE_LOADORDERGROUP, 0, REG_SZ, (LPBYTE)lpDisplayName, strlen(lpLoadOrderGroup)+1);
714 if(lpDependencies) {
715 //seems to need an extra terminating '0'
716 int size = strlen(lpDependencies)+2;
717 char *dependencies = (char *)malloc(size);
718 memset(dependencies, 0, size);
719 strcpy(dependencies, lpDependencies);
720 RegSetValueExA(keyThisService, REG_SERVICE_DEPENDENCIES, 0, REG_BINARY, (LPBYTE)dependencies, size);
721 free(dependencies);
722 }
723 //TODO: %SystemRoot%
724 RegSetValueExA(keyThisService, REG_SERVICE_IMAGEPATH, 0, REG_SZ, (LPBYTE)lpBinaryPathName, strlen(lpBinaryPathName)+1);
725
726 //Pointer to a variable that receives a tag value that is unique in the group specified in the
727 //lpLoadOrderGroup parameter. Specify NULL if you are not changing the existing tag.
728 DWORD tag = 1; //TODO!!
729 RegSetValueExA(keyThisService, REG_SERVICE_TAG, 0, REG_DWORD, (LPBYTE)&tag, sizeof(DWORD));
730 if(lpdwTagId)
731 *lpdwTagId = tag;
732
733 DWORD state = SERVICE_STOPPED;
734 RegSetValueExA(keyThisService, REG_SERVICE_STATUS, 0, REG_DWORD, (LPBYTE)&state, sizeof(DWORD));
735
736 //TODO: What else?
737
738 RegCloseKey(keyServices);
739 return keyThisService;
740}
741
742
743/*****************************************************************************
744 * Name : CreateServiceW
745 * Purpose : The CreateService function creates a service object and adds it
746 * to the specified service control manager database.
747 * Parameters: SC_HANDLE hSCManager handle of service control manager database
748 * LPCWSTR lpServiceName address of name of service to start
749 * LPCWSTR lpDisplayName address of display name
750 * DWORD dwDesiredAccess type of access to service
751 * DWORD dwServiceType type of service
752 * DWORD dwStartType when to start service
753 * DWORD dwErrorControl severity if service fails to start
754 * LPCWSTR lpBinaryPathName address of name of binary file
755 * LPCWSTR lpLoadOrderGroup address of name of load ordering group
756 * LPDWORD lpdwTagId address of variable to get tag identifier
757 * LPCWSTR lpDependencies address of array of dependency names
758 * LPCWSTR lpServiceStartName address of account name of service
759 * LPCWSTR lpPassword address of password for service account
760 * Variables :
761 * Result :
762 * Remark :
763 * Status : UNTESTED STUB
764 *
765 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
766 *****************************************************************************/
767
768SC_HANDLE WIN32API CreateServiceW(SC_HANDLE hSCManager,
769 LPCWSTR lpServiceName,
770 LPCWSTR lpDisplayName,
771 DWORD dwDesiredAccess,
772 DWORD dwServiceType,
773 DWORD dwStartType,
774 DWORD dwErrorControl,
775 LPCWSTR lpBinaryPathName,
776 LPCWSTR lpLoadOrderGroup,
777 LPDWORD lpdwTagId,
778 LPCWSTR lpDependencies,
779 LPCWSTR lpServiceStartName,
780 LPCWSTR lpPassword)
781{
782 LPSTR lpServiceNameA = NULL, lpDisplayNameA = NULL, lpBinaryPathNameA = NULL;
783 LPSTR lpDependenciesA = NULL, lpServiceStartNameA = NULL, lpPasswordA = NULL;
784 LPSTR lpLoadOrderGroupA = NULL;
785 SC_HANDLE hService;
786
787 dprintf(("ADVAPI32: CreateServiceW(%08xh,%s,%s,%08xh,%08xh,%08xh,%08xh,%s,%s,%08xh,%s,%s,%s) not correctly implemented.\n",
788 hSCManager,
789 lpServiceName,
790 lpDisplayName,
791 dwDesiredAccess,
792 dwServiceType,
793 dwStartType,
794 dwErrorControl,
795 lpBinaryPathName,
796 lpLoadOrderGroup,
797 lpdwTagId,
798 lpDependencies,
799 lpServiceStartName,
800 lpPassword));
801
802 if(lpServiceName)
803 lpServiceNameA = HEAP_strdupWtoA(GetProcessHeap(), 0, lpServiceName);
804 if(lpDisplayName)
805 lpDisplayNameA = HEAP_strdupWtoA(GetProcessHeap(), 0, lpDisplayName);
806 if(lpBinaryPathName)
807 lpBinaryPathNameA = HEAP_strdupWtoA(GetProcessHeap(), 0, lpBinaryPathName);
808 if(lpDependencies)
809 lpDependenciesA = HEAP_strdupWtoA(GetProcessHeap(), 0, lpDependencies);
810 if(lpServiceStartName)
811 lpServiceStartNameA = HEAP_strdupWtoA(GetProcessHeap(), 0, lpServiceStartName);
812 if(lpPassword)
813 lpPasswordA = HEAP_strdupWtoA(GetProcessHeap(), 0, lpPassword);
814 if(lpDisplayName)
815 lpDisplayNameA = HEAP_strdupWtoA(GetProcessHeap(), 0, lpDisplayName);
816 if(lpLoadOrderGroup)
817 lpLoadOrderGroupA = HEAP_strdupWtoA(GetProcessHeap(), 0, lpLoadOrderGroup);
818
819 hService = CreateServiceA(hSCManager,lpServiceNameA, lpDisplayNameA,
820 dwDesiredAccess, dwServiceType, dwStartType,
821 dwErrorControl, lpBinaryPathNameA, lpLoadOrderGroupA,
822 lpdwTagId, lpDependenciesA, lpServiceStartNameA,
823 lpPasswordA);
824
825 if(lpServiceNameA) HeapFree(GetProcessHeap(), 0, lpServiceNameA);
826 if(lpDisplayNameA) HeapFree(GetProcessHeap(), 0, lpDisplayNameA);
827 if(lpBinaryPathNameA) HeapFree(GetProcessHeap(), 0, lpBinaryPathNameA);
828 if(lpDependenciesA) HeapFree(GetProcessHeap(), 0, lpDependenciesA);
829 if(lpServiceStartNameA) HeapFree(GetProcessHeap(), 0, lpServiceStartNameA);
830 if(lpPasswordA) HeapFree(GetProcessHeap(), 0, lpPasswordA);
831 if(lpLoadOrderGroupA) HeapFree(GetProcessHeap(), 0, lpLoadOrderGroupA);
832
833 return hService;
834}
835
836/*****************************************************************************
837 * Name : StartServiceA
838 * Purpose : The StartService function starts the execution of a service.
839 * Parameters: SC_HANDLE schService handle of service
840 * DWORD dwNumServiceArgs number of arguments
841 * LPCSTR *lpszServiceArgs address of array of argument string pointers
842 * Variables :
843 * Result :
844 * Remark :
845 * Status : UNTESTED STUB
846 *
847 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
848 *****************************************************************************/
849
850BOOL WIN32API StartServiceA(SC_HANDLE schService,
851 DWORD dwNumServiceArgs,
852 LPCSTR *lpszServiceArgs)
853{
854 dprintf(("ADVAPI32: StartServiceA(%08xh,%08xh,%s) not implemented.\n",
855 schService,
856 dwNumServiceArgs,
857 lpszServiceArgs));
858
859 if(CheckServiceHandle(schService) == FALSE) {
860 SetLastError(ERROR_INVALID_PARAMETER);
861 return FALSE;
862 }
863
864 DWORD state = SERVICE_RUNNING;
865 if(!RegSetValueExA((HKEY)schService, REG_SERVICE_STATUS, 0, REG_DWORD, (LPBYTE)&state, sizeof(DWORD))) {
866 return TRUE;
867 }
868
869 return (FALSE); /* signal failure */
870}
871
872/*****************************************************************************
873 * Name : StartServiceW
874 * Purpose : The StartService function starts the execution of a service.
875 * Parameters: SC_HANDLE schService handle of service
876 * DWORD dwNumServiceArgs number of arguments
877 * LPCWSTR *lpszServiceArgs address of array of argument string pointers
878 * Variables :
879 * Result :
880 * Remark :
881 * Status : UNTESTED STUB
882 *
883 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
884 *****************************************************************************/
885
886BOOL WIN32API StartServiceW(SC_HANDLE schService,
887 DWORD dwNumServiceArgs,
888 LPCWSTR *lpszServiceArgs)
889{
890 dprintf(("ADVAPI32: StartServiceW(%08xh,%08xh,%s) not implemented.\n",
891 schService,
892 dwNumServiceArgs,
893 lpszServiceArgs));
894
895 if(CheckServiceHandle(schService) == FALSE) {
896 SetLastError(ERROR_INVALID_PARAMETER);
897 return FALSE;
898 }
899
900 DWORD state = SERVICE_RUNNING;
901 if(!RegSetValueExW((HKEY)schService, REG_SERVICE_STATUS_W, 0, REG_DWORD, (LPBYTE)&state, sizeof(DWORD))) {
902 return TRUE;
903 }
904 return (FALSE); /* signal failure */
905}
906
907/*****************************************************************************
908 * Name : DeleteService
909 * Purpose : The DeleteService function marks the specified service for
910 * deletion from the service control manager database.
911 * Parameters: SC_HANDLE hService handle of service
912 * Variables :
913 * Result :
914 * Remark :
915 * Status : UNTESTED STUB
916 *
917 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
918 *****************************************************************************/
919
920BOOL WIN32API DeleteService(SC_HANDLE hService)
921{
922 dprintf(("ADVAPI32: DeleteService(%08xh)", hService));
923
924 if(CheckServiceHandle(hService) == FALSE) {
925 SetLastError(ERROR_INVALID_PARAMETER);
926 return FALSE;
927 }
928 DWORD deletepending = 1;
929 if(!RegSetValueExA((HKEY)hService, REG_SERVICE_DELETEPENDING, 0, REG_DWORD, (LPBYTE)&deletepending, sizeof(DWORD))) {
930 return TRUE;
931 }
932 return FALSE;
933}
934
935/*****************************************************************************
936 * Name : GetServiceDisplayNameA
937 * Purpose : The GetServiceDisplayName function obtains the display name that
938 * is associated with a particular service name. The service name
939 * is the same as the service's registry key name.
940 * Parameters: SC_HANDLE hSCManager handle to a service control manager database
941 * LPCSTR lpServiceName the service name
942 * LPTSTR lpDisplayName buffer to receive the service's display name
943 * LPDWORD lpcchBuffer size of display name buffer and display name
944 * Variables :
945 * Result :
946 * Remark :
947 * Status : UNTESTED STUB
948 *
949 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
950 *****************************************************************************/
951
952BOOL WIN32API GetServiceDisplayNameA(SC_HANDLE hSCManager,
953 LPCSTR lpServiceName,
954 LPTSTR lpDisplayName,
955 LPDWORD lpcchBuffer)
956{
957 HKEY keyThisService;
958 DWORD size, type;
959
960 dprintf(("ADVAPI32: GetServiceDisplayNameA(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
961 hSCManager,
962 lpServiceName,
963 lpDisplayName,
964 lpcchBuffer));
965
966 if(!lpServiceName || !lpDisplayName) {
967 SetLastError(ERROR_INVALID_PARAMETER);
968 return FALSE;
969 }
970 if(CheckServiceHandle(hSCManager) == FALSE) {
971 SetLastError(ERROR_INVALID_PARAMETER);
972 return FALSE;
973 }
974
975 if(RegOpenKeyA((HKEY)hSCManager, lpServiceName, &keyThisService) != 0) {
976 SetLastError(ERROR_SERVICE_DOES_NOT_EXIST);
977 return FALSE;
978 }
979 size = *lpcchBuffer;
980 type = REG_SZ;
981 if(RegQueryValueExA(keyThisService, REG_SERVICE_DISPLAYNAME, 0, &type, (LPBYTE)lpDisplayName, &size) == ERROR_MORE_DATA)
982 {
983 SetLastError(ERROR_MORE_DATA);
984 *lpcchBuffer = size;
985 return FALSE;
986 }
987 *lpcchBuffer = size;
988 RegCloseKey(keyThisService);
989 return TRUE;
990}
991
992
993/*****************************************************************************
994 * Name : GetServiceDisplayNameW
995 * Purpose : The GetServiceDisplayName function obtains the display name that
996 * is associated with a particular service name. The service name
997 * is the same as the service's registry key name.
998 * Parameters: SC_HANDLE hSCManager handle to a service control manager database
999 * LPCWSTR lpServiceName the service name
1000 * LPWSTR lpDisplayName buffer to receive the service's display name
1001 * LPDWORD lpcchBuffer size of display name buffer and display name
1002 * Variables :
1003 * Result :
1004 * Remark :
1005 * Status : UNTESTED STUB
1006 *
1007 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
1008 *****************************************************************************/
1009
1010BOOL WIN32API GetServiceDisplayNameW(SC_HANDLE hSCManager,
1011 LPCWSTR lpServiceName,
1012 LPWSTR lpDisplayName,
1013 LPDWORD lpcchBuffer)
1014{
1015 HKEY keyThisService;
1016 DWORD size, type;
1017
1018 dprintf(("ADVAPI32: GetServiceDisplayNameW(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
1019 hSCManager,
1020 lpServiceName,
1021 lpDisplayName,
1022 lpcchBuffer));
1023
1024 if(!lpServiceName || !lpDisplayName) {
1025 SetLastError(ERROR_INVALID_PARAMETER);
1026 return FALSE;
1027 }
1028 if(CheckServiceHandle(hSCManager) == FALSE) {
1029 SetLastError(ERROR_INVALID_PARAMETER);
1030 return FALSE;
1031 }
1032
1033 if(RegOpenKeyW((HKEY)hSCManager, lpServiceName, &keyThisService) != 0) {
1034 SetLastError(ERROR_SERVICE_DOES_NOT_EXIST);
1035 return FALSE;
1036 }
1037 size = *lpcchBuffer;
1038 type = REG_SZ;
1039 if(RegQueryValueExW(keyThisService, REG_SERVICE_DISPLAYNAME_W, 0, &type, (LPBYTE)lpDisplayName, &size) == ERROR_MORE_DATA)
1040 {
1041 SetLastError(ERROR_MORE_DATA);
1042 *lpcchBuffer = size;
1043 return FALSE;
1044 }
1045 *lpcchBuffer = size;
1046 RegCloseKey(keyThisService);
1047 return TRUE;
1048}
1049
1050/*****************************************************************************
1051 * Name : EnumDependentServicesA
1052 * Purpose : The EnumDependentServices function enumerates services that
1053 * depend on another specified service; that is, the specified
1054 * service must be running before the enumerated services can run.
1055 * The name and status of each dependent service are provided.
1056 * Parameters: SC_HANDLE hService handle of service
1057 * DWORD dwServiceState state of services to enumerate
1058 * LPENUM_SERVICE_STATUS lpServices address of service status buffer
1059 * DWORD cbBufSize size of service status buffer
1060 * LPDWORD pcbBytesNeeded address of variable for bytes needed
1061 * LPDWORD lpServicesReturned address of variable for number returned
1062 * Variables :
1063 * Result :
1064 * Remark :
1065 * Status : UNTESTED STUB
1066 *
1067 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
1068 *****************************************************************************/
1069
1070BOOL WIN32API EnumDependentServicesA(SC_HANDLE hService,
1071 DWORD dwServiceState,
1072 LPENUM_SERVICE_STATUSA lpServices,
1073 DWORD cbBufSize,
1074 LPDWORD pcbBytesNeeded,
1075 LPDWORD lpServicesReturned)
1076{
1077 dprintf(("ADVAPI32: EnumDependentServicesA(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
1078 hService,
1079 dwServiceState,
1080 lpServices,
1081 cbBufSize,
1082 pcbBytesNeeded,
1083 lpServicesReturned));
1084
1085 return (FALSE); /* signal failure */
1086}
1087
1088
1089/*****************************************************************************
1090 * Name : EnumDependentServicesW
1091 * Purpose : The EnumDependentServices function enumerates services that
1092 * depend on another specified service; that is, the specified
1093 * service must be running before the enumerated services can run.
1094 * The name and status of each dependent service are provided.
1095 * Parameters: SC_HANDLE hService handle of service
1096 * DWORD dwServiceState state of services to enumerate
1097 * LPENUM_SERVICE_STATUS lpServices address of service status buffer
1098 * DWORD cbBufSize size of service status buffer
1099 * LPDWORD pcbBytesNeeded address of variable for bytes needed
1100 * LPDWORD lpServicesReturned address of variable for number returned
1101 * Variables :
1102 * Result :
1103 * Remark :
1104 * Status : UNTESTED STUB
1105 *
1106 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
1107 *****************************************************************************/
1108
1109BOOL WIN32API EnumDependentServicesW(SC_HANDLE hService,
1110 DWORD dwServiceState,
1111 LPENUM_SERVICE_STATUSW lpServices,
1112 DWORD cbBufSize,
1113 LPDWORD pcbBytesNeeded,
1114 LPDWORD lpServicesReturned)
1115{
1116 dprintf(("ADVAPI32: EnumDependentServicesW(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
1117 hService,
1118 dwServiceState,
1119 lpServices,
1120 cbBufSize,
1121 pcbBytesNeeded,
1122 lpServicesReturned));
1123
1124 return (FALSE); /* signal failure */
1125}
1126
1127
1128/*****************************************************************************
1129 * Name : EnumServicesStatusA
1130 * Purpose : The EnumServicesStatus function enumerates services in the specified
1131 * service control manager database. The name and status of each service are provided.
1132 * Parameters: SC_HANDLE hSCManager handle of service control manager database
1133 * DWORD dwServiceType type of services to enumerate
1134 * DWORD dwServiceState state of services to enumerate
1135 * LPENUM_SERVICE_STATUS lpServices address of service status buffer
1136 * DWORD cbBufSize size of service status buffer
1137 * LPDWORD pcbBytesNeeded address of variable for bytes needed
1138 * LPDWORD lpServicesReturned address of variable for number returned
1139 * LPDWORD lpResumeHandle address of variable for next entry
1140 * Variables :
1141 * Result :
1142 * Remark :
1143 * Status : UNTESTED STUB
1144 *
1145 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
1146 *****************************************************************************/
1147
1148BOOL WIN32API EnumServicesStatusA(SC_HANDLE hSCManager,
1149 DWORD dwServiceType,
1150 DWORD dwServiceState,
1151 LPENUM_SERVICE_STATUSA lpServices,
1152 DWORD cbBufSize,
1153 LPDWORD pcbBytesNeeded,
1154 LPDWORD lpServicesReturned,
1155 LPDWORD lpResumeHandle)
1156{
1157 dprintf(("ADVAPI32: EnumServicesStatusA(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
1158 hSCManager,
1159 dwServiceType,
1160 dwServiceState,
1161 lpServices,
1162 cbBufSize,
1163 pcbBytesNeeded,
1164 lpServicesReturned,
1165 lpResumeHandle));
1166
1167 return (FALSE); /* signal failure */
1168}
1169
1170
1171/*****************************************************************************
1172 * Name : EnumServicesStatusW
1173 * Purpose : The EnumServicesStatus function enumerates services in the specified
1174 * service control manager database. The name and status of each service are provided.
1175 * Parameters: SC_HANDLE hSCManager handle of service control manager database
1176 * DWORD dwServiceType type of services to enumerate
1177 * DWORD dwServiceState state of services to enumerate
1178 * LPENUM_SERVICE_STATUS lpServices address of service status buffer
1179 * DWORD cbBufSize size of service status buffer
1180 * LPDWORD pcbBytesNeeded address of variable for bytes needed
1181 * LPDWORD lpServicesReturned address of variable for number returned
1182 * LPDWORD lpResumeHandle address of variable for next entry
1183 * Variables :
1184 * Result :
1185 * Remark :
1186 * Status : UNTESTED STUB
1187 *
1188 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
1189 *****************************************************************************/
1190
1191BOOL WIN32API EnumServicesStatusW(SC_HANDLE hSCManager,
1192 DWORD dwServiceType,
1193 DWORD dwServiceState,
1194 LPENUM_SERVICE_STATUSW lpServices,
1195 DWORD cbBufSize,
1196 LPDWORD pcbBytesNeeded,
1197 LPDWORD lpServicesReturned,
1198 LPDWORD lpResumeHandle)
1199{
1200 dprintf(("ADVAPI32: EnumServicesStatusW(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
1201 hSCManager,
1202 dwServiceType,
1203 dwServiceState,
1204 lpServices,
1205 cbBufSize,
1206 pcbBytesNeeded,
1207 lpServicesReturned,
1208 lpResumeHandle));
1209
1210 return (FALSE); /* signal failure */
1211}
1212
1213/*****************************************************************************
1214 * Name : GetServiceKeyNameA
1215 * Purpose : The GetServiceKeyName function obtains the service name that is
1216 * associated with a particular service's display name. The service
1217 * name is the same as the service's registry key name.
1218 * Parameters: SC_HANDLE hSCManager handle to a service control manager database
1219 * LPCSTR lpDisplayName the service's display name
1220 * LPTSTR lpServiceName buffer to receive the service name
1221 * LPDWORD lpcchBuffer size of service name buffer and service name
1222 * Variables :
1223 * Result :
1224 * Remark :
1225 * Status : UNTESTED STUB
1226 *
1227 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
1228 *****************************************************************************/
1229
1230BOOL WIN32API GetServiceKeyNameA(SC_HANDLE hSCManager,
1231 LPCSTR lpDisplayName,
1232 LPTSTR lpServiceName,
1233 LPDWORD lpcchBuffer)
1234{
1235 dprintf(("ADVAPI32: GetServiceKeyNameA(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
1236 hSCManager,
1237 lpDisplayName,
1238 lpServiceName,
1239 lpcchBuffer));
1240
1241 return (FALSE); /* signal failure */
1242}
1243
1244
1245/*****************************************************************************
1246 * Name : GetServiceKeyNameW
1247 * Purpose : The GetServiceKeyName function obtains the service name that is
1248 * associated with a particular service's display name. The service
1249 * name is the same as the service's registry key name.
1250 * Parameters: SC_HANDLE hSCManager handle to a service control manager database
1251 * LPCWSTR lpDisplayName the service's display name
1252 * LPWSTR lpServiceName buffer to receive the service name
1253 * LPDWORD lpcchBuffer size of service name buffer and service name
1254 * Variables :
1255 * Result :
1256 * Remark :
1257 * Status : UNTESTED STUB
1258 *
1259 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
1260 *****************************************************************************/
1261
1262BOOL WIN32API GetServiceKeyNameW(SC_HANDLE hSCManager,
1263 LPCWSTR lpDisplayName,
1264 LPWSTR lpServiceName,
1265 LPDWORD lpcchBuffer)
1266{
1267 dprintf(("ADVAPI32: GetServiceKeyNameW(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
1268 hSCManager,
1269 lpDisplayName,
1270 lpServiceName,
1271 lpcchBuffer));
1272
1273 return (FALSE); /* signal failure */
1274}
1275
1276/*****************************************************************************
1277 * Name : LockServiceDatabase
1278 * Purpose : The LockServiceDatabase function locks a specified database.
1279 * Parameters: SC_HANDLE hSCManager handle of service control manager database
1280 * Variables :
1281 * Result :
1282 * Remark :
1283 * Status : UNTESTED STUB
1284 *
1285 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
1286 *****************************************************************************/
1287
1288SC_LOCK WIN32API LockServiceDatabase(SC_HANDLE hSCManager)
1289{
1290 dprintf(("ADVAPI32: LockServiceDatabase(%08xh) not implemented.\n",
1291 hSCManager));
1292
1293 return 0; /* signal failure */
1294}
1295
1296/*****************************************************************************
1297 * Name : UnlockServiceDatabase
1298 * Purpose : The UnlockServiceDatabase function unlocks a service control
1299 * manager database by releasing the specified lock.
1300 * Parameters: SC_LOCK sclLock service control manager database lock to be released
1301 * Variables :
1302 * Result :
1303 * Remark :
1304 * Status : UNTESTED STUB
1305 *
1306 * Author : Patrick Haller [Tue, 1998/06/16 23:00]
1307
1308 *****************************************************************************/
1309
1310BOOL WIN32API UnlockServiceDatabase(SC_LOCK sclLock)
1311{
1312 dprintf(("ADVAPI32: UnlockServiceDatabase(%08xh) not implemented.\n",
1313 sclLock));
1314
1315 return (FALSE); /* signal failure */
1316}
1317
1318
Note: See TracBrowser for help on using the repository browser.