From 9016b5f3efc8fd3378112e818cacb78cb8cf7ea9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Sun, 28 Oct 2018 23:33:29 +0100 Subject: [PATCH] [SETUPLIB] Silence noisy DPRINTs. --- base/setup/lib/bootsup.c | 18 +++--- base/setup/lib/utils/bldrsup.c | 12 ++-- base/setup/lib/utils/osdetect.c | 106 +++++++++++++++++--------------- 3 files changed, 70 insertions(+), 66 deletions(-) diff --git a/base/setup/lib/bootsup.c b/base/setup/lib/bootsup.c index 3059d0c884c..1caf02f951c 100644 --- a/base/setup/lib/bootsup.c +++ b/base/setup/lib/bootsup.c @@ -356,10 +356,10 @@ EnumerateReactOSEntries( RTL_FIELD_SIZE(NTOS_OPTIONS, Signature)) { /* This is not a ReactOS entry */ - // DPRINT1(" An installation '%S' of unsupported type '%S'\n", - // BootEntry->FriendlyName, BootEntry->Version ? BootEntry->Version : L"n/a"); - DPRINT1(" An installation '%S' of unsupported type %lu\n", - BootEntry->FriendlyName, BootEntry->OsOptionsLength); + // DPRINT(" An installation '%S' of unsupported type '%S'\n", + // BootEntry->FriendlyName, BootEntry->Version ? BootEntry->Version : L"n/a"); + DPRINT(" An installation '%S' of unsupported type %lu\n", + BootEntry->FriendlyName, BootEntry->OsOptionsLength); /* Continue the enumeration */ goto SkipThisEntry; } @@ -388,12 +388,12 @@ EnumerateReactOSEntries( } } - DPRINT1(" Found a candidate Win2k3 install '%S' with ARC path '%S'\n", - BootEntry->FriendlyName, Options->OsLoadPath); - // DPRINT1(" Found a Win2k3 install '%S' with ARC path '%S'\n", - // BootEntry->FriendlyName, Options->OsLoadPath); + DPRINT(" Found a candidate Win2k3 install '%S' with ARC path '%S'\n", + BootEntry->FriendlyName, Options->OsLoadPath); + // DPRINT(" Found a Win2k3 install '%S' with ARC path '%S'\n", + // BootEntry->FriendlyName, Options->OsLoadPath); - DPRINT1("EnumerateReactOSEntries: OsLoadPath: '%S'\n", Options->OsLoadPath); + DPRINT("EnumerateReactOSEntries: OsLoadPath: '%S'\n", Options->OsLoadPath); Data->UseExistingEntry = TRUE; RtlStringCchCopyW(Data->OsName, ARRAYSIZE(Data->OsName), BootEntry->FriendlyName); diff --git a/base/setup/lib/utils/bldrsup.c b/base/setup/lib/utils/bldrsup.c index a2978a0f257..09c59945b73 100644 --- a/base/setup/lib/utils/bldrsup.c +++ b/base/setup/lib/utils/bldrsup.c @@ -156,18 +156,18 @@ FindBootStore( // By handle if (DoesFileExist(PartitionDirectoryHandle, LoaderExecutable)) { /* A loader was found, stop there */ - DPRINT1("Found loader executable '%S'\n", LoaderExecutable); + DPRINT("Found loader executable '%S'\n", LoaderExecutable); break; } /* The loader does not exist, continue with another one */ - DPRINT1("Loader executable '%S' does not exist, continue with another one...\n", LoaderExecutable); + DPRINT("Loader executable '%S' does not exist, continue with another one...\n", LoaderExecutable); LoaderExecutable += wcslen(LoaderExecutable) + 1; } if (!*LoaderExecutable) { /* No loader was found */ - DPRINT1("No loader executable was found\n"); + DPRINT("No loader executable was found\n"); return STATUS_NOT_FOUND; } @@ -1308,7 +1308,7 @@ FreeLdrEnumerateBootEntries( InstallName = Buffer; } - DPRINT1("Boot entry '%S' in OS section '%S'\n", InstallName, SectionName); + DPRINT("Boot entry '%S' in OS section '%S'\n", InstallName, SectionName); BootEntry->Version = FreeLdr; BootEntry->BootEntryKey = MAKESTRKEY(SectionName); @@ -1337,7 +1337,7 @@ FreeLdrEnumerateBootEntries( /* BootType is Windows2003 */ PNTOS_OPTIONS Options = (PNTOS_OPTIONS)&BootEntry->OsOptions; - DPRINT1("This is a '%S' boot entry\n", KeyData); + DPRINT("This is a '%S' boot entry\n", KeyData); BootEntry->OsOptionsLength = sizeof(NTOS_OPTIONS); RtlCopyMemory(Options->Signature, @@ -1368,7 +1368,7 @@ FreeLdrEnumerateBootEntries( /* BootType is BootSector */ PBOOT_SECTOR_OPTIONS Options = (PBOOT_SECTOR_OPTIONS)&BootEntry->OsOptions; - DPRINT1("This is a '%S' boot entry\n", KeyData); + DPRINT("This is a '%S' boot entry\n", KeyData); BootEntry->OsOptionsLength = sizeof(BOOT_SECTOR_OPTIONS); RtlCopyMemory(Options->Signature, diff --git a/base/setup/lib/utils/osdetect.c b/base/setup/lib/utils/osdetect.c index e654312c485..ed5e1f58054 100644 --- a/base/setup/lib/utils/osdetect.c +++ b/base/setup/lib/utils/osdetect.c @@ -96,10 +96,10 @@ EnumerateInstallations( RTL_FIELD_SIZE(NTOS_OPTIONS, Signature)) { /* This is not a ReactOS entry */ - // DPRINT1(" An installation '%S' of unsupported type '%S'\n", - // BootEntry->FriendlyName, BootEntry->Version ? BootEntry->Version : L"n/a"); - DPRINT1(" An installation '%S' of unsupported type %lu\n", - BootEntry->FriendlyName, BootEntry->OsOptionsLength); + // DPRINT(" An installation '%S' of unsupported type '%S'\n", + // BootEntry->FriendlyName, BootEntry->Version ? BootEntry->Version : L"n/a"); + DPRINT(" An installation '%S' of unsupported type %lu\n", + BootEntry->FriendlyName, BootEntry->OsOptionsLength); /* Continue the enumeration */ return STATUS_SUCCESS; } @@ -113,10 +113,10 @@ EnumerateInstallations( return STATUS_SUCCESS; } - DPRINT1(" Found a candidate Win2k3 install '%S' with ARC path '%S'\n", - BootEntry->FriendlyName, Options->OsLoadPath); - // DPRINT1(" Found a Win2k3 install '%S' with ARC path '%S'\n", - // BootEntry->FriendlyName, Options->OsLoadPath); + DPRINT(" Found a candidate Win2k3 install '%S' with ARC path '%S'\n", + BootEntry->FriendlyName, Options->OsLoadPath); + // DPRINT(" Found a Win2k3 install '%S' with ARC path '%S'\n", + // BootEntry->FriendlyName, Options->OsLoadPath); // TODO: Normalize the ARC path. @@ -127,8 +127,8 @@ EnumerateInstallations( NtOsInstall = FindExistingNTOSInstall(Data->List, Options->OsLoadPath, NULL); if (NtOsInstall) { - DPRINT1(" An NTOS installation with name \"%S\" from vendor \"%S\" already exists in SystemRoot '%wZ'\n", - NtOsInstall->InstallationName, NtOsInstall->VendorName, &NtOsInstall->SystemArcPath); + DPRINT(" An NTOS installation with name \"%S\" from vendor \"%S\" already exists in SystemRoot '%wZ'\n", + NtOsInstall->InstallationName, NtOsInstall->VendorName, &NtOsInstall->SystemArcPath); /* Continue the enumeration */ return STATUS_SUCCESS; } @@ -146,8 +146,8 @@ EnumerateInstallations( return STATUS_SUCCESS; } - DPRINT1("ArcPathToNtPath() succeeded: '%S' --> '%wZ'\n", - Options->OsLoadPath, &SystemRootPath); + DPRINT("ArcPathToNtPath() succeeded: '%S' --> '%wZ'\n", + Options->OsLoadPath, &SystemRootPath); /* * Check whether we already have an installation with this NT path. @@ -162,7 +162,7 @@ EnumerateInstallations( return STATUS_SUCCESS; } - DPRINT1("EnumerateInstallations: SystemRootPath: '%wZ'\n", &SystemRootPath); + DPRINT("EnumerateInstallations: SystemRootPath: '%wZ'\n", &SystemRootPath); /* Check if this is a valid NTOS installation; stop there if it isn't one */ RtlInitEmptyUnicodeString(&VendorName, VendorNameBuffer, sizeof(VendorNameBuffer)); @@ -172,14 +172,14 @@ EnumerateInstallations( return STATUS_SUCCESS; } - DPRINT1("Found a valid NTOS installation in SystemRoot ARC path '%S', NT path '%wZ'\n", - Options->OsLoadPath, &SystemRootPath); + DPRINT("Found a valid NTOS installation in SystemRoot ARC path '%S', NT path '%wZ'\n", + Options->OsLoadPath, &SystemRootPath); /* From the NT path, compute the disk, partition and path components */ if (NtPathToDiskPartComponents(SystemRootPath.Buffer, &DiskNumber, &PartitionNumber, &PathComponent)) { - DPRINT1("SystemRootPath = '%wZ' points to disk #%d, partition #%d, path '%S'\n", - &SystemRootPath, DiskNumber, PartitionNumber, PathComponent); + DPRINT("SystemRootPath = '%wZ' points to disk #%d, partition #%d, path '%S'\n", + &SystemRootPath, DiskNumber, PartitionNumber, PathComponent); /* Retrieve the corresponding disk and partition */ if (!GetDiskOrPartition(Data->PartList, DiskNumber, PartitionNumber, &DiskEntry, &PartEntry)) @@ -307,7 +307,7 @@ CheckForValidPEAndVendor( if (NT_SUCCESS(Status) /*&& pvData*/) { /* BufLen includes the NULL terminator count */ - DPRINT1("Found version vendor: \"%S\" for file '%S'\n", pvData, PathNameToFile); + DPRINT("Found version vendor: \"%S\" for file '%S'\n", pvData, PathNameToFile); RtlStringCbCopyNW(VendorName->Buffer, VendorName->MaximumLength, pvData, BufLen * sizeof(WCHAR)); @@ -318,7 +318,7 @@ CheckForValidPEAndVendor( } if (!NT_SUCCESS(Status)) - DPRINT1("No version vendor found for file '%S'\n", PathNameToFile); + DPRINT("No version vendor found for file '%S'\n", PathNameToFile); UnmapCloseFile: /* Finally, unmap and close the file */ @@ -417,7 +417,7 @@ IsValidNTOSInstallationByHandle( if (Success) { /* We have found a correct vendor combination */ - DPRINT1("IsValidNTOSInstallation: We've got an NTOS installation from %S !\n", KnownVendors[i]); + DPRINT("IsValidNTOSInstallation: We've got an NTOS installation from %S !\n", KnownVendors[i]); break; } } @@ -445,7 +445,7 @@ IsValidNTOSInstallationByHandle( if (!!FindSubStrI(LocalVendorName.Buffer, KnownVendors[i])) { /* We have found a correct vendor combination */ - DPRINT1("IsValidNTOSInstallation: The user-mode DLL '%S' is from %S\n", PathName, KnownVendors[i]); + DPRINT("IsValidNTOSInstallation: The user-mode DLL '%S' is from %S\n", PathName, KnownVendors[i]); break; } } @@ -498,6 +498,7 @@ IsValidNTOSInstallation( return Success; } +#ifndef NDEBUG static VOID DumpNTOSInstalls( IN PGENERIC_LIST List) @@ -506,22 +507,23 @@ DumpNTOSInstalls( PNTOS_INSTALLATION NtOsInstall; ULONG NtOsInstallsCount = GetNumberOfListEntries(List); - DPRINT1("There %s %d installation%s detected:\n", - NtOsInstallsCount >= 2 ? "are" : "is", - NtOsInstallsCount, - NtOsInstallsCount >= 2 ? "s" : ""); + DPRINT("There %s %d installation%s detected:\n", + NtOsInstallsCount >= 2 ? "are" : "is", + NtOsInstallsCount, + NtOsInstallsCount >= 2 ? "s" : ""); for (Entry = GetFirstListEntry(List); Entry; Entry = GetNextListEntry(Entry)) { NtOsInstall = (PNTOS_INSTALLATION)GetListEntryData(Entry); - DPRINT1(" On disk #%d, partition #%d: Installation \"%S\" in SystemRoot '%wZ'\n", - NtOsInstall->DiskNumber, NtOsInstall->PartitionNumber, - NtOsInstall->InstallationName, &NtOsInstall->SystemNtPath); + DPRINT(" On disk #%d, partition #%d: Installation \"%S\" in SystemRoot '%wZ'\n", + NtOsInstall->DiskNumber, NtOsInstall->PartitionNumber, + NtOsInstall->InstallationName, &NtOsInstall->SystemNtPath); } - DPRINT1("Done.\n"); + DPRINT("Done.\n"); } +#endif static PNTOS_INSTALLATION FindExistingNTOSInstall( @@ -661,7 +663,7 @@ FindNTOSInstallations( L"\\Device\\Harddisk%lu\\Partition%lu\\", DiskNumber, PartitionNumber); RtlInitUnicodeString(&PartitionRootPath, PathBuffer); - DPRINT1("FindNTOSInstallations: PartitionRootPath: '%wZ'\n", &PartitionRootPath); + DPRINT("FindNTOSInstallations: PartitionRootPath: '%wZ'\n", &PartitionRootPath); /* Open the partition */ InitializeObjectAttributes(&ObjectAttributes, @@ -691,14 +693,14 @@ FindNTOSInstallations( if (!NT_SUCCESS(Status)) { /* The loader does not exist, continue with another one */ - DPRINT1("Loader type '%d' does not exist, or an error happened (Status 0x%08lx), continue with another one...\n", - Type, Status); + DPRINT("Loader type '%d' does not exist, or an error happened (Status 0x%08lx), continue with another one...\n", + Type, Status); continue; } /* The loader exists, try to enumerate its boot entries */ - DPRINT1("Analyse the OS installations for loader type '%d' in disk #%d, partition #%d\n", - Type, DiskNumber, PartitionNumber); + DPRINT("Analyze the OS installations for loader type '%d' in disk #%d, partition #%d\n", + Type, DiskNumber, PartitionNumber); Status = OpenBootStoreByHandle(&BootStoreHandle, PartitionDirectoryHandle, Type, FALSE); if (!NT_SUCCESS(Status)) @@ -750,7 +752,7 @@ CreateNTOSInstallationsList( DiskEntry = CONTAINING_RECORD(Entry, DISKENTRY, ListEntry); Entry = Entry->Flink; - DPRINT1("Disk #%d\n", DiskEntry->DiskNumber); + DPRINT("Disk #%d\n", DiskEntry->DiskNumber); /* ... and for each disk, loop each available partition */ @@ -763,14 +765,14 @@ CreateNTOSInstallationsList( ASSERT(PartEntry->DiskEntry == DiskEntry); - DPRINT1(" Primary Partition #%d, index %d - Type 0x%02x, IsLogical = %s, IsPartitioned = %s, IsNew = %s, AutoCreate = %s, FormatState = %lu -- Should I check it? %s\n", - PartEntry->PartitionNumber, PartEntry->PartitionIndex, - PartEntry->PartitionType, PartEntry->LogicalPartition ? "TRUE" : "FALSE", - PartEntry->IsPartitioned ? "TRUE" : "FALSE", - PartEntry->New ? "Yes" : "No", - PartEntry->AutoCreate ? "Yes" : "No", - PartEntry->FormatState, - ShouldICheckThisPartition(PartEntry) ? "YES!" : "NO!"); + DPRINT(" Primary Partition #%d, index %d - Type 0x%02x, IsLogical = %s, IsPartitioned = %s, IsNew = %s, AutoCreate = %s, FormatState = %lu -- Should I check it? %s\n", + PartEntry->PartitionNumber, PartEntry->PartitionIndex, + PartEntry->PartitionType, PartEntry->LogicalPartition ? "TRUE" : "FALSE", + PartEntry->IsPartitioned ? "TRUE" : "FALSE", + PartEntry->New ? "Yes" : "No", + PartEntry->AutoCreate ? "Yes" : "No", + PartEntry->FormatState, + ShouldICheckThisPartition(PartEntry) ? "YES!" : "NO!"); if (ShouldICheckThisPartition(PartEntry)) FindNTOSInstallations(List, PartList, PartEntry); @@ -785,22 +787,24 @@ CreateNTOSInstallationsList( ASSERT(PartEntry->DiskEntry == DiskEntry); - DPRINT1(" Logical Partition #%d, index %d - Type 0x%02x, IsLogical = %s, IsPartitioned = %s, IsNew = %s, AutoCreate = %s, FormatState = %lu -- Should I check it? %s\n", - PartEntry->PartitionNumber, PartEntry->PartitionIndex, - PartEntry->PartitionType, PartEntry->LogicalPartition ? "TRUE" : "FALSE", - PartEntry->IsPartitioned ? "TRUE" : "FALSE", - PartEntry->New ? "Yes" : "No", - PartEntry->AutoCreate ? "Yes" : "No", - PartEntry->FormatState, - ShouldICheckThisPartition(PartEntry) ? "YES!" : "NO!"); + DPRINT(" Logical Partition #%d, index %d - Type 0x%02x, IsLogical = %s, IsPartitioned = %s, IsNew = %s, AutoCreate = %s, FormatState = %lu -- Should I check it? %s\n", + PartEntry->PartitionNumber, PartEntry->PartitionIndex, + PartEntry->PartitionType, PartEntry->LogicalPartition ? "TRUE" : "FALSE", + PartEntry->IsPartitioned ? "TRUE" : "FALSE", + PartEntry->New ? "Yes" : "No", + PartEntry->AutoCreate ? "Yes" : "No", + PartEntry->FormatState, + ShouldICheckThisPartition(PartEntry) ? "YES!" : "NO!"); if (ShouldICheckThisPartition(PartEntry)) FindNTOSInstallations(List, PartList, PartEntry); } } +#ifndef NDEBUG /**** Debugging: List all the collected installations ****/ DumpNTOSInstalls(List); +#endif return List; } -- 2.17.1