advapi32: Add some input parameter checks to GetOldestEventLogRecord.

This commit is contained in:
Paul Vriens 2009-10-29 09:25:07 +01:00 committed by Alexandre Julliard
parent 1fe325fd13
commit 78452960bc
2 changed files with 12 additions and 6 deletions

View File

@ -300,7 +300,18 @@ BOOL WINAPI GetOldestEventLogRecord( HANDLE hEventLog, PDWORD OldestRecord )
{ {
FIXME("(%p,%p) stub\n", hEventLog, 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; *OldestRecord = 0;
return TRUE; return TRUE;

View File

@ -191,25 +191,20 @@ static void test_oldest(void)
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = GetOldestEventLogRecord(NULL, NULL); ret = GetOldestEventLogRecord(NULL, NULL);
ok(!ret, "Expected failure\n"); ok(!ret, "Expected failure\n");
todo_wine
ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
oldest = 0xdeadbeef; oldest = 0xdeadbeef;
ret = GetOldestEventLogRecord(NULL, &oldest); ret = GetOldestEventLogRecord(NULL, &oldest);
todo_wine
{
ok(!ret, "Expected failure\n"); ok(!ret, "Expected failure\n");
ok(GetLastError() == ERROR_INVALID_HANDLE, "Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError()); ok(GetLastError() == ERROR_INVALID_HANDLE, "Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
ok(oldest == 0xdeadbeef, "Expected oldest to stay unchanged\n"); ok(oldest == 0xdeadbeef, "Expected oldest to stay unchanged\n");
}
handle = OpenEventLogA(NULL, "Application"); handle = OpenEventLogA(NULL, "Application");
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = GetOldestEventLogRecord(handle, NULL); ret = GetOldestEventLogRecord(handle, NULL);
ok(!ret, "Expected failure\n"); ok(!ret, "Expected failure\n");
todo_wine
ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
oldest = 0xdeadbeef; oldest = 0xdeadbeef;