Commit 2ea3dc43 authored by Mike Hearn's avatar Mike Hearn Committed by Alexandre Julliard

Implemented ReportEventA/W.

parent 4f21b3cd
/* /*
* Win32 advapi functions * Win32 advapi functions
* *
* Copyright 1995 Sven Verdoolaege, 1998 Juergen Schmied * Copyright 1995 Sven Verdoolaege
* Copyright 1998 Juergen Schmied
* Copyright 2003 Mike Hearn
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
...@@ -29,6 +31,7 @@ ...@@ -29,6 +31,7 @@
#include "wine/debug.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(advapi); WINE_DEFAULT_DEBUG_CHANNEL(advapi);
WINE_DECLARE_DEBUG_CHANNEL(eventlog);
/****************************************************************************** /******************************************************************************
* BackupEventLogA [ADVAPI32.@] * BackupEventLogA [ADVAPI32.@]
...@@ -257,8 +260,28 @@ RegisterEventSourceW( LPCWSTR lpUNCServerName, LPCWSTR lpSourceName ) ...@@ -257,8 +260,28 @@ RegisterEventSourceW( LPCWSTR lpUNCServerName, LPCWSTR lpSourceName )
BOOL WINAPI ReportEventA ( HANDLE hEventLog, WORD wType, WORD wCategory, DWORD dwEventID, BOOL WINAPI ReportEventA ( HANDLE hEventLog, WORD wType, WORD wCategory, DWORD dwEventID,
PSID lpUserSid, WORD wNumStrings, DWORD dwDataSize, LPCSTR *lpStrings, LPVOID lpRawData) PSID lpUserSid, WORD wNumStrings, DWORD dwDataSize, LPCSTR *lpStrings, LPVOID lpRawData)
{ {
FIXME("stub\n"); LPCWSTR *wideStrArray;
return TRUE; UNICODE_STRING str;
int i;
BOOL ret;
if (wNumStrings == 0) return TRUE;
if (!lpStrings) return TRUE;
wideStrArray = HeapAlloc(GetProcessHeap(), 0, sizeof(LPCWSTR) * wNumStrings);
for (i = 0; i < wNumStrings; i++)
{
RtlCreateUnicodeStringFromAsciiz(&str, lpStrings[i]);
wideStrArray[i] = str.Buffer;
}
ret = ReportEventW(hEventLog, wType, wCategory, dwEventID, lpUserSid,
wNumStrings, dwDataSize, wideStrArray, lpRawData);
for (i = 0; i < wNumStrings; i++)
{
if (wideStrArray[i]) HeapFree( GetProcessHeap(), 0, (LPSTR)wideStrArray[i] );
}
HeapFree(GetProcessHeap(), 0, wideStrArray);
return ret;
} }
/****************************************************************************** /******************************************************************************
...@@ -280,6 +303,31 @@ ReportEventW( HANDLE hEventLog, WORD wType, WORD wCategory, ...@@ -280,6 +303,31 @@ ReportEventW( HANDLE hEventLog, WORD wType, WORD wCategory,
DWORD dwEventID, PSID lpUserSid, WORD wNumStrings, DWORD dwEventID, PSID lpUserSid, WORD wNumStrings,
DWORD dwDataSize, LPCWSTR *lpStrings, LPVOID lpRawData ) DWORD dwDataSize, LPCWSTR *lpStrings, LPVOID lpRawData )
{ {
FIXME("stub\n"); int i;
/* partial stub */
if (wNumStrings == 0) return TRUE;
if (!lpStrings) return TRUE;
for (i = 0; i < wNumStrings; i++)
{
switch (wType)
{
case EVENTLOG_SUCCESS:
TRACE_(eventlog)("%s\n", debugstr_w(lpStrings[i]));
break;
case EVENTLOG_ERROR_TYPE:
ERR_(eventlog)("%s\n", debugstr_w(lpStrings[i]));
break;
case EVENTLOG_WARNING_TYPE:
WARN_(eventlog)("%s\n", debugstr_w(lpStrings[i]));
break;
default:
TRACE_(eventlog)("%s\n", debugstr_w(lpStrings[i]));
break;
}
}
return TRUE; return TRUE;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment