From c2f7758e9643ba0799615df2cc7db84b25945865 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Thu, 8 Jun 2017 02:20:33 +0000 Subject: [PATCH 1/1] [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 6bdd5ea4166..daa98c7ab16 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); -- 2.17.1