From 7e79b5656e5fa88e224f118b69c534c3312c38be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Zalewski?= Date: Tue, 14 Aug 2007 11:47:56 -0700 Subject: [PATCH] kernel32: Return error code if WOWCallback16Ex of a real-mode function failed. --- dlls/kernel32/wowthunk.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/dlls/kernel32/wowthunk.c b/dlls/kernel32/wowthunk.c index 4f714ab6317..2ccfddff39c 100644 --- a/dlls/kernel32/wowthunk.c +++ b/dlls/kernel32/wowthunk.c @@ -23,6 +23,7 @@ #include #include +#include #include "wine/winbase16.h" #include "windef.h" @@ -587,9 +588,19 @@ BOOL WINAPI K32WOWCallback16Ex( DWORD vpfn16, DWORD dwFlags, { EXCEPTION_REGISTRATION_RECORD frame; frame.Handler = vm86_handler; + errno = 0; __wine_push_frame( &frame ); __wine_enter_vm86( context ); __wine_pop_frame( &frame ); + if (errno != 0) /* enter_vm86 will fall with ENOSYS on x64 kernels */ + { + ERR("__wine_enter_vm86 failed (errno=%d)\n", errno); + if (errno == ENOSYS) + SetLastError(ERROR_NOT_SUPPORTED); + else + SetLastError(ERROR_GEN_FAILURE); + return FALSE; + } } else {