Moved creation of ARC names into ntoskrnl.

svn path=/trunk/; revision=2707
This commit is contained in:
Eric Kohl 2002-03-13 01:30:34 +00:00
parent 724d0e6c2f
commit 576dc2f69b
8 changed files with 218 additions and 121 deletions

View file

@ -41,8 +41,6 @@ FloppyCreateController(PDRIVER_OBJECT DriverObject,
PFLOPPY_CONTROLLER_EXTENSION ControllerExtension; PFLOPPY_CONTROLLER_EXTENSION ControllerExtension;
PFLOPPY_DEVICE_EXTENSION DeviceExtension; PFLOPPY_DEVICE_EXTENSION DeviceExtension;
UNICODE_STRING DeviceName; UNICODE_STRING DeviceName;
UNICODE_STRING arcname;
UNICODE_STRING SymlinkName;
NTSTATUS Status; NTSTATUS Status;
PDEVICE_OBJECT DeviceObject; PDEVICE_OBJECT DeviceObject;
PCONFIGURATION_INFORMATION ConfigInfo; PCONFIGURATION_INFORMATION ConfigInfo;
@ -241,8 +239,6 @@ FloppyCreateController(PDRIVER_OBJECT DriverObject,
// Ok, we own the adapter object, from now on we can just IoMapTransfer, and not // Ok, we own the adapter object, from now on we can just IoMapTransfer, and not
// bother releasing the adapter ever. // bother releasing the adapter ever.
RtlInitUnicodeString( &arcname, L"\\ArcName\\multi(0)disk(0)fdisk(0)" );
Status = IoAssignArcName( &arcname, &DeviceName );
DPRINT( "Floppy drive initialized\n" ); DPRINT( "Floppy drive initialized\n" );
return TRUE; return TRUE;

View file

@ -1,4 +1,4 @@
/* $Id: ide.c,v 1.52 2002/03/12 20:16:53 ekohl Exp $ /* $Id: ide.c,v 1.53 2002/03/13 01:29:44 ekohl Exp $
* *
* IDE.C - IDE Disk driver * IDE.C - IDE Disk driver
* written by Rex Jolliff * written by Rex Jolliff
@ -875,7 +875,7 @@ IDEGetDriveIdentification(IN int CommandPort,
// IDECreateDiskDevice // IDECreateDiskDevice
// //
// DESCRIPTION: // DESCRIPTION:
// Creates a device by calling IoCreateDevice and a sylbolic link for Win32 // Creates the disk device object
// //
// RUN LEVEL: // RUN LEVEL:
// PASSIVE_LEVEL // PASSIVE_LEVEL
@ -905,9 +905,7 @@ IDECreateDiskDevice(IN PDRIVER_OBJECT DriverObject,
IN ULONG SectorCount) IN ULONG SectorCount)
{ {
WCHAR NameBuffer[IDE_MAX_NAME_LENGTH]; WCHAR NameBuffer[IDE_MAX_NAME_LENGTH];
WCHAR ArcNameBuffer[IDE_MAX_NAME_LENGTH + 15];
UNICODE_STRING DeviceName; UNICODE_STRING DeviceName;
UNICODE_STRING ArcName;
NTSTATUS RC; NTSTATUS RC;
PIDE_DEVICE_EXTENSION DeviceExtension; PIDE_DEVICE_EXTENSION DeviceExtension;
@ -971,20 +969,6 @@ IDECreateDiskDevice(IN PDRIVER_OBJECT DriverObject,
IoInitializeDpcRequest(*DeviceObject, IoInitializeDpcRequest(*DeviceObject,
IDEDpcForIsr); IDEDpcForIsr);
/* assign arc name */
swprintf(ArcNameBuffer,
L"\\ArcName\\multi(0)disk(0)rdisk(%d)",
DiskNumber);
RtlInitUnicodeString(&ArcName,
ArcNameBuffer);
DPRINT("%wZ ==> %wZ\n", &ArcName, &DeviceName);
RC = IoAssignArcName(&ArcName,
&DeviceName);
if (!NT_SUCCESS(RC))
{
DbgPrint("IoAssignArcName (%wZ) failed (Status %x)\n", &ArcName, RC);
}
return RC; return RC;
} }
@ -992,7 +976,7 @@ IDECreateDiskDevice(IN PDRIVER_OBJECT DriverObject,
// IDECreatePartitionDevice // IDECreatePartitionDevice
// //
// DESCRIPTION: // DESCRIPTION:
// Creates a device by calling IoCreateDevice and a sylbolic link for Win32 // Creates a partition device object
// //
// RUN LEVEL: // RUN LEVEL:
// PASSIVE_LEVEL // PASSIVE_LEVEL
@ -1023,9 +1007,7 @@ IDECreatePartitionDevice(IN PDRIVER_OBJECT DriverObject,
IN PPARTITION_INFORMATION PartitionInfo) IN PPARTITION_INFORMATION PartitionInfo)
{ {
WCHAR NameBuffer[IDE_MAX_NAME_LENGTH]; WCHAR NameBuffer[IDE_MAX_NAME_LENGTH];
WCHAR ArcNameBuffer[IDE_MAX_NAME_LENGTH + 15];
UNICODE_STRING DeviceName; UNICODE_STRING DeviceName;
UNICODE_STRING ArcName;
NTSTATUS RC; NTSTATUS RC;
PIDE_DEVICE_EXTENSION DeviceExtension; PIDE_DEVICE_EXTENSION DeviceExtension;
@ -1087,21 +1069,6 @@ IDECreatePartitionDevice(IN PDRIVER_OBJECT DriverObject,
&DeviceName, &DeviceName,
DeviceExtension->PartitionLength.QuadPart >> 20); DeviceExtension->PartitionLength.QuadPart >> 20);
/* assign arc name */
swprintf(ArcNameBuffer,
L"\\ArcName\\multi(0)disk(0)rdisk(%d)partition(%d)",
DiskNumber,
PartitionInfo->PartitionNumber);
RtlInitUnicodeString(&ArcName,
ArcNameBuffer);
DPRINT("%wZ ==> %wZ\n", &ArcName, &DeviceName);
RC = IoAssignArcName(&ArcName,
&DeviceName);
if (!NT_SUCCESS(RC))
{
DbgPrint("IoAssignArcName (%wZ) failed (Status %x)\n", &ArcName, RC);
}
return RC; return RC;
} }

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: disk.c,v 1.8 2002/03/08 12:01:26 ekohl Exp $ /* $Id: disk.c,v 1.9 2002/03/13 01:30:34 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -386,11 +386,6 @@ DiskClassCreateDeviceObject(IN PDRIVER_OBJECT DriverObject,
ULONG PartitionNumber; ULONG PartitionNumber;
NTSTATUS Status; NTSTATUS Status;
WCHAR ArcNameBuffer[120];
UNICODE_STRING ArcName;
ANSI_STRING DeviceNameA;
UNICODE_STRING DeviceName;
DPRINT("DiskClassCreateDeviceObject() called\n"); DPRINT("DiskClassCreateDeviceObject() called\n");
/* Create the harddisk device directory */ /* Create the harddisk device directory */
@ -525,30 +520,6 @@ DiskClassCreateDeviceObject(IN PDRIVER_OBJECT DriverObject,
DPRINT("SectorSize: %lu\n", DiskDeviceExtension->DiskGeometry->BytesPerSector); DPRINT("SectorSize: %lu\n", DiskDeviceExtension->DiskGeometry->BytesPerSector);
/* assign arc name */
RtlInitAnsiString(&DeviceNameA,
NameBuffer2);
RtlAnsiStringToUnicodeString(&DeviceName,
&DeviceNameA,
TRUE);
swprintf(ArcNameBuffer,
L"\\ArcName\\multi(0)disk(0)rdisk(%lu)",
DiskNumber);
RtlInitUnicodeString(&ArcName,
ArcNameBuffer);
DPRINT("ArcNameBuffer '%S'\n", ArcNameBuffer);
DPRINT("%wZ ==> %wZ\n", &ArcName, &DeviceName);
Status = IoAssignArcName(&ArcName,
&DeviceName);
RtlFreeUnicodeString(&DeviceName);
if (!NT_SUCCESS(Status))
{
DbgPrint("IoAssignArcName (%wZ) failed (Status %x)\n", &ArcName, Status);
KeBugCheck(0);
}
/* Read partition table */ /* Read partition table */
Status = IoReadPartitionTable(DiskDeviceObject, Status = IoReadPartitionTable(DiskDeviceObject,
DiskDeviceExtension->DiskGeometry->BytesPerSector, DiskDeviceExtension->DiskGeometry->BytesPerSector,
@ -646,32 +617,6 @@ DiskClassCreateDeviceObject(IN PDRIVER_OBJECT DriverObject,
DiskData->HiddenSectors = PartitionEntry->HiddenSectors; DiskData->HiddenSectors = PartitionEntry->HiddenSectors;
DiskData->BootIndicator = PartitionEntry->BootIndicator; DiskData->BootIndicator = PartitionEntry->BootIndicator;
DiskData->DriveNotReady = FALSE; DiskData->DriveNotReady = FALSE;
/* assign arc name */
RtlInitAnsiString(&DeviceNameA,
NameBuffer2);
RtlAnsiStringToUnicodeString(&DeviceName,
&DeviceNameA,
TRUE);
swprintf(ArcNameBuffer,
L"\\ArcName\\multi(0)disk(0)rdisk(%lu)partition(%lu)",
DiskNumber,
PartitionNumber + 1);
RtlInitUnicodeString(&ArcName,
ArcNameBuffer);
DPRINT("ArcNameBuffer '%S'\n", ArcNameBuffer);
DPRINT("%wZ ==> %wZ\n", &ArcName, &DeviceName);
Status = IoAssignArcName(&ArcName,
&DeviceName);
RtlFreeUnicodeString(&DeviceName);
if (!NT_SUCCESS(Status))
{
DbgPrint("IoAssignArcName (%wZ) failed (Status %x)\n", &ArcName, Status);
KeBugCheck(0);
}
} }
else else
{ {
@ -795,6 +740,8 @@ DiskClassDeviceControl(IN PDEVICE_OBJECT DeviceObject,
case IOCTL_DISK_SET_PARTITION_INFO: case IOCTL_DISK_SET_PARTITION_INFO:
DPRINT1("Unhandled IOCTL_DISK_SET_PARTITION_INFO\n"); DPRINT1("Unhandled IOCTL_DISK_SET_PARTITION_INFO\n");
Status = STATUS_INVALID_DEVICE_REQUEST;
Information = 0;
break; break;
case IOCTL_DISK_GET_DRIVE_LAYOUT: case IOCTL_DISK_GET_DRIVE_LAYOUT:
@ -866,20 +813,26 @@ DiskClassDeviceControl(IN PDEVICE_OBJECT DeviceObject,
} }
// DiskClassShutdownFlush /**********************************************************************
// * NAME EXPORTED
// DESCRIPTION: * DiskClassShutdownFlush
// Answer requests for shutdown and flush calls *
// * DESCRIPTION
// RUN LEVEL: * Answer requests for shutdown and flush calls.
// PASSIVE_LEVEL *
// * RUN LEVEL
// ARGUMENTS: * PASSIVE_LEVEL
// Standard dispatch arguments *
// * ARGUMENTS
// RETURNS: * DeviceObject
// NTSTATUS * Pointer to the device.
// *
* Irp
* Pointer to the IRP
*
* RETURN VALUE
* Status
*/
NTSTATUS STDCALL NTSTATUS STDCALL
DiskClassShutdownFlush(IN PDEVICE_OBJECT DeviceObject, DiskClassShutdownFlush(IN PDEVICE_OBJECT DeviceObject,

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: io.h,v 1.15 2001/10/10 21:57:00 hbirr Exp $ /* $Id: io.h,v 1.16 2002/03/13 01:26:02 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -311,6 +311,9 @@ NTSTATUS STDCALL IoPageWrite (PFILE_OBJECT FileObject,
PIO_STATUS_BLOCK StatusBlock, PIO_STATUS_BLOCK StatusBlock,
BOOLEAN PagingIo); BOOLEAN PagingIo);
NTSTATUS
IoCreateArcNames(VOID);
NTSTATUS NTSTATUS
IopInitiatePnpIrp( IopInitiatePnpIrp(
PDEVICE_OBJECT DeviceObject, PDEVICE_OBJECT DeviceObject,

View file

@ -1,6 +1,10 @@
#ifndef __INCLUDE_INTERNAL_XHAL_H #ifndef __INCLUDE_INTERNAL_XHAL_H
#define __INCLUDE_INTERNAL_XHAL_H #define __INCLUDE_INTERNAL_XHAL_H
NTSTATUS
xHalQueryDriveLayout(IN PUNICODE_STRING DeviceName,
OUT PDRIVE_LAYOUT_INFORMATION *LayoutInfo);
VOID FASTCALL VOID FASTCALL
xHalExamineMBR(IN PDEVICE_OBJECT DeviceObject, xHalExamineMBR(IN PDEVICE_OBJECT DeviceObject,
IN ULONG SectorSize, IN ULONG SectorSize,

View file

@ -0,0 +1,174 @@
/*
* ReactOS kernel
* Copyright (C) 2002 ReactOS Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: arcname.c,v 1.1 2002/03/13 01:27:06 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/io/arcname.c
* PURPOSE: creates ARC names for boot devices
* PROGRAMMER: Eric Kohl (ekohl@rz-online.de)
*/
/* INCLUDES *****************************************************************/
#include <ddk/ntddk.h>
#include "internal/io.h"
#include "internal/xhal.h"
#define NDEBUG
#include <debug.h>
/* FUNCTIONS ****************************************************************/
NTSTATUS
IoCreateArcNames(VOID)
{
PCONFIGURATION_INFORMATION ConfigInfo;
PDRIVE_LAYOUT_INFORMATION LayoutInfo = NULL;
WCHAR DeviceNameBuffer[80];
WCHAR ArcNameBuffer[80];
UNICODE_STRING DeviceName;
UNICODE_STRING ArcName;
ULONG i, j;
NTSTATUS Status;
DPRINT("IoCreateArcNames() called\n");
ConfigInfo = IoGetConfigurationInformation();
/* create ARC names for floppy drives */
DPRINT("Floppy drives: %lu\n", ConfigInfo->FloppyCount);
for (i = 0; i < ConfigInfo->FloppyCount; i++)
{
swprintf(DeviceNameBuffer,
L"\\Device\\Floppy%lu",
i);
RtlInitUnicodeString(&DeviceName,
DeviceNameBuffer);
swprintf(ArcNameBuffer,
L"\\ArcName\\multi(0)disk(0)fdisk(%lu)",
i);
RtlInitUnicodeString(&ArcName,
ArcNameBuffer);
DPRINT("%wZ ==> %wZ\n",
&ArcName,
&DeviceName);
Status = IoAssignArcName(&ArcName,
&DeviceName);
if (!NT_SUCCESS(Status))
return(Status);
}
/* create ARC names for hard disk drives */
DPRINT("Disk drives: %lu\n", ConfigInfo->DiskCount);
for (i = 0; i < ConfigInfo->DiskCount; i++)
{
swprintf(DeviceNameBuffer,
L"\\Device\\Harddisk%lu\\Partition0",
i);
RtlInitUnicodeString(&DeviceName,
DeviceNameBuffer);
swprintf(ArcNameBuffer,
L"\\ArcName\\multi(0)disk(0)rdisk(%lu)partition(0)",
i);
RtlInitUnicodeString(&ArcName,
ArcNameBuffer);
DPRINT("%wZ ==> %wZ\n",
&ArcName,
&DeviceName);
Status = IoAssignArcName(&ArcName,
&DeviceName);
if (!NT_SUCCESS(Status))
return(Status);
Status = xHalQueryDriveLayout(&DeviceName,
&LayoutInfo);
if (!NT_SUCCESS(Status))
return(Status);
DPRINT("Number of partitions: %u\n", LayoutInfo->PartitionCount);
for (j = 0;j < LayoutInfo->PartitionCount; j++)
{
swprintf(DeviceNameBuffer,
L"\\Device\\Harddisk%lu\\Partition%lu",
i,
j + 1);
RtlInitUnicodeString(&DeviceName,
DeviceNameBuffer);
swprintf(ArcNameBuffer,
L"\\ArcName\\multi(0)disk(0)rdisk(%lu)partition(%lu)",
i,
j + 1);
RtlInitUnicodeString(&ArcName,
ArcNameBuffer);
DPRINT("%wZ ==> %wZ\n",
&ArcName,
&DeviceName);
Status = IoAssignArcName(&ArcName,
&DeviceName);
if (!NT_SUCCESS(Status))
return(Status);
}
ExFreePool(LayoutInfo);
LayoutInfo = NULL;
}
/* create ARC names for cdrom drives */
DPRINT("CD-ROM drives: %lu\n", ConfigInfo->CDRomCount);
for (i = 0; i < ConfigInfo->CDRomCount; i++)
{
swprintf(DeviceNameBuffer,
L"\\Device\\CdRom%lu",
i);
RtlInitUnicodeString(&DeviceName,
DeviceNameBuffer);
swprintf(ArcNameBuffer,
L"\\ArcName\\multi(0)disk(0)cdrom(%lu)",
i);
RtlInitUnicodeString(&ArcName,
ArcNameBuffer);
DPRINT("%wZ ==> %wZ\n",
&ArcName,
&DeviceName);
Status = IoAssignArcName(&ArcName,
&DeviceName);
if (!NT_SUCCESS(Status))
return(Status);
}
DPRINT("IoCreateArcNames() done\n");
return(STATUS_SUCCESS);
}
/* EOF */

View file

@ -1,4 +1,4 @@
/* $Id: xhaldrv.c,v 1.15 2001/08/21 20:13:09 chorns Exp $ /* $Id: xhaldrv.c,v 1.16 2002/03/13 01:27:06 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -59,9 +59,9 @@ typedef struct _PARTITION_TABLE
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
static NTSTATUS NTSTATUS
xHalpQueryDriveLayout(IN PUNICODE_STRING DeviceName, xHalQueryDriveLayout(IN PUNICODE_STRING DeviceName,
OUT PDRIVE_LAYOUT_INFORMATION *LayoutInfo) OUT PDRIVE_LAYOUT_INFORMATION *LayoutInfo)
{ {
IO_STATUS_BLOCK StatusBlock; IO_STATUS_BLOCK StatusBlock;
DISK_GEOMETRY DiskGeometry; DISK_GEOMETRY DiskGeometry;
@ -361,8 +361,8 @@ xHalIoAssignDriveLetters(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
RtlInitUnicodeString(&UnicodeString1, RtlInitUnicodeString(&UnicodeString1,
Buffer1); Buffer1);
Status = xHalpQueryDriveLayout(&UnicodeString1, Status = xHalQueryDriveLayout(&UnicodeString1,
&LayoutArray[i]); &LayoutArray[i]);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DbgPrint("xHalpQueryDriveLayout() failed (Status = 0x%lx)\n", DbgPrint("xHalpQueryDriveLayout() failed (Status = 0x%lx)\n",

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: main.c,v 1.114 2002/02/20 20:14:22 ekohl Exp $ /* $Id: main.c,v 1.115 2002/03/13 01:26:32 ekohl Exp $
* *
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
* FILE: ntoskrnl/ke/main.c * FILE: ntoskrnl/ke/main.c
@ -1125,6 +1125,8 @@ ExpInitializeExecutive(VOID)
} }
} }
IoCreateArcNames();
/* Create the SystemRoot symbolic link */ /* Create the SystemRoot symbolic link */
CPRINT("CommandLine: %s\n", (PUCHAR)KeLoaderBlock.CommandLine); CPRINT("CommandLine: %s\n", (PUCHAR)KeLoaderBlock.CommandLine);
@ -1137,8 +1139,6 @@ ExpInitializeExecutive(VOID)
#endif /* DBGPRINT_FILE_LOG */ #endif /* DBGPRINT_FILE_LOG */
CmInitializeRegistry2();
#if 0 #if 0
CreateDefaultRegistry(); CreateDefaultRegistry();
#endif #endif
@ -1243,7 +1243,7 @@ _main (ULONG MultiBootMagic, PLOADER_PARAMETER_BLOCK _LoaderBlock)
*/ */
strcpy (KeLoaderCommandLine, strcpy (KeLoaderCommandLine,
"multi(0)disk(0)rdisk(0)partition(1)\\reactos /DEBUGPORT=SCREEN"); "multi(0)disk(0)rdisk(0)partition(1)\\reactos /DEBUGPORT=SCREEN");
strcat (KeLoaderCommandLine, (PUCHAR)KeLoaderBlock.CommandLine); /* strcat (KeLoaderCommandLine, (PUCHAR)KeLoaderBlock.CommandLine); */
KeLoaderBlock.CommandLine = (ULONG)KeLoaderCommandLine; KeLoaderBlock.CommandLine = (ULONG)KeLoaderCommandLine;
strcpy(KeLoaderModuleStrings[0], "ntoskrnl.exe"); strcpy(KeLoaderModuleStrings[0], "ntoskrnl.exe");