- Stub out ExpSystemErrorHandler more properly.
[reactos.git] / reactos / ntoskrnl / ex / harderr.c
index 74a5fde..266fefc 100644 (file)
@@ -12,7 +12,7 @@
 #define NDEBUG
 #include <debug.h>
 
-#define TAG_ERR TAG('E', 'r', 'r', ' ')
+#define TAG_ERR ' rrE'
 
 /* GLOBALS ****************************************************************/
 
@@ -23,7 +23,7 @@ PEPROCESS ExpDefaultErrorPortProcess = NULL;
 /* FUNCTIONS ****************************************************************/
 
 /*++
-* @name ExpRaiseHardError
+* @name ExpSystemErrorHandler
 *
 * For now it's a stub
 *
@@ -58,10 +58,26 @@ ExpSystemErrorHandler(IN NTSTATUS ErrorStatus,
                       IN PULONG_PTR Parameters,
                       IN BOOLEAN Shutdown)
 {
+    ULONG_PTR BugCheckParameters[MAXIMUM_HARDERROR_PARAMETERS] = {0, 0, 0, 0};
+    ULONG i;
+
+    /* Sanity check */
+    ASSERT(NumberOfParameters <= MAXIMUM_HARDERROR_PARAMETERS);
+
+    /*
+     * KeBugCheck expects MAXIMUM_HARDERROR_PARAMETERS parameters,
+     * but we might get called with less, so use a local buffer here.
+     */
+    for (i = 0; i < NumberOfParameters; i++)
+    {
+        /* Copy them over */
+        BugCheckParameters[i] = Parameters[i];
+    }
+
     /* FIXME: STUB */
     KeBugCheckEx(FATAL_UNHANDLED_HARD_ERROR,
                  ErrorStatus,
-                 0,
+                 (ULONG_PTR)BugCheckParameters,
                  0,
                  0);
     return STATUS_SUCCESS;
@@ -505,7 +521,7 @@ ExRaiseHardError(IN NTSTATUS ErrorStatus,
  *        Optional string parameter (can be only one per error code)
  *
  * @param Parameters
- *        Array of ULONG parameters for use in error message string
+ *        Array of ULONG_PTR parameters for use in error message string
  *
  * @param ValidResponseOptions
  *        See HARDERROR_RESPONSE_OPTION for possible values description
@@ -572,7 +588,7 @@ NtRaiseHardError(IN NTSTATUS ErrorStatus,
         }
 
         /* Enter SEH Block */
-        _SEH_TRY
+        _SEH2_TRY
         {
             /* Validate the response pointer */
             ProbeForWriteUlong(Response);
@@ -620,16 +636,15 @@ NtRaiseHardError(IN NTSTATUS ErrorStatus,
                 }
             }
         }
-        _SEH_EXCEPT(_SEH_ExSystemExceptionFilter)
+        _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
         {
             /* Free captured buffer */
             if (SafeParams) ExFreePool(SafeParams);
-            Status = _SEH_GetExceptionCode();
-        }
-        _SEH_END;
 
-        /* If we failed to capture/probe, bail out */
-        if (!NT_SUCCESS(Status)) return Status;
+            /* Return the exception code */
+            _SEH2_YIELD(return _SEH2_GetExceptionCode());
+        }
+        _SEH2_END;
 
         /* Call the system function directly, because we probed */
         ExpRaiseHardError(ErrorStatus,
@@ -663,16 +678,17 @@ NtRaiseHardError(IN NTSTATUS ErrorStatus,
         if (SafeParams) ExFreePool(SafeParams);
 
         /* Enter SEH Block for return */
-        _SEH_TRY
+        _SEH2_TRY
         {
             /* Return the response */
             *Response = SafeResponse;
         }
-        _SEH_EXCEPT(_SEH_ExSystemExceptionFilter)
+        _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
         {
-            Status = _SEH_GetExceptionCode();
+            /* Get the exception code */
+            Status = _SEH2_GetExceptionCode();
         }
-        _SEH_END;
+        _SEH2_END;
     }
     else
     {