From bc524e92d23c6ca4f0d7c503db348f12b058edf7 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Thu, 20 Jun 2002 22:54:26 +0000 Subject: [PATCH] Avoid loading programs into the DOS memory area. --- loader/pe_image.c | 10 +++++----- memory/virtual.c | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/loader/pe_image.c b/loader/pe_image.c index 974c6a11387..c886cf3c006 100644 --- a/loader/pe_image.c +++ b/loader/pe_image.c @@ -395,10 +395,11 @@ static int do_relocations( char *base, const IMAGE_NT_HEADERS *nt, const char *f { if (nt->OptionalHeader.ImageBase == 0x400000) ERR("Standard load address for a Win32 program (0x00400000) not available - security-patched kernel ?\n"); - ERR( "FATAL: Need to relocate %s, but no relocation records present (%s). Try to run that file directly !\n", - filename, - (nt->FileHeader.Characteristics&IMAGE_FILE_RELOCS_STRIPPED)? - "stripped during link" : "unknown reason" ); + else + ERR( "FATAL: Need to relocate %s from addr %p, but %s\n", + filename, nt->OptionalHeader.ImageBase, + (nt->FileHeader.Characteristics&IMAGE_FILE_RELOCS_STRIPPED)? + "relocation records are stripped" : "no relocation records present" ); return 0; } @@ -822,4 +823,3 @@ void PE_InitTls( void ) TlsSetValue( wm->tlsindex, mem ); } } - diff --git a/memory/virtual.c b/memory/virtual.c index afa141888ca..988e3c6a537 100644 --- a/memory/virtual.c +++ b/memory/virtual.c @@ -513,6 +513,7 @@ static LPVOID map_image( HANDLE hmapping, int fd, char *base, DWORD total_size, /* zero-map the whole range */ + if (base < (char *)0x110000) base = 0; /* make sure the DOS area remains free */ if ((ptr = wine_anon_mmap( base, total_size, PROT_READ | PROT_WRITE | PROT_EXEC, 0 )) == (char *)-1) {