mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 01:24:38 +00:00
Removed debugging code from NTDLL loader
Make sure there is a space between the boot device and the kernel command line Vfat fixes svn path=/trunk/; revision=1502
This commit is contained in:
parent
1c655ae05a
commit
e371c33d76
11 changed files with 247 additions and 127 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $Id: create.c,v 1.12 2001/01/08 02:14:06 dwelch Exp $
|
||||
/* $Id: create.c,v 1.13 2001/01/12 21:00:08 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -148,6 +148,7 @@ ReadVolumeLabel (PDEVICE_EXTENSION DeviceExt, PVPB Vpb)
|
|||
char *block;
|
||||
ULONG StartingSector;
|
||||
ULONG NextCluster;
|
||||
NTSTATUS Status;
|
||||
|
||||
Size = DeviceExt->rootDirectorySectors; //FIXME : in fat32, no limit
|
||||
StartingSector = DeviceExt->rootStart;
|
||||
|
@ -191,7 +192,7 @@ ReadVolumeLabel (PDEVICE_EXTENSION DeviceExt, PVPB Vpb)
|
|||
{
|
||||
if (StartingSector == ClusterToSector (DeviceExt, NextCluster + 1))
|
||||
{
|
||||
NextCluster = GetNextCluster (DeviceExt, NextCluster);
|
||||
Status = GetNextCluster (DeviceExt, NextCluster, &NextCluster);
|
||||
if (NextCluster == 0 || NextCluster == 0xffffffff)
|
||||
{
|
||||
*(Vpb->VolumeLabel) = 0;
|
||||
|
@ -225,6 +226,7 @@ FindFile (PDEVICE_EXTENSION DeviceExt, PVFATFCB Fcb,
|
|||
ULONG StartingSector;
|
||||
ULONG NextCluster;
|
||||
WCHAR TempStr[2];
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT ("FindFile(Parent %x, FileToFind '%S')\n", Parent, FileToFind);
|
||||
|
||||
|
@ -352,7 +354,7 @@ FindFile (PDEVICE_EXTENSION DeviceExt, PVFATFCB Fcb,
|
|||
{
|
||||
if (StartingSector == ClusterToSector (DeviceExt, NextCluster + 1))
|
||||
{
|
||||
NextCluster = GetNextCluster (DeviceExt, NextCluster);
|
||||
Status = GetNextCluster (DeviceExt, NextCluster, &NextCluster);
|
||||
if (NextCluster == 0 || NextCluster == 0xffffffff)
|
||||
{
|
||||
if (StartSector)
|
||||
|
@ -638,7 +640,7 @@ VfatCreateFile (PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
|||
FileObject = Stack->FileObject;
|
||||
DeviceExt = DeviceObject->DeviceExtension;
|
||||
assert (DeviceExt);
|
||||
|
||||
|
||||
Status = FsdOpenFile (DeviceExt, FileObject, FileObject->FileName.Buffer);
|
||||
|
||||
CHECKPOINT;
|
||||
|
@ -700,8 +702,8 @@ VfatCreateFile (PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
|||
// updEntry (DeviceExt, FileObject);
|
||||
while (Cluster != 0xffffffff && Cluster > 1)
|
||||
{
|
||||
NextCluster = GetNextCluster (DeviceExt, Cluster);
|
||||
WriteCluster (DeviceExt, Cluster, 0);
|
||||
Status = GetNextCluster (DeviceExt, Cluster, &NextCluster);
|
||||
// WriteCluster (DeviceExt, Cluster, 0);
|
||||
Cluster = NextCluster;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Id: fat.c,v 1.10 2001/01/08 02:14:06 dwelch Exp $
|
||||
* $Id: fat.c,v 1.11 2001/01/12 21:00:08 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -21,8 +21,10 @@
|
|||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
ULONG
|
||||
Fat32GetNextCluster (PDEVICE_EXTENSION DeviceExt, ULONG CurrentCluster)
|
||||
NTSTATUS
|
||||
Fat32GetNextCluster (PDEVICE_EXTENSION DeviceExt,
|
||||
ULONG CurrentCluster,
|
||||
PULONG NextCluster)
|
||||
/*
|
||||
* FUNCTION: Retrieve the next FAT32 cluster from the FAT table via a physical
|
||||
* disk read
|
||||
|
@ -31,29 +33,35 @@ Fat32GetNextCluster (PDEVICE_EXTENSION DeviceExt, ULONG CurrentCluster)
|
|||
ULONG FATsector;
|
||||
ULONG FATeis;
|
||||
PULONG Block;
|
||||
NTSTATUS Status;
|
||||
|
||||
Block = ExAllocatePool (NonPagedPool, 1024);
|
||||
FATsector = CurrentCluster / (512 / sizeof (ULONG));
|
||||
FATeis = CurrentCluster - (FATsector * (512 / sizeof (ULONG)));
|
||||
/* FIXME: Check status */
|
||||
VfatReadSectors (DeviceExt->StorageDevice,
|
||||
(ULONG) (DeviceExt->FATStart + FATsector), 1,
|
||||
(UCHAR *) Block);
|
||||
Status = VfatReadSectors (DeviceExt->StorageDevice,
|
||||
(ULONG) (DeviceExt->FATStart + FATsector), 1,
|
||||
(UCHAR *) Block);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return(Status);
|
||||
}
|
||||
CurrentCluster = Block[FATeis];
|
||||
if (CurrentCluster >= 0xffffff8 && CurrentCluster <= 0xfffffff)
|
||||
CurrentCluster = 0xffffffff;
|
||||
ExFreePool (Block);
|
||||
return (CurrentCluster);
|
||||
*NextCluster = CurrentCluster;
|
||||
return (STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
ULONG
|
||||
Fat16GetNextCluster (PDEVICE_EXTENSION DeviceExt, ULONG CurrentCluster)
|
||||
NTSTATUS
|
||||
Fat16GetNextCluster (PDEVICE_EXTENSION DeviceExt,
|
||||
ULONG CurrentCluster,
|
||||
PULONG NextCluster)
|
||||
/*
|
||||
* FUNCTION: Retrieve the next FAT16 cluster from the FAT table from the
|
||||
* in-memory FAT
|
||||
*/
|
||||
{
|
||||
PUSHORT Block;
|
||||
PVOID BaseAddress;
|
||||
BOOLEAN Valid;
|
||||
PCACHE_SEGMENT CacheSeg;
|
||||
|
@ -67,6 +75,10 @@ Fat16GetNextCluster (PDEVICE_EXTENSION DeviceExt, ULONG CurrentCluster)
|
|||
&BaseAddress,
|
||||
&Valid,
|
||||
&CacheSeg);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return(Status);
|
||||
}
|
||||
if (!Valid)
|
||||
{
|
||||
Status = VfatReadSectors(DeviceExt->StorageDevice,
|
||||
|
@ -76,28 +88,28 @@ Fat16GetNextCluster (PDEVICE_EXTENSION DeviceExt, ULONG CurrentCluster)
|
|||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
CcReleaseCacheSegment(DeviceExt->StorageBcb, CacheSeg, FALSE);
|
||||
return(0xFFFFFFFF);
|
||||
return(Status);
|
||||
}
|
||||
}
|
||||
|
||||
CurrentCluster = *((PUSHORT)(BaseAddress + (FATOffset % PAGESIZE)));
|
||||
if (CurrentCluster >= 0xfff8 && CurrentCluster <= 0xffff)
|
||||
CurrentCluster = 0xffffffff;
|
||||
CurrentCluster = 0xffffffff;
|
||||
CcReleaseCacheSegment(DeviceExt->StorageBcb, CacheSeg, TRUE);
|
||||
return (CurrentCluster);
|
||||
*NextCluster = CurrentCluster;
|
||||
return (STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
ULONG
|
||||
Fat12GetNextCluster (PDEVICE_EXTENSION DeviceExt, ULONG CurrentCluster)
|
||||
NTSTATUS
|
||||
Fat12GetNextCluster (PDEVICE_EXTENSION DeviceExt,
|
||||
ULONG CurrentCluster,
|
||||
PULONG NextCluster)
|
||||
/*
|
||||
* FUNCTION: Retrieve the next FAT12 cluster from the FAT table from the
|
||||
* in-memory FAT
|
||||
* FUNCTION: Retrieve the next FAT12 cluster from the FAT table
|
||||
*/
|
||||
{
|
||||
unsigned char *CBlock;
|
||||
ULONG FATOffset;
|
||||
ULONG Entry;
|
||||
PVOID PBlock;
|
||||
NTSTATUS Status;
|
||||
PVOID BaseAddress;
|
||||
BOOLEAN Valid;
|
||||
|
@ -114,6 +126,10 @@ Fat12GetNextCluster (PDEVICE_EXTENSION DeviceExt, ULONG CurrentCluster)
|
|||
&BaseAddress,
|
||||
&Valid,
|
||||
&CacheSeg);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return(Status);
|
||||
}
|
||||
if (!Valid)
|
||||
{
|
||||
Status = VfatReadSectors(DeviceExt->StorageDevice,
|
||||
|
@ -123,7 +139,7 @@ Fat12GetNextCluster (PDEVICE_EXTENSION DeviceExt, ULONG CurrentCluster)
|
|||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
CcReleaseCacheSegment(DeviceExt->StorageBcb, CacheSeg, FALSE);
|
||||
return(0xFFFFFFFF);
|
||||
return(Status);
|
||||
}
|
||||
}
|
||||
Value1 = ((PUCHAR)BaseAddress)[FATOffset % PAGESIZE];
|
||||
|
@ -139,6 +155,10 @@ Fat12GetNextCluster (PDEVICE_EXTENSION DeviceExt, ULONG CurrentCluster)
|
|||
&BaseAddress,
|
||||
&Valid,
|
||||
&CacheSeg);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return(Status);
|
||||
}
|
||||
if (!Valid)
|
||||
{
|
||||
ULONG NextOffset;
|
||||
|
@ -152,7 +172,7 @@ Fat12GetNextCluster (PDEVICE_EXTENSION DeviceExt, ULONG CurrentCluster)
|
|||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
CcReleaseCacheSegment(DeviceExt->StorageBcb, CacheSeg, FALSE);
|
||||
return(0xFFFFFFFF);
|
||||
return(Status);
|
||||
}
|
||||
}
|
||||
Value2 = ((PUCHAR)BaseAddress)[0];
|
||||
|
@ -178,16 +198,19 @@ Fat12GetNextCluster (PDEVICE_EXTENSION DeviceExt, ULONG CurrentCluster)
|
|||
if (Entry >= 0xff8 && Entry <= 0xfff)
|
||||
Entry = 0xffffffff;
|
||||
DPRINT ("Returning %x\n", Entry);
|
||||
return (Entry);
|
||||
*NextCluster = Entry;
|
||||
return (STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
ULONG
|
||||
GetNextCluster (PDEVICE_EXTENSION DeviceExt, ULONG CurrentCluster)
|
||||
NTSTATUS
|
||||
GetNextCluster (PDEVICE_EXTENSION DeviceExt,
|
||||
ULONG CurrentCluster,
|
||||
PULONG NextCluster)
|
||||
/*
|
||||
* FUNCTION: Retrieve the next cluster depending on the FAT type
|
||||
*/
|
||||
{
|
||||
ULONG NextCluster;
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT ("GetNextCluster(DeviceExt %x, CurrentCluster %x)\n",
|
||||
DeviceExt, CurrentCluster);
|
||||
|
@ -196,22 +219,56 @@ GetNextCluster (PDEVICE_EXTENSION DeviceExt, ULONG CurrentCluster)
|
|||
|
||||
if (DeviceExt->FatType == FAT16)
|
||||
{
|
||||
NextCluster = Fat16GetNextCluster (DeviceExt, CurrentCluster);
|
||||
Status = Fat16GetNextCluster (DeviceExt, CurrentCluster, NextCluster);
|
||||
}
|
||||
else if (DeviceExt->FatType == FAT32)
|
||||
{
|
||||
NextCluster = Fat32GetNextCluster (DeviceExt, CurrentCluster);
|
||||
Status = Fat32GetNextCluster (DeviceExt, CurrentCluster, NextCluster);
|
||||
}
|
||||
else
|
||||
{
|
||||
NextCluster = Fat12GetNextCluster (DeviceExt, CurrentCluster);
|
||||
Status = Fat12GetNextCluster (DeviceExt, CurrentCluster, NextCluster);
|
||||
}
|
||||
|
||||
ExReleaseResourceLite (&DeviceExt->FatResource);
|
||||
|
||||
return (NextCluster);
|
||||
return (Status);
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
VfatRequestDiskPage(PDEVICE_EXTENSION DeviceExt,
|
||||
ULONG Offset,
|
||||
PVOID* BaseAddress,
|
||||
PCACHE_SEGMENT* CacheSeg)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
BOOLEAN Valid;
|
||||
|
||||
Status = CcRequestCacheSegment(DeviceExt->StorageBcb,
|
||||
Offset,
|
||||
BaseAddress,
|
||||
&Valid,
|
||||
CacheSeg);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return(Status);
|
||||
}
|
||||
if (!Valid)
|
||||
{
|
||||
Status = VfatReadSectors(DeviceExt->StorageDevice,
|
||||
Offset,
|
||||
PAGESIZE / BLOCKSIZE,
|
||||
*BaseAddress);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
CcReleaseCacheSegment(DeviceExt->StorageBcb, *CacheSeg, FALSE);
|
||||
return(Status);
|
||||
}
|
||||
}
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
#if 0
|
||||
ULONG
|
||||
FAT16FindAvailableCluster (PDEVICE_EXTENSION DeviceExt)
|
||||
/*
|
||||
|
@ -219,13 +276,67 @@ FAT16FindAvailableCluster (PDEVICE_EXTENSION DeviceExt)
|
|||
*/
|
||||
{
|
||||
PUSHORT Block;
|
||||
int i;
|
||||
Block = (PUSHORT) DeviceExt->FAT;
|
||||
for (i = 2; i < (DeviceExt->Boot->FATSectors * 256); i++)
|
||||
if (Block[i] == 0)
|
||||
return (i);
|
||||
/* Give an error message (out of disk space) if we reach here) */
|
||||
return 0;
|
||||
ULONG i;
|
||||
PCACHE_SEG CacheSeg;
|
||||
PVOID BaseAddress;
|
||||
BOOLEAN Valid;
|
||||
ULONG StartOffset;
|
||||
ULONG FatLength;
|
||||
ULONG j;
|
||||
ULONG RCluster;
|
||||
ULONG Length;
|
||||
|
||||
StartOffset = DeviceExt->Boot->FatStart * BLOCKSIZE;
|
||||
FatLength = DevceExt->Boot->FatSectors * BLOCKSIZE;
|
||||
|
||||
if (StartOffset % PAGESIZE) != 0)
|
||||
{
|
||||
Status = VfatRequestDiskPage(DeviceExt,
|
||||
PAGE_ROUND_DOWN(StartOffset),
|
||||
&BaseAddress,
|
||||
&CacheSeg);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
Length = max(PAGESIZE, FatLength);
|
||||
for (j = (StartOffset % PAGESIZE); j < Length; j+=2)
|
||||
{
|
||||
if ((*((PUSHORT)(BaseAddress + j))) == 0)
|
||||
{
|
||||
CcReleaseCacheSegment(DeviceExt->StorageBcb, CacheSeg, FALSE);
|
||||
return(j);
|
||||
}
|
||||
}
|
||||
CcReleaseCacheSegment(DeviceExt->StorageBcb, CacheSeg, FALSE);
|
||||
StartOffset = StartOffset + (Length - (StartOffset % PAGESIZE));
|
||||
FatLength = FatLength - (Length - (StartOffset % PAGESIZE));
|
||||
}
|
||||
for (i = 0; i < (FatLength / PAGESIZE); i++)
|
||||
{
|
||||
Status = VfatRequestDiskPage(DeviceExt,
|
||||
PAGE_ROUND_DOWN(StartOffset),
|
||||
&BaseAddress,
|
||||
&CacheSeg);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
for (j = 0; j < PAGESIZE; j+=2)
|
||||
{
|
||||
if (*((PUSHORT)(BaseAddress + j)) == 0)
|
||||
{
|
||||
CcReleaseCacheSegment(DeviceExt->StorageBcb,
|
||||
CacheSeg,
|
||||
TRUE);
|
||||
RCluster =
|
||||
(StartOffset + j) - (DeviceExt->Boot->FatStart * BLOCKSIZE);
|
||||
RCluster = RCluster / 2;
|
||||
return(RCluster);
|
||||
}
|
||||
}
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
ULONG
|
||||
|
@ -576,6 +687,7 @@ GetNextWriteCluster (PDEVICE_EXTENSION DeviceExt, ULONG CurrentCluster)
|
|||
return LastCluster;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
ULONG
|
||||
ClusterToSector (PDEVICE_EXTENSION DeviceExt, unsigned long Cluster)
|
||||
|
@ -607,6 +719,7 @@ VFATLoadCluster (PDEVICE_EXTENSION DeviceExt, PVOID Buffer, ULONG Cluster)
|
|||
DPRINT ("Finished VFATReadSectors\n");
|
||||
}
|
||||
|
||||
#if 0
|
||||
VOID
|
||||
VFATWriteCluster (PDEVICE_EXTENSION DeviceExt, PVOID Buffer, ULONG Cluster)
|
||||
/*
|
||||
|
@ -623,3 +736,4 @@ VFATWriteCluster (PDEVICE_EXTENSION DeviceExt, PVOID Buffer, ULONG Cluster)
|
|||
VfatWriteSectors (DeviceExt->StorageDevice,
|
||||
Sector, DeviceExt->Boot->SectorsPerCluster, Buffer);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: iface.c,v 1.47 2001/01/08 02:14:06 dwelch Exp $
|
||||
/* $Id: iface.c,v 1.48 2001/01/12 21:00:08 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -128,17 +128,6 @@ VfatMountDevice (PDEVICE_EXTENSION DeviceExt, PDEVICE_OBJECT DeviceToMount)
|
|||
DeviceExt->FatType = FAT16;
|
||||
}
|
||||
|
||||
// with FAT32 it's not a good idea to load always fat in memory
|
||||
// because on a 8GB partition with 2 KO clusters, the fat = 8 MO
|
||||
if (DeviceExt->FatType != FAT32)
|
||||
{
|
||||
DeviceExt->FAT =
|
||||
ExAllocatePool (NonPagedPool,
|
||||
BLOCKSIZE * DeviceExt->Boot->FATSectors);
|
||||
/* FIXME: Check status */
|
||||
VfatReadSectors (DeviceToMount, DeviceExt->FATStart,
|
||||
DeviceExt->Boot->FATSectors, (UCHAR *) DeviceExt->FAT);
|
||||
}
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $Id: makefile,v 1.25 2001/01/01 04:42:12 dwelch Exp $
|
||||
# $Id: makefile,v 1.26 2001/01/12 21:00:08 dwelch Exp $
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../../..
|
||||
|
@ -9,7 +9,7 @@ OBJECTS = blockdev.o close.o create.o dir.o dirwr.o iface.o string.o fat.o \
|
|||
rw.o finfo.o volume.o shutdown.o $(TARGET).coff
|
||||
LIBS = ../../../ntoskrnl/ntoskrnl.a
|
||||
|
||||
CFLAGS = -g
|
||||
CFLAGS = -g -Wall -Werror
|
||||
|
||||
all: $(TARGET).nostrip.sys $(TARGET).sys
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/* $Id: rw.c,v 1.14 2001/01/08 02:14:06 dwelch Exp $
|
||||
|
||||
/* $Id: rw.c,v 1.15 2001/01/12 21:00:08 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -26,50 +27,56 @@
|
|||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
VOID
|
||||
NTSTATUS
|
||||
NextCluster(PDEVICE_EXTENSION DeviceExt,
|
||||
ULONG FirstCluster,
|
||||
PULONG CurrentCluster)
|
||||
{
|
||||
DPRINT("NextCluster() (*CurrentCluster) 0x%x\n", (*CurrentCluster));
|
||||
if (FirstCluster == 1)
|
||||
{
|
||||
(*CurrentCluster) += DeviceExt->Boot->SectorsPerCluster;
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
else
|
||||
{
|
||||
(*CurrentCluster) = GetNextCluster(DeviceExt, (*CurrentCluster));
|
||||
NTSTATUS Status;
|
||||
|
||||
Status = GetNextCluster(DeviceExt, (*CurrentCluster), CurrentCluster);
|
||||
return(Status);
|
||||
}
|
||||
DPRINT("NextCluster() finished (*CurrentCluster) 0x%x\n",
|
||||
(*CurrentCluster));
|
||||
}
|
||||
|
||||
ULONG
|
||||
NTSTATUS
|
||||
OffsetToCluster(PDEVICE_EXTENSION DeviceExt,
|
||||
ULONG FirstCluster,
|
||||
ULONG FileOffset)
|
||||
ULONG FileOffset,
|
||||
PULONG Cluster)
|
||||
{
|
||||
ULONG CurrentCluster;
|
||||
ULONG i;
|
||||
|
||||
DPRINT("OffsetToCluster(FirstCluster 0x%x)\n", FirstCluster);
|
||||
NTSTATUS Status;
|
||||
|
||||
CurrentCluster = FirstCluster;
|
||||
if (FirstCluster == 1)
|
||||
{
|
||||
/* root of FAT16 or FAT12 */
|
||||
CurrentCluster = DeviceExt->rootStart + FileOffset
|
||||
*Cluster = DeviceExt->rootStart + FileOffset
|
||||
/ (DeviceExt->BytesPerCluster) * DeviceExt->Boot->SectorsPerCluster;
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
else
|
||||
{
|
||||
CurrentCluster = FirstCluster;
|
||||
for (i = 0; i < FileOffset / DeviceExt->BytesPerCluster; i++)
|
||||
{
|
||||
CurrentCluster = GetNextCluster (DeviceExt, CurrentCluster);
|
||||
Status = GetNextCluster (DeviceExt, CurrentCluster, &CurrentCluster);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return(Status);
|
||||
}
|
||||
}
|
||||
*Cluster = CurrentCluster;
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
DPRINT("OffsetToCluster() = 0x%x\n", CurrentCluster);
|
||||
return(CurrentCluster);
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
|
@ -86,6 +93,7 @@ VfatReadFileNoCache (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
|
|||
PVFATFCB Fcb;
|
||||
PVOID Temp;
|
||||
ULONG TempLength;
|
||||
NTSTATUS Status;
|
||||
|
||||
/* PRECONDITION */
|
||||
assert (DeviceExt != NULL);
|
||||
|
@ -149,7 +157,8 @@ VfatReadFileNoCache (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
|
|||
for (FileOffset = 0; FileOffset < ReadOffset / DeviceExt->BytesPerCluster;
|
||||
FileOffset++)
|
||||
{
|
||||
CurrentCluster = GetNextCluster (DeviceExt, CurrentCluster);
|
||||
Status = GetNextCluster (DeviceExt, CurrentCluster, &CurrentCluster);
|
||||
return(Status);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -169,7 +178,7 @@ VfatReadFileNoCache (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
|
|||
else
|
||||
{
|
||||
VFATLoadCluster (DeviceExt, Temp, CurrentCluster);
|
||||
CurrentCluster = GetNextCluster (DeviceExt, CurrentCluster);
|
||||
Status = GetNextCluster (DeviceExt, CurrentCluster, &CurrentCluster);
|
||||
}
|
||||
TempLength = min (Length, DeviceExt->BytesPerCluster -
|
||||
(ReadOffset % DeviceExt->BytesPerCluster));
|
||||
|
@ -195,7 +204,7 @@ VfatReadFileNoCache (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
|
|||
else
|
||||
{
|
||||
VFATLoadCluster (DeviceExt, Buffer, CurrentCluster);
|
||||
CurrentCluster = GetNextCluster (DeviceExt, CurrentCluster);
|
||||
Status = GetNextCluster (DeviceExt, CurrentCluster, &CurrentCluster);
|
||||
}
|
||||
if (CurrentCluster == 0xffffffff)
|
||||
{
|
||||
|
@ -222,7 +231,7 @@ VfatReadFileNoCache (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
|
|||
else
|
||||
{
|
||||
VFATLoadCluster (DeviceExt, Temp, CurrentCluster);
|
||||
CurrentCluster = GetNextCluster (DeviceExt, CurrentCluster);
|
||||
Status = GetNextCluster (DeviceExt, CurrentCluster, &CurrentCluster);
|
||||
}
|
||||
memcpy (Buffer, Temp, Length);
|
||||
}
|
||||
|
@ -236,24 +245,22 @@ VfatRawReadCluster (PDEVICE_EXTENSION DeviceExt,
|
|||
PULONG CurrentCluster,
|
||||
PVOID Destination)
|
||||
{
|
||||
DPRINT("VfatRawReadCluster() *CurrentCluster 0x%x\n", *CurrentCluster);
|
||||
NTSTATUS Status;
|
||||
|
||||
if (FirstCluster == 1)
|
||||
{
|
||||
/* FIXME: Check status */
|
||||
VfatReadSectors (DeviceExt->StorageDevice,
|
||||
(*CurrentCluster),
|
||||
DeviceExt->Boot->SectorsPerCluster,
|
||||
Destination);
|
||||
(*CurrentCluster) += DeviceExt->Boot->SectorsPerCluster;
|
||||
Status = VfatReadSectors (DeviceExt->StorageDevice,
|
||||
(*CurrentCluster),
|
||||
DeviceExt->Boot->SectorsPerCluster,
|
||||
Destination);
|
||||
return(Status);
|
||||
}
|
||||
else
|
||||
{
|
||||
VFATLoadCluster (DeviceExt, Destination, (*CurrentCluster));
|
||||
(*CurrentCluster) = GetNextCluster (DeviceExt, (*CurrentCluster));
|
||||
Status = STATUS_SUCCESS;
|
||||
return(Status);
|
||||
}
|
||||
DPRINT("VfatRawReadCluster() finished *CurrentCluster 0x%x\n",
|
||||
*CurrentCluster);
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
|
@ -300,25 +307,17 @@ VfatReadCluster(PDEVICE_EXTENSION DeviceExt,
|
|||
return(Status);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Otherwise go on to the next cluster
|
||||
*/
|
||||
if (FirstCluster == 1)
|
||||
{
|
||||
(*CurrentCluster) += DeviceExt->Boot->SectorsPerCluster;
|
||||
}
|
||||
else
|
||||
{
|
||||
(*CurrentCluster) = GetNextCluster(DeviceExt, (*CurrentCluster));
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copy the data from the cache to the caller
|
||||
*/
|
||||
memcpy(Destination, BaseAddress, BytesPerCluster);
|
||||
CcReleaseCacheSegment(Fcb->RFCB.Bcb, CacheSeg, TRUE);
|
||||
|
||||
Status = NextCluster(DeviceExt, FirstCluster, CurrentCluster);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return(Status);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -358,7 +357,8 @@ VfatReadCluster(PDEVICE_EXTENSION DeviceExt,
|
|||
CcReleaseCacheSegment(Fcb->RFCB.Bcb, CacheSeg, FALSE);
|
||||
return(Status);
|
||||
}
|
||||
if (CurrentCluster == 0xFFFFFFFF)
|
||||
Status = NextCluster(DeviceExt, FirstCluster, CurrentCluster);
|
||||
if ((*CurrentCluster) == 0xFFFFFFFF)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -372,7 +372,7 @@ VfatReadCluster(PDEVICE_EXTENSION DeviceExt,
|
|||
for (i = 0; i < (PAGESIZE / DeviceExt->BytesPerCluster); i++)
|
||||
{
|
||||
NextCluster(DeviceExt, FirstCluster, CurrentCluster);
|
||||
if (CurrentCluster == 0xFFFFFFFF)
|
||||
if ((*CurrentCluster) == 0xFFFFFFFF)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -396,12 +396,12 @@ VfatReadFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
|
|||
*/
|
||||
{
|
||||
ULONG CurrentCluster;
|
||||
ULONG FileOffset;
|
||||
ULONG FirstCluster;
|
||||
PVFATFCB Fcb;
|
||||
PVOID Temp;
|
||||
ULONG TempLength;
|
||||
ULONG ChunkSize;
|
||||
NTSTATUS Status;
|
||||
|
||||
/* PRECONDITION */
|
||||
assert (DeviceExt != NULL);
|
||||
|
@ -450,14 +450,21 @@ VfatReadFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
|
|||
*/
|
||||
Temp = ExAllocatePool (NonPagedPool, ChunkSize);
|
||||
if (!Temp)
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
{
|
||||
return(STATUS_NO_MEMORY);
|
||||
}
|
||||
|
||||
/*
|
||||
* Find the cluster to start the read from
|
||||
* FIXME: Optimize by remembering the last cluster read and using if
|
||||
* possible.
|
||||
*/
|
||||
CurrentCluster = OffsetToCluster(DeviceExt, FirstCluster, ReadOffset);
|
||||
Status = OffsetToCluster(DeviceExt, FirstCluster, ReadOffset,
|
||||
&CurrentCluster);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return(Status);
|
||||
}
|
||||
|
||||
/*
|
||||
* If the read doesn't begin on a cluster boundary then read a full
|
||||
|
@ -727,8 +734,8 @@ VfatWrite (PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
|||
PVOID Buffer;
|
||||
ULONG Offset;
|
||||
PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation (Irp);
|
||||
PFILE_OBJECT FileObject = Stack->FileObject;
|
||||
PDEVICE_EXTENSION DeviceExt = DeviceObject->DeviceExtension;
|
||||
/* PFILE_OBJECT FileObject = Stack->FileObject; */
|
||||
/* PDEVICE_EXTENSION DeviceExt = DeviceObject->DeviceExtension; */
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT ("VfatWrite(DeviceObject %x Irp %x)\n", DeviceObject, Irp);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: shutdown.c,v 1.1 2000/12/29 13:45:01 ekohl Exp $
|
||||
/* $Id: shutdown.c,v 1.2 2001/01/12 21:00:08 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -21,9 +21,6 @@
|
|||
NTSTATUS STDCALL
|
||||
VfatShutdown(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
||||
{
|
||||
PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
PFILE_OBJECT FileObject = Stack->FileObject;
|
||||
PDEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT("VfatShutdown(DeviceObject %x, Irp %x)\n",DeviceObject, Irp);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: vfat.h,v 1.20 2001/01/08 02:14:06 dwelch Exp $ */
|
||||
/* $Id: vfat.h,v 1.21 2001/01/12 21:00:08 dwelch Exp $ */
|
||||
|
||||
#include <ddk/ntifs.h>
|
||||
|
||||
|
@ -88,7 +88,6 @@ typedef struct
|
|||
int FATEntriesPerSector, FATUnit;
|
||||
ULONG BytesPerCluster;
|
||||
ULONG FatType;
|
||||
unsigned char* FAT;
|
||||
} DEVICE_EXTENSION, *PDEVICE_EXTENSION;
|
||||
|
||||
typedef struct _VFATFCB
|
||||
|
@ -233,8 +232,10 @@ wstrcmpjoki(PWSTR s1, PWSTR s2);
|
|||
*/
|
||||
ULONG
|
||||
ClusterToSector(PDEVICE_EXTENSION DeviceExt, ULONG Cluster);
|
||||
ULONG
|
||||
GetNextCluster(PDEVICE_EXTENSION DeviceExt, ULONG CurrentCluster);
|
||||
NTSTATUS
|
||||
GetNextCluster(PDEVICE_EXTENSION DeviceExt,
|
||||
ULONG CurrentCluster,
|
||||
PULONG NextCluster);
|
||||
VOID
|
||||
VFATLoadCluster(PDEVICE_EXTENSION DeviceExt, PVOID Buffer, ULONG Cluster);
|
||||
ULONG
|
||||
|
@ -243,6 +244,9 @@ ULONG
|
|||
FAT16CountAvailableClusters(PDEVICE_EXTENSION DeviceExt);
|
||||
ULONG
|
||||
FAT32CountAvailableClusters(PDEVICE_EXTENSION DeviceExt);
|
||||
VOID
|
||||
WriteCluster (PDEVICE_EXTENSION DeviceExt, ULONG ClusterToWrite,
|
||||
ULONG NewValue);
|
||||
|
||||
/*
|
||||
* functions from volume.c
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: volume.c,v 1.5 2000/12/29 23:17:12 dwelch Exp $
|
||||
/* $Id: volume.c,v 1.6 2001/01/12 21:00:08 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -88,8 +88,8 @@ FsdGetFsSizeInformation (PDEVICE_OBJECT DeviceObject,
|
|||
else
|
||||
FsSizeInfo->TotalAllocationUnits.QuadPart = BootSect->SectorsHuge;
|
||||
|
||||
FsSizeInfo->AvailableAllocationUnits.QuadPart =
|
||||
FAT32CountAvailableClusters (DeviceExt);
|
||||
/* FsSizeInfo->AvailableAllocationUnits.QuadPart =
|
||||
FAT32CountAvailableClusters (DeviceExt); */
|
||||
|
||||
FsSizeInfo->SectorsPerAllocationUnit = BootSect->SectorsPerCluster;
|
||||
FsSizeInfo->BytesPerSector = BootSect->BytesPerSector;
|
||||
|
@ -102,14 +102,14 @@ FsdGetFsSizeInformation (PDEVICE_OBJECT DeviceObject,
|
|||
FsSizeInfo->TotalAllocationUnits.QuadPart = BootSect->Sectors;
|
||||
else
|
||||
FsSizeInfo->TotalAllocationUnits.QuadPart = BootSect->SectorsHuge;
|
||||
|
||||
/*
|
||||
if (DeviceExt->FatType == FAT16)
|
||||
FsSizeInfo->AvailableAllocationUnits.QuadPart =
|
||||
FAT16CountAvailableClusters (DeviceExt);
|
||||
else
|
||||
FsSizeInfo->AvailableAllocationUnits.QuadPart =
|
||||
FAT12CountAvailableClusters (DeviceExt);
|
||||
|
||||
*/
|
||||
FsSizeInfo->SectorsPerAllocationUnit = BootSect->SectorsPerCluster;
|
||||
FsSizeInfo->BytesPerSector = BootSect->BytesPerSector;
|
||||
}
|
||||
|
|
|
@ -71,6 +71,15 @@ typedef struct
|
|||
PSECTION_PAGE_TABLE PageTables[NR_SECTION_PAGE_TABLES];
|
||||
} SECTION_PAGE_DIRECTORY, *PSECTION_PAGE_DIRECTORY;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ULONG FileOffset;
|
||||
ULONG Protection;
|
||||
ULONG Attributes;
|
||||
SECTION_PAGE_DIRECTORY PageDirectory;
|
||||
KMUTEX Lock;
|
||||
} MM_SECTION_SEGMENT;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
CSHORT Type;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: main.c,v 1.71 2001/01/06 21:40:13 rex Exp $
|
||||
/* $Id: main.c,v 1.72 2001/01/12 21:00:07 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -443,11 +443,12 @@ _main (ULONG MultiBootMagic, PLOADER_PARAMETER_BLOCK _LoaderBlock)
|
|||
sizeof(LOADER_MODULE) * KeLoaderBlock.ModsCount);
|
||||
KeLoaderBlock.ModsAddr = (ULONG)&KeLoaderModules;
|
||||
|
||||
/*FIXME: Preliminary hack!!!! Add boot device to beginning of command line.
|
||||
/*
|
||||
* FIXME: Preliminary hack!!!! Add boot device to beginning of command line.
|
||||
* This should be done by the boot loader.
|
||||
*/
|
||||
strcpy (KeLoaderCommandLine,
|
||||
"multi(0)disk(0)rdisk(0)partition(1)\\reactos");
|
||||
"multi(0)disk(0)rdisk(0)partition(1)\\reactos ");
|
||||
strcat (KeLoaderCommandLine, (PUCHAR)KeLoaderBlock.CommandLine);
|
||||
|
||||
KeLoaderBlock.CommandLine = (ULONG)KeLoaderCommandLine;
|
||||
|
|
|
@ -235,7 +235,6 @@ NTSTATUS LdrpMapSystemDll(HANDLE ProcessHandle,
|
|||
*/
|
||||
RtlInitAnsiString (&ProcedureName,
|
||||
"LdrInitializeThunk");
|
||||
DPRINT1("Getting address of system DLL entrypoint\n");
|
||||
Status = LdrGetProcedureAddress ((PVOID)ImageBase,
|
||||
&ProcedureName,
|
||||
0,
|
||||
|
@ -248,8 +247,6 @@ NTSTATUS LdrpMapSystemDll(HANDLE ProcessHandle,
|
|||
ZwClose(NTDllSectionHandle);
|
||||
return (Status);
|
||||
}
|
||||
DPRINT1("SystemDllEntryPoint 0x%08lx\n",
|
||||
SystemDllEntryPoint);
|
||||
*LdrStartupAddr = SystemDllEntryPoint;
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue