kernel32: Add a test for VirtualAlloc called on a mapped PE section.
Dmitry Timoshkov
dmitry at baikal.ru
Mon Jun 24 07:36:49 CDT 2013
---
dlls/kernel32/tests/loader.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c
index bd80508..ef1cde4 100644
--- a/dlls/kernel32/tests/loader.c
+++ b/dlls/kernel32/tests/loader.c
@@ -374,6 +374,7 @@ static void test_Loader(void)
if (hlib)
{
MEMORY_BASIC_INFORMATION info;
+ void *ptr;
ok( td[i].errors[0] == ERROR_SUCCESS, "%d: should have failed\n", i );
@@ -394,6 +395,15 @@ static void test_Loader(void)
ok(info.Type == SEC_IMAGE, "%d: %x != SEC_IMAGE\n", i, info.Type);
SetLastError(0xdeadbeef);
+ ptr = VirtualAlloc(hlib, si.dwPageSize, MEM_COMMIT, info.Protect);
+ /* FIXME: Remove once Wine is fixed */
+ if (ptr) todo_wine
+ ok(!ptr, "%d: VirtualAlloc should fail\n", i);
+ else ok(!ptr, "%d: VirtualAlloc should fail\n", i);
+todo_wine
+ ok(GetLastError() == ERROR_ACCESS_DENIED, "%d: expected ERROR_ACCESS_DENIED, got %d\n", i, GetLastError());
+
+ SetLastError(0xdeadbeef);
size = VirtualQuery((char *)hlib + info.RegionSize, &info, sizeof(info));
ok(size == sizeof(info),
"%d: VirtualQuery error %d\n", i, GetLastError());
@@ -471,6 +481,17 @@ static void test_Loader(void)
size = ALIGN_SIZE((ULONG_PTR)start, si.dwPageSize) - (ULONG_PTR)start;
ok(memcmp(start, filler, size), "%d: alignment should not be cleared\n", i);
}
+
+ SetLastError(0xdeadbeef);
+ ptr = VirtualAlloc((char *)hlib + section.VirtualAddress, si.dwPageSize, MEM_COMMIT, info.Protect);
+ /* FIXME: Remove once Wine is fixed */
+ if (ptr) todo_wine
+ ok(!ptr, "%d: VirtualAlloc should fail\n", i);
+ else ok(!ptr, "%d: VirtualAlloc should fail\n", i);
+todo_wine
+ ok(GetLastError() == ERROR_ACCESS_DENIED || GetLastError() == ERROR_INVALID_ADDRESS,
+ "%d: expected ERROR_ACCESS_DENIED, got %d\n", i, GetLastError());
+
}
SetLastError(0xdeadbeef);
--
1.8.3.1
More information about the wine-patches
mailing list