[Bug 38432] Xeon 1.0 (Xbox emulator) fails to load (PE image prelinked into DOS reserved area and default process heap range, no relocation possible)

wine-bugs at winehq.org wine-bugs at winehq.org
Sun Apr 19 09:46:18 CDT 2015


https://bugs.winehq.org/show_bug.cgi?id=38432

Anastasius Focht <focht at gmx.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |focht at gmx.net
            Summary|Xeon (Xbox emulator) fails  |Xeon 1.0 (Xbox emulator)
                   |to run - invalid address    |fails to load (PE image
                   |                            |prelinked into DOS reserved
                   |                            |area and default process
                   |                            |heap range, no relocation
                   |                            |possible)

--- Comment #1 from Anastasius Focht <focht at gmx.net> ---
Hello folks,

confirming.

Some "genius" prelinked the executable to 0x10000 and made the image
non-relocatable (code in 'newcode' text section assumes a fixed address space
layout/mapping).

--- snip ---
$ WINEDEBUG=+tid,+seh,+relay,+module wine ./Xeon.exe >>log.txt 2>&1
...
0009:trace:module:get_load_order looking for
L"Z:\\home\\focht\\Downloads\\Xeon.exe"
0009:trace:module:get_load_order got main exe default n,b for
L"Z:\\home\\focht\\Downloads\\Xeon.exe"
0009:trace:module:load_native_dll Trying native dll
L"Z:\\home\\focht\\Downloads\\Xeon.exe"
0009:trace:module:map_image mapped PE file at 0x240000-0x70e000
0009:trace:module:map_image mapping section .text at 0x241000 off 1000 size
4c9000 virt 4c8748 flags 60000020
0009:trace:module:map_image mapping section newcode at 0x70a000 off 4ca000 size
1000 virt 48 flags 60000020
0009:trace:module:map_image mapping section .rdata at 0x70b000 off 4cb000 size
2000 virt 11e6 flags 40000040
0009:trace:module:map_image mapping section .data at 0x70d000 off 4cd000 size
1000 virt 838 flags c0000040
0009:warn:module:map_image Need to relocate module from 0x10000 to 0x240000,
but there are no relocation records
0009:warn:module:load_dll Failed to load module
L"Z:\\home\\focht\\Downloads\\Xeon.exe"; status=c0000018
...
wine: Invalid address.
--- snip ---

Dump of relevant header/section info:

--- snip ---
...
->Optional Header
   Magic:                        0x010B  (HDR32_MAGIC)
   MajorLinkerVersion:           0x07
   MinorLinkerVersion:           0x0A  -> 7.10
   SizeOfCode:                   0x004CA000
   SizeOfInitializedData:        0x00003000
   SizeOfUninitializedData:      0x00000000
   AddressOfEntryPoint:          0x004C5B65
   BaseOfCode:                   0x00001000
   BaseOfData:                   0x004CB000
   ImageBase:                    0x00010000
   SectionAlignment:             0x00001000
   FileAlignment:                0x00001000
   MajorOperatingSystemVersion:  0x0004
   MinorOperatingSystemVersion:  0x0000  -> 4.00
   MajorImageVersion:            0x0000
   MinorImageVersion:            0x0000  -> 0.00
   MajorSubsystemVersion:        0x0004
   MinorSubsystemVersion:        0x0000  -> 4.00
   Win32VersionValue:            0x00000000
   SizeOfImage:                  0x004CD838
   SizeOfHeaders:                0x00001000
   CheckSum:                     0x00000000
   Subsystem:                    0x0002  (WINDOWS_GUI)
   DllCharacteristics:           0x0000
   SizeOfStackReserve:           0x00100000
   SizeOfStackCommit:            0x00100000
   SizeOfHeapReserve:            0x00100000
   SizeOfHeapCommit:             0x00001000
   LoaderFlags:                  0x00000000
   NumberOfRvaAndSizes:          0x00000010

   DataDirectory (16)            RVA        Size
   -------------                 ---------- ----------
   ExportTable                   0x00000000 0x00000000
   ImportTable                   0x004CBD48 0x0000003C  (".rdata")
   Resource                      0x00000000 0x00000000
   Exception                     0x00000000 0x00000000
   Security                      0x00000000 0x00000000
   Relocation                    0x00000000 0x00000000
   Debug                         0x00000000 0x00000000
   Copyright                     0x00000000 0x00000000
   GlobalPtr                     0x00000000 0x00000000
   TLSTable                      0x00000000 0x00000000
   LoadConfig                    0x004CBCE8 0x00000048  (".rdata")
   BoundImport                   0x00000000 0x00000000
   IAT                           0x004CB000 0x000000D0  (".rdata")
   DelayImport                   0x00000000 0x00000000
   COM                           0x00000000 0x00000000
   Reserved                      0x00000000 0x00000000
--- snip ---

--- snip ---
->Section Header Table
   1. item:
    Name:                  .text
    VirtualSize:           0x004C8748
    VirtualAddress:        0x00001000
    SizeOfRawData:         0x004C9000
    PointerToRawData:      0x00001000
    PointerToRelocations:  0x00000000
    PointerToLinenumbers:  0x00000000
    NumberOfRelocations:   0x0000
    NumberOfLinenumbers:   0x0000
    Characteristics:       0x60000020
    (CODE, EXECUTE, READ)

   2. item:
    Name:                  newcode
    VirtualSize:           0x00000048
    VirtualAddress:        0x004CA000
    SizeOfRawData:         0x00001000
    PointerToRawData:      0x004CA000
    PointerToRelocations:  0x00000000
    PointerToLinenumbers:  0x00000000
    NumberOfRelocations:   0x0000
    NumberOfLinenumbers:   0x0000
    Characteristics:       0x60000020
    (CODE, EXECUTE, READ)

   3. item:
    Name:                  .rdata
    VirtualSize:           0x000011E6
    VirtualAddress:        0x004CB000
    SizeOfRawData:         0x00002000
    PointerToRawData:      0x004CB000
    PointerToRelocations:  0x00000000
    PointerToLinenumbers:  0x00000000
    NumberOfRelocations:   0x0000
    NumberOfLinenumbers:   0x0000
    Characteristics:       0x40000040
    (INITIALIZED_DATA, READ)

   4. item:
    Name:                  .data
    VirtualSize:           0x00000838
    VirtualAddress:        0x004CD000
    SizeOfRawData:         0x00001000
    PointerToRawData:      0x004CD000
    PointerToRelocations:  0x00000000
    PointerToLinenumbers:  0x00000000
    NumberOfRelocations:   0x0000
    NumberOfLinenumbers:   0x0000
    Characteristics:       0xC0000040
    (INITIALIZED_DATA, READ, WRITE)
--- snip ---

This obviously can't work since Wine keeps that area reserved for DOS apps and
also places the default process heap after.

It can be made to work by making address space tweaks (loader/preloader,
ntdll/virtual).

Since there are no further apps requiring this, it might not be worth to
potentially break things by changing the current virtual address space layout.

$ sha1sum Xeon_10.rar 
64090d99fbd476bb0fb8014f9e2b6cd362812285  Xeon_10.rar

$ du -sh Xeon_10.rar 
980K    Xeon_10.rar

$ wine --version
wine-1.7.41

Regards

-- 
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.



More information about the wine-bugs mailing list