Author: fireball Date: Fri Jan 25 18:08:27 2008 New Revision: 31996
URL: http://svn.reactos.org/svn/reactos?rev=31996&view=rev Log: - Add a runtime switch between using freeldr-embedded configuration tree heap, or using a real heap allocation (for NT-way). - Use that in winldr.
Modified: trunk/reactos/boot/freeldr/freeldr/reactos/archwsup.c trunk/reactos/boot/freeldr/freeldr/windows/winldr.c
Modified: trunk/reactos/boot/freeldr/freeldr/reactos/archwsup.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/reacto... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/reactos/archwsup.c (original) +++ trunk/reactos/boot/freeldr/freeldr/reactos/archwsup.c Fri Jan 25 18:08:27 2008 @@ -18,6 +18,8 @@ ULONG FldrpHwHeapLocation; PCONFIGURATION_COMPONENT_DATA FldrArcHwTreeRoot;
+BOOLEAN UseRealHeap = FALSE; + /* FUNCTIONS ******************************************************************/
PVOID @@ -25,13 +27,21 @@ FldrpHwHeapAlloc(IN ULONG Size) { PVOID Buffer; - - /* Return a block of memory from the ARC Hardware Heap */ - Buffer = &reactos_arc_hardware_data[FldrpHwHeapLocation]; - - /* Increment the heap location */ - FldrpHwHeapLocation += Size; - if (FldrpHwHeapLocation > HW_MAX_ARC_HEAP_SIZE) Buffer = NULL; + + if (UseRealHeap) + { + /* Allocate memory from generic bootloader heap */ + Buffer = MmHeapAlloc(Size); + } + else + { + /* Return a block of memory from the ARC Hardware Heap */ + Buffer = &reactos_arc_hardware_data[FldrpHwHeapLocation]; + + /* Increment the heap location */ + FldrpHwHeapLocation += Size; + if (FldrpHwHeapLocation > HW_MAX_ARC_HEAP_SIZE) Buffer = NULL; + }
/* Clear it */ if (Buffer)
Modified: trunk/reactos/boot/freeldr/freeldr/windows/winldr.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/window... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/windows/winldr.c (original) +++ trunk/reactos/boot/freeldr/freeldr/windows/winldr.c Fri Jan 25 18:08:27 2008 @@ -29,6 +29,8 @@ extern ARC_DISK_SIGNATURE reactos_arc_disk_info[]; extern char reactos_arc_strings[32][256];
+extern BOOLEAN UseRealHeap; + BOOLEAN WinLdrCheckForLoadedDll(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock, IN PCH DllName, @@ -429,6 +431,7 @@ AllocateAndInitLPB(&LoaderBlock);
/* Detect hardware */ + UseRealHeap = TRUE; LoaderBlock->ConfigurationRoot = MachHwDetect();
/* Load kernel */