https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c2f7758e9643ba0799615d...
commit c2f7758e9643ba0799615df2cc7db84b25945865 Author: Hermès Bélusca-Maïto hermes.belusca-maito@reactos.org AuthorDate: Thu Jun 8 02:20:33 2017 +0000 Commit: Hermès Bélusca-Maïto hermes.belusca-maito@reactos.org CommitDate: Sun Oct 14 23:37:44 2018 +0200
[SETUPLIB] Adapt the code in osdetect.c to make it use the new features of bldrsup.c committed in 27603a10 (r74952).
svn path=/branches/setup_improvements/; revision=74953 --- base/setup/lib/osdetect.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-)
diff --git a/base/setup/lib/osdetect.c b/base/setup/lib/osdetect.c index 6bdd5ea416..daa98c7ab1 100644 --- a/base/setup/lib/osdetect.c +++ b/base/setup/lib/osdetect.c @@ -73,6 +73,7 @@ EnumerateInstallations( IN PVOID Parameter OPTIONAL) { PENUM_INSTALLS_DATA Data = (PENUM_INSTALLS_DATA)Parameter; + PNTOS_OPTIONS Options = (PNTOS_OPTIONS)&BootEntry->OsOptions;
PNTOS_INSTALLATION NtOsInstall; UNICODE_STRING SystemRootPath; @@ -87,10 +88,11 @@ EnumerateInstallations( /* We have a boot entry */
/* Check for supported boot type "Windows2003" */ - // TODO: What to do with "Windows" ; "WindowsNT40" ; "ReactOSSetup" ? - if ((BootEntry->Version == NULL) || - ( (_wcsicmp(BootEntry->Version, L"Windows2003") != 0) && - (_wcsicmp(BootEntry->Version, L""Windows2003"") != 0) )) + if (BootEntry->OsOptionsLength < sizeof(NTOS_OPTIONS) || + RtlCompareMemory(&BootEntry->OsOptions /* Signature */, + NTOS_OPTIONS_SIGNATURE, + RTL_FIELD_SIZE(NTOS_OPTIONS, Signature)) != + RTL_FIELD_SIZE(NTOS_OPTIONS, Signature)) { /* This is not a ReactOS entry */ DPRINT1(" An installation '%S' of unsupported type '%S'\n", @@ -99,7 +101,8 @@ EnumerateInstallations( return STATUS_SUCCESS; }
- if (!BootEntry->OsLoadPath || !*BootEntry->OsLoadPath) + /* BootType is Windows2003, now check OsLoadPath */ + if (!Options->OsLoadPath || !*Options->OsLoadPath) { /* Certainly not a ReactOS installation */ DPRINT1(" A Win2k3 install '%S' without an ARC path?!\n", BootEntry->FriendlyName); @@ -108,9 +111,9 @@ EnumerateInstallations( }
DPRINT1(" Found a candidate Win2k3 install '%S' with ARC path '%S'\n", - BootEntry->FriendlyName, BootEntry->OsLoadPath); + BootEntry->FriendlyName, Options->OsLoadPath); // DPRINT1(" Found a Win2k3 install '%S' with ARC path '%S'\n", - // BootEntry->FriendlyName, BootEntry->OsLoadPath); + // BootEntry->FriendlyName, Options->OsLoadPath);
// TODO: Normalize the ARC path.
@@ -118,7 +121,7 @@ EnumerateInstallations( * Check whether we already have an installation with this ARC path. * If this is the case, stop there. */ - NtOsInstall = FindExistingNTOSInstall(Data->List, BootEntry->OsLoadPath, NULL); + NtOsInstall = FindExistingNTOSInstall(Data->List, Options->OsLoadPath, NULL); if (NtOsInstall) { DPRINT1(" An NTOS installation with name "%S" already exists in SystemRoot '%wZ'\n", @@ -133,21 +136,21 @@ EnumerateInstallations( * resides, as well verifying whether it is indeed an NTOS installation. */ RtlInitEmptyUnicodeString(&SystemRootPath, SystemRoot, sizeof(SystemRoot)); - if (!ArcPathToNtPath(&SystemRootPath, BootEntry->OsLoadPath, Data->PartList)) + if (!ArcPathToNtPath(&SystemRootPath, Options->OsLoadPath, Data->PartList)) { - DPRINT1("ArcPathToNtPath(%S) failed, skip the installation.\n", BootEntry->OsLoadPath); + DPRINT1("ArcPathToNtPath(%S) failed, skip the installation.\n", Options->OsLoadPath); /* Continue the enumeration */ return STATUS_SUCCESS; }
DPRINT1("ArcPathToNtPath() succeeded: '%S' --> '%wZ'\n", - BootEntry->OsLoadPath, &SystemRootPath); + Options->OsLoadPath, &SystemRootPath);
/* * Check whether we already have an installation with this NT path. * If this is the case, stop there. */ - NtOsInstall = FindExistingNTOSInstall(Data->List, NULL /*BootEntry->OsLoadPath*/, &SystemRootPath); + NtOsInstall = FindExistingNTOSInstall(Data->List, NULL /*Options->OsLoadPath*/, &SystemRootPath); if (NtOsInstall) { DPRINT1(" An NTOS installation with name "%S" already exists in SystemRoot '%wZ'\n", @@ -166,7 +169,7 @@ EnumerateInstallations( }
DPRINT1("Found a valid NTOS installation in SystemRoot ARC path '%S', NT path '%wZ'\n", - BootEntry->OsLoadPath, &SystemRootPath); + Options->OsLoadPath, &SystemRootPath);
/* From the NT path, compute the disk, partition and path components */ if (NtPathToDiskPartComponents(SystemRootPath.Buffer, &DiskNumber, &PartitionNumber, &PathComponent)) @@ -204,7 +207,7 @@ EnumerateInstallations( &SystemRootPath, BootEntry->FriendlyName); } - AddNTOSInstallation(Data->List, BootEntry->OsLoadPath, + AddNTOSInstallation(Data->List, Options->OsLoadPath, &SystemRootPath, PathComponent, DiskNumber, PartitionNumber, PartEntry, InstallNameW);