[CMAKE]
[reactos.git] / boot / freeldr / freeldr / debug.c
index 6aebbd1..08f49bd 100644 (file)
@@ -66,6 +66,19 @@ ULONG                BaudRate = 115200;
 
 BOOLEAN        DebugStartOfLine = TRUE;
 
+// We need to emulate these, because the original ones don't work in freeldr
+int __cdecl wctomb(char *mbchar, wchar_t wchar)
+{
+    *mbchar = wchar;
+    return 1;
+}
+
+int __cdecl mbtowc (wchar_t *wchar, const char *mbchar, size_t count)
+{
+    *wchar = *mbchar;
+    return 1;
+}
+
 VOID DebugInit(VOID)
 {
        if (DebugPort & RS232)
@@ -173,6 +186,12 @@ VOID DebugPrintHeader(ULONG Mask)
        case DPRINT_HWDETECT:
            DbgPrint("HWDETECT: ");
                break;
+       case DPRINT_PELOADER:
+           DbgPrint("PELOADER: ");
+               break;
+       case DPRINT_SCSIPORT:
+           DbgPrint("SCSIPORT: ");
+               break;
        default:
            DbgPrint("UNKNOWN: ");
                break;
@@ -194,6 +213,12 @@ VOID DbgPrintMask(ULONG Mask, char *format, ...)
                return;
        }
 
+       // Disable file/line for scsiport messages
+       if (Mask & DPRINT_SCSIPORT)
+       {
+               DebugStartOfLine = FALSE;
+       }
+
        // Print the header if we have started a new line
        if (DebugStartOfLine)
        {
@@ -328,3 +353,21 @@ MsgBoxPrint(const char *Format, ...)
        return 0;
 }
 
+NTKERNELAPI
+VOID
+NTAPI
+KeBugCheckEx(
+    IN ULONG  BugCheckCode,
+    IN ULONG_PTR  BugCheckParameter1,
+    IN ULONG_PTR  BugCheckParameter2,
+    IN ULONG_PTR  BugCheckParameter3,
+    IN ULONG_PTR  BugCheckParameter4)
+{
+    char Buffer[70];
+    sprintf(Buffer, "*** STOP: 0x%08lX (0x%08lX, 0x%08lX, 0x%08lX, 0x%08lX)",
+        BugCheckCode, BugCheckParameter1, BugCheckParameter2,
+        BugCheckParameter3, BugCheckParameter4);
+    UiMessageBoxCritical(Buffer);
+    assert(FALSE);
+    for (;;);
+}