IPaddress common control implementation. First try; needs more work to
[wine/multimedia.git] / win32 / advapi.c
blobf66f16ea5e5438e355764c7c84a539f9425f5a3b
1 /*
2 * Win32 advapi functions
4 * Copyright 1995 Sven Verdoolaege
5 */
7 #include <unistd.h>
8 #include <time.h>
9 #include "windows.h"
10 #include "winerror.h"
11 #include "shell.h"
12 #include "heap.h"
13 #include "debug.h"
14 /***********************************************************************
15 * EnumServicesStatus32A [ADVAPI32.37]
17 BOOL32 WINAPI EnumServicesStatus32A( HANDLE32 hSCManager, DWORD dwServiceType,
18 DWORD dwServiceState, LPVOID lpServices,
19 DWORD cbBufSize, LPDWORD pcbBytesNeeded,
20 LPDWORD lpServicesReturned, LPDWORD lpResumeHandle)
21 { FIXME (advapi,"%x type=%lx state=%lx %p %lx %p %p %p\n", hSCManager,
22 dwServiceType, dwServiceState, lpServices, cbBufSize,
23 pcbBytesNeeded, lpServicesReturned, lpResumeHandle);
24 SetLastError (ERROR_ACCESS_DENIED);
25 return 0;
27 /***********************************************************************
28 * StartServiceCtrlDispatcherA [ADVAPI32.196]
30 BOOL32 WINAPI StartServiceCtrlDispatcher32A(LPSERVICE_TABLE_ENTRY32A servent)
31 { LPSERVICE_TABLE_ENTRY32A ptr = servent;
33 while (ptr->lpServiceName)
34 { FIXME(advapi,"%s at %p\n", ptr->lpServiceName, ptr);
35 ptr++;
37 return TRUE;
40 /***********************************************************************
41 * StartServiceCtrlDispatcherW [ADVAPI32.197]
43 BOOL32 WINAPI StartServiceCtrlDispatcher32W(LPSERVICE_TABLE_ENTRY32W servent)
44 { LPSERVICE_TABLE_ENTRY32W ptr = servent;
45 LPSERVICE_MAIN_FUNCTION32W fpMain;
47 while (ptr->lpServiceName)
48 { FIXME(advapi,"%s at %p): STUB.\n", debugstr_w(ptr->lpServiceName),ptr);
49 fpMain = ptr->lpServiceProc;
50 fpMain(0,NULL); /* try to start the service */
51 ptr++;
53 return TRUE;
56 typedef DWORD SERVICE_STATUS_HANDLE;
57 typedef VOID (WINAPI *LPHANDLER_FUNCTION)( DWORD dwControl);
58 /***********************************************************************
59 * RegisterServiceCtrlHandlerA [ADVAPI32.176]
61 SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandlerA (LPSTR lpServiceName, LPHANDLER_FUNCTION lpfHandler)
62 { FIXME(advapi,"%s %p\n", lpServiceName, lpfHandler);
63 return 0xcacacafe;
65 /***********************************************************************
66 * RegisterServiceCtrlHandlerW [ADVAPI32.177]
68 SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandlerW (LPWSTR lpServiceName, LPHANDLER_FUNCTION lpfHandler)
69 { FIXME(advapi,"%s %p\n", debugstr_w(lpServiceName), lpfHandler);
70 return 0xcacacafe;
72 /***********************************************************************
73 * SetServiceStatus [ADVAPI32.192]
75 BOOL32 WINAPI SetServiceStatus(SERVICE_STATUS_HANDLE hService, LPSERVICE_STATUS lpStatus)
76 { FIXME(advapi,"%lx %p\n",hService, lpStatus);
77 TRACE(advapi,"\tType:%lx\n",lpStatus->dwServiceType);
78 TRACE(advapi,"\tState:%lx\n",lpStatus->dwCurrentState);
79 TRACE(advapi,"\tControlAccepted:%lx\n",lpStatus->dwControlsAccepted);
80 TRACE(advapi,"\tExitCode:%lx\n",lpStatus->dwWin32ExitCode);
81 TRACE(advapi,"\tServiceExitCode:%lx\n",lpStatus->dwServiceSpecificExitCode);
82 TRACE(advapi,"\tCheckPoint:%lx\n",lpStatus->dwCheckPoint);
83 TRACE(advapi,"\tWaitHint:%lx\n",lpStatus->dwWaitHint);
84 return TRUE;
86 /******************************************************************************
87 * OpenProcessToken [ADVAPI32.109]
88 * Opens the access token associated with a process
90 * PARAMS
91 * ProcessHandle [I] Handle to process
92 * DesiredAccess [I] Desired access to process
93 * TokenHandle [O] Pointer to handle of open access token
95 * RETURNS STD
97 BOOL32 WINAPI OpenProcessToken( HANDLE32 ProcessHandle, DWORD DesiredAccess,
98 HANDLE32 *TokenHandle )
100 FIXME(advapi,"(%08x,%08lx,%p): stub\n",ProcessHandle,DesiredAccess,
101 TokenHandle);
102 return TRUE;
106 /***********************************************************************
107 * OpenThreadToken [ADVAPI32.114]
109 BOOL32 WINAPI OpenThreadToken( HANDLE32 thread,DWORD desiredaccess,
110 BOOL32 openasself,HANDLE32 *thandle )
112 FIXME(advapi,"(%08x,%08lx,%d,%p): stub!\n",
113 thread,desiredaccess,openasself,thandle);
114 return TRUE;
118 /******************************************************************************
119 * LookupPrivilegeValue32A [ADVAPI32.92]
121 BOOL32 WINAPI LookupPrivilegeValue32A( LPCSTR lpSystemName,
122 LPCSTR lpName, LPVOID lpLuid)
124 LPWSTR lpSystemNameW = HEAP_strdupAtoW(GetProcessHeap(), 0, lpSystemName);
125 LPWSTR lpNameW = HEAP_strdupAtoW(GetProcessHeap(), 0, lpName);
126 BOOL32 ret = LookupPrivilegeValue32W( lpSystemNameW, lpNameW, lpLuid);
127 HeapFree(GetProcessHeap(), 0, lpNameW);
128 HeapFree(GetProcessHeap(), 0, lpSystemNameW);
129 return ret;
133 /******************************************************************************
134 * LookupPrivilegeValue32W [ADVAPI32.93]
135 * Retrieves LUID used on a system to represent the privilege name.
137 * NOTES
138 * lpLuid should be PLUID
140 * PARAMS
141 * lpSystemName [I] Address of string specifying the system
142 * lpName [I] Address of string specifying the privilege
143 * lpLuid [I] Address of locally unique identifier
145 * RETURNS STD
147 BOOL32 WINAPI LookupPrivilegeValue32W( LPCWSTR lpSystemName,
148 LPCWSTR lpName, LPVOID lpLuid )
150 FIXME(advapi,"(%s,%s,%p): stub\n",debugstr_w(lpSystemName),
151 debugstr_w(lpName), lpLuid);
152 return TRUE;
156 /***********************************************************************
157 * AdjustTokenPrivileges [ADVAPI32.10]
159 BOOL32 WINAPI AdjustTokenPrivileges(HANDLE32 TokenHandle,BOOL32 DisableAllPrivileges,
160 LPVOID NewState,DWORD BufferLength,LPVOID PreviousState,
161 LPDWORD ReturnLength )
163 return TRUE;
166 /***********************************************************************
167 * GetTokenInformation [ADVAPI32.66]
169 BOOL32 WINAPI GetTokenInformation(
170 HANDLE32 token,TOKEN_INFORMATION_CLASS tokeninfoclass,LPVOID tokeninfo,
171 DWORD tokeninfolength,LPDWORD retlen
173 FIXME(advapi,"(%08x,%d,%p,%ld,%p): stub\n",
174 token,tokeninfoclass,tokeninfo,tokeninfolength,retlen);
175 return TRUE;
179 /******************************************************************************
180 * OpenSCManager32A [ADVAPI32.110]
182 HANDLE32 WINAPI OpenSCManager32A( LPCSTR lpMachineName, LPCSTR lpDatabaseName,
183 DWORD dwDesiredAccess )
185 LPWSTR lpMachineNameW = HEAP_strdupAtoW(GetProcessHeap(),0,lpMachineName);
186 LPWSTR lpDatabaseNameW = HEAP_strdupAtoW(GetProcessHeap(),0,lpDatabaseName);
187 DWORD ret = OpenSCManager32W(lpMachineNameW,lpDatabaseNameW,
188 dwDesiredAccess);
189 HeapFree(GetProcessHeap(),0,lpDatabaseNameW);
190 HeapFree(GetProcessHeap(),0,lpMachineNameW);
191 return ret;
195 /******************************************************************************
196 * OpenSCManager32W [ADVAPI32.111]
197 * Establishes a connection to the service control manager and opens database
199 * NOTES
200 * This should return a SC_HANDLE
202 * PARAMS
203 * lpMachineName [I] Pointer to machine name string
204 * lpDatabaseName [I] Pointer to database name string
205 * dwDesiredAccess [I] Type of access
207 * RETURNS
208 * Success: Handle to service control manager database
209 * Failure: NULL
211 HANDLE32 WINAPI OpenSCManager32W( LPCWSTR lpMachineName, LPCWSTR lpDatabaseName,
212 DWORD dwDesiredAccess )
214 FIXME(advapi,"(%s,%s,0x%08lx): stub\n", debugstr_w(lpMachineName),
215 debugstr_w(lpDatabaseName), dwDesiredAccess);
216 return 1;
220 BOOL32 WINAPI AllocateLocallyUniqueId(LPLUID lpluid) {
221 lpluid->LowPart = time(NULL);
222 lpluid->HighPart = 0;
223 return TRUE;
227 /******************************************************************************
228 * ControlService [ADVAPI32.23]
229 * Sends a control code to a Win32-based service.
231 * NOTES
232 * hService should be SC_HANDLE
234 * RETURNS STD
236 BOOL32 WINAPI ControlService( HANDLE32 hService, DWORD dwControl,
237 LPSERVICE_STATUS lpServiceStatus )
239 FIXME(advapi, "(%d,%ld,%p): stub\n",hService,dwControl,lpServiceStatus);
240 return TRUE;
244 /******************************************************************************
245 * CloseServiceHandle [ADVAPI32.22]
246 * Close handle to service or service control manager
248 * PARAMS
249 * hSCObject [I] Handle to service or service control manager database
251 * NOTES
252 * hSCObject should be SC_HANDLE
254 * RETURNS STD
256 BOOL32 WINAPI CloseServiceHandle( HANDLE32 hSCObject )
258 FIXME(advapi, "(%d): stub\n", hSCObject);
259 return TRUE;
263 /******************************************************************************
264 * GetFileSecurityA [32.45]
265 * Obtains Specified information about the security of a file or directory
266 * The information obtained is constrained by the callers acces rights and
267 * priviliges
270 BOOL32 WINAPI GetFileSecurity32A( LPCSTR lpFileName,
271 SECURITY_INFORMATION RequestedInformation,
272 LPSECURITY_DESCRIPTOR pSecurityDescriptor,
273 DWORD nLength,
274 LPDWORD lpnLengthNeeded)
276 FIXME(advapi, "(%s) : stub\n", debugstr_a(lpFileName));
277 return TRUE;
280 /******************************************************************************
281 * GetFileSecurityiW [32.46]
282 * Obtains Specified information about the security of a file or directory
283 * The information obtained is constrained by the callers acces rights and
284 * priviliges
287 BOOL32 WINAPI GetFileSecurity32W( LPCWSTR lpFileName,
288 SECURITY_INFORMATION RequestedInformation,
289 LPSECURITY_DESCRIPTOR pSecurityDescriptor,
290 DWORD nLength,
291 LPDWORD lpnLengthNeeded)
293 FIXME(advapi, "(%s) : stub\n", debugstr_w(lpFileName) );
294 return TRUE;
297 /******************************************************************************
298 * SetFileSecurityA [32.182]
299 * Sets the security of a file or directory
302 BOOL32 WINAPI SetFileSecurity32A( LPCSTR lpFileName,
303 SECURITY_INFORMATION RequestedInformation,
304 LPSECURITY_DESCRIPTOR pSecurityDescriptor)
306 FIXME(advapi, "(%s) : stub\n", debugstr_a(lpFileName));
307 return TRUE;
310 /******************************************************************************
311 * SetFileSecurityW [32.183]
312 * Sets the security of a file or directory
315 BOOL32 WINAPI SetFileSecurity32W( LPCWSTR lpFileName,
316 SECURITY_INFORMATION RequestedInformation,
317 LPSECURITY_DESCRIPTOR pSecurityDescriptor)
319 FIXME(advapi, "(%s) : stub\n", debugstr_w(lpFileName) );
320 return TRUE;
323 /******************************************************************************
324 * OpenService32A [ADVAPI32.112]
326 HANDLE32 WINAPI OpenService32A( HANDLE32 hSCManager, LPCSTR lpServiceName,
327 DWORD dwDesiredAccess )
329 LPWSTR lpServiceNameW = HEAP_strdupAtoW(GetProcessHeap(),0,lpServiceName);
330 DWORD ret = OpenService32W( hSCManager, lpServiceNameW, dwDesiredAccess);
331 HeapFree(GetProcessHeap(),0,lpServiceNameW);
332 return ret;
336 /******************************************************************************
337 * OpenService32W [ADVAPI32.113]
338 * Opens a handle to an existing service
340 * NOTES
341 * The return value should be SC_HANDLE
342 * hSCManager should be SC_HANDLE
344 * RETURNS
345 * Success: Handle to the service
346 * Failure: NULL
348 HANDLE32 WINAPI OpenService32W( HANDLE32 hSCManager, LPCWSTR lpServiceName,
349 DWORD dwDesiredAccess )
351 FIXME(advapi, "(%d,%p,%ld): stub\n",hSCManager, lpServiceName,
352 dwDesiredAccess);
353 return 1;
357 /******************************************************************************
358 * CreateService32A [ADVAPI32.28]
360 DWORD WINAPI CreateService32A( DWORD hSCManager, LPCSTR lpServiceName,
361 LPCSTR lpDisplayName, DWORD dwDesiredAccess,
362 DWORD dwServiceType, DWORD dwStartType,
363 DWORD dwErrorControl, LPCSTR lpBinaryPathName,
364 LPCSTR lpLoadOrderGroup, LPDWORD lpdwTagId,
365 LPCSTR lpDependencies, LPCSTR lpServiceStartName,
366 LPCSTR lpPassword )
368 FIXME(advapi, "(%ld,%s,%s,...): stub\n",
369 hSCManager, debugstr_a(lpServiceName), debugstr_a(lpDisplayName));
370 return 1;
374 /******************************************************************************
375 * DeleteService [ADVAPI32.31]
377 * PARAMS
378 * hService [I] Handle to service
380 * RETURNS STD
382 * NOTES
383 * hService should be SC_HANDLE
385 BOOL32 WINAPI DeleteService( HANDLE32 hService )
387 FIXME(advapi, "(%d): stub\n",hService);
388 return TRUE;
392 /******************************************************************************
393 * StartService32A [ADVAPI32.195]
395 * NOTES
396 * How do we convert lpServiceArgVectors to use the 32W version?
398 BOOL32 WINAPI StartService32A( HANDLE32 hService, DWORD dwNumServiceArgs,
399 LPCSTR *lpServiceArgVectors )
401 FIXME(advapi, "(%d,%ld,%p): stub\n",hService,dwNumServiceArgs,lpServiceArgVectors);
402 return TRUE;
406 /******************************************************************************
407 * StartService32W [ADVAPI32.198]
408 * Starts a service
410 * PARAMS
411 * hService [I] Handle of service
412 * dwNumServiceArgs [I] Number of arguments
413 * lpServiceArgVectors [I] Address of array of argument string pointers
415 * RETURNS STD
417 * NOTES
418 * hService should be SC_HANDLE
420 BOOL32 WINAPI StartService32W( HANDLE32 hService, DWORD dwNumServiceArgs,
421 LPCWSTR *lpServiceArgVectors )
423 FIXME(advapi, "(%d,%ld,%p): stub\n",hService,dwNumServiceArgs,
424 lpServiceArgVectors);
425 return TRUE;
429 /******************************************************************************
430 * DeregisterEventSource [ADVAPI32.32]
431 * Closes a handle to the specified event log
433 * PARAMS
434 * hEventLog [I] Handle to event log
436 * RETURNS STD
438 BOOL32 WINAPI DeregisterEventSource( HANDLE32 hEventLog )
440 FIXME(advapi, "(%d): stub\n",hEventLog);
441 return TRUE;
445 /******************************************************************************
446 * RegisterEventSource32A [ADVAPI32.174]
448 HANDLE32 WINAPI RegisterEventSource32A( LPCSTR lpUNCServerName,
449 LPCSTR lpSourceName )
451 LPWSTR lpUNCServerNameW = HEAP_strdupAtoW(GetProcessHeap(),0,lpUNCServerName);
452 LPWSTR lpSourceNameW = HEAP_strdupAtoW(GetProcessHeap(),0,lpSourceName);
453 HANDLE32 ret = RegisterEventSource32W(lpUNCServerNameW,lpSourceNameW);
454 HeapFree(GetProcessHeap(),0,lpSourceNameW);
455 HeapFree(GetProcessHeap(),0,lpUNCServerNameW);
456 return ret;
460 /******************************************************************************
461 * RegisterEventSource32W [ADVAPI32.175]
462 * Returns a registered handle to an event log
464 * PARAMS
465 * lpUNCServerName [I] Server name for source
466 * lpSourceName [I] Source name for registered handle
468 * RETURNS
469 * Success: Handle
470 * Failure: NULL
472 HANDLE32 WINAPI RegisterEventSource32W( LPCWSTR lpUNCServerName,
473 LPCWSTR lpSourceName )
475 FIXME(advapi, "(%s,%s): stub\n", debugstr_w(lpUNCServerName),
476 debugstr_w(lpSourceName));
477 return 1;
480 /******************************************************************************
481 * QueryServiceStatus [ADVAPI32]
483 BOOL32 WINAPI QueryServiceStatus(/*SC_HANDLE*/HANDLE32 hService,/*LPSERVICE_STATUS*/LPVOID lpservicestatus) {
484 FIXME(advapi,"(%d,%p),stub!\n",hService,lpservicestatus);
485 return TRUE;
488 /******************************************************************************
489 * IsValidSecurityDescriptor [ADVAPI32]
491 BOOL32 WINAPI IsValidSecurityDescriptor(LPSECURITY_DESCRIPTOR lpsecdesc) {
492 FIXME(advapi,"(%p),stub!\n",lpsecdesc);
493 return TRUE;
496 /******************************************************************************
497 * MakeSelfRelativeSD [ADVAPI32]
499 BOOL32 WINAPI MakeSelfRelativeSD(
500 LPSECURITY_DESCRIPTOR lpabssecdesc,
501 LPSECURITY_DESCRIPTOR lpselfsecdesc,LPDWORD lpbuflen
503 FIXME(advapi,"(%p,%p,%p),stub!\n",lpabssecdesc,lpselfsecdesc,lpbuflen);
504 return TRUE;
507 /******************************************************************************
508 * QueryWindows31FilesMigration [ADVAPI32]
510 BOOL32 WINAPI QueryWindows31FilesMigration(DWORD x1) {
511 FIXME(advapi,"(%ld),stub!\n",x1);
512 return TRUE;
515 /******************************************************************************
516 * SynchronizeWindows31FilesAndWindowsNTRegistry [ADVAPI32]
518 BOOL32 WINAPI SynchronizeWindows31FilesAndWindowsNTRegistry(DWORD x1,DWORD x2,DWORD x3,DWORD x4) {
519 FIXME(advapi,"(0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3,x4);
520 return TRUE;
523 /******************************************************************************
524 * LsaOpenPolicy [ADVAPI32]
526 BOOL32 WINAPI LsaOpenPolicy(DWORD x1,DWORD x2,DWORD x3,DWORD x4) {
527 FIXME(advapi,"(0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3,x4);
528 return 0xc0000000; /* generic error */
531 /******************************************************************************
532 * NotifyBootConfigStatus [ADVAPI32]
534 BOOL32 WINAPI NotifyBootConfigStatus(DWORD x1) {
535 FIXME(advapi,"(0x%08lx),stub!\n",x1);
536 return 1;
539 /******************************************************************************
540 * OpenEventLogA [ADVAPI32]
542 HANDLE32 WINAPI OpenEventLog32A(LPCSTR uncname,LPCSTR source) {
543 FIXME(advapi,"(%s,%s),stub!\n",uncname,source);
544 return 0xcafe4242;