Author: tkreuzer
Date: Fri Sep 30 21:13:49 2011
New Revision: 53908
URL:
http://svn.reactos.org/svn/reactos?rev=53908&view=rev
Log:
[FREELDR]
Remove DTEs for ntbootdd.sys and freeldr.sys after they are not used any longer. freeldr
one will even point to invalid stack data. It only works currently, because the
LoadOrderListHead is reset later. More fixes are coming.
Modified:
trunk/reactos/boot/freeldr/freeldr/disk/scsiport.c
Modified: trunk/reactos/boot/freeldr/freeldr/disk/scsiport.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/disk/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/disk/scsiport.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/disk/scsiport.c [iso-8859-1] Fri Sep 30 21:13:49
2011
@@ -1659,12 +1659,6 @@
FunctionTable[i] = (ULONG)((ULONG_PTR)ExportTable[i].Function -
(ULONG_PTR)&ImageDosHeader);
}
- /* Add freeldr.sys to list of loaded executables */
- Status = WinLdrAllocateDataTableEntry(&LoaderBlock, "scsiport.sys",
- "FREELDR.SYS", &ImageDosHeader, &FreeldrDTE);
- if (!Status)
- return EIO;
-
/* Create full ntbootdd.sys path */
MachDiskGetBootPath(NtBootDdPath, sizeof(NtBootDdPath));
strcat(NtBootDdPath, "\\NTBOOTDD.SYS");
@@ -1677,12 +1671,28 @@
return ESUCCESS;
}
- /* Fix imports */
+ /* Allocate a DTE for ntbootdd */
Status = WinLdrAllocateDataTableEntry(&LoaderBlock, "ntbootdd.sys",
"NTBOOTDD.SYS", ImageBase, &BootDdDTE);
if (!Status)
return EIO;
+
+ /* Add freeldr.sys to list of loaded executables, it repaces scsiport.sys */
+ Status = WinLdrAllocateDataTableEntry(&LoaderBlock, "scsiport.sys",
+ "FREELDR.SYS", &ImageDosHeader, &FreeldrDTE);
+ if (!Status)
+ {
+ RemoveEntryList(&BootDdDTE->InLoadOrderLinks);
+ return EIO;
+ }
+
+ /* Fix imports */
Status = WinLdrScanImportDescriptorTable(&LoaderBlock, "", BootDdDTE);
+
+ /* Now unlinkt the DTEs, they won't be valid later */
+ RemoveEntryList(&BootDdDTE->InLoadOrderLinks);
+ RemoveEntryList(&FreeldrDTE->InLoadOrderLinks);
+
if (!Status)
return EIO;