Ejemplo n.º 1
0
VOID __cdecl BootMain(IN PCCH CmdLine)
{
    CmdLineParse(CmdLine);

    /* Debugger pre-initialization */
    DebugInit(FALSE);

    TRACE("BootMain() called.\n");

    MachInit(CmdLine);

    /* Check if the CPU is new enough */
    FrLdrCheckCpuCompatibility(); // FIXME: Should be done inside MachInit!

    /* UI pre-initialization */
    if (!UiInitialize(FALSE))
    {
        UiMessageBoxCritical("Unable to initialize UI.");
        goto Quit;
    }

    /* Initialize memory manager */
    if (!MmInitializeMemoryManager())
    {
        UiMessageBoxCritical("Unable to initialize memory manager.");
        goto Quit;
    }

    /* Initialize I/O subsystem */
    FsInit();

    RunLoader();

Quit:
    /* If we reach this point, something went wrong before, therefore reboot */
#if defined(__i386__) || defined(_M_AMD64)
    DiskStopFloppyMotor();
#endif
    Reboot();
}
Ejemplo n.º 2
0
VOID BootMain(LPSTR CmdLine)
{
    CmdLineParse(CmdLine);

    MachInit(CmdLine);

    FsInit();

    DebugInit();

    TRACE("BootMain() called.\n");

    /* Check if the CPU is new enough */
    FrLdrCheckCpuCompatiblity();

    if (!UiInitialize(FALSE))
    {
        UiMessageBoxCritical("Unable to initialize UI.\n");
        goto quit;
    }

    if (!MmInitializeMemoryManager())
    {
        UiMessageBoxCritical("Unable to initialize memory manager");
        goto quit;
    }

#ifdef _M_IX86
	HalpInitializePciStubs();
	HalpInitBusHandler();
#endif
	RunLoader();

quit:
    /* If we reach this point, something went wrong before, therefore reboot */
    DiskStopFloppyMotor();
    Reboot();
}
Ejemplo n.º 3
0
VOID RunLoader(VOID)
{
    ULONG_PTR SectionId;
    ULONG     OperatingSystemCount;
    OperatingSystemItem* OperatingSystemList;
    PCSTR*    OperatingSystemDisplayNames;
    ULONG     DefaultOperatingSystem;
    LONG      TimeOut;
    ULONG     SelectedOperatingSystem;
    ULONG     i;

    if (!MachInitializeBootDevices())
    {
        UiMessageBoxCritical("Error when detecting hardware.");
        return;
    }

#ifdef _M_IX86
    /* Load additional SCSI driver (if any) */
    if (LoadBootDeviceDriver() != ESUCCESS)
    {
        UiMessageBoxCritical("Unable to load additional boot device drivers.");
    }
#endif

    if (!IniFileInitialize())
    {
        UiMessageBoxCritical("Error initializing .ini file.");
        return;
    }

    /* Debugger main initialization */
    DebugInit(TRUE);

    if (!IniOpenSection("FreeLoader", &SectionId))
    {
        UiMessageBoxCritical("Section [FreeLoader] not found in freeldr.ini.");
        return;
    }

    TimeOut = GetTimeOut();

    /* UI main initialization */
    if (!UiInitialize(TRUE))
    {
        UiMessageBoxCritical("Unable to initialize UI.");
        return;
    }

    OperatingSystemList = InitOperatingSystemList(&OperatingSystemCount);
    if (!OperatingSystemList)
    {
        UiMessageBox("Unable to read operating systems section in freeldr.ini.\nPress ENTER to reboot.");
        goto Reboot;
    }

    if (OperatingSystemCount == 0)
    {
        UiMessageBox("There were no operating systems listed in freeldr.ini.\nPress ENTER to reboot.");
        goto Reboot;
    }

    DefaultOperatingSystem = GetDefaultOperatingSystem(OperatingSystemList, OperatingSystemCount);

    /* Create list of display names */
    OperatingSystemDisplayNames = FrLdrTempAlloc(sizeof(PCSTR) * OperatingSystemCount, 'mNSO');
    if (!OperatingSystemDisplayNames)
        goto Reboot;

    for (i = 0; i < OperatingSystemCount; i++)
    {
        OperatingSystemDisplayNames[i] = OperatingSystemList[i].LoadIdentifier;
    }

    /* Find all the message box settings and run them */
    UiShowMessageBoxesInSection("FreeLoader");

    for (;;)
    {
        /* Redraw the backdrop */
        UiDrawBackdrop();

        /* Show the operating system list menu */
        if (!UiDisplayMenu("Please select the operating system to start:",
                           "For troubleshooting and advanced startup options for "
                               "ReactOS, press F8.",
                           TRUE,
                           OperatingSystemDisplayNames,
                           OperatingSystemCount,
                           DefaultOperatingSystem,
                           TimeOut,
                           &SelectedOperatingSystem,
                           FALSE,
                           MainBootMenuKeyPressFilter))
        {
            UiMessageBox("Press ENTER to reboot.");
            goto Reboot;
        }

        TimeOut = -1;

        /* Load the chosen operating system */
        LoadOperatingSystem(&OperatingSystemList[SelectedOperatingSystem]);
    }

Reboot:
    UiUnInitialize("Rebooting...");
    return;
}
Ejemplo n.º 4
0
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
	HINSTANCE v4; // esi
	//int v11; // ecx
	char Filename[260]; // [esp+8h] [ebp-10Ch]
	char value_name[8]; // [esp+10Ch] [ebp-8h]

	v4 = hInstance;
#ifndef DEBUGGER
	diablo_reload_process(hInstance);
#endif
	ghInst = v4;
	if ( RestrictedTest() )
		ErrDlg(TEMPLATE_ERR_RESTRICTED, 0, "C:\\Src\\Diablo\\Source\\DIABLO.CPP", 877);
	if ( ReadOnlyTest() )
	{
		if ( !GetModuleFileNameA(ghInst, Filename, 0x104u) )
			*Filename = '\0';
		DirErrDlg(Filename);
	}
	ShowCursor(FALSE);
	srand(GetTickCount());
	encrypt_init_lookup_table();
	exception_get_filter();
	if ( !diablo_find_window("DIABLO") && diablo_get_not_running() )
	{
		diablo_init_screen();
		diablo_parse_flags(lpCmdLine);
		init_create_window();
		sound_init();
		UiInitialize();
#ifdef _DEBUG
		if ( showintrodebug )
			play_movie("gendata\\logo.smk", 1);
#else
		play_movie("gendata\\logo.smk", 1);
#endif
		strcpy(value_name, "Intro");
		if ( !SRegLoadValue("Diablo", value_name, 0, (int *)&hInstance) )
			hInstance = (HINSTANCE)1;
		if ( hInstance )
			play_movie("gendata\\diablo1.smk", 1);
		SRegSaveValue("Diablo", value_name, 0, 0);
#ifdef _DEBUG
		if ( showintrodebug )
		{
			UiTitleDialog(7);
			BlackPalette();
		}
#else
		UiTitleDialog(7);
		BlackPalette();
#endif
		mainmenu_action(0); /* v11 fix unused arg */
		UiDestroy();
		palette_save_gamme();
		if ( ghMainWnd )
		{
			Sleep(300);
			DestroyWindow(ghMainWnd);
		}
	}
	return 0;
}