Module: wine Branch: refs/heads/master Commit: 08c2555dd86969c157037b7850667175aa102f16 URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=08c2555dd86969c157037b78...
Author: Marcus Meissner marcus@jet.franken.de Date: Sat May 6 15:16:39 2006 +0200
ntdll: Make the section with AddressOfEntryPoint in it executable.
---
dlls/ntdll/virtual.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c index 1723070..fcdb96b 100644 --- a/dlls/ntdll/virtual.c +++ b/dlls/ntdll/virtual.c @@ -1072,6 +1072,12 @@ static NTSTATUS map_image( HANDLE hmappi if (sec->Characteristics & IMAGE_SCN_MEM_READ) vprot |= VPROT_READ; if (sec->Characteristics & IMAGE_SCN_MEM_WRITE) vprot |= VPROT_READ|VPROT_WRITECOPY; if (sec->Characteristics & IMAGE_SCN_MEM_EXECUTE) vprot |= VPROT_EXEC; + + /* Dumb game crack lets the AOEP point into a data section. Adjust. */ + if ((nt->OptionalHeader.AddressOfEntryPoint >= sec->VirtualAddress) && + (nt->OptionalHeader.AddressOfEntryPoint < sec->VirtualAddress + size)) + vprot |= VPROT_EXEC; + VIRTUAL_SetProt( view, ptr + sec->VirtualAddress, size, vprot ); }