That was dropped in 4752e252ea6ee084b679a9b9551a1c55f8744451 and it causes Metal Gear Solid V: Ground Zeroes to crash on start. The game debugs itself and closes an invalid handle as an anti-debug check.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com ---
I'm not sure why the try catch was removed, and maybe there's a better fix to it?
dlls/ntdll/unix/server.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/unix/server.c b/dlls/ntdll/unix/server.c index 4d7962fddc7..e45accf4f2b 100644 --- a/dlls/ntdll/unix/server.c +++ b/dlls/ntdll/unix/server.c @@ -87,6 +87,7 @@ #include "winnt.h" #include "wine/library.h" #include "wine/server.h" +#include "wine/exception.h" #include "wine/debug.h" #include "unix_private.h" #include "ddk/wdm.h" @@ -1634,6 +1635,11 @@ NTSTATUS WINAPI NtDuplicateObject( HANDLE source_process, HANDLE source, HANDLE return ret; }
+static LONG WINAPI invalid_handle_exception_handler( EXCEPTION_POINTERS *eptr ) +{ + EXCEPTION_RECORD *rec = eptr->ExceptionRecord; + return (rec->ExceptionCode == EXCEPTION_INVALID_HANDLE) ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH; +}
/************************************************************************** * NtClose @@ -1656,8 +1662,15 @@ NTSTATUS WINAPI NtClose( HANDLE handle ) if (!NtCurrentTeb()->Peb->BeingDebugged) return ret; if (!NtQueryInformationProcess( NtCurrentProcess(), ProcessDebugPort, &port, sizeof(port), NULL) && port) { - NtCurrentTeb()->ExceptionCode = ret; - pKiRaiseUserExceptionDispatcher(); + __TRY + { + NtCurrentTeb()->ExceptionCode = ret; + pKiRaiseUserExceptionDispatcher(); + } + __EXCEPT(invalid_handle_exception_handler) + { + } + __ENDTRY } return ret; }