Module: wine Branch: master Commit: e5c55c5a5aedb3898f8a0a1e8df232a19447009a URL: http://source.winehq.org/git/wine.git/?a=commit;h=e5c55c5a5aedb3898f8a0a1e8d...
Author: Dmitry Timoshkov dmitry@baikal.ru Date: Mon Jun 24 21:36:49 2013 +0900
kernel32/tests: Add a test for VirtualAlloc called on a mapped PE section.
---
dlls/kernel32/tests/loader.c | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-)
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);