http://bugs.winehq.org/show_bug.cgi?id=30572
Bug #: 30572 Summary: Add support for vectored continue handlers (AddVectoredContinueHandler, RemoveVectoredContinueHandler) Product: Wine Version: 1.5.3 Platform: x86 OS/Version: Linux Status: NEW Severity: enhancement Priority: P2 Component: ntdll AssignedTo: wine-bugs@winehq.org ReportedBy: focht@gmx.net Classification: Unclassified
Hello,
an improvement, might come handy in future. Newer .NET runtimes (3.x/4.x) and certain applications make use of vectored continue handlers for better error reporting/diagnosis.
Currently there is no harm if the export is not found in kernel32 (error reporting using event api):
--- snip --- 003b:Call KERNEL32.GetModuleHandleW(79203ef8 L"kernel32.dll") ret=792a7116 003b:Ret KERNEL32.GetModuleHandleW() retval=7b810000 ret=792a7116 003b:Call KERNEL32.GetProcAddress(7b810000,792a7210 "AddVectoredExceptionHandler") ret=792a712d 003b:Ret KERNEL32.GetProcAddress() retval=7bc21e3c ret=792a712d 003b:Call KERNEL32.GetProcAddress(7b810000,792a71f0 "RemoveVectoredExceptionHandler") ret=792a713a 003b:Ret KERNEL32.GetProcAddress() retval=7bc23534 ret=792a713a 003b:Call KERNEL32.GetProcAddress(7b810000,792a71d4 "AddVectoredContinueHandler") ret=792a7147 003b:Ret KERNEL32.GetProcAddress() retval=00000000 ret=792a7147 003b:Call KERNEL32.GetProcAddress(7b810000,792a71b4 "RemoveVectoredContinueHandler") ret=792a7154 003b:Ret KERNEL32.GetProcAddress() retval=00000000 ret=792a7154 003b:Call ntdll.RtlAddVectoredExceptionHandler(00000001,791f5a7c) ret=792a7182 003b:Ret ntdll.RtlAddVectoredExceptionHandler() retval=001586a0 ret=792a7182 003b:Call KERNEL32.GetModuleHandleW(792083bc L"mscoree.dll") ret=792a7064 003b:Ret KERNEL32.GetModuleHandleW() retval=79000000 ret=792a7064 003b:Call KERNEL32.GetProcAddress(79000000,00000018) ret=792a7086 003b:Ret KERNEL32.GetProcAddress() retval=79008017 ret=792a7086 003b:Call KERNEL32.GetProcAddress(603b0000,00000018) ret=79008056 003b:Ret KERNEL32.GetProcAddress() retval=603b4470 ret=79008056 003b:Call KERNEL32.SetUnhandledExceptionFilter(603e468a) ret=603b4791 003b:Ret KERNEL32.SetUnhandledExceptionFilter() retval=00404395 ret=603b4791 ... --- snip ---
MSDN:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms679273%28v=vs.85%2... (AddVectoredContinueHandler)
http://msdn.microsoft.com/en-us/library/windows/desktop/ms680567%28v=vs.85%2... (RemoveVectoredContinueHandler)
--- Some more information how it works:
Extract from "Chapter 25 - Unhandled Exceptions, Vectored Exception Handling, and C++ Exceptions" Windows Via C/C++ by Jeffrey Richter and Christophe Nasarre Microsoft Press 2008
http://vmg.pp.ua/books/%D0%9A%D0%BE%D0%BF%D1%8C%D1%8E%D1%82%D0%B5%D1%80%D1%8...
MSDN blog: http://blogs.msdn.com/b/zhanli/archive/2010/06/25/c-tips-addvectoredexceptio...
Regards
http://bugs.winehq.org/show_bug.cgi?id=30572
Erich Hoover ehoover@mines.edu changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |ehoover@mines.edu
--- Comment #1 from Erich Hoover ehoover@mines.edu 2013-02-19 11:18:52 CST --- Silverlight also wants this feature.
http://bugs.winehq.org/show_bug.cgi?id=30572
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |dotnet Summary|Add support for vectored |Enhance .NET |continue handlers |3.x/4.x/Silverlight |(AddVectoredContinueHandler |application error handling |, |with vectored continue |RemoveVectoredContinueHandl |handlers |er) |(AddVectoredContinueHandler | |, | |RemoveVectoredContinueHandl | |er)
--- Comment #2 from Anastasius Focht focht@gmx.net 2013-05-01 10:42:10 CDT --- Hello folks,
still present. Refining summary to mention .NET and Silverlight (Erich's comment #2).
$ wine --version wine-1.5.29-38-g8e4317c
Regards
http://bugs.winehq.org/show_bug.cgi?id=30572
swdevelop1981@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |swdevelop1981@gmail.com
http://bugs.winehq.org/show_bug.cgi?id=30572
Maxim Kondratovich maxim.mvk@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |maxim.mvk@gmail.com
--- Comment #3 from Maxim Kondratovich maxim.mvk@gmail.com --- Lync application from Office 2013 also needs this functions.
http://bugs.winehq.org/show_bug.cgi?id=30572
--- Comment #4 from Maxim Kondratovich maxim.mvk@gmail.com --- Created attachment 48502 --> http://bugs.winehq.org/attachment.cgi?id=48502 Lync 2013 fails to start
http://bugs.winehq.org/show_bug.cgi?id=30572
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|Enhance .NET |Multiple applications need |3.x/4.x/Silverlight |vectored continue handler |application error handling |support (.NET |with vectored continue |3.x/4.x/Silverlight, Lync |handlers |from Office 2013) |(AddVectoredContinueHandler | |, | |RemoveVectoredContinueHandl | |er) | Severity|enhancement |normal
--- Comment #5 from Anastasius Focht focht@gmx.net --- Hello Maxim,
thanks for the information. I'm changing the summary accordingly since this is no longer an "enhancement".
Regards
https://bugs.winehq.org/show_bug.cgi?id=30572
Damian Ivanov damianatorrpm@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |damianatorrpm@gmail.com
--- Comment #6 from Damian Ivanov damianatorrpm@gmail.com --- https://bugs.winehq.org/show_bug.cgi?id=33078 seems to be a duplicate of this one. So Lync 2010 also affected.
https://bugs.winehq.org/show_bug.cgi?id=30572
--- Comment #7 from Austin English austinenglish@gmail.com --- Created attachment 49921 --> https://bugs.winehq.org/attachment.cgi?id=49921 stubs
I don't have any applications listed to test, but here's some stubs that might help.
https://bugs.winehq.org/show_bug.cgi?id=30572
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |austinenglish@gmail.com
https://bugs.winehq.org/show_bug.cgi?id=30572
Sebastian Lackner sebastian@fds-team.de changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |sebastian@fds-team.de
https://bugs.winehq.org/show_bug.cgi?id=30572
--- Comment #8 from Sebastian Lackner sebastian@fds-team.de --- @Austin: The stub for RemoveVectoredContinueHandler is wrong, the function takes only one argument, and returns an ULONG instead of a PVOID.
A fixed version was added to the staging tree and works well with Silverlight (which detects at runtime if the function is present, and also works well without it):
https://github.com/wine-compholio/wine-staging/blob/master/patches/ntdll-Vec...
If some applications refuse to work when AddVectoredContinueHandler returns NULL - it is also safe to return some dummy value like (void *)0xdeadbeef, and let RemoveVectoredContinueHandler return TRUE. The structure is undocumented and its unlikely that any app tries to mess directly with the content.
Some technical details:
On Windows the exception handlers are executed in the following order: * vectored exception handlers * frame based exception handlers * unhandled exception handler * vectored continue handlers (<- at least if some documents are right, I was unable to verify that)
This implies that vectored continue handlers are only used for error reporting, as already described in Fochts description of this bug report. On some Windows systems (including all testbot VMs?!) they also seem to be just stubs - instead of running vectored continue handlers the test crashes. I looked at implementing these functions some time ago, and even wrote some tests, which I will attach here for reference. Nevertheless, those tests don't seem to work as expected, and are basically useless when we also allow "broken" behaviour. Maybe it depends on some Windows settings which error reporting tool is executed?
By the way: Implementing in Wine would be relatively difficult because the unhandled exception handler stuff is in kernel32.dll, but vectored continue handlers are in ntdll.dll. I didn't find any documentation on how native Windows deals with that? Should unhandled exception filter stuff be moved to ntdll? Is there some undocumented export which can be used to execute continue handlers?
https://bugs.winehq.org/show_bug.cgi?id=30572
--- Comment #9 from Sebastian Lackner sebastian@fds-team.de --- Created attachment 49934 --> https://bugs.winehq.org/attachment.cgi?id=49934 ntdll/tests: Add tests for vectored continue handlers.
Not ready for submission. Uses "ok(0, " instead of "trace(" to simplify debugging. Moreover on most (all?) machines the test seem to crash because vectored continue handlers are never executed.
https://bugs.winehq.org/show_bug.cgi?id=30572
--- Comment #10 from Austin English austinenglish@gmail.com --- https://source.winehq.org/patches/data/107640
https://bugs.winehq.org/show_bug.cgi?id=30572
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |4c0ceacee0413031f129d2e62be | |6a064f2cfae5b Status|NEW |RESOLVED Resolution|--- |FIXED
--- Comment #11 from Austin English austinenglish@gmail.com --- (In reply to Austin English from comment #10)
https://source.winehq.org/git/wine.git/commitdiff/4c0ceacee0413031f129d2e62b...
Since the patch works for Silverlight, marking fixed.
https://bugs.winehq.org/show_bug.cgi?id=30572
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #12 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 1.7.31.
https://bugs.winehq.org/show_bug.cgi?id=30572
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- URL| |https://web.archive.org/web | |/20101224185549/http://down | |load.microsoft.com/download | |/3/6/1/36190D2A-4138-4733-8 | |48E-5BB3D7ED960B/50917.00/r | |untime/Silverlight.exe Keywords| |download