Don't change base in map_image since we use it later on.
Added some tracing.
diff --git a/memory/virtual.c b/memory/virtual.c
index 7751f97..d3583c4 100644
--- a/memory/virtual.c
+++ b/memory/virtual.c
@@ -502,6 +502,9 @@
{
IMAGE_BASE_RELOCATION *rel;
+ TRACE_(module)( "relocating from %p-%p to %p-%p\n",
+ base - delta, base - delta + total_size, base, base + total_size );
+
for (rel = (IMAGE_BASE_RELOCATION *)(base + dir->VirtualAddress);
((char *)rel < base + dir->VirtualAddress + dir->Size) && rel->SizeOfBlock;
rel = (IMAGE_BASE_RELOCATION*)((char*)rel + rel->SizeOfBlock) )
@@ -576,9 +579,9 @@
/* 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)
+ if (base < (char *)0x110000 || /* make sure the DOS area remains free */
+ (ptr = wine_anon_mmap( base, total_size,
+ PROT_READ | PROT_WRITE | PROT_EXEC, 0 )) == (char *)-1)
{
ptr = wine_anon_mmap( NULL, total_size,
PROT_READ | PROT_WRITE | PROT_EXEC, 0 );
@@ -680,14 +683,14 @@
continue;
}
- if (sec->Characteristics & IMAGE_SCN_CNT_UNINITIALIZED_DATA) continue;
- if (!sec->PointerToRawData || !sec->SizeOfRawData) continue;
-
TRACE_(module)( "mapping section %.8s at %p off %lx size %lx flags %lx\n",
sec->Name, ptr + sec->VirtualAddress,
sec->PointerToRawData, sec->SizeOfRawData,
sec->Characteristics );
+ if (sec->Characteristics & IMAGE_SCN_CNT_UNINITIALIZED_DATA) continue;
+ if (!sec->PointerToRawData || !sec->SizeOfRawData) continue;
+
/* Note: if the section is not aligned properly VIRTUAL_mmap will magically
* fall back to read(), so we don't need to check anything here.
*/