#include <freeldr.h>
#include <debug.h>
+DBG_DEFAULT_CHANNEL(WARNING);
+
VOID NTAPI HalpInitializePciStubs(VOID);
VOID NTAPI HalpInitBusHandler(VOID);
DebugInit();
- DPRINTM(DPRINT_WARNING, "BootMain() called.\n");
+ TRACE("BootMain() called.\n");
if (!UiInitialize(FALSE))
{
UiMessageBoxCritical("Unable to initialize UI.\n");
- return;
+ goto quit;
}
if (!MmInitializeMemoryManager())
{
UiMessageBoxCritical("Unable to initialize memory manager");
- return;
+ goto quit;
}
#ifdef _M_IX86
HalpInitBusHandler();
#endif
RunLoader();
+
+quit:
+ /* If we reach this point, something went wrong before, therefore reboot */
+ DiskStopFloppyMotor();
+ Reboot();
+}
+
+// We need to emulate these, because the original ones don't work in freeldr
+// These functions are here, because they need to be in the main compilation unit
+// and cannot be in a library.
+int __cdecl wctomb(char *mbchar, wchar_t wchar)
+{
+ *mbchar = (char)wchar;
+ return 1;
+}
+
+int __cdecl mbtowc (wchar_t *wchar, const char *mbchar, size_t count)
+{
+ *wchar = (wchar_t)*mbchar;
+ return 1;
+}
+
+// The wctype table is 144 KB, too much for poor freeldr
+int iswctype(wint_t wc, wctype_t wctypeFlags)
+{
+ return _isctype((char)wc, wctypeFlags);
}
+