1 /*
2 * Win32 advapi functions
3 *
4 * Copyright 1995 Sven Verdoolaege
5 * Copyright 1998 Juergen Schmied
6 * Copyright 2003 Mike Hearn
7 *
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.
12 *
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.
17 *
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
21 */
22
23 #include <stdarg.h>
24
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
32 #include "wine/unicode.h"
33 #include "wine/debug.h"
34
35 WINE_DEFAULT_DEBUG_CHANNEL(advapi);
36 WINE_DECLARE_DEBUG_CHANNEL(eventlog);
37
38 static inline LPWSTR SERV_dup( LPCSTR str )
39 {
40 UINT len;
41 LPWSTR wstr;
42
43 if( !str )
44 return NULL;
45 len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 );
46 wstr = HeapAlloc( GetProcessHeap(), 0, len*sizeof (WCHAR) );
47 MultiByteToWideChar( CP_ACP, 0, str, -1, wstr, len );
48 return wstr;
49 }
50
51 /******************************************************************************
52 * BackupEventLogA [ADVAPI32.@]
53 *
54 * Saves the event log to a backup file.
55 *
56 * PARAMS
57 * hEventLog [I] Handle to event log to backup.
58 * lpBackupFileName [I] Name of the backup file.
59 *
60 * RETURNS
61 * Success: nonzero. File lpBackupFileName will contain the contents of
62 * hEvenLog.
63 * Failure: zero.
64 */
65 BOOL WINAPI BackupEventLogA( HANDLE hEventLog, LPCSTR lpBackupFileName )
66 {
67 LPWSTR backupW;
68 BOOL ret;
69
70 backupW = SERV_dup(lpBackupFileName);
71 ret = BackupEventLogW(hEventLog, backupW);
72 HeapFree(GetProcessHeap(), 0, backupW);
73
74 return ret;
75 }
76
77 /******************************************************************************
78 * BackupEventLogW [ADVAPI32.@]
79 *
80 * See BackupEventLogA.
81 */
82 BOOL WINAPI BackupEventLogW( HANDLE hEventLog, LPCWSTR lpBackupFileName )
83 {
84 FIXME("(%p,%s) stub\n", hEventLog, debugstr_w(lpBackupFileName));
85
86 if (!lpBackupFileName)
87 {
88 SetLastError(ERROR_INVALID_PARAMETER);
89 return FALSE;
90 }
91
92 if (!hEventLog)
93 {
94 SetLastError(ERROR_INVALID_HANDLE);
95 return FALSE;
96 }
97
98 if (GetFileAttributesW(lpBackupFileName) != INVALID_FILE_ATTRIBUTES)
99 {
100 SetLastError(ERROR_ALREADY_EXISTS);
101 return FALSE;
102 }
103
104 return TRUE;
105 }
106
107 /******************************************************************************
108 * ClearEventLogA [ADVAPI32.@]
109 *
110 * Clears the event log and optionally saves the log to a backup file.
111 *
112 * PARAMS
113 * hEvenLog [I] Handle to event log to clear.
114 * lpBackupFileName [I] Name of the backup file.
115 *
116 * RETURNS
117 * Success: nonzero. if lpBackupFileName != NULL, lpBackupFileName will
118 * contain the contents of hEvenLog and the log will be cleared.
119 * Failure: zero. Fails if the event log is empty or if lpBackupFileName
120 * exists.
121 */
122 BOOL WINAPI ClearEventLogA( HANDLE hEventLog, LPCSTR lpBackupFileName )
123 {
124 LPWSTR backupW;
125 BOOL ret;
126
127 backupW = SERV_dup(lpBackupFileName);
128 ret = ClearEventLogW(hEventLog, backupW);
129 HeapFree(GetProcessHeap(), 0, backupW);
130
131 return ret;
132 }
133
134 /******************************************************************************
135 * ClearEventLogW [ADVAPI32.@]
136 *
137 * See ClearEventLogA.
138 */
139 BOOL WINAPI ClearEventLogW( HANDLE hEventLog, LPCWSTR lpBackupFileName )
140 {
141 FIXME("(%p,%s) stub\n", hEventLog, debugstr_w(lpBackupFileName));
142
143 if (!hEventLog)
144 {
145 SetLastError(ERROR_INVALID_HANDLE);
146 return FALSE;
147 }
148
149 return TRUE;
150 }
151
152 /******************************************************************************
153 * CloseEventLog [ADVAPI32.@]
154 *
155 * Closes a read handle to the event log.
156 *
157 * PARAMS
158 * hEventLog [I/O] Handle of the event log to close.
159 *
160 * RETURNS
161 * Success: nonzero
162 * Failure: zero
163 */
164 BOOL WINAPI CloseEventLog( HANDLE hEventLog )
165 {
166 FIXME("(%p) stub\n", hEventLog);
167
168 if (!hEventLog)
169 {
170 SetLastError(ERROR_INVALID_HANDLE);
171 return FALSE;
172 }
173
174 return TRUE;
175 }
176
177 /******************************************************************************
178 * ControlTraceW [ADVAPI32.@]
179 *
180 * Control a givel event trace session
181 *
182 */
183 ULONG WINAPI ControlTraceW( TRACEHANDLE hSession, LPCWSTR SessionName, PEVENT_TRACE_PROPERTIES Properties, ULONG control )
184 {
185 FIXME("(%s, %s, %p, %d) stub\n", wine_dbgstr_longlong(hSession), debugstr_w(SessionName), Properties, control);
186 return ERROR_SUCCESS;
187 }
188
189 /******************************************************************************
190 * ControlTraceA [ADVAPI32.@]
191 *
192 * See ControlTraceW.
193 *
194 */
195 ULONG WINAPI ControlTraceA( TRACEHANDLE hSession, LPCSTR SessionName, PEVENT_TRACE_PROPERTIES Properties, ULONG control )
196 {
197 FIXME("(%s, %s, %p, %d) stub\n", wine_dbgstr_longlong(hSession), debugstr_a(SessionName), Properties, control);
198 return ERROR_SUCCESS;
199 }
200
201 /******************************************************************************
202 * DeregisterEventSource [ADVAPI32.@]
203 *
204 * Closes a write handle to an event log
205 *
206 * PARAMS
207 * hEventLog [I/O] Handle of the event log.
208 *
209 * RETURNS
210 * Success: nonzero
211 * Failure: zero
212 */
213 BOOL WINAPI DeregisterEventSource( HANDLE hEventLog )
214 {
215 FIXME("(%p) stub\n", hEventLog);
216 return TRUE;
217 }
218
219 /******************************************************************************
220 * EnableTrace [ADVAPI32.@]
221 */
222 ULONG WINAPI EnableTrace( ULONG enable, ULONG flag, ULONG level, LPCGUID guid, TRACEHANDLE hSession )
223 {
224 FIXME("(%d, 0x%x, %d, %s, %s): stub\n", enable, flag, level,
225 debugstr_guid(guid), wine_dbgstr_longlong(hSession));
226
227 return ERROR_SUCCESS;
228 }
229
230 /******************************************************************************
231 * GetEventLogInformation [ADVAPI32.@]
232 *
233 * Retrieve some information about an event log.
234 *
235 * PARAMS
236 * hEventLog [I] Handle to an open event log.
237 * dwInfoLevel [I] Level of information (only EVENTLOG_FULL_INFO)
238 * lpBuffer [I/O] The buffer for the returned information
239 * cbBufSize [I] The size of the buffer
240 * pcbBytesNeeded [O] The needed bytes to hold the information
241 *
242 * RETURNS
243 * Success: TRUE. lpBuffer will hold the information and pcbBytesNeeded shows
244 * the needed buffer size.
245 * Failure: FALSE.
246 */
247 BOOL WINAPI GetEventLogInformation( HANDLE hEventLog, DWORD dwInfoLevel, LPVOID lpBuffer, DWORD cbBufSize, LPDWORD pcbBytesNeeded)
248 {
249 EVENTLOG_FULL_INFORMATION *efi;
250
251 FIXME("(%p, %d, %p, %d, %p) stub\n", hEventLog, dwInfoLevel, lpBuffer, cbBufSize, pcbBytesNeeded);
252
253 if (dwInfoLevel != EVENTLOG_FULL_INFO)
254 {
255 SetLastError(ERROR_INVALID_LEVEL);
256 return FALSE;
257 }
258
259 if (!hEventLog)
260 {
261 SetLastError(ERROR_INVALID_HANDLE);
262 return FALSE;
263 }
264
265 if (!lpBuffer || !pcbBytesNeeded)
266 {
267 /* FIXME: This will be handled properly when eventlog is moved
268 * to a higher level
269 */
270 SetLastError(RPC_X_NULL_REF_POINTER);
271 return FALSE;
272 }
273
274 *pcbBytesNeeded = sizeof(EVENTLOG_FULL_INFORMATION);
275 if (cbBufSize < sizeof(EVENTLOG_FULL_INFORMATION))
276 {
277 SetLastError(ERROR_INSUFFICIENT_BUFFER);
278 return FALSE;
279 }
280
281 /* Pretend the log is not full */
282 efi = (EVENTLOG_FULL_INFORMATION *)lpBuffer;
283 efi->dwFull = 0;
284
285 return TRUE;
286 }
287
288 /******************************************************************************
289 * GetNumberOfEventLogRecords [ADVAPI32.@]
290 *
291 * Retrieves the number of records in an event log.
292 *
293 * PARAMS
294 * hEventLog [I] Handle to an open event log.
295 * NumberOfRecords [O] Number of records in the log.
296 *
297 * RETURNS
298 * Success: nonzero. NumberOfRecords will contain the number of records in
299 * the log.
300 * Failure: zero
301 */
302 BOOL WINAPI GetNumberOfEventLogRecords( HANDLE hEventLog, PDWORD NumberOfRecords )
303 {
304 FIXME("(%p,%p) stub\n", hEventLog, NumberOfRecords);
305
306 if (!NumberOfRecords)
307 {
308 SetLastError(ERROR_INVALID_PARAMETER);
309 return FALSE;
310 }
311
312 if (!hEventLog)
313 {
314 SetLastError(ERROR_INVALID_HANDLE);
315 return FALSE;
316 }
317
318 *NumberOfRecords = 0;
319
320 return TRUE;
321 }
322
323 /******************************************************************************
324 * GetOldestEventLogRecord [ADVAPI32.@]
325 *
326 * Retrieves the absolute record number of the oldest record in an even log.
327 *
328 * PARAMS
329 * hEventLog [I] Handle to an open event log.
330 * OldestRecord [O] Absolute record number of the oldest record.
331 *
332 * RETURNS
333 * Success: nonzero. OldestRecord contains the record number of the oldest
334 * record in the log.
335 * Failure: zero
336 */
337 BOOL WINAPI GetOldestEventLogRecord( HANDLE hEventLog, PDWORD OldestRecord )
338 {
339 FIXME("(%p,%p) stub\n", hEventLog, OldestRecord);
340
341 if (!OldestRecord)
342 {
343 SetLastError(ERROR_INVALID_PARAMETER);
344 return FALSE;
345 }
346
347 if (!hEventLog)
348 {
349 SetLastError(ERROR_INVALID_HANDLE);
350 return FALSE;
351 }
352
353 *OldestRecord = 0;
354
355 return TRUE;
356 }
357
358 /******************************************************************************
359 * NotifyChangeEventLog [ADVAPI32.@]
360 *
361 * Enables an application to receive notification when an event is written
362 * to an event log.
363 *
364 * PARAMS
365 * hEventLog [I] Handle to an event log.
366 * hEvent [I] Handle to a manual-reset event object.
367 *
368 * RETURNS
369 * Success: nonzero
370 * Failure: zero
371 */
372 BOOL WINAPI NotifyChangeEventLog( HANDLE hEventLog, HANDLE hEvent )
373 {
374 FIXME("(%p,%p) stub\n", hEventLog, hEvent);
375 return TRUE;
376 }
377
378 /******************************************************************************
379 * OpenBackupEventLogA [ADVAPI32.@]
380 *
381 * Opens a handle to a backup event log.
382 *
383 * PARAMS
384 * lpUNCServerName [I] Universal Naming Convention name of the server on which
385 * this will be performed.
386 * lpFileName [I] Specifies the name of the backup file.
387 *
388 * RETURNS
389 * Success: Handle to the backup event log.
390 * Failure: NULL
391 */
392 HANDLE WINAPI OpenBackupEventLogA( LPCSTR lpUNCServerName, LPCSTR lpFileName )
393 {
394 LPWSTR uncnameW, filenameW;
395 HANDLE handle;
396
397 uncnameW = SERV_dup(lpUNCServerName);
398 filenameW = SERV_dup(lpFileName);
399 handle = OpenBackupEventLogW(uncnameW, filenameW);
400 HeapFree(GetProcessHeap(), 0, uncnameW);
401 HeapFree(GetProcessHeap(), 0, filenameW);
402
403 return handle;
404 }
405
406 /******************************************************************************
407 * OpenBackupEventLogW [ADVAPI32.@]
408 *
409 * See OpenBackupEventLogA.
410 */
411 HANDLE WINAPI OpenBackupEventLogW( LPCWSTR lpUNCServerName, LPCWSTR lpFileName )
412 {
413 FIXME("(%s,%s) stub\n", debugstr_w(lpUNCServerName), debugstr_w(lpFileName));
414
415 if (!lpFileName)
416 {
417 SetLastError(ERROR_INVALID_PARAMETER);
418 return NULL;
419 }
420
421 if (lpUNCServerName && lpUNCServerName[0])
422 {
423 FIXME("Remote server not supported\n");
424 SetLastError(RPC_S_SERVER_UNAVAILABLE);
425 return NULL;
426 }
427
428 if (GetFileAttributesW(lpFileName) == INVALID_FILE_ATTRIBUTES)
429 {
430 SetLastError(ERROR_FILE_NOT_FOUND);
431 return NULL;
432 }
433
434 return (HANDLE)0xcafe4242;
435 }
436
437 /******************************************************************************
438 * OpenEventLogA [ADVAPI32.@]
439 *
440 * Opens a handle to the specified event log.
441 *
442 * PARAMS
443 * lpUNCServerName [I] UNC name of the server on which the event log is
444 * opened.
445 * lpSourceName [I] Name of the log.
446 *
447 * RETURNS
448 * Success: Handle to an event log.
449 * Failure: NULL
450 */
451 HANDLE WINAPI OpenEventLogA( LPCSTR uncname, LPCSTR source )
452 {
453 LPWSTR uncnameW, sourceW;
454 HANDLE handle;
455
456 uncnameW = SERV_dup(uncname);
457 sourceW = SERV_dup(source);
458 handle = OpenEventLogW(uncnameW, sourceW);
459 HeapFree(GetProcessHeap(), 0, uncnameW);
460 HeapFree(GetProcessHeap(), 0, sourceW);
461
462 return handle;
463 }
464
465 /******************************************************************************
466 * OpenEventLogW [ADVAPI32.@]
467 *
468 * See OpenEventLogA.
469 */
470 HANDLE WINAPI OpenEventLogW( LPCWSTR uncname, LPCWSTR source )
471 {
472 FIXME("(%s,%s) stub\n", debugstr_w(uncname), debugstr_w(source));
473
474 if (!source)
475 {
476 SetLastError(ERROR_INVALID_PARAMETER);
477 return NULL;
478 }
479
480 if (uncname && uncname[0])
481 {
482 FIXME("Remote server not supported\n");
483 SetLastError(RPC_S_SERVER_UNAVAILABLE);
484 return NULL;
485 }
486
487 return (HANDLE)0xcafe4242;
488 }
489
490 /******************************************************************************
491 * QueryAllTracesW [ADVAPI32.@]
492 *
493 * Query information for started event trace sessions
494 *
495 */
496 ULONG WINAPI QueryAllTracesW( PEVENT_TRACE_PROPERTIES * parray, ULONG arraycount, PULONG psessioncount )
497 {
498 FIXME("(%p, %d, %p) stub\n", parray, arraycount, psessioncount);
499
500 if (psessioncount) *psessioncount = 0;
501 return ERROR_SUCCESS;
502 }
503
504 /******************************************************************************
505 * QueryAllTracesA [ADVAPI32.@]
506 *
507 * See QueryAllTracesW.
508 */
509 ULONG WINAPI QueryAllTracesA( PEVENT_TRACE_PROPERTIES * parray, ULONG arraycount, PULONG psessioncount )
510 {
511 FIXME("(%p, %d, %p) stub\n", parray, arraycount, psessioncount);
512
513 if (psessioncount) *psessioncount = 0;
514 return ERROR_SUCCESS;
515 }
516
517 /******************************************************************************
518 * ReadEventLogA [ADVAPI32.@]
519 *
520 * Reads a whole number of entries from an event log.
521 *
522 * PARAMS
523 * hEventLog [I] Handle of the event log to read.
524 * dwReadFlags [I] see MSDN doc.
525 * dwRecordOffset [I] Log-entry record number to start at.
526 * lpBuffer [O] Buffer for the data read.
527 * nNumberOfBytesToRead [I] Size of lpBuffer.
528 * pnBytesRead [O] Receives number of bytes read.
529 * pnMinNumberOfBytesNeeded [O] Receives number of bytes required for the
530 * next log entry.
531 *
532 * RETURNS
533 * Success: nonzero
534 * Failure: zero
535 */
536 BOOL WINAPI ReadEventLogA( HANDLE hEventLog, DWORD dwReadFlags, DWORD dwRecordOffset,
537 LPVOID lpBuffer, DWORD nNumberOfBytesToRead, DWORD *pnBytesRead, DWORD *pnMinNumberOfBytesNeeded )
538 {
539 FIXME("(%p,0x%08x,0x%08x,%p,0x%08x,%p,%p) stub\n", hEventLog, dwReadFlags,
540 dwRecordOffset, lpBuffer, nNumberOfBytesToRead, pnBytesRead, pnMinNumberOfBytesNeeded);
541 return FALSE;
542 }
543
544 /******************************************************************************
545 * ReadEventLogW [ADVAPI32.@]
546 *
547 * See ReadEventLogA.
548 */
549 BOOL WINAPI ReadEventLogW( HANDLE hEventLog, DWORD dwReadFlags, DWORD dwRecordOffset,
550 LPVOID lpBuffer, DWORD nNumberOfBytesToRead, DWORD *pnBytesRead, DWORD *pnMinNumberOfBytesNeeded )
551 {
552 FIXME("(%p,0x%08x,0x%08x,%p,0x%08x,%p,%p) stub\n", hEventLog, dwReadFlags,
553 dwRecordOffset, lpBuffer, nNumberOfBytesToRead, pnBytesRead, pnMinNumberOfBytesNeeded);
554 return FALSE;
555 }
556
557 /******************************************************************************
558 * RegisterEventSourceA [ADVAPI32.@]
559 *
560 * Returns a registered handle to an event log.
561 *
562 * PARAMS
563 * lpUNCServerName [I] UNC name of the source server.
564 * lpSourceName [I] Specifies the name of the event source to retrieve.
565 *
566 * RETURNS
567 * Success: Handle to the event log.
568 * Failure: NULL. Returns ERROR_INVALID_HANDLE if lpSourceName specifies the
569 * Security event log.
570 */
571 HANDLE WINAPI RegisterEventSourceA( LPCSTR lpUNCServerName, LPCSTR lpSourceName )
572 {
573 UNICODE_STRING lpUNCServerNameW;
574 UNICODE_STRING lpSourceNameW;
575 HANDLE ret;
576
577 FIXME("(%s,%s): stub\n", debugstr_a(lpUNCServerName), debugstr_a(lpSourceName));
578
579 RtlCreateUnicodeStringFromAsciiz(&lpUNCServerNameW, lpUNCServerName);
580 RtlCreateUnicodeStringFromAsciiz(&lpSourceNameW, lpSourceName);
581 ret = RegisterEventSourceW(lpUNCServerNameW.Buffer,lpSourceNameW.Buffer);
582 RtlFreeUnicodeString (&lpUNCServerNameW);
583 RtlFreeUnicodeString (&lpSourceNameW);
584 return ret;
585 }
586
587 /******************************************************************************
588 * RegisterEventSourceW [ADVAPI32.@]
589 *
590 * See RegisterEventSourceA.
591 */
592 HANDLE WINAPI RegisterEventSourceW( LPCWSTR lpUNCServerName, LPCWSTR lpSourceName )
593 {
594 FIXME("(%s,%s): stub\n", debugstr_w(lpUNCServerName), debugstr_w(lpSourceName));
595 return (HANDLE)0xcafe4242;
596 }
597
598 /******************************************************************************
599 * ReportEventA [ADVAPI32.@]
600 *
601 * Writes an entry at the end of an event log.
602 *
603 * PARAMS
604 * hEventLog [I] Handle of an event log.
605 * wType [I] See MSDN doc.
606 * wCategory [I] Event category.
607 * dwEventID [I] Event identifier.
608 * lpUserSid [I] Current user's security identifier.
609 * wNumStrings [I] Number of insert strings in lpStrings.
610 * dwDataSize [I] Size of event-specific raw data to write.
611 * lpStrings [I] Buffer containing an array of string to be merged.
612 * lpRawData [I] Buffer containing the binary data.
613 *
614 * RETURNS
615 * Success: nonzero. Entry was written to the log.
616 * Failure: zero.
617 *
618 * NOTES
619 * The ReportEvent function adds the time, the entry's length, and the
620 * offsets before storing the entry in the log. If lpUserSid != NULL, the
621 * username is also logged.
622 */
623 BOOL WINAPI ReportEventA ( HANDLE hEventLog, WORD wType, WORD wCategory, DWORD dwEventID,
624 PSID lpUserSid, WORD wNumStrings, DWORD dwDataSize, LPCSTR *lpStrings, LPVOID lpRawData)
625 {
626 LPWSTR *wideStrArray;
627 UNICODE_STRING str;
628 int i;
629 BOOL ret;
630
631 FIXME("(%p,0x%04x,0x%04x,0x%08x,%p,0x%04x,0x%08x,%p,%p): stub\n", hEventLog,
632 wType, wCategory, dwEventID, lpUserSid, wNumStrings, dwDataSize, lpStrings, lpRawData);
633
634 if (wNumStrings == 0) return TRUE;
635 if (!lpStrings) return TRUE;
636
637 wideStrArray = HeapAlloc(GetProcessHeap(), 0, sizeof(LPWSTR) * wNumStrings);
638 for (i = 0; i < wNumStrings; i++)
639 {
640 RtlCreateUnicodeStringFromAsciiz(&str, lpStrings[i]);
641 wideStrArray[i] = str.Buffer;
642 }
643 ret = ReportEventW(hEventLog, wType, wCategory, dwEventID, lpUserSid,
644 wNumStrings, dwDataSize, (LPCWSTR *)wideStrArray, lpRawData);
645 for (i = 0; i < wNumStrings; i++)
646 {
647 HeapFree( GetProcessHeap(), 0, wideStrArray[i] );
648 }
649 HeapFree(GetProcessHeap(), 0, wideStrArray);
650 return ret;
651 }
652
653 /******************************************************************************
654 * ReportEventW [ADVAPI32.@]
655 *
656 * See ReportEventA.
657 */
658 BOOL WINAPI ReportEventW( HANDLE hEventLog, WORD wType, WORD wCategory, DWORD dwEventID,
659 PSID lpUserSid, WORD wNumStrings, DWORD dwDataSize, LPCWSTR *lpStrings, LPVOID lpRawData )
660 {
661 int i;
662
663 FIXME("(%p,0x%04x,0x%04x,0x%08x,%p,0x%04x,0x%08x,%p,%p): stub\n", hEventLog,
664 wType, wCategory, dwEventID, lpUserSid, wNumStrings, dwDataSize, lpStrings, lpRawData);
665
666 /* partial stub */
667
668 if (wNumStrings == 0) return TRUE;
669 if (!lpStrings) return TRUE;
670
671 for (i = 0; i < wNumStrings; i++)
672 {
673 switch (wType)
674 {
675 case EVENTLOG_SUCCESS:
676 TRACE_(eventlog)("%s\n", debugstr_w(lpStrings[i]));
677 break;
678 case EVENTLOG_ERROR_TYPE:
679 ERR_(eventlog)("%s\n", debugstr_w(lpStrings[i]));
680 break;
681 case EVENTLOG_WARNING_TYPE:
682 WARN_(eventlog)("%s\n", debugstr_w(lpStrings[i]));
683 break;
684 default:
685 TRACE_(eventlog)("%s\n", debugstr_w(lpStrings[i]));
686 break;
687 }
688 }
689 return TRUE;
690 }
691
692 /******************************************************************************
693 * RegisterTraceGuidsW [ADVAPI32.@]
694 *
695 * Register an event trace provider and the event trace classes that it uses
696 * to generate events.
697 *
698 * PARAMS
699 * RequestAddress [I] ControlCallback function
700 * RequestContext [I] Optional provider-defined context
701 * ControlGuid [I] GUID of the registering provider
702 * GuidCount [I] Number of elements in the TraceGuidReg array
703 * TraceGuidReg [I/O] Array of TRACE_GUID_REGISTRATION structures
704 * MofImagePath [I] not supported, set to NULL
705 * MofResourceNmae [I] not supported, set to NULL
706 * RegistrationHandle [O] Provider's registration handle
707 *
708 * RETURNS
709 * Success: ERROR_SUCCESS
710 * Failure: System error code
711 *
712 * FIXME
713 * Stub.
714 */
715 ULONG WINAPI RegisterTraceGuidsW( WMIDPREQUEST RequestAddress,
716 PVOID RequestContext, LPCGUID ControlGuid, ULONG GuidCount,
717 PTRACE_GUID_REGISTRATION TraceGuidReg, LPCWSTR MofImagePath,
718 LPCWSTR MofResourceName, PTRACEHANDLE RegistrationHandle )
719 {
720 FIXME("%p %p %p %u %p %s %s %p\n", RequestAddress, RequestContext,
721 ControlGuid, GuidCount, TraceGuidReg, debugstr_w(MofImagePath),
722 debugstr_w(MofResourceName), RegistrationHandle);
723 return ERROR_CALL_NOT_IMPLEMENTED;
724 }
725
726 /******************************************************************************
727 * RegisterTraceGuidsA [ADVAPI32.@]
728 *
729 * See RegisterTraceGuidsW.
730 *
731 * FIXME
732 * Stub.
733 */
734 ULONG WINAPI RegisterTraceGuidsA( WMIDPREQUEST RequestAddress,
735 PVOID RequestContext, LPCGUID ControlGuid, ULONG GuidCount,
736 PTRACE_GUID_REGISTRATION TraceGuidReg, LPCSTR MofImagePath,
737 LPCSTR MofResourceName, PTRACEHANDLE RegistrationHandle )
738 {
739 FIXME("%p %p %p %u %p %s %s %p\n", RequestAddress, RequestContext,
740 ControlGuid, GuidCount, TraceGuidReg, debugstr_a(MofImagePath),
741 debugstr_a(MofResourceName), RegistrationHandle);
742 return ERROR_CALL_NOT_IMPLEMENTED;
743 }
744
745 /******************************************************************************
746 * StartTraceW [ADVAPI32.@]
747 *
748 * Register and start an event trace session
749 *
750 */
751 ULONG WINAPI StartTraceW( PTRACEHANDLE pSessionHandle, LPCWSTR SessionName, PEVENT_TRACE_PROPERTIES Properties )
752 {
753 FIXME("(%p, %s, %p) stub\n", pSessionHandle, debugstr_w(SessionName), Properties);
754 if (pSessionHandle) *pSessionHandle = 0xcafe4242;
755 return ERROR_SUCCESS;
756 }
757
758 /******************************************************************************
759 * StartTraceA [ADVAPI32.@]
760 *
761 * See StartTraceW.
762 *
763 */
764 ULONG WINAPI StartTraceA( PTRACEHANDLE pSessionHandle, LPCSTR SessionName, PEVENT_TRACE_PROPERTIES Properties )
765 {
766 FIXME("(%p, %s, %p) stub\n", pSessionHandle, debugstr_a(SessionName), Properties);
767 if (pSessionHandle) *pSessionHandle = 0xcafe4242;
768 return ERROR_SUCCESS;
769 }
770
771 /******************************************************************************
772 * TraceEvent [ADVAPI32.@]
773 */
774 ULONG WINAPI TraceEvent( TRACEHANDLE SessionHandle, PEVENT_TRACE_HEADER EventTrace )
775 {
776 FIXME("%s %p\n", wine_dbgstr_longlong(SessionHandle), EventTrace);
777 return ERROR_CALL_NOT_IMPLEMENTED;
778 }
779
780 /******************************************************************************
781 * UnregisterTraceGuids [ADVAPI32.@]
782 *
783 * See RegisterTraceGuids
784 *
785 * FIXME
786 * Stub.
787 */
788 ULONG WINAPI UnregisterTraceGuids( TRACEHANDLE RegistrationHandle )
789 {
790 FIXME("%s: stub\n", wine_dbgstr_longlong(RegistrationHandle));
791 return ERROR_CALL_NOT_IMPLEMENTED;
792 }
793
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.