[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
This commit is contained in:
Hermès Bélusca-Maïto 2017-06-08 02:20:33 +00:00
parent 27603a101c
commit c2f7758e96
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0

View file

@ -73,6 +73,7 @@ EnumerateInstallations(
IN PVOID Parameter OPTIONAL) IN PVOID Parameter OPTIONAL)
{ {
PENUM_INSTALLS_DATA Data = (PENUM_INSTALLS_DATA)Parameter; PENUM_INSTALLS_DATA Data = (PENUM_INSTALLS_DATA)Parameter;
PNTOS_OPTIONS Options = (PNTOS_OPTIONS)&BootEntry->OsOptions;
PNTOS_INSTALLATION NtOsInstall; PNTOS_INSTALLATION NtOsInstall;
UNICODE_STRING SystemRootPath; UNICODE_STRING SystemRootPath;
@ -87,10 +88,11 @@ EnumerateInstallations(
/* We have a boot entry */ /* We have a boot entry */
/* Check for supported boot type "Windows2003" */ /* Check for supported boot type "Windows2003" */
// TODO: What to do with "Windows" ; "WindowsNT40" ; "ReactOSSetup" ? if (BootEntry->OsOptionsLength < sizeof(NTOS_OPTIONS) ||
if ((BootEntry->Version == NULL) || RtlCompareMemory(&BootEntry->OsOptions /* Signature */,
( (_wcsicmp(BootEntry->Version, L"Windows2003") != 0) && NTOS_OPTIONS_SIGNATURE,
(_wcsicmp(BootEntry->Version, L"\"Windows2003\"") != 0) )) RTL_FIELD_SIZE(NTOS_OPTIONS, Signature)) !=
RTL_FIELD_SIZE(NTOS_OPTIONS, Signature))
{ {
/* This is not a ReactOS entry */ /* This is not a ReactOS entry */
DPRINT1(" An installation '%S' of unsupported type '%S'\n", DPRINT1(" An installation '%S' of unsupported type '%S'\n",
@ -99,7 +101,8 @@ EnumerateInstallations(
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
if (!BootEntry->OsLoadPath || !*BootEntry->OsLoadPath) /* BootType is Windows2003, now check OsLoadPath */
if (!Options->OsLoadPath || !*Options->OsLoadPath)
{ {
/* Certainly not a ReactOS installation */ /* Certainly not a ReactOS installation */
DPRINT1(" A Win2k3 install '%S' without an ARC path?!\n", BootEntry->FriendlyName); 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", 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", // DPRINT1(" Found a Win2k3 install '%S' with ARC path '%S'\n",
// BootEntry->FriendlyName, BootEntry->OsLoadPath); // BootEntry->FriendlyName, Options->OsLoadPath);
// TODO: Normalize the ARC path. // TODO: Normalize the ARC path.
@ -118,7 +121,7 @@ EnumerateInstallations(
* Check whether we already have an installation with this ARC path. * Check whether we already have an installation with this ARC path.
* If this is the case, stop there. * If this is the case, stop there.
*/ */
NtOsInstall = FindExistingNTOSInstall(Data->List, BootEntry->OsLoadPath, NULL); NtOsInstall = FindExistingNTOSInstall(Data->List, Options->OsLoadPath, NULL);
if (NtOsInstall) if (NtOsInstall)
{ {
DPRINT1(" An NTOS installation with name \"%S\" already exists in SystemRoot '%wZ'\n", 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. * resides, as well verifying whether it is indeed an NTOS installation.
*/ */
RtlInitEmptyUnicodeString(&SystemRootPath, SystemRoot, sizeof(SystemRoot)); 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 */ /* Continue the enumeration */
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
DPRINT1("ArcPathToNtPath() succeeded: '%S' --> '%wZ'\n", DPRINT1("ArcPathToNtPath() succeeded: '%S' --> '%wZ'\n",
BootEntry->OsLoadPath, &SystemRootPath); Options->OsLoadPath, &SystemRootPath);
/* /*
* Check whether we already have an installation with this NT path. * Check whether we already have an installation with this NT path.
* If this is the case, stop there. * 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) if (NtOsInstall)
{ {
DPRINT1(" An NTOS installation with name \"%S\" already exists in SystemRoot '%wZ'\n", 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", 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 */ /* From the NT path, compute the disk, partition and path components */
if (NtPathToDiskPartComponents(SystemRootPath.Buffer, &DiskNumber, &PartitionNumber, &PathComponent)) if (NtPathToDiskPartComponents(SystemRootPath.Buffer, &DiskNumber, &PartitionNumber, &PathComponent))
@ -204,7 +207,7 @@ EnumerateInstallations(
&SystemRootPath, &SystemRootPath,
BootEntry->FriendlyName); BootEntry->FriendlyName);
} }
AddNTOSInstallation(Data->List, BootEntry->OsLoadPath, AddNTOSInstallation(Data->List, Options->OsLoadPath,
&SystemRootPath, PathComponent, &SystemRootPath, PathComponent,
DiskNumber, PartitionNumber, PartEntry, DiskNumber, PartitionNumber, PartEntry,
InstallNameW); InstallNameW);