+FSCTL_DISMOUNT_VOLUME define
[reactos.git] / ntoskrnl / ke / bug.c
index 4b3f76c..8bec9da 100644 (file)
@@ -56,6 +56,7 @@ BOOLEAN STDCALL
 KeDeregisterBugCheckCallback(PKBUGCHECK_CALLBACK_RECORD CallbackRecord)
 {
   UNIMPLEMENTED;
+  return FALSE;
 }
 
 BOOLEAN STDCALL
@@ -81,14 +82,59 @@ KeBugCheckWithTf(ULONG BugCheckCode,
                 ULONG BugCheckParameter4,
                 PKTRAP_FRAME Tf)
 {
-  KIRQL oldIrql;
-  KeRaiseIrql(HIGH_LEVEL, &oldIrql);
-  DbgPrint("Bug detected code: 0x%X\n", BugCheckCode);
+  PRTL_MESSAGE_RESOURCE_ENTRY Message;
+  NTSTATUS Status;
+  
+  __asm__("cli\n\t");
+  DbgPrint("Bug detected (code %x param %x %x %x %x)\n",
+          BugCheckCode,
+          BugCheckParameter1,
+          BugCheckParameter2,
+          BugCheckParameter3,
+          BugCheckParameter4);
+
+  Status = RtlFindMessage((PVOID)KERNEL_BASE, //0xC0000000,
+                         11, //RT_MESSAGETABLE,
+                         0x09, //0x409,
+                         BugCheckCode,
+                         &Message);
+  if (NT_SUCCESS(Status))
+    {
+      if (Message->Flags == 0)
+       DbgPrint("  %s\n", Message->Text);
+      else
+       DbgPrint("  %S\n", (PWSTR)Message->Text);
+    }
+  else
+    {
+      DbgPrint("  No message text found!\n\n");
+    }
+
+  if (InBugCheck == 1)
+    {
+      DbgPrint("Recursive bug check halting now\n");
+      for (;;)
+       {
+         __asm__ ("hlt\n\t");
+       }
+    }
+  InBugCheck = 1;
   KiDumpTrapFrame(Tf, BugCheckParameter1, BugCheckParameter2);
   MmDumpToPagingFile(BugCheckCode, BugCheckParameter1, 
                     BugCheckParameter2, BugCheckParameter3,
                     BugCheckParameter4, Tf);
-  for(;;);
+
+  if (KdDebuggerEnabled)
+    {
+      __asm__("sti\n\t");
+      DbgBreakPoint();
+      __asm__("cli\n\t");
+    }
+
+  for (;;)
+    {
+      __asm__("hlt\n\t");
+    }
 }
 
 VOID STDCALL
@@ -158,14 +204,18 @@ KeBugCheckEx(ULONG BugCheckCode,
   MmDumpToPagingFile(BugCheckCode, BugCheckParameter1, 
                     BugCheckParameter2, BugCheckParameter3,
                     BugCheckParameter4, NULL);
-  
+
   if (KdDebuggerEnabled)
     {
       __asm__("sti\n\t");
       DbgBreakPoint();
+      __asm__("cli\n\t");
     }
 
-  for(;;);
+  for (;;)
+    {
+      __asm__("hlt\n\t");
+    }
 }
 
 VOID STDCALL