https://git.reactos.org/?p=reactos.git;a=commitdiff;h=12542f271dfdccf99dbdb…
commit 12542f271dfdccf99dbdb49c25d8b32f83df47ed
Author: Victor Perevertkin <victor(a)perevertkin.ru>
AuthorDate: Wed Jun 26 00:56:21 2019 +0300
Commit: Victor Perevertkin <victor(a)perevertkin.ru>
CommitDate: Wed Jun 26 00:56:21 2019 +0300
[FREELDR] Fix Release build
---
boot/freeldr/freeldr/lib/mm/heap.c | 11 +++++++----
boot/freeldr/freeldr/lib/peloader.c | 18 ++++++++++++------
boot/freeldr/freeldr/ntldr/setupldr.c | 11 ++++++++---
3 files changed, 27 insertions(+), 13 deletions(-)
diff --git a/boot/freeldr/freeldr/lib/mm/heap.c b/boot/freeldr/freeldr/lib/mm/heap.c
index 236658a7e8e..0e45ba352da 100644
--- a/boot/freeldr/freeldr/lib/mm/heap.c
+++ b/boot/freeldr/freeldr/lib/mm/heap.c
@@ -184,7 +184,8 @@ FrLdrHeapRelease(
PHEAP Heap = HeapHandle;
PHEAP_BLOCK Block;
PUCHAR StartAddress, EndAddress;
- PFN_COUNT FreePages, AllPages, AllFreePages = 0;
+ PFN_COUNT FreePages, AllFreePages = 0;
+
TRACE("HeapRelease(%p)\n", HeapHandle);
/* Loop all heap chunks */
@@ -240,13 +241,13 @@ FrLdrHeapRelease(
if (Block->Size == 0) break;
}
- AllPages = Heap->MaximumSize / MM_PAGE_SIZE;
- TRACE("HeapRelease() done, freed %lu of %lu pages\n", AllFreePages,
AllPages);
+ TRACE("HeapRelease() done, freed %lu of %lu pages\n", AllFreePages,
Heap->MaximumSize / MM_PAGE_SIZE);
}
VOID
FrLdrHeapCleanupAll(VOID)
{
+#if DBG
PHEAP Heap;
Heap = FrLdrDefaultHeap;
@@ -257,17 +258,19 @@ FrLdrHeapCleanupAll(VOID)
Heap->NumAllocs, Heap->NumFrees);
TRACE("AllocTime = %I64d, FreeTime = %I64d, sum = %I64d\n",
Heap->AllocationTime, Heap->FreeTime, Heap->AllocationTime +
Heap->FreeTime);
-
+#endif
/* Release free pages from the default heap */
FrLdrHeapRelease(FrLdrDefaultHeap);
+#if DBG
Heap = FrLdrTempHeap;
TRACE("Heap statistics for temp heap:\n"
"CurrentAlloc=0x%lx, MaxAlloc=0x%lx, LargestAllocation=0x%lx\n"
"NumAllocs=%ld, NumFrees=%ld\n",
Heap->CurrentAllocBytes, Heap->MaxAllocBytes,
Heap->LargestAllocation,
Heap->NumAllocs, Heap->NumFrees);
+#endif
/* Destroy the temp heap */
FrLdrHeapDestroy(FrLdrTempHeap);
diff --git a/boot/freeldr/freeldr/lib/peloader.c b/boot/freeldr/freeldr/lib/peloader.c
index 84eef62c252..ac61aba1a9f 100644
--- a/boot/freeldr/freeldr/lib/peloader.c
+++ b/boot/freeldr/freeldr/lib/peloader.c
@@ -112,6 +112,7 @@ WinLdrScanImportDescriptorTable(IN OUT PLIST_ENTRY ModuleListHead,
ImportTable =
(PIMAGE_IMPORT_DESCRIPTOR)RtlImageDirectoryEntryToData(VaToPa(ScanDTE->DllBase),
TRUE, IMAGE_DIRECTORY_ENTRY_IMPORT, &ImportTableSize);
+#if DBG
{
UNICODE_STRING BaseName;
BaseName.Buffer = VaToPa(ScanDTE->BaseDllName.Buffer);
@@ -120,6 +121,7 @@ WinLdrScanImportDescriptorTable(IN OUT PLIST_ENTRY ModuleListHead,
TRACE("WinLdrScanImportDescriptorTable(): %wZ ImportTable = 0x%X\n",
&BaseName, ImportTable);
}
+#endif
/* If image doesn't have any import directory - just return success */
if (ImportTable == NULL)
@@ -456,17 +458,21 @@ WinLdrpCompareDllName(IN PCH DllName,
IN PUNICODE_STRING UnicodeName)
{
PWSTR Buffer;
- UNICODE_STRING UnicodeNamePA;
SIZE_T i, Length;
/* First obvious check: for length of two names */
Length = strlen(DllName);
- UnicodeNamePA.Length = UnicodeName->Length;
- UnicodeNamePA.MaximumLength = UnicodeName->MaximumLength;
- UnicodeNamePA.Buffer = VaToPa(UnicodeName->Buffer);
- TRACE("WinLdrpCompareDllName: %s and %wZ, Length = %d "
- "UN->Length %d\n", DllName, &UnicodeNamePA, Length,
UnicodeName->Length);
+#if DBG
+ {
+ UNICODE_STRING UnicodeNamePA;
+ UnicodeNamePA.Length = UnicodeName->Length;
+ UnicodeNamePA.MaximumLength = UnicodeName->MaximumLength;
+ UnicodeNamePA.Buffer = VaToPa(UnicodeName->Buffer);
+ TRACE("WinLdrpCompareDllName: %s and %wZ, Length = %d "
+ "UN->Length %d\n", DllName, &UnicodeNamePA, Length,
UnicodeName->Length);
+ }
+#endif
if ((Length * sizeof(WCHAR)) > UnicodeName->Length)
return FALSE;
diff --git a/boot/freeldr/freeldr/ntldr/setupldr.c
b/boot/freeldr/freeldr/ntldr/setupldr.c
index 111194acd03..10bfe3dff37 100644
--- a/boot/freeldr/freeldr/ntldr/setupldr.c
+++ b/boot/freeldr/freeldr/ntldr/setupldr.c
@@ -36,7 +36,6 @@ static VOID
SetupLdrLoadNlsData(PLOADER_PARAMETER_BLOCK LoaderBlock, HINF InfHandle, LPCSTR
SearchPath)
{
INFCONTEXT InfContext;
- BOOLEAN Success;
LPCSTR AnsiName, OemName, LangName;
/* Get ANSI codepage file */
@@ -76,8 +75,14 @@ SetupLdrLoadNlsData(PLOADER_PARAMETER_BLOCK LoaderBlock, HINF
InfHandle, LPCSTR
TRACE("NLS data %s %s %s\n", AnsiName, OemName, LangName);
- Success = WinLdrLoadNLSData(LoaderBlock, SearchPath, AnsiName, OemName, LangName);
- TRACE("NLS data loading %s\n", Success ? "successful" :
"failed");
+#if DBG
+ {
+ BOOLEAN Success = WinLdrLoadNLSData(LoaderBlock, SearchPath, AnsiName, OemName,
LangName);
+ TRACE("NLS data loading %s\n", Success ? "successful" :
"failed");
+ }
+#else
+ WinLdrLoadNLSData(LoaderBlock, SearchPath, AnsiName, OemName, LangName);
+#endif
/* TODO: Load OEM HAL font */
// Value "OemHalFont"