mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 18:25:58 +00:00
Fixed bug that fails to update files entries in the root, and added some error checking
svn path=/trunk/; revision=1190
This commit is contained in:
parent
8eb69e31d4
commit
ea455bcfce
1 changed files with 23 additions and 5 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: dirwr.c,v 1.11 2000/03/13 17:58:06 ekohl Exp $
|
/* $Id: dirwr.c,v 1.12 2000/06/17 22:02:09 phreak Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -110,8 +110,16 @@ NTSTATUS updEntry(PDEVICE_EXTENSION DeviceExt,PFILE_OBJECT pFileObject)
|
||||||
for(NameLen=0;FileName[NameLen];NameLen++);
|
for(NameLen=0;FileName[NameLen];NameLen++);
|
||||||
|
|
||||||
// extract directory name from pathname
|
// extract directory name from pathname
|
||||||
memcpy(DirName,PathFileName,posCar*sizeof(WCHAR));
|
if( posCar == 0 )
|
||||||
DirName[posCar]=0;
|
{
|
||||||
|
// root dir
|
||||||
|
DirName[0] = L'\\';
|
||||||
|
DirName[1] = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
memcpy(DirName,PathFileName,posCar*sizeof(WCHAR));
|
||||||
|
DirName[posCar]=0;
|
||||||
|
}
|
||||||
if(FileName[0]==0 && DirName[0]==0)
|
if(FileName[0]==0 && DirName[0]==0)
|
||||||
return STATUS_SUCCESS;//root : nothing to do ?
|
return STATUS_SUCCESS;//root : nothing to do ?
|
||||||
memset(&FileObject,0,sizeof(FILE_OBJECT));
|
memset(&FileObject,0,sizeof(FILE_OBJECT));
|
||||||
|
@ -343,9 +351,18 @@ DPRINT("i=%d,j=%d,%d,%d\n",i,j,pEntry->Filename[i],FileName[i]);
|
||||||
{
|
{
|
||||||
status=FsdReadFile(DeviceExt,&FileObject,&FatEntry
|
status=FsdReadFile(DeviceExt,&FileObject,&FatEntry
|
||||||
,sizeof(FATDirEntry),i*sizeof(FATDirEntry),&LengthRead);
|
,sizeof(FATDirEntry),i*sizeof(FATDirEntry),&LengthRead);
|
||||||
if(IsLastEntry(&FatEntry,0))
|
if( status == STATUS_END_OF_FILE )
|
||||||
break;
|
break;
|
||||||
|
if( !NT_SUCCESS( status ) )
|
||||||
|
{
|
||||||
|
DPRINT1( "FsdReadFile failed to read the directory entry\n" );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if( LengthRead != sizeof( FATDirEntry ) )
|
||||||
|
{
|
||||||
|
DPRINT1( "FsdReadFile did not read a complete directory entry\n" );
|
||||||
|
break;
|
||||||
|
}
|
||||||
if(IsDeletedEntry(&FatEntry,0))
|
if(IsDeletedEntry(&FatEntry,0))
|
||||||
nbFree++;
|
nbFree++;
|
||||||
else
|
else
|
||||||
|
@ -377,6 +394,7 @@ DPRINT("i=%d,j=%d,%d,%d\n",i,j,pEntry->Filename[i],FileName[i]);
|
||||||
Offset=(i-nbSlots+1)*sizeof(FATDirEntry);
|
Offset=(i-nbSlots+1)*sizeof(FATDirEntry);
|
||||||
status=FsdWriteFile(DeviceExt,&FileObject,Buffer
|
status=FsdWriteFile(DeviceExt,&FileObject,Buffer
|
||||||
,sizeof(FATDirEntry)*nbSlots,Offset);
|
,sizeof(FATDirEntry)*nbSlots,Offset);
|
||||||
|
DPRINT( "FsdWriteFile() returned: %x\n", status );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{//write at end of directory
|
{//write at end of directory
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue