mirror of
https://github.com/reactos/reactos.git
synced 2025-07-27 20:22:05 +00:00
Remove now unneeded ARC cdrom hack. We're now able to boot from a LiveCD, even if ReactOS directory is not "reactos"
svn path=/trunk/; revision=43141
This commit is contained in:
parent
757788da16
commit
5519bfc73a
1 changed files with 25 additions and 119 deletions
|
@ -20,107 +20,6 @@ PCHAR IoLoaderArcBootDeviceName;
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
BOOLEAN
|
|
||||||
INIT_FUNCTION
|
|
||||||
NTAPI
|
|
||||||
IopApplyRosCdromArcHack(IN ULONG i)
|
|
||||||
{
|
|
||||||
ULONG DeviceNumber = -1;
|
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
|
||||||
ANSI_STRING InstallName;
|
|
||||||
UNICODE_STRING DeviceName;
|
|
||||||
CHAR Buffer[128], RosSysPath[16];
|
|
||||||
FILE_BASIC_INFORMATION FileInfo;
|
|
||||||
NTSTATUS Status;
|
|
||||||
PCHAR p, q;
|
|
||||||
PCONFIGURATION_INFORMATION ConfigInfo = IoGetConfigurationInformation();
|
|
||||||
extern BOOLEAN InitIsWinPEMode, ExpInTextModeSetup;
|
|
||||||
|
|
||||||
/* Change this if you want ROS to boot properly from another directory */
|
|
||||||
sprintf(RosSysPath, "%s", "reactos");
|
|
||||||
|
|
||||||
/* Only ARC Name left - Build full ARC Name */
|
|
||||||
p = strstr(KeLoaderBlock->ArcBootDeviceName, "cdrom");
|
|
||||||
if (p)
|
|
||||||
{
|
|
||||||
/* Build installer name */
|
|
||||||
sprintf(Buffer, "\\Device\\CdRom%lu\\%s\\ntoskrnl.exe", i, RosSysPath);
|
|
||||||
RtlInitAnsiString(&InstallName, Buffer);
|
|
||||||
Status = RtlAnsiStringToUnicodeString(&DeviceName, &InstallName, TRUE);
|
|
||||||
if (!NT_SUCCESS(Status)) return FALSE;
|
|
||||||
|
|
||||||
/* Try to find the installer */
|
|
||||||
InitializeObjectAttributes(&ObjectAttributes,
|
|
||||||
&DeviceName,
|
|
||||||
0,
|
|
||||||
NULL,
|
|
||||||
NULL);
|
|
||||||
Status = ZwQueryAttributesFile(&ObjectAttributes, &FileInfo);
|
|
||||||
|
|
||||||
/* Free the string */
|
|
||||||
RtlFreeUnicodeString(&DeviceName);
|
|
||||||
|
|
||||||
/* Check if we found the file */
|
|
||||||
if (NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
/* We did, save the device number */
|
|
||||||
DeviceNumber = i;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Build live CD kernel name */
|
|
||||||
sprintf(Buffer,
|
|
||||||
"\\Device\\CdRom%lu\\%s\\system32\\ntoskrnl.exe",
|
|
||||||
i, RosSysPath);
|
|
||||||
RtlInitAnsiString(&InstallName, Buffer);
|
|
||||||
Status = RtlAnsiStringToUnicodeString(&DeviceName,
|
|
||||||
&InstallName,
|
|
||||||
TRUE);
|
|
||||||
if (!NT_SUCCESS(Status)) return FALSE;
|
|
||||||
|
|
||||||
/* Try to find it */
|
|
||||||
InitializeObjectAttributes(&ObjectAttributes,
|
|
||||||
&DeviceName,
|
|
||||||
0,
|
|
||||||
NULL,
|
|
||||||
NULL);
|
|
||||||
Status = ZwQueryAttributesFile(&ObjectAttributes, &FileInfo);
|
|
||||||
if (NT_SUCCESS(Status)) DeviceNumber = i;
|
|
||||||
|
|
||||||
/* Free the string */
|
|
||||||
RtlFreeUnicodeString(&DeviceName);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!InitIsWinPEMode)
|
|
||||||
{
|
|
||||||
/* Build the name */
|
|
||||||
sprintf(p, "cdrom(%lu)", DeviceNumber);
|
|
||||||
|
|
||||||
/* Adjust original command line */
|
|
||||||
q = strchr(p, ')');
|
|
||||||
if (q)
|
|
||||||
{
|
|
||||||
q++;
|
|
||||||
strcpy(Buffer, q);
|
|
||||||
sprintf(p, "cdrom(%lu)", DeviceNumber);
|
|
||||||
strcat(p, Buffer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* OK, how many disks are there? */
|
|
||||||
DeviceNumber += ConfigInfo->DiskCount;
|
|
||||||
|
|
||||||
/* Return whether this is the CD or not */
|
|
||||||
if ((InitIsWinPEMode) || (ExpInTextModeSetup))
|
|
||||||
{
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Failed */
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
INIT_FUNCTION
|
INIT_FUNCTION
|
||||||
NTAPI
|
NTAPI
|
||||||
|
@ -278,7 +177,8 @@ IopGetDiskInformation(IN ULONG i,
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
INIT_FUNCTION
|
INIT_FUNCTION
|
||||||
NTAPI
|
NTAPI
|
||||||
IopAssignArcNamesToCdrom(IN PULONG Buffer,
|
IopAssignArcNamesToCdrom(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
||||||
|
IN PULONG Buffer,
|
||||||
IN ULONG DiskNumber)
|
IN ULONG DiskNumber)
|
||||||
{
|
{
|
||||||
CHAR ArcBuffer[128];
|
CHAR ArcBuffer[128];
|
||||||
|
@ -292,6 +192,10 @@ IopAssignArcNamesToCdrom(IN PULONG Buffer,
|
||||||
ULONG i, CheckSum = 0;
|
ULONG i, CheckSum = 0;
|
||||||
PDEVICE_OBJECT DeviceObject;
|
PDEVICE_OBJECT DeviceObject;
|
||||||
PFILE_OBJECT FileObject;
|
PFILE_OBJECT FileObject;
|
||||||
|
PARC_DISK_INFORMATION ArcDiskInfo = LoaderBlock->ArcDiskInformation;
|
||||||
|
PLIST_ENTRY NextEntry;
|
||||||
|
PARC_DISK_SIGNATURE ArcDiskEntry;
|
||||||
|
BOOLEAN IsBootCdRom = FALSE;
|
||||||
|
|
||||||
/* Build the device name */
|
/* Build the device name */
|
||||||
sprintf(ArcBuffer, "\\Device\\CdRom%lu", DiskNumber);
|
sprintf(ArcBuffer, "\\Device\\CdRom%lu", DiskNumber);
|
||||||
|
@ -348,22 +252,24 @@ IopAssignArcNamesToCdrom(IN PULONG Buffer,
|
||||||
/* Now calculate the checksum */
|
/* Now calculate the checksum */
|
||||||
for (i = 0; i < 2048 / sizeof(ULONG); i++) CheckSum += Buffer[i];
|
for (i = 0; i < 2048 / sizeof(ULONG); i++) CheckSum += Buffer[i];
|
||||||
|
|
||||||
/*
|
/* Search if this device is the actual boot CD */
|
||||||
* FIXME: In normal conditions, NTLDR/FreeLdr sends the *proper* CDROM
|
for (NextEntry = ArcDiskInfo->DiskSignatureListHead.Flink;
|
||||||
* ARC Path name, and what happens here is a comparision of both checksums
|
NextEntry != &ArcDiskInfo->DiskSignatureListHead;
|
||||||
* in order to see if this is the actual boot CD.
|
NextEntry = NextEntry->Flink)
|
||||||
*
|
{
|
||||||
* In ReactOS this doesn't currently happen, instead we have a hack on top
|
/* Get the current ARC disk signature entry */
|
||||||
* of this file which scans the CD for the ntoskrnl.exe file, then modifies
|
ArcDiskEntry = CONTAINING_RECORD(NextEntry,
|
||||||
* the LoaderBlock's ARC Path with the right CDROM path. Consequently, we
|
ARC_DISK_SIGNATURE,
|
||||||
* get the same state as if NTLDR had properly booted us, except that we do
|
ListEntry);
|
||||||
* not actually need to check the signature, since the hack already did the
|
if (CheckSum == ArcDiskEntry->CheckSum &&
|
||||||
* check for ntoskrnl.exe, which is just as good.
|
strcmp(KeLoaderBlock->ArcBootDeviceName, ArcDiskEntry->ArcName) == 0)
|
||||||
*
|
{
|
||||||
* The signature code stays however, because eventually FreeLDR will work
|
IsBootCdRom = TRUE;
|
||||||
* like NTLDR, and, conversly, we do want to be able to be booted by NTLDR.
|
break;
|
||||||
*/
|
}
|
||||||
if (IopApplyRosCdromArcHack(DiskNumber))
|
}
|
||||||
|
|
||||||
|
if (IsBootCdRom)
|
||||||
{
|
{
|
||||||
/* This is the boot CD-ROM, build the ARC name */
|
/* This is the boot CD-ROM, build the ARC name */
|
||||||
sprintf(ArcBuffer, "\\ArcName\\%s", KeLoaderBlock->ArcBootDeviceName);
|
sprintf(ArcBuffer, "\\ArcName\\%s", KeLoaderBlock->ArcBootDeviceName);
|
||||||
|
@ -583,7 +489,7 @@ IopCreateArcNames(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||||
for (i = 0; i < ConfigInfo->CdRomCount; i++)
|
for (i = 0; i < ConfigInfo->CdRomCount; i++)
|
||||||
{
|
{
|
||||||
/* Give it an ARC name */
|
/* Give it an ARC name */
|
||||||
if (IopAssignArcNamesToCdrom(PartitionBuffer, i)) break;
|
if (IopAssignArcNamesToCdrom(LoaderBlock, PartitionBuffer, i)) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free the buffer */
|
/* Free the buffer */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue