2 * Win32 advapi functions
4 * Copyright 1995 Sven Verdoolaege
13 #include "debugtools.h"
15 DEFAULT_DEBUG_CHANNEL(advapi)
17 /******************************************************************************
18 * EnumServicesStatus32A [ADVAPI32.38]
21 EnumServicesStatusA( SC_HANDLE hSCManager, DWORD dwServiceType,
22 DWORD dwServiceState, LPENUM_SERVICE_STATUSA lpServices,
23 DWORD cbBufSize, LPDWORD pcbBytesNeeded,
24 LPDWORD lpServicesReturned, LPDWORD lpResumeHandle )
25 { FIXME("%x type=%lx state=%lx %p %lx %p %p %p\n", hSCManager,
26 dwServiceType, dwServiceState, lpServices, cbBufSize,
27 pcbBytesNeeded, lpServicesReturned, lpResumeHandle);
28 SetLastError (ERROR_ACCESS_DENIED);
32 /******************************************************************************
33 * StartServiceCtrlDispatcher32A [ADVAPI32.196]
36 StartServiceCtrlDispatcherA( LPSERVICE_TABLE_ENTRYA servent )
37 { LPSERVICE_TABLE_ENTRYA ptr = servent;
39 while (ptr->lpServiceName)
40 { FIXME("%s at %p\n", ptr->lpServiceName, ptr);
46 /******************************************************************************
47 * StartServiceCtrlDispatcher32W [ADVAPI32.197]
53 StartServiceCtrlDispatcherW( LPSERVICE_TABLE_ENTRYW servent )
54 { LPSERVICE_TABLE_ENTRYW ptr = servent;
55 LPSERVICE_MAIN_FUNCTIONW fpMain;
57 while (ptr->lpServiceName)
58 { FIXME("%s at %p): STUB.\n", debugstr_w(ptr->lpServiceName),ptr);
59 fpMain = ptr->lpServiceProc;
60 fpMain(0,NULL); /* try to start the service */
66 /******************************************************************************
67 * RegisterServiceCtrlHandlerA [ADVAPI32.176]
69 SERVICE_STATUS_HANDLE WINAPI
70 RegisterServiceCtrlHandlerA( LPCSTR lpServiceName,
71 LPHANDLER_FUNCTION lpfHandler )
72 { FIXME("%s %p\n", lpServiceName, lpfHandler);
76 /******************************************************************************
77 * RegisterServiceCtrlHandlerW [ADVAPI32.177]
83 SERVICE_STATUS_HANDLE WINAPI
84 RegisterServiceCtrlHandlerW( LPCWSTR lpServiceName,
85 LPHANDLER_FUNCTION lpfHandler )
86 { FIXME("%s %p\n", debugstr_w(lpServiceName), lpfHandler);
90 /******************************************************************************
91 * SetServiceStatus [ADVAPI32.192]
98 SetServiceStatus( SERVICE_STATUS_HANDLE hService, LPSERVICE_STATUS lpStatus )
99 { FIXME("%lx %p\n",hService, lpStatus);
100 TRACE("\tType:%lx\n",lpStatus->dwServiceType);
101 TRACE("\tState:%lx\n",lpStatus->dwCurrentState);
102 TRACE("\tControlAccepted:%lx\n",lpStatus->dwControlsAccepted);
103 TRACE("\tExitCode:%lx\n",lpStatus->dwWin32ExitCode);
104 TRACE("\tServiceExitCode:%lx\n",lpStatus->dwServiceSpecificExitCode);
105 TRACE("\tCheckPoint:%lx\n",lpStatus->dwCheckPoint);
106 TRACE("\tWaitHint:%lx\n",lpStatus->dwWaitHint);
110 /******************************************************************************
111 * OpenSCManager32A [ADVAPI32.110]
114 OpenSCManagerA( LPCSTR lpMachineName, LPCSTR lpDatabaseName,
115 DWORD dwDesiredAccess )
117 LPWSTR lpMachineNameW = HEAP_strdupAtoW(GetProcessHeap(),0,lpMachineName);
118 LPWSTR lpDatabaseNameW = HEAP_strdupAtoW(GetProcessHeap(),0,lpDatabaseName);
119 DWORD ret = OpenSCManagerW(lpMachineNameW,lpDatabaseNameW,
121 HeapFree(GetProcessHeap(),0,lpDatabaseNameW);
122 HeapFree(GetProcessHeap(),0,lpMachineNameW);
126 /******************************************************************************
127 * OpenSCManager32W [ADVAPI32.111]
128 * Establishes a connection to the service control manager and opens database
131 * This should return a SC_HANDLE
134 * lpMachineName [I] Pointer to machine name string
135 * lpDatabaseName [I] Pointer to database name string
136 * dwDesiredAccess [I] Type of access
139 * Success: Handle to service control manager database
143 OpenSCManagerW( LPCWSTR lpMachineName, LPCWSTR lpDatabaseName,
144 DWORD dwDesiredAccess )
146 FIXME("(%s,%s,0x%08lx): stub\n", debugstr_w(lpMachineName),
147 debugstr_w(lpDatabaseName), dwDesiredAccess);
152 /******************************************************************************
153 * AllocateLocallyUniqueId [ADVAPI32.12]
159 AllocateLocallyUniqueId( PLUID lpluid )
161 lpluid->LowPart = time(NULL);
162 lpluid->HighPart = 0;
167 /******************************************************************************
168 * ControlService [ADVAPI32.23]
169 * Sends a control code to a Win32-based service.
179 ControlService( SC_HANDLE hService, DWORD dwControl,
180 LPSERVICE_STATUS lpServiceStatus )
182 FIXME("(%d,%ld,%p): stub\n",hService,dwControl,lpServiceStatus);
187 /******************************************************************************
188 * CloseServiceHandle [ADVAPI32.22]
189 * Close handle to service or service control manager
192 * hSCObject [I] Handle to service or service control manager database
197 CloseServiceHandle( SC_HANDLE hSCObject )
199 FIXME("(%d): stub\n", hSCObject);
204 /******************************************************************************
205 * OpenService32A [ADVAPI32.112]
208 OpenServiceA( SC_HANDLE hSCManager, LPCSTR lpServiceName,
209 DWORD dwDesiredAccess )
211 LPWSTR lpServiceNameW = HEAP_strdupAtoW(GetProcessHeap(),0,lpServiceName);
212 DWORD ret = OpenServiceW( hSCManager, lpServiceNameW, dwDesiredAccess);
213 HeapFree(GetProcessHeap(),0,lpServiceNameW);
218 /******************************************************************************
219 * OpenService32W [ADVAPI32.113]
220 * Opens a handle to an existing service
228 * Success: Handle to the service
232 OpenServiceW(SC_HANDLE hSCManager, LPCWSTR lpServiceName,
233 DWORD dwDesiredAccess)
235 FIXME("(%d,%p,%ld): stub\n",hSCManager, lpServiceName,
241 /******************************************************************************
242 * CreateService32A [ADVAPI32.29]
245 CreateServiceA( DWORD hSCManager, LPCSTR lpServiceName,
246 LPCSTR lpDisplayName, DWORD dwDesiredAccess,
247 DWORD dwServiceType, DWORD dwStartType,
248 DWORD dwErrorControl, LPCSTR lpBinaryPathName,
249 LPCSTR lpLoadOrderGroup, LPDWORD lpdwTagId,
250 LPCSTR lpDependencies, LPCSTR lpServiceStartName,
253 FIXME("(%ld,%s,%s,...): stub\n",
254 hSCManager, debugstr_a(lpServiceName), debugstr_a(lpDisplayName));
259 /******************************************************************************
260 * DeleteService [ADVAPI32.31]
263 * hService [I] Handle to service
269 DeleteService( SC_HANDLE hService )
271 FIXME("(%d): stub\n",hService);
276 /******************************************************************************
277 * StartService32A [ADVAPI32.195]
280 * How do we convert lpServiceArgVectors to use the 32W version?
283 StartServiceA( SC_HANDLE hService, DWORD dwNumServiceArgs,
284 LPCSTR *lpServiceArgVectors )
286 FIXME("(%d,%ld,%p): stub\n",hService,dwNumServiceArgs,lpServiceArgVectors);
291 /******************************************************************************
292 * StartService32W [ADVAPI32.198]
296 * hService [I] Handle of service
297 * dwNumServiceArgs [I] Number of arguments
298 * lpServiceArgVectors [I] Address of array of argument string pointers
304 StartServiceW( SC_HANDLE hService, DWORD dwNumServiceArgs,
305 LPCWSTR *lpServiceArgVectors )
307 FIXME("(%d,%ld,%p): stub\n",hService,dwNumServiceArgs,
308 lpServiceArgVectors);
312 /******************************************************************************
313 * QueryServiceStatus [ADVAPI32.123]
321 QueryServiceStatus( SC_HANDLE hService, LPSERVICE_STATUS lpservicestatus )
323 FIXME("(%d,%p),stub!\n",hService,lpservicestatus);