Author: hbelusca Date: Sun Jan 4 23:49:18 2015 New Revision: 65982
URL: http://svn.reactos.org/svn/reactos?rev=65982&view=rev Log: [FREELDR] - Correctly append a backslash to the BootPath (if needed). - Be able to specify relative boot paths (relative to the current boot device): as a consequence, remove the "LiveCD" hackish special value that was introduced long long ago. - Fix BootPath retrieval in ReactOSSetup mode (via the SystemPath optional value), and use a better way to build the temporary txtsetup.sif full file names.
As a consequence we can now build hybrid cds with the following architecture: \ --> loader\ (bootsectors + free/setupldr.sys) --> myboot\ (contents of what_defaults_to_reactos directory for the bootcd) --> mylive\ (contents of what_defaults_to_reactos directory for the livecd) --> <regular_files> and freeldr.ini specifying the following values:
; The Setup entry [Setup] BootType=ReactOSSetup SystemPath=\myboot
; The LiveCD entry [LiveCD] BootType=Windows2003 SystemPath=\mylive Options=/MININT
Part 2/2 CORE-9023
Modified: trunk/reactos/boot/bootdata/livecd.ini trunk/reactos/boot/freeldr/freeldr/CHANGELOG trunk/reactos/boot/freeldr/freeldr/windows/setupldr.c trunk/reactos/boot/freeldr/freeldr/windows/winldr.c
Modified: trunk/reactos/boot/bootdata/livecd.ini URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/livecd.ini?re... ============================================================================== --- trunk/reactos/boot/bootdata/livecd.ini [iso-8859-1] (original) +++ trunk/reactos/boot/bootdata/livecd.ini [iso-8859-1] Sun Jan 4 23:49:18 2015 @@ -32,20 +32,20 @@
[LiveCD] BootType=Windows2003 -SystemPath=LiveCD\reactos +SystemPath=\reactos Options=/MININT
[LiveCD_Debug] BootType=Windows2003 -SystemPath=LiveCD\reactos +SystemPath=\reactos Options=/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200 /SOS /MININT
[LiveCD_Screen] BootType=Windows2003 -SystemPath=LiveCD\reactos +SystemPath=\reactos Options=/DEBUG /DEBUGPORT=SCREEN /SOS /MININT
[LiveCD_LogFile] BootType=Windows2003 -SystemPath=LiveCD\reactos +SystemPath=\reactos Options=/DEBUG /DEBUGPORT=FILE:\Device\HarddiskX\PartitionY\debug.log /SOS /MININT
Modified: trunk/reactos/boot/freeldr/freeldr/CHANGELOG URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/CHANGE... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/CHANGELOG [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/CHANGELOG [iso-8859-1] Sun Jan 4 23:49:18 2015 @@ -1,3 +1,9 @@ +Changes in v3.0+ (05/01/2015) (hbelusca) + +- Remove support for special value "LiveCD" of SystemPath option + for loading ReactOS since now we treat non-ARC SystemPath as + a path relative to the boot path. + Changes in v3.0.0 (11/12/2007) (fball)
- Support for building an ARC Tree.
Modified: trunk/reactos/boot/freeldr/freeldr/windows/setupldr.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/window... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/windows/setupldr.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/windows/setupldr.c [iso-8859-1] Sun Jan 4 23:49:18 2015 @@ -178,17 +178,40 @@ HasSection = IniOpenSection(SectionName, &SectionId);
UiDrawBackdrop(); - UiDrawProgressBarCenter(1, 100, "Loading NT..."); + UiDrawProgressBarCenter(1, 100, "Loading ReactOS Setup...");
/* Read the system path is set in the .ini file */ if (!HasSection || !IniReadSettingByName(SectionId, "SystemPath", BootPath, sizeof(BootPath))) { + // MachDiskGetBootPath(BootPath, sizeof(BootPath)); + // strcpy(BootPath, SectionName); + } + + /* + * Check whether BootPath is a full path + * and if not, create a full boot path. + * + * See FsOpenFile for the technique used. + */ + if (strrchr(BootPath, ')') == NULL) + { + /* Temporarily save the boot path */ + strcpy(FileName, BootPath); + + /* This is not a full path. Use the current (i.e. boot) device. */ MachDiskGetBootPath(BootPath, sizeof(BootPath)); - } - - /* Append a backslash */ - if ((strlen(BootPath)==0) || BootPath[strlen(BootPath)] != '\') + + /* Append a path separator if needed */ + if (FileName[0] != '\' && FileName[0] != '/') + strcat(BootPath, "\"); + + /* Append the remaining path */ + strcat(BootPath, FileName); + } + + /* Append a backslash if needed */ + if ((strlen(BootPath) == 0) || BootPath[strlen(BootPath) - 1] != '\') strcat(BootPath, "\");
/* Read booting options */ @@ -233,10 +256,11 @@ ERR("Failed to open txtsetup.sif\n"); return; } - sprintf(File, "%stxtsetup.sif", SystemPath); - if (InfOpenFile (&InfHandle, BootPath, &ErrorLine)) + strcpy(File, SystemPath); + strcpy(FileName, BootPath); + strcat(FileName, "txtsetup.sif"); + if (InfOpenFile(&InfHandle, FileName, &ErrorLine)) { - sprintf(File, "%s", SystemPath); break; } }
Modified: trunk/reactos/boot/freeldr/freeldr/windows/winldr.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/window... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/windows/winldr.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/windows/winldr.c [iso-8859-1] Sun Jan 4 23:49:18 2015 @@ -621,16 +621,30 @@ strcpy(BootPath, SectionName); }
- /* Special case for LiveCD */ - if (!_strnicmp(BootPath, "LiveCD", strlen("LiveCD"))) - { - strcpy(FileName, BootPath + strlen("LiveCD")); + /* + * Check whether BootPath is a full path + * and if not, create a full boot path. + * + * See FsOpenFile for the technique used. + */ + if (strrchr(BootPath, ')') == NULL) + { + /* Temporarily save the boot path */ + strcpy(FileName, BootPath); + + /* This is not a full path. Use the current (i.e. boot) device. */ MachDiskGetBootPath(BootPath, sizeof(BootPath)); + + /* Append a path separator if needed */ + if (FileName[0] != '\' && FileName[0] != '/') + strcat(BootPath, "\"); + + /* Append the remaining path */ strcat(BootPath, FileName); }
- /* Append a backslash */ - if ((strlen(BootPath)==0) || BootPath[strlen(BootPath)] != '\') + /* Append a backslash if needed */ + if ((strlen(BootPath) == 0) || BootPath[strlen(BootPath) - 1] != '\') strcat(BootPath, "\");
/* Read booting options */