From a7d8f1c9ab665293f204b5e91e62eff16ba0408b Mon Sep 17 00:00:00 2001 From: jean Date: Tue, 5 Dec 2000 17:12:16 +0000 Subject: [PATCH] corrected bugs in create operations svn path=/trunk/; revision=1449 --- reactos/drivers/fs/vfat/create.c | 19 +++++++++++++++++-- reactos/drivers/fs/vfat/rw.c | 13 +++++++++---- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/reactos/drivers/fs/vfat/create.c b/reactos/drivers/fs/vfat/create.c index afd255f746a..fbd4a796575 100644 --- a/reactos/drivers/fs/vfat/create.c +++ b/reactos/drivers/fs/vfat/create.c @@ -1,4 +1,4 @@ -/* $Id: create.c,v 1.7 2000/09/12 10:12:13 jean Exp $ +/* $Id: create.c,v 1.8 2000/12/05 17:12:16 jean Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -448,6 +448,19 @@ DPRINT("FileName %S\n", FileName); next = &string[0]; CHECKPOINT; + if(*next==0) // root + { + memset(Fcb->entry.Filename,' ',11); + Fcb->entry.FileSize=DeviceExt->rootDirectorySectors*BLOCKSIZE; + Fcb->entry.Attrib=FILE_ATTRIBUTE_DIRECTORY; + if (DeviceExt->FatType == FAT32)Fcb->entry.FirstCluster=2; + else Fcb->entry.FirstCluster=1; + //FIXME : is 1 the good value for mark root? + ParentFcb=Fcb; + Fcb=NULL; + } + else + { while (TRUE) { CHECKPOINT; @@ -525,6 +538,7 @@ CHECKPOINT; Fcb = ParentFcb; CHECKPOINT; ParentFcb = Temp; + } CHECKPOINT; @@ -592,7 +606,8 @@ NTSTATUS FsdCreateFile (PDEVICE_OBJECT DeviceObject, PIRP Irp) { if(RequestedDisposition==FILE_CREATE ||RequestedDisposition==FILE_OPEN_IF - ||RequestedDisposition==FILE_OVERWRITE_IF) + ||RequestedDisposition==FILE_OVERWRITE_IF + ||RequestedDisposition==FILE_SUPERSEDE) { CHECKPOINT; Status=addEntry(DeviceExt,FileObject,RequestedOptions diff --git a/reactos/drivers/fs/vfat/rw.c b/reactos/drivers/fs/vfat/rw.c index 9bcaaadad67..8c893ddd8e7 100644 --- a/reactos/drivers/fs/vfat/rw.c +++ b/reactos/drivers/fs/vfat/rw.c @@ -1,4 +1,4 @@ -/* $Id: rw.c,v 1.10 2000/12/01 12:41:08 jean Exp $ +/* $Id: rw.c,v 1.11 2000/12/05 17:12:16 jean Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -55,14 +55,18 @@ NTSTATUS FsdReadFile(PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject, FirstCluster=CurrentCluster; DPRINT("DeviceExt->BytesPerCluster %x\n",DeviceExt->BytesPerCluster); - if (ReadOffset >= Fcb->entry.FileSize) + if ( !(Fcb->entry.Attrib & FILE_ATTRIBUTE_DIRECTORY)) + { + if (ReadOffset >= Fcb->entry.FileSize) { return(STATUS_END_OF_FILE); } - if ((ReadOffset + Length) > Fcb->entry.FileSize) + if ((ReadOffset + Length) > Fcb->entry.FileSize) { Length = Fcb->entry.FileSize - ReadOffset; } + } +CHECKPOINT; *LengthRead = 0; /* FIXME: optimize by remembering the last cluster read and using if possible */ Temp = ExAllocatePool(NonPagedPool,DeviceExt->BytesPerCluster); @@ -353,7 +357,8 @@ NTSTATUS FsdWriteFile(PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject, &Fcb->entry.UpdateTime); Fcb->entry.AccessDate = Fcb->entry.UpdateDate; - if (Fcb->entry.FileSize < WriteOffset+Length) + if (Fcb->entry.FileSize < WriteOffset+Length + && ! (Fcb->entry.Attrib & FILE_ATTRIBUTE_DIRECTORY)) { Fcb->entry.FileSize = WriteOffset+Length; /*