Patch to memory/virtual.c

Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Thu Dec 13 16:50:16 CST 2001


>>>>> "Robert" == Robert Baruch <autophile at starband.net> writes:

    Robert> Description: map_image now sets up the protections in the view
    Robert> of the memory-mapped executable image according to the
    Robert> protections for each section in the image. Before the patch,
    Robert> running an app under WinDbg on W2K/VMware showed a protection
    Robert> violation at a certain address, which Wine did not fault at that
    Robert> address. After the patch, the app faults in the same place in
    Robert> Wine as it does in W2K.

I think the protection setting needs more care. With some shrinker file
(targ2001.exe) I get
...
trace:module:map_image mapping section .idata at 0x75b69000 off 34000 size c00 flags 40000040
...
trace:virtual:map_image Set protection for section .idata 40000040 to 41.
trace:virtual:VIRTUAL_SetProt 0x75b69000-0x75b69fff c-r--
...
Unhandled exception: page fault on write access to 0x75b6903c in 32-bit code (0x40091c2f).
In 32-bit mode.
0x40091c2f (PE_fixup_imports+0x2af [pe_image.c:330] in libntdll.so): movl %eax,0x0(%ecx)
333                         if (!thunk_list->u1.Function) { 
Wine-dbg>Backtrace:
=>0 0x40091c2f (PE_fixup_imports+0x2af(wm=0x40382b48) [pe_image.c:330] in libntdll.so) (ebp=405b5dc8)

Giving VPROT_WRITE to .idata breaks when native oleaut32 is loaded:
trace:module:MODULE_LoadLibraryExA Trying native dll 'D:\wine95\system\OLEAUT32.DLL'
trace:module:PE_LoadImage loading D:\wine95\system\OLEAUT32.DLL
trace:virtual:CreateFileMappingW (18,(nil),01000000,0000000000000000,(null))
trace:module:map_image mapped PE file at 0x65340000-0x653d2000
trace:module:map_image mapping section .text at 0x65341000 off 2000 size 82000 flags 60000020
...
trace:virtual:map_image Set protection for section .text 60000020 to 45.
trace:virtual:VIRTUAL_SetProt 0x65341000-0x653c2fff c-r-x
...
Unhandled exception: page fault on write access to 0x65341000 in 32-bit code
(0x40091c2f).
In 32-bit mode.
0x40091c2f (KERNEL32.DLL.__wine_call_from_16_thunk+0x61cf): movl
%eax,0x0(%ecx)
Wine-dbg>Backtrace:
=>0 0x40091c2f (KERNEL32.DLL.__wine_call_from_16_thunk+0x61cf) (ebp=405b6cbc)
  1 0x400924e2 (KERNEL32.DLL.__wine_call_from_16_thunk+0x6a82) (ebp=405b6d48)
  2 0x40092632 (KERNEL32.DLL.__wine_call_from_16_thunk+0x6bd2) (ebp=405b6d70)
...

Running with builtin oleaut32 and friends, I again get to the shrinker error
box.

Thanks for your efforts so long!

Bye
-- 
Uwe Bonnes                bon at elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------




More information about the wine-devel mailing list