advapi32: Add stubs for GetTraceEnableFlags and GetTraceEnableLevel.
[wine/multimedia.git] / dlls / advapi32 / eventlog.c
blobd730bb91c799660a666904808794ddea03cd9b7d
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 HeapFree(GetProcessHeap(), 0, 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 HeapFree(GetProcessHeap(), 0, 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, %d, %c, %s, %s, %d, %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 * EnableTrace [ADVAPI32.@]
244 ULONG WINAPI EnableTrace( ULONG enable, ULONG flag, ULONG level, LPCGUID guid, TRACEHANDLE hSession )
246 FIXME("(%d, 0x%x, %d, %s, %s): stub\n", enable, flag, level,
247 debugstr_guid(guid), wine_dbgstr_longlong(hSession));
249 return ERROR_SUCCESS;
252 /******************************************************************************
253 * GetEventLogInformation [ADVAPI32.@]
255 * Retrieve some information about an event log.
257 * PARAMS
258 * hEventLog [I] Handle to an open event log.
259 * dwInfoLevel [I] Level of information (only EVENTLOG_FULL_INFO)
260 * lpBuffer [I/O] The buffer for the returned information
261 * cbBufSize [I] The size of the buffer
262 * pcbBytesNeeded [O] The needed bytes to hold the information
264 * RETURNS
265 * Success: TRUE. lpBuffer will hold the information and pcbBytesNeeded shows
266 * the needed buffer size.
267 * Failure: FALSE.
269 BOOL WINAPI GetEventLogInformation( HANDLE hEventLog, DWORD dwInfoLevel, LPVOID lpBuffer, DWORD cbBufSize, LPDWORD pcbBytesNeeded)
271 EVENTLOG_FULL_INFORMATION *efi;
273 FIXME("(%p, %d, %p, %d, %p) stub\n", hEventLog, dwInfoLevel, lpBuffer, cbBufSize, pcbBytesNeeded);
275 if (dwInfoLevel != EVENTLOG_FULL_INFO)
277 SetLastError(ERROR_INVALID_LEVEL);
278 return FALSE;
281 if (!hEventLog)
283 SetLastError(ERROR_INVALID_HANDLE);
284 return FALSE;
287 if (!lpBuffer || !pcbBytesNeeded)
289 /* FIXME: This will be handled properly when eventlog is moved
290 * to a higher level
292 SetLastError(RPC_X_NULL_REF_POINTER);
293 return FALSE;
296 *pcbBytesNeeded = sizeof(EVENTLOG_FULL_INFORMATION);
297 if (cbBufSize < sizeof(EVENTLOG_FULL_INFORMATION))
299 SetLastError(ERROR_INSUFFICIENT_BUFFER);
300 return FALSE;
303 /* Pretend the log is not full */
304 efi = (EVENTLOG_FULL_INFORMATION *)lpBuffer;
305 efi->dwFull = 0;
307 return TRUE;
310 /******************************************************************************
311 * GetNumberOfEventLogRecords [ADVAPI32.@]
313 * Retrieves the number of records in an event log.
315 * PARAMS
316 * hEventLog [I] Handle to an open event log.
317 * NumberOfRecords [O] Number of records in the log.
319 * RETURNS
320 * Success: nonzero. NumberOfRecords will contain the number of records in
321 * the log.
322 * Failure: zero
324 BOOL WINAPI GetNumberOfEventLogRecords( HANDLE hEventLog, PDWORD NumberOfRecords )
326 FIXME("(%p,%p) stub\n", hEventLog, NumberOfRecords);
328 if (!NumberOfRecords)
330 SetLastError(ERROR_INVALID_PARAMETER);
331 return FALSE;
334 if (!hEventLog)
336 SetLastError(ERROR_INVALID_HANDLE);
337 return FALSE;
340 *NumberOfRecords = 0;
342 return TRUE;
345 /******************************************************************************
346 * GetOldestEventLogRecord [ADVAPI32.@]
348 * Retrieves the absolute record number of the oldest record in an even log.
350 * PARAMS
351 * hEventLog [I] Handle to an open event log.
352 * OldestRecord [O] Absolute record number of the oldest record.
354 * RETURNS
355 * Success: nonzero. OldestRecord contains the record number of the oldest
356 * record in the log.
357 * Failure: zero
359 BOOL WINAPI GetOldestEventLogRecord( HANDLE hEventLog, PDWORD OldestRecord )
361 FIXME("(%p,%p) stub\n", hEventLog, OldestRecord);
363 if (!OldestRecord)
365 SetLastError(ERROR_INVALID_PARAMETER);
366 return FALSE;
369 if (!hEventLog)
371 SetLastError(ERROR_INVALID_HANDLE);
372 return FALSE;
375 *OldestRecord = 0;
377 return TRUE;
380 /******************************************************************************
381 * GetTraceEnableFlags [ADVAPI32.@]
383 ULONG WINAPI GetTraceEnableFlags( TRACEHANDLE handle )
385 FIXME("(%s) stub\n", wine_dbgstr_longlong(handle));
386 return 0;
389 /******************************************************************************
390 * GetTraceEnableLevel [ADVAPI32.@]
392 UCHAR WINAPI GetTraceEnableLevel( TRACEHANDLE handle )
394 FIXME("(%s) stub\n", wine_dbgstr_longlong(handle));
395 return TRACE_LEVEL_VERBOSE;
398 /******************************************************************************
399 * GetTraceLoggerHandle [ADVAPI32.@]
401 TRACEHANDLE WINAPI GetTraceLoggerHandle( PVOID buf )
403 FIXME("(%p) stub\n", buf);
404 SetLastError(ERROR_ACCESS_DENIED);
405 return INVALID_PROCESSTRACE_HANDLE;
408 /******************************************************************************
409 * NotifyChangeEventLog [ADVAPI32.@]
411 * Enables an application to receive notification when an event is written
412 * to an event log.
414 * PARAMS
415 * hEventLog [I] Handle to an event log.
416 * hEvent [I] Handle to a manual-reset event object.
418 * RETURNS
419 * Success: nonzero
420 * Failure: zero
422 BOOL WINAPI NotifyChangeEventLog( HANDLE hEventLog, HANDLE hEvent )
424 FIXME("(%p,%p) stub\n", hEventLog, hEvent);
425 return TRUE;
428 /******************************************************************************
429 * OpenBackupEventLogA [ADVAPI32.@]
431 * Opens a handle to a backup event log.
433 * PARAMS
434 * lpUNCServerName [I] Universal Naming Convention name of the server on which
435 * this will be performed.
436 * lpFileName [I] Specifies the name of the backup file.
438 * RETURNS
439 * Success: Handle to the backup event log.
440 * Failure: NULL
442 HANDLE WINAPI OpenBackupEventLogA( LPCSTR lpUNCServerName, LPCSTR lpFileName )
444 LPWSTR uncnameW, filenameW;
445 HANDLE handle;
447 uncnameW = SERV_dup(lpUNCServerName);
448 filenameW = SERV_dup(lpFileName);
449 handle = OpenBackupEventLogW(uncnameW, filenameW);
450 HeapFree(GetProcessHeap(), 0, uncnameW);
451 HeapFree(GetProcessHeap(), 0, filenameW);
453 return handle;
456 /******************************************************************************
457 * OpenBackupEventLogW [ADVAPI32.@]
459 * See OpenBackupEventLogA.
461 HANDLE WINAPI OpenBackupEventLogW( LPCWSTR lpUNCServerName, LPCWSTR lpFileName )
463 FIXME("(%s,%s) stub\n", debugstr_w(lpUNCServerName), debugstr_w(lpFileName));
465 if (!lpFileName)
467 SetLastError(ERROR_INVALID_PARAMETER);
468 return NULL;
471 if (lpUNCServerName && lpUNCServerName[0])
473 FIXME("Remote server not supported\n");
474 SetLastError(RPC_S_SERVER_UNAVAILABLE);
475 return NULL;
478 if (GetFileAttributesW(lpFileName) == INVALID_FILE_ATTRIBUTES)
480 SetLastError(ERROR_FILE_NOT_FOUND);
481 return NULL;
484 return (HANDLE)0xcafe4242;
487 /******************************************************************************
488 * OpenEventLogA [ADVAPI32.@]
490 * Opens a handle to the specified event log.
492 * PARAMS
493 * lpUNCServerName [I] UNC name of the server on which the event log is
494 * opened.
495 * lpSourceName [I] Name of the log.
497 * RETURNS
498 * Success: Handle to an event log.
499 * Failure: NULL
501 HANDLE WINAPI OpenEventLogA( LPCSTR uncname, LPCSTR source )
503 LPWSTR uncnameW, sourceW;
504 HANDLE handle;
506 uncnameW = SERV_dup(uncname);
507 sourceW = SERV_dup(source);
508 handle = OpenEventLogW(uncnameW, sourceW);
509 HeapFree(GetProcessHeap(), 0, uncnameW);
510 HeapFree(GetProcessHeap(), 0, sourceW);
512 return handle;
515 /******************************************************************************
516 * OpenEventLogW [ADVAPI32.@]
518 * See OpenEventLogA.
520 HANDLE WINAPI OpenEventLogW( LPCWSTR uncname, LPCWSTR source )
522 FIXME("(%s,%s) stub\n", debugstr_w(uncname), debugstr_w(source));
524 if (!source)
526 SetLastError(ERROR_INVALID_PARAMETER);
527 return NULL;
530 if (uncname && uncname[0])
532 FIXME("Remote server not supported\n");
533 SetLastError(RPC_S_SERVER_UNAVAILABLE);
534 return NULL;
537 return (HANDLE)0xcafe4242;
540 /******************************************************************************
541 * QueryAllTracesW [ADVAPI32.@]
543 * Query information for started event trace sessions
546 ULONG WINAPI QueryAllTracesW( PEVENT_TRACE_PROPERTIES * parray, ULONG arraycount, PULONG psessioncount )
548 FIXME("(%p, %d, %p) stub\n", parray, arraycount, psessioncount);
550 if (psessioncount) *psessioncount = 0;
551 return ERROR_SUCCESS;
554 /******************************************************************************
555 * QueryAllTracesA [ADVAPI32.@]
557 * See QueryAllTracesW.
559 ULONG WINAPI QueryAllTracesA( PEVENT_TRACE_PROPERTIES * parray, ULONG arraycount, PULONG psessioncount )
561 FIXME("(%p, %d, %p) stub\n", parray, arraycount, psessioncount);
563 if (psessioncount) *psessioncount = 0;
564 return ERROR_SUCCESS;
567 /******************************************************************************
568 * ReadEventLogA [ADVAPI32.@]
570 * Reads a whole number of entries from an event log.
572 * PARAMS
573 * hEventLog [I] Handle of the event log to read.
574 * dwReadFlags [I] see MSDN doc.
575 * dwRecordOffset [I] Log-entry record number to start at.
576 * lpBuffer [O] Buffer for the data read.
577 * nNumberOfBytesToRead [I] Size of lpBuffer.
578 * pnBytesRead [O] Receives number of bytes read.
579 * pnMinNumberOfBytesNeeded [O] Receives number of bytes required for the
580 * next log entry.
582 * RETURNS
583 * Success: nonzero
584 * Failure: zero
586 BOOL WINAPI ReadEventLogA( HANDLE hEventLog, DWORD dwReadFlags, DWORD dwRecordOffset,
587 LPVOID lpBuffer, DWORD nNumberOfBytesToRead, DWORD *pnBytesRead, DWORD *pnMinNumberOfBytesNeeded )
589 FIXME("(%p,0x%08x,0x%08x,%p,0x%08x,%p,%p) stub\n", hEventLog, dwReadFlags,
590 dwRecordOffset, lpBuffer, nNumberOfBytesToRead, pnBytesRead, pnMinNumberOfBytesNeeded);
592 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
593 return FALSE;
596 /******************************************************************************
597 * ReadEventLogW [ADVAPI32.@]
599 * See ReadEventLogA.
601 BOOL WINAPI ReadEventLogW( HANDLE hEventLog, DWORD dwReadFlags, DWORD dwRecordOffset,
602 LPVOID lpBuffer, DWORD nNumberOfBytesToRead, DWORD *pnBytesRead, DWORD *pnMinNumberOfBytesNeeded )
604 FIXME("(%p,0x%08x,0x%08x,%p,0x%08x,%p,%p) stub\n", hEventLog, dwReadFlags,
605 dwRecordOffset, lpBuffer, nNumberOfBytesToRead, pnBytesRead, pnMinNumberOfBytesNeeded);
607 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
608 return FALSE;
611 /******************************************************************************
612 * RegisterEventSourceA [ADVAPI32.@]
614 * Returns a registered handle to an event log.
616 * PARAMS
617 * lpUNCServerName [I] UNC name of the source server.
618 * lpSourceName [I] Specifies the name of the event source to retrieve.
620 * RETURNS
621 * Success: Handle to the event log.
622 * Failure: NULL. Returns ERROR_INVALID_HANDLE if lpSourceName specifies the
623 * Security event log.
625 HANDLE WINAPI RegisterEventSourceA( LPCSTR lpUNCServerName, LPCSTR lpSourceName )
627 UNICODE_STRING lpUNCServerNameW;
628 UNICODE_STRING lpSourceNameW;
629 HANDLE ret;
631 FIXME("(%s,%s): stub\n", debugstr_a(lpUNCServerName), debugstr_a(lpSourceName));
633 RtlCreateUnicodeStringFromAsciiz(&lpUNCServerNameW, lpUNCServerName);
634 RtlCreateUnicodeStringFromAsciiz(&lpSourceNameW, lpSourceName);
635 ret = RegisterEventSourceW(lpUNCServerNameW.Buffer,lpSourceNameW.Buffer);
636 RtlFreeUnicodeString (&lpUNCServerNameW);
637 RtlFreeUnicodeString (&lpSourceNameW);
638 return ret;
641 /******************************************************************************
642 * RegisterEventSourceW [ADVAPI32.@]
644 * See RegisterEventSourceA.
646 HANDLE WINAPI RegisterEventSourceW( LPCWSTR lpUNCServerName, LPCWSTR lpSourceName )
648 FIXME("(%s,%s): stub\n", debugstr_w(lpUNCServerName), debugstr_w(lpSourceName));
649 return (HANDLE)0xcafe4242;
652 /******************************************************************************
653 * ReportEventA [ADVAPI32.@]
655 * Writes an entry at the end of an event log.
657 * PARAMS
658 * hEventLog [I] Handle of an event log.
659 * wType [I] See MSDN doc.
660 * wCategory [I] Event category.
661 * dwEventID [I] Event identifier.
662 * lpUserSid [I] Current user's security identifier.
663 * wNumStrings [I] Number of insert strings in lpStrings.
664 * dwDataSize [I] Size of event-specific raw data to write.
665 * lpStrings [I] Buffer containing an array of string to be merged.
666 * lpRawData [I] Buffer containing the binary data.
668 * RETURNS
669 * Success: nonzero. Entry was written to the log.
670 * Failure: zero.
672 * NOTES
673 * The ReportEvent function adds the time, the entry's length, and the
674 * offsets before storing the entry in the log. If lpUserSid != NULL, the
675 * username is also logged.
677 BOOL WINAPI ReportEventA ( HANDLE hEventLog, WORD wType, WORD wCategory, DWORD dwEventID,
678 PSID lpUserSid, WORD wNumStrings, DWORD dwDataSize, LPCSTR *lpStrings, LPVOID lpRawData)
680 LPWSTR *wideStrArray;
681 UNICODE_STRING str;
682 UINT i;
683 BOOL ret;
685 FIXME("(%p,0x%04x,0x%04x,0x%08x,%p,0x%04x,0x%08x,%p,%p): stub\n", hEventLog,
686 wType, wCategory, dwEventID, lpUserSid, wNumStrings, dwDataSize, lpStrings, lpRawData);
688 if (wNumStrings == 0) return TRUE;
689 if (!lpStrings) return TRUE;
691 wideStrArray = HeapAlloc(GetProcessHeap(), 0, sizeof(LPWSTR) * wNumStrings);
692 for (i = 0; i < wNumStrings; i++)
694 RtlCreateUnicodeStringFromAsciiz(&str, lpStrings[i]);
695 wideStrArray[i] = str.Buffer;
697 ret = ReportEventW(hEventLog, wType, wCategory, dwEventID, lpUserSid,
698 wNumStrings, dwDataSize, (LPCWSTR *)wideStrArray, lpRawData);
699 for (i = 0; i < wNumStrings; i++)
701 HeapFree( GetProcessHeap(), 0, wideStrArray[i] );
703 HeapFree(GetProcessHeap(), 0, wideStrArray);
704 return ret;
707 /******************************************************************************
708 * ReportEventW [ADVAPI32.@]
710 * See ReportEventA.
712 BOOL WINAPI ReportEventW( HANDLE hEventLog, WORD wType, WORD wCategory, DWORD dwEventID,
713 PSID lpUserSid, WORD wNumStrings, DWORD dwDataSize, LPCWSTR *lpStrings, LPVOID lpRawData )
715 UINT i;
717 FIXME("(%p,0x%04x,0x%04x,0x%08x,%p,0x%04x,0x%08x,%p,%p): stub\n", hEventLog,
718 wType, wCategory, dwEventID, lpUserSid, wNumStrings, dwDataSize, lpStrings, lpRawData);
720 /* partial stub */
722 if (wNumStrings == 0) return TRUE;
723 if (!lpStrings) return TRUE;
725 for (i = 0; i < wNumStrings; i++)
727 switch (wType)
729 case EVENTLOG_SUCCESS:
730 TRACE_(eventlog)("%s\n", debugstr_w(lpStrings[i]));
731 break;
732 case EVENTLOG_ERROR_TYPE:
733 ERR_(eventlog)("%s\n", debugstr_w(lpStrings[i]));
734 break;
735 case EVENTLOG_WARNING_TYPE:
736 WARN_(eventlog)("%s\n", debugstr_w(lpStrings[i]));
737 break;
738 default:
739 TRACE_(eventlog)("%s\n", debugstr_w(lpStrings[i]));
740 break;
743 return TRUE;
746 /******************************************************************************
747 * RegisterTraceGuidsW [ADVAPI32.@]
749 * Register an event trace provider and the event trace classes that it uses
750 * to generate events.
752 * PARAMS
753 * RequestAddress [I] ControlCallback function
754 * RequestContext [I] Optional provider-defined context
755 * ControlGuid [I] GUID of the registering provider
756 * GuidCount [I] Number of elements in the TraceGuidReg array
757 * TraceGuidReg [I/O] Array of TRACE_GUID_REGISTRATION structures
758 * MofImagePath [I] not supported, set to NULL
759 * MofResourceName [I] not supported, set to NULL
760 * RegistrationHandle [O] Provider's registration handle
762 * RETURNS
763 * Success: ERROR_SUCCESS
764 * Failure: System error code
766 * FIXME
767 * Stub.
769 ULONG WINAPI RegisterTraceGuidsW( WMIDPREQUEST RequestAddress,
770 PVOID RequestContext, LPCGUID ControlGuid, ULONG GuidCount,
771 PTRACE_GUID_REGISTRATION TraceGuidReg, LPCWSTR MofImagePath,
772 LPCWSTR MofResourceName, PTRACEHANDLE RegistrationHandle )
774 FIXME("(%p, %p, %s, %u, %p, %s, %s, %p): stub\n", RequestAddress, RequestContext,
775 debugstr_guid(ControlGuid), GuidCount, TraceGuidReg, debugstr_w(MofImagePath),
776 debugstr_w(MofResourceName), RegistrationHandle);
777 return ERROR_SUCCESS;
780 /******************************************************************************
781 * RegisterTraceGuidsA [ADVAPI32.@]
783 * See RegisterTraceGuidsW.
785 * FIXME
786 * Stub.
788 ULONG WINAPI RegisterTraceGuidsA( WMIDPREQUEST RequestAddress,
789 PVOID RequestContext, LPCGUID ControlGuid, ULONG GuidCount,
790 PTRACE_GUID_REGISTRATION TraceGuidReg, LPCSTR MofImagePath,
791 LPCSTR MofResourceName, PTRACEHANDLE RegistrationHandle )
793 FIXME("(%p, %p, %s, %u, %p, %s, %s, %p): stub\n", RequestAddress, RequestContext,
794 debugstr_guid(ControlGuid), GuidCount, TraceGuidReg, debugstr_a(MofImagePath),
795 debugstr_a(MofResourceName), RegistrationHandle);
796 return ERROR_SUCCESS;
799 /******************************************************************************
800 * StartTraceW [ADVAPI32.@]
802 * Register and start an event trace session
805 ULONG WINAPI StartTraceW( PTRACEHANDLE pSessionHandle, LPCWSTR SessionName, PEVENT_TRACE_PROPERTIES Properties )
807 FIXME("(%p, %s, %p) stub\n", pSessionHandle, debugstr_w(SessionName), Properties);
808 if (pSessionHandle) *pSessionHandle = 0xcafe4242;
809 return ERROR_SUCCESS;
812 /******************************************************************************
813 * StartTraceA [ADVAPI32.@]
815 * See StartTraceW.
818 ULONG WINAPI StartTraceA( PTRACEHANDLE pSessionHandle, LPCSTR SessionName, PEVENT_TRACE_PROPERTIES Properties )
820 FIXME("(%p, %s, %p) stub\n", pSessionHandle, debugstr_a(SessionName), Properties);
821 if (pSessionHandle) *pSessionHandle = 0xcafe4242;
822 return ERROR_SUCCESS;
825 /******************************************************************************
826 * StopTraceW [ADVAPI32.@]
828 * Stop an event trace session
831 ULONG WINAPI StopTraceW( TRACEHANDLE session, LPCWSTR session_name, PEVENT_TRACE_PROPERTIES properties )
833 FIXME("(%s, %s, %p) stub\n", wine_dbgstr_longlong(session), debugstr_w(session_name), properties);
834 return ERROR_SUCCESS;
837 /******************************************************************************
838 * StopTraceA [ADVAPI32.@]
840 * See StopTraceW.
843 ULONG WINAPI StopTraceA( TRACEHANDLE session, LPCSTR session_name, PEVENT_TRACE_PROPERTIES properties )
845 FIXME("(%s, %s, %p) stub\n", wine_dbgstr_longlong(session), debugstr_a(session_name), properties);
846 return ERROR_SUCCESS;
849 /******************************************************************************
850 * TraceEvent [ADVAPI32.@]
852 ULONG WINAPI TraceEvent( TRACEHANDLE SessionHandle, PEVENT_TRACE_HEADER EventTrace )
854 FIXME("%s %p\n", wine_dbgstr_longlong(SessionHandle), EventTrace);
855 return ERROR_CALL_NOT_IMPLEMENTED;
858 /******************************************************************************
859 * UnregisterTraceGuids [ADVAPI32.@]
861 * See RegisterTraceGuids
863 * FIXME
864 * Stub.
866 ULONG WINAPI UnregisterTraceGuids( TRACEHANDLE RegistrationHandle )
868 FIXME("%s: stub\n", wine_dbgstr_longlong(RegistrationHandle));
869 return ERROR_CALL_NOT_IMPLEMENTED;
872 /******************************************************************************
873 * EventRegister [ADVAPI32.@]
875 ULONG WINAPI EventRegister( LPCGUID provider, PENABLECALLBACK callback, PVOID context, PREGHANDLE handle )
877 FIXME("%s, %p, %p, %p\n", debugstr_guid(provider), callback, context, handle);
879 *handle = 0xdeadbeef;
880 return ERROR_SUCCESS;
883 /******************************************************************************
884 * EventUnregister [ADVAPI32.@]
886 ULONG WINAPI EventUnregister( REGHANDLE handle )
888 FIXME("%s: stub\n", wine_dbgstr_longlong(handle));
889 return ERROR_SUCCESS;
892 /******************************************************************************
893 * EventEnabled [ADVAPI32.@]
896 BOOLEAN WINAPI EventEnabled( REGHANDLE handle, PCEVENT_DESCRIPTOR descriptor )
898 FIXME("(%s, %p): stub\n", wine_dbgstr_longlong(handle), descriptor);
899 return FALSE;
902 /******************************************************************************
903 * EventProviderEnabled [ADVAPI32.@]
906 BOOLEAN WINAPI EventProviderEnabled( REGHANDLE handle, UCHAR level, ULONGLONG keyword )
908 FIXME("%s, %u, %s: stub\n", wine_dbgstr_longlong(handle), level, wine_dbgstr_longlong(keyword));
909 return FALSE;
912 /******************************************************************************
913 * EventWrite [ADVAPI32.@]
915 ULONG WINAPI EventWrite( REGHANDLE handle, PCEVENT_DESCRIPTOR descriptor, ULONG count,
916 PEVENT_DATA_DESCRIPTOR data )
918 FIXME("%s, %p, %u, %p: stub\n", wine_dbgstr_longlong(handle), descriptor, count, data);
919 return ERROR_SUCCESS;
922 /******************************************************************************
923 * QueryTraceW [ADVAPI32.@]
925 ULONG WINAPI QueryTraceW( TRACEHANDLE handle, LPCWSTR sessionname, PEVENT_TRACE_PROPERTIES properties )
927 FIXME("%s %s %p: stub\n", wine_dbgstr_longlong(handle), debugstr_w(sessionname), properties);
928 return ERROR_CALL_NOT_IMPLEMENTED;
931 /******************************************************************************
932 * OpenTraceA [ADVAPI32.@]
934 TRACEHANDLE WINAPI OpenTraceA( PEVENT_TRACE_LOGFILEA logfile )
936 FIXME("%p: stub\n", logfile);
937 SetLastError(ERROR_ACCESS_DENIED);
938 return INVALID_PROCESSTRACE_HANDLE;
941 /******************************************************************************
942 * OpenTraceW [ADVAPI32.@]
944 TRACEHANDLE WINAPI OpenTraceW( PEVENT_TRACE_LOGFILEW logfile )
946 FIXME("%p: stub\n", logfile);
947 SetLastError(ERROR_ACCESS_DENIED);
948 return INVALID_PROCESSTRACE_HANDLE;
951 /******************************************************************************
952 * ProcessTrace [ADVAPI32.@]
954 ULONG WINAPI ProcessTrace( PTRACEHANDLE HandleArray, ULONG HandleCount, LPFILETIME StartTime, LPFILETIME EndTime)
956 FIXME("%p %u %p %p: stub\n", HandleArray, HandleCount, StartTime, EndTime);
957 return ERROR_CALL_NOT_IMPLEMENTED;
960 /******************************************************************************
961 * TraceMessage [ADVAPI32.@]
963 ULONG WINAPIV TraceMessage( TRACEHANDLE handle, ULONG flags, LPGUID guid, USHORT number, ... )
965 __ms_va_list valist;
966 ULONG ret;
968 __ms_va_start( valist, number );
969 ret = TraceMessageVa( handle, flags, guid, number, valist );
970 __ms_va_end( valist );
971 return ret;
974 /******************************************************************************
975 * TraceMessageVa [ADVAPI32.@]
977 ULONG WINAPI TraceMessageVa( TRACEHANDLE handle, ULONG flags, LPGUID guid, USHORT number,
978 __ms_va_list args )
980 FIXME("(%s %x %s %d) : stub\n", wine_dbgstr_longlong(handle), flags, debugstr_guid(guid), number);
981 return ERROR_SUCCESS;
984 /******************************************************************************
985 * CloseTrace [ADVAPI32.@]
987 ULONG WINAPI CloseTrace( TRACEHANDLE handle )
989 FIXME("%s: stub\n", wine_dbgstr_longlong(handle));
990 return ERROR_INVALID_HANDLE;
993 /******************************************************************************
994 * EnumerateTraceGuids [ADVAPI32.@]
996 ULONG WINAPI EnumerateTraceGuids(PTRACE_GUID_PROPERTIES *propertiesarray,
997 ULONG arraycount, PULONG guidcount)
999 FIXME("%p %d %p: stub\n", propertiesarray, arraycount, guidcount);
1000 return ERROR_INVALID_PARAMETER;