Alexandre Julliard : ntdll: Add an exception handler around check_actctx to catch bad handles.

Alexandre Julliard julliard at winehq.org
Mon Feb 25 14:21:27 CST 2008


Module: wine
Branch: master
Commit: 198a00bc9eeb2d2fcf5122fa8b7de38bb4fb526d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=198a00bc9eeb2d2fcf5122fa8b7de38bb4fb526d

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Feb 25 19:49:27 2008 +0100

ntdll: Add an exception handler around check_actctx to catch bad handles.

---

 dlls/ntdll/actctx.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/dlls/ntdll/actctx.c b/dlls/ntdll/actctx.c
index 60128bc..8f9a2c1 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 )




More information about the wine-cvs mailing list