Index: trunk/src/helpers/except.c
===================================================================
--- trunk/src/helpers/except.c	(revision 434)
+++ trunk/src/helpers/except.c	(revision 435)
@@ -300,5 +300,10 @@
     }
     else if (arc == ERROR_INVALID_ADDRESS)
-        fprintf(file, "invalid");
+    {
+        if (ulCheck < 0x10000)
+            fprintf(file, "not an address");
+        else
+            fprintf(file, "invalid address");
+    }
 }
 
@@ -443,20 +448,12 @@
  *      This calls excPrintStackFrame for each stack frame.
  *
- *@@changed V0.9.0 [umoeller]: added support for application hook
- *@@changed V0.9.0 (99-11-02) [umoeller]: added TID to dump
- *@@changed V0.9.2 (2000-03-10) [umoeller]: now using excPrintStackFrame
- *@@changed V0.9.3 (2000-05-03) [umoeller]: fixed crashes
- *@@changed V0.9.6 (2000-11-06) [umoeller]: added more register dumps
- *@@changed V0.9.13 (2001-06-19) [umoeller]: added global flag for whether this is running
- *@@changed V0.9.16 (2001-11-02) [pr]: make object display signed
- *@@changed V0.9.19 (2002-03-28) [umoeller]: added thread ordinal
- *@@changed V1.0.0 (2002-08-28) [umoeller]: added OS revision to dump
  *@@changed XWP V1.0.9 (2010-04-16) [pr]: add variable initialisation
  */
 
-VOID excExplainException(FILE *file,                   // in: logfile from fopen()
-                         PSZ pszHandlerName,           // in: descriptive string
-                         PEXCEPTIONREPORTRECORD pReportRec, // in: excpt info
-                         PCONTEXTRECORD pContextRec)   // in: excpt info
+VOID excExplainException2(FILE *file,                               // in: logfile from fopen()
+                          PSZ pszHandlerName,                       // in: descriptive string
+                          PEXCEPTIONREPORTRECORD pReportRec,        // in: excpt info
+                          PCONTEXTRECORD pContextRec,               // in: excpt info
+                          PEXCEPTIONREGISTRATIONRECORD2 pRegRec2)   // in: reg info
 {
     ULONG       aulBuf[3];
@@ -666,4 +663,27 @@
             fprintf(file, "\nProcess information was not available.");
 
+        // avoid trouble if the developer is using an older version of except.h
+#ifdef TRY_V2
+        if (pRegRec2 &&
+            pRegRec2->pvUser == &(pRegRec2->pszSetBy) &&
+            pRegRec2->pszSetBy)
+        {
+            fprintf(file,
+                    "\nException handler:"
+                    "\n    Set by:          %s\n",
+                    pRegRec2->pszSetBy ? pRegRec2->pszSetBy : "unknown");
+
+            if (pRegRec2->pszFmt)
+            {
+                fprintf(file, "    Details:         ");
+                fprintf(file, pRegRec2->pszFmt,
+                        pRegRec2->ulArg1, pRegRec2->ulArg2,
+                        pRegRec2->ulArg3, pRegRec2->ulArg4);
+            }
+        }
+#endif
+
+        fprintf(file, "\n");
+
         /*
          *  now call the hook, if one has been defined,
@@ -680,16 +700,8 @@
         if (pContextRec->ContextFlags & CONTEXT_INTEGER)
         {
-            // DS the following 4 added V0.9.6 (2000-11-06) [umoeller]
             fprintf(file, "\n    DS  = %08lX  ", pContextRec->ctx_SegDs);
-            excDescribePage(file, pContextRec->ctx_SegDs);
-            // ES
             fprintf(file, "\n    ES  = %08lX  ", pContextRec->ctx_SegEs);
-            excDescribePage(file, pContextRec->ctx_SegEs);
-            // FS
             fprintf(file, "\n    FS  = %08lX  ", pContextRec->ctx_SegFs);
-            excDescribePage(file, pContextRec->ctx_SegFs);
-            // GS
             fprintf(file, "\n    GS  = %08lX  ", pContextRec->ctx_SegGs);
-            excDescribePage(file, pContextRec->ctx_SegGs);
 
             // EAX
@@ -721,5 +733,5 @@
             // *** instruction
 
-            fprintf(file, "Instruction pointer (where exception occurred):\n    CS:EIP = %04lX:%08lX  ",
+            fprintf(file, "\nInstruction pointer (where exception occurred):\n    CS:EIP = %04lX:%08lX  ",
                     pContextRec->ctx_SegCs,
                     pContextRec->ctx_RegEip);
@@ -728,5 +740,5 @@
             // *** CPU flags
 
-            fprintf(file, "\n    EFLAGS = %08lX", pContextRec->ctx_EFlags);
+            fprintf(file, "\n    EFLAGS = %08lX\n", pContextRec->ctx_EFlags);
 
             /*
@@ -766,4 +778,12 @@
     // lower global flag again V0.9.13 (2001-06-19) [umoeller]
     G_ulExplainExceptionRunning--;
+}
+
+VOID excExplainException(FILE *file,                   // in: logfile from fopen()
+                         PSZ pszHandlerName,           // in: descriptive string
+                         PEXCEPTIONREPORTRECORD pReportRec, // in: excpt info
+                         PCONTEXTRECORD pContextRec)   // in: excpt info
+{
+    excExplainException2(file, pszHandlerName, pReportRec, pContextRec, 0);
 }
 
@@ -962,8 +982,9 @@
             {
                 // write error log
-                excExplainException(file,
-                                    "excHandlerLoud",
-                                    pReportRec,
-                                    pContextRec);
+                excExplainException2(file,
+                                     "excHandlerLoud",
+                                     pReportRec,
+                                     pContextRec,
+                                     pRegRec2);
                 fclose(file);
             }
@@ -1031,5 +1052,6 @@
                                     "excHandlerQuiet",
                                     pReportRec,
-                                    pContextRec);
+                                    pContextRec
+                                    pRegRec2);
                 fclose(file);
             }
