Alexandre Julliard : include: Added definitions for the fault address exception information.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Sep 20 05:33:43 CDT 2006


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Sep 20 11:27:53 2006 +0200

include: Added definitions for the fault address exception information.

---

 dlls/kernel32/except.c        |    9 +++++----
 dlls/ntdll/signal_i386.c      |    3 ++-
 dlls/winex11.drv/dib.c        |    2 +-
 include/winnt.h               |   28 ++++++++++++++++++++++++++++
 programs/winedbg/tgt_active.c |    3 ++-
 5 files changed, 38 insertions(+), 7 deletions(-)

diff --git a/dlls/kernel32/except.c b/dlls/kernel32/except.c
index ed31ab9..1d2690e 100644
--- a/dlls/kernel32/except.c
+++ b/dlls/kernel32/except.c
@@ -117,8 +117,9 @@ static int format_exception_msg( const E
     case EXCEPTION_ACCESS_VIOLATION:
         if (rec->NumberParameters == 2)
             len = snprintf( buffer, size, "Unhandled page fault on %s access to 0x%08lx",
-                     rec->ExceptionInformation[0] ? "write" : "read",
-                     rec->ExceptionInformation[1]);
+                            rec->ExceptionInformation[0] == EXCEPTION_WRITE_FAULT ? "write" :
+                            rec->ExceptionInformation[0] == EXCEPTION_EXECUTE_FAULT ? "execute" : "read",
+                            rec->ExceptionInformation[1]);
         else
             len = snprintf( buffer, size, "Unhandled page fault");
         break;
@@ -448,11 +449,11 @@ LONG WINAPI UnhandledExceptionFilter(PEX
     {
         switch(rec->ExceptionInformation[0])
         {
-        case 1:  /* write access */
+        case EXCEPTION_WRITE_FAULT:
             if (check_resource_write( (void *)rec->ExceptionInformation[1] ))
                 return EXCEPTION_CONTINUE_EXECUTION;
             break;
-        case 8:  /* execute access */
+        case EXCEPTION_EXECUTE_FAULT:
             if (check_no_exec( (void *)rec->ExceptionInformation[1] ))
                 return EXCEPTION_CONTINUE_EXECUTION;
             break;
diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c
index 72144bd..6ff7e39 100644
--- a/dlls/ntdll/signal_i386.c
+++ b/dlls/ntdll/signal_i386.c
@@ -970,7 +970,8 @@ static void WINAPI raise_segv_exception(
     case EXCEPTION_ACCESS_VIOLATION:
         if (rec->NumberParameters == 2)
         {
-            if ((rec->ExceptionInformation[0] == 8) && check_atl_thunk( rec, context )) goto done;
+            if (rec->ExceptionInformation[0] == EXCEPTION_EXECUTE_FAULT && check_atl_thunk( rec, context ))
+                goto done;
             rec->ExceptionCode = VIRTUAL_HandleFault( (void *)rec->ExceptionInformation[1] );
         }
         break;
diff --git a/dlls/winex11.drv/dib.c b/dlls/winex11.drv/dib.c
index 51f57c8..9a615d9 100644
--- a/dlls/winex11.drv/dib.c
+++ b/dlls/winex11.drv/dib.c
@@ -4359,7 +4359,7 @@ static LONG CALLBACK X11DRV_DIB_FaultHan
     if (!found) return EXCEPTION_CONTINUE_SEARCH;
 
     X11DRV_DIB_Lock( physBitmap, DIB_Status_None, FALSE );
-    if (ep->ExceptionRecord->ExceptionInformation[0]) {
+    if (ep->ExceptionRecord->ExceptionInformation[0] == EXCEPTION_WRITE_FAULT) {
         /* the app tried to write the DIB bits */
         X11DRV_DIB_Coerce( physBitmap, DIB_Status_AppMod, FALSE );
     } else {
diff --git a/include/winnt.h b/include/winnt.h
index 3bbbcac..7ae686a 100644
--- a/include/winnt.h
+++ b/include/winnt.h
@@ -714,6 +714,10 @@ #define CONTEXT_FULL            CONTEXT8
 
 typedef CONTEXT86 CONTEXT;
 
+#define EXCEPTION_READ_FAULT    0
+#define EXCEPTION_WRITE_FAULT   1
+#define EXCEPTION_EXECUTE_FAULT 8
+
 #endif  /* __i386__ */
 
 typedef struct _LDT_ENTRY {
@@ -754,6 +758,10 @@ #define CONTEXT_DEBUG_REGISTERS (CONTEXT
 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT)
 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS)
 
+#define EXCEPTION_READ_FAULT    0
+#define EXCEPTION_WRITE_FAULT   1
+#define EXCEPTION_EXECUTE_FAULT 8
+
 typedef struct DECLSPEC_ALIGN(16) _M128A {
     ULONGLONG Low;
     LONGLONG High;
@@ -877,6 +885,10 @@ #define CONTEXT_FLOATING_POINT	(CONTEXT_
 #define CONTEXT_INTEGER		(CONTEXT_ALPHA | 0x00000004L)
 #define CONTEXT_FULL  (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
 
+#define EXCEPTION_READ_FAULT    0
+#define EXCEPTION_WRITE_FAULT   1
+#define EXCEPTION_EXECUTE_FAULT 8
+
 typedef struct _CONTEXT
 {
     /* selected by CONTEXT_FLOATING_POINT */
@@ -973,6 +985,10 @@ #define CONTEXT_INTEGER         (CONTEXT
 
 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER)
 
+#define EXCEPTION_READ_FAULT    0
+#define EXCEPTION_WRITE_FAULT   1
+#define EXCEPTION_EXECUTE_FAULT 8
+
 typedef struct _CONTEXT {
 	/* The flags values within this flag control the contents of
 	   a CONTEXT record.
@@ -1028,6 +1044,10 @@ #define CONTEXT_INTEGER         (CONTEXT
 
 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
 
+#define EXCEPTION_READ_FAULT    0
+#define EXCEPTION_WRITE_FAULT   1
+#define EXCEPTION_EXECUTE_FAULT 8
+
 typedef struct _CONTEXT
 {
     DWORD Argument[4];
@@ -1123,6 +1143,10 @@ #define CONTEXT_INTEGER         0x0004
 #define CONTEXT_DEBUG_REGISTERS 0x0008
 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
 
+#define EXCEPTION_READ_FAULT    0
+#define EXCEPTION_WRITE_FAULT   1
+#define EXCEPTION_EXECUTE_FAULT 8
+
 typedef struct
 {
     /* These are selected by CONTEXT_FLOATING_POINT */
@@ -1267,6 +1291,10 @@ #define CONTEXT_INTEGER         (CONTEXT
 
 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
 
+#define EXCEPTION_READ_FAULT    0
+#define EXCEPTION_WRITE_FAULT   1
+#define EXCEPTION_EXECUTE_FAULT 8
+
 typedef struct _CONTEXT
 {
     DWORD ContextFlags;
diff --git a/programs/winedbg/tgt_active.c b/programs/winedbg/tgt_active.c
index 3a1fb4f..7636b16 100644
--- a/programs/winedbg/tgt_active.c
+++ b/programs/winedbg/tgt_active.c
@@ -307,7 +307,8 @@ static DWORD dbg_handle_exception(const 
         case EXCEPTION_ACCESS_VIOLATION:
             if (rec->NumberParameters == 2)
                 dbg_printf("page fault on %s access to 0x%08lx",
-                           rec->ExceptionInformation[0] ? "write" : "read",
+                           rec->ExceptionInformation[0] == EXCEPTION_WRITE_FAULT ? "write" :
+                           rec->ExceptionInformation[0] == EXCEPTION_EXECUTE_FAULT ? "execute" : "read",
                            rec->ExceptionInformation[1]);
             else
                 dbg_printf("page fault");




More information about the wine-cvs mailing list