advapi32/tests: Avoid crashing if ReadEventLogA fails.

This commit is contained in:
Alexandre Julliard 2010-02-18 14:06:10 +01:00
parent 9b7d1041fc
commit 4f6d085073
1 changed files with 13 additions and 13 deletions

View File

@ -776,9 +776,9 @@ static void test_readwrite(void)
/* Needed to catch earlier Vista (with no ServicePack for example) */ /* Needed to catch earlier Vista (with no ServicePack for example) */
buf = HeapAlloc(GetProcessHeap(), 0, sizeof(EVENTLOGRECORD)); buf = HeapAlloc(GetProcessHeap(), 0, sizeof(EVENTLOGRECORD));
ReadEventLogA(handle, EVENTLOG_SEQUENTIAL_READ | EVENTLOG_FORWARDS_READ, if (ReadEventLogA(handle, EVENTLOG_SEQUENTIAL_READ | EVENTLOG_FORWARDS_READ,
0, buf, sizeof(EVENTLOGRECORD), &read, &needed); 0, buf, sizeof(EVENTLOGRECORD), &read, &needed))
{
buf = HeapReAlloc(GetProcessHeap(), 0, buf, needed); buf = HeapReAlloc(GetProcessHeap(), 0, buf, needed);
ReadEventLogA(handle, EVENTLOG_SEQUENTIAL_READ | EVENTLOG_FORWARDS_READ, ReadEventLogA(handle, EVENTLOG_SEQUENTIAL_READ | EVENTLOG_FORWARDS_READ,
0, buf, needed, &read, &needed); 0, buf, needed, &read, &needed);
@ -790,7 +790,7 @@ static void test_readwrite(void)
*/ */
if (record->EventType == EVENTLOG_SUCCESS) if (record->EventType == EVENTLOG_SUCCESS)
on_vista = TRUE; on_vista = TRUE;
}
HeapFree(GetProcessHeap(), 0, buf); HeapFree(GetProcessHeap(), 0, buf);
} }
ok(ret, "Expected success : %d\n", GetLastError()); ok(ret, "Expected success : %d\n", GetLastError());