From 6d9cf47ce2c2f274bd989e8fee12c8af37e9f22a Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 25 Jun 2011 13:52:47 +0000 Subject: [PATCH] [FEELDR] - Don't try to load referenced dlls in any other dir than system32. A second attempt would fail on the first dll that was already loaded and the function would bail out before any missing dll could be loaded. This worked only by chance on gcc builds, because the 1st import was bootvid, which was always loaded in the 2nd attempt from system32, and the function failed after that, since hal and kdcom were already loaded. svn path=/trunk/; revision=52452 --- reactos/boot/freeldr/freeldr/windows/i386/wlmemory.c | 8 ++++---- reactos/boot/freeldr/freeldr/windows/setupldr2.c | 11 +++-------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/reactos/boot/freeldr/freeldr/windows/i386/wlmemory.c b/reactos/boot/freeldr/freeldr/windows/i386/wlmemory.c index 578927c9daf..8eb7bb61c44 100644 --- a/reactos/boot/freeldr/freeldr/windows/i386/wlmemory.c +++ b/reactos/boot/freeldr/freeldr/windows/i386/wlmemory.c @@ -148,7 +148,7 @@ MempSetupPaging(IN ULONG StartPage, ULONG Entry, Page; //Print(L"MempSetupPaging: SP 0x%X, Number: 0x%X\n", StartPage, NumberOfPages); - + // HACK if (StartPage+NumberOfPages >= 0x80000) { @@ -487,13 +487,13 @@ WinLdrSetProcessorContext(PVOID GdtIdt, IN ULONG Pcr, IN ULONG Tss) "1:\n"); #elif defined(_MSC_VER) /* We can't express the above in MASM so we use this far return instead */ - DbgPrint("WinLdrSetProcessorContext: Performing untested far-return\n"); - __asm { + __asm + { push 8 push offset resume retf resume: - }; + }; #else #error #endif diff --git a/reactos/boot/freeldr/freeldr/windows/setupldr2.c b/reactos/boot/freeldr/freeldr/windows/setupldr2.c index 58ee4d89d31..a371cc72a02 100644 --- a/reactos/boot/freeldr/freeldr/windows/setupldr2.c +++ b/reactos/boot/freeldr/freeldr/windows/setupldr2.c @@ -123,7 +123,7 @@ SetupLdrScanBootDrivers(PLOADER_PARAMETER_BLOCK LoaderBlock, HINF InfHandle, LPC do { if (InfGetDataField(&InfContext, 7, &Media) && - InfGetDataField(&InfContext, 0, &DriverName) && + InfGetDataField(&InfContext, 0, &DriverName) && InfGetDataField(&InfContext, 13, &dirIndex)) { if ((strcmp(Media, "x") == 0) && @@ -137,7 +137,7 @@ SetupLdrScanBootDrivers(PLOADER_PARAMETER_BLOCK LoaderBlock, HINF InfHandle, LPC swprintf(ImagePathW, L"%S", ImagePath); wcscat(ImagePathW, L"\\"); wcscat(ImagePathW, ServiceName); - + /* Remove .sys extension */ ServiceName[wcslen(ServiceName) - 4] = 0; @@ -310,12 +310,7 @@ VOID LoadReactOSSetup2(VOID) /* Load all referenced DLLs for kernel, HAL and kdcom.dll */ strcpy(SearchPath, BootPath); - WinLdrScanImportDescriptorTable(LoaderBlock, SearchPath, KernelDTE); - WinLdrScanImportDescriptorTable(LoaderBlock, SearchPath, HalDTE); - if (KdComDTE) - WinLdrScanImportDescriptorTable(LoaderBlock, SearchPath, KdComDTE); - /* In system32 too */ - strcpy(SearchPath + strlen(BootPath), "system32\\"); + strcat(SearchPath, "system32\\"); WinLdrScanImportDescriptorTable(LoaderBlock, SearchPath, KernelDTE); WinLdrScanImportDescriptorTable(LoaderBlock, SearchPath, HalDTE); if (KdComDTE)