https://bugs.winehq.org/show_bug.cgi?id=37669
--- Comment #26 from Dmitry Timoshkov dmitry@baikal.ru --- (In reply to Sebastian Lackner from comment #25)
Thanks for tracking this down. I don't think its easily possible to introduce proper exception handling on the signal stack. Exceptions introduced while wine is in "kernel mode" have to be handled completely different, and should never be forwarded to debuggers or other exception handlers, so a simple SEH2 exception handler is not sufficient.
I don't think the problem with AcceptEx() is that hard to fix. If I didn't miss anything the patch I just added should be sufficient. Would you please test again?
https://github.com/wine-compholio/wine-staging/tree/master/patches/ws2_32- WriteWatches
With that patch applied in addition to previous series now the application crashes at (it's the match to the patched version) http://source.winehq.org/git/wine.git/blob/HEAD:/dlls/ws2_32/socket.c#l2009 WS2_async_recv is called from WS2_async_accept_recv, which in turn is another async callback of AcceptEx.
So, it's an improvement, the crash has moved to a later used code block. But it's really a pain to track all this down, although I have specially invented hacks to make my life a bit easier.
The fix for NtReadFile is not complete unfortunately. Async handling of NtReadFile is handled in FILE_AsyncReadService(), and it should be changed there too
I didn't need an async part (and couldn't test the fix) since the app here is reading from disk files, so I didn't bother with that.