Open mity opened 11 years ago
Investigation showed the following facts:
windres
), different resource may be made broken instead.FindResource()
+ LoadResource()
+ LockResource()
and saves the resource into the file (at end of the program), it is valid PNG image binary equal to the source one. Perhaps MSHTML.DLL
accesses it in a different way rather then using those Win32 functions???More observations:
res://foo.exe/
)Even more observations. It seems that many conditions have to be met in order to reproduce the bug:
touch
ed). Subsequent runs do not trigger the issue.Gosh. This issue is big mystery to me.
As the issue seems to be related to layout of resources in .rsrc section, I performed several analyzes and experiments.
FindResource() + LoadResource()
on app. exit (i.e. after the bug happens) and saved them to a file. They are genuine and same as the "unbroken" originals.doc.html
) got broken.RT_MANIFEST - 1
) which is long enough "fixes" the issue.BeginUpdateResource()
+ related functions). Result was not same as that one of RC.EXE
but much closer then windres.exe
. Again this "fixed" the issue.Is it possible there is incompatibility between windres
, and some part of Windows 8 (which may be the embedded browser, dynamic loader which surely interprets the manifest or whatever)???
Manually analyzed hex-dump of the .rsrc
section, both from ex_html.exe built with gcc and MSVC:
RC.EXE
) seems to be much more generous about padding in .rsrc section.Tried once again to verify correctness of mCtrl.dll + ex_html.exe code:
MC_WC_HTML
control implementation as well as code of ex_html.exe. No output.MC_WC_HTML
as possible. Bug still happens.Enabled HTML traces (-DHTML_DEBUG=1
), run ex_html.exe multiple times. When compared the 1st run (when the bug happens) and subsequent runs (when it does not):
html.c
are same and it the very same order.DllMain(DLL_THREAD_ATTACH)
while subsequent runs do 11 times. The 6th (sic!) started thread is the one that is missing in the 1st run.What the hell is going on??
Tried one more intersting experiment:
windres
from the mingw-w64 toolchain.The bug is still there. By this I consider more or less proved the issue is about incompatibility of windres
from GNU binutils and something in Windows 8 or 8.1. Given the bug happens only on the 1st run, it may involve some caching in some Windows subsystem.
Perhaps dynamic loader somehow and very subtly breaks state of loaded ex_html.exe
image when accessing the application manifest in it (in a way colliding only with resource layout as output by windres
but not RC.EXE
. Arguably, Windows might cache the manifest for next app. starts so the subsequent starts do not trigger the bug. But this paragraph is pure speculation.
Reported in binutils bugzilla: https://sourceware.org/bugzilla/show_bug.cgi?id=17184
When running ex_html.exe built with mingw-w64 on Windows 8 and 8.1, a PNG image is not shown in the HTML page.