From 517d0800df64239df484d231063d3fdace1abead Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Tue, 22 Nov 2011 18:03:22 +0800 Subject: [PATCH] ntdll: Revert 33b0f0edffa0c8a06b4ee8831c92fdc373f83ece. The tests clearly show that this commit is wrong. --- dlls/kernel32/tests/loader.c | 10 ---------- dlls/ntdll/virtual.c | 8 +------- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c index 3bc75405b0e..2af7cc58479 100644 --- a/dlls/kernel32/tests/loader.c +++ b/dlls/kernel32/tests/loader.c @@ -691,11 +691,6 @@ static void test_section_access(void) "%d: VirtualQuery error %d\n", i, GetLastError()); ok(info.BaseAddress == (char *)hlib + section.VirtualAddress, "%d: got %p != expected %p\n", i, info.BaseAddress, (char *)hlib + section.VirtualAddress); ok(info.RegionSize == si.dwPageSize, "%d: got %#lx != expected %#x\n", i, info.RegionSize, si.dwPageSize); - /* FIXME: remove the condition below once Wine is fixed */ - if ((td[i].scn_file_access & IMAGE_SCN_MEM_WRITE) && - (td[i].scn_file_access & IMAGE_SCN_CNT_UNINITIALIZED_DATA)) - todo_wine ok(info.Protect == td[i].scn_page_access, "%d: got %#x != expected %#x\n", i, info.Protect, td[i].scn_page_access); - else ok(info.Protect == td[i].scn_page_access, "%d: got %#x != expected %#x\n", i, info.Protect, td[i].scn_page_access); ok(info.AllocationBase == hlib, "%d: %p != %p\n", i, info.AllocationBase, hlib); ok(info.AllocationProtect == PAGE_EXECUTE_WRITECOPY, "%d: %#x != PAGE_EXECUTE_WRITECOPY\n", i, info.AllocationProtect); @@ -735,11 +730,6 @@ static void test_section_access(void) "%d: VirtualQuery error %d\n", i, GetLastError()); ok(info.BaseAddress == (char *)hlib + section.VirtualAddress, "%d: got %p != expected %p\n", i, info.BaseAddress, (char *)hlib + section.VirtualAddress); ok(info.RegionSize == si.dwPageSize, "%d: got %#lx != expected %#x\n", i, info.RegionSize, si.dwPageSize); - /* FIXME: remove the condition below once Wine is fixed */ - if ((td[i].scn_file_access & IMAGE_SCN_MEM_WRITE) && - (td[i].scn_file_access & IMAGE_SCN_CNT_UNINITIALIZED_DATA)) - todo_wine ok(info.Protect == td[i].scn_page_access, "%d: got %#x != expected %#x\n", i, info.Protect, td[i].scn_page_access); - else ok(info.Protect == td[i].scn_page_access, "%d: got %#x != expected %#x\n", i, info.Protect, td[i].scn_page_access); ok(info.AllocationBase == hlib, "%d: %p != %p\n", i, info.AllocationBase, hlib); ok(info.AllocationProtect == PAGE_EXECUTE_WRITECOPY, "%d: %#x != PAGE_EXECUTE_WRITECOPY\n", i, info.AllocationProtect); diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c index fb8786f16d9..98536280b6c 100644 --- a/dlls/ntdll/virtual.c +++ b/dlls/ntdll/virtual.c @@ -1345,14 +1345,8 @@ static NTSTATUS map_image( HANDLE hmapping, int fd, char *base, SIZE_T total_siz size = ROUND_SIZE( sec->VirtualAddress, sec->SizeOfRawData ); if (sec->Characteristics & IMAGE_SCN_MEM_READ) vprot |= VPROT_READ; + if (sec->Characteristics & IMAGE_SCN_MEM_WRITE) vprot |= VPROT_WRITECOPY; if (sec->Characteristics & IMAGE_SCN_MEM_EXECUTE) vprot |= VPROT_EXEC; - if (sec->Characteristics & IMAGE_SCN_MEM_WRITE) - { - if (sec->Characteristics & IMAGE_SCN_CNT_UNINITIALIZED_DATA) - vprot |= VPROT_WRITE; - else - vprot |= VPROT_WRITECOPY; - } /* Dumb game crack lets the AOEP point into a data section. Adjust. */ if ((nt->OptionalHeader.AddressOfEntryPoint >= sec->VirtualAddress) && -- 2.11.4.GIT