Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions mono/mini/exceptions-x86.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ static MonoW32ExceptionHandler segv_handler;

static LPTOP_LEVEL_EXCEPTION_FILTER old_handler;

#ifndef PROCESS_CALLBACK_FILTER_ENABLED
# define PROCESS_CALLBACK_FILTER_ENABLED 1
#endif

#define W32_SEH_HANDLE_EX(_ex) \
if (_ex##_handler) _ex##_handler(0, er, sctx)

Expand Down Expand Up @@ -833,6 +837,27 @@ mono_arch_get_throw_corlib_exception (void)
void
mono_arch_exceptions_init (void)
{
/*
* If we're running WoW64, we need to set the usermode exception policy
* for SEHs to behave. This requires hotfix http://support.microsoft.com/kb/976038
* or (eventually) Windows 7 SP1.
*/
#ifdef PLATFORM_WIN32
DWORD flags;
FARPROC getter;
FARPROC setter;
HMODULE kernel32 = LoadLibraryW (L"kernel32.dll");

if (kernel32) {
getter = GetProcAddress (kernel32, "GetProcessUserModeExceptionPolicy");
setter = GetProcAddress (kernel32, "SetProcessUserModeExceptionPolicy");
if (getter && setter) {
if (getter (&flags))
setter (flags & ~PROCESS_CALLBACK_FILTER_ENABLED);
}
}
#endif

if (mono_aot_only) {
signal_exception_trampoline = mono_aot_get_named_code ("x86_signal_exception_trampoline");
return;
Expand Down