http://bugs.winehq.org/show_bug.cgi?id=22812
Summary: mt under wine corrupts executables Product: Wine Version: 1.1.44 Platform: x86 URL: http://ghostscript.com/~hintak/wine-debug/ OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: loader AssignedTo: wine-bugs@winehq.org ReportedBy: htl10@users.sourceforge.net
part of ghostscript's building process runs:
mt -nologo -manifest psi/dwsetup_x86.manifest -outputresource:setupgs.exe;#1 mt -nologo -manifest psi/dwuninst_x86.manifest -outputresource:uninstgs.exe;#1
This step corrupts executables under wine and they gain a wrong image size; both vista and win7 then complains they are not valid win32 applications. See discussion on wine-devel mailing list.
I have modified the makefiles slightly so that setupgs.exe and uninstgs.exe are saved to setupgs.exe.bak and uninstgs.exe.bak before running mt. So the two *.bak files can be found in:
http://ghostscript.com/~hintak/wine-debug/vista-bins.zip and the manifests in: http://ghostscript.com/~hintak/wine-debug/dw_manifests.zip
and one can compare running mt against them with the vista executables, also in that zip file.
http://bugs.winehq.org/show_bug.cgi?id=22812
Hin-Tak Leung htl10@users.sourceforge.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Component|loader |imagehlp
--- Comment #1 from Hin-Tak Leung htl10@users.sourceforge.net 2010-05-22 03:39:59 --- change component to imagehlp, since that's what mt depends on and where the likely problem is.
http://bugs.winehq.org/show_bug.cgi?id=22812
Dmitry Timoshkov dmitry@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Component|imagehlp |-unknown Summary|mt under wine corrupts |mt creates corrupted |executables |executables
--- Comment #2 from Dmitry Timoshkov dmitry@codeweavers.com 2010-05-22 03:41:20 --- Did you try to use native imagehlp.dll?
http://bugs.winehq.org/show_bug.cgi?id=22812
--- Comment #3 from Hin-Tak Leung htl10@users.sourceforge.net 2010-05-22 03:56:53 --- (In reply to comment #2)
Did you try to use native imagehlp.dll?
I have taken setupgs.exe.bak and uninstgs.exe.bak from under wine and just run the mt step under vista and the result is valid according to vista; so it would seems to be one of mt's dependencies. (I have win 7 sdk under wine and vista and mt.exe is the same).
http://bugs.winehq.org/show_bug.cgi?id=22812
--- Comment #4 from Dmitry Timoshkov dmitry@codeweavers.com 2010-05-22 04:17:49 --- (In reply to comment #3)
(In reply to comment #2)
Did you try to use native imagehlp.dll?
I have taken setupgs.exe.bak and uninstgs.exe.bak from under wine and just run the mt step under vista and the result is valid according to vista; so it would seems to be one of mt's dependencies. (I have win 7 sdk under wine and vista and mt.exe is the same).
So this bug and the bug #22813 are invalid?
http://bugs.winehq.org/show_bug.cgi?id=22812
--- Comment #5 from Hin-Tak Leung htl10@users.sourceforge.net 2010-05-22 05:00:22 --- (In reply to comment #4)
So this bug and the bug #22813 are invalid?
What's the reasoning behind this question? If wine is supposed to does things like windows, there are (very valid) two bugs, (1) it runs mt differently, (2) it runs 'invalid' executables successfully which vista/win7 refuses to run.
http://bugs.winehq.org/show_bug.cgi?id=22812
--- Comment #6 from Dmitry Timoshkov dmitry@codeweavers.com 2010-05-22 05:37:02 --- (In reply to comment #5)
What's the reasoning behind this question? If wine is supposed to does things like windows, there are (very valid) two bugs, (1) it runs mt differently, (2) it runs 'invalid' executables successfully which vista/win7 refuses to run.
Then please clarify what the Comment #3 means.
http://bugs.winehq.org/show_bug.cgi?id=22812
--- Comment #7 from Hin-Tak Leung htl10@users.sourceforge.net 2010-05-22 05:50:26 --- (In reply to comment #6)
Then please clarify what the Comment #3 means.
$ md5sum /media/Vista/Program\ Files/Microsoft\ SDKs/Windows/v7.0/Bin/mt.exe 79d4d86b1d0071ed817a31fa90153130 /media/Vista/Program Files/Microsoft SDKs/Windows/v7.0/Bin/mt.exe $ md5sum ~/.wine/drive_c/Program\ Files/Microsoft\ SDKs/Windows/v7.0/Bin/mt.exe 79d4d86b1d0071ed817a31fa90153130 /home/Hin-Tak/.wine/drive_c/Program Files/Microsoft SDKs/Windows/v7.0/Bin/mt.exe
Identical mt executable, processes two of the same files (setupgs.exe.bak , uninstgs.exe.bak). The resulting files of running mt under wine are invalid under Vista. The resulting files of running mt under vista are valid under Vista.
So everything is equal except the execution environment of mt, and therefore one of the problem comes from dependencies of mt provided by wine (and imagehlp.dll is prime suspect).
http://bugs.winehq.org/show_bug.cgi?id=22812
--- Comment #8 from Hin-Tak Leung htl10@users.sourceforge.net 2010-05-23 07:52:31 --- imagehlp.dll is off the hook, I think - tried using native imagehlp.dll and the situation does not improve.
http://bugs.winehq.org/show_bug.cgi?id=22812
--- Comment #9 from Saulius K. saulius2@gmail.com 2010-05-24 13:34:02 --- In reply to comment #8:
tried using native imagehlp.dll and the situation does not improve.
Just in case. Haven't you forget to override it's loading order to "native only" ?
In any case it would be interesting to see what dlls mt is loading. WINEDEBUG=+tid,+process,+loaddll env-variable would probably help you.
http://bugs.winehq.org/show_bug.cgi?id=22812
--- Comment #10 from Hin-Tak Leung htl10@users.sourceforge.net 2010-05-24 15:01:08 --- (In reply to comment #9)
In reply to comment #8:
tried using native imagehlp.dll and the situation does not improve.
Just in case. Haven't you forget to override it's loading order to "native only" ?
I thought I might, because I was doing 'WINEDLLOVERRIDES="imagehlp=n,b" cmd' then run mt inside cmd, but I redo with running mt directly like this:
cp bin/setupgs.exe.bak bin/setupgsbak.exe
WINEDLLOVERRIDES="imagehlp=n" '/home/Hin-Tak/.wine/drive_c/Program Files/Microsoft SDKs/Windows/v7.0/Bin/mt.exe' -nologo -manifest psi/dwsetup_x86.manifest '-outputresource:bin/setupgsbak.exe;#1'
In any case it would be interesting to see what dlls mt is loading. WINEDEBUG=+tid,+process,+loaddll env-variable would probably help you.
I'll attach that next.
http://bugs.winehq.org/show_bug.cgi?id=22812
--- Comment #11 from Saulius K. saulius2@gmail.com 2010-06-01 13:49:24 --- OK, so in addition you should probably try overriding msvcr80.dll (winetricks vcrun2005). Also native dbghelp.dll comes to mind.
http://bugs.winehq.org/show_bug.cgi?id=22812
Saulius K. saulius2@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |saulius2@gmail.com
http://bugs.winehq.org/show_bug.cgi?id=22812
--- Comment #12 from Hin-Tak Leung htl10@users.sourceforge.net 2010-06-11 00:26:29 --- (In reply to comment #11)
OK, so in addition you should probably try overriding msvcr80.dll (winetricks vcrun2005). Also native dbghelp.dll comes to mind.
tried msvcr80.dll - still broken. I am thinking since section alignment is 0x1000, xxx200 would be wrong? In any case, since I have two binaries which have wrong image size (and I know exactly what they are) - it is probably possible to just run "WINEDEBUG=<something> | grep 'value'" to see which routines mt uses to get those values?
http://bugs.winehq.org/show_bug.cgi?id=22812
--- Comment #13 from Andrey Turkin andrey.turkin@gmail.com 2010-07-11 14:49:39 --- Created an attachment (id=29535) --> (http://bugs.winehq.org/attachment.cgi?id=29535) patch to fix EndUpdateResource
Please try if this patch works for you
http://bugs.winehq.org/show_bug.cgi?id=22812
--- Comment #14 from Hin-Tak Leung htl10@users.sourceforge.net 2010-07-11 17:00:00 --- (In reply to comment #13)
Created an attachment (id=29535)
--> (http://bugs.winehq.org/attachment.cgi?id=29535) [details]
patch to fix EndUpdateResource
Please try if this patch works for you
Thanks for the patch - I'll give it a try in a moment. It looks quite invasive though.
BTW, trying to build the 64-bit version (which works under vista 32-bit) result in this message: ---------- mt -nologo -manifest .\psi\dwuninst_x64.manifest -outputresource:.\bin\uninstgs.exe;#1 fixme:file:NeedCurrentDirectoryForExePathW (L"mt"): partial stub Trying to load PE image for unsupported architecture (AMD-64)
$ grep -R 'rying to load PE image for unsupported architecture' ../wine/ ../wine/dlls/ntdll/virtual.c: MESSAGE("Trying to load PE image for unsupported architecture ("); ------------- Probably related.
http://bugs.winehq.org/show_bug.cgi?id=22812
--- Comment #15 from Dmitry Timoshkov dmitry@codeweavers.com 2010-07-12 00:34:34 --- (In reply to comment #14)
BTW, trying to build the 64-bit version (which works under vista 32-bit)
How about testing with plain 32-bi executable? 64-bit one can't work under 32-bit Wine just like won't under 32-bit Windows. There is no magic.
http://bugs.winehq.org/show_bug.cgi?id=22812
--- Comment #16 from Hin-Tak Leung htl10@users.sourceforge.net 2010-07-12 01:15:50 --- (In reply to comment #15)
(In reply to comment #14)
BTW, trying to build the 64-bit version (which works under vista 32-bit)
How about testing with plain 32-bi executable? 64-bit one can't work under 32-bit Wine just like won't under 32-bit Windows. There is no magic.
That was *additional* information: 32-bit executable generation corrupted, 64-bit executable manipulation does not work and emit a warning. They might be related so I mention it.
The windows 7 SDK works as a cross-compiler - itself is all 32-bit, but it can build and manipulate 64-bit executables on a 32-bit host. Most of it works under 32-bit wine, except the corresponding part for inserting an manifest into an 64-bit executable that has just been built.
http://bugs.winehq.org/show_bug.cgi?id=22812
--- Comment #17 from Hin-Tak Leung htl10@users.sourceforge.net 2010-07-12 03:53:28 --- (In reply to comment #13)
Created an attachment (id=29535)
--> (http://bugs.winehq.org/attachment.cgi?id=29535) [details]
patch to fix EndUpdateResource Please try if this patch works for you
I tried the patch and Vista no longer complains about the result and they seems to run correctly under Vista now. However the patch is not at all obvious and probably will take some time to convince AJ to take it?
In case you want to examine the executables themselves, here they are (I'll leave them there for a while) - one bundle is built under wine git with patch, the under under wine 1.2rc7 vanilla. Each bundle consists of the before- and after-mt'ed executables (installer and uninstaller), so 4 files in each:
http://htl10.users.sourceforge.net/tmp/wine-patch-testing-bins.zip http://htl10.users.sourceforge.net/tmp/wine-without-patch-testing-bins.zip
Thanks a lot for the patch - I'll have a better look itself when I find the time.
http://bugs.winehq.org/show_bug.cgi?id=22812
Andrey Turkin andrey.turkin@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |andrey.turkin@gmail.com
--- Comment #18 from Andrey Turkin andrey.turkin@gmail.com 2010-07-22 12:53:57 ---
the patch is not at all obvious and probably will take some time to convince AJ to take it?
Revised patch was accepted into git; you right it is not that obvious (well there are some tests to show it works for simpler cases). I checked uninstgs.exe files you provided (vista vs patched wine) and these are almost identical (setupgs.exe are different though - dos stubs have different size so everything is different in those two).
http://bugs.winehq.org/show_bug.cgi?id=22812
Bruno Jesus 00cpxxx@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |00cpxxx@gmail.com
--- Comment #19 from Bruno Jesus 00cpxxx@gmail.com 2013-01-19 09:24:19 CST --- The mentioned patch was commited long ago, is this still an issue in wine 1.5.22?
http://source.winehq.org/git/wine.git/commitdiff/a610fc17d8dd215651d272eb178...
http://bugs.winehq.org/show_bug.cgi?id=22812
Hin-Tak Leung htl10@users.sourceforge.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |FIXED
--- Comment #20 from Hin-Tak Leung htl10@users.sourceforge.net 2013-01-19 10:33:56 CST --- (In reply to comment #19)
The mentioned patch was commited long ago, is this still an issue in wine 1.5.22? http://source.winehq.org/git/wine.git/commitdiff/a610fc17d8dd215651d272eb178...
Thanks - I haven't tried for a while so I'll assume it is fixed and shall re-open if that's not the case.
http://bugs.winehq.org/show_bug.cgi?id=22812
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #21 from Alexandre Julliard julliard@winehq.org 2013-02-01 04:57:51 CST --- Closing bugs fixed in 1.5.23.