I was dismayed to discover that UFile 2013 (and 2014 and on) recently started to crash consistently on some “Interview” pages, when it was working rather flawlessly before.
This compelled me to learn how to debug Wine once again, and to try to provide a workaround solution in Wine Bug 39892: UFile crashes with runtime error when rendering certain pages.
Hence this blog post to document my “adventure” so I can keep track of how the Wine developers will eventually fix this issue, and so that I can get up-and-running much quicker next time I need to work on Wine again.
(Kudos to my former colleague Leanne Tsang who bravely worked with Wine source code to try to get it to work with ThizLinux way back in year 2002.)
Initial troubleshooting: Eliminating other potential side-causes:
- Tried different distributions: Ubuntu 14.04.3 (amd64) and Debian sid (amd64)
- Tried different versions: wine1.8 (1:1.8.0-0ubuntu1), wine1.8 (1.8-1 by Debian), wine-devel 1.9.0~sid_i386.deb (from WineHQ)
- Tried both WINEARCH=win32 and WINEARCH=win64. Same crash.
But I personally used it and tested it in May 2014! It worked (almost perfectly) with Wine 1.7.17 on Ubuntu 13.10!
Finally decided to try to install wine-unstable 1.7.17-1 from snapshot.debian.org. It works :-)
- wine-development 1.7.55-1 does not work.
- Tried a few other random versions, and finally discovered that wine-development 1.7.32-1 works, but wine-development 1.7.33 starts crashing.
To confirm it is not due to compile environment, try to build it… use pbuilder-dist, or, rather, cowbuilder-dist, to create a build for sid-i386. (UFile for Windows is a 32-bit application.)
Filed my bug here: https://bugs.winehq.org/show_bug.cgi?id=39892
In Debian lingo, wine-unstable == wine-development == odd-numbered Wine developmental releases like 1.7.32 and 1.9.0
Following the instructions at Building Wine from Source → Cross-Compiling → Containers:
sudo apt-get install lxc sudo lxc-create -t debian -n sid-i386-box -- -r sid -a i386
--bindhome is available for
lxc-create -t ubuntu only, see Launchpad Bug #1043004 “ –bindhome option should be on lxc-create, not on lxc-ubuntu”.
… Gave up trying to set up a bridge with wlan0. (Too troublesome for me at this moment.)
Referring to http://wiki.winehq.org/BuildingWine#head-12f714f104c5961e2c7b07efaf7c812585c6db96 and
[sid-i386] description=Debian sid (unstable) i386 directory=/srv/chroot/sid-i386 users=foka groups=sbuild root-groups=root personality=linux32
sudo debootstrap --variant=buildd --arch=i386 sid /srv/chroot/sid-i386 http://httpredir.debian.org/debian
etc. … gave up, ran out of space on my hard drive… :-p
Edit /etc/pbuilderrc and add /Ubuntu/home/foka/wine-dirs to BINDMOUNTS.
Login to the chroot environment:
cowbuilder-dist sid i386 login
apt-get install nano nano /etc/apt/sources.list (to uncomment the deb-src line) apt-get update apt-get --no-install-recommends build-dep wine apt-get install ccache
Then, continue to follow the General Compiling Hints at http://wiki.winehq.org/BuildingWine#head-c86e58755b5571613900c9b74229d6b85e7b3a4f, or, rather, Regression Testing at http://wiki.winehq.org/RegressionTesting
cd /Ubuntu/home/foka/wine-dirs mkdir wine-build cd wine-source git bisect start git bisect good wine-1.7.32 git bisect bad wine-1.7.33
cd wine-build ../wine-source/configure CC="ccache gcc" --verbose --disable-tests make -j4
../wine-source/configure --options CC="ccache gcc"? It does not work! I took it out.
These following warnings are harmless. Harmless for me anyway. :-)
configure: libhal 32-bit development files not found, no legacy dynamic device support. configure: libsane 32-bit development files not found, scanners won't be supported. configure: libv4l 32-bit development files not found. configure: libgphoto2 32-bit development files not found, digital cameras won't be supported. configure: libgphoto2_port 32-bit development files not found, digital cameras won't be auto-detected. configure: gstreamer-0.10 base plugins 32-bit development files not found, gstreamer support disabled configure: libcapi20 32-bit development files not found, ISDN won't be supported. configure: Finished. Do 'make' to compile Wine.
Okay, now what?
WINEDEBUG=+mshtml winedbg "C:\Program Files\UFile 2013\ufile.exe"
prevent-0x80020005-type-mismatch-error-with-getAttribute-onclick-2.patch (patch to ensure UFile does not crash, reverting to 1.7.32 behaviour):
--- a/dlls/mshtml/htmlelem.c +++ b/dlls/mshtml/htmlelem.c @@ -658,6 +658,10 @@ HRESULT get_elem_attr_value_by_dispid(HTMLElement *elem, DISPID dispid, DWORD fl V_VT(ret) = VT_BSTR; V_BSTR(ret) = SysAllocString(NULL); break; + case VT_NULL: + V_VT(ret) = VT_BSTR; + V_BSTR(ret) = SysAllocString(NULL); + break; default: hres = VariantChangeType(ret, ret, 0, VT_BSTR); if(FAILED(hres))
and mshtml-jstest-getAttribute-onclick-2.patch (test case):