Various fixes by Hartmut Birr.

svn path=/trunk/; revision=2072
This commit is contained in:
Eric Kohl 2001-07-18 12:04:52 +00:00
parent 1481663f41
commit e6063f185b

View file

@ -1,4 +1,4 @@
/* $Id: create.c,v 1.27 2001/07/05 01:51:52 rex Exp $
/* $Id: create.c,v 1.28 2001/07/18 12:04:52 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -110,6 +110,7 @@ GetEntryName (PVOID Block, PULONG _Offset, PWSTR Name, PULONG _jloop,
ULONG StartingSector = *_StartingSector;
ULONG jloop = *_jloop;
ULONG cpos;
PVOID OldBlock;
test = (FATDirEntry *) Block;
test2 = (slot *) Block;
@ -152,6 +153,42 @@ GetEntryName (PVOID Block, PULONG _Offset, PWSTR Name, PULONG _jloop,
}
// save values for returning
*_Offset = Offset;
*_jloop = jloop;
*_StartingSector = StartingSector;
if (Offset + 1 == ENTRIES_PER_SECTOR)
{
// save the old sector
OldBlock = ExAllocatePool (NonPagedPool, BLOCKSIZE);
memcpy (OldBlock, Block, BLOCKSIZE);
// read the next sector
Offset = 0;
/* FIXME: Check status */
GetNextSector (DeviceExt, StartingSector, &StartingSector, FALSE);
jloop++;
/* FIXME: Check status */
VfatReadSectors (DeviceExt->StorageDevice, StartingSector, 1, Block);
test2 = (slot *) Block;
if (IsDeletedEntry (Block, Offset))
{
ExFreePool (OldBlock);
*_Offset = Offset;
*_jloop = jloop;
*_StartingSector = StartingSector;
return FALSE;
}
// restore the old sector
memcpy (Block, OldBlock, BLOCKSIZE);
ExFreePool (OldBlock);
}
else
{
if (IsDeletedEntry (Block, Offset + 1))
{
Offset++;
@ -160,11 +197,7 @@ GetEntryName (PVOID Block, PULONG _Offset, PWSTR Name, PULONG _jloop,
*_StartingSector = StartingSector;
return (FALSE);
}
*_Offset = Offset;
*_jloop = jloop;
*_StartingSector = StartingSector;
}
return (TRUE);
}
@ -373,12 +406,18 @@ FindFile (PDEVICE_EXTENSION DeviceExt, PVFATFCB Fcb,
CHECKPOINT;
memcpy(Fcb->PathName, Parent->PathName, len*sizeof(WCHAR));
Fcb->ObjectName=&Fcb->PathName[len];
if (len != 1 || Fcb->PathName[0] != '\\')
{
Fcb->ObjectName[0] = '\\';
Fcb->ObjectName = &Fcb->ObjectName[1];
}
}
else
{
Fcb->ObjectName=Fcb->PathName;
Fcb->ObjectName[0]='\\';
Fcb->ObjectName=&Fcb->ObjectName[1];
}
memcpy (&Fcb->entry, &((FATDirEntry *) block)[i],
sizeof (FATDirEntry));
@ -400,7 +439,10 @@ FindFile (PDEVICE_EXTENSION DeviceExt, PVFATFCB Fcb,
GetNextSector was originally implemented to handle the case above */
if (Entry)
*Entry = 0;
StartingSector++;
/* FIXME: Check status */
GetNextSector (DeviceExt, StartingSector, &StartingSector, FALSE);
if ((Parent != NULL && Parent->entry.FirstCluster != 1)
|| DeviceExt->FatType == FAT32)
{