Commit e5c55c5a authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

kernel32/tests: Add a test for VirtualAlloc called on a mapped PE section.

parent de03abd5
......@@ -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);
......
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