mirror of
https://github.com/reactos/reactos.git
synced 2025-05-31 15:08:14 +00:00
[FREELDR]
Allocate the ARC_DISK_SIGNATURE structures from the heap instead of putting them into the initial loader block allocation, since the number of disks changes later. Fixes memory corrruption and boot breakage when 3 hdds are connected. [NTOSKRNL] Remove a hack that disabled unloading drivers, which didn't work because of memory corruption from freeldr. This works now, too. See issue #7139 for more details. svn path=/trunk/; revision=56860
This commit is contained in:
parent
60c98d7414
commit
aec110d514
3 changed files with 15 additions and 20 deletions
|
@ -71,7 +71,6 @@ typedef struct _LOADER_SYSTEM_BLOCK
|
|||
CHAR NtBootPathName[MAX_PATH+1];
|
||||
CHAR NtHalPathName[MAX_PATH+1];
|
||||
ARC_DISK_INFORMATION ArcDiskInformation;
|
||||
ARC_DISK_SIGNATURE_EX ArcDiskSignature[];
|
||||
} LOADER_SYSTEM_BLOCK, *PLOADER_SYSTEM_BLOCK;
|
||||
|
||||
extern PLOADER_SYSTEM_BLOCK WinLdrSystemBlock;
|
||||
|
|
|
@ -48,12 +48,9 @@ VOID
|
|||
AllocateAndInitLPB(PLOADER_PARAMETER_BLOCK *OutLoaderBlock)
|
||||
{
|
||||
PLOADER_PARAMETER_BLOCK LoaderBlock;
|
||||
ULONG SystemBlockSize;
|
||||
|
||||
/* Allocate and zero-init the LPB */
|
||||
SystemBlockSize = sizeof(LOADER_SYSTEM_BLOCK) +
|
||||
reactos_disk_count * sizeof(ARC_DISK_SIGNATURE_EX);
|
||||
WinLdrSystemBlock = MmAllocateMemoryWithType(SystemBlockSize,
|
||||
WinLdrSystemBlock = MmAllocateMemoryWithType(sizeof(LOADER_SYSTEM_BLOCK),
|
||||
LoaderSystemBlock);
|
||||
if (WinLdrSystemBlock == NULL)
|
||||
{
|
||||
|
@ -135,26 +132,27 @@ WinLdrInitializePhase1(PLOADER_PARAMETER_BLOCK LoaderBlock,
|
|||
/* Convert ARC disk information from freeldr to a correct format */
|
||||
for (i = 0; i < reactos_disk_count; i++)
|
||||
{
|
||||
PARC_DISK_SIGNATURE ArcDiskSig;
|
||||
PARC_DISK_SIGNATURE_EX ArcDiskSig;
|
||||
|
||||
/* Get the ARC structure */
|
||||
ArcDiskSig = &WinLdrSystemBlock->ArcDiskSignature[i].DiskSignature;
|
||||
/* Allocate the ARC structure */
|
||||
ArcDiskSig = HeapAllocate(FrLdrDefaultHeap,
|
||||
sizeof(ARC_DISK_SIGNATURE_EX),
|
||||
'giSD');
|
||||
|
||||
/* Copy the data over */
|
||||
ArcDiskSig->Signature = reactos_arc_disk_info[i].Signature;
|
||||
ArcDiskSig->CheckSum = reactos_arc_disk_info[i].CheckSum;
|
||||
ArcDiskSig->DiskSignature.Signature = reactos_arc_disk_info[i].Signature;
|
||||
ArcDiskSig->DiskSignature.CheckSum = reactos_arc_disk_info[i].CheckSum;
|
||||
|
||||
/* Copy the ARC Name */
|
||||
ArcDiskSig->ArcName = WinLdrSystemBlock->ArcDiskSignature[i].ArcName;
|
||||
strncpy(ArcDiskSig->ArcName, reactos_arc_disk_info[i].ArcName, MAX_PATH);
|
||||
ArcDiskSig->ArcName = PaToVa(ArcDiskSig->ArcName);
|
||||
ArcDiskSig->DiskSignature.ArcName = PaToVa(ArcDiskSig->ArcName);
|
||||
|
||||
/* Mark partition table as valid */
|
||||
ArcDiskSig->ValidPartitionTable = TRUE;
|
||||
ArcDiskSig->DiskSignature.ValidPartitionTable = TRUE;
|
||||
|
||||
/* Insert into the list */
|
||||
InsertTailList(&LoaderBlock->ArcDiskInformation->DiskSignatureListHead,
|
||||
&ArcDiskSig->ListEntry);
|
||||
&ArcDiskSig->DiskSignature.ListEntry);
|
||||
}
|
||||
|
||||
/* Convert all list's to Virtual address */
|
||||
|
@ -639,7 +637,9 @@ LoadAndBootWindowsCommon(
|
|||
|
||||
WinLdrpDumpMemoryDescriptors(LoaderBlockVA);
|
||||
WinLdrpDumpBootDriver(LoaderBlockVA);
|
||||
#ifndef _M_AMD64
|
||||
WinLdrpDumpArcDisks(LoaderBlockVA);
|
||||
#endif
|
||||
|
||||
//FIXME: If I substitute this debugging checkpoint, GCC will "optimize away" the code below
|
||||
//while (1) {};
|
||||
|
|
|
@ -76,16 +76,12 @@ IopDeleteDriver(IN PVOID ObjectBody)
|
|||
DriverExtension = NextDriverExtension;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* Check if the driver image is still loaded */
|
||||
if (DriverObject->DriverSection)
|
||||
{
|
||||
/* Unload it */
|
||||
MmUnloadSystemImage(DriverObject->DriverSection);
|
||||
}
|
||||
#else
|
||||
DPRINT1("HACK: Not unloading the driver image due to critical bugs!\n");
|
||||
#endif
|
||||
|
||||
/* Check if it has a name */
|
||||
if (DriverObject->DriverName.Buffer)
|
||||
|
@ -283,7 +279,7 @@ IopNormalizeImagePath(
|
|||
/* Free caller's string */
|
||||
ExFreePoolWithTag(InputImagePath.Buffer, TAG_RTLREGISTRY);
|
||||
}
|
||||
|
||||
|
||||
DPRINT("Normalized image path is '%wZ' for service '%wZ'\n", ImagePath, ServiceName);
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
|
@ -526,7 +522,7 @@ IopInitializeDriverModule(
|
|||
DPRINT("IopCreateDriver() failed (Status 0x%08lx)\n", Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
MmFreeDriverInitialization((PLDR_DATA_TABLE_ENTRY)Driver->DriverSection);
|
||||
|
||||
/* Set the driver as initialized */
|
||||
|
|
Loading…
Reference in a new issue