advapi32/tests: Show that child processes do not inherit mandatory labels.
[wine.git] / dlls / advapi32 / eventlog.c
blob1547aa47cf5e3eba777ce1daef32bb5ac185a80e
1 /*
2 * Win32 advapi functions
4 * Copyright 1995 Sven Verdoolaege
5 * Copyright 1998 Juergen Schmied
6 * Copyright 2003 Mike Hearn
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #include <stdarg.h>
25 #include "windef.h"
26 #include "winbase.h"
27 #include "winerror.h"
28 #include "winternl.h"
29 #include "wmistr.h"
30 #include "evntrace.h"
31 #include "evntprov.h"
33 #include "wine/unicode.h"
34 #include "wine/debug.h"
36 #include "advapi32_misc.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(advapi);
39 WINE_DECLARE_DEBUG_CHANNEL(eventlog);
41 /******************************************************************************
42 * BackupEventLogA [ADVAPI32.@]
44 * Saves the event log to a backup file.
46 * PARAMS
47 * hEventLog [I] Handle to event log to backup.
48 * lpBackupFileName [I] Name of the backup file.
50 * RETURNS
51 * Success: nonzero. File lpBackupFileName will contain the contents of
52 * hEvenLog.
53 * Failure: zero.
55 BOOL WINAPI BackupEventLogA( HANDLE hEventLog, LPCSTR lpBackupFileName )
57 LPWSTR backupW;
58 BOOL ret;
60 backupW = SERV_dup(lpBackupFileName);
61 ret = BackupEventLogW(hEventLog, backupW);
62 heap_free(backupW);
64 return ret;
67 /******************************************************************************
68 * BackupEventLogW [ADVAPI32.@]
70 * See BackupEventLogA.
72 BOOL WINAPI BackupEventLogW( HANDLE hEventLog, LPCWSTR lpBackupFileName )
74 FIXME("(%p,%s) stub\n", hEventLog, debugstr_w(lpBackupFileName));
76 if (!lpBackupFileName)
78 SetLastError(ERROR_INVALID_PARAMETER);
79 return FALSE;
82 if (!hEventLog)
84 SetLastError(ERROR_INVALID_HANDLE);
85 return FALSE;
88 if (GetFileAttributesW(lpBackupFileName) != INVALID_FILE_ATTRIBUTES)
90 SetLastError(ERROR_ALREADY_EXISTS);
91 return FALSE;
94 return TRUE;
97 /******************************************************************************
98 * ClearEventLogA [ADVAPI32.@]
100 * Clears the event log and optionally saves the log to a backup file.
102 * PARAMS
103 * hEvenLog [I] Handle to event log to clear.
104 * lpBackupFileName [I] Name of the backup file.
106 * RETURNS
107 * Success: nonzero. if lpBackupFileName != NULL, lpBackupFileName will
108 * contain the contents of hEvenLog and the log will be cleared.
109 * Failure: zero. Fails if the event log is empty or if lpBackupFileName
110 * exists.
112 BOOL WINAPI ClearEventLogA( HANDLE hEventLog, LPCSTR lpBackupFileName )
114 LPWSTR backupW;
115 BOOL ret;
117 backupW = SERV_dup(lpBackupFileName);
118 ret = ClearEventLogW(hEventLog, backupW);
119 heap_free(backupW);
121 return ret;
124 /******************************************************************************
125 * ClearEventLogW [ADVAPI32.@]
127 * See ClearEventLogA.
129 BOOL WINAPI ClearEventLogW( HANDLE hEventLog, LPCWSTR lpBackupFileName )
131 FIXME("(%p,%s) stub\n", hEventLog, debugstr_w(lpBackupFileName));
133 if (!hEventLog)
135 SetLastError(ERROR_INVALID_HANDLE);
136 return FALSE;
139 return TRUE;
142 /******************************************************************************
143 * CloseEventLog [ADVAPI32.@]
145 * Closes a read handle to the event log.
147 * PARAMS
148 * hEventLog [I/O] Handle of the event log to close.
150 * RETURNS
151 * Success: nonzero
152 * Failure: zero
154 BOOL WINAPI CloseEventLog( HANDLE hEventLog )
156 FIXME("(%p) stub\n", hEventLog);
158 if (!hEventLog)
160 SetLastError(ERROR_INVALID_HANDLE);
161 return FALSE;
164 return TRUE;
167 /******************************************************************************
168 * ControlTraceW [ADVAPI32.@]
170 * Control a givel event trace session
173 ULONG WINAPI ControlTraceW( TRACEHANDLE hSession, LPCWSTR SessionName, PEVENT_TRACE_PROPERTIES Properties, ULONG control )
175 FIXME("(%s, %s, %p, %d) stub\n", wine_dbgstr_longlong(hSession), debugstr_w(SessionName), Properties, control);
176 return ERROR_SUCCESS;
179 /******************************************************************************
180 * ControlTraceA [ADVAPI32.@]
182 * See ControlTraceW.
185 ULONG WINAPI ControlTraceA( TRACEHANDLE hSession, LPCSTR SessionName, PEVENT_TRACE_PROPERTIES Properties, ULONG control )
187 FIXME("(%s, %s, %p, %d) stub\n", wine_dbgstr_longlong(hSession), debugstr_a(SessionName), Properties, control);
188 return ERROR_SUCCESS;
191 /******************************************************************************
192 * FlushTraceA [ADVAPI32.@]
194 ULONG WINAPI FlushTraceA ( TRACEHANDLE hSession, LPCSTR SessionName, PEVENT_TRACE_PROPERTIES Properties )
196 return ControlTraceA( hSession, SessionName, Properties, EVENT_TRACE_CONTROL_FLUSH );
199 /******************************************************************************
200 * FlushTraceW [ADVAPI32.@]
202 ULONG WINAPI FlushTraceW ( TRACEHANDLE hSession, LPCWSTR SessionName, PEVENT_TRACE_PROPERTIES Properties )
204 return ControlTraceW( hSession, SessionName, Properties, EVENT_TRACE_CONTROL_FLUSH );
208 /******************************************************************************
209 * DeregisterEventSource [ADVAPI32.@]
211 * Closes a write handle to an event log
213 * PARAMS
214 * hEventLog [I/O] Handle of the event log.
216 * RETURNS
217 * Success: nonzero
218 * Failure: zero
220 BOOL WINAPI DeregisterEventSource( HANDLE hEventLog )
222 FIXME("(%p) stub\n", hEventLog);
223 return TRUE;
226 /******************************************************************************
227 * EnableTraceEx [ADVAPI32.@]
229 ULONG WINAPI EnableTraceEx( LPCGUID provider, LPCGUID source, TRACEHANDLE hSession, ULONG enable,
230 UCHAR level, ULONGLONG anykeyword, ULONGLONG allkeyword, ULONG enableprop,
231 PEVENT_FILTER_DESCRIPTOR filterdesc )
233 FIXME("(%s, %s, %s, %u, %u, %s, %s, %u, %p): stub\n", debugstr_guid(provider),
234 debugstr_guid(source), wine_dbgstr_longlong(hSession), enable, level,
235 wine_dbgstr_longlong(anykeyword), wine_dbgstr_longlong(allkeyword),
236 enableprop, filterdesc);
238 return ERROR_SUCCESS;
241 /******************************************************************************
242 * EnableTraceEx2 [ADVAPI32.@]
244 ULONG WINAPI EnableTraceEx2( TRACEHANDLE handle, LPCGUID provider, ULONG control, UCHAR level,
245 ULONGLONG match_any, ULONGLONG match_all, ULONG timeout,
246 PENABLE_TRACE_PARAMETERS params )
248 FIXME("(%s, %s, %u, %u, %s, %s, %u, %p): stub\n", wine_dbgstr_longlong(handle),
249 debugstr_guid(provider), control, level, wine_dbgstr_longlong(match_any),
250 wine_dbgstr_longlong(match_all), timeout, params);
252 return ERROR_SUCCESS;
255 /******************************************************************************
256 * EnableTrace [ADVAPI32.@]
258 ULONG WINAPI EnableTrace( ULONG enable, ULONG flag, ULONG level, LPCGUID guid, TRACEHANDLE hSession )
260 FIXME("(%d, 0x%x, %d, %s, %s): stub\n", enable, flag, level,
261 debugstr_guid(guid), wine_dbgstr_longlong(hSession));
263 return ERROR_SUCCESS;
266 /******************************************************************************
267 * GetEventLogInformation [ADVAPI32.@]
269 * Retrieve some information about an event log.
271 * PARAMS
272 * hEventLog [I] Handle to an open event log.
273 * dwInfoLevel [I] Level of information (only EVENTLOG_FULL_INFO)
274 * lpBuffer [I/O] The buffer for the returned information
275 * cbBufSize [I] The size of the buffer
276 * pcbBytesNeeded [O] The needed bytes to hold the information
278 * RETURNS
279 * Success: TRUE. lpBuffer will hold the information and pcbBytesNeeded shows
280 * the needed buffer size.
281 * Failure: FALSE.
283 BOOL WINAPI GetEventLogInformation( HANDLE hEventLog, DWORD dwInfoLevel, LPVOID lpBuffer, DWORD cbBufSize, LPDWORD pcbBytesNeeded)
285 EVENTLOG_FULL_INFORMATION *efi;
287 FIXME("(%p, %d, %p, %d, %p) stub\n", hEventLog, dwInfoLevel, lpBuffer, cbBufSize, pcbBytesNeeded);
289 if (dwInfoLevel != EVENTLOG_FULL_INFO)
291 SetLastError(ERROR_INVALID_LEVEL);
292 return FALSE;
295 if (!hEventLog)
297 SetLastError(ERROR_INVALID_HANDLE);
298 return FALSE;
301 if (!lpBuffer || !pcbBytesNeeded)
303 /* FIXME: This will be handled properly when eventlog is moved
304 * to a higher level
306 SetLastError(RPC_X_NULL_REF_POINTER);
307 return FALSE;
310 *pcbBytesNeeded = sizeof(EVENTLOG_FULL_INFORMATION);
311 if (cbBufSize < sizeof(EVENTLOG_FULL_INFORMATION))
313 SetLastError(ERROR_INSUFFICIENT_BUFFER);
314 return FALSE;
317 /* Pretend the log is not full */
318 efi = (EVENTLOG_FULL_INFORMATION *)lpBuffer;
319 efi->dwFull = 0;
321 return TRUE;
324 /******************************************************************************
325 * GetNumberOfEventLogRecords [ADVAPI32.@]
327 * Retrieves the number of records in an event log.
329 * PARAMS
330 * hEventLog [I] Handle to an open event log.
331 * NumberOfRecords [O] Number of records in the log.
333 * RETURNS
334 * Success: nonzero. NumberOfRecords will contain the number of records in
335 * the log.
336 * Failure: zero
338 BOOL WINAPI GetNumberOfEventLogRecords( HANDLE hEventLog, PDWORD NumberOfRecords )
340 FIXME("(%p,%p) stub\n", hEventLog, NumberOfRecords);
342 if (!NumberOfRecords)
344 SetLastError(ERROR_INVALID_PARAMETER);
345 return FALSE;
348 if (!hEventLog)
350 SetLastError(ERROR_INVALID_HANDLE);
351 return FALSE;
354 *NumberOfRecords = 0;
356 return TRUE;
359 /******************************************************************************
360 * GetOldestEventLogRecord [ADVAPI32.@]
362 * Retrieves the absolute record number of the oldest record in an even log.
364 * PARAMS
365 * hEventLog [I] Handle to an open event log.
366 * OldestRecord [O] Absolute record number of the oldest record.
368 * RETURNS
369 * Success: nonzero. OldestRecord contains the record number of the oldest
370 * record in the log.
371 * Failure: zero
373 BOOL WINAPI GetOldestEventLogRecord( HANDLE hEventLog, PDWORD OldestRecord )
375 FIXME("(%p,%p) stub\n", hEventLog, OldestRecord);
377 if (!OldestRecord)
379 SetLastError(ERROR_INVALID_PARAMETER);
380 return FALSE;
383 if (!hEventLog)
385 SetLastError(ERROR_INVALID_HANDLE);
386 return FALSE;
389 *OldestRecord = 0;
391 return TRUE;
394 /******************************************************************************
395 * GetTraceEnableFlags [ADVAPI32.@]
397 ULONG WINAPI GetTraceEnableFlags( TRACEHANDLE handle )
399 FIXME("(%s) stub\n", wine_dbgstr_longlong(handle));
400 return 0;
403 /******************************************************************************
404 * GetTraceEnableLevel [ADVAPI32.@]
406 UCHAR WINAPI GetTraceEnableLevel( TRACEHANDLE handle )
408 FIXME("(%s) stub\n", wine_dbgstr_longlong(handle));
409 return TRACE_LEVEL_VERBOSE;
412 /******************************************************************************
413 * GetTraceLoggerHandle [ADVAPI32.@]
415 TRACEHANDLE WINAPI GetTraceLoggerHandle( PVOID buf )
417 FIXME("(%p) stub\n", buf);
418 SetLastError(ERROR_ACCESS_DENIED);
419 return INVALID_PROCESSTRACE_HANDLE;
422 /******************************************************************************
423 * NotifyChangeEventLog [ADVAPI32.@]
425 * Enables an application to receive notification when an event is written
426 * to an event log.
428 * PARAMS
429 * hEventLog [I] Handle to an event log.
430 * hEvent [I] Handle to a manual-reset event object.
432 * RETURNS
433 * Success: nonzero
434 * Failure: zero
436 BOOL WINAPI NotifyChangeEventLog( HANDLE hEventLog, HANDLE hEvent )
438 FIXME("(%p,%p) stub\n", hEventLog, hEvent);
439 return TRUE;
442 /******************************************************************************
443 * OpenBackupEventLogA [ADVAPI32.@]
445 * Opens a handle to a backup event log.
447 * PARAMS
448 * lpUNCServerName [I] Universal Naming Convention name of the server on which
449 * this will be performed.
450 * lpFileName [I] Specifies the name of the backup file.
452 * RETURNS
453 * Success: Handle to the backup event log.
454 * Failure: NULL
456 HANDLE WINAPI OpenBackupEventLogA( LPCSTR lpUNCServerName, LPCSTR lpFileName )
458 LPWSTR uncnameW, filenameW;
459 HANDLE handle;
461 uncnameW = SERV_dup(lpUNCServerName);
462 filenameW = SERV_dup(lpFileName);
463 handle = OpenBackupEventLogW(uncnameW, filenameW);
464 heap_free(uncnameW);
465 heap_free(filenameW);
467 return handle;
470 /******************************************************************************
471 * OpenBackupEventLogW [ADVAPI32.@]
473 * See OpenBackupEventLogA.
475 HANDLE WINAPI OpenBackupEventLogW( LPCWSTR lpUNCServerName, LPCWSTR lpFileName )
477 FIXME("(%s,%s) stub\n", debugstr_w(lpUNCServerName), debugstr_w(lpFileName));
479 if (!lpFileName)
481 SetLastError(ERROR_INVALID_PARAMETER);
482 return NULL;
485 if (lpUNCServerName && lpUNCServerName[0])
487 FIXME("Remote server not supported\n");
488 SetLastError(RPC_S_SERVER_UNAVAILABLE);
489 return NULL;
492 if (GetFileAttributesW(lpFileName) == INVALID_FILE_ATTRIBUTES)
494 SetLastError(ERROR_FILE_NOT_FOUND);
495 return NULL;
498 return (HANDLE)0xcafe4242;
501 /******************************************************************************
502 * OpenEventLogA [ADVAPI32.@]
504 * Opens a handle to the specified event log.
506 * PARAMS
507 * lpUNCServerName [I] UNC name of the server on which the event log is
508 * opened.
509 * lpSourceName [I] Name of the log.
511 * RETURNS
512 * Success: Handle to an event log.
513 * Failure: NULL
515 HANDLE WINAPI OpenEventLogA( LPCSTR uncname, LPCSTR source )
517 LPWSTR uncnameW, sourceW;
518 HANDLE handle;
520 uncnameW = SERV_dup(uncname);
521 sourceW = SERV_dup(source);
522 handle = OpenEventLogW(uncnameW, sourceW);
523 heap_free(uncnameW);
524 heap_free(sourceW);
526 return handle;
529 /******************************************************************************
530 * OpenEventLogW [ADVAPI32.@]
532 * See OpenEventLogA.
534 HANDLE WINAPI OpenEventLogW( LPCWSTR uncname, LPCWSTR source )
536 FIXME("(%s,%s) stub\n", debugstr_w(uncname), debugstr_w(source));
538 if (!source)
540 SetLastError(ERROR_INVALID_PARAMETER);
541 return NULL;
544 if (uncname && uncname[0])
546 FIXME("Remote server not supported\n");
547 SetLastError(RPC_S_SERVER_UNAVAILABLE);
548 return NULL;
551 return (HANDLE)0xcafe4242;
554 /******************************************************************************
555 * QueryAllTracesW [ADVAPI32.@]
557 * Query information for started event trace sessions
560 ULONG WINAPI QueryAllTracesW( PEVENT_TRACE_PROPERTIES * parray, ULONG arraycount, PULONG psessioncount )
562 FIXME("(%p, %d, %p) stub\n", parray, arraycount, psessioncount);
564 if (psessioncount) *psessioncount = 0;
565 return ERROR_SUCCESS;
568 /******************************************************************************
569 * QueryAllTracesA [ADVAPI32.@]
571 * See QueryAllTracesW.
573 ULONG WINAPI QueryAllTracesA( PEVENT_TRACE_PROPERTIES * parray, ULONG arraycount, PULONG psessioncount )
575 FIXME("(%p, %d, %p) stub\n", parray, arraycount, psessioncount);
577 if (psessioncount) *psessioncount = 0;
578 return ERROR_SUCCESS;
581 /******************************************************************************
582 * ReadEventLogA [ADVAPI32.@]
584 * Reads a whole number of entries from an event log.
586 * PARAMS
587 * hEventLog [I] Handle of the event log to read.
588 * dwReadFlags [I] see MSDN doc.
589 * dwRecordOffset [I] Log-entry record number to start at.
590 * lpBuffer [O] Buffer for the data read.
591 * nNumberOfBytesToRead [I] Size of lpBuffer.
592 * pnBytesRead [O] Receives number of bytes read.
593 * pnMinNumberOfBytesNeeded [O] Receives number of bytes required for the
594 * next log entry.
596 * RETURNS
597 * Success: nonzero
598 * Failure: zero
600 BOOL WINAPI ReadEventLogA( HANDLE hEventLog, DWORD dwReadFlags, DWORD dwRecordOffset,
601 LPVOID lpBuffer, DWORD nNumberOfBytesToRead, DWORD *pnBytesRead, DWORD *pnMinNumberOfBytesNeeded )
603 FIXME("(%p,0x%08x,0x%08x,%p,0x%08x,%p,%p) stub\n", hEventLog, dwReadFlags,
604 dwRecordOffset, lpBuffer, nNumberOfBytesToRead, pnBytesRead, pnMinNumberOfBytesNeeded);
606 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
607 return FALSE;
610 /******************************************************************************
611 * ReadEventLogW [ADVAPI32.@]
613 * See ReadEventLogA.
615 BOOL WINAPI ReadEventLogW( HANDLE hEventLog, DWORD dwReadFlags, DWORD dwRecordOffset,
616 LPVOID lpBuffer, DWORD nNumberOfBytesToRead, DWORD *pnBytesRead, DWORD *pnMinNumberOfBytesNeeded )
618 FIXME("(%p,0x%08x,0x%08x,%p,0x%08x,%p,%p) stub\n", hEventLog, dwReadFlags,
619 dwRecordOffset, lpBuffer, nNumberOfBytesToRead, pnBytesRead, pnMinNumberOfBytesNeeded);
621 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
622 return FALSE;
625 /******************************************************************************
626 * RegisterEventSourceA [ADVAPI32.@]
628 * Returns a registered handle to an event log.
630 * PARAMS
631 * lpUNCServerName [I] UNC name of the source server.
632 * lpSourceName [I] Specifies the name of the event source to retrieve.
634 * RETURNS
635 * Success: Handle to the event log.
636 * Failure: NULL. Returns ERROR_INVALID_HANDLE if lpSourceName specifies the
637 * Security event log.
639 HANDLE WINAPI RegisterEventSourceA( LPCSTR lpUNCServerName, LPCSTR lpSourceName )
641 UNICODE_STRING lpUNCServerNameW;
642 UNICODE_STRING lpSourceNameW;
643 HANDLE ret;
645 FIXME("(%s,%s): stub\n", debugstr_a(lpUNCServerName), debugstr_a(lpSourceName));
647 RtlCreateUnicodeStringFromAsciiz(&lpUNCServerNameW, lpUNCServerName);
648 RtlCreateUnicodeStringFromAsciiz(&lpSourceNameW, lpSourceName);
649 ret = RegisterEventSourceW(lpUNCServerNameW.Buffer,lpSourceNameW.Buffer);
650 RtlFreeUnicodeString (&lpUNCServerNameW);
651 RtlFreeUnicodeString (&lpSourceNameW);
652 return ret;
655 /******************************************************************************
656 * RegisterEventSourceW [ADVAPI32.@]
658 * See RegisterEventSourceA.
660 HANDLE WINAPI RegisterEventSourceW( LPCWSTR lpUNCServerName, LPCWSTR lpSourceName )
662 FIXME("(%s,%s): stub\n", debugstr_w(lpUNCServerName), debugstr_w(lpSourceName));
663 return (HANDLE)0xcafe4242;
666 /******************************************************************************
667 * ReportEventA [ADVAPI32.@]
669 * Writes an entry at the end of an event log.
671 * PARAMS
672 * hEventLog [I] Handle of an event log.
673 * wType [I] See MSDN doc.
674 * wCategory [I] Event category.
675 * dwEventID [I] Event identifier.
676 * lpUserSid [I] Current user's security identifier.
677 * wNumStrings [I] Number of insert strings in lpStrings.
678 * dwDataSize [I] Size of event-specific raw data to write.
679 * lpStrings [I] Buffer containing an array of string to be merged.
680 * lpRawData [I] Buffer containing the binary data.
682 * RETURNS
683 * Success: nonzero. Entry was written to the log.
684 * Failure: zero.
686 * NOTES
687 * The ReportEvent function adds the time, the entry's length, and the
688 * offsets before storing the entry in the log. If lpUserSid != NULL, the
689 * username is also logged.
691 BOOL WINAPI ReportEventA ( HANDLE hEventLog, WORD wType, WORD wCategory, DWORD dwEventID,
692 PSID lpUserSid, WORD wNumStrings, DWORD dwDataSize, LPCSTR *lpStrings, LPVOID lpRawData)
694 LPWSTR *wideStrArray;
695 UNICODE_STRING str;
696 UINT i;
697 BOOL ret;
699 FIXME("(%p,0x%04x,0x%04x,0x%08x,%p,0x%04x,0x%08x,%p,%p): stub\n", hEventLog,
700 wType, wCategory, dwEventID, lpUserSid, wNumStrings, dwDataSize, lpStrings, lpRawData);
702 if (wNumStrings == 0) return TRUE;
703 if (!lpStrings) return TRUE;
705 wideStrArray = heap_alloc(sizeof(LPWSTR) * wNumStrings);
706 for (i = 0; i < wNumStrings; i++)
708 RtlCreateUnicodeStringFromAsciiz(&str, lpStrings[i]);
709 wideStrArray[i] = str.Buffer;
711 ret = ReportEventW(hEventLog, wType, wCategory, dwEventID, lpUserSid,
712 wNumStrings, dwDataSize, (LPCWSTR *)wideStrArray, lpRawData);
713 for (i = 0; i < wNumStrings; i++)
714 heap_free( wideStrArray[i] );
715 heap_free(wideStrArray);
716 return ret;
719 /******************************************************************************
720 * ReportEventW [ADVAPI32.@]
722 * See ReportEventA.
724 BOOL WINAPI ReportEventW( HANDLE hEventLog, WORD wType, WORD wCategory, DWORD dwEventID,
725 PSID lpUserSid, WORD wNumStrings, DWORD dwDataSize, LPCWSTR *lpStrings, LPVOID lpRawData )
727 UINT i;
729 FIXME("(%p,0x%04x,0x%04x,0x%08x,%p,0x%04x,0x%08x,%p,%p): stub\n", hEventLog,
730 wType, wCategory, dwEventID, lpUserSid, wNumStrings, dwDataSize, lpStrings, lpRawData);
732 /* partial stub */
734 if (wNumStrings == 0) return TRUE;
735 if (!lpStrings) return TRUE;
737 for (i = 0; i < wNumStrings; i++)
739 switch (wType)
741 case EVENTLOG_SUCCESS:
742 TRACE_(eventlog)("%s\n", debugstr_w(lpStrings[i]));
743 break;
744 case EVENTLOG_ERROR_TYPE:
745 ERR_(eventlog)("%s\n", debugstr_w(lpStrings[i]));
746 break;
747 case EVENTLOG_WARNING_TYPE:
748 WARN_(eventlog)("%s\n", debugstr_w(lpStrings[i]));
749 break;
750 default:
751 TRACE_(eventlog)("%s\n", debugstr_w(lpStrings[i]));
752 break;
755 return TRUE;
758 /******************************************************************************
759 * StartTraceW [ADVAPI32.@]
761 * Register and start an event trace session
764 ULONG WINAPI StartTraceW( PTRACEHANDLE pSessionHandle, LPCWSTR SessionName, PEVENT_TRACE_PROPERTIES Properties )
766 FIXME("(%p, %s, %p) stub\n", pSessionHandle, debugstr_w(SessionName), Properties);
767 if (pSessionHandle) *pSessionHandle = 0xcafe4242;
768 return ERROR_SUCCESS;
771 /******************************************************************************
772 * StartTraceA [ADVAPI32.@]
774 * See StartTraceW.
777 ULONG WINAPI StartTraceA( PTRACEHANDLE pSessionHandle, LPCSTR SessionName, PEVENT_TRACE_PROPERTIES Properties )
779 FIXME("(%p, %s, %p) stub\n", pSessionHandle, debugstr_a(SessionName), Properties);
780 if (pSessionHandle) *pSessionHandle = 0xcafe4242;
781 return ERROR_SUCCESS;
784 /******************************************************************************
785 * StopTraceW [ADVAPI32.@]
787 * Stop an event trace session
790 ULONG WINAPI StopTraceW( TRACEHANDLE session, LPCWSTR session_name, PEVENT_TRACE_PROPERTIES properties )
792 FIXME("(%s, %s, %p) stub\n", wine_dbgstr_longlong(session), debugstr_w(session_name), properties);
793 return ERROR_SUCCESS;
796 /******************************************************************************
797 * StopTraceA [ADVAPI32.@]
799 * See StopTraceW.
802 ULONG WINAPI StopTraceA( TRACEHANDLE session, LPCSTR session_name, PEVENT_TRACE_PROPERTIES properties )
804 FIXME("(%s, %s, %p) stub\n", wine_dbgstr_longlong(session), debugstr_a(session_name), properties);
805 return ERROR_SUCCESS;
808 /******************************************************************************
809 * TraceEvent [ADVAPI32.@]
811 ULONG WINAPI TraceEvent( TRACEHANDLE SessionHandle, PEVENT_TRACE_HEADER EventTrace )
813 FIXME("%s %p\n", wine_dbgstr_longlong(SessionHandle), EventTrace);
814 return ERROR_CALL_NOT_IMPLEMENTED;
817 /******************************************************************************
818 * EventProviderEnabled [ADVAPI32.@]
821 BOOLEAN WINAPI EventProviderEnabled( REGHANDLE handle, UCHAR level, ULONGLONG keyword )
823 FIXME("%s, %u, %s: stub\n", wine_dbgstr_longlong(handle), level, wine_dbgstr_longlong(keyword));
824 return FALSE;
827 /******************************************************************************
828 * EventActivityIdControl [ADVAPI32.@]
831 ULONG WINAPI EventActivityIdControl(ULONG code, GUID *guid)
833 FIXME("0x%x, %p: stub\n", code, guid);
834 return ERROR_SUCCESS;
837 /******************************************************************************
838 * EventWriteTransfer [ADVAPI32.@]
840 ULONG WINAPI EventWriteTransfer( REGHANDLE handle, PCEVENT_DESCRIPTOR descriptor, LPCGUID activity,
841 LPCGUID related, ULONG count, PEVENT_DATA_DESCRIPTOR data )
843 FIXME("%s, %p, %s, %s, %u, %p: stub\n", wine_dbgstr_longlong(handle), descriptor,
844 debugstr_guid(activity), debugstr_guid(related), count, data);
845 return ERROR_SUCCESS;
848 /******************************************************************************
849 * QueryTraceW [ADVAPI32.@]
851 ULONG WINAPI QueryTraceW( TRACEHANDLE handle, LPCWSTR sessionname, PEVENT_TRACE_PROPERTIES properties )
853 FIXME("%s %s %p: stub\n", wine_dbgstr_longlong(handle), debugstr_w(sessionname), properties);
854 return ERROR_CALL_NOT_IMPLEMENTED;
857 /******************************************************************************
858 * OpenTraceA [ADVAPI32.@]
860 TRACEHANDLE WINAPI OpenTraceA( PEVENT_TRACE_LOGFILEA logfile )
862 FIXME("%p: stub\n", logfile);
863 SetLastError(ERROR_ACCESS_DENIED);
864 return INVALID_PROCESSTRACE_HANDLE;
867 /******************************************************************************
868 * OpenTraceW [ADVAPI32.@]
870 TRACEHANDLE WINAPI OpenTraceW( PEVENT_TRACE_LOGFILEW logfile )
872 FIXME("%p: stub\n", logfile);
873 SetLastError(ERROR_ACCESS_DENIED);
874 return INVALID_PROCESSTRACE_HANDLE;
877 /******************************************************************************
878 * ProcessTrace [ADVAPI32.@]
880 ULONG WINAPI ProcessTrace( PTRACEHANDLE HandleArray, ULONG HandleCount, LPFILETIME StartTime, LPFILETIME EndTime)
882 FIXME("%p %u %p %p: stub\n", HandleArray, HandleCount, StartTime, EndTime);
883 return ERROR_CALL_NOT_IMPLEMENTED;
886 /******************************************************************************
887 * TraceMessage [ADVAPI32.@]
889 ULONG WINAPIV TraceMessage( TRACEHANDLE handle, ULONG flags, LPGUID guid, USHORT number, ... )
891 __ms_va_list valist;
892 ULONG ret;
894 __ms_va_start( valist, number );
895 ret = TraceMessageVa( handle, flags, guid, number, valist );
896 __ms_va_end( valist );
897 return ret;
900 /******************************************************************************
901 * TraceMessageVa [ADVAPI32.@]
903 ULONG WINAPI TraceMessageVa( TRACEHANDLE handle, ULONG flags, LPGUID guid, USHORT number,
904 __ms_va_list args )
906 FIXME("(%s %x %s %d) : stub\n", wine_dbgstr_longlong(handle), flags, debugstr_guid(guid), number);
907 return ERROR_SUCCESS;
910 /******************************************************************************
911 * CloseTrace [ADVAPI32.@]
913 ULONG WINAPI CloseTrace( TRACEHANDLE handle )
915 FIXME("%s: stub\n", wine_dbgstr_longlong(handle));
916 return ERROR_INVALID_HANDLE;
919 /******************************************************************************
920 * EnumerateTraceGuids [ADVAPI32.@]
922 ULONG WINAPI EnumerateTraceGuids(PTRACE_GUID_PROPERTIES *propertiesarray,
923 ULONG arraycount, PULONG guidcount)
925 FIXME("%p %d %p: stub\n", propertiesarray, arraycount, guidcount);
926 return ERROR_INVALID_PARAMETER;