On Thu, May 20, 2010 at 3:54 AM, Hin-Tak Leung <hintak_le...@yahoo.co.uk> wrote: > Saulius Krasuckas wrote: >> >> I sorry for stepping into Alexandre's or Dmitry's shoes, but.. >> >> * On Tue, 18 May 2010, Hin-Tak Leung wrote: >>> >>> So it seems that setupgs.exe is mis-compiled under wine with win7 sdk but >>> just happened to also work under wine. Any idea how it might happen? >> >> ... there could be a pair of bugs: one in PE image manipulation functions >> plus another in Wine PE loading mechanism(s). >> >> I could imagine the first easily inside a IMAGEHLP, eg. functions >> ImageAddCertificate() or CheckSumMappedFile(). >> >> If you find the first one, then it should be possible to write a test to >> reveal the second one. >> >>> I have checked things like end-of-line, but it is curious why the setupgs >>> program works under wine but not in vista, the reverse situation compared to >>> most. >> >> Could you build the same project under real Windows? >> >> Then I would run "winedump dump -f" or even "-x" on both files to compare >> the outputs (probably line by line) and to find the essential difference. > > I have gone ahead and done exactly that - the correct behavior should be a > msg box saying filelist.txt is missing, rather than setupgs.exe not a valid > win32 application. > > http://www.ghostscript.com/~hintak/setupgs-vista.exe > http://www.ghostscript.com/~hintak/setupgs-wine.exe > > I haven't tried the uninstaller yet, so I don't know if the wine-built > uninstaller work: > > http://www.ghostscript.com/~hintak/uninstgs-vista.exe > http://www.ghostscript.com/~hintak/uninstgs-wine.exe > > To analyse the executables are a bit beyond me, but I hope somebody can do > that. > > under either system, if I compile the file twice quickly, the result differs > only by the datestamp and checksum (and in two wine-compiled executable > built a bit of time between , also a few bytes in the .text section after > what looks like an import table in a hex editor? > >
There are a few differences I spotted between the two executables: 1) setupgs-wine.exe has wrong image size, changing it from 0x2b200 to 0x2b000 makes the executable working under win7. 2) setupgs-wine.exe has wrong resource size, probably related to 1), because the size of both executables are the same. 3) The assembly in setupgs-wine.exe has only LF line endings, vista has CRLF. This explains 2). I don't know the reason for 3), I assume it's a bug somewhere in wine.