ReactOS 0.4.16-dev-338-g34e76ad
freeldr.c
Go to the documentation of this file.
1/*
2 * FreeLoader
3 * Copyright (C) 1998-2003 Brian Palmer <brianp@sginet.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20/* INCLUDES *******************************************************************/
21
22#include <freeldr.h>
23
24#include <debug.h>
26
27/* GLOBALS ********************************************************************/
28
30
31/* FUNCTIONS ******************************************************************/
32
34{
35 /* Load the default settings from the command-line */
37
38 /* Debugger pre-initialization */
40
42
43 TRACE("BootMain() called.\n");
44
45#ifndef UEFIBOOT
46 /* Check if the CPU is new enough */
47 FrLdrCheckCpuCompatibility(); // FIXME: Should be done inside MachInit!
48#endif
49
50 /* UI pre-initialization */
51 if (!UiInitialize(FALSE))
52 {
53 UiMessageBoxCritical("Unable to initialize UI.");
54 goto Quit;
55 }
56
57 /* Initialize memory manager */
59 {
60 UiMessageBoxCritical("Unable to initialize memory manager.");
61 goto Quit;
62 }
63
64 /* Initialize I/O subsystem */
65 FsInit();
66
67 /* Initialize the module list */
69 {
70 UiMessageBoxCritical("Unable to initialize module list.");
71 goto Quit;
72 }
73
74 RunLoader();
75
76Quit:
77 /* If we reach this point, something went wrong before, therefore reboot */
78 Reboot();
79}
80
81// We need to emulate these, because the original ones don't work in freeldr
82// These functions are here, because they need to be in the main compilation unit
83// and cannot be in a library.
84int __cdecl wctomb(char *mbchar, wchar_t wchar)
85{
86 *mbchar = (char)wchar;
87 return 1;
88}
89
90int __cdecl mbtowc(wchar_t *wchar, const char *mbchar, size_t count)
91{
92 *wchar = (wchar_t)*mbchar;
93 return 1;
94}
95
96// The wctype table is 144 KB, too much for poor freeldr
97int __cdecl iswctype(wint_t wc, wctype_t wctypeFlags)
98{
99 return _isctype((char)wc, wctypeFlags);
100}
101
102#ifdef _MSC_VER
103#pragma warning(disable:4164)
104#pragma function(pow)
105#pragma function(log)
106#pragma function(log10)
107#endif
108
109// Stubs to avoid pulling in data from CRT
110double pow(double x, double y)
111{
112 __debugbreak();
113 return 0.0;
114}
115
116double log(double x)
117{
118 __debugbreak();
119 return 0.0;
120}
121
122double log10(double x)
123{
124 __debugbreak();
125 return 0.0;
126}
#define WARNING
Definition: BusLogic958.h:56
int wint_t
Definition: _apple.h:38
#define __cdecl
Definition: accygwin.h:79
void LoadSettings(void)
Definition: settings.c:53
@ Reboot
Definition: bl.h:891
#define DebugInit(DebugString)
Definition: debug.h:120
#define DBG_DEFAULT_CHANNEL(ch)
Definition: debug.h:106
VOID FsInit(VOID)
Definition: fs.c:646
BOOLEAN MmInitializeMemoryManager(VOID)
Definition: meminit.c:315
BOOTMGRINFO BootMgrInfo
Definition: settings.c:18
VOID UiMessageBoxCritical(_In_ PCSTR MessageText)
Definition: ui.c:372
BOOLEAN UiInitialize(BOOLEAN ShowUi)
Definition: ui.c:92
unsigned short wctype_t
Definition: crtdefs.h:217
#define FALSE
Definition: types.h:117
#define MAX_PATH
Definition: compat.h:34
static const WCHAR CmdLine[]
Definition: install.c:48
unsigned char
Definition: typeof.h:29
VOID RunLoader(VOID)
Definition: bootmgr.c:356
VOID __cdecl BootMain(IN PCCH CmdLine)
Definition: freeldr.c:33
CCHAR FrLdrBootPath[MAX_PATH]
Definition: freeldr.c:29
double log10(double x)
Definition: freeldr.c:122
double pow(double x, double y)
Definition: freeldr.c:110
int __cdecl iswctype(wint_t wc, wctype_t wctypeFlags)
Definition: freeldr.c:97
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLuint GLuint GLsizei count
Definition: gl.h:1545
_Check_return_ _CRTIMP int __cdecl _isctype(_In_ int _C, _In_ int _Type)
void __cdecl __debugbreak(void)
Definition: intrin_ppc.h:698
VOID FrLdrCheckCpuCompatibility(VOID)
Definition: macharm.c:65
VOID MachInit(IN PCCH CommandLine)
Definition: macharm.c:182
CONST CHAR * PCCH
Definition: ntbasedef.h:400
BOOLEAN PeLdrInitializeModuleList(VOID)
Definition: peloader.c:525
#define log(outFile, fmt,...)
Definition: util.h:15
#define TRACE(s)
Definition: solgame.cpp:4
PCSTR DebugString
Definition: settings.h:12
#define wctomb(cp, wc)
Definition: wchar.h:161
#define wchar_t
Definition: wchar.h:102
#define mbtowc(wp, cp, len)
Definition: wchar.h:155
#define IN
Definition: typedefs.h:39
char CCHAR
Definition: typedefs.h:51