You echoed my thoughts when I also saw this reverted...
-----Original Message-----
From: ros-dev-bounces(a)reactos.org [mailto:ros-dev-bounces@reactos.org] On
Behalf Of Alex Ionescu
Sent: 25 September 2009 20:41
To: ros-dev(a)reactos.org
Cc: ros-diffs(a)reactos.org
Subject: Re: [ros-dev] [ros-diffs] [hpoussin] 43145: Revert r43141 to try to
fix ReactOS boot style...
Fuck.
Best regards,
Alex Ionescu
On Fri, Sep 25, 2009 at 11:10 AM, <hpoussin(a)svn.reactos.org> wrote:
Author: hpoussin
Date: Fri Sep 25 17:10:28 2009
New Revision: 43145
URL:
http://svn.reactos.org/svn/reactos?rev=43145&view=rev
Log:
Revert r43141 to try to fix ReactOS boot style...
Modified:
trunk/reactos/ntoskrnl/io/iomgr/arcname.c
Modified: trunk/reactos/ntoskrnl/io/iomgr/arcname.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/arcname.c
?rev=43145&r1=43144&r2=43145&view=diff
============================================================================
==
--- trunk/reactos/ntoskrnl/io/iomgr/arcname.c
[iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/arcname.c [iso-8859-1] Fri Sep 25
17:10:28
2009
> @@ -19,6 +19,107 @@
> PCHAR IoLoaderArcBootDeviceName;
> /* 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
> INIT_FUNCTION
> @@ -177,8 +278,7 @@
> BOOLEAN
> INIT_FUNCTION
> NTAPI
> -IopAssignArcNamesToCdrom(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
> - IN PULONG Buffer,
> +IopAssignArcNamesToCdrom(IN PULONG Buffer,
> IN ULONG DiskNumber)
> {
> CHAR ArcBuffer[128];
> @@ -192,10 +292,6 @@
> ULONG i, CheckSum = 0;
> PDEVICE_OBJECT DeviceObject;
> PFILE_OBJECT FileObject;
> - PARC_DISK_INFORMATION ArcDiskInfo = LoaderBlock->ArcDiskInformation;
> - PLIST_ENTRY NextEntry;
> - PARC_DISK_SIGNATURE ArcDiskEntry;
> - BOOLEAN IsBootCdRom = FALSE;
> /* Build the device name */
> sprintf(ArcBuffer, "\\Device\\CdRom%lu", DiskNumber);
> @@ -252,24 +348,22 @@
> /* Now calculate the checksum */
> for (i = 0; i < 2048 / sizeof(ULONG); i++) CheckSum += Buffer[i];
> - /* Search if this device is the actual
boot CD */
> - for (NextEntry = ArcDiskInfo->DiskSignatureListHead.Flink;
> - NextEntry != &ArcDiskInfo->DiskSignatureListHead;
> - NextEntry = NextEntry->Flink)
> - {
> - /* Get the current ARC disk signature entry */
> - ArcDiskEntry = CONTAINING_RECORD(NextEntry,
> - ARC_DISK_SIGNATURE,
> - ListEntry);
> - if (CheckSum == ArcDiskEntry->CheckSum &&
> - strcmp(KeLoaderBlock->ArcBootDeviceName,
ArcDiskEntry->ArcName) == 0)
- {
- IsBootCdRom = TRUE;
- break;
- }
- }
-
- if (IsBootCdRom)
+ /*
+ * FIXME: In normal conditions, NTLDR/FreeLdr sends the *proper*
CDROM
+ * ARC Path name, and what happens here is a
comparision of both
checksums
+ * in order to see if this is the actual boot
CD.
+ *
+ * In ReactOS this doesn't currently happen, instead we have a hack
on
top
+ * of this file which scans the CD for the
ntoskrnl.exe file, then
modifies
+ * the LoaderBlock's ARC Path with the right
CDROM path.
Consequently, we
+ * get the same state as if NTLDR had properly
booted us, except that
we do
+ * not actually need to check the signature,
since the hack already
did the
+ * check for ntoskrnl.exe, which is just as
good.
+ *
+ * The signature code stays however, because eventually FreeLDR will
work
+ * like NTLDR, and, conversly, we do want to be
able to be booted by
NTLDR.
+ */
+ if (IopApplyRosCdromArcHack(DiskNumber))
{
/* This is the boot CD-ROM, build the ARC name */
sprintf(ArcBuffer, "\\ArcName\\%s",
KeLoaderBlock->ArcBootDeviceName);
@@ -489,7 +583,7 @@
for (i = 0; i < ConfigInfo->CdRomCount; i++)
{
/* Give it an ARC name */
- if (IopAssignArcNamesToCdrom(LoaderBlock, PartitionBuffer,
i)) break;
> + if (IopAssignArcNamesToCdrom(PartitionBuffer, i)) break;
> }
> /* Free the buffer */
_______________________________________________
Ros-dev mailing list
Ros-dev(a)reactos.org
http://www.reactos.org/mailman/listinfo/ros-dev