Module: wine Branch: master Commit: 78452960bc0ee057b74a8e48ffd2c5cc527e295d URL: http://source.winehq.org/git/wine.git/?a=commit;h=78452960bc0ee057b74a8e48ff...
Author: Paul Vriens Paul.Vriens.Wine@gmail.com Date: Thu Oct 29 09:25:07 2009 +0100
advapi32: Add some input parameter checks to GetOldestEventLogRecord.
---
dlls/advapi32/eventlog.c | 13 ++++++++++++- dlls/advapi32/tests/eventlog.c | 5 ----- 2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/dlls/advapi32/eventlog.c b/dlls/advapi32/eventlog.c index 6812cdd..8ce255a 100644 --- a/dlls/advapi32/eventlog.c +++ b/dlls/advapi32/eventlog.c @@ -300,7 +300,18 @@ BOOL WINAPI GetOldestEventLogRecord( HANDLE hEventLog, PDWORD OldestRecord ) { FIXME("(%p,%p) stub\n", hEventLog, OldestRecord);
- if (!OldestRecord) return FALSE; + if (!OldestRecord) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + if (!hEventLog) + { + SetLastError(ERROR_INVALID_HANDLE); + return FALSE; + } + *OldestRecord = 0;
return TRUE; diff --git a/dlls/advapi32/tests/eventlog.c b/dlls/advapi32/tests/eventlog.c index dab24f0..9dc1d97 100644 --- a/dlls/advapi32/tests/eventlog.c +++ b/dlls/advapi32/tests/eventlog.c @@ -191,25 +191,20 @@ static void test_oldest(void) SetLastError(0xdeadbeef); ret = GetOldestEventLogRecord(NULL, NULL); ok(!ret, "Expected failure\n"); - todo_wine ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
SetLastError(0xdeadbeef); oldest = 0xdeadbeef; ret = GetOldestEventLogRecord(NULL, &oldest); - todo_wine - { ok(!ret, "Expected failure\n"); ok(GetLastError() == ERROR_INVALID_HANDLE, "Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError()); ok(oldest == 0xdeadbeef, "Expected oldest to stay unchanged\n"); - }
handle = OpenEventLogA(NULL, "Application");
SetLastError(0xdeadbeef); ret = GetOldestEventLogRecord(handle, NULL); ok(!ret, "Expected failure\n"); - todo_wine ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
oldest = 0xdeadbeef;