Big merge: thanks alex and greatlord. Not a complete merge but most
[reactos.git] / reactos / boot / freeldr / freeldr / reactos / reactos.c
index 441664f..8db5c05 100644 (file)
@@ -820,7 +820,11 @@ LoadAndBootReactOS(PCSTR OperatingSystemName)
        /*
         * Import the loaded system hive
         */
-       RegImportBinaryHive((PCHAR)Base, Size);
+       if( !RegImportBinaryHive((PCHAR)Base, Size) )
+       {
+           printf("Could not load system hive\n");
+           return;
+       }
 
        /*
         * Initialize the 'CurrentControlSet' link
@@ -870,10 +874,34 @@ LoadAndBootReactOS(PCSTR OperatingSystemName)
 
 #undef DbgPrint
 ULONG
-DbgPrint(char *Fmt, ...)
+__cdecl
+DbgPrint(PCCH Format, ...)
 {
-  UiMessageBox(Fmt);
-  return 0;
+       va_list ap;
+       CHAR Buffer[512];
+       ULONG Length;
+
+       va_start(ap, Format);
+
+       /* Construct a string */
+       Length = _vsnprintf(Buffer, 512, Format, ap);
+
+       /* Check if we went past the buffer */
+       if (Length == -1)
+       {
+               /* Terminate it if we went over-board */
+               Buffer[sizeof(Buffer) - 1] = '\n';
+
+               /* Put maximum */
+               Length = sizeof(Buffer);
+       }
+
+       /* Show it as a message box */
+       UiMessageBox(Buffer);
+
+       /* Cleanup and exit */
+       va_end(ap);
+       return 0;
 }
 
 /* EOF */