ntdll: Do not perform base relocation if an image is not a DLL
Dmitry Timoshkov
dmitry at codeweavers.com
Tue Jan 15 23:39:01 CST 2008
Hello,
this patch fixes the problem reported in the bug 11170. It appears that
LoadLibrary in Windows doesn't attempt to relocate .exe files.
Changelog:
ntdll: Do not perform base relocation if an image is not a DLL.
---
dlls/ntdll/virtual.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index cbd524a..96e1d6f 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -1147,14 +1147,14 @@ 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))
{
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 +1165,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 ))
{
--
1.5.3.8
More information about the wine-patches
mailing list