Implemented SHCreateShellFolderViewEx.
[wine.git] / dlls / advapi32 / service.c
blobb07eb8999e2e04c9b423d9d39d14785abb7b2eab
1 /*
2 * Win32 advapi functions
4 * Copyright 1995 Sven Verdoolaege
5 */
7 #include <time.h>
9 #include "windef.h"
10 #include "winsvc.h"
11 #include "winerror.h"
12 #include "heap.h"
13 #include "debugtools.h"
15 DEFAULT_DEBUG_CHANNEL(advapi)
17 /******************************************************************************
18 * EnumServicesStatus32A [ADVAPI32.38]
20 BOOL WINAPI
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);
29 return 0;
32 /******************************************************************************
33 * StartServiceCtrlDispatcher32A [ADVAPI32.196]
35 BOOL WINAPI
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);
41 ptr++;
43 return TRUE;
46 /******************************************************************************
47 * StartServiceCtrlDispatcher32W [ADVAPI32.197]
49 * PARAMS
50 * servent []
52 BOOL WINAPI
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 */
61 ptr++;
63 return TRUE;
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);
73 return 0xcacacafe;
76 /******************************************************************************
77 * RegisterServiceCtrlHandlerW [ADVAPI32.177]
79 * PARAMS
80 * lpServiceName []
81 * lpfHandler []
83 SERVICE_STATUS_HANDLE WINAPI
84 RegisterServiceCtrlHandlerW( LPCWSTR lpServiceName,
85 LPHANDLER_FUNCTION lpfHandler )
86 { FIXME("%s %p\n", debugstr_w(lpServiceName), lpfHandler);
87 return 0xcacacafe;
90 /******************************************************************************
91 * SetServiceStatus [ADVAPI32.192]
93 * PARAMS
94 * hService []
95 * lpStatus []
97 BOOL WINAPI
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);
107 return TRUE;
110 /******************************************************************************
111 * OpenSCManager32A [ADVAPI32.110]
113 SC_HANDLE WINAPI
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,
120 dwDesiredAccess);
121 HeapFree(GetProcessHeap(),0,lpDatabaseNameW);
122 HeapFree(GetProcessHeap(),0,lpMachineNameW);
123 return ret;
126 /******************************************************************************
127 * OpenSCManager32W [ADVAPI32.111]
128 * Establishes a connection to the service control manager and opens database
130 * NOTES
131 * This should return a SC_HANDLE
133 * PARAMS
134 * lpMachineName [I] Pointer to machine name string
135 * lpDatabaseName [I] Pointer to database name string
136 * dwDesiredAccess [I] Type of access
138 * RETURNS
139 * Success: Handle to service control manager database
140 * Failure: NULL
142 SC_HANDLE WINAPI
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);
148 return 1;
152 /******************************************************************************
153 * AllocateLocallyUniqueId [ADVAPI32.12]
155 * PARAMS
156 * lpluid []
158 BOOL WINAPI
159 AllocateLocallyUniqueId( PLUID lpluid )
161 lpluid->LowPart = time(NULL);
162 lpluid->HighPart = 0;
163 return TRUE;
167 /******************************************************************************
168 * ControlService [ADVAPI32.23]
169 * Sends a control code to a Win32-based service.
171 * PARAMS
172 * hService []
173 * dwControl []
174 * lpServiceStatus []
176 * RETURNS STD
178 BOOL WINAPI
179 ControlService( SC_HANDLE hService, DWORD dwControl,
180 LPSERVICE_STATUS lpServiceStatus )
182 FIXME("(%d,%ld,%p): stub\n",hService,dwControl,lpServiceStatus);
183 return TRUE;
187 /******************************************************************************
188 * CloseServiceHandle [ADVAPI32.22]
189 * Close handle to service or service control manager
191 * PARAMS
192 * hSCObject [I] Handle to service or service control manager database
194 * RETURNS STD
196 BOOL WINAPI
197 CloseServiceHandle( SC_HANDLE hSCObject )
199 FIXME("(%d): stub\n", hSCObject);
200 return TRUE;
204 /******************************************************************************
205 * OpenService32A [ADVAPI32.112]
207 SC_HANDLE WINAPI
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);
214 return ret;
218 /******************************************************************************
219 * OpenService32W [ADVAPI32.113]
220 * Opens a handle to an existing service
222 * PARAMS
223 * hSCManager []
224 * lpServiceName []
225 * dwDesiredAccess []
227 * RETURNS
228 * Success: Handle to the service
229 * Failure: NULL
231 SC_HANDLE WINAPI
232 OpenServiceW(SC_HANDLE hSCManager, LPCWSTR lpServiceName,
233 DWORD dwDesiredAccess)
235 FIXME("(%d,%p,%ld): stub\n",hSCManager, lpServiceName,
236 dwDesiredAccess);
237 return 1;
241 /******************************************************************************
242 * CreateService32A [ADVAPI32.29]
244 SC_HANDLE WINAPI
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,
251 LPCSTR lpPassword )
253 FIXME("(%ld,%s,%s,...): stub\n",
254 hSCManager, debugstr_a(lpServiceName), debugstr_a(lpDisplayName));
255 return 1;
259 /******************************************************************************
260 * DeleteService [ADVAPI32.31]
262 * PARAMS
263 * hService [I] Handle to service
265 * RETURNS STD
268 BOOL WINAPI
269 DeleteService( SC_HANDLE hService )
271 FIXME("(%d): stub\n",hService);
272 return TRUE;
276 /******************************************************************************
277 * StartService32A [ADVAPI32.195]
279 * NOTES
280 * How do we convert lpServiceArgVectors to use the 32W version?
282 BOOL WINAPI
283 StartServiceA( SC_HANDLE hService, DWORD dwNumServiceArgs,
284 LPCSTR *lpServiceArgVectors )
286 FIXME("(%d,%ld,%p): stub\n",hService,dwNumServiceArgs,lpServiceArgVectors);
287 return TRUE;
291 /******************************************************************************
292 * StartService32W [ADVAPI32.198]
293 * Starts a service
295 * PARAMS
296 * hService [I] Handle of service
297 * dwNumServiceArgs [I] Number of arguments
298 * lpServiceArgVectors [I] Address of array of argument string pointers
300 * RETURNS STD
303 BOOL WINAPI
304 StartServiceW( SC_HANDLE hService, DWORD dwNumServiceArgs,
305 LPCWSTR *lpServiceArgVectors )
307 FIXME("(%d,%ld,%p): stub\n",hService,dwNumServiceArgs,
308 lpServiceArgVectors);
309 return TRUE;
312 /******************************************************************************
313 * QueryServiceStatus [ADVAPI32.123]
315 * PARAMS
316 * hService []
317 * lpservicestatus []
320 BOOL WINAPI
321 QueryServiceStatus( SC_HANDLE hService, LPSERVICE_STATUS lpservicestatus )
323 FIXME("(%d,%p),stub!\n",hService,lpservicestatus);
324 return TRUE;