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

Francois Gouget fgouget at codeweavers.com
Sat May 15 10:38:47 CDT 2021


Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 dlls/advapi32/tests/eventlog.c | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/dlls/advapi32/tests/eventlog.c b/dlls/advapi32/tests/eventlog.c
index c93494e5cf3..0c5d1e2523f 100644
--- a/dlls/advapi32/tests/eventlog.c
+++ b/dlls/advapi32/tests/eventlog.c
@@ -115,9 +115,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);
@@ -129,11 +129,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);
 }
 
@@ -192,7 +192,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);
 
@@ -228,7 +228,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);
@@ -245,7 +245,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");
         }
 
@@ -283,7 +283,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);
@@ -300,7 +300,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");
         }
 
@@ -341,7 +341,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");
 
@@ -364,7 +364,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");
     }
 
@@ -512,7 +512,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");
@@ -893,7 +893,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);
@@ -1031,11 +1031,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);
-- 
2.20.1




More information about the wine-devel mailing list