- Jesus Christ... will Hell freeze over before someone finally listens and implements a proper PE loader in Freeloader?

svn path=/trunk/; revision=23793
This commit is contained in:
Alex Ionescu 2006-08-30 01:22:41 +00:00
parent ab77204ef9
commit 655e78f3cc

View file

@ -72,6 +72,8 @@ VOID INIT_FUNCTION _main(ULONG MultiBootMagic, PROS_LOADER_PARAMETER_BLOCK _Load
#pragma alloc_text(INIT, _main) #pragma alloc_text(INIT, _main)
#endif #endif
extern LDR_DATA_TABLE_ENTRY HalModuleObject;
/* FUNCTIONS ****************************************************************/ /* FUNCTIONS ****************************************************************/
/* /*
@ -240,6 +242,17 @@ _main(ULONG MultiBootMagic,
(PVOID)KERNEL_BASE, (PVOID)KERNEL_BASE,
&DriverSize); &DriverSize);
//
//
// HACK HACK HACK WHEN WILL YOU PEOPLE FIX FREELDR?!?!?!
// FREELDR SENDS US AN ***INVALID*** HAL PE HEADER!!!
// WE READ IT IN LdrInitModuleManagement ABOVE!!!
// WE SET .SizeOfImage TO A *GARBAGE* VALUE!!!
//
// This dirty hack fixes it, and should make symbol lookup work too.
//
HalModuleObject.SizeOfImage = RtlImageNtHeader((PVOID)HalModuleObject.DllBase)->OptionalHeader.SizeOfImage;
/* Increase the last kernel address with the size of HAL */ /* Increase the last kernel address with the size of HAL */
LastKernelAddress += PAGE_ROUND_UP(DriverSize); LastKernelAddress += PAGE_ROUND_UP(DriverSize);