[3/4] server: Process OutputDebugString events like regular exceptions.

Sebastian Lackner sebastian at fds-team.de
Thu Jun 19 23:24:56 CDT 2014


As recently mentioned in one of my other patches, Windows internally
processes debug string events the same way as regular exceptions. This
patch removes the output_debug_string wineserver call, and instead uses
always an exception to send debug strings to the debugger. The
wineserver function queue_exception_event is then responsible to
translate exceptions into the corresponding debug events. Make sure to
run ./tools/make_requests after applying this patch.

NOTE1: Besides the fact that this is more like its done on Windows, the
previous solution also had a critical bug. output_debug_string returned
immediately, but the string was not copied. As the debugger has to grab
the string with ReadProcessMemory from the target process (see:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms680545(v=vs.85).aspx
) this could lead to race-conditions, when the memory is not available
anymore. Moreover the continue status code was ignored (-> part 4 shows
that this should not be the case).

NOTE2: As you will see in part 4 I had to add a todo_wine at one point
to the exception tests, where the behaviour still doesn't match native:
For some unknown reason when OutputDebugStringA (or manually generating
such an exception) is continued with DBG_EXCEPTION_NOT_HANDLED, then the
exception handler will be called _twice_. I have no explanation for that
and it doesn't make any sense (Windows bug?), so I didn't care about
reproducing this exact behaviour yet. Also other people were wondering
about this and have no explanation, see for example this blog:
http://maximumcrack.wordpress.com/2009/06/22/outputdebugstring-awesomeness/

NOTE3: I haven't tested all other debugger exception codes yet, but I
assume that we will have to add at least one additional translation from
exception to debug event for RIP_EVENT.

---
 dlls/kernel32/debugger.c |   21 +++++----------------
 server/debugger.c        |   39 ++++++++++++++++++++-------------------
 server/protocol.def      |    7 -------
 3 files changed, 25 insertions(+), 42 deletions(-)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-server-Process-OutputDebugString-events-like-regular.patch
Type: text/x-patch
Size: 4883 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20140620/68530c64/attachment-0001.bin>


More information about the wine-patches mailing list