[Bug 30297] Sikuli IDE doesn't start up (incorrect calculation of negative PE relocation delta)

wine-bugs at winehq.org wine-bugs at winehq.org
Thu Oct 3 14:58:04 CDT 2013


http://bugs.winehq.org/show_bug.cgi?id=30297

Anastasius Focht <focht at gmx.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
          Component|-unknown                    |ntdll
         Resolution|FIXED                       |
            Summary|Sikuli IDE doesn't start up |Sikuli IDE doesn't start up
                   |                            |(incorrect calculation of
                   |                            |negative PE relocation
                   |                            |delta)
     Ever Confirmed|0                           |1

--- Comment #3 from Anastasius Focht <focht at gmx.net> 2013-10-03 14:58:04 CDT ---
Hello Qian,

looks like I had it working by chance while investigating various JRE related
bugs.
I tested multiple JavaSE JRE versions/installers, maybe there was a "golden"
one.

Now I get the same thing on clean 32-bit WINEPREFIX with the JRE version you
use, the app exits without showing the GUI.

The problem is indeed 'JIntellitype.dll'.
There is an exception in dll entry point and it looks like the relocation
fixups are wrong.

'JIntellitype.dll' is extracted from 'sikuli-script.jar' at runtime and written
to temp folder.
The runtime modifies the dll PE header at offset 0xD0 (image size) from
0x00010848 to 0x00011000.
The real problem seems to be the default load base address of 0x64E80000
present in PE header.
Wine always relocates the dll to a lower address range.
Unfortunately the negative relocation delta is not correctly calculated leading
to wrong fixups.

Source here:
http://source.winehq.org/git/wine.git/blob/5c0b5f4dcb60d2c7341cfb1ba3d586e30143cc79:/dlls/ntdll/virtual.c#l1320

--- snip ---
...
        TRACE_(module)( "relocating from %p-%p to %p-%p\n",
                        base, base + total_size, ptr, ptr + total_size );

        relocs =
&nt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC];
        rel = (IMAGE_BASE_RELOCATION *)(ptr + relocs->VirtualAddress);
        end = (IMAGE_BASE_RELOCATION *)(ptr + relocs->VirtualAddress +
relocs->Size);
        delta = ptr - base;

        while (rel < end - 1 && rel->SizeOfBlock)
        {
            if (rel->VirtualAddress >= total_size)
            {
                WARN_(module)( "invalid address %p in relocation %p\n", ptr +
rel->VirtualAddress, rel );
                status = STATUS_ACCESS_VIOLATION;
                goto error;
            }
            rel = LdrProcessRelocationBlock( ptr + rel->VirtualAddress,
                                             (rel->SizeOfBlock - sizeof(*rel))
/ sizeof(USHORT),
                                             (USHORT *)(rel + 1), delta );
            if (!rel) goto error;
        }
...
--- snip ---

Regards

-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
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