corrected bugs in create operations

svn path=/trunk/; revision=1449
This commit is contained in:
jean 2000-12-05 17:12:16 +00:00
parent 564101ab11
commit a7d8f1c9ab
2 changed files with 26 additions and 6 deletions

View file

@ -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

View file

@ -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;
/*