'kernel32_test loader' causes BSOD on XP SP1

Francois Gouget fgouget at free.fr
Sun Nov 4 11:01:16 CST 2007


So I'm running tests in an XP SP1 VM and yet, you can see no such 
results on http://test.winehq.org/data/. The reason for is that the 
'kernel32_test loader' causes XP SP1 to crash, so that winetest.exe 
never has an opportunity to send the results.

So I investigated this and the specific test that causes the crash is 
this one:

         { &dos_header, sizeof(dos_header),
           1, sizeof(IMAGE_OPTIONAL_HEADER), 0x200, 0x200,
          sizeof(dos_header) + sizeof(nt_header) + sizeof(IMAGE_SECTION_HEADER) + 0x1000,
           sizeof(dos_header) + sizeof(nt_header) + sizeof(IMAGE_SECTION_HEADER),
           ERROR_SUCCESS
         },

I noticed the 0x1000. Shouldn't this be a 0x200? Or is that the whole 
point of this test? In any case, changing it to 0x200 avoids crashing 
SP1.

Another weird way to avoid the crash is to introduce a Sleep(1000) just 
before the LoadLibrary().

I've summed up both ways to avoid the crash in the patch below. 
Hopefully someone more familiar with the loader than me can have a look 
into this and suggest a proper fix.



diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c
index 49af819..f9f9e0b 100644
--- a/dlls/kernel32/tests/loader.c
+++ b/dlls/kernel32/tests/loader.c
@@ -139,7 +139,7 @@ START_TEST(loader)
         },
         { &dos_header, sizeof(dos_header),
           1, sizeof(IMAGE_OPTIONAL_HEADER), 0x200, 0x200,
-          sizeof(dos_header) + sizeof(nt_header) + sizeof(IMAGE_SECTION_HEADER) + 0x1000,
+          sizeof(dos_header) + sizeof(nt_header) + sizeof(IMAGE_SECTION_HEADER) + 0xf00,
           sizeof(dos_header) + sizeof(nt_header) + sizeof(IMAGE_SECTION_HEADER),
           ERROR_SUCCESS
         },
@@ -321,6 +322,11 @@ START_TEST(loader)
         file_size = GetFileSize(hfile, NULL);
         CloseHandle(hfile);
 
+        if (0 && i == 4)
+        {
+            /* Required to avoid a crash on Windows XP SP1 */
+            Sleep(1000);
+        }
         SetLastError(0xdeadbeef);
         hlib = LoadLibrary(dll_name);
         if (td[i].error == ERROR_SUCCESS)



-- 
Francois Gouget <fgouget at free.fr>              http://fgouget.free.fr/
     Linux, WinNT, MS-DOS - also known as the Good, the Bad and the Ugly.



More information about the wine-devel mailing list