http://bugs.winehq.org/show_bug.cgi?id=2608
--- Comment #10 from Anastasius Focht focht@gmx.net 2007-10-26 04:10:43 --- Created an attachment (id=8777) --> (http://bugs.winehq.org/attachment.cgi?id=8777) patch which fixes shrinker 3.x issues, making it fully wine compatible
Hello,
this bug seemed interesting to me - so I looked into it ;-)
Attached is a patch which fixes remaining shinker 3.x issue. For reference I tested another target compressed with shrinker 3.4 which suffers from same problem: "Astrosoft Vision 4" (http://astrosoft.ch/vision.htm).
Shrinker depends on specific API entry (opcode) layout of following functions:
LdrAccessResource EXC_CallHandler/ExceptionHandler2 (windows) ExitProcess
The patch mimics windows API entry opcodes for ExitProcess by using __asm__ wrapper to let shrinker successfully hook. The opcode sequences must be located between first 0x20 bytes of API entry. Shrinker usually overwrites push <imm32> (5 byte) instructions, large enough to fit jmp/call dword ptr opcode. If any 3rd party software hooks one of these entries on standard way (detour on first bytes), Shrinker will obviously fail. Same goes to wine +relay feature - do not use it while running shrinker protected programs.
The patch was tested with Might & Magic 6 (with shrinked mss32.dll) under NT/2K/XP configurations. It successfully starts up, no more manual deshrinking needed. Should apply to all other Shrinker 3.x protected apps/games. The latest known Shrinker version is 3.4 - development probably abandoned some time ago.
Additional notes for this game:
1.)
You might run into "More diskspace needed" error when starting up the game. This is due to GetDiskFreeSpaceA/W() cluster overflow. Wine fixes overflow (cap 2 GB) only for Win9X/Me systems, which is IMHO wrong. This API is broken on all windows versions (should not make any difference - cap by default). You can fix this by removing GetVersion() check in "dlls/kernel32/volume.c:GetDiskFreeSpaceW()". The game will then successfully start on larger disk partitions.
2.)
If it asks for "CD2", just make directory containing ANIMS/AUTORUN/AUTORUN.INF data and add directory to winecfg, setting type as CDROM.
Regards
PS: I hope the developers of Shrinker burn in hell for writing such intrusive code. That api entry trickery has no benefit at all but makes life of customers/users harder (hooking problems with other 3rd party software). Protection level? Zero. All this stuff can be easily recognized/bypassed by advanced reversers. ;-)