Author: ion Date: Wed Nov 22 10:01:32 2006 New Revision: 24796
URL: http://svn.reactos.org/svn/reactos?rev=24796&view=rev Log: - Fix boot CD with 10 lines of code. That's right Fireball, go shame yourself!
Modified: trunk/reactos/boot/freeldr/freeldr/reactos/reactos.c trunk/reactos/boot/freeldr/freeldr/reactos/setupldr.c
Modified: trunk/reactos/boot/freeldr/freeldr/reactos/reactos.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/reacto... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/reactos/reactos.c (original) +++ trunk/reactos/boot/freeldr/freeldr/reactos/reactos.c Wed Nov 22 10:01:32 2006 @@ -36,6 +36,7 @@ CHAR szHalName[255]; CHAR szBootPath[255]; static CHAR szLoadingMsg[] = "Loading ReactOS..."; +BOOLEAN FrLdrBootType;
static BOOLEAN NTAPI @@ -118,7 +119,14 @@ /* Which means we need to build a path now */ strcpy(szBuffer, szFileName); strcpy(szFullPath, szBootPath); - strcat(szFullPath, "SYSTEM32\DRIVERS\"); + if (!FrLdrBootType) + { + strcat(szFullPath, "SYSTEM32\DRIVERS\"); + } + else + { + strcat(szFullPath, "\"); + } strcat(szFullPath, szBuffer); szFileName = szFullPath; }
Modified: trunk/reactos/boot/freeldr/freeldr/reactos/setupldr.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/reacto... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/reactos/setupldr.c (original) +++ trunk/reactos/boot/freeldr/freeldr/reactos/setupldr.c Wed Nov 22 10:01:32 2006 @@ -26,6 +26,8 @@ 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 @@ 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); - } - - szShortName = strrchr(szFileName, '\'); - if (szShortName == NULL) - szShortName = szFileName; - else - szShortName = szShortName + 1; - - FilePointer = FsOpenFile(szFullName); - if (FilePointer == NULL) - { - printf("Could not find %s\n", szShortName); - return(FALSE); - } - - /* - * 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 - - /* - * Load the kernel - */ - FrLdrMapKernel(FilePointer); - - return(TRUE); + PFILE FilePointer; + PCHAR szShortName; + CHAR szBuffer[256]; + + /* Extract Kernel filename without path */ + szShortName = strrchr(szFileName, '\'); + if (!szShortName) + { + /* No path, leave it alone */ + szShortName = szFileName; + } + else + { + /* Skip the path */ + szShortName = szShortName + 1; + } + + /* 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; + } + + /* Update the status bar with the current file */ + strcpy(szBuffer, "Reading "); + strcat(szBuffer, szShortName); + UiDrawStatusText(szBuffer); + + /* Do the actual loading */ + FrLdrMapKernel(FilePointer); + + /* Update Processbar and return success */ + return TRUE; }
static BOOLEAN @@ -301,6 +283,7 @@ const char *SourcePath; const char *LoadOptions; UINT i; + char szKernelName[256];
HINF InfHandle; ULONG ErrorLine; @@ -359,6 +342,9 @@ UiDrawStatusText(""); #endif
+ extern BOOLEAN FrLdrBootType; + FrLdrBootType = TRUE; + /* Initialize registry */ RegInitializeRegistry();
@@ -433,14 +419,17 @@ strcat(strcat(strcat(reactos_kernel_cmdline, SourcePath), " "), LoadOptions);
- /* Load ntoskrnl.exe */ - if (!LoadKernel(SourcePath, "ntoskrnl.exe")) - return; - - - /* Load hal.dll */ - if (!LoadDriver(SourcePath, "hal.dll")) - 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 the kernel */ + if (!FrLdrLoadKernel(szKernelName, 5)) return;
/* Create ntoskrnl.sym */ LoadKernelSymbols(SourcePath, "ntoskrnl.exe");