From 6c1fab522b0afd1549b0208f2a76004859145022 Mon Sep 17 00:00:00 2001 From: Aleksey Bragin Date: Mon, 28 Sep 2009 11:02:34 +0000 Subject: [PATCH] [fastfat_new] - Add an internal routine for opening root DCB (a stub for now). - Add code for checking if this is a relative or absolute open. Start implementing absolute opening part. svn path=/trunk/; revision=43203 --- .../drivers/filesystems/fastfat_new/create.c | 77 ++++++++++++++++++- .../filesystems/fastfat_new/fatstruc.h | 5 +- 2 files changed, 77 insertions(+), 5 deletions(-) diff --git a/reactos/drivers/filesystems/fastfat_new/create.c b/reactos/drivers/filesystems/fastfat_new/create.c index 88ccc9575b2..090e5eea7e8 100644 --- a/reactos/drivers/filesystems/fastfat_new/create.c +++ b/reactos/drivers/filesystems/fastfat_new/create.c @@ -13,6 +13,24 @@ /* FUNCTIONS *****************************************************************/ +IO_STATUS_BLOCK +NTAPI +FatiOpenRootDcb(IN PFAT_IRP_CONTEXT IrpContext, + IN PFILE_OBJECT FileObject, + IN PVCB Vcb, + IN PACCESS_MASK DesiredAccess, + IN USHORT ShareAccess, + IN ULONG CreateDisposition) +{ + IO_STATUS_BLOCK Iosb; + + DPRINT1("Opening root directory\n"); + + Iosb.Status = STATUS_NOT_IMPLEMENTED; + + return Iosb; +} + NTSTATUS NTAPI FatiCreate(IN PFAT_IRP_CONTEXT IrpContext, @@ -36,6 +54,7 @@ FatiCreate(IN PFAT_IRP_CONTEXT IrpContext, PVCB Vcb, DecodedVcb; PFCB Fcb; PCCB Ccb; + PFCB ParentDcb; /* IRP data */ PFILE_OBJECT FileObject; @@ -51,7 +70,7 @@ FatiCreate(IN PFAT_IRP_CONTEXT IrpContext, /* Misc */ NTSTATUS Status; - //IO_STATUS_BLOCK Iosb; + IO_STATUS_BLOCK Iosb; PIO_STACK_LOCATION IrpSp; /* Get current IRP stack location */ @@ -184,10 +203,10 @@ FatiCreate(IN PFAT_IRP_CONTEXT IrpContext, // TODO: Make sure EAs aren't supported on FAT32 + /* Check if it's a volume open request */ if (FileName.Length == 0) { - /* It is a volume open request, check related FO to be sure */ - + /* Test related FO to be sure */ if (!RelatedFO || FatDecodeFileObject(RelatedFO, &DecodedVcb, &Fcb, &Ccb) == UserVolumeOpen) { @@ -197,6 +216,58 @@ FatiCreate(IN PFAT_IRP_CONTEXT IrpContext, } } + /* Check if this is a relative open */ + if (RelatedFO) + { + // RelatedFO will be a parent directory + UNIMPLEMENTED; + } + else + { + /* Absolute open */ + if ((FileName.Length == sizeof(WCHAR)) && + (FileName.Buffer[0] == L'\\')) + { + /* Check if it's ok to open it */ + if (NonDirectoryFile) + { + DPRINT1("Trying to open root dir as a file\n"); + + /* Cleanup and return */ + FatReleaseVcb(IrpContext, Vcb); + return STATUS_FILE_IS_A_DIRECTORY; + } + + /* Check delete on close on a root dir */ + if (DeleteOnClose) + { + /* Cleanup and return */ + FatReleaseVcb(IrpContext, Vcb); + return STATUS_CANNOT_DELETE; + } + + /* Call root directory open routine */ + Iosb = FatiOpenRootDcb(IrpContext, + FileObject, + Vcb, + DesiredAccess, + ShareAccess, + CreateDisposition); + + Irp->IoStatus.Information = Iosb.Information; + + /* Cleanup and return */ + FatReleaseVcb(IrpContext, Vcb); + return Iosb.Status; + } + else + { + /* Not a root dir */ + ParentDcb = Vcb->RootDcb; + DPRINT1("ParentDcb %p\n", ParentDcb); + } + } + //return Iosb.Status; return STATUS_SUCCESS; } diff --git a/reactos/drivers/filesystems/fastfat_new/fatstruc.h b/reactos/drivers/filesystems/fastfat_new/fatstruc.h index d2b7412c49d..7b739c6a0ff 100644 --- a/reactos/drivers/filesystems/fastfat_new/fatstruc.h +++ b/reactos/drivers/filesystems/fastfat_new/fatstruc.h @@ -170,8 +170,9 @@ typedef struct _VCB ULONG RootDirentSectors; LONGLONG BeyondLastClusterInFat; FAT_METHODS Methods; - /* Root Directory Fcb: */ - struct _FCB *RootFcb; + + /* Root Directory Control block */ + struct _FCB *RootDcb; ULONG MediaChangeCount; } VCB, *PVCB;