2006-10-08 22:50:26 +00:00
|
|
|
/*
|
|
|
|
* PROJECT: ReactOS Kernel
|
|
|
|
* LICENSE: GPL - See COPYING in the top level directory
|
|
|
|
* FILE: ntoskrnl/io/iomgr/arcname.c
|
|
|
|
* PURPOSE: ARC Path Initialization Functions
|
|
|
|
* PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
|
2010-01-09 22:43:16 +00:00
|
|
|
* Eric Kohl
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
* Pierre Schweitzer (pierre.schweitzer@reactos.org)
|
2006-10-08 22:50:26 +00:00
|
|
|
*/
|
2002-03-13 01:30:34 +00:00
|
|
|
|
2006-10-08 22:50:26 +00:00
|
|
|
/* INCLUDES ******************************************************************/
|
2002-03-13 01:30:34 +00:00
|
|
|
|
2004-08-15 16:39:12 +00:00
|
|
|
#include <ntoskrnl.h>
|
2002-03-13 01:30:34 +00:00
|
|
|
#define NDEBUG
|
2006-10-08 21:09:00 +00:00
|
|
|
#include <debug.h>
|
|
|
|
|
|
|
|
/* GLOBALS *******************************************************************/
|
|
|
|
|
|
|
|
UNICODE_STRING IoArcHalDeviceName, IoArcBootDeviceName;
|
|
|
|
PCHAR IoLoaderArcBootDeviceName;
|
2002-03-13 01:30:34 +00:00
|
|
|
|
2006-10-08 22:50:26 +00:00
|
|
|
/* FUNCTIONS *****************************************************************/
|
2005-09-15 17:23:41 +00:00
|
|
|
|
2020-10-06 19:44:01 +00:00
|
|
|
CODE_SEG("INIT")
|
2018-12-30 11:19:11 +00:00
|
|
|
NTSTATUS
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
NTAPI
|
2021-06-10 17:24:04 +00:00
|
|
|
IopCreateArcNamesCd(IN PLOADER_PARAMETER_BLOCK LoaderBlock);
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
|
2020-10-06 19:44:01 +00:00
|
|
|
CODE_SEG("INIT")
|
2018-12-30 11:19:11 +00:00
|
|
|
NTSTATUS
|
2009-09-25 15:10:28 +00:00
|
|
|
NTAPI
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
IopCreateArcNamesDisk(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
|
|
|
IN BOOLEAN SingleDisk,
|
2021-06-10 17:24:04 +00:00
|
|
|
OUT PBOOLEAN FoundBoot);
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
|
2020-10-06 19:44:01 +00:00
|
|
|
CODE_SEG("INIT")
|
2018-12-30 11:19:11 +00:00
|
|
|
NTSTATUS
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
NTAPI
|
|
|
|
IopCreateArcNames(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
2009-09-25 15:10:28 +00:00
|
|
|
{
|
[HAL/NDK]
- Make Vector parameter in HalEnableSystemInterrupt, HalDisableSystemInterrupt and HalBeginSystemInterrupt an ULONG, not an UCHAR
[NDK]
- 64bit fixes for HANDLE_TABLE, KPROCESS, SECTION_IMAGE_INFORMATION, MMADDRESS_LIST, MMVAD_FLAGS, MMVAD, MMVAD_LONG, MMVAD_SHORT, MEMORY_DESCRIPTOR, MEMORY_ALLOCATION_DESCRIPTOR, LdrVerifyMappedImageMatchesChecksum
- KDPC_DATA::DpcQueueDepth is signed on amd64, unsigned on x86
[NTOSKRNL]
- Fix hundreds of MSVC and amd64 warnings
- add a pragma message to FstubFixupEfiPartition, since it looks broken
- Move portable Ke constants from <arch>/cpu.c to krnlinit.c
- Fixed a bug in amd64 KiGeneralProtectionFaultHandler
svn path=/trunk/; revision=53734
2011-09-18 13:11:45 +00:00
|
|
|
SIZE_T Length;
|
2009-09-25 15:10:28 +00:00
|
|
|
NTSTATUS Status;
|
2012-02-07 17:40:15 +00:00
|
|
|
CHAR Buffer[128];
|
|
|
|
BOOLEAN SingleDisk;
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
BOOLEAN FoundBoot = FALSE;
|
2012-02-07 17:40:15 +00:00
|
|
|
UNICODE_STRING SystemDevice, LoaderPathNameW, BootDeviceName;
|
|
|
|
PARC_DISK_INFORMATION ArcDiskInfo = LoaderBlock->ArcDiskInformation;
|
|
|
|
ANSI_STRING ArcSystemString, ArcString, LanmanRedirector, LoaderPathNameA;
|
2009-09-25 15:10:28 +00:00
|
|
|
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
/* Check if we only have one disk on the machine */
|
2021-06-10 17:31:43 +00:00
|
|
|
SingleDisk = (ArcDiskInfo->DiskSignatureListHead.Flink->Flink ==
|
|
|
|
&ArcDiskInfo->DiskSignatureListHead);
|
2009-09-25 15:10:28 +00:00
|
|
|
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
/* Create the global HAL partition name */
|
|
|
|
sprintf(Buffer, "\\ArcName\\%s", LoaderBlock->ArcHalDeviceName);
|
|
|
|
RtlInitAnsiString(&ArcString, Buffer);
|
2021-06-17 14:36:32 +00:00
|
|
|
Status = RtlAnsiStringToUnicodeString(&IoArcHalDeviceName, &ArcString, TRUE);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
return Status;
|
2009-09-25 15:10:28 +00:00
|
|
|
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
/* Create the global system partition name */
|
|
|
|
sprintf(Buffer, "\\ArcName\\%s", LoaderBlock->ArcBootDeviceName);
|
|
|
|
RtlInitAnsiString(&ArcString, Buffer);
|
2021-06-17 14:36:32 +00:00
|
|
|
Status = RtlAnsiStringToUnicodeString(&IoArcBootDeviceName, &ArcString, TRUE);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
return Status;
|
2009-09-25 15:10:28 +00:00
|
|
|
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
/* Allocate memory for the string */
|
|
|
|
Length = strlen(LoaderBlock->ArcBootDeviceName) + sizeof(ANSI_NULL);
|
|
|
|
IoLoaderArcBootDeviceName = ExAllocatePoolWithTag(PagedPool,
|
|
|
|
Length,
|
|
|
|
TAG_IO);
|
|
|
|
if (IoLoaderArcBootDeviceName)
|
|
|
|
{
|
|
|
|
/* Copy the name */
|
|
|
|
RtlCopyMemory(IoLoaderArcBootDeviceName,
|
|
|
|
LoaderBlock->ArcBootDeviceName,
|
|
|
|
Length);
|
2009-09-25 15:10:28 +00:00
|
|
|
}
|
|
|
|
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
/* Check if we only found a disk, but we're booting from CD-ROM */
|
|
|
|
if ((SingleDisk) && strstr(LoaderBlock->ArcBootDeviceName, "cdrom"))
|
|
|
|
{
|
|
|
|
/* Then disable single-disk mode, since there's a CD drive out there */
|
|
|
|
SingleDisk = FALSE;
|
|
|
|
}
|
2009-09-25 15:10:28 +00:00
|
|
|
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
/* Build the boot strings */
|
|
|
|
RtlInitAnsiString(&ArcSystemString, LoaderBlock->ArcHalDeviceName);
|
|
|
|
|
2012-02-07 17:40:15 +00:00
|
|
|
/* If we are doing remote booting */
|
|
|
|
if (IoRemoteBootClient)
|
|
|
|
{
|
|
|
|
/* Yes, we have found boot device */
|
|
|
|
FoundBoot = TRUE;
|
|
|
|
|
|
|
|
/* Get NT device name */
|
|
|
|
RtlInitAnsiString(&LanmanRedirector, "\\Device\\LanmanRedirector");
|
|
|
|
Status = RtlAnsiStringToUnicodeString(&SystemDevice, &LanmanRedirector, TRUE);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
return Status;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Get ARC booting device name (in net(0) something) */
|
|
|
|
sprintf(Buffer, "\\ArcName\\%s", LoaderBlock->ArcBootDeviceName);
|
|
|
|
RtlInitAnsiString(&ArcString, Buffer);
|
|
|
|
Status = RtlAnsiStringToUnicodeString(&BootDeviceName, &ArcString, TRUE);
|
|
|
|
if (NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
/* Map ARC to NT name */
|
2012-02-10 18:57:55 +00:00
|
|
|
IoAssignArcName(&BootDeviceName, &SystemDevice);
|
2012-02-07 17:40:15 +00:00
|
|
|
RtlFreeUnicodeString(&BootDeviceName);
|
|
|
|
|
|
|
|
/* Now, get loader path name */
|
|
|
|
RtlInitAnsiString(&LoaderPathNameA, LoaderBlock->NtHalPathName);
|
|
|
|
Status = RtlAnsiStringToUnicodeString(&LoaderPathNameW, &LoaderPathNameA, TRUE);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
RtlFreeUnicodeString(&SystemDevice);
|
|
|
|
return Status;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* And set it has system partition */
|
|
|
|
IopStoreSystemPartitionInformation(&SystemDevice, &LoaderPathNameW);
|
|
|
|
}
|
|
|
|
|
|
|
|
RtlFreeUnicodeString(&SystemDevice);
|
|
|
|
|
|
|
|
/* Don't quit here, even if everything went fine!
|
|
|
|
* We need IopCreateArcNamesDisk to properly map
|
|
|
|
* devices with symlinks.
|
|
|
|
* It will return success if the mapping process went fine
|
|
|
|
* even if it didn't find boot device.
|
|
|
|
* It won't reset boot device finding status as well.
|
|
|
|
*/
|
|
|
|
}
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
|
|
|
|
/* Loop every disk and try to find boot disk */
|
|
|
|
Status = IopCreateArcNamesDisk(LoaderBlock, SingleDisk, &FoundBoot);
|
2021-06-10 17:24:04 +00:00
|
|
|
/* If it succeeded but we didn't find boot device, try to browse Cds */
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
if (NT_SUCCESS(Status) && !FoundBoot)
|
2009-09-25 15:10:28 +00:00
|
|
|
{
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
Status = IopCreateArcNamesCd(LoaderBlock);
|
2009-09-25 15:10:28 +00:00
|
|
|
}
|
|
|
|
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
/* Return success */
|
|
|
|
return Status;
|
2009-09-25 15:10:28 +00:00
|
|
|
}
|
|
|
|
|
2020-10-06 19:44:01 +00:00
|
|
|
CODE_SEG("INIT")
|
2018-12-30 11:19:11 +00:00
|
|
|
NTSTATUS
|
2006-10-08 16:58:03 +00:00
|
|
|
NTAPI
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
IopCreateArcNamesCd(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
2006-10-08 16:58:03 +00:00
|
|
|
{
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
PIRP Irp;
|
|
|
|
KEVENT Event;
|
2006-10-08 16:58:03 +00:00
|
|
|
NTSTATUS Status;
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
PLIST_ENTRY NextEntry;
|
2006-10-08 16:58:03 +00:00
|
|
|
PFILE_OBJECT FileObject;
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
PDEVICE_OBJECT DeviceObject;
|
|
|
|
LARGE_INTEGER StartingOffset;
|
|
|
|
IO_STATUS_BLOCK IoStatusBlock;
|
|
|
|
PULONG PartitionBuffer = NULL;
|
|
|
|
CHAR Buffer[128], ArcBuffer[128];
|
|
|
|
BOOLEAN NotEnabledPresent = FALSE;
|
|
|
|
STORAGE_DEVICE_NUMBER DeviceNumber;
|
|
|
|
ANSI_STRING DeviceStringA, ArcNameStringA;
|
|
|
|
PWSTR SymbolicLinkList, lSymbolicLinkList;
|
|
|
|
PARC_DISK_SIGNATURE ArcDiskSignature = NULL;
|
|
|
|
UNICODE_STRING DeviceStringW, ArcNameStringW;
|
|
|
|
ULONG DiskNumber, CdRomCount, CheckSum, i, EnabledDisks = 0;
|
|
|
|
PARC_DISK_INFORMATION ArcDiskInformation = LoaderBlock->ArcDiskInformation;
|
|
|
|
|
|
|
|
/* Get all the Cds present in the system */
|
|
|
|
CdRomCount = IoGetConfigurationInformation()->CdRomCount;
|
|
|
|
|
|
|
|
/* Get enabled Cds and check if result matches
|
|
|
|
* For the record, enabled Cds (or even disk) are Cds/disks
|
|
|
|
* that have been successfully handled by MountMgr driver
|
|
|
|
* and that already own their device name. This is the "new" way
|
|
|
|
* to handle them, that came with NT5.
|
2021-06-10 17:24:04 +00:00
|
|
|
* Currently, Windows 2003 provides an ARC names creation based
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
* on both enabled drives and not enabled drives (lack from
|
|
|
|
* the driver).
|
|
|
|
* Given the current ReactOS state, that's good for us.
|
|
|
|
* To sum up, this is NOT a hack or whatsoever.
|
|
|
|
*/
|
|
|
|
Status = IopFetchConfigurationInformation(&SymbolicLinkList,
|
|
|
|
GUID_DEVINTERFACE_CDROM,
|
|
|
|
CdRomCount,
|
|
|
|
&EnabledDisks);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
NotEnabledPresent = TRUE;
|
|
|
|
}
|
|
|
|
/* Save symbolic link list address in order to free it after */
|
|
|
|
lSymbolicLinkList = SymbolicLinkList;
|
|
|
|
/* For the moment, we won't fail */
|
|
|
|
Status = STATUS_SUCCESS;
|
|
|
|
|
|
|
|
/* Browse all the ARC devices trying to find the one matching boot device */
|
|
|
|
for (NextEntry = ArcDiskInformation->DiskSignatureListHead.Flink;
|
|
|
|
NextEntry != &ArcDiskInformation->DiskSignatureListHead;
|
|
|
|
NextEntry = NextEntry->Flink)
|
|
|
|
{
|
|
|
|
ArcDiskSignature = CONTAINING_RECORD(NextEntry,
|
|
|
|
ARC_DISK_SIGNATURE,
|
|
|
|
ListEntry);
|
2006-10-08 16:58:03 +00:00
|
|
|
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
if (strcmp(LoaderBlock->ArcBootDeviceName, ArcDiskSignature->ArcName) == 0)
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
2006-10-08 16:58:03 +00:00
|
|
|
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
ArcDiskSignature = NULL;
|
|
|
|
}
|
2006-10-08 16:58:03 +00:00
|
|
|
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
/* Not found... Not booting from a Cd */
|
|
|
|
if (!ArcDiskSignature)
|
2006-10-08 21:09:00 +00:00
|
|
|
{
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
DPRINT("Failed finding a cd that could match current boot device\n");
|
|
|
|
goto Cleanup;
|
2006-10-08 16:58:03 +00:00
|
|
|
}
|
|
|
|
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
/* Allocate needed space for reading Cd */
|
|
|
|
PartitionBuffer = ExAllocatePoolWithTag(NonPagedPoolCacheAligned, 2048, TAG_IO);
|
|
|
|
if (!PartitionBuffer)
|
2006-10-08 21:09:00 +00:00
|
|
|
{
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
DPRINT("Failed allocating resources!\n");
|
|
|
|
/* Here, we fail, BUT we return success, some Microsoft joke */
|
|
|
|
goto Cleanup;
|
2006-10-08 21:09:00 +00:00
|
|
|
}
|
2006-10-08 16:58:03 +00:00
|
|
|
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
/* If we have more enabled Cds, take that into account */
|
|
|
|
if (EnabledDisks > CdRomCount)
|
2006-10-08 16:58:03 +00:00
|
|
|
{
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
CdRomCount = EnabledDisks;
|
2006-10-08 21:09:00 +00:00
|
|
|
}
|
2006-10-08 16:58:03 +00:00
|
|
|
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
/* If we'll have to browse for none enabled Cds, fix higher count */
|
|
|
|
if (NotEnabledPresent && !EnabledDisks)
|
2008-09-24 16:37:35 +00:00
|
|
|
{
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
CdRomCount += 5;
|
2008-09-24 16:37:35 +00:00
|
|
|
}
|
2006-10-08 16:58:03 +00:00
|
|
|
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
/* Finally, if in spite of all that work, we still don't have Cds, leave */
|
|
|
|
if (!CdRomCount)
|
2008-09-24 16:37:35 +00:00
|
|
|
{
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
goto Cleanup;
|
2008-09-24 16:37:35 +00:00
|
|
|
}
|
2005-09-15 17:23:41 +00:00
|
|
|
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
/* Start browsing Cds */
|
|
|
|
for (DiskNumber = 0, EnabledDisks = 0; DiskNumber < CdRomCount; DiskNumber++)
|
2006-10-08 21:09:00 +00:00
|
|
|
{
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
/* Check if we have an enabled disk */
|
2015-05-15 21:08:06 +00:00
|
|
|
if (lSymbolicLinkList && *lSymbolicLinkList != UNICODE_NULL)
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
{
|
|
|
|
/* Create its device name using first symbolic link */
|
|
|
|
RtlInitUnicodeString(&DeviceStringW, lSymbolicLinkList);
|
|
|
|
/* Then, update symbolic links list */
|
|
|
|
lSymbolicLinkList += wcslen(lSymbolicLinkList) + (sizeof(UNICODE_NULL) / sizeof(WCHAR));
|
|
|
|
|
|
|
|
/* Get its associated device object and file object */
|
|
|
|
Status = IoGetDeviceObjectPointer(&DeviceStringW,
|
|
|
|
FILE_READ_ATTRIBUTES,
|
|
|
|
&FileObject,
|
|
|
|
&DeviceObject);
|
|
|
|
/* Failure? Good bye! */
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
goto Cleanup;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Now, we'll ask the device its device number */
|
|
|
|
Irp = IoBuildDeviceIoControlRequest(IOCTL_STORAGE_GET_DEVICE_NUMBER,
|
|
|
|
DeviceObject,
|
|
|
|
NULL,
|
|
|
|
0,
|
|
|
|
&DeviceNumber,
|
2021-06-10 17:30:45 +00:00
|
|
|
sizeof(DeviceNumber),
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
FALSE,
|
|
|
|
&Event,
|
|
|
|
&IoStatusBlock);
|
|
|
|
/* Failure? Good bye! */
|
|
|
|
if (!Irp)
|
|
|
|
{
|
|
|
|
/* Dereference file object before leaving */
|
|
|
|
ObDereferenceObject(FileObject);
|
|
|
|
Status = STATUS_INSUFFICIENT_RESOURCES;
|
|
|
|
goto Cleanup;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Call the driver, and wait for it if needed */
|
|
|
|
KeInitializeEvent(&Event, NotificationEvent, FALSE);
|
|
|
|
Status = IoCallDriver(DeviceObject, Irp);
|
|
|
|
if (Status == STATUS_PENDING)
|
|
|
|
{
|
|
|
|
KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
|
|
|
|
Status = IoStatusBlock.Status;
|
|
|
|
}
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
ObDereferenceObject(FileObject);
|
|
|
|
goto Cleanup;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Finally, build proper device name */
|
|
|
|
sprintf(Buffer, "\\Device\\CdRom%lu", DeviceNumber.DeviceNumber);
|
|
|
|
RtlInitAnsiString(&DeviceStringA, Buffer);
|
|
|
|
Status = RtlAnsiStringToUnicodeString(&DeviceStringW, &DeviceStringA, TRUE);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
ObDereferenceObject(FileObject);
|
|
|
|
goto Cleanup;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Create device name for the cd */
|
|
|
|
sprintf(Buffer, "\\Device\\CdRom%lu", EnabledDisks++);
|
|
|
|
RtlInitAnsiString(&DeviceStringA, Buffer);
|
|
|
|
Status = RtlAnsiStringToUnicodeString(&DeviceStringW, &DeviceStringA, TRUE);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
goto Cleanup;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Get its device object */
|
|
|
|
Status = IoGetDeviceObjectPointer(&DeviceStringW,
|
|
|
|
FILE_READ_ATTRIBUTES,
|
|
|
|
&FileObject,
|
|
|
|
&DeviceObject);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
RtlFreeUnicodeString(&DeviceStringW);
|
|
|
|
goto Cleanup;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Initiate data for reading cd and compute checksum */
|
|
|
|
StartingOffset.QuadPart = 0x8000;
|
|
|
|
CheckSum = 0;
|
|
|
|
Irp = IoBuildSynchronousFsdRequest(IRP_MJ_READ,
|
|
|
|
DeviceObject,
|
|
|
|
PartitionBuffer,
|
|
|
|
2048,
|
|
|
|
&StartingOffset,
|
|
|
|
&Event,
|
|
|
|
&IoStatusBlock);
|
|
|
|
if (Irp)
|
|
|
|
{
|
|
|
|
/* Call the driver, and wait for it if needed */
|
|
|
|
KeInitializeEvent(&Event, NotificationEvent, FALSE);
|
|
|
|
Status = IoCallDriver(DeviceObject, Irp);
|
|
|
|
if (Status == STATUS_PENDING)
|
|
|
|
{
|
|
|
|
KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
|
|
|
|
Status = IoStatusBlock.Status;
|
|
|
|
}
|
|
|
|
|
2021-06-10 17:24:04 +00:00
|
|
|
/* If reading succeeded, compute checksum by adding data, 2048 bytes checksum */
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
if (NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
for (i = 0; i < 2048 / sizeof(ULONG); i++)
|
|
|
|
{
|
|
|
|
CheckSum += PartitionBuffer[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Dereference file object */
|
|
|
|
ObDereferenceObject(FileObject);
|
|
|
|
|
|
|
|
/* If checksums are matching, we have the proper cd */
|
|
|
|
if (CheckSum + ArcDiskSignature->CheckSum == 0)
|
|
|
|
{
|
|
|
|
/* Create ARC name */
|
|
|
|
sprintf(ArcBuffer, "\\ArcName\\%s", LoaderBlock->ArcBootDeviceName);
|
|
|
|
RtlInitAnsiString(&ArcNameStringA, ArcBuffer);
|
|
|
|
Status = RtlAnsiStringToUnicodeString(&ArcNameStringW, &ArcNameStringA, TRUE);
|
|
|
|
if (NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
/* Create symbolic link */
|
2012-02-10 18:57:55 +00:00
|
|
|
IoAssignArcName(&ArcNameStringW, &DeviceStringW);
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
RtlFreeUnicodeString(&ArcNameStringW);
|
2014-11-02 11:30:14 +00:00
|
|
|
DPRINT("Boot device found\n");
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* And quit, whatever happens */
|
|
|
|
RtlFreeUnicodeString(&DeviceStringW);
|
|
|
|
goto Cleanup;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Free string before trying another disk */
|
|
|
|
RtlFreeUnicodeString(&DeviceStringW);
|
2006-10-08 21:09:00 +00:00
|
|
|
}
|
2006-10-08 16:58:03 +00:00
|
|
|
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
Cleanup:
|
|
|
|
if (PartitionBuffer)
|
2006-10-08 21:09:00 +00:00
|
|
|
{
|
2008-08-31 15:29:21 +00:00
|
|
|
ExFreePoolWithTag(PartitionBuffer, TAG_IO);
|
2006-10-08 21:09:00 +00:00
|
|
|
}
|
2006-10-08 16:58:03 +00:00
|
|
|
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
if (SymbolicLinkList)
|
|
|
|
{
|
|
|
|
ExFreePool(SymbolicLinkList);
|
|
|
|
}
|
2006-10-08 21:09:00 +00:00
|
|
|
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
return Status;
|
2005-09-15 17:23:41 +00:00
|
|
|
}
|
|
|
|
|
2020-10-06 19:44:01 +00:00
|
|
|
CODE_SEG("INIT")
|
2018-12-30 11:19:11 +00:00
|
|
|
NTSTATUS
|
2006-10-08 16:58:03 +00:00
|
|
|
NTAPI
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
IopCreateArcNamesDisk(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
|
|
|
IN BOOLEAN SingleDisk,
|
2021-06-10 17:24:04 +00:00
|
|
|
OUT PBOOLEAN FoundBoot)
|
2005-09-15 17:23:41 +00:00
|
|
|
{
|
2006-10-08 16:58:03 +00:00
|
|
|
PIRP Irp;
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
PVOID Data;
|
|
|
|
KEVENT Event;
|
|
|
|
NTSTATUS Status;
|
2009-09-29 20:01:20 +00:00
|
|
|
PLIST_ENTRY NextEntry;
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
PFILE_OBJECT FileObject;
|
|
|
|
DISK_GEOMETRY DiskGeometry;
|
|
|
|
PDEVICE_OBJECT DeviceObject;
|
|
|
|
LARGE_INTEGER StartingOffset;
|
|
|
|
PULONG PartitionBuffer = NULL;
|
|
|
|
IO_STATUS_BLOCK IoStatusBlock;
|
|
|
|
CHAR Buffer[128], ArcBuffer[128];
|
|
|
|
BOOLEAN NotEnabledPresent = FALSE;
|
|
|
|
STORAGE_DEVICE_NUMBER DeviceNumber;
|
|
|
|
PARC_DISK_SIGNATURE ArcDiskSignature;
|
|
|
|
PWSTR SymbolicLinkList, lSymbolicLinkList;
|
|
|
|
PDRIVE_LAYOUT_INFORMATION_EX DriveLayout = NULL;
|
|
|
|
UNICODE_STRING DeviceStringW, ArcNameStringW, HalPathStringW;
|
|
|
|
ULONG DiskNumber, DiskCount, CheckSum, i, Signature, EnabledDisks = 0;
|
|
|
|
PARC_DISK_INFORMATION ArcDiskInformation = LoaderBlock->ArcDiskInformation;
|
|
|
|
ANSI_STRING ArcBootString, ArcSystemString, DeviceStringA, ArcNameStringA, HalPathStringA;
|
|
|
|
|
|
|
|
/* Initialise device number */
|
2012-02-07 17:50:00 +00:00
|
|
|
DeviceNumber.DeviceNumber = ULONG_MAX;
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
/* Get all the disks present in the system */
|
|
|
|
DiskCount = IoGetConfigurationInformation()->DiskCount;
|
|
|
|
|
|
|
|
/* Get enabled disks and check if result matches */
|
|
|
|
Status = IopFetchConfigurationInformation(&SymbolicLinkList,
|
|
|
|
GUID_DEVINTERFACE_DISK,
|
|
|
|
DiskCount,
|
|
|
|
&EnabledDisks);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
NotEnabledPresent = TRUE;
|
|
|
|
}
|
2006-10-08 16:58:03 +00:00
|
|
|
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
/* Save symbolic link list address in order to free it after */
|
|
|
|
lSymbolicLinkList = SymbolicLinkList;
|
2006-10-08 16:58:03 +00:00
|
|
|
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
/* Build the boot strings */
|
|
|
|
RtlInitAnsiString(&ArcBootString, LoaderBlock->ArcBootDeviceName);
|
|
|
|
RtlInitAnsiString(&ArcSystemString, LoaderBlock->ArcHalDeviceName);
|
2005-09-15 17:23:41 +00:00
|
|
|
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
/* If we have more enabled disks, take that into account */
|
|
|
|
if (EnabledDisks > DiskCount)
|
2005-09-15 17:23:41 +00:00
|
|
|
{
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
DiskCount = EnabledDisks;
|
2005-09-15 17:23:41 +00:00
|
|
|
}
|
|
|
|
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
/* If we'll have to browse for none enabled disks, fix higher count */
|
|
|
|
if (NotEnabledPresent && !EnabledDisks)
|
2005-09-15 17:23:41 +00:00
|
|
|
{
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
DiskCount += 20;
|
2005-09-15 17:23:41 +00:00
|
|
|
}
|
|
|
|
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
/* Finally, if in spite of all that work, we still don't have disks, leave */
|
|
|
|
if (!DiskCount)
|
2005-09-15 17:23:41 +00:00
|
|
|
{
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
goto Cleanup;
|
2005-09-15 17:23:41 +00:00
|
|
|
}
|
|
|
|
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
/* Start browsing disks */
|
|
|
|
for (DiskNumber = 0; DiskNumber < DiskCount; DiskNumber++)
|
|
|
|
{
|
2021-06-10 17:44:59 +00:00
|
|
|
ASSERT(DriveLayout == NULL);
|
|
|
|
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
/* Check if we have an enabled disk */
|
|
|
|
if (lSymbolicLinkList && *lSymbolicLinkList != UNICODE_NULL)
|
|
|
|
{
|
|
|
|
/* Create its device name using first symbolic link */
|
|
|
|
RtlInitUnicodeString(&DeviceStringW, lSymbolicLinkList);
|
|
|
|
/* Then, update symbolic links list */
|
|
|
|
lSymbolicLinkList += wcslen(lSymbolicLinkList) + (sizeof(UNICODE_NULL) / sizeof(WCHAR));
|
|
|
|
|
|
|
|
/* Get its associated device object and file object */
|
|
|
|
Status = IoGetDeviceObjectPointer(&DeviceStringW,
|
|
|
|
FILE_READ_ATTRIBUTES,
|
|
|
|
&FileObject,
|
|
|
|
&DeviceObject);
|
|
|
|
if (NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
/* Now, we'll ask the device its device number */
|
|
|
|
Irp = IoBuildDeviceIoControlRequest(IOCTL_STORAGE_GET_DEVICE_NUMBER,
|
|
|
|
DeviceObject,
|
|
|
|
NULL,
|
|
|
|
0,
|
|
|
|
&DeviceNumber,
|
2021-06-10 17:30:45 +00:00
|
|
|
sizeof(DeviceNumber),
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
FALSE,
|
|
|
|
&Event,
|
|
|
|
&IoStatusBlock);
|
|
|
|
/* Missing resources is a shame... No need to go farther */
|
|
|
|
if (!Irp)
|
|
|
|
{
|
|
|
|
ObDereferenceObject(FileObject);
|
|
|
|
Status = STATUS_INSUFFICIENT_RESOURCES;
|
|
|
|
goto Cleanup;
|
|
|
|
}
|
2005-09-15 17:23:41 +00:00
|
|
|
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
/* Call the driver, and wait for it if needed */
|
|
|
|
KeInitializeEvent(&Event, NotificationEvent, FALSE);
|
|
|
|
Status = IoCallDriver(DeviceObject, Irp);
|
|
|
|
if (Status == STATUS_PENDING)
|
|
|
|
{
|
|
|
|
KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
|
|
|
|
Status = IoStatusBlock.Status;
|
|
|
|
}
|
2006-10-08 16:58:03 +00:00
|
|
|
|
2024-06-11 20:32:27 +00:00
|
|
|
/* If we didn't get the appropriate data, just skip that disk */
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
ObDereferenceObject(FileObject);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
2009-09-29 20:01:20 +00:00
|
|
|
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
/* End of enabled disks enumeration */
|
|
|
|
if (NotEnabledPresent && *lSymbolicLinkList == UNICODE_NULL)
|
|
|
|
{
|
|
|
|
/* No enabled disk worked, reset field */
|
2012-02-07 17:50:00 +00:00
|
|
|
if (DeviceNumber.DeviceNumber == ULONG_MAX)
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
{
|
|
|
|
DeviceNumber.DeviceNumber = 0;
|
|
|
|
}
|
2009-09-29 20:01:20 +00:00
|
|
|
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
/* Update disk number to enable the following not enabled disks */
|
|
|
|
if (DeviceNumber.DeviceNumber > DiskNumber)
|
|
|
|
{
|
|
|
|
DiskNumber = DeviceNumber.DeviceNumber;
|
|
|
|
}
|
2005-09-15 17:23:41 +00:00
|
|
|
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
/* Increase a bit more */
|
|
|
|
DiskCount = DiskNumber + 20;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Create device name for the disk */
|
|
|
|
sprintf(Buffer, "\\Device\\Harddisk%lu\\Partition0", DiskNumber);
|
|
|
|
RtlInitAnsiString(&DeviceStringA, Buffer);
|
|
|
|
Status = RtlAnsiStringToUnicodeString(&DeviceStringW, &DeviceStringA, TRUE);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
goto Cleanup;
|
|
|
|
}
|
2005-09-15 17:23:41 +00:00
|
|
|
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
/* Get its device object */
|
|
|
|
Status = IoGetDeviceObjectPointer(&DeviceStringW,
|
|
|
|
FILE_READ_ATTRIBUTES,
|
|
|
|
&FileObject,
|
|
|
|
&DeviceObject);
|
2006-10-08 16:58:03 +00:00
|
|
|
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
RtlFreeUnicodeString(&DeviceStringW);
|
|
|
|
/* This is a security measure, to ensure DiskNumber will be used */
|
2012-02-07 17:50:00 +00:00
|
|
|
DeviceNumber.DeviceNumber = ULONG_MAX;
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
}
|
2002-03-13 01:30:34 +00:00
|
|
|
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
/* Something failed somewhere earlier, just skip the disk */
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
2002-03-13 01:30:34 +00:00
|
|
|
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
/* Let's ask the disk for its geometry */
|
|
|
|
Irp = IoBuildDeviceIoControlRequest(IOCTL_DISK_GET_DRIVE_GEOMETRY,
|
|
|
|
DeviceObject,
|
|
|
|
NULL,
|
|
|
|
0,
|
|
|
|
&DiskGeometry,
|
2021-06-10 17:30:45 +00:00
|
|
|
sizeof(DiskGeometry),
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
FALSE,
|
|
|
|
&Event,
|
|
|
|
&IoStatusBlock);
|
|
|
|
/* Missing resources is a shame... No need to go farther */
|
|
|
|
if (!Irp)
|
|
|
|
{
|
|
|
|
ObDereferenceObject(FileObject);
|
|
|
|
Status = STATUS_INSUFFICIENT_RESOURCES;
|
|
|
|
goto Cleanup;
|
|
|
|
}
|
2006-10-08 21:09:00 +00:00
|
|
|
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
/* Call the driver, and wait for it if needed */
|
|
|
|
KeInitializeEvent(&Event, NotificationEvent, FALSE);
|
|
|
|
Status = IoCallDriver(DeviceObject, Irp);
|
|
|
|
if (Status == STATUS_PENDING)
|
|
|
|
{
|
|
|
|
KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
|
|
|
|
Status = IoStatusBlock.Status;
|
|
|
|
}
|
|
|
|
/* Failure, skip disk */
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
ObDereferenceObject(FileObject);
|
|
|
|
continue;
|
|
|
|
}
|
2006-10-08 21:09:00 +00:00
|
|
|
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
/* Read the partition table */
|
|
|
|
Status = IoReadPartitionTableEx(DeviceObject,
|
|
|
|
&DriveLayout);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
ObDereferenceObject(FileObject);
|
|
|
|
continue;
|
|
|
|
}
|
2006-10-08 21:09:00 +00:00
|
|
|
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
/* Ensure we have at least 512 bytes per sector */
|
|
|
|
if (DiskGeometry.BytesPerSector < 512)
|
|
|
|
{
|
|
|
|
DiskGeometry.BytesPerSector = 512;
|
|
|
|
}
|
2006-10-08 21:09:00 +00:00
|
|
|
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
/* Check MBR type against EZ Drive type */
|
|
|
|
StartingOffset.QuadPart = 0;
|
|
|
|
HalExamineMBR(DeviceObject, DiskGeometry.BytesPerSector, 0x55, &Data);
|
|
|
|
if (Data)
|
|
|
|
{
|
|
|
|
/* If MBR is of the EZ Drive type, we'll read after it */
|
|
|
|
StartingOffset.QuadPart = DiskGeometry.BytesPerSector;
|
|
|
|
ExFreePool(Data);
|
|
|
|
}
|
2006-10-08 16:58:03 +00:00
|
|
|
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
/* Allocate for reading enough data for checksum */
|
|
|
|
PartitionBuffer = ExAllocatePoolWithTag(NonPagedPoolCacheAligned, DiskGeometry.BytesPerSector, TAG_IO);
|
|
|
|
if (!PartitionBuffer)
|
|
|
|
{
|
|
|
|
ObDereferenceObject(FileObject);
|
|
|
|
Status = STATUS_INSUFFICIENT_RESOURCES;
|
|
|
|
goto Cleanup;
|
|
|
|
}
|
2006-10-08 19:59:53 +00:00
|
|
|
|
2021-06-10 17:24:04 +00:00
|
|
|
/* Read the first sector for computing checksum */
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
Irp = IoBuildSynchronousFsdRequest(IRP_MJ_READ,
|
|
|
|
DeviceObject,
|
|
|
|
PartitionBuffer,
|
|
|
|
DiskGeometry.BytesPerSector,
|
|
|
|
&StartingOffset,
|
|
|
|
&Event,
|
|
|
|
&IoStatusBlock);
|
|
|
|
if (!Irp)
|
|
|
|
{
|
2021-06-10 17:44:59 +00:00
|
|
|
ExFreePoolWithTag(PartitionBuffer, TAG_IO);
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
ObDereferenceObject(FileObject);
|
|
|
|
Status = STATUS_INSUFFICIENT_RESOURCES;
|
|
|
|
goto Cleanup;
|
|
|
|
}
|
2006-10-08 16:58:03 +00:00
|
|
|
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
/* Call the driver to perform reading */
|
|
|
|
KeInitializeEvent(&Event, NotificationEvent, FALSE);
|
|
|
|
Status = IoCallDriver(DeviceObject, Irp);
|
|
|
|
if (Status == STATUS_PENDING)
|
|
|
|
{
|
|
|
|
KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
|
|
|
|
Status = IoStatusBlock.Status;
|
|
|
|
}
|
2021-06-10 17:44:59 +00:00
|
|
|
|
|
|
|
/* If reading succeeded, calculate checksum by adding data */
|
|
|
|
if (NT_SUCCESS(Status))
|
2005-09-15 17:23:41 +00:00
|
|
|
{
|
2021-06-10 17:44:59 +00:00
|
|
|
for (i = 0, CheckSum = 0; i < 512 / sizeof(ULONG); i++)
|
|
|
|
{
|
|
|
|
CheckSum += PartitionBuffer[i];
|
|
|
|
}
|
2006-10-08 21:09:00 +00:00
|
|
|
}
|
|
|
|
|
2021-06-10 17:44:59 +00:00
|
|
|
/* Release now unnecessary resources */
|
|
|
|
ExFreePoolWithTag(PartitionBuffer, TAG_IO);
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
ObDereferenceObject(FileObject);
|
|
|
|
|
2021-06-10 17:44:59 +00:00
|
|
|
/* If we failed, release drive layout before going to next disk */
|
|
|
|
if (!NT_SUCCESS(Status))
|
2006-10-08 21:09:00 +00:00
|
|
|
{
|
2021-06-10 17:44:59 +00:00
|
|
|
ExFreePool(DriveLayout);
|
|
|
|
DriveLayout = NULL;
|
|
|
|
continue;
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
}
|
2006-10-08 21:09:00 +00:00
|
|
|
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
/* Browse each ARC disk */
|
|
|
|
for (NextEntry = ArcDiskInformation->DiskSignatureListHead.Flink;
|
|
|
|
NextEntry != &ArcDiskInformation->DiskSignatureListHead;
|
|
|
|
NextEntry = NextEntry->Flink)
|
|
|
|
{
|
|
|
|
ArcDiskSignature = CONTAINING_RECORD(NextEntry,
|
|
|
|
ARC_DISK_SIGNATURE,
|
|
|
|
ListEntry);
|
|
|
|
|
2024-06-11 20:21:49 +00:00
|
|
|
/*
|
|
|
|
* If this is the only MBR disk in the ARC list and detected
|
|
|
|
* in the device tree, just go ahead and create the ArcName link.
|
|
|
|
* Otherwise, check whether the signatures and checksums match
|
|
|
|
* before creating the ArcName link.
|
2006-10-08 21:09:00 +00:00
|
|
|
*/
|
2024-06-11 20:21:49 +00:00
|
|
|
if ((SingleDisk && (DiskCount == 1) &&
|
|
|
|
(DriveLayout->PartitionStyle == PARTITION_STYLE_MBR)) ||
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
(IopVerifyDiskSignature(DriveLayout, ArcDiskSignature, &Signature) &&
|
2024-06-11 20:21:49 +00:00
|
|
|
(ArcDiskSignature->CheckSum + CheckSum == 0)))
|
2005-09-15 17:23:41 +00:00
|
|
|
{
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
/* Create device name */
|
2024-06-11 20:32:27 +00:00
|
|
|
sprintf(Buffer, "\\Device\\Harddisk%lu\\Partition0",
|
|
|
|
(DeviceNumber.DeviceNumber != ULONG_MAX) ? DeviceNumber.DeviceNumber : DiskNumber);
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
RtlInitAnsiString(&DeviceStringA, Buffer);
|
|
|
|
Status = RtlAnsiStringToUnicodeString(&DeviceStringW, &DeviceStringA, TRUE);
|
|
|
|
if (!NT_SUCCESS(Status))
|
2006-10-08 21:09:00 +00:00
|
|
|
{
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
goto Cleanup;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Create ARC name */
|
|
|
|
sprintf(ArcBuffer, "\\ArcName\\%s", ArcDiskSignature->ArcName);
|
|
|
|
RtlInitAnsiString(&ArcNameStringA, ArcBuffer);
|
|
|
|
Status = RtlAnsiStringToUnicodeString(&ArcNameStringW, &ArcNameStringA, TRUE);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
RtlFreeUnicodeString(&DeviceStringW);
|
|
|
|
goto Cleanup;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Link both */
|
2012-02-10 18:57:55 +00:00
|
|
|
IoAssignArcName(&ArcNameStringW, &DeviceStringW);
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
|
2024-06-11 20:32:27 +00:00
|
|
|
/* And release strings */
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
RtlFreeUnicodeString(&ArcNameStringW);
|
|
|
|
RtlFreeUnicodeString(&DeviceStringW);
|
|
|
|
|
2024-06-11 20:32:27 +00:00
|
|
|
/* Now, browse each partition */
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
for (i = 1; i <= DriveLayout->PartitionCount; i++)
|
|
|
|
{
|
|
|
|
/* Create device name */
|
2024-06-11 20:32:27 +00:00
|
|
|
sprintf(Buffer, "\\Device\\Harddisk%lu\\Partition%lu",
|
|
|
|
(DeviceNumber.DeviceNumber != ULONG_MAX) ? DeviceNumber.DeviceNumber : DiskNumber, i);
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
RtlInitAnsiString(&DeviceStringA, Buffer);
|
|
|
|
Status = RtlAnsiStringToUnicodeString(&DeviceStringW, &DeviceStringA, TRUE);
|
|
|
|
if (!NT_SUCCESS(Status))
|
2006-10-08 21:09:00 +00:00
|
|
|
{
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
goto Cleanup;
|
2006-10-08 21:09:00 +00:00
|
|
|
}
|
|
|
|
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
/* Create partial ARC name */
|
|
|
|
sprintf(ArcBuffer, "%spartition(%lu)", ArcDiskSignature->ArcName, i);
|
|
|
|
RtlInitAnsiString(&ArcNameStringA, ArcBuffer);
|
|
|
|
|
|
|
|
/* Is that boot device? */
|
|
|
|
if (RtlEqualString(&ArcNameStringA, &ArcBootString, TRUE))
|
2006-10-08 21:09:00 +00:00
|
|
|
{
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
DPRINT("Found boot device\n");
|
|
|
|
*FoundBoot = TRUE;
|
|
|
|
}
|
2006-10-08 21:09:00 +00:00
|
|
|
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
/* Is that system partition? */
|
|
|
|
if (RtlEqualString(&ArcNameStringA, &ArcSystemString, TRUE))
|
|
|
|
{
|
|
|
|
/* Create HAL path name */
|
|
|
|
RtlInitAnsiString(&HalPathStringA, LoaderBlock->NtHalPathName);
|
|
|
|
Status = RtlAnsiStringToUnicodeString(&HalPathStringW, &HalPathStringA, TRUE);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
RtlFreeUnicodeString(&DeviceStringW);
|
|
|
|
goto Cleanup;
|
2006-10-08 21:09:00 +00:00
|
|
|
}
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
|
|
|
|
/* Then store those information to registry */
|
|
|
|
IopStoreSystemPartitionInformation(&DeviceStringW, &HalPathStringW);
|
|
|
|
RtlFreeUnicodeString(&HalPathStringW);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Create complete ARC name */
|
|
|
|
sprintf(ArcBuffer, "\\ArcName\\%spartition(%lu)", ArcDiskSignature->ArcName, i);
|
|
|
|
RtlInitAnsiString(&ArcNameStringA, ArcBuffer);
|
|
|
|
Status = RtlAnsiStringToUnicodeString(&ArcNameStringW, &ArcNameStringA, TRUE);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
RtlFreeUnicodeString(&DeviceStringW);
|
|
|
|
goto Cleanup;
|
2006-10-08 21:09:00 +00:00
|
|
|
}
|
|
|
|
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
/* Link device name & ARC name */
|
2012-02-10 18:57:55 +00:00
|
|
|
IoAssignArcName(&ArcNameStringW, &DeviceStringW);
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
|
|
|
|
/* Release strings */
|
|
|
|
RtlFreeUnicodeString(&ArcNameStringW);
|
|
|
|
RtlFreeUnicodeString(&DeviceStringW);
|
2006-10-08 21:09:00 +00:00
|
|
|
}
|
2005-09-15 17:23:41 +00:00
|
|
|
}
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
else
|
|
|
|
{
|
2021-06-10 17:24:04 +00:00
|
|
|
/* Debugging feedback: Warn in case there's a valid partition,
|
|
|
|
* a matching signature, BUT a non-matching checksum: this can
|
|
|
|
* be the sign of a duplicate signature, or even worse a virus
|
|
|
|
* played with the partition table. */
|
|
|
|
if (ArcDiskSignature->ValidPartitionTable &&
|
|
|
|
(ArcDiskSignature->Signature == Signature) &&
|
|
|
|
(ArcDiskSignature->CheckSum + CheckSum != 0))
|
2024-06-11 20:32:27 +00:00
|
|
|
{
|
|
|
|
DPRINT("Be careful, you have a duplicate disk signature, or a virus altered your MBR!\n");
|
|
|
|
}
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
}
|
2005-09-15 17:23:41 +00:00
|
|
|
}
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
|
2021-06-10 17:44:59 +00:00
|
|
|
/* Finally, release drive layout */
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
ExFreePool(DriveLayout);
|
|
|
|
DriveLayout = NULL;
|
2005-09-15 17:23:41 +00:00
|
|
|
}
|
2002-03-13 01:30:34 +00:00
|
|
|
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
Status = STATUS_SUCCESS;
|
|
|
|
|
|
|
|
Cleanup:
|
|
|
|
if (DriveLayout)
|
|
|
|
{
|
|
|
|
ExFreePool(DriveLayout);
|
|
|
|
}
|
2004-05-29 21:28:28 +00:00
|
|
|
|
2021-06-10 17:44:59 +00:00
|
|
|
if (SymbolicLinkList)
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
{
|
2021-06-10 17:44:59 +00:00
|
|
|
ExFreePool(SymbolicLinkList);
|
2002-09-04 13:58:56 +00:00
|
|
|
}
|
2006-10-08 16:58:03 +00:00
|
|
|
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
return Status;
|
2002-09-04 13:58:56 +00:00
|
|
|
}
|
|
|
|
|
2020-10-06 19:44:01 +00:00
|
|
|
CODE_SEG("INIT")
|
2006-10-08 07:53:37 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
IopReassignSystemRoot(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
|
|
|
OUT PANSI_STRING NtBootPath)
|
2002-03-16 00:00:13 +00:00
|
|
|
{
|
2006-10-08 07:53:37 +00:00
|
|
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
|
|
|
NTSTATUS Status;
|
|
|
|
CHAR Buffer[256], AnsiBuffer[256];
|
|
|
|
WCHAR ArcNameBuffer[64];
|
|
|
|
ANSI_STRING TargetString, ArcString, TempString;
|
|
|
|
UNICODE_STRING LinkName, TargetName, ArcName;
|
|
|
|
HANDLE LinkHandle;
|
|
|
|
|
|
|
|
/* Create the Unicode name for the current ARC boot device */
|
|
|
|
sprintf(Buffer, "\\ArcName\\%s", LoaderBlock->ArcBootDeviceName);
|
|
|
|
RtlInitAnsiString(&TargetString, Buffer);
|
|
|
|
Status = RtlAnsiStringToUnicodeString(&TargetName, &TargetString, TRUE);
|
|
|
|
if (!NT_SUCCESS(Status)) return FALSE;
|
|
|
|
|
|
|
|
/* Initialize the attributes and open the link */
|
|
|
|
InitializeObjectAttributes(&ObjectAttributes,
|
|
|
|
&TargetName,
|
|
|
|
OBJ_CASE_INSENSITIVE,
|
|
|
|
NULL,
|
|
|
|
NULL);
|
|
|
|
Status = NtOpenSymbolicLinkObject(&LinkHandle,
|
|
|
|
SYMBOLIC_LINK_ALL_ACCESS,
|
|
|
|
&ObjectAttributes);
|
|
|
|
if (!NT_SUCCESS(Status))
|
2002-03-16 00:00:13 +00:00
|
|
|
{
|
2006-10-08 07:53:37 +00:00
|
|
|
/* We failed, free the string */
|
|
|
|
RtlFreeUnicodeString(&TargetName);
|
|
|
|
return FALSE;
|
2002-03-16 00:00:13 +00:00
|
|
|
}
|
|
|
|
|
2006-10-08 07:53:37 +00:00
|
|
|
/* Query the current \\SystemRoot */
|
|
|
|
ArcName.Buffer = ArcNameBuffer;
|
|
|
|
ArcName.Length = 0;
|
|
|
|
ArcName.MaximumLength = sizeof(ArcNameBuffer);
|
|
|
|
Status = NtQuerySymbolicLinkObject(LinkHandle, &ArcName, NULL);
|
|
|
|
if (!NT_SUCCESS(Status))
|
2002-03-16 00:00:13 +00:00
|
|
|
{
|
2006-10-08 07:53:37 +00:00
|
|
|
/* We failed, free the string */
|
|
|
|
RtlFreeUnicodeString(&TargetName);
|
|
|
|
return FALSE;
|
2002-03-16 00:00:13 +00:00
|
|
|
}
|
2002-06-27 17:45:45 +00:00
|
|
|
|
2006-10-08 07:53:37 +00:00
|
|
|
/* Convert it to Ansi */
|
|
|
|
ArcString.Buffer = AnsiBuffer;
|
|
|
|
ArcString.Length = 0;
|
|
|
|
ArcString.MaximumLength = sizeof(AnsiBuffer);
|
|
|
|
Status = RtlUnicodeStringToAnsiString(&ArcString, &ArcName, FALSE);
|
|
|
|
AnsiBuffer[ArcString.Length] = ANSI_NULL;
|
|
|
|
|
|
|
|
/* Close the link handle and free the name */
|
|
|
|
ObCloseHandle(LinkHandle, KernelMode);
|
|
|
|
RtlFreeUnicodeString(&TargetName);
|
|
|
|
|
|
|
|
/* Setup the system root name again */
|
|
|
|
RtlInitAnsiString(&TempString, "\\SystemRoot");
|
|
|
|
Status = RtlAnsiStringToUnicodeString(&LinkName, &TempString, TRUE);
|
|
|
|
if (!NT_SUCCESS(Status)) return FALSE;
|
|
|
|
|
|
|
|
/* Open the symbolic link for it */
|
|
|
|
InitializeObjectAttributes(&ObjectAttributes,
|
|
|
|
&LinkName,
|
|
|
|
OBJ_CASE_INSENSITIVE,
|
|
|
|
NULL,
|
|
|
|
NULL);
|
|
|
|
Status = NtOpenSymbolicLinkObject(&LinkHandle,
|
|
|
|
SYMBOLIC_LINK_ALL_ACCESS,
|
|
|
|
&ObjectAttributes);
|
|
|
|
if (!NT_SUCCESS(Status)) return FALSE;
|
|
|
|
|
|
|
|
/* Destroy it */
|
|
|
|
NtMakeTemporaryObject(LinkHandle);
|
|
|
|
ObCloseHandle(LinkHandle, KernelMode);
|
|
|
|
|
|
|
|
/* Now create the new name for it */
|
|
|
|
sprintf(Buffer, "%s%s", ArcString.Buffer, LoaderBlock->NtBootPathName);
|
|
|
|
|
|
|
|
/* Copy it into the passed parameter and null-terminate it */
|
|
|
|
RtlCopyString(NtBootPath, &ArcString);
|
|
|
|
Buffer[strlen(Buffer) - 1] = ANSI_NULL;
|
|
|
|
|
|
|
|
/* Setup the Unicode-name for the new symbolic link value */
|
|
|
|
RtlInitAnsiString(&TargetString, Buffer);
|
|
|
|
InitializeObjectAttributes(&ObjectAttributes,
|
|
|
|
&LinkName,
|
|
|
|
OBJ_CASE_INSENSITIVE | OBJ_PERMANENT,
|
|
|
|
NULL,
|
|
|
|
NULL);
|
|
|
|
Status = RtlAnsiStringToUnicodeString(&ArcName, &TargetString, TRUE);
|
|
|
|
if (!NT_SUCCESS(Status)) return FALSE;
|
|
|
|
|
|
|
|
/* Create it */
|
|
|
|
Status = NtCreateSymbolicLinkObject(&LinkHandle,
|
|
|
|
SYMBOLIC_LINK_ALL_ACCESS,
|
|
|
|
&ObjectAttributes,
|
|
|
|
&ArcName);
|
|
|
|
|
|
|
|
/* Free all the strings and close the handle and return success */
|
|
|
|
RtlFreeUnicodeString(&ArcName);
|
|
|
|
RtlFreeUnicodeString(&LinkName);
|
|
|
|
ObCloseHandle(LinkHandle, KernelMode);
|
|
|
|
return TRUE;
|
2002-03-16 00:00:13 +00:00
|
|
|
}
|
|
|
|
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
BOOLEAN
|
2024-06-11 19:26:12 +00:00
|
|
|
IopVerifyDiskSignature(
|
|
|
|
_In_ PDRIVE_LAYOUT_INFORMATION_EX DriveLayout,
|
|
|
|
_In_ PARC_DISK_SIGNATURE ArcDiskSignature,
|
|
|
|
_Out_ PULONG Signature)
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
{
|
2024-06-11 20:32:27 +00:00
|
|
|
/* Fail if the partition table is invalid */
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
if (!ArcDiskSignature->ValidPartitionTable)
|
|
|
|
return FALSE;
|
|
|
|
|
2024-06-11 20:32:27 +00:00
|
|
|
/* If the partition style is MBR */
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
if (DriveLayout->PartitionStyle == PARTITION_STYLE_MBR)
|
|
|
|
{
|
2024-06-11 20:32:27 +00:00
|
|
|
/* Check the MBR signature */
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
if (DriveLayout->Mbr.Signature == ArcDiskSignature->Signature)
|
|
|
|
{
|
|
|
|
/* And return it */
|
|
|
|
if (Signature)
|
|
|
|
*Signature = DriveLayout->Mbr.Signature;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
2024-06-11 20:32:27 +00:00
|
|
|
/* If the partition style is GPT */
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
else if (DriveLayout->PartitionStyle == PARTITION_STYLE_GPT)
|
|
|
|
{
|
2024-06-11 20:32:27 +00:00
|
|
|
/* Verify whether the signature is GPT and compare the GUID */
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
if (ArcDiskSignature->IsGpt &&
|
2024-06-11 19:26:12 +00:00
|
|
|
IsEqualGUID((PGUID)&ArcDiskSignature->GptSignature, &DriveLayout->Gpt.DiskId))
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
{
|
2024-06-11 20:32:27 +00:00
|
|
|
/* There is no signature to return, just zero it */
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
if (Signature)
|
|
|
|
*Signature = 0;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-06-11 20:32:27 +00:00
|
|
|
/* If we get there, something went wrong, so fail */
|
[NTOSKRNL]
Implemented IopFetchConfigurationInformation(), IopCreateArcNamesCd(), IopCreateArcNamesDisk(), IopVerifyDiskSignature()
Removed IopApplyRosCdromArcHack(), IopGetDiskInformation(), IopAssignArcNamesToCdrom()
Finally, rewritten IopCreateArcNames()
To make it short, this is the rewrite of ARC names handling in the kernel.
This brings our kernel to a higher state of existence. Indeed, it's leaving NT4 design for a proper NT5.2 design, with less hacks, less ROS specific stuff and such.
This code handles the mount manager we don't have yet.
svn path=/trunk/; revision=49131
2010-10-12 20:29:50 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2002-05-05 14:57:45 +00:00
|
|
|
/* EOF */
|