kernel32: Raise DBG_PRINTEXCEPTION_C exception in OutputDebugStringA.

Sebastian Lackner sebastian at fds-team.de
Sun Jun 15 18:19:13 CDT 2014


Fixes http://bugs.winehq.org/show_bug.cgi?id=35646

This bug uncovered that Wines debug handling works totally different
than on Windows x86 and x86_64. Windows seems to use "special"
exceptions to communicate with its debugger. Its not sufficient that
Wine uses its own mechanism (via direct wineserver calls), because
vectored exception handlers can be used to intercept debugging events
from the same application, or even to implement an integrated user-mode
debugger.

This patch doesn't fix these problems, but as a first step just makes
Wine a bit more compatible, by raising and catching a (useless)
DBG_PRINTEXCEPTION_C exception. This is sufficient for the Obsidium DRM
module to think everything is well :)

As a next step, and to improve further compatibility with Windows, it
would be possible to remove the output_debug_string (and many other)
wineserver calls, and replace them with a similar __TRY {
RaiseException(...) }... block. Some tests on Windows suggest that a
debugger has no chance to differentiate between a real exception with
code DBG_* and a debug API call. The translation from exception codes to
actual debug events could be done either in the wineserver, or even in
kernel32 of the debugger process itself. Any opinions on that?

@ARM guys: Could someone of you guys confirm that the Windows RT
actually implements it the same way? (By running the wine exception tests)

---
 dlls/kernel32/debugger.c     |   21 +++++++++++++++++++++
 dlls/ntdll/tests/exception.c |   41
+++++++++++++++++++++++++++++++++++++++++
 include/ntstatus.h           |    1 +
 include/winnt.h              |    1 +
 4 files changed, 64 insertions(+)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-kernel32-Raise-DBG_PRINTEXCEPTION_C-exception-in-Out.patch
Type: text/x-patch
Size: 5287 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20140616/f055e4f0/attachment-0001.bin>


More information about the wine-patches mailing list