From 198a00bc9eeb2d2fcf5122fa8b7de38bb4fb526d Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 25 Feb 2008 19:49:27 +0100 Subject: [PATCH] ntdll: Add an exception handler around check_actctx to catch bad handles. --- dlls/ntdll/actctx.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/dlls/ntdll/actctx.c b/dlls/ntdll/actctx.c index 60128bcc1e1..8f9a2c146ea 100644 --- a/dlls/ntdll/actctx.c +++ b/dlls/ntdll/actctx.c @@ -33,6 +33,7 @@ #define WIN32_NO_STATUS #include "winternl.h" #include "ntdll_misc.h" +#include "wine/exception.h" #include "wine/debug.h" #include "wine/unicode.h" @@ -568,16 +569,18 @@ static WCHAR *build_assembly_id( const struct assembly_identity *ai ) static ACTIVATION_CONTEXT *check_actctx( HANDLE h ) { - ACTIVATION_CONTEXT *actctx = h; + ACTIVATION_CONTEXT *ret = NULL, *actctx = h; if (!h || h == INVALID_HANDLE_VALUE) return NULL; - switch (actctx->magic) + __TRY { - case ACTCTX_MAGIC: - return actctx; - default: - return NULL; + if (actctx->magic == ACTCTX_MAGIC) ret = actctx; } + __EXCEPT_PAGE_FAULT + { + } + __ENDTRY + return ret; } static inline void actctx_addref( ACTIVATION_CONTEXT *actctx )