Minor ide driver cleanup

Implemented ARC names

svn path=/trunk/; revision=1314
This commit is contained in:
Eric Kohl 2000-08-24 19:15:20 +00:00
parent 495a30cb8e
commit 6c2d255207
13 changed files with 370 additions and 218 deletions

View file

@ -1,4 +1,4 @@
/* $Id: ide.c,v 1.32 2000/08/22 21:09:25 ekohl Exp $ /* $Id: ide.c,v 1.33 2000/08/24 19:15:20 ekohl Exp $
* *
* IDE.C - IDE Disk driver * IDE.C - IDE Disk driver
* written by Rex Jolliff * written by Rex Jolliff
@ -64,12 +64,9 @@
* FIXME: add support for ATAPI tape drives * FIXME: add support for ATAPI tape drives
*/ */
#include <ddk/ntddk.h>
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
#include "../../../ntoskrnl/include/internal/i386/io.h" #include <ddk/ntddk.h>
#include <string.h>
#define NDEBUG #define NDEBUG
#include <debug.h> #include <debug.h>
@ -153,10 +150,12 @@ static BOOLEAN IDEGetPartitionTable(IN int CommandPort,
IN PIDE_DRIVE_IDENTIFY DrvParms, IN PIDE_DRIVE_IDENTIFY DrvParms,
PARTITION *PartitionTable); PARTITION *PartitionTable);
static NTSTATUS IDECreateDevice(IN PDRIVER_OBJECT DriverObject, static NTSTATUS IDECreateDevice(IN PDRIVER_OBJECT DriverObject,
IN PCHAR DeviceName, // IN PCHAR DeviceName,
OUT PDEVICE_OBJECT *DeviceObject, OUT PDEVICE_OBJECT *DeviceObject,
IN PCONTROLLER_OBJECT ControllerObject, IN PCONTROLLER_OBJECT ControllerObject,
IN int UnitNumber, IN int UnitNumber,
IN ULONG DiskNumber,
IN ULONG PartitionNumber,
IN PIDE_DRIVE_IDENTIFY DrvParms, IN PIDE_DRIVE_IDENTIFY DrvParms,
IN DWORD Offset, IN DWORD Offset,
IN DWORD Size); IN DWORD Size);
@ -186,7 +185,7 @@ static VOID IDEDpcForIsr(IN PKDPC Dpc,
IN PVOID DpcContext); IN PVOID DpcContext);
static VOID IDEFinishOperation(PIDE_CONTROLLER_EXTENSION ControllerExtension); static VOID IDEFinishOperation(PIDE_CONTROLLER_EXTENSION ControllerExtension);
static VOID IDEIoTimer(PDEVICE_OBJECT DeviceObject, PVOID Context); static VOID IDEIoTimer(PDEVICE_OBJECT DeviceObject, PVOID Context);
// ---------------------------------------------------------------- Inlines // ---------------------------------------------------------------- Inlines
extern inline void extern inline void
@ -468,8 +467,7 @@ IDECreateDevices(IN PDRIVER_OBJECT DriverObject,
IN int HarddiskIdx) IN int HarddiskIdx)
{ {
BOOLEAN CreatedDevices; BOOLEAN CreatedDevices;
char RawDeviceName[IDE_MAX_NAME_LENGTH]; WCHAR NameBuffer[IDE_MAX_NAME_LENGTH];
char PrimaryDeviceName[IDE_MAX_NAME_LENGTH];
int CommandPort, PartitionIdx, PartitionNum; int CommandPort, PartitionIdx, PartitionNum;
NTSTATUS RC; NTSTATUS RC;
IDE_DRIVE_IDENTIFY DrvParms; IDE_DRIVE_IDENTIFY DrvParms;
@ -477,8 +475,6 @@ IDECreateDevices(IN PDRIVER_OBJECT DriverObject,
PDEVICE_OBJECT PrimaryDeviceObject; PDEVICE_OBJECT PrimaryDeviceObject;
PIDE_DEVICE_EXTENSION RawDeviceExtension; PIDE_DEVICE_EXTENSION RawDeviceExtension;
PARTITION PartitionTable[4], *p; PARTITION PartitionTable[4], *p;
char DeviceDirName[IDE_MAX_NAME_LENGTH + 1];
ANSI_STRING AnsiDeviceDirName;
UNICODE_STRING UnicodeDeviceDirName; UNICODE_STRING UnicodeDeviceDirName;
OBJECT_ATTRIBUTES DeviceDirAttributes; OBJECT_ATTRIBUTES DeviceDirAttributes;
HANDLE Handle; HANDLE Handle;
@ -506,23 +502,15 @@ IDECreateDevices(IN PDRIVER_OBJECT DriverObject,
CreatedDevices = FALSE; CreatedDevices = FALSE;
// Create the harddisk device directory // Create the harddisk device directory
strcpy(DeviceDirName, IDE_NT_ROOTDIR_NAME); swprintf (NameBuffer,
strcat(DeviceDirName, IDE_NT_DEVICE_NAME); L"\\Device\\Harddisk%d",
DeviceDirName[strlen(DeviceDirName) + 1] = '\0'; HarddiskIdx);
DeviceDirName[strlen(DeviceDirName)] = '0' + HarddiskIdx; RtlInitUnicodeString(&UnicodeDeviceDirName,
RtlInitAnsiString(&AnsiDeviceDirName, DeviceDirName); NameBuffer);
RC = RtlAnsiStringToUnicodeString(&UnicodeDeviceDirName, InitializeObjectAttributes(&DeviceDirAttributes,
&AnsiDeviceDirName, &UnicodeDeviceDirName,
TRUE); 0,
if (!NT_SUCCESS(RC)) NULL,
{
DPRINT("Could not convert ansi to unicode for device dir\n", 0);
return FALSE;
}
InitializeObjectAttributes(&DeviceDirAttributes,
&UnicodeDeviceDirName,
0,
NULL,
NULL); NULL);
RC = ZwCreateDirectoryObject(&Handle, 0, &DeviceDirAttributes); RC = ZwCreateDirectoryObject(&Handle, 0, &DeviceDirAttributes);
if (!NT_SUCCESS(RC)) if (!NT_SUCCESS(RC))
@ -530,17 +518,8 @@ IDECreateDevices(IN PDRIVER_OBJECT DriverObject,
DPRINT("Could not create device dir object\n", 0); DPRINT("Could not create device dir object\n", 0);
return FALSE; return FALSE;
} }
RtlFreeUnicodeString(&UnicodeDeviceDirName);
// Create the raw device // Create the raw device
strcpy(RawDeviceName, IDE_NT_ROOTDIR_NAME);
strcat(RawDeviceName, IDE_NT_DEVICE_NAME);
RawDeviceName[strlen(RawDeviceName) + 1] = '\0';
RawDeviceName[strlen(RawDeviceName)] = '0' + HarddiskIdx;
strcat(RawDeviceName, IDE_NT_PARTITION_NAME);
RawDeviceName[strlen(RawDeviceName) + 1] = '\0';
RawDeviceName[strlen(RawDeviceName)] = '0';
if (DrvParms.Capabilities & IDE_DRID_LBA_SUPPORTED) if (DrvParms.Capabilities & IDE_DRID_LBA_SUPPORTED)
{ {
SectorCount = SectorCount =
@ -553,10 +532,11 @@ IDECreateDevices(IN PDRIVER_OBJECT DriverObject,
} }
RC = IDECreateDevice(DriverObject, RC = IDECreateDevice(DriverObject,
RawDeviceName,
&RawDeviceObject, &RawDeviceObject,
ControllerObject, ControllerObject,
DriveIdx, DriveIdx,
HarddiskIdx,
0,
&DrvParms, &DrvParms,
0, 0,
SectorCount); SectorCount);
@ -620,19 +600,13 @@ IDECreateDevices(IN PDRIVER_OBJECT DriverObject,
p->SectorCount); p->SectorCount);
// Create Device for partition // Create Device for partition
strcpy(PrimaryDeviceName, IDE_NT_ROOTDIR_NAME);
strcat(PrimaryDeviceName, IDE_NT_DEVICE_NAME);
PrimaryDeviceName[strlen(PrimaryDeviceName) + 1] = '\0';
PrimaryDeviceName[strlen(PrimaryDeviceName)] = '0' + HarddiskIdx;
strcat(PrimaryDeviceName, IDE_NT_PARTITION_NAME);
PrimaryDeviceName[strlen(PrimaryDeviceName) + 1] = '\0';
PrimaryDeviceName[strlen(PrimaryDeviceName)] = '0' + PartitionNum++;
TotalPartitions++; TotalPartitions++;
RC = IDECreateDevice(DriverObject, RC = IDECreateDevice(DriverObject,
PrimaryDeviceName,
&PrimaryDeviceObject, &PrimaryDeviceObject,
ControllerObject, ControllerObject,
DriveIdx, DriveIdx,
HarddiskIdx,
PartitionNum,
&DrvParms, &DrvParms,
p->StartingBlock + PartitionOffset, p->StartingBlock + PartitionOffset,
p->SectorCount); p->SectorCount);
@ -642,6 +616,7 @@ IDECreateDevices(IN PDRIVER_OBJECT DriverObject,
break; break;
} }
PartitionOffset += (p->StartingBlock + p->SectorCount); PartitionOffset += (p->StartingBlock + p->SectorCount);
PartitionNum++;
} }
else if (IsExtendedPartition(p->PartitionType)) else if (IsExtendedPartition(p->PartitionType))
{ {
@ -852,7 +827,6 @@ IDEGetPartitionTable(IN int CommandPort,
// //
// ARGUMENTS: // ARGUMENTS:
// IN PDRIVER_OBJECT DriverObject The system supplied driver object // IN PDRIVER_OBJECT DriverObject The system supplied driver object
// IN PCHAR DeviceName The name of the device
// OUT PDEVICE_OBJECT *DeviceObject The created device object // OUT PDEVICE_OBJECT *DeviceObject The created device object
// IN PCONTROLLER_OBJECT ControllerObject The Controller for the device // IN PCONTROLLER_OBJECT ControllerObject The Controller for the device
// IN BOOLEAN LBASupported Does the drive support LBA addressing? // IN BOOLEAN LBASupported Does the drive support LBA addressing?
@ -866,32 +840,36 @@ IDEGetPartitionTable(IN int CommandPort,
// NTSTATUS // NTSTATUS
// //
NTSTATUS NTSTATUS
IDECreateDevice(IN PDRIVER_OBJECT DriverObject, IDECreateDevice(IN PDRIVER_OBJECT DriverObject,
IN PCHAR DeviceName, OUT PDEVICE_OBJECT *DeviceObject,
OUT PDEVICE_OBJECT *DeviceObject, IN PCONTROLLER_OBJECT ControllerObject,
IN PCONTROLLER_OBJECT ControllerObject,
IN int UnitNumber, IN int UnitNumber,
IN ULONG DiskNumber,
IN ULONG PartitionNumber,
IN PIDE_DRIVE_IDENTIFY DrvParms, IN PIDE_DRIVE_IDENTIFY DrvParms,
IN DWORD Offset, IN DWORD Offset,
IN DWORD Size) IN DWORD Size)
{ {
WCHAR UnicodeBuffer[IDE_MAX_NAME_LENGTH]; WCHAR NameBuffer[IDE_MAX_NAME_LENGTH];
WCHAR ArcNameBuffer[IDE_MAX_NAME_LENGTH + 15];
UNICODE_STRING DeviceName;
UNICODE_STRING ArcName;
NTSTATUS RC; NTSTATUS RC;
ANSI_STRING AnsiName;
UNICODE_STRING UnicodeName;
PIDE_DEVICE_EXTENSION DeviceExtension; PIDE_DEVICE_EXTENSION DeviceExtension;
// Create a unicode device name // Create a unicode device name
RtlInitAnsiString(&AnsiName, DeviceName); swprintf(NameBuffer,
UnicodeName.MaximumLength = IDE_MAX_NAME_LENGTH * sizeof(WCHAR); L"\\Device\\Harddisk%d\\Partition%d",
UnicodeName.Buffer = UnicodeBuffer; DiskNumber,
RtlAnsiStringToUnicodeString(&UnicodeName, &AnsiName, FALSE); PartitionNumber);
RtlInitUnicodeString(&DeviceName,
NameBuffer);
// Create the device // Create the device
RC = IoCreateDevice(DriverObject, sizeof(IDE_DEVICE_EXTENSION), RC = IoCreateDevice(DriverObject, sizeof(IDE_DEVICE_EXTENSION),
&UnicodeName, FILE_DEVICE_DISK, 0, TRUE, DeviceObject); &DeviceName, FILE_DEVICE_DISK, 0, TRUE, DeviceObject);
if (!NT_SUCCESS(RC)) if (!NT_SUCCESS(RC))
{ {
DPRINT("IoCreateDevice call failed\n",0); DPRINT("IoCreateDevice call failed\n",0);
return RC; return RC;
@ -912,21 +890,50 @@ IDECreateDevice(IN PDRIVER_OBJECT DriverObject,
(DrvParms->Capabilities & IDE_DRID_DMA_SUPPORTED) ? 1 : 0; (DrvParms->Capabilities & IDE_DRID_DMA_SUPPORTED) ? 1 : 0;
// FIXME: deal with bizarre sector sizes // FIXME: deal with bizarre sector sizes
DeviceExtension->BytesPerSector = 512 /* DrvParms->BytesPerSector */; DeviceExtension->BytesPerSector = 512 /* DrvParms->BytesPerSector */;
DeviceExtension->SectorsPerLogCyl = DrvParms->LogicalHeads * DeviceExtension->SectorsPerLogCyl = DrvParms->LogicalHeads *
DrvParms->SectorsPerTrack; DrvParms->SectorsPerTrack;
DeviceExtension->SectorsPerLogTrk = DrvParms->SectorsPerTrack; DeviceExtension->SectorsPerLogTrk = DrvParms->SectorsPerTrack;
DeviceExtension->LogicalHeads = DrvParms->LogicalHeads; DeviceExtension->LogicalHeads = DrvParms->LogicalHeads;
DeviceExtension->Offset = Offset; DeviceExtension->Offset = Offset;
DeviceExtension->Size = Size; DeviceExtension->Size = Size;
DPRINT("%s: offset %d size %d \n", DPRINT("%wZ: offset %d size %d \n",
DeviceName, &DeviceName,
DeviceExtension->Offset, DeviceExtension->Offset,
DeviceExtension->Size); DeviceExtension->Size);
// Initialize the DPC object here // Initialize the DPC object here
IoInitializeDpcRequest(*DeviceObject, IDEDpcForIsr); IoInitializeDpcRequest(*DeviceObject, IDEDpcForIsr);
DbgPrint("%s %dMB\n", DeviceName, Size / 2048); if (PartitionNumber != 0)
{
DbgPrint("%wZ %dMB\n", &DeviceName, Size / 2048);
}
/* assign arc name */
if (PartitionNumber == 0)
{
swprintf(ArcNameBuffer,
L"\\ArcName\\multi(0)disk(0)rdisk(%d)",
DiskNumber);
}
else
{
swprintf(ArcNameBuffer,
L"\\ArcName\\multi(0)disk(0)rdisk(%d)partition(%d)",
DiskNumber,
PartitionNumber);
}
RtlInitUnicodeString (&ArcName,
ArcNameBuffer);
DPRINT1("%wZ ==> %wZ\n", &ArcName, &DeviceName);
RC = IoAssignArcName (&ArcName,
&DeviceName);
if (!NT_SUCCESS(RC))
{
DPRINT1("IoAssignArcName (%wZ) failed (Status %x)\n",
&ArcName, RC);
}
return RC; return RC;
} }

View file

@ -12,11 +12,6 @@ extern "C" {
#define IDE_MAXIMUM_DEVICES 8 #define IDE_MAXIMUM_DEVICES 8
#define IDE_MAX_NAME_LENGTH 50 #define IDE_MAX_NAME_LENGTH 50
#define IDE_NT_ROOTDIR_NAME "\\Device"
#define IDE_NT_DEVICE_NAME "\\Harddisk"
#define IDE_NT_PARTITION_NAME "\\Partition"
#define IDE_WIN32_DEVICE_NAME "\\DosDevices\\IDE"
#define IDE_DRIVER_NAME "IDEDRIVER"
#define IDE_SECTOR_BUF_SZ 512 #define IDE_SECTOR_BUF_SZ 512
#define IDE_MAX_SECTORS_PER_XFER 256 #define IDE_MAX_SECTORS_PER_XFER 256
@ -77,34 +72,50 @@ extern "C" {
// Access macros for command registers // Access macros for command registers
// Each macro takes an address of the command port block, and data // Each macro takes an address of the command port block, and data
// //
#define IDEReadError(Address) (inb_p((Address) + IDE_REG_ERROR)) #define IDEReadError(Address) \
#define IDEWritePrecomp(Address, Data) (outb_p((Address) + IDE_REG_PRECOMP, (Data))) (READ_PORT_UCHAR((PUCHAR)((Address) + IDE_REG_ERROR)))
#define IDEReadSectorCount(Address) (inb_p((Address) + IDE_REG_SECTOR_CNT)) #define IDEWritePrecomp(Address, Data) \
#define IDEWriteSectorCount(Address, Data) (outb_p((Address) + IDE_REG_SECTOR_CNT, (Data))) (WRITE_PORT_UCHAR((PUCHAR)((Address) + IDE_REG_PRECOMP), (Data)))
#define IDEReadSectorNum(Address) (inb_p((Address) + IDE_REG_SECTOR_NUM)) #define IDEReadSectorCount(Address) \
#define IDEWriteSectorNum(Address, Data) (outb_p((Address) + IDE_REG_SECTOR_NUM, (Data))) (READ_PORT_UCHAR((PUCHAR)((Address) + IDE_REG_SECTOR_CNT)))
#define IDEReadCylinderLow(Address) (inb_p((Address) + IDE_REG_CYL_LOW)) #define IDEWriteSectorCount(Address, Data) \
#define IDEWriteCylinderLow(Address, Data) (outb_p((Address) + IDE_REG_CYL_LOW, (Data))) (WRITE_PORT_UCHAR((PUCHAR)((Address) + IDE_REG_SECTOR_CNT), (Data)))
#define IDEReadCylinderHigh(Address) (inb_p((Address) + IDE_REG_CYL_HIGH)) #define IDEReadSectorNum(Address) \
#define IDEWriteCylinderHigh(Address, Data) (outb_p((Address) + IDE_REG_CYL_HIGH, (Data))) (READ_PORT_UCHAR((PUCHAR)((Address) + IDE_REG_SECTOR_NUM)))
#define IDEReadDriveHead(Address) (inb_p((Address) + IDE_REG_DRV_HEAD)) #define IDEWriteSectorNum(Address, Data) \
#define IDEWriteDriveHead(Address, Data) (outb_p((Address) + IDE_REG_DRV_HEAD, (Data))) (WRITE_PORT_UCHAR((PUCHAR)((Address) + IDE_REG_SECTOR_NUM), (Data)))
#define IDEReadStatus(Address) (inb_p((Address) + IDE_REG_STATUS)) #define IDEReadCylinderLow(Address) \
#define IDEWriteCommand(Address, Data) (outb_p((Address) + IDE_REG_COMMAND, (Data))) (READ_PORT_UCHAR((PUCHAR)((Address) + IDE_REG_CYL_LOW)))
#define IDEWriteCylinderLow(Address, Data) \
(WRITE_PORT_UCHAR((PUCHAR)((Address) + IDE_REG_CYL_LOW), (Data)))
#define IDEReadCylinderHigh(Address) \
(READ_PORT_UCHAR((PUCHAR)((Address) + IDE_REG_CYL_HIGH)))
#define IDEWriteCylinderHigh(Address, Data) \
(WRITE_PORT_UCHAR((PUCHAR)((Address) + IDE_REG_CYL_HIGH), (Data)))
#define IDEReadDriveHead(Address) \
(READ_PORT_UCHAR((PUCHAR)((Address) + IDE_REG_DRV_HEAD)))
#define IDEWriteDriveHead(Address, Data) \
(WRITE_PORT_UCHAR((PUCHAR)((Address) + IDE_REG_DRV_HEAD), (Data)))
#define IDEReadStatus(Address) \
(READ_PORT_UCHAR((PUCHAR)((Address) + IDE_REG_STATUS)))
#define IDEWriteCommand(Address, Data) \
(WRITE_PORT_UCHAR((PUCHAR)((Address) + IDE_REG_COMMAND), (Data)))
// //
// Data block read and write commands // Data block read and write commands
// //
#define IDEReadBlock(Address, Buffer, Count) \ #define IDEReadBlock(Address, Buffer, Count) \
(insw((Address) + IDE_REG_DATA_PORT, (Buffer), (Count) / 2)) (READ_PORT_BUFFER_USHORT((PUSHORT)((Address) + IDE_REG_DATA_PORT), (PUSHORT)(Buffer), (Count) / 2))
#define IDEWriteBlock(Address, Buffer, Count) \ #define IDEWriteBlock(Address, Buffer, Count) \
(outsw((Address) + IDE_REG_DATA_PORT, (Buffer), (Count) / 2)) (WRITE_PORT_BUFFER_USHORT((PUSHORT)((Address) + IDE_REG_DATA_PORT), (PUSHORT)(Buffer), (Count) / 2))
// //
// Access macros for control registers // Access macros for control registers
// Each macro takes an address of the control port blank and data // Each macro takes an address of the control port blank and data
// //
#define IDEWriteDriveControl(Address, Data) (outb_p((Address) + IDE_REG_DEV_CNTRL, (Data))) #define IDEWriteDriveControl(Address, Data) \
(WRITE_PORT_UCHAR((PUCHAR)((Address) + IDE_REG_DEV_CNTRL), (Data)))
// IDE_DEVICE_EXTENSION // IDE_DEVICE_EXTENSION
// //

View file

@ -1,6 +1,6 @@
#ifndef _INCLUDE_DDK_IOFUNCS_H #ifndef _INCLUDE_DDK_IOFUNCS_H
#define _INCLUDE_DDK_IOFUNCS_H #define _INCLUDE_DDK_IOFUNCS_H
/* $Id: iofuncs.h,v 1.19 2000/07/30 18:22:32 dwelch Exp $ */ /* $Id: iofuncs.h,v 1.20 2000/08/24 19:06:29 ekohl Exp $ */
/* --- EXPORTED BY NTOSKRNL --- */ /* --- EXPORTED BY NTOSKRNL --- */
@ -213,8 +213,8 @@ IoAllocateMdl (
* PUNICODE_STRING DeviceName * PUNICODE_STRING DeviceName
* ); * );
*/ */
#define IoAssignArcName (ArcName, DeviceName) \ #define IoAssignArcName(ArcName,DeviceName) \
(IoCreateSymbolicLink ((ArcName), (DeviceName))) (IoCreateSymbolicLink((ArcName),(DeviceName)))
/********************************************************************** /**********************************************************************
* NAME EXPORTED * NAME EXPORTED
@ -695,7 +695,7 @@ IoGetTopLevelIrp (
VOID VOID
); );
#define IoInitializeDpcRequest(DeviceObject, DpcRoutine) \ #define IoInitializeDpcRequest(DeviceObject,DpcRoutine) \
(KeInitializeDpc(&(DeviceObject)->Dpc, \ (KeInitializeDpc(&(DeviceObject)->Dpc, \
(PKDEFERRED_ROUTINE)(DpcRoutine), \ (PKDEFERRED_ROUTINE)(DpcRoutine), \
(DeviceObject))) (DeviceObject)))
@ -894,10 +894,10 @@ IoReportResourceUsage (
PBOOLEAN ConflictDetected PBOOLEAN ConflictDetected
); );
#define IoRequestDpc(DeviceObject, Irp, Context) \ #define IoRequestDpc(DeviceObject,Irp,Context) \
(KeInsertQueueDpc(&(DeviceObject)->Dpc,(Irp),(Context))) (KeInsertQueueDpc(&(DeviceObject)->Dpc,(Irp),(Context)))
#define IoSetCancelRoutine(Irp, NewCancelRoutine) \ #define IoSetCancelRoutine(Irp,NewCancelRoutine) \
((PDRIVER_CANCEL)InterlockedExchange((PULONG)&(Irp)->CancelRoutine, \ ((PDRIVER_CANCEL)InterlockedExchange((PULONG)&(Irp)->CancelRoutine, \
(ULONG)(NewCancelRoutine))); (ULONG)(NewCancelRoutine)));

View file

@ -1,6 +1,6 @@
#ifndef _INCLUDE_DDK_OBTYPES_H #ifndef _INCLUDE_DDK_OBTYPES_H
#define _INCLUDE_DDK_OBTYPES_H #define _INCLUDE_DDK_OBTYPES_H
/* $Id: obtypes.h,v 1.8 2000/06/15 18:37:33 ekohl Exp $ */ /* $Id: obtypes.h,v 1.9 2000/08/24 19:06:29 ekohl Exp $ */
struct _DIRECTORY_OBJECT; struct _DIRECTORY_OBJECT;
struct _OBJECT_ATTRIBUTES; struct _OBJECT_ATTRIBUTES;
@ -90,7 +90,8 @@ typedef struct _OBJECT_TYPE
NTSTATUS (*Parse)(PVOID ParsedObject, NTSTATUS (*Parse)(PVOID ParsedObject,
PVOID *NextObject, PVOID *NextObject,
PUNICODE_STRING FullPath, PUNICODE_STRING FullPath,
PWSTR *Path); PWSTR *Path,
struct _OBJECT_TYPE* ObjectType);
/* /*
*/ */

View file

@ -1,4 +1,4 @@
/* $Id: io.h,v 1.3 2000/07/07 10:30:55 dwelch Exp $ /* $Id: io.h,v 1.4 2000/08/24 19:07:49 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -15,7 +15,7 @@
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <internal/ob.h> #include <internal/ob.h>
extern POBJECT_TYPE IoSymbolicLinkObjectType; extern POBJECT_TYPE IoSymbolicLinkType;
/* /*
* FUNCTION: Called to initalize a loaded driver * FUNCTION: Called to initalize a loaded driver

View file

@ -106,9 +106,8 @@ VOID ObCreateHandleTable(struct _EPROCESS* Parent,
struct _EPROCESS* Process); struct _EPROCESS* Process);
NTSTATUS ObFindObject(POBJECT_ATTRIBUTES ObjectAttributes, NTSTATUS ObFindObject(POBJECT_ATTRIBUTES ObjectAttributes,
PVOID* ReturnedObject, PVOID* ReturnedObject,
PUNICODE_STRING RemainingPath); PUNICODE_STRING RemainingPath,
// PWSTR* RemainingPath); POBJECT_TYPE ObjectType);
ULONG ObGetReferenceCount(PVOID Object); ULONG ObGetReferenceCount(PVOID Object);
ULONG ObGetHandleCount(PVOID Object); ULONG ObGetHandleCount(PVOID Object);
VOID ObCloseAllHandles(struct _EPROCESS* Process); VOID ObCloseAllHandles(struct _EPROCESS* Process);

View file

@ -1,4 +1,4 @@
/* $Id: iomgr.c,v 1.13 2000/07/07 02:10:18 ekohl Exp $ /* $Id: iomgr.c,v 1.14 2000/08/24 19:09:12 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -109,7 +109,6 @@ VOID IoInit (VOID)
OBJECT_ATTRIBUTES attr; OBJECT_ATTRIBUTES attr;
HANDLE handle; HANDLE handle;
UNICODE_STRING UnicodeString; UNICODE_STRING UnicodeString;
ANSI_STRING AnsiString;
UNICODE_STRING DeviceName; UNICODE_STRING DeviceName;
/* /*
@ -136,15 +135,11 @@ VOID IoInit (VOID)
IoDeviceObjectType->OkayToClose = NULL; IoDeviceObjectType->OkayToClose = NULL;
IoDeviceObjectType->Create = IopCreateDevice; IoDeviceObjectType->Create = IopCreateDevice;
RtlInitAnsiString ( RtlInitUnicodeString (
& AnsiString,
"Device"
);
RtlAnsiStringToUnicodeString (
& IoDeviceObjectType->TypeName, & IoDeviceObjectType->TypeName,
& AnsiString, L"Device"
TRUE
); );
/* /*
* Register iomgr types: FileObjectType * Register iomgr types: FileObjectType
* (alias DriverObjectType) * (alias DriverObjectType)
@ -170,27 +165,17 @@ VOID IoInit (VOID)
IoFileObjectType->OkayToClose = NULL; IoFileObjectType->OkayToClose = NULL;
IoFileObjectType->Create = IopCreateFile; IoFileObjectType->Create = IopCreateFile;
RtlInitAnsiString ( RtlInitUnicodeString (
& AnsiString,
"File"
);
RtlAnsiStringToUnicodeString (
& IoFileObjectType->TypeName, & IoFileObjectType->TypeName,
& AnsiString, L"File"
TRUE
); );
/* /*
* Create the device directory * Create the '\Device' directory
*/ */
RtlInitAnsiString ( RtlInitUnicodeString (
& AnsiString,
"\\Device"
);
RtlAnsiStringToUnicodeString (
& UnicodeString, & UnicodeString,
& AnsiString, L"\\Device"
TRUE
); );
InitializeObjectAttributes ( InitializeObjectAttributes (
& attr, & attr,
@ -206,16 +191,11 @@ VOID IoInit (VOID)
); );
/* /*
* Create the \?? directory * Create the '\??' directory
*/ */
RtlInitAnsiString ( RtlInitUnicodeString (
& AnsiString,
"\\??"
);
RtlAnsiStringToUnicodeString (
& UnicodeString, & UnicodeString,
& AnsiString, L"\\??"
TRUE
); );
InitializeObjectAttributes ( InitializeObjectAttributes (
& attr, & attr,
@ -229,6 +209,26 @@ VOID IoInit (VOID)
0, 0,
& attr & attr
); );
/*
* Create the '\ArcName' directory
*/
RtlInitUnicodeString (
& UnicodeString,
L"\\ArcName");
InitializeObjectAttributes (
& attr,
& UnicodeString,
0,
NULL,
NULL
);
ZwCreateDirectoryObject (
& handle,
0,
& attr
);
/* /*
* Initialize remaining subsubsystem * Initialize remaining subsubsystem
*/ */
@ -238,7 +238,7 @@ VOID IoInit (VOID)
IoInitVpbImplementation (); IoInitVpbImplementation ();
/* /*
* Create link from \DosDevices to \?? directory * Create link from '\DosDevices' to '\??' directory
*/ */
RtlInitUnicodeString (&UnicodeString, RtlInitUnicodeString (&UnicodeString,
L"\\DosDevices"); L"\\DosDevices");

View file

@ -1,4 +1,4 @@
/* $Id: symlink.c,v 1.15 2000/06/29 23:35:38 dwelch Exp $ /* $Id: symlink.c,v 1.16 2000/08/24 19:09:12 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -86,7 +86,8 @@ IopParseSymbolicLink (
PVOID Object, PVOID Object,
PVOID * NextObject, PVOID * NextObject,
PUNICODE_STRING FullPath, PUNICODE_STRING FullPath,
PWSTR * RemainingPath PWSTR * RemainingPath,
POBJECT_TYPE ObjectType
) )
{ {
NTSTATUS Status; NTSTATUS Status;
@ -94,6 +95,19 @@ IopParseSymbolicLink (
PVOID ReturnedObject; PVOID ReturnedObject;
UNICODE_STRING TargetPath; UNICODE_STRING TargetPath;
DPRINT("IopParseSymbolicLink (RemainingPath %S)\n", *RemainingPath);
/*
* Stop parsing if the entire path has been parsed and
* the desired object is a symbolic link object.
*/
if (((*RemainingPath == NULL) || (**RemainingPath == 0)) &&
(ObjectType == IoSymbolicLinkType))
{
DPRINT("Parsing stopped!\n");
*NextObject = NULL;
return STATUS_SUCCESS;
}
Status = ObReferenceObjectByName( Status = ObReferenceObjectByName(
SymlinkObject->Target.ObjectName, SymlinkObject->Target.ObjectName,
0, 0,
@ -197,12 +211,15 @@ NtOpenSymbolicLinkObject (
NTSTATUS Status; NTSTATUS Status;
PVOID Object; PVOID Object;
DPRINT("NtOpenSymbolicLinkObject (Name %wZ)\n",
ObjectAttributes->ObjectName);
Status = ObReferenceObjectByName( Status = ObReferenceObjectByName(
ObjectAttributes->ObjectName, ObjectAttributes->ObjectName,
ObjectAttributes->Attributes, ObjectAttributes->Attributes,
NULL, NULL,
DesiredAccess, DesiredAccess,
NULL, IoSymbolicLinkType,
UserMode, UserMode,
NULL, NULL,
& Object & Object
@ -354,7 +371,6 @@ IoCreateSymbolicLink (
{ {
return STATUS_UNSUCCESSFUL; return STATUS_UNSUCCESSFUL;
} }
SymbolicLink->TargetName.Length = 0; SymbolicLink->TargetName.Length = 0;
SymbolicLink->TargetName.MaximumLength = SymbolicLink->TargetName.MaximumLength =
((wcslen(DeviceName->Buffer) + 1) * sizeof(WCHAR)); ((wcslen(DeviceName->Buffer) + 1) * sizeof(WCHAR));

View file

@ -1,4 +1,4 @@
/* $Id: xhaldrv.c,v 1.5 2000/08/22 21:10:28 ekohl Exp $ /* $Id: xhaldrv.c,v 1.6 2000/08/24 19:09:12 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -34,18 +34,6 @@
#define PARTITION_OFFSET 0x01be #define PARTITION_OFFSET 0x01be
#define PARTITION_TBL_SIZE 4 #define PARTITION_TBL_SIZE 4
/*
#define PTCHSToLBA(c, h, s, scnt, hcnt) ((s) & 0x3f) + \
(scnt) * ( (h) + (hcnt) * ((c) | (((s) & 0xc0) << 2)))
#define PTLBAToCHS(lba, c, h, s, scnt, hcnt) ( \
(s) = (lba) % (scnt) + 1, \
(lba) /= (scnt), \
(h) = (lba) % (hcnt), \
(lba) /= (heads), \
(c) = (lba) & 0xff, \
(s) |= ((lba) >> 2) & 0xc0)
*/
#define IsUsablePartition(P) \ #define IsUsablePartition(P) \
((P) != PTEmpty && \ ((P) != PTEmpty && \
(P) != PTDosExtended && \ (P) != PTDosExtended && \
@ -286,9 +274,9 @@ HalpAssignDrive (
RtlInitUnicodeString (&DriveName, RtlInitUnicodeString (&DriveName,
DriveNameBuffer); DriveNameBuffer);
DPRINT1(" %wZ ==> %wZ\n", DPRINT(" %wZ ==> %wZ\n",
&DriveName, &DriveName,
PartitionName); PartitionName);
/* create symbolic link */ /* create symbolic link */
IoCreateSymbolicLink (&DriveName, IoCreateSymbolicLink (&DriveName,
@ -360,9 +348,9 @@ xHalIoAssignDriveLetters (
RtlInitUnicodeString (&UnicodeString2, RtlInitUnicodeString (&UnicodeString2,
Buffer2); Buffer2);
DPRINT1("Creating link: %S ==> %S\n", DPRINT("Creating link: %S ==> %S\n",
Buffer2, Buffer2,
Buffer1); Buffer1);
IoCreateSymbolicLink (&UnicodeString2, IoCreateSymbolicLink (&UnicodeString2,
&UnicodeString1); &UnicodeString1);
@ -385,8 +373,8 @@ xHalIoAssignDriveLetters (
&LayoutInfo); &LayoutInfo);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT1("xHalpQueryDriveLayout() failed (Status = 0x%lx)\n", DbgPrint("xHalpQueryDriveLayout() failed (Status = 0x%lx)\n",
Status); Status);
continue; continue;
} }
@ -439,8 +427,8 @@ xHalIoAssignDriveLetters (
&LayoutInfo); &LayoutInfo);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT1("xHalpQueryDriveLayout() failed (Status = 0x%lx)\n", DbgPrint("xHalpQueryDriveLayout() failed (Status = 0x%lx)\n",
Status); Status);
continue; continue;
} }
@ -491,8 +479,8 @@ xHalIoAssignDriveLetters (
&LayoutInfo); &LayoutInfo);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT1("xHalpQueryDriveLayout() failed (Status = 0x%lx)\n", DbgPrint("xHalpQueryDriveLayout() failed (Status = 0x%lx)\n",
Status); Status);
continue; continue;
} }

View file

@ -1,4 +1,4 @@
/* $Id: main.c,v 1.57 2000/08/15 12:44:47 ekohl Exp $ /* $Id: main.c,v 1.58 2000/08/24 19:10:27 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -23,6 +23,7 @@
#include <internal/ps.h> #include <internal/ps.h>
#include <internal/hal.h> #include <internal/hal.h>
#include <internal/ke.h> #include <internal/ke.h>
#include <internal/io.h>
#include <internal/mmhal.h> #include <internal/mmhal.h>
#include <internal/i386/segment.h> #include <internal/i386/segment.h>
@ -40,21 +41,140 @@ LOADER_PARAMETER_BLOCK EXPORTED KeLoaderBlock;
/* FUNCTIONS ****************************************************************/ /* FUNCTIONS ****************************************************************/
static VOID CreateSystemRootLink (LPWSTR Device) static VOID
CreateSystemRootLink (PCSZ ParameterLine)
{ {
UNICODE_STRING LinkName; UNICODE_STRING LinkName;
UNICODE_STRING DeviceName; UNICODE_STRING DeviceName;
UNICODE_STRING ArcName;
UNICODE_STRING BootPath;
PCHAR ParamBuffer;
PWCHAR ArcNameBuffer;
PCHAR p;
NTSTATUS Status;
ULONG Length;
OBJECT_ATTRIBUTES ObjectAttributes;
HANDLE Handle;
/* create local parameter line copy */
ParamBuffer = ExAllocatePool (PagedPool, 256);
strcpy (ParamBuffer, (char *)ParameterLine);
DPRINT("%s\n", ParamBuffer);
/* Format: <arc_name>\<path> [options...] */
/* cut options off */
p = strchr (ParamBuffer, ' ');
if (p)
*p = 0;
DPRINT("%s\n", ParamBuffer);
/* extract path */
p = strchr (ParamBuffer, '\\');
if (p)
{
DPRINT("Boot path: %s\n", p);
RtlCreateUnicodeStringFromAsciiz (&BootPath, p);
*p = 0;
}
else
{
DPRINT("Boot path: %s\n", "\\");
RtlCreateUnicodeStringFromAsciiz (&BootPath, "\\");
}
DPRINT("Arc name: %s\n", ParamBuffer);
/* Only arc name left - build full arc name */
ArcNameBuffer = ExAllocatePool (PagedPool, 256 * sizeof(WCHAR));
swprintf (ArcNameBuffer,
L"\\ArcName\\%S", ParamBuffer);
RtlInitUnicodeString (&ArcName, ArcNameBuffer);
DPRINT("Arc name: %wZ\n", &ArcName);
/* free ParamBuffer */
ExFreePool (ParamBuffer);
/* allocate device name string */
DeviceName.Length = 0;
DeviceName.MaximumLength = 256 * sizeof(WCHAR);
DeviceName.Buffer = ExAllocatePool (PagedPool, 256 * sizeof(WCHAR));
InitializeObjectAttributes (&ObjectAttributes,
&ArcName,
0,
NULL,
NULL);
Status = NtOpenSymbolicLinkObject (&Handle,
SYMBOLIC_LINK_ALL_ACCESS,
&ObjectAttributes);
RtlFreeUnicodeString (&ArcName);
if (!NT_SUCCESS(Status))
{
RtlFreeUnicodeString (&BootPath);
RtlFreeUnicodeString (&DeviceName);
DbgPrint("NtOpenSymbolicLinkObject() failed (Status %x)\n",
Status);
KeBugCheck (0x0);
}
Status = NtQuerySymbolicLinkObject (Handle,
&DeviceName,
&Length);
NtClose (Handle);
if (!NT_SUCCESS(Status))
{
RtlFreeUnicodeString (&BootPath);
RtlFreeUnicodeString (&DeviceName);
DbgPrint("NtQuerySymbolicObject() failed (Status %x)\n",
Status);
KeBugCheck (0x0);
}
DPRINT("Length: %lu DeviceName: %wZ\n", Length, &DeviceName);
RtlAppendUnicodeStringToString (&DeviceName,
&BootPath);
RtlFreeUnicodeString (&BootPath);
DPRINT("DeviceName: %wZ\n", &DeviceName);
/* create the '\SystemRoot' link */
RtlInitUnicodeString (&LinkName, RtlInitUnicodeString (&LinkName,
L"\\SystemRoot"); L"\\SystemRoot");
RtlInitUnicodeString (&DeviceName, Status = IoCreateSymbolicLink (&LinkName,
Device); &DeviceName);
RtlFreeUnicodeString (&DeviceName);
if (!NT_SUCCESS(Status))
{
DbgPrint("IoCreateSymbolicLink() failed (Status %x)\n",
Status);
IoCreateSymbolicLink (&LinkName, KeBugCheck (0x0);
&DeviceName); }
/*
* FIXME: test if '\SystemRoot' (LinkName)can be opened,
* otherwise crash it!
*/
} }
static VOID
InitSystemSharedUserPage (VOID)
{
PKUSER_SHARED_DATA SharedPage;
SharedPage = (PKUSER_SHARED_DATA)KERNEL_SHARED_DATA_BASE;
/* set system root in shared user page */
wcscpy (SharedPage->NtSystemRoot, L"C:\\reactos");
SharedPage->NtProductType = NtProductWinNt;
}
void _main (PLOADER_PARAMETER_BLOCK LoaderBlock) void _main (PLOADER_PARAMETER_BLOCK LoaderBlock)
/* /*
* FUNCTION: Called by the boot loader to start the kernel * FUNCTION: Called by the boot loader to start the kernel
@ -78,7 +198,8 @@ void _main (PLOADER_PARAMETER_BLOCK LoaderBlock)
* Initializes the kernel parameter line. * Initializes the kernel parameter line.
* This should be done by the boot loader. * This should be done by the boot loader.
*/ */
strcpy (KeLoaderBlock.kernel_parameters, "/DEBUGPORT=SCREEN"); strcpy (KeLoaderBlock.kernel_parameters,
"multi(0)disk(0)rdisk(0)partition(1)\\reactos /DEBUGPORT=SCREEN");
/* /*
* Initialization phase 0 * Initialization phase 0
@ -145,34 +266,33 @@ void _main (PLOADER_PARAMETER_BLOCK LoaderBlock)
*/ */
DPRINT1("%d files loaded\n",KeLoaderBlock.nr_files); DPRINT1("%d files loaded\n",KeLoaderBlock.nr_files);
/* Pass 1: load registry chunks passed in */ /* Pass 1: load registry chunks passed in */
start = KERNEL_BASE + PAGE_ROUND_UP(KeLoaderBlock.module_length[0]); start = KERNEL_BASE + PAGE_ROUND_UP(KeLoaderBlock.module_length[0]);
for (i = 1; i < KeLoaderBlock.nr_files; i++) for (i = 1; i < KeLoaderBlock.nr_files; i++)
{ {
if (!strcmp ((PCHAR) start, "REGEDIT4")) if (!strcmp ((PCHAR) start, "REGEDIT4"))
{ {
DPRINT1("process registry chunk at %08lx\n", start); DPRINT1("process registry chunk at %08lx\n", start);
CmImportHive((PCHAR) start); CmImportHive((PCHAR) start);
} }
start = start + KeLoaderBlock.module_length[i]; start = start + KeLoaderBlock.module_length[i];
} }
/* Pass 2: process boot loaded drivers */ /* Pass 2: process boot loaded drivers */
start = KERNEL_BASE + PAGE_ROUND_UP(KeLoaderBlock.module_length[0]); start = KERNEL_BASE + PAGE_ROUND_UP(KeLoaderBlock.module_length[0]);
start1 = start + KeLoaderBlock.module_length[1]; start1 = start + KeLoaderBlock.module_length[1];
for (i=1;i<KeLoaderBlock.nr_files;i++) for (i=1;i<KeLoaderBlock.nr_files;i++)
{ {
if (strcmp ((PCHAR) start, "REGEDIT4")) if (strcmp ((PCHAR) start, "REGEDIT4"))
{ {
DPRINT1("process module at %08lx\n", start); DPRINT1("process module at %08lx\n", start);
LdrProcessDriver((PVOID)start); LdrProcessDriver((PVOID)start);
} }
start = start + KeLoaderBlock.module_length[i]; start = start + KeLoaderBlock.module_length[i];
} }
/* Create the SystemRoot symbolic link */ /* Create the SystemRoot symbolic link */
/* Hardcoded to 'C:\reactos' but this will change. */ CreateSystemRootLink (KeLoaderBlock.kernel_parameters);
CreateSystemRootLink (L"\\Device\\Harddisk0\\Partition1\\reactos");
/* /*
* Load Auto configured drivers * Load Auto configured drivers
@ -187,12 +307,8 @@ void _main (PLOADER_PARAMETER_BLOCK LoaderBlock)
NULL, NULL,
NULL); NULL);
/* set system root in shared user page */ /* initialize shared user page */
wcscpy (((PKUSER_SHARED_DATA)KERNEL_SHARED_DATA_BASE)->NtSystemRoot, InitSystemSharedUserPage ();
L"C:\\reactos");
((PKUSER_SHARED_DATA)KERNEL_SHARED_DATA_BASE)->NtProductType = NtProductWinNt;
/* /*
* Launch initial process * Launch initial process

View file

@ -1,4 +1,4 @@
/* $Id: loader.c,v 1.60 2000/08/12 19:33:21 dwelch Exp $ /* $Id: loader.c,v 1.61 2000/08/24 19:11: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
@ -421,7 +421,8 @@ LdrOpenModule(PUNICODE_STRING Filename)
Status = ObFindObject(&ObjectAttributes, Status = ObFindObject(&ObjectAttributes,
(PVOID *) &ModuleObject, (PVOID *) &ModuleObject,
&RemainingPath); &RemainingPath,
NULL);
CHECKPOINT; CHECKPOINT;
if (NT_SUCCESS(Status) && (RemainingPath.Buffer == NULL || *(RemainingPath.Buffer) == 0)) if (NT_SUCCESS(Status) && (RemainingPath.Buffer == NULL || *(RemainingPath.Buffer) == 0))
{ {

View file

@ -37,20 +37,25 @@ NTSTATUS STDCALL ObReferenceObjectByName(PUNICODE_STRING ObjectPath,
PVOID ParseContext, PVOID ParseContext,
PVOID* ObjectPtr) PVOID* ObjectPtr)
{ {
PVOID Object; PVOID Object = NULL;
UNICODE_STRING RemainingPath; UNICODE_STRING RemainingPath;
// PWSTR RemainingPath;
OBJECT_ATTRIBUTES ObjectAttributes; OBJECT_ATTRIBUTES ObjectAttributes;
NTSTATUS Status;
InitializeObjectAttributes(&ObjectAttributes, InitializeObjectAttributes(&ObjectAttributes,
ObjectPath, ObjectPath,
0, 0,
NULL, NULL,
NULL); NULL);
ObFindObject(&ObjectAttributes, Status = ObFindObject(&ObjectAttributes,
&Object, &Object,
&RemainingPath); &RemainingPath,
ObjectType);
if (!NT_SUCCESS(Status))
{
return(STATUS_UNSUCCESSFUL);
}
if (RemainingPath.Buffer != NULL || if (RemainingPath.Buffer != NULL ||
Object == NULL) Object == NULL)
{ {
@ -138,7 +143,8 @@ ObpParseDirectory (
PVOID Object, PVOID Object,
PVOID * NextObject, PVOID * NextObject,
PUNICODE_STRING FullPath, PUNICODE_STRING FullPath,
PWSTR * Path PWSTR * Path,
POBJECT_TYPE ObjectType
) )
{ {
PWSTR end; PWSTR end;

View file

@ -1,4 +1,4 @@
/* $Id: object.c,v 1.25 2000/07/30 18:22:35 dwelch Exp $ /* $Id: object.c,v 1.26 2000/08/24 19:12:16 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -66,7 +66,7 @@ VOID ObInitializeObject(POBJECT_HEADER ObjectHeader,
/********************************************************************** /**********************************************************************
* NAME PRIVATE * NAME PRIVATE
* ObFindObject@12 * ObFindObject@16
* *
* DESCRIPTION * DESCRIPTION
* *
@ -81,11 +81,16 @@ VOID ObInitializeObject(POBJECT_HEADER ObjectHeader,
* The caller must free the buffer after use by calling * The caller must free the buffer after use by calling
* RtlFreeUnicodeString (). * RtlFreeUnicodeString ().
* *
* ObjectType
* Optional pointer to an object type. This is used to
* descide if a symbolic link object will be parsed or not.
*
* RETURN VALUE * RETURN VALUE
*/ */
NTSTATUS ObFindObject(POBJECT_ATTRIBUTES ObjectAttributes, NTSTATUS ObFindObject(POBJECT_ATTRIBUTES ObjectAttributes,
PVOID* ReturnedObject, PVOID* ReturnedObject,
PUNICODE_STRING RemainingPath) PUNICODE_STRING RemainingPath,
POBJECT_TYPE ObjectType)
{ {
PVOID NextObject; PVOID NextObject;
PVOID CurrentObject; PVOID CurrentObject;
@ -163,7 +168,8 @@ NTSTATUS ObFindObject(POBJECT_ATTRIBUTES ObjectAttributes,
Status = CurrentHeader->ObjectType->Parse(CurrentObject, Status = CurrentHeader->ObjectType->Parse(CurrentObject,
&NextObject, &NextObject,
&PathString, &PathString,
&current); &current,
ObjectType);
if (Status == STATUS_REPARSE) if (Status == STATUS_REPARSE)
{ {
/* reparse the object path */ /* reparse the object path */
@ -228,7 +234,8 @@ PVOID STDCALL ObCreateObject(PHANDLE Handle,
{ {
ObFindObject(ObjectAttributes, ObFindObject(ObjectAttributes,
&Parent, &Parent,
&RemainingPath); &RemainingPath,
NULL);
} }
else else
{ {