Author: hbelusca
Date: Mon May 15 01:59:28 2017
New Revision: 74550
URL:
http://svn.reactos.org/svn/reactos?rev=74550&view=rev
Log:
[USETUP]: Continue implementing the NT OS installation detector.
What remains to be done here, besides cleaning up the code from temporary comments and
DPRINTs (and fixing potential bugs), is to actually parse the NTOS loader configuration
files (freeldr.ini in ROS' case, or boot.ini in Win2k3's case, etc...) to retrieve
the actual installation paths. So far these are currently hardcoded for testing purposes
only.
Note that I try to distinguish between ROS and Windows installations by checking at the
company name vendor of the ntoskrnl.exe & ntdll.dll files, in order to allow the
upgrade of ROS installations only.
Suggestions are always welcome.
Modified:
branches/setup_improvements/base/setup/usetup/osdetect.c
Modified: branches/setup_improvements/base/setup/usetup/osdetect.c
URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/base/setup/u…
==============================================================================
--- branches/setup_improvements/base/setup/usetup/osdetect.c [iso-8859-1] (original)
+++ branches/setup_improvements/base/setup/usetup/osdetect.c [iso-8859-1] Mon May 15
01:59:28 2017
@@ -19,6 +19,9 @@
/* GLOBALS ******************************************************************/
extern PPARTLIST PartitionList;
+
+/* Language-independent Vendor strings */
+static const PCWSTR KnownVendors[] = { L"ReactOS", L"Microsoft" };
/* VERSION RESOURCE API ******************************************************/
@@ -361,36 +364,331 @@
#endif
+
+/***
+*wchar_t *wcsstr(string1, string2) - search for string2 in string1
+* (wide strings)
+*
+*Purpose:
+* finds the first occurrence of string2 in string1 (wide strings)
+*
+*Entry:
+* wchar_t *string1 - string to search in
+* wchar_t *string2 - string to search for
+*
+*Exit:
+* returns a pointer to the first occurrence of string2 in
+* string1, or NULL if string2 does not occur in string1
+*
+*Uses:
+*
+*Exceptions:
+*
+*******************************************************************************/
+PWSTR FindSubStrI(PCWSTR str, PCWSTR strSearch)
+{
+ PWSTR cp = (PWSTR)str;
+ PWSTR s1, s2;
+
+ if (!*strSearch)
+ return (PWSTR)str;
+
+ while (*cp)
+ {
+ s1 = cp;
+ s2 = (PWSTR)strSearch;
+
+ while (*s1 && *s2 && (towupper(*s1) == towupper(*s2)))
+ ++s1, ++s2;
+
+ if (!*s2)
+ return cp;
+
+ ++cp;
+ }
+
+ return NULL;
+}
+
static BOOLEAN
-IsRecognizedOS(
+CheckForValidPEAndVendor(
+ IN HANDLE RootDirectory OPTIONAL,
+ IN PCWSTR PathName OPTIONAL,
+ IN PCWSTR FileName, // OPTIONAL
+ IN PCWSTR VendorName // Better would be OUT PCWSTR*, and the function returning
NTSTATUS ?
+ )
+{
+ BOOLEAN Success = FALSE;
+ NTSTATUS Status;
+ HANDLE FileHandle, SectionHandle;
+ // SIZE_T ViewSize;
+ PVOID ViewBase;
+ PVOID VersionBuffer = NULL; // Read-only
+ PVOID pvData = NULL;
+ UINT BufLen = 0;
+
+ Status = OpenAndMapFile(RootDirectory, PathName, FileName,
+ &FileHandle, &SectionHandle, &ViewBase);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("Failed to open and map file %wZ, Status 0x%08lx\n",
&FileName, Status);
+ return FALSE; // Status;
+ }
+
+ /* Make sure it's a valid PE file */
+ if (!RtlImageNtHeader(ViewBase))
+ {
+ DPRINT1("File %wZ does not seem to be a valid PE, bail out\n",
&FileName);
+ Status = STATUS_INVALID_IMAGE_FORMAT;
+ goto UnmapFile;
+ }
+
+ /*
+ * Search for a valid executable version and vendor.
+ * NOTE: The module is loaded as a data file, it should be marked as such.
+ */
+ Status = NtGetVersionResource((PVOID)((ULONG_PTR)ViewBase | 1), &VersionBuffer,
NULL);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("Failed to get version resource for file %wZ, Status
0x%08lx\n", &FileName, Status);
+ goto UnmapFile;
+ }
+
+ Status = NtVerQueryValue(VersionBuffer, L"\\VarFileInfo\\Translation",
&pvData, &BufLen);
+ if (NT_SUCCESS(Status))
+ {
+ USHORT wCodePage = 0, wLangID = 0;
+ WCHAR FileInfo[MAX_PATH];
+ UNICODE_STRING Vendor;
+
+ wCodePage = LOWORD(*(ULONG*)pvData);
+ wLangID = HIWORD(*(ULONG*)pvData);
+
+ StringCchPrintfW(FileInfo, ARRAYSIZE(FileInfo),
+ L"StringFileInfo\\%04X%04X\\CompanyName",
+ wCodePage, wLangID);
+
+ Status = NtVerQueryValue(VersionBuffer, FileInfo, &pvData, &BufLen);
+ if (NT_SUCCESS(Status) && pvData)
+ {
+ /* BufLen includes the NULL terminator count */
+ RtlInitEmptyUnicodeString(&Vendor, pvData, BufLen * sizeof(WCHAR));
+ Vendor.Length = Vendor.MaximumLength - sizeof(UNICODE_NULL);
+
+ DPRINT1("Found version vendor: \"%wZ\" for file %wZ\n",
&Vendor, &FileName);
+
+ Success = !!FindSubStrI(pvData, VendorName);
+ }
+ else
+ {
+ DPRINT1("No version vendor found for file %wZ\n", &FileName);
+ }
+ }
+
+UnmapFile:
+ /* Finally, unmap and close the file */
+ UnMapFile(SectionHandle, ViewBase);
+ NtClose(FileHandle);
+
+ return Success;
+}
+
+static BOOLEAN
+IsValidNTOSInstallation(
+ IN HANDLE PartitionHandle,
+ IN PCWSTR SystemRoot)
+{
+ BOOLEAN Success = FALSE;
+ USHORT i;
+ WCHAR PathBuffer[MAX_PATH];
+
+ // DoesPathExist(PartitionHandle, SystemRoot, L"System32\\"); etc...
+
+ /* Check for the existence of \SystemRoot\System32 */
+ StringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer), L"%s%s", SystemRoot,
L"System32\\");
+ if (!DoesPathExist(PartitionHandle, PathBuffer))
+ {
+ // DPRINT1("Failed to open directory %wZ, Status 0x%08lx\n",
&FileName, Status);
+ return FALSE;
+ }
+
+ /* Check for the existence of \SystemRoot\System32\drivers */
+ StringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer), L"%s%s", SystemRoot,
L"System32\\drivers\\");
+ if (!DoesPathExist(PartitionHandle, PathBuffer))
+ {
+ // DPRINT1("Failed to open directory %wZ, Status 0x%08lx\n",
&FileName, Status);
+ return FALSE;
+ }
+
+ /* Check for the existence of \SystemRoot\System32\config */
+ StringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer), L"%s%s", SystemRoot,
L"System32\\config\\");
+ if (!DoesPathExist(PartitionHandle, PathBuffer))
+ {
+ // DPRINT1("Failed to open directory %wZ, Status 0x%08lx\n",
&FileName, Status);
+ return FALSE;
+ }
+
+#if 0
+ /*
+ * Check for the existence of SYSTEM and SOFTWARE hives in
\SystemRoot\System32\config
+ * (but we don't check here whether they are actually valid).
+ */
+ if (!DoesFileExist(PartitionHandle, SystemRoot,
L"System32\\config\\SYSTEM"))
+ {
+ // DPRINT1("Failed to open file %wZ, Status 0x%08lx\n", &FileName,
Status);
+ return FALSE;
+ }
+ if (!DoesFileExist(PartitionHandle, SystemRoot,
L"System32\\config\\SOFTWARE"))
+ {
+ // DPRINT1("Failed to open file %wZ, Status 0x%08lx\n", &FileName,
Status);
+ return FALSE;
+ }
+#endif
+
+ for (i = 0; i < ARRAYSIZE(KnownVendors); ++i)
+ {
+ /* Check for the existence of \SystemRoot\System32\ntoskrnl.exe and verify its
version */
+ Success = CheckForValidPEAndVendor(PartitionHandle, SystemRoot,
L"System32\\ntoskrnl.exe", KnownVendors[i]);
+
+ /* OPTIONAL: Check for the existence of \SystemRoot\System32\ntkrnlpa.exe */
+
+ /* Check for the existence of \SystemRoot\System32\ntdll.dll */
+ Success = CheckForValidPEAndVendor(PartitionHandle, SystemRoot,
L"System32\\ntdll.dll", KnownVendors[i]);
+
+ /* We have found a correct vendor combination */
+ if (Success)
+ break;
+ }
+
+ return Success;
+}
+
+typedef struct _NTOS_INSTALLATION
+{
+ LIST_ENTRY ListEntry;
+ ULONG DiskNumber;
+ ULONG PartitionNumber;
+// Vendor????
+ WCHAR SystemRoot[MAX_PATH];
+/**/WCHAR InstallationName[MAX_PATH];/**/
+} NTOS_INSTALLATION, *PNTOS_INSTALLATION;
+
+static VOID
+ListNTOSInstalls(
+ IN PGENERIC_LIST List)
+{
+ PGENERIC_LIST_ENTRY Entry;
+ PNTOS_INSTALLATION NtOsInstall;
+ ULONG NtOsInstallsCount = GetNumberOfListEntries(List);
+
+ DPRINT1("There %s %d installation%s detected:\n",
+ NtOsInstallsCount >= 2 ? "are" : "is",
+ NtOsInstallsCount,
+ NtOsInstallsCount >= 2 ? "s" : "");
+
+ Entry = GetFirstListEntry(List);
+ while (Entry)
+ {
+ NtOsInstall = (PNTOS_INSTALLATION)GetListEntryUserData(Entry);
+ Entry = GetNextListEntry(Entry);
+
+ DPRINT1(" On disk #%d, partition #%d: Installation \"%S\" in
SystemRoot %S\n",
+ NtOsInstall->DiskNumber, NtOsInstall->PartitionNumber,
+ NtOsInstall->InstallationName, NtOsInstall->SystemRoot);
+ }
+
+ DPRINT1("Done.\n");
+}
+
+static PNTOS_INSTALLATION
+FindExistingNTOSInstall(
+ IN PGENERIC_LIST List,
+ IN ULONG DiskNumber,
+ IN ULONG PartitionNumber,
+ IN PCWSTR SystemRoot)
+{
+ PGENERIC_LIST_ENTRY Entry;
+ PNTOS_INSTALLATION NtOsInstall;
+
+ Entry = GetFirstListEntry(List);
+ while (Entry)
+ {
+ NtOsInstall = (PNTOS_INSTALLATION)GetListEntryUserData(Entry);
+ Entry = GetNextListEntry(Entry);
+
+ if (NtOsInstall->DiskNumber == DiskNumber &&
+ NtOsInstall->PartitionNumber == PartitionNumber &&
+ _wcsicmp(NtOsInstall->SystemRoot, SystemRoot) == 0)
+ {
+ /* Found it! */
+ return NtOsInstall;
+ }
+ }
+
+ return NULL;
+}
+
+static PNTOS_INSTALLATION
+AddNTOSInstallation(
+ IN PGENERIC_LIST List,
+ IN ULONG DiskNumber,
+ IN ULONG PartitionNumber,
+ IN PCWSTR SystemRoot,
+ IN PCWSTR InstallationName)
+{
+ PNTOS_INSTALLATION NtOsInstall;
+ CHAR InstallNameA[MAX_PATH];
+
+ /* Is there already any installation with these settings? */
+ NtOsInstall = FindExistingNTOSInstall(List, DiskNumber, PartitionNumber,
SystemRoot);
+ if (NtOsInstall)
+ {
+ DPRINT1("An NTOS installation with name \"%S\" already exists on
disk #%d, partition #%d, in SystemRoot %S\n",
+ NtOsInstall->InstallationName, NtOsInstall->DiskNumber,
NtOsInstall->PartitionNumber, NtOsInstall->SystemRoot);
+ return NtOsInstall;
+ }
+
+ /* None was found, so add a new one */
+ NtOsInstall = RtlAllocateHeap(ProcessHeap, HEAP_ZERO_MEMORY, sizeof(*NtOsInstall));
+ if (!NtOsInstall)
+ return NULL;
+
+ NtOsInstall->DiskNumber = DiskNumber;
+ NtOsInstall->PartitionNumber = PartitionNumber;
+ StringCchCopyW(NtOsInstall->SystemRoot, ARRAYSIZE(NtOsInstall->SystemRoot),
SystemRoot);
+ StringCchCopyW(NtOsInstall->InstallationName,
ARRAYSIZE(NtOsInstall->InstallationName), InstallationName);
+
+ // Having the GENERIC_LIST storing the display item string plainly sucks...
+ StringCchPrintfA(InstallNameA, ARRAYSIZE(InstallNameA), "%S",
InstallationName);
+ AppendGenericListEntry(List, InstallNameA, NtOsInstall, FALSE);
+
+ return NtOsInstall;
+}
+
+static VOID
+FindNTOSInstallations(
+ IN PGENERIC_LIST List,
IN ULONG DiskNumber,
IN ULONG PartitionNumber)
{
- BOOLEAN Success = FALSE;
NTSTATUS Status;
UINT i;
HANDLE PartitionHandle, FileHandle;
OBJECT_ATTRIBUTES ObjectAttributes;
IO_STATUS_BLOCK IoStatusBlock;
UNICODE_STRING PartitionRootPath;
+ HANDLE SectionHandle;
+ // SIZE_T ViewSize;
+ PVOID ViewBase;
WCHAR PathBuffer[MAX_PATH];
- UNICODE_STRING FileName;
- // WCHAR FullName[MAX_PATH];
-
- /* Version stuff */
- HANDLE SectionHandle;
- SIZE_T ViewSize;
- PVOID ViewBase;
- PVOID VersionBuffer = NULL; // Read-only
- PVOID pvData = NULL;
- UINT BufLen = 0;
+ WCHAR SystemRoot[MAX_PATH];
/* Set PartitionRootPath */
swprintf(PathBuffer,
L"\\Device\\Harddisk%lu\\Partition%lu\\",
DiskNumber, PartitionNumber);
RtlInitUnicodeString(&PartitionRootPath, PathBuffer);
- DPRINT1("IsRecognizedOS: PartitionRootPath: %wZ\n",
&PartitionRootPath);
+ DPRINT1("FindNTOSInstallations: PartitionRootPath: %wZ\n",
&PartitionRootPath);
/* Open the partition */
InitializeObjectAttributes(&ObjectAttributes,
@@ -402,51 +700,28 @@
FILE_LIST_DIRECTORY | SYNCHRONIZE,
&ObjectAttributes,
&IoStatusBlock,
- 0,
+ FILE_SHARE_READ | FILE_SHARE_WRITE,
FILE_SYNCHRONOUS_IO_NONALERT | FILE_DIRECTORY_FILE);
if (!NT_SUCCESS(Status))
{
DPRINT1("Failed to open partition %wZ, Status 0x%08lx\n",
&PartitionRootPath, Status);
- return FALSE;
+ return;
}
/* Try to see whether we recognize some NT boot loaders */
for (i = 0; i < ARRAYSIZE(NtosBootLoaders); ++i)
{
/* Check whether the loader executable exists */
- RtlInitUnicodeString(&FileName, NtosBootLoaders[i].LoaderExecutable);
- InitializeObjectAttributes(&ObjectAttributes,
- &FileName,
- OBJ_CASE_INSENSITIVE,
- PartitionHandle,
- NULL);
- Status = NtOpenFile(&FileHandle,
- GENERIC_READ | SYNCHRONIZE,
- &ObjectAttributes,
- &IoStatusBlock,
- 0,
- FILE_SYNCHRONOUS_IO_NONALERT | FILE_NON_DIRECTORY_FILE);
- if (!NT_SUCCESS(Status))
+ if (!DoesFileExist(PartitionHandle, NULL, NtosBootLoaders[i].LoaderExecutable))
{
/* The loader does not exist, continue with another one */
DPRINT1("Loader executable %S does not exist, continue with another
one...\n", NtosBootLoaders[i].LoaderExecutable);
continue;
}
- NtClose(FileHandle);
/* Check whether the loader configuration file exists */
- RtlInitUnicodeString(&FileName, NtosBootLoaders[i].LoaderConfigurationFile);
- InitializeObjectAttributes(&ObjectAttributes,
- &FileName,
- OBJ_CASE_INSENSITIVE,
- PartitionHandle,
- NULL);
- Status = NtOpenFile(&FileHandle,
- GENERIC_READ | SYNCHRONIZE,
- &ObjectAttributes,
- &IoStatusBlock,
- 0,
- FILE_SYNCHRONOUS_IO_NONALERT | FILE_NON_DIRECTORY_FILE);
+ Status = OpenAndMapFile(PartitionHandle, NULL,
NtosBootLoaders[i].LoaderConfigurationFile,
+ &FileHandle, &SectionHandle, &ViewBase);
if (!NT_SUCCESS(Status))
{
/* The loader does not exist, continue with another one */
@@ -459,137 +734,37 @@
// TODO!!
DPRINT1("TODO: Analyse the OS installations inside %S !\n",
NtosBootLoaders[i].LoaderConfigurationFile);
- /* Close the file */
+ // Here we get a SystemRootPath for each installation // FIXME!
+ // FIXME: Do NOT hardcode the path!! But retrieve it from boot.ini etc...
+ StringCchCopyW(SystemRoot, ARRAYSIZE(SystemRoot), L"WINDOWS\\");
+ if (IsValidNTOSInstallation(PartitionHandle, SystemRoot))
+ {
+ DPRINT1("Found a valid NTOS installation in disk #%d, partition #%d,
SystemRoot %S\n",
+ DiskNumber, PartitionNumber, SystemRoot);
+ AddNTOSInstallation(List, DiskNumber, PartitionNumber, SystemRoot,
L"Install_Windows");
+ }
+
+ // Here we get a SystemRootPath for each installation // FIXME!
+ // FIXME: Do NOT hardcode the path!! But retrieve it from boot.ini etc...
+ StringCchCopyW(SystemRoot, ARRAYSIZE(SystemRoot), L"ReactOS\\");
+ if (IsValidNTOSInstallation(PartitionHandle, SystemRoot))
+ {
+ DPRINT1("Found a valid NTOS installation in disk #%d, partition #%d,
SystemRoot %S\n",
+ DiskNumber, PartitionNumber, SystemRoot);
+ AddNTOSInstallation(List, DiskNumber, PartitionNumber, SystemRoot,
L"Install_ReactOS");
+ }
+
+ /* Finally, unmap and close the file */
+ UnMapFile(SectionHandle, ViewBase);
NtClose(FileHandle);
}
-
-
-
- /* Find a version string in \SystemRoot\System32\ntoskrnl.exe (standard name) */
- // FIXME: Do NOT hardcode the path!! But retrieve it from boot.ini etc...
- // RtlInitUnicodeString(&FileName,
L"\\SystemRoot\\System32\\ntoskrnl.exe");
- RtlInitUnicodeString(&FileName, L"WINDOWS\\system32\\ntoskrnl.exe");
- InitializeObjectAttributes(&ObjectAttributes,
- &FileName,
- OBJ_CASE_INSENSITIVE,
- PartitionHandle,
- NULL);
- Status = NtOpenFile(&FileHandle,
- GENERIC_READ | SYNCHRONIZE,
- &ObjectAttributes,
- &IoStatusBlock,
- 0,
- FILE_SYNCHRONOUS_IO_NONALERT | FILE_NON_DIRECTORY_FILE);
- if (!NT_SUCCESS(Status))
- {
- DPRINT1("Failed to open file %wZ, Status 0x%08lx\n", &FileName,
Status);
- goto Quit;
- }
-
- /* Map the file in memory */
-
- /* Create the section */
- Status = NtCreateSection(&SectionHandle,
- SECTION_MAP_READ,
- NULL,
- NULL,
- PAGE_READONLY,
- SEC_COMMIT /* | SEC_IMAGE (_NO_EXECUTE) */,
- FileHandle);
- if (!NT_SUCCESS(Status))
- {
- DPRINT1("Failed to create a memory section for file %wZ, Status
0x%08lx\n", &FileName, Status);
- goto SkipFile;
- }
-
- /* Map the section */
- ViewSize = 0;
- ViewBase = NULL;
- Status = NtMapViewOfSection(SectionHandle,
- NtCurrentProcess(),
- &ViewBase,
- 0, 0,
- NULL,
- &ViewSize,
- ViewShare,
- 0,
- PAGE_READONLY);
- /* Close handle to the section */
- NtClose(SectionHandle);
- if (!NT_SUCCESS(Status))
- {
- DPRINT1("Failed to map a view for file %wZ, Status 0x%08lx\n",
&FileName, Status);
- goto SkipFile;
- }
-
- /* Make sure it's a valid PE file */
- if (!RtlImageNtHeader(ViewBase))
- {
- DPRINT1("File %wZ does not seem to be a valid PE, bail out\n",
&FileName);
- Status = STATUS_INVALID_IMAGE_FORMAT;
- goto UnmapFile;
- }
-
- /*
- * Search for a valid executable version and vendor.
- * NOTE: The module is loaded as a data file, it should be marked as such.
- */
- Status = NtGetVersionResource((PVOID)((ULONG_PTR)ViewBase | 1), &VersionBuffer,
NULL);
- if (!NT_SUCCESS(Status))
- {
- DPRINT1("Failed to get version resource for file %wZ, Status
0x%08lx\n", &FileName, Status);
- goto UnmapFile;
- }
-
- Status = NtVerQueryValue(VersionBuffer, L"\\VarFileInfo\\Translation",
&pvData, &BufLen);
- if (NT_SUCCESS(Status))
- {
- USHORT wCodePage = 0, wLangID = 0;
- WCHAR FileInfo[MAX_PATH];
- UNICODE_STRING Vendor;
-
- wCodePage = LOWORD(*(ULONG*)pvData);
- wLangID = HIWORD(*(ULONG*)pvData);
-
- StringCchPrintfW(FileInfo, ARRAYSIZE(FileInfo),
- L"StringFileInfo\\%04X%04X\\CompanyName",
- wCodePage, wLangID);
-
- Status = NtVerQueryValue(VersionBuffer, FileInfo, &pvData, &BufLen);
- if (NT_SUCCESS(Status) && pvData)
- {
- /* BufLen includes the NULL terminator count */
- RtlInitEmptyUnicodeString(&Vendor, pvData, BufLen * sizeof(WCHAR));
- Vendor.Length = Vendor.MaximumLength - sizeof(UNICODE_NULL);
-
- DPRINT1("Found version vendor: \"%wZ\" for file %wZ\n",
&Vendor, &FileName);
-
- /**/
- Success = TRUE;
- /**/
- }
- else
- {
- DPRINT1("No version vendor found for file %wZ\n", &FileName);
- }
- }
-
-UnmapFile:
- /* Finally, unmap the file */
- NtUnmapViewOfSection(NtCurrentProcess(), ViewBase);
-
-SkipFile:
- /* Close the file */
- NtClose(FileHandle);
-
-Quit:
/* Close the partition */
NtClose(PartitionHandle);
- return Success;
-}
-
-static BOOLEAN
+}
+
+// static
+FORCEINLINE BOOLEAN
ShouldICheckThisPartition(
IN PPARTENTRY PartEntry)
{
@@ -602,17 +777,23 @@
(PartEntry->FormatState == Preformatted /* || PartEntry->FormatState ==
Formatted */);
}
-VOID
-DetectOperatingSystems(
- IN PPARTLIST List)
-{
+// EnumerateNTOSInstallations
+PGENERIC_LIST
+CreateNTOSInstallationsList(
+ IN PPARTLIST PartList)
+{
+ PGENERIC_LIST List;
PLIST_ENTRY Entry, Entry2;
PDISKENTRY DiskEntry;
- PPARTENTRY PartEntry = NULL;
+ PPARTENTRY PartEntry;
+
+ List = CreateGenericList();
+ if (List == NULL)
+ return NULL;
/* Loop each available disk ... */
- Entry = List->DiskListHead.Flink;
- while (Entry != &List->DiskListHead)
+ Entry = PartList->DiskListHead.Flink;
+ while (Entry != &PartList->DiskListHead)
{
DiskEntry = CONTAINING_RECORD(Entry, DISKENTRY, ListEntry);
Entry = Entry->Flink;
@@ -638,12 +819,7 @@
ShouldICheckThisPartition(PartEntry) ? "YES!" :
"NO!");
if (ShouldICheckThisPartition(PartEntry))
- {
- BOOLEAN IsRecognized = IsRecognizedOS(DiskEntry->DiskNumber,
PartEntry->PartitionNumber);
- DPRINT1("%s OS in partition #%d, index %d\n",
- IsRecognized ? "Recognized" :
"Unrecognized",
- PartEntry->PartitionNumber, PartEntry->PartitionIndex);
- }
+ FindNTOSInstallations(List, DiskEntry->DiskNumber,
PartEntry->PartitionNumber);
}
/* Then, the logical partitions (present in the extended partition) */
@@ -663,14 +839,14 @@
ShouldICheckThisPartition(PartEntry) ? "YES!" :
"NO!");
if (ShouldICheckThisPartition(PartEntry))
- {
- BOOLEAN IsRecognized = IsRecognizedOS(DiskEntry->DiskNumber,
PartEntry->PartitionNumber);
- DPRINT1("%s OS in partition #%d, index %d\n",
- IsRecognized ? "Recognized" :
"Unrecognized",
- PartEntry->PartitionNumber, PartEntry->PartitionIndex);
- }
- }
- }
+ FindNTOSInstallations(List, DiskEntry->DiskNumber,
PartEntry->PartitionNumber);
+ }
+ }
+
+ /**** Debugging: List all the collected installations ****/
+ ListNTOSInstalls(List);
+
+ return List;
}
/* EOF */