mirror of
https://github.com/reactos/reactos.git
synced 2024-09-30 22:47:28 +00:00
- Fix boot CD with 10 lines of code. That's right Fireball, go shame yourself!
svn path=/trunk/; revision=24796
This commit is contained in:
parent
732eec1ad8
commit
9bd055bf1e
|
@ -36,6 +36,7 @@ unsigned long reactos_disk_count = 0;
|
|||
CHAR szHalName[255];
|
||||
CHAR szBootPath[255];
|
||||
static CHAR szLoadingMsg[] = "Loading ReactOS...";
|
||||
BOOLEAN FrLdrBootType;
|
||||
|
||||
static BOOLEAN
|
||||
NTAPI
|
||||
|
@ -118,7 +119,14 @@ FrLdrLoadImage(IN PCHAR szFileName,
|
|||
/* Which means we need to build a path now */
|
||||
strcpy(szBuffer, szFileName);
|
||||
strcpy(szFullPath, szBootPath);
|
||||
if (!FrLdrBootType)
|
||||
{
|
||||
strcat(szFullPath, "SYSTEM32\\DRIVERS\\");
|
||||
}
|
||||
else
|
||||
{
|
||||
strcat(szFullPath, "\\");
|
||||
}
|
||||
strcat(szFullPath, szBuffer);
|
||||
szFileName = szFullPath;
|
||||
}
|
||||
|
|
|
@ -26,6 +26,8 @@ LOADER_MODULE reactos_modules[64]; // Array to hold boot module info loaded f
|
|||
char reactos_module_strings[64][256]; // Array to hold module names
|
||||
unsigned long reactos_memory_map_descriptor_size;
|
||||
memory_map_t reactos_memory_map[32]; // Memory map
|
||||
char szBootPath[256];
|
||||
char szHalName[256];
|
||||
|
||||
#define USE_UI
|
||||
|
||||
|
@ -45,69 +47,49 @@ FreeldrSeekFile(PVOID FileContext, ULONG_PTR Position)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOLEAN
|
||||
LoadKernel(PCSTR szSourcePath, PCSTR szFileName)
|
||||
BOOLEAN
|
||||
NTAPI
|
||||
static FrLdrLoadKernel(IN PCHAR szFileName,
|
||||
IN INT nPos)
|
||||
{
|
||||
CHAR szFullName[256];
|
||||
#ifdef USE_UI
|
||||
CHAR szBuffer[80];
|
||||
#endif
|
||||
PFILE FilePointer;
|
||||
PCSTR szShortName;
|
||||
|
||||
if (szSourcePath[0] != '\\')
|
||||
{
|
||||
strcpy(szFullName, "\\");
|
||||
strcat(szFullName, szSourcePath);
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(szFullName, szSourcePath);
|
||||
}
|
||||
|
||||
if (szFullName[strlen(szFullName)] != '\\')
|
||||
{
|
||||
strcat(szFullName, "\\");
|
||||
}
|
||||
|
||||
if (szFileName[0] != '\\')
|
||||
{
|
||||
strcat(szFullName, szFileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
strcat(szFullName, szFileName + 1);
|
||||
}
|
||||
PCHAR szShortName;
|
||||
CHAR szBuffer[256];
|
||||
|
||||
/* Extract Kernel filename without path */
|
||||
szShortName = strrchr(szFileName, '\\');
|
||||
if (szShortName == NULL)
|
||||
szShortName = szFileName;
|
||||
else
|
||||
szShortName = szShortName + 1;
|
||||
|
||||
FilePointer = FsOpenFile(szFullName);
|
||||
if (FilePointer == NULL)
|
||||
if (!szShortName)
|
||||
{
|
||||
printf("Could not find %s\n", szShortName);
|
||||
return(FALSE);
|
||||
/* No path, leave it alone */
|
||||
szShortName = szFileName;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Skip the path */
|
||||
szShortName = szShortName + 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Update the status bar with the current file
|
||||
*/
|
||||
#ifdef USE_UI
|
||||
sprintf(szBuffer, "Setup is loading files (%s)", szShortName);
|
||||
UiDrawStatusText(szBuffer);
|
||||
#else
|
||||
printf("Reading %s\n", szShortName);
|
||||
#endif
|
||||
/* Open the Kernel */
|
||||
FilePointer = FsOpenFile(szFileName);
|
||||
if (!FilePointer)
|
||||
{
|
||||
/* Return failure on the short name */
|
||||
strcpy(szBuffer, szShortName);
|
||||
strcat(szBuffer, " not found.");
|
||||
UiMessageBox(szBuffer);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Load the kernel
|
||||
*/
|
||||
/* Update the status bar with the current file */
|
||||
strcpy(szBuffer, "Reading ");
|
||||
strcat(szBuffer, szShortName);
|
||||
UiDrawStatusText(szBuffer);
|
||||
|
||||
/* Do the actual loading */
|
||||
FrLdrMapKernel(FilePointer);
|
||||
|
||||
return(TRUE);
|
||||
/* Update Processbar and return success */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOLEAN
|
||||
|
@ -301,6 +283,7 @@ VOID RunLoader(VOID)
|
|||
const char *SourcePath;
|
||||
const char *LoadOptions;
|
||||
UINT i;
|
||||
char szKernelName[256];
|
||||
|
||||
HINF InfHandle;
|
||||
ULONG ErrorLine;
|
||||
|
@ -359,6 +342,9 @@ VOID RunLoader(VOID)
|
|||
UiDrawStatusText("");
|
||||
#endif
|
||||
|
||||
extern BOOLEAN FrLdrBootType;
|
||||
FrLdrBootType = TRUE;
|
||||
|
||||
/* Initialize registry */
|
||||
RegInitializeRegistry();
|
||||
|
||||
|
@ -433,14 +419,17 @@ VOID RunLoader(VOID)
|
|||
strcat(strcat(strcat(reactos_kernel_cmdline, SourcePath), " "),
|
||||
LoadOptions);
|
||||
|
||||
/* Load ntoskrnl.exe */
|
||||
if (!LoadKernel(SourcePath, "ntoskrnl.exe"))
|
||||
return;
|
||||
/* Setup the boot path and kernel path */
|
||||
strcpy(szBootPath, SourcePath);
|
||||
strcpy(szKernelName, szBootPath);
|
||||
strcat(szKernelName, "\\ntoskrnl.exe");
|
||||
|
||||
/* Setup the HAL path */
|
||||
strcpy(szHalName, szBootPath);
|
||||
strcat(szHalName, "\\hal.dll");
|
||||
|
||||
/* Load hal.dll */
|
||||
if (!LoadDriver(SourcePath, "hal.dll"))
|
||||
return;
|
||||
/* Load the kernel */
|
||||
if (!FrLdrLoadKernel(szKernelName, 5)) return;
|
||||
|
||||
/* Create ntoskrnl.sym */
|
||||
LoadKernelSymbols(SourcePath, "ntoskrnl.exe");
|
||||
|
|
Loading…
Reference in a new issue