Commit 59588b66 authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

advapi32/tests: Trace GetLastError() when an event log API fails.

parent a76fd1c3
......@@ -113,9 +113,9 @@ static void test_open_close(void)
/* This one opens the Application log */
handle = OpenEventLogA(NULL, "deadbeef");
ok(handle != NULL, "Expected a handle\n");
ok(handle != NULL, "Expected a handle : %d\n", GetLastError());
ret = CloseEventLog(handle);
ok(ret, "Expected success\n");
ok(ret, "Expected success : %d\n", GetLastError());
/* Close a second time */
SetLastError(0xdeadbeef);
ret = CloseEventLog(handle);
......@@ -127,11 +127,11 @@ static void test_open_close(void)
/* Empty servername should be read as local server */
handle = OpenEventLogA("", "Application");
ok(handle != NULL, "Expected a handle\n");
ok(handle != NULL, "Expected a handle : %d\n", GetLastError());
CloseEventLog(handle);
handle = OpenEventLogA(NULL, "Application");
ok(handle != NULL, "Expected a handle\n");
ok(handle != NULL, "Expected a handle : %d\n", GetLastError());
CloseEventLog(handle);
}
......@@ -189,7 +189,7 @@ static void test_info(void)
efi->dwFull = 0xdeadbeef;
needed = sizeof(buffer);
ret = pGetEventLogInformation(handle, EVENTLOG_FULL_INFO, efi, needed, &needed);
ok(ret, "Expected success\n");
ok(ret, "Expected success : %d\n", GetLastError());
ok(needed == sizeof(EVENTLOG_FULL_INFORMATION), "Expected sizeof(EVENTLOG_FULL_INFORMATION), got %d\n", needed);
ok(efi->dwFull == 0 || efi->dwFull == 1, "Expected 0 (not full) or 1 (full), got %d\n", efi->dwFull);
......@@ -224,7 +224,7 @@ static void test_count(void)
count = 0xdeadbeef;
ret = GetNumberOfEventLogRecords(handle, &count);
ok(ret, "Expected success\n");
ok(ret, "Expected success : %d\n", GetLastError());
ok(count != 0xdeadbeef, "Expected the number of records\n");
CloseEventLog(handle);
......@@ -241,7 +241,7 @@ static void test_count(void)
ret = GetNumberOfEventLogRecords(handle, &count);
todo_wine
{
ok(ret, "Expected success\n");
ok(ret, "Expected success : %d\n", GetLastError());
ok(count != 0xdeadbeef, "Expected the number of records\n");
}
......@@ -278,7 +278,7 @@ static void test_oldest(void)
oldest = 0xdeadbeef;
ret = GetOldestEventLogRecord(handle, &oldest);
ok(ret, "Expected success\n");
ok(ret, "Expected success : %d\n", GetLastError());
ok(oldest != 0xdeadbeef, "Expected the number of the oldest record\n");
CloseEventLog(handle);
......@@ -295,7 +295,7 @@ static void test_oldest(void)
ret = GetOldestEventLogRecord(handle, &oldest);
todo_wine
{
ok(ret, "Expected success\n");
ok(ret, "Expected success : %d\n", GetLastError());
ok(oldest != 0xdeadbeef, "Expected the number of the oldest record\n");
}
......@@ -335,7 +335,7 @@ static void test_backup(void)
CloseEventLog(handle);
return;
}
ok(ret, "Expected success\n");
ok(ret, "Expected success : %d\n", GetLastError());
todo_wine
ok(GetFileAttributesA(backup) != INVALID_FILE_ATTRIBUTES, "Expected a backup file\n");
......@@ -358,7 +358,7 @@ static void test_backup(void)
ret = BackupEventLogA(handle, backup2);
todo_wine
{
ok(ret, "Expected success\n");
ok(ret, "Expected success : %d\n", GetLastError());
ok(GetFileAttributesA(backup2) != INVALID_FILE_ATTRIBUTES, "Expected a backup file\n");
}
......@@ -505,7 +505,7 @@ static void test_read(void)
read = needed = 0xdeadbeef;
SetLastError(0xdeadbeef);
ret = ReadEventLogA(handle, EVENTLOG_SEQUENTIAL_READ | EVENTLOG_FORWARDS_READ, 0, buf, toread, &read, &needed);
ok(ret, "Expected success\n");
ok(ret, "Expected success : %d\n", GetLastError());
ok(read == toread ||
broken(read < toread), /* NT4 wants a buffer size way bigger than just 1 record */
"Expected the requested size to be read\n");
......@@ -886,7 +886,7 @@ static void test_readwrite(void)
handle = OpenEventLogA(NULL, eventlogname);
count = 0xdeadbeef;
ret = GetNumberOfEventLogRecords(handle, &count);
ok(ret, "Expected success\n");
ok(ret, "Expected success : %d\n", GetLastError());
todo_wine
ok(count == i, "Expected %d records, got %d\n", i, count);
CloseEventLog(handle);
......@@ -1024,11 +1024,11 @@ static void test_readwrite(void)
SetLastError(0xdeadbeef);
ret = ClearEventLogA(handle, NULL);
ok(ret, "Expected success\n");
ok(ret, "Expected success : %d\n", GetLastError());
count = 0xdeadbeef;
ret = GetNumberOfEventLogRecords(handle, &count);
ok(ret, "Expected success\n");
ok(ret, "Expected success : %d\n", GetLastError());
ok(count == 0, "Expected an empty eventlog, got %d records\n", count);
CloseEventLog(handle);
......
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