[USETUP]: Correctly check for existing "ReactOS" entries in FreeLdr in case ReactOS is reinstalled over an existing installation, and if no one does exist, then create a new one that actually works. Thanks tower for having reported the problem 8^)

svn path=/trunk/; revision=70469
This commit is contained in:
Hermès Bélusca-Maïto 2015-12-30 20:23:18 +00:00
parent ef915b1472
commit c91100685b

View file

@ -539,18 +539,19 @@ UpdateFreeLoaderIni(
wcscpy(SectionName2, KeyData); wcscpy(SectionName2, KeyData);
} }
/* Search for an existing ReactOS entry */
OsIniSection = IniCacheGetSection(IniCache, SectionName2); OsIniSection = IniCacheGetSection(IniCache, SectionName2);
if (OsIniSection != NULL) if (OsIniSection != NULL)
{ {
BOOLEAN UseExistingEntry = TRUE; BOOLEAN UseExistingEntry = TRUE;
/* Check BootType */ /* Check for boot type "Windows2003" */
Status = IniCacheGetKey(OsIniSection, L"BootType", &KeyData); Status = IniCacheGetKey(OsIniSection, L"BootType", &KeyData);
if (NT_SUCCESS(Status)) if (NT_SUCCESS(Status))
{ {
if ((KeyData == NULL) || if ((KeyData == NULL) ||
( (_wcsicmp(KeyData, L"ReactOS") != 0) && ( (_wcsicmp(KeyData, L"Windows2003") != 0) &&
(_wcsicmp(KeyData, L"\"ReactOS\"") != 0) )) (_wcsicmp(KeyData, L"\"Windows2003\"") != 0) ))
{ {
/* This is not a ReactOS entry */ /* This is not a ReactOS entry */
UseExistingEntry = FALSE; UseExistingEntry = FALSE;
@ -563,17 +564,17 @@ UpdateFreeLoaderIni(
if (UseExistingEntry) if (UseExistingEntry)
{ {
/* BootType is ReactOS. Now check SystemPath */ /* BootType is Windows2003. Now check SystemPath. */
Status = IniCacheGetKey(OsIniSection, L"SystemPath", &KeyData); Status = IniCacheGetKey(OsIniSection, L"SystemPath", &KeyData);
if (NT_SUCCESS(Status)) if (NT_SUCCESS(Status))
{ {
swprintf(SystemPath, L"\"%S\"", ArcPath); swprintf(SystemPath, L"\"%s\"", ArcPath);
if ((KeyData == NULL) || if ((KeyData == NULL) ||
((_wcsicmp(KeyData, ArcPath) != 0) && ( (_wcsicmp(KeyData, ArcPath) != 0) &&
(_wcsicmp(KeyData, SystemPath) != 0) )) (_wcsicmp(KeyData, SystemPath) != 0) ))
{ {
/* This entry is a ReactOS entry, but the SystemRoot does not /* This entry is a ReactOS entry, but the SystemRoot
match the one we are looking for */ does not match the one we are looking for. */
UseExistingEntry = FALSE; UseExistingEntry = FALSE;
} }
} }
@ -595,29 +596,11 @@ UpdateFreeLoaderIni(
i++; i++;
} }
/* <SectionName>=<OsName> */ /* Create a new "ReactOS" entry */
IniCacheInsertKey(IniSection, CreateFreeLoaderEntry(IniCache, IniSection,
NULL, SectionName, OsName,
INSERT_LAST, L"Windows2003", ArcPath,
SectionName, L"");
OsName);
/* Create <SectionName> section */
IniSection = IniCacheAppendSection(IniCache, SectionName);
/* BootType=ReactOS */
IniCacheInsertKey(IniSection,
NULL,
INSERT_LAST,
L"BootType",
L"ReactOS");
/* SystemPath=<ArcPath> */
IniCacheInsertKey(IniSection,
NULL,
INSERT_LAST,
L"SystemPath",
ArcPath);
IniCacheSave(IniCache, IniPath); IniCacheSave(IniCache, IniPath);
IniCacheDestroy(IniCache); IniCacheDestroy(IniCache);
@ -2032,7 +2015,7 @@ InstallFatBootcodeToPartition(
/* Install new bootcode */ /* Install new bootcode */
if (PartitionType == PARTITION_FAT32 || if (PartitionType == PARTITION_FAT32 ||
PartitionType == PARTITION_FAT32_XINT13) PartitionType == PARTITION_FAT32_XINT13)
{ {
/* Install FAT32 bootcode */ /* Install FAT32 bootcode */
wcscpy(SrcPath, SourceRootPath->Buffer); wcscpy(SrcPath, SourceRootPath->Buffer);
@ -2151,7 +2134,7 @@ InstallFatBootcodeToPartition(
/* Install new bootsector */ /* Install new bootsector */
if (PartitionType == PARTITION_FAT32 || if (PartitionType == PARTITION_FAT32 ||
PartitionType == PARTITION_FAT32_XINT13) PartitionType == PARTITION_FAT32_XINT13)
{ {
wcscpy(SrcPath, SourceRootPath->Buffer); wcscpy(SrcPath, SourceRootPath->Buffer);
wcscat(SrcPath, L"\\loader\\fat32.bin"); wcscat(SrcPath, L"\\loader\\fat32.bin");