>From a2a0cb0e8eff17583a4ac1381a22b45b9279273a Mon Sep 17 00:00:00 2001 From: Paul Vriens Date: Wed, 28 Oct 2009 10:07:18 +0100 Subject: [PATCH 3/3] Add a stubbed GetEventLogInformation with input param checking --- dlls/advapi32/advapi32.spec | 2 +- dlls/advapi32/eventlog.c | 58 ++++++++++++++++++++++++++++++++++++++++ dlls/advapi32/tests/eventlog.c | 2 +- 3 files changed, 60 insertions(+), 2 deletions(-) diff --git a/dlls/advapi32/advapi32.spec b/dlls/advapi32/advapi32.spec index 058760d..806cecf 100644 --- a/dlls/advapi32/advapi32.spec +++ b/dlls/advapi32/advapi32.spec @@ -236,7 +236,7 @@ @ stdcall GetCurrentHwProfileW(ptr) @ stdcall GetEffectiveRightsFromAclA(ptr ptr ptr) @ stdcall GetEffectiveRightsFromAclW(ptr ptr ptr) -# @ stub GetEventLogInformation +@ stdcall GetEventLogInformation(long long ptr long ptr) @ stdcall GetExplicitEntriesFromAclA(ptr ptr ptr) @ stdcall GetExplicitEntriesFromAclW(ptr ptr ptr) @ stdcall GetFileSecurityA(str long ptr long ptr) diff --git a/dlls/advapi32/eventlog.c b/dlls/advapi32/eventlog.c index 1074ccc..e646967 100644 --- a/dlls/advapi32/eventlog.c +++ b/dlls/advapi32/eventlog.c @@ -190,6 +190,64 @@ ULONG WINAPI EnableTrace( ULONG enable, ULONG flag, ULONG level, LPCGUID guid, T } /****************************************************************************** + * GetEventLogInformation [ADVAPI32.@] + * + * Retrieve some information about an event log. + * + * PARAMS + * hEventLog [I] Handle to an open event log. + * dwInfoLevel [I] Level of information (only EVENTLOG_FULL_INFO) + * lpBuffer [I/O] The buffer for the returned information + * cbBufSize [I] The size of the buffer + * pcbBytesNeeded [O] The needed bytes to hold the information + * + * RETURNS + * Success: TRUE. lpBuffer will hold the information and pcbBytesNeeded shows + * the needed buffer size. + * Failure: FALSE. + */ +BOOL WINAPI GetEventLogInformation( HANDLE hEventLog, DWORD dwInfoLevel, LPVOID lpBuffer, DWORD cbBufSize, LPDWORD pcbBytesNeeded) +{ + EVENTLOG_FULL_INFORMATION *efi; + + FIXME("(%p, %d, %p, %d, %p) stub\n", hEventLog, dwInfoLevel, lpBuffer, cbBufSize, pcbBytesNeeded); + + if (dwInfoLevel != EVENTLOG_FULL_INFO) + { + SetLastError(ERROR_INVALID_LEVEL); + return FALSE; + } + + if (!hEventLog) + { + SetLastError(ERROR_INVALID_HANDLE); + return FALSE; + } + + if (!lpBuffer || !pcbBytesNeeded) + { + /* FIXME: This will be handled properly when eventlog is moved + * to a higher level + */ + SetLastError(RPC_X_NULL_REF_POINTER); + return FALSE; + } + + *pcbBytesNeeded = sizeof(EVENTLOG_FULL_INFORMATION); + if (cbBufSize < sizeof(EVENTLOG_FULL_INFORMATION)) + { + SetLastError(ERROR_INSUFFICIENT_BUFFER); + return FALSE; + } + + /* Pretend the log is not full */ + efi = (EVENTLOG_FULL_INFORMATION *)lpBuffer; + efi->dwFull = 0; + + return TRUE; +} + +/****************************************************************************** * GetNumberOfEventLogRecords [ADVAPI32.@] * * Retrieves the number of records in an event log. diff --git a/dlls/advapi32/tests/eventlog.c b/dlls/advapi32/tests/eventlog.c index 51d798b..628b08c 100644 --- a/dlls/advapi32/tests/eventlog.c +++ b/dlls/advapi32/tests/eventlog.c @@ -99,7 +99,7 @@ static void test_info(void) if (!pGetEventLogInformation) { /* NT4 */ - skip("GetEventLogInformation is not available\n"); + win_skip("GetEventLogInformation is not available\n"); return; } SetLastError(0xdeadbeef); -- 1.6.2.5