Module: wine
Branch: master
Commit: bf89330fb665e7913aeb081bbb1882c06e6607f6
URL: http://source.winehq.org/git/wine.git/?a=commit;h=bf89330fb665e7913aeb081bb…
Author: Dmitry Timoshkov <dmitry(a)codeweavers.com>
Date: Thu Jan 17 21:05:25 2008 +0800
ntdll: Do not perform base relocation if an image is not a DLL.
---
dlls/ntdll/virtual.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index cbd524a..1c44d49 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -1147,14 +1147,16 @@ static NTSTATUS map_image( HANDLE hmapping, int fd, char *base, SIZE_T total_siz
/* perform base relocation, if necessary */
- if (ptr != base)
+ if (ptr != base &&
+ ((nt->FileHeader.Characteristics & IMAGE_FILE_DLL) ||
+ !NtCurrentTeb()->Peb->ImageBaseAddress) )
{
const IMAGE_DATA_DIRECTORY *relocs;
relocs = &nt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC];
if (nt->FileHeader.Characteristics & IMAGE_FILE_RELOCS_STRIPPED)
{
- WARN( "Need to relocate module from addr %lx, but there are no relocation records\n",
+ WARN_(module)( "Need to relocate module from addr %lx, but there are no relocation records\n",
(ULONG_PTR)nt->OptionalHeader.ImageBase );
status = STATUS_CONFLICTING_ADDRESSES;
goto error;
@@ -1165,7 +1167,7 @@ static NTSTATUS map_image( HANDLE hmapping, int fd, char *base, SIZE_T total_siz
* Some DLLs really check the MSB of the module handle :-/
*/
if ((nt->OptionalHeader.ImageBase & 0x80000000) && !((ULONG_PTR)base & 0x80000000))
- ERR( "Forced to relocate system DLL (base > 2GB). This is not good.\n" );
+ ERR_(module)( "Forced to relocate system DLL (base > 2GB). This is not good.\n" );
if (!do_relocations( ptr, relocs, ptr - base, total_size ))
{