# objdir
#NET_APPS = ping roshttpd
-NET_APPS = ping roshttpd
+NET_APPS = ping
KERNEL_SERVICES = $(DEVICE_DRIVERS) $(INPUT_DRIVERS) $(FS_DRIVERS) $(NET_DRIVERS) $(NET_DEVICE_DRIVERS)
Prev = prev;
}
-PVOID CListNode::operator new(/*size_t*/ UINT size)
+void* CListNode::operator new(/*size_t*/ UINT size)
{
PVOID p;
if (hHeap == NULL) {
return p;
}
-VOID CListNode::operator delete(PVOID p)
+VOID CListNode::operator delete(void* p)
{
if (HeapFree(hHeap, 0, p) != FALSE)
nRef--;
CHAR str[255];
CHAR str2[32];
union BigNum {
- unsigned __int64 Big;
+ // unsigned __int64 Big;
+ unsigned long long Big;
struct {
DWORD Low;
DWORD High;
- };
+ } u;
} nTotalBytes;
DWORD nBytesToRead;
DWORD nBytesRead;
return;
}
// Get file size
- nTotalBytes.Low = GetFileSize(hFile, &nTotalBytes.High);
- if ((nTotalBytes.Low == 0xFFFFFFFF) && ((GetLastError()) != NO_ERROR)) {
+ nTotalBytes.u.Low = GetFileSize(hFile, &nTotalBytes.u.High);
+ if ((nTotalBytes.u.Low == 0xFFFFFFFF) && ((GetLastError()) != NO_ERROR)) {
// Internal server error
Report("500 Internal Server Error", HttpMsg500);
// Close file
SendText("Content-Type: text/plain");
SendText("Accept-Ranges: bytes");
strcpy(str, "Content-Length: ");
- _itoa(nTotalBytes.Low, str2, 10);
+ _itoa(nTotalBytes.u.Low, str2, 10);
strcat(str, str2);
SendText(str);
SendText("");
BOOL bStop;
LPSTR lpsBuffer;
LONG nBufferSize;
- unsigned __int64 nTotalRead;
- unsigned __int64 nFileSize;
+ // unsigned __int64 nTotalRead;
+ unsigned long long nTotalRead;
+ // unsigned __int64 nFileSize;
+ unsigned long long nFileSize;
HANDLE hFile;
};
typedef CHttpClient* LPCHttpClient;
CListNode();
CListNode(VOID *element, CListNode *next, CListNode *prev);
~CListNode() {};
- PVOID operator new(/*size_t s*/ UINT s);
- VOID operator delete(PVOID p);
+ void* operator new(/*size_t s*/ UINT s);
+ VOID operator delete(void* p);
VOID SetElement(PVOID element);
VOID SetNext(CListNode *next);
OBJECTS = $(MAIN_OBJECTS) $(COMMON_OBJECTS)
PROGS = $(TARGETNAME).exe
LIBS = ../../../lib/kernel32/kernel32.a \
- ../../../lib/ws2_32/ws2_32.a
+ ../../../lib/ws2_32/ws2_32.a \
+ ../../../lib/user32/user32.a
ifeq ($(DOSCLI), yes)
CLEAN_FILES = *.o $(TARGETNAME).exe $(TARGETNAME).sym common\*.o
* PROJECT: ReactOS kernel
* FILE: services/fs/vfat/blockdev.c
* PURPOSE: Temporary sector reading support
- * PROGRAMMER: David Welch (welch@mcmail.com)
+ * PROGRAMMER: David Welch (welch@cwcom.net)
* UPDATE HISTORY:
*/
if (!NT_SUCCESS (Status))
{
- DPRINT ("IO failed!!! VFATWriteSectors : Error code: %x\n", Status);
+ DPRINT1 ("IO failed!!! VFATWriteSectors : Error code: %x\n", Status);
return (Status);
}
-/* $Id: close.c,v 1.3 2000/12/29 23:17:12 dwelch Exp $
+/* $Id: close.c,v 1.4 2001/01/16 09:55:02 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
PVFATCCB pCcb;
KIRQL oldIrql;
- DPRINT ("FsdCloseFile(DeviceExt %x, FileObject %x)\n",
+ DPRINT ("VfatCloseFile(DeviceExt %x, FileObject %x)\n",
DeviceExt, FileObject);
//FIXME : update entry in directory ?
PDEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
NTSTATUS Status;
- DPRINT ("FsdClose(DeviceObject %x, Irp %x)\n", DeviceObject, Irp);
+ DPRINT ("VfatClose(DeviceObject %x, Irp %x)\n", DeviceObject, Irp);
Status = VfatCloseFile (DeviceExtension, FileObject);
-/* $Id: create.c,v 1.13 2001/01/12 21:00:08 dwelch Exp $
+/* $Id: create.c,v 1.14 2001/01/16 09:55:02 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
ULONG NextCluster;
NTSTATUS Status;
- Size = DeviceExt->rootDirectorySectors; //FIXME : in fat32, no limit
+ Size = DeviceExt->rootDirectorySectors; /* FIXME : in fat32, no limit */
StartingSector = DeviceExt->rootStart;
NextCluster = 0;
return (STATUS_UNSUCCESSFUL);
}
}
- // not found in this sector, try next :
+ /* not found in this sector, try next : */
/* directory can be fragmented although it is best to keep them
unfragmented */
{
if (StartingSector == ClusterToSector (DeviceExt, NextCluster + 1))
{
- Status = GetNextCluster (DeviceExt, NextCluster, &NextCluster);
+ Status = GetNextCluster (DeviceExt, NextCluster, &NextCluster,
+ FALSE);
if (NextCluster == 0 || NextCluster == 0xffffffff)
{
*(Vpb->VolumeLabel) = 0;
CHECKPOINT;
TempStr[0] = (WCHAR) '.';
TempStr[1] = 0;
- FileToFind = (PWSTR) & TempStr;
- }
- if (Parent != NULL)
- {
- DPRINT ("Parent->entry.FirstCluster %d\n", Parent->entry.FirstCluster);
+ FileToFind = (PWSTR)&TempStr;
}
- DPRINT ("FindFile '%S'\n", FileToFind);
if (Parent == NULL || Parent->entry.FirstCluster == 1)
{
- CHECKPOINT;
Size = DeviceExt->rootDirectorySectors; /* FIXME : in fat32, no limit */
StartingSector = DeviceExt->rootStart;
NextCluster = 0;
|| (FileToFind[0] == '.' && FileToFind[1] == 0))
{
/* it's root : complete essentials fields then return ok */
- CHECKPOINT;
memset (Fcb, 0, sizeof (VFATFCB));
memset (Fcb->entry.Filename, ' ', 11);
Fcb->entry.FileSize = DeviceExt->rootDirectorySectors * BLOCKSIZE;
if (DeviceExt->FatType == FAT32)
Fcb->entry.FirstCluster = 2;
else
- Fcb->entry.FirstCluster = 1; /* FIXME : is 1 the good value for mark root? */
+ Fcb->entry.FirstCluster = 1;
if (StartSector)
*StartSector = StartingSector;
if (Entry)
StartingSector = DeviceExt->rootStart;
}
}
- CHECKPOINT;
block = ExAllocatePool (NonPagedPool, BLOCKSIZE);
- CHECKPOINT;
if (StartSector && (*StartSector))
StartingSector = *StartSector;
i = (Entry) ? (*Entry) : 0;
- DPRINT ("FindFile : start at sector %lx, entry %ld\n", StartingSector, i);
for (j = 0; j < Size; j++)
{
/* FIXME: Check status */
{
if (wstrcmpjoki (name, FileToFind))
{
- /* In the case of a long filename, the firstcluster is stored in
- the next record -- where it's short name is */
+ /* In the case of a long filename, the firstcluster is
+ stored in the next record -- where it's short name is */
if (((FATDirEntry *) block)[i].Attrib == 0x0f)
i++;
if (i == (ENTRIES_PER_SECTOR))
{
if (StartingSector == ClusterToSector (DeviceExt, NextCluster + 1))
{
- Status = GetNextCluster (DeviceExt, NextCluster, &NextCluster);
+ Status = GetNextCluster (DeviceExt, NextCluster, &NextCluster,
+ FALSE);
if (NextCluster == 0 || NextCluster == 0xffffffff)
{
if (StartSector)
NTSTATUS
-FsdOpenFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
+VfatOpenFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
PWSTR FileName)
/*
* FUNCTION: Opens a file
KIRQL oldIrql;
ULONG BytesPerCluster;
- DPRINT ("FsdOpenFile(%08lx, %08lx, %S)\n", DeviceExt, FileObject, FileName);
+ DPRINT ("VfatOpenFile(%08lx, %08lx, %S)\n", DeviceExt, FileObject, FileName);
/* FIXME : treat relative name */
if (FileObject->RelatedFileObject)
DeviceExt = DeviceObject->DeviceExtension;
assert (DeviceExt);
- Status = FsdOpenFile (DeviceExt, FileObject, FileObject->FileName.Buffer);
+ Status = VfatOpenFile (DeviceExt, FileObject, FileObject->FileName.Buffer);
- CHECKPOINT;
+ /*
+ * If the directory containing the file to open doesn't exist then
+ * fail immediately
+ */
Irp->IoStatus.Information = 0;
if (Status == STATUS_OBJECT_PATH_NOT_FOUND)
{
return Status;
}
- CHECKPOINT;
if (!NT_SUCCESS (Status))
{
- if (RequestedDisposition == FILE_CREATE
- || RequestedDisposition == FILE_OPEN_IF
- || RequestedDisposition == FILE_OVERWRITE_IF
- || RequestedDisposition == FILE_SUPERSEDE)
+ /*
+ * If the file open failed then create the required file
+ */
+ if (RequestedDisposition == FILE_CREATE ||
+ RequestedDisposition == FILE_OPEN_IF ||
+ RequestedDisposition == FILE_OVERWRITE_IF ||
+ RequestedDisposition == FILE_SUPERSEDE)
{
CHECKPOINT;
-#if 0
- Status =
+ Status =
addEntry (DeviceExt, FileObject, RequestedOptions,
(Stack->Parameters.
Create.FileAttributes & FILE_ATTRIBUTE_VALID_FLAGS));
-#else
- Status = STATUS_UNSUCCESSFUL;
-#endif
if (NT_SUCCESS (Status))
Irp->IoStatus.Information = FILE_CREATED;
/* FIXME set size if AllocationSize requested */
}
else
{
+ /*
+ * Otherwise fail if the caller wanted to create a new file
+ */
if (RequestedDisposition == FILE_CREATE)
{
Irp->IoStatus.Information = FILE_EXISTS;
Status = STATUS_OBJECT_NAME_COLLISION;
- }
+ }
pCcb = FileObject->FsContext2;
pFcb = pCcb->pFcb;
+ /*
+ * If requested then delete the file and create a new one with the
+ * same name
+ */
if (RequestedDisposition == FILE_SUPERSEDE)
{
ULONG Cluster, NextCluster;
Cluster = pFcb->entry.FirstCluster;
pFcb->entry.FirstCluster = 0;
pFcb->entry.FirstClusterHigh = 0;
- // updEntry (DeviceExt, FileObject);
+ updEntry (DeviceExt, FileObject);
while (Cluster != 0xffffffff && Cluster > 1)
{
- Status = GetNextCluster (DeviceExt, Cluster, &NextCluster);
+ Status = GetNextCluster (DeviceExt, Cluster, &NextCluster, TRUE);
// WriteCluster (DeviceExt, Cluster, 0);
Cluster = NextCluster;
}
}
+
+ /*
+ * Check the file has the requested attributes
+ */
if ((RequestedOptions & FILE_NON_DIRECTORY_FILE)
&& (pFcb->entry.Attrib & FILE_ATTRIBUTE_DIRECTORY))
{
-/* $Id: dirwr.c,v 1.15 2001/01/01 04:42:11 dwelch Exp $
+/* $Id: dirwr.c,v 1.16 2001/01/16 09:55:02 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
#include "vfat.h"
-#if 0
/*
* Copies a file name into a directory slot (long file name entry)
* and fills trailing slot space with 0xFFFF. This keeps scandisk
memset (&FileObject, 0, sizeof (FILE_OBJECT));
DPRINT ("open directory \'%S\' for update of entry \'%S\'\n", DirName,
FileName);
- status = FsdOpenFile (DeviceExt, &FileObject, DirName);
+ status = VfatOpenFile (DeviceExt, &FileObject, DirName);
if (!NT_SUCCESS (status))
{
DbgPrint ("Failed to open \'%S\'. Status %lx\n", DirName, status);
{
Buffer = ExAllocatePool (NonPagedPool, BLOCKSIZE);
DPRINT ("update entry: sector %d, entry %d\n", Sector, Entry);
- VFATReadSectors (DeviceExt->StorageDevice, Sector, 1, Buffer);
+ VfatReadSectors (DeviceExt->StorageDevice, Sector, 1, Buffer);
pEntries = (FATDirEntry *) Buffer;
memcpy (&pEntries[Entry], &pFcb->entry, sizeof (FATDirEntry));
- VFATWriteSectors (DeviceExt->StorageDevice, Sector, 1, Buffer);
+ VfatWriteSectors (DeviceExt->StorageDevice, Sector, 1, Buffer);
ExFreePool (Buffer);
}
VfatCloseFile (DeviceExt, &FileObject);
ULONG CurrentCluster;
KIRQL oldIrql;
LARGE_INTEGER SystemTime, LocalTime;
+ ULONG BytesPerCluster;
+ NTSTATUS Status;
PathFileName = pFileObject->FileName.Buffer;
DPRINT ("addEntry: Pathname=%S\n", PathFileName);
DirName[posCar] = 0;
// open parent directory
memset (&FileObject, 0, sizeof (FILE_OBJECT));
- status = FsdOpenFile (DeviceExt, &FileObject, DirName);
+ status = VfatOpenFile (DeviceExt, &FileObject, DirName);
nbSlots = (NameLen + 12) / 13 + 1; //nb of entry needed for long name+normal entry
DPRINT ("NameLen= %d, nbSlots =%d\n", NameLen, nbSlots);
Buffer =
{
status =
VfatReadFile (DeviceExt, &FileObject, &FatEntry, sizeof (FATDirEntry),
- i * sizeof (FATDirEntry), &LengthRead);
+ i * sizeof (FATDirEntry), &LengthRead, FALSE);
if (status == STATUS_END_OF_FILE)
break;
if (!NT_SUCCESS (status))
if (RequestedOptions & FILE_DIRECTORY_FILE)
{
- CurrentCluster = GetNextWriteCluster (DeviceExt, 0);
+ NextCluster (DeviceExt, 0, &CurrentCluster, TRUE);
// zero the cluster
Buffer2 = ExAllocatePool (NonPagedPool, DeviceExt->BytesPerCluster);
memset (Buffer2, 0, DeviceExt->BytesPerCluster);
- VFATWriteCluster (DeviceExt, Buffer2, CurrentCluster);
+ VfatRawWriteCluster (DeviceExt, 0, Buffer2, CurrentCluster);
ExFreePool (Buffer2);
if (DeviceExt->FatType == FAT32)
{
Offset = (i - nbSlots + 1) * sizeof (FATDirEntry);
status =
VfatWriteFile (DeviceExt, &FileObject, Buffer,
- sizeof (FATDirEntry) * nbSlots, Offset);
+ sizeof (FATDirEntry) * nbSlots, Offset, FALSE);
DPRINT ("VfatWriteFile() returned: %x\n", status);
}
else
Offset = (i - nbFree) * sizeof (FATDirEntry);
status =
VfatWriteFile (DeviceExt, &FileObject, Buffer,
- sizeof (FATDirEntry) * (nbSlots + 1), Offset);
+ sizeof (FATDirEntry) * (nbSlots + 1), Offset, FALSE);
}
DPRINT ("write entry offset %d status=%x\n", Offset, status);
newCCB = ExAllocatePool (NonPagedPool, sizeof (VFATCCB));
newCCB->pFcb = newFCB;
newCCB->PtrFileObject = pFileObject;
newFCB->RefCount++;
+
+ BytesPerCluster = DeviceExt->Boot->SectorsPerCluster * BLOCKSIZE;
+ if (BytesPerCluster >= PAGESIZE)
+ {
+ Status = CcInitializeFileCache(pFileObject, &newFCB->RFCB.Bcb,
+ BytesPerCluster);
+ }
+ else
+ {
+ Status = CcInitializeFileCache(pFileObject, &newFCB->RFCB.Bcb,
+ PAGESIZE);
+ }
/*
* FIXME : initialize all fields in FCB and CCB
memcpy (pEntry->Filename, ". ", 11);
status =
VfatWriteFile (DeviceExt, pFileObject, pEntry, sizeof (FATDirEntry),
- 0L);
+ 0L, FALSE);
pEntry->FirstCluster =
((VFATCCB *) (FileObject.FsContext2))->pFcb->entry.FirstCluster;
pEntry->FirstClusterHigh =
pEntry->FirstCluster = 0;
status =
VfatWriteFile (DeviceExt, pFileObject, pEntry, sizeof (FATDirEntry),
- sizeof (FATDirEntry));
+ sizeof (FATDirEntry), FALSE);
}
VfatCloseFile (DeviceExt, &FileObject);
ExFreePool (Buffer);
DPRINT ("addentry ok\n");
return STATUS_SUCCESS;
}
-#endif
/* EOF */
/*
- * $Id: fat.c,v 1.13 2001/01/14 15:05:53 dwelch Exp $
+ * $Id: fat.c,v 1.14 2001/01/16 09:55:02 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FUNCTION: Retrieve the next FAT12 cluster from the FAT table
*/
{
- ULONG FATOffset;
- ULONG Entry;
- NTSTATUS Status;
- PVOID BaseAddress;
- BOOLEAN Valid;
- PCACHE_SEGMENT CacheSeg;
- UCHAR Value1, Value2;
-
- FATOffset = (DeviceExt->FATStart * BLOCKSIZE) + ((CurrentCluster * 12) / 8);
-
- /*
- * Get the page containing this offset
- */
- Status = CcRequestCacheSegment(DeviceExt->StorageBcb,
- PAGE_ROUND_DOWN(FATOffset),
- &BaseAddress,
- &Valid,
- &CacheSeg);
+ unsigned char* CBlock;
+ ULONG FATOffset;
+ ULONG Entry;
+ BOOLEAN Valid;
+ PCACHE_SEGMENT CacheSeg;
+ NTSTATUS Status;
+ PVOID BaseAddress;
+
+ *NextCluster = 0;
+
+ Status = CcRequestCacheSegment(DeviceExt->Fat12StorageBcb,
+ 0,
+ &BaseAddress,
+ &Valid,
+ &CacheSeg);
if (!NT_SUCCESS(Status))
{
return(Status);
if (!Valid)
{
Status = VfatReadSectors(DeviceExt->StorageDevice,
- PAGE_ROUND_DOWN(FATOffset) / BLOCKSIZE,
- PAGESIZE / BLOCKSIZE,
- BaseAddress);
+ DeviceExt->FATStart,
+ DeviceExt->Boot->FATSectors,
+ BaseAddress);
if (!NT_SUCCESS(Status))
{
- CcReleaseCacheSegment(DeviceExt->StorageBcb, CacheSeg, FALSE);
+ CcReleaseCacheSegment(DeviceExt->Fat12StorageBcb, CacheSeg, FALSE);
return(Status);
}
}
- Value1 = ((PUCHAR)BaseAddress)[FATOffset % PAGESIZE];
-
- /*
- * A FAT12 entry may straggle two sectors
- */
- if ((FATOffset + 1) == PAGESIZE)
- {
- CcReleaseCacheSegment(DeviceExt->StorageBcb, CacheSeg, TRUE);
- Status = CcRequestCacheSegment(DeviceExt->StorageBcb,
- PAGE_ROUND_DOWN(FATOffset) + PAGESIZE,
- &BaseAddress,
- &Valid,
- &CacheSeg);
- if (!NT_SUCCESS(Status))
- {
- return(Status);
- }
- if (!Valid)
- {
- ULONG NextOffset;
-
- NextOffset = (PAGE_ROUND_DOWN(FATOffset) + PAGESIZE) / BLOCKSIZE;
- Status =
- VfatReadSectors(DeviceExt->StorageDevice,
- NextOffset,
- PAGESIZE / BLOCKSIZE,
- BaseAddress);
- if (!NT_SUCCESS(Status))
- {
- CcReleaseCacheSegment(DeviceExt->StorageBcb, CacheSeg, FALSE);
- return(Status);
- }
- }
- Value2 = ((PUCHAR)BaseAddress)[0];
- CcReleaseCacheSegment(DeviceExt->StorageBcb, CacheSeg, TRUE);
- }
- else
- {
- Value2 = ((PUCHAR)BaseAddress)[(FATOffset % PAGESIZE) + 1];
- CcReleaseCacheSegment(DeviceExt->StorageBcb, CacheSeg, TRUE);
- }
-
+ CBlock = (PUCHAR)BaseAddress;
+
+ FATOffset = (CurrentCluster * 12) / 8; /* first byte containing value */
if ((CurrentCluster % 2) == 0)
{
- Entry = Value1;
- Entry |= ((Value2 & 0xf) << 8);
+ Entry = CBlock[FATOffset];
+ Entry |= ((CBlock[FATOffset+1] & 0xf)<<8);
}
else
{
- Entry = (Value1 >> 4);
- Entry |= (Value2 << 4);
+ Entry = (CBlock[FATOffset] >> 4);
+ Entry |= (CBlock[FATOffset+1] << 4);
}
- DPRINT ("Entry %x\n", Entry);
+ DPRINT("Entry %x\n",Entry);
if (Entry >= 0xff8 && Entry <= 0xfff)
Entry = 0xffffffff;
- DPRINT ("Returning %x\n", Entry);
+ DPRINT("Returning %x\n",Entry);
*NextCluster = Entry;
- return (STATUS_SUCCESS);
-}
-
-NTSTATUS
-GetNextCluster (PDEVICE_EXTENSION DeviceExt,
- ULONG CurrentCluster,
- PULONG NextCluster)
-/*
- * FUNCTION: Retrieve the next cluster depending on the FAT type
- */
-{
- NTSTATUS Status;
-
- DPRINT ("GetNextCluster(DeviceExt %x, CurrentCluster %x)\n",
- DeviceExt, CurrentCluster);
-
- ExAcquireResourceSharedLite (&DeviceExt->FatResource, TRUE);
-
- if (DeviceExt->FatType == FAT16)
- {
- Status = Fat16GetNextCluster (DeviceExt, CurrentCluster, NextCluster);
- }
- else if (DeviceExt->FatType == FAT32)
- {
- Status = Fat32GetNextCluster (DeviceExt, CurrentCluster, NextCluster);
- }
- else
- {
- Status = Fat12GetNextCluster (DeviceExt, CurrentCluster, NextCluster);
- }
-
- ExReleaseResourceLite (&DeviceExt->FatResource);
-
- return (Status);
+ CcReleaseCacheSegment(DeviceExt->Fat12StorageBcb, CacheSeg, TRUE);
+ return(STATUS_SUCCESS);
}
NTSTATUS
CacheSeg = NULL;
*Cluster = 0;
- for (i = 0; i < FatLength; i+=2)
+ for (i = 2; i < FatLength; i+=2)
{
- if ((i % PAGESIZE) == 0)
+ if (((FatStart + i) % PAGESIZE) == 0 || CacheSeg == NULL)
{
if (CacheSeg != NULL)
{
CcReleaseCacheSegment(DeviceExt->StorageBcb, CacheSeg, TRUE);
}
Status = CcRequestCacheSegment(DeviceExt->StorageBcb,
- FatStart + i,
+ PAGE_ROUND_DOWN(FatStart + i),
&BaseAddress,
&Valid,
&CacheSeg);
if (!Valid)
{
Status = VfatReadSectors(DeviceExt->StorageDevice,
- (FatStart + i) / BLOCKSIZE,
+ PAGE_ROUND_DOWN(FatStart + i)
+ / BLOCKSIZE,
PAGESIZE / BLOCKSIZE,
BaseAddress);
if (!NT_SUCCESS(Status))
}
}
}
- if (*((PUSHORT)(BaseAddress + (i % PAGESIZE))) == 0)
+ if (*((PUSHORT)(BaseAddress + ((FatStart + i) % PAGESIZE))) == 0)
{
+ DPRINT1("Found available cluster 0x%x\n", i);
*Cluster = i / 2;
+ CcReleaseCacheSegment(DeviceExt->StorageBcb, CacheSeg, TRUE);
return(STATUS_SUCCESS);
}
}
-
+ CcReleaseCacheSegment(DeviceExt->StorageBcb, CacheSeg, TRUE);
return(STATUS_DISK_FULL);
}
* FUNCTION: Finds the first available cluster in a FAT12 table
*/
{
- *Cluster = 0;
- return(STATUS_UNSUCCESSFUL);
-
-#if 0
ULONG FATOffset;
ULONG Entry;
- PUCHAR CBlock = DeviceExt->FAT;
+ PUCHAR CBlock;
ULONG i;
+ PVOID BaseAddress;
+ BOOLEAN Valid;
+ PCACHE_SEGMENT CacheSeg;
+ NTSTATUS Status;
+
+ *Cluster = 0;
+
+ Status = CcRequestCacheSegment(DeviceExt->Fat12StorageBcb,
+ 0,
+ &BaseAddress,
+ &Valid,
+ &CacheSeg);
+ if (!NT_SUCCESS(Status))
+ {
+ return(Status);
+ }
+ if (!Valid)
+ {
+ Status = VfatReadSectors(DeviceExt->StorageDevice,
+ DeviceExt->FATStart,
+ DeviceExt->Boot->FATSectors,
+ BaseAddress);
+ if (!NT_SUCCESS(Status))
+ {
+ CcReleaseCacheSegment(DeviceExt->Fat12StorageBcb, CacheSeg, FALSE);
+ return(Status);
+ }
+ }
+ CBlock = (PUCHAR)BaseAddress;
+
for (i = 2; i < ((DeviceExt->Boot->FATSectors * 512 * 8) / 12); i++)
{
FATOffset = (i * 12) / 8;
Entry |= (CBlock[FATOffset + 1] << 4);
}
if (Entry == 0)
- return (i);
+ {
+ DPRINT1("Found available cluster 0x%x\n", i);
+ *Cluster = i;
+ CcReleaseCacheSegment(DeviceExt->StorageBcb, CacheSeg, TRUE);
+ }
}
- /* Give an error message (out of disk space) if we reach here) */
- DbgPrint ("Disk full, %d clusters used\n", i);
- return 0;
-#endif
+ CcReleaseCacheSegment(DeviceExt->StorageBcb, CacheSeg, TRUE);
+ return (STATUS_DISK_FULL);
}
NTSTATUS
* FUNCTION: Writes a cluster to the FAT12 physical and in-memory tables
*/
{
- return(STATUS_UNSUCCESSFUL);
-
-#if 0
ULONG FATsector;
ULONG FATOffset;
- PUCHAR CBlock = DeviceExt->FAT;
+ PUCHAR CBlock;
int i;
+ NTSTATUS Status;
+ PVOID BaseAddress;
+ BOOLEAN Valid;
+ PCACHE_SEGMENT CacheSeg;
+
+ Status = CcRequestCacheSegment(DeviceExt->Fat12StorageBcb,
+ 0,
+ &BaseAddress,
+ &Valid,
+ &CacheSeg);
+ if (!NT_SUCCESS(Status))
+ {
+ return(Status);
+ }
+ if (!Valid)
+ {
+ Status = VfatReadSectors(DeviceExt->StorageDevice,
+ DeviceExt->FATStart,
+ DeviceExt->Boot->FATSectors,
+ BaseAddress);
+ if (!NT_SUCCESS(Status))
+ {
+ CcReleaseCacheSegment(DeviceExt->Fat12StorageBcb, CacheSeg, FALSE);
+ return(Status);
+ }
+ }
+ CBlock = (PUCHAR)BaseAddress;
+
FATOffset = (ClusterToWrite * 12) / 8;
+ DPRINT1("Writing 0x%x for 0x%x at 0x%x\n",
+ NewValue, ClusterToWrite, FATOffset);
if ((ClusterToWrite % 2) == 0)
{
CBlock[FATOffset] = NewValue;
1, CBlock + FATsector * 512);
}
}
-#endif
+ CcReleaseCacheSegment(DeviceExt->StorageBcb, CacheSeg, TRUE);
+ return(STATUS_SUCCESS);
}
NTSTATUS
Start = DeviceExt->FATStart;
+ FATOffset = (Start * BLOCKSIZE) + (ClusterToWrite * 2);
+
for (i = 0; i < DeviceExt->Boot->FATCount; i++)
- {
- FATOffset = (Start * BLOCKSIZE) + (ClusterToWrite * 2);
-
+ {
Status = CcRequestCacheSegment(DeviceExt->StorageBcb,
PAGE_ROUND_DOWN(FATOffset),
&BaseAddress,
return(Status);
}
}
-
+
+ DPRINT1("Writing 0x%x for offset 0x%x 0x%x\n", NewValue, FATOffset,
+ ClusterToWrite);
*((PUSHORT)(BaseAddress + (FATOffset % PAGESIZE))) = NewValue;
+ Status = VfatWriteSectors(DeviceExt->StorageDevice,
+ PAGE_ROUND_DOWN(FATOffset) / BLOCKSIZE,
+ PAGESIZE / BLOCKSIZE,
+ BaseAddress);
CcReleaseCacheSegment(DeviceExt->StorageBcb, CacheSeg, TRUE);
-
- Start = Start + DeviceExt->Boot->FATSectors;
+
+ DPRINT1("DeviceExt->Boot->FATSectors %d\n",
+ DeviceExt->Boot->FATSectors);
+ FATOffset = FATOffset + DeviceExt->Boot->FATSectors * BLOCKSIZE;
}
return (STATUS_SUCCESS);
return(Status);
}
-NTSTATUS
-GetNextWriteCluster (PDEVICE_EXTENSION DeviceExt,
- ULONG CurrentCluster,
- PULONG NextCluster)
-/*
- * FUNCTION: Determines the next cluster to be written
- */
-{
- ULONG LastCluster, NewCluster;
- UCHAR *Buffer2;
- NTSTATUS Status;
-
- DPRINT ("GetNextWriteCluster(DeviceExt %x, CurrentCluster %x)\n",
- DeviceExt, CurrentCluster);
-
- *NextCluster = 0;
-
- /* Find out what was happening in the last cluster's AU */
- Status = GetNextCluster (DeviceExt, CurrentCluster, &LastCluster);
- if (!NT_SUCCESS(Status))
- {
- return(Status);
- }
- /* Check to see if we must append or overwrite */
- if (LastCluster == 0xFFFFFFFF)
- {
- /* we are after last existing cluster : we must add one to file */
- /* Append */
- /* Firstly, find the next available open allocation unit */
- if (DeviceExt->FatType == FAT16)
- {
- Status = FAT16FindAvailableCluster (DeviceExt, &NewCluster);
- if (!NT_SUCCESS(Status))
- {
- return(Status);
- }
- }
- else if (DeviceExt->FatType == FAT32)
- {
- Status = FAT32FindAvailableCluster (DeviceExt, &NewCluster);
- }
- else
- {
- Status = FAT12FindAvailableCluster (DeviceExt, &NewCluster);
- if (!NT_SUCCESS(Status))
- {
- return(Status);
- }
- }
- /* Mark the new AU as the EOF */
- WriteCluster (DeviceExt, NewCluster, 0xFFFFFFFF);
- /* Now, write the AU of the LastCluster with the value of the newly
- found AU */
- WriteCluster (DeviceExt, CurrentCluster, NewCluster);
- /* fill cluster with zero */
- Buffer2 = ExAllocatePool (NonPagedPool, DeviceExt->BytesPerCluster);
- memset (Buffer2, 0, DeviceExt->BytesPerCluster);
- VfatWriteCluster (DeviceExt, Buffer2, NewCluster);
- ExFreePool (Buffer2);
- /* Return NewCluster as CurrentCluster */
- *NextCluster = NewCluster;
- return(STATUS_SUCCESS);
- }
- else
- {
- /* Overwrite: Return LastCluster as CurrentCluster */
- *NextCluster = LastCluster;
- return(STATUS_SUCCESS);
- }
-}
-
ULONG
ClusterToSector (PDEVICE_EXTENSION DeviceExt, unsigned long Cluster)
/*
}
NTSTATUS
-VfatWriteCluster (PDEVICE_EXTENSION DeviceExt, PVOID Buffer, ULONG Cluster)
+VfatRawWriteCluster (PDEVICE_EXTENSION DeviceExt,
+ ULONG FirstCluster,
+ PVOID Buffer,
+ ULONG Cluster)
/*
* FUNCTION: Write a cluster to the physical device
*/
DPRINT ("VfatWriteCluster(DeviceExt %x, Buffer %x, Cluster %d)\n",
DeviceExt, Buffer, Cluster);
- Sector = ClusterToSector (DeviceExt, Cluster);
-
- Status = VfatWriteSectors (DeviceExt->StorageDevice,
- Sector, DeviceExt->Boot->SectorsPerCluster,
- Buffer);
+ if (FirstCluster == 1)
+ {
+ Status = VfatWriteSectors (DeviceExt->StorageDevice,
+ Cluster,
+ DeviceExt->Boot->SectorsPerCluster, Buffer);
+ }
+ else
+ {
+ Sector = ClusterToSector (DeviceExt, Cluster);
+
+ Status = VfatWriteSectors (DeviceExt->StorageDevice,
+ Sector, DeviceExt->Boot->SectorsPerCluster,
+ Buffer);
+ }
return(Status);
}
+NTSTATUS
+GetNextCluster (PDEVICE_EXTENSION DeviceExt,
+ ULONG CurrentCluster,
+ PULONG NextCluster,
+ BOOLEAN Extend)
+/*
+ * FUNCTION: Retrieve the next cluster depending on the FAT type
+ */
+{
+ NTSTATUS Status;
+
+ DPRINT ("GetNextCluster(DeviceExt %x, CurrentCluster %x)\n",
+ DeviceExt, CurrentCluster);
+
+ if (Extend)
+ {
+ ExAcquireResourceSharedLite (&DeviceExt->FatResource, TRUE);
+ }
+ else
+ {
+ ExAcquireResourceExclusiveLite (&DeviceExt->FatResource, TRUE);
+ }
+
+ /*
+ * If the file hasn't any clusters allocated then we need special
+ * handling
+ */
+ if (CurrentCluster == 0 && Extend)
+ {
+ ULONG NewCluster;
+
+ if (DeviceExt->FatType == FAT16)
+ {
+ Status = FAT16FindAvailableCluster (DeviceExt, &NewCluster);
+ if (!NT_SUCCESS(Status))
+ {
+ return(Status);
+ }
+ }
+ else if (DeviceExt->FatType == FAT32)
+ {
+ Status = FAT32FindAvailableCluster (DeviceExt, &NewCluster);
+ }
+ else
+ {
+ Status = FAT12FindAvailableCluster (DeviceExt, &NewCluster);
+ if (!NT_SUCCESS(Status))
+ {
+ return(Status);
+ }
+ }
+ /* Mark the new AU as the EOF */
+ WriteCluster (DeviceExt, NewCluster, 0xFFFFFFFF);
+ *NextCluster = NewCluster;
+ ExReleaseResourceLite(&DeviceExt->FatResource);
+ return(STATUS_SUCCESS);
+ }
+ else if (CurrentCluster == 0)
+ {
+ ExReleaseResourceLite(&DeviceExt->FatResource);
+ return(STATUS_UNSUCCESSFUL);
+ }
+
+ if (DeviceExt->FatType == FAT16)
+ {
+ Status = Fat16GetNextCluster (DeviceExt, CurrentCluster, NextCluster);
+ }
+ else if (DeviceExt->FatType == FAT32)
+ {
+ Status = Fat32GetNextCluster (DeviceExt, CurrentCluster, NextCluster);
+ }
+ else
+ {
+ Status = Fat12GetNextCluster (DeviceExt, CurrentCluster, NextCluster);
+ }
+ if (Extend && (*NextCluster) == 0xFFFFFFFF)
+ {
+ ULONG NewCluster;
+
+ /* We are after last existing cluster, we must add one to file */
+ /* Firstly, find the next available open allocation unit */
+ if (DeviceExt->FatType == FAT16)
+ {
+ Status = FAT16FindAvailableCluster (DeviceExt, &NewCluster);
+ if (!NT_SUCCESS(Status))
+ {
+ return(Status);
+ }
+ }
+ else if (DeviceExt->FatType == FAT32)
+ {
+ Status = FAT32FindAvailableCluster (DeviceExt, &NewCluster);
+ }
+ else
+ {
+ Status = FAT12FindAvailableCluster (DeviceExt, &NewCluster);
+ if (!NT_SUCCESS(Status))
+ {
+ return(Status);
+ }
+ }
+ /* Mark the new AU as the EOF */
+ WriteCluster (DeviceExt, NewCluster, 0xFFFFFFFF);
+ /* Now, write the AU of the LastCluster with the value of the newly
+ found AU */
+ WriteCluster (DeviceExt, CurrentCluster, NewCluster);
+ *NextCluster = NewCluster;
+ }
+
+ ExReleaseResourceLite (&DeviceExt->FatResource);
+
+ return (Status);
+}
+
-/* $Id: iface.c,v 1.48 2001/01/12 21:00:08 dwelch Exp $
+/* $Id: iface.c,v 1.49 2001/01/16 09:55:02 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
Status = CcInitializeFileCache(DeviceExt->StreamStorageDevice,
&DeviceExt->StorageBcb,
PAGESIZE);
+ if (DeviceExt->FatType == FAT12)
+ {
+ DeviceExt->Fat12StorageDevice =
+ IoCreateStreamFileObject(NULL, DeviceExt->StorageDevice);
+ Status = CcInitializeFileCache(DeviceExt->Fat12StorageDevice,
+ &DeviceExt->Fat12StorageBcb,
+ PAGESIZE * 3);
+ }
ExInitializeResourceLite (&DeviceExt->DirResource);
ExInitializeResourceLite (&DeviceExt->FatResource);
-/* $Id: rw.c,v 1.18 2001/01/14 15:05:53 dwelch Exp $
+/* $Id: rw.c,v 1.19 2001/01/16 09:55:02 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
NTSTATUS
NextCluster(PDEVICE_EXTENSION DeviceExt,
ULONG FirstCluster,
- PULONG CurrentCluster)
+ PULONG CurrentCluster,
+ BOOLEAN Extend)
+ /*
+ * Return the next cluster in a FAT chain, possibly extending the chain if
+ * necessary
+ */
{
if (FirstCluster == 1)
{
{
NTSTATUS Status;
- Status = GetNextCluster(DeviceExt, (*CurrentCluster), CurrentCluster);
+ Status = GetNextCluster(DeviceExt, (*CurrentCluster), CurrentCluster,
+ Extend);
return(Status);
}
}
OffsetToCluster(PDEVICE_EXTENSION DeviceExt,
ULONG FirstCluster,
ULONG FileOffset,
- PULONG Cluster)
+ PULONG Cluster,
+ BOOLEAN Extend)
+ /*
+ * Return the cluster corresponding to an offset within a file,
+ * possibly extending the file if necessary
+ */
{
ULONG CurrentCluster;
ULONG i;
CurrentCluster = FirstCluster;
for (i = 0; i < FileOffset / DeviceExt->BytesPerCluster; i++)
{
- Status = GetNextCluster (DeviceExt, CurrentCluster, &CurrentCluster);
+ Status = GetNextCluster (DeviceExt, CurrentCluster, &CurrentCluster,
+ Extend);
if (!NT_SUCCESS(Status))
{
return(Status);
}
NTSTATUS
-VfatReadCluster(PDEVICE_EXTENSION DeviceExt,
+VfatReadBigCluster(PDEVICE_EXTENSION DeviceExt,
PVFATFCB Fcb,
ULONG StartOffset,
ULONG FirstCluster,
ULONG InternalOffset,
ULONG InternalLength)
{
- ULONG BytesPerCluster;
BOOLEAN Valid;
- PVOID BaseAddress;
- PCACHE_SEGMENT CacheSeg;
- NTSTATUS Status;
-
- BytesPerCluster = DeviceExt->Boot->SectorsPerCluster * BLOCKSIZE;
+ PVOID BaseAddress = NULL;
+ PCACHE_SEGMENT CacheSeg = NULL;
+ NTSTATUS Status;
- if (BytesPerCluster >= PAGESIZE)
+ /*
+ * In this case the size of a cache segment is the same as a cluster
+ */
+
+ if (!NoCache)
{
- /*
- * In this case the size of a cache segment is the same as a cluster
- */
-
- if (!NoCache)
+ Status = CcRequestCacheSegment(Fcb->RFCB.Bcb,
+ StartOffset,
+ &BaseAddress,
+ &Valid,
+ &CacheSeg);
+ if (!NT_SUCCESS(Status))
{
- Status = CcRequestCacheSegment(Fcb->RFCB.Bcb,
- StartOffset,
- &BaseAddress,
- &Valid,
- &CacheSeg);
- if (!NT_SUCCESS(Status))
- {
- return(Status);
- }
+ return(Status);
}
- else
+ }
+ else
+ {
+ Valid = FALSE;
+ if (InternalOffset == 0)
{
- Valid = FALSE;
+ BaseAddress = Destination;
}
- if (!Valid)
+ else
{
- /*
- * If necessary read the cluster from the disk
- */
- Status = VfatRawReadCluster(DeviceExt, FirstCluster, BaseAddress,
- *CurrentCluster);
- if (!NT_SUCCESS(Status))
+ BaseAddress = ExAllocatePool(NonPagedPool,
+ DeviceExt->BytesPerCluster);
+ if (BaseAddress == NULL)
{
- if (!NoCache)
- {
- CcReleaseCacheSegment(Fcb->RFCB.Bcb, CacheSeg, FALSE);
- }
- return(Status);
+ return(STATUS_NO_MEMORY);
}
}
+ }
+
+ if (!Valid)
+ {
/*
- * Copy the data from the cache to the caller
+ * If necessary read the cluster from the disk
*/
- memcpy(Destination, BaseAddress + InternalOffset, InternalLength);
- if (!NoCache)
+ Status = VfatRawReadCluster(DeviceExt, FirstCluster, BaseAddress,
+ *CurrentCluster);
+ if (!NT_SUCCESS(Status))
{
- CcReleaseCacheSegment(Fcb->RFCB.Bcb, CacheSeg, TRUE);
+ if (!NoCache)
+ {
+ CcReleaseCacheSegment(Fcb->RFCB.Bcb, CacheSeg, FALSE);
+ }
+ else if (InternalOffset != 0)
+ {
+ ExFreePool(BaseAddress);
+ }
+ return(Status);
}
+ }
+ /*
+ * Copy the data from the cache to the caller
+ */
+ memcpy(Destination, BaseAddress + InternalOffset, InternalLength);
+ if (!NoCache)
+ {
+ CcReleaseCacheSegment(Fcb->RFCB.Bcb, CacheSeg, TRUE);
+ }
+ else if (InternalOffset != 0)
+ {
+ ExFreePool(BaseAddress);
+ }
+
+ Status = NextCluster(DeviceExt, FirstCluster, CurrentCluster, FALSE);
+ if (!NT_SUCCESS(Status))
+ {
+ return(Status);
+ }
+ return(STATUS_SUCCESS);
+}
- Status = NextCluster(DeviceExt, FirstCluster, CurrentCluster);
+NTSTATUS
+VfatReadSmallCluster(PDEVICE_EXTENSION DeviceExt,
+ PVFATFCB Fcb,
+ ULONG StartOffset,
+ ULONG FirstCluster,
+ PULONG CurrentCluster,
+ PVOID Destination,
+ ULONG NoCache,
+ ULONG InternalOffset,
+ ULONG InternalLength)
+{
+ BOOLEAN Valid;
+ PVOID BaseAddress = NULL;
+ PCACHE_SEGMENT CacheSeg = NULL;
+ NTSTATUS Status;
+ ULONG i;
+
+ /*
+ * Otherwise we read a page of clusters together
+ */
+ if (!NoCache)
+ {
+ Status = CcRequestCacheSegment(Fcb->RFCB.Bcb,
+ StartOffset,
+ &BaseAddress,
+ &Valid,
+ &CacheSeg);
if (!NT_SUCCESS(Status))
{
return(Status);
}
else
{
- ULONG i;
-
- /*
- * Otherwise we read a page of clusters together
- */
-
- if (!NoCache)
+ Valid = FALSE;
+ if (InternalOffset == 0)
{
- Status = CcRequestCacheSegment(Fcb->RFCB.Bcb,
- StartOffset,
- &BaseAddress,
- &Valid,
- &CacheSeg);
- if (!NT_SUCCESS(Status))
- {
- return(Status);
- }
+ BaseAddress = Destination;
}
else
{
- Valid = FALSE;
+ BaseAddress = ExAllocatePool(NonPagedPool, PAGESIZE);
+ if (BaseAddress == NULL)
+ {
+ return(STATUS_NO_MEMORY);
+ }
}
-
- /*
- * If necessary read all the data for the page, unfortunately the
- * file length may not be page aligned in which case the page will
- * only be partially filled.
- * FIXME: So zero fill the rest?
- */
- if (!Valid)
- {
- for (i = 0; i < (PAGESIZE / BytesPerCluster); i++)
- {
- Status = VfatRawReadCluster(DeviceExt,
- FirstCluster,
- BaseAddress + (i * BytesPerCluster),
- *CurrentCluster);
- if (!NT_SUCCESS(Status))
+ }
+
+ /*
+ * If necessary read all the data for the page, unfortunately the
+ * file length may not be page aligned in which case the page will
+ * only be partially filled.
+ * FIXME: So zero fill the rest?
+ */
+ if (!Valid)
+ {
+ for (i = 0; i < (PAGESIZE / DeviceExt->BytesPerCluster); i++)
+ {
+ Status = VfatRawReadCluster(DeviceExt,
+ FirstCluster,
+ BaseAddress +
+ (i * DeviceExt->BytesPerCluster),
+ *CurrentCluster);
+ if (!NT_SUCCESS(Status))
+ {
+ if (!NoCache)
{
- if (!NoCache)
- {
- CcReleaseCacheSegment(Fcb->RFCB.Bcb, CacheSeg, FALSE);
- }
- return(Status);
+ CcReleaseCacheSegment(Fcb->RFCB.Bcb, CacheSeg, FALSE);
}
- Status = NextCluster(DeviceExt, FirstCluster, CurrentCluster);
- if ((*CurrentCluster) == 0xFFFFFFFF)
+ else if (InternalOffset != 0)
{
- break;
+ ExFreePool(BaseAddress);
}
+ return(Status);
}
- }
- else
- {
- /*
- * Otherwise just move onto the next cluster
- */
- for (i = 0; i < (PAGESIZE / DeviceExt->BytesPerCluster); i++)
+ Status = NextCluster(DeviceExt, FirstCluster, CurrentCluster, FALSE);
+ if ((*CurrentCluster) == 0xFFFFFFFF)
{
- NextCluster(DeviceExt, FirstCluster, CurrentCluster);
- if ((*CurrentCluster) == 0xFFFFFFFF)
- {
- break;
- }
+ break;
}
}
+ }
+ else
+ {
/*
- * Copy the data from the cache to the caller
+ * Otherwise just move onto the next cluster
*/
- memcpy(Destination, BaseAddress + InternalOffset, InternalLength);
- if (!NoCache)
+ for (i = 0; i < (PAGESIZE / DeviceExt->BytesPerCluster); i++)
{
- CcReleaseCacheSegment(Fcb->RFCB.Bcb, CacheSeg, TRUE);
+ NextCluster(DeviceExt, FirstCluster, CurrentCluster, FALSE);
+ if ((*CurrentCluster) == 0xFFFFFFFF)
+ {
+ break;
+ }
}
}
+ /*
+ * Copy the data from the cache to the caller
+ */
+ memcpy(Destination, BaseAddress + InternalOffset, InternalLength);
+ if (!NoCache)
+ {
+ CcReleaseCacheSegment(Fcb->RFCB.Bcb, CacheSeg, TRUE);
+ }
+ else if (InternalOffset != 0)
+ {
+ ExFreePool(BaseAddress);
+ }
+ return(STATUS_SUCCESS);
+}
+
+NTSTATUS
+VfatReadCluster(PDEVICE_EXTENSION DeviceExt,
+ PVFATFCB Fcb,
+ ULONG StartOffset,
+ ULONG FirstCluster,
+ PULONG CurrentCluster,
+ PVOID Destination,
+ ULONG NoCache,
+ ULONG InternalOffset,
+ ULONG InternalLength)
+{
+ if (DeviceExt->BytesPerCluster >= PAGESIZE)
+ {
+ return(VfatReadBigCluster(DeviceExt,
+ Fcb,
+ StartOffset,
+ FirstCluster,
+ CurrentCluster,
+ Destination,
+ NoCache,
+ InternalOffset,
+ InternalLength));
+ }
+ else
+ {
+ return(VfatReadSmallCluster(DeviceExt,
+ Fcb,
+ StartOffset,
+ FirstCluster,
+ CurrentCluster,
+ Destination,
+ NoCache,
+ InternalOffset,
+ InternalLength));
+ }
return(STATUS_SUCCESS);
}
Length = Fcb->entry.FileSize - ReadOffset;
}
}
-
+
+ /*
+ * Select an appropiate size for reads
+ */
if (DeviceExt->BytesPerCluster >= PAGESIZE)
{
ChunkSize = DeviceExt->BytesPerCluster;
Status = OffsetToCluster(DeviceExt,
FirstCluster,
ROUND_DOWN(ReadOffset, ChunkSize),
- &CurrentCluster);
+ &CurrentCluster,
+ FALSE);
if (!NT_SUCCESS(Status))
{
return(Status);
}
/*
- * If the read doesn't begin on a cluster boundary then read a full
- * cluster and copy it.
+ * If the read doesn't begin on a chunk boundary then we need special
+ * handling
*/
if ((ReadOffset % ChunkSize) != 0)
{
TempLength = min (Length, ChunkSize - (ReadOffset % ChunkSize));
- VfatReadCluster(DeviceExt, Fcb,
- ROUND_DOWN(ReadOffset, ChunkSize),
+ VfatReadCluster(DeviceExt, Fcb, ROUND_DOWN(ReadOffset, ChunkSize),
FirstCluster, &CurrentCluster, Buffer, NoCache,
ReadOffset % ChunkSize, TempLength);
VfatReadCluster(DeviceExt, Fcb, ReadOffset,
FirstCluster, &CurrentCluster, Buffer, NoCache, 0,
ChunkSize);
- if (CurrentCluster == 0xffffffff)
- {
- return (STATUS_SUCCESS);
- }
(*LengthRead) = (*LengthRead) + ChunkSize;
Buffer = Buffer + ChunkSize;
return (STATUS_SUCCESS);
}
+NTSTATUS
+VfatWriteBigCluster(PDEVICE_EXTENSION DeviceExt,
+ PVFATFCB Fcb,
+ ULONG StartOffset,
+ ULONG FirstCluster,
+ PULONG CurrentCluster,
+ PVOID Source,
+ ULONG NoCache,
+ ULONG InternalOffset,
+ ULONG InternalLength,
+ BOOLEAN Extend)
+{
+ BOOLEAN Valid;
+ PVOID BaseAddress;
+ PCACHE_SEGMENT CacheSeg;
+ NTSTATUS Status;
+
+ /*
+ * In this case the size of a cache segment is the same as a cluster
+ */
+ if (!NoCache)
+ {
+ Status = CcRequestCacheSegment(Fcb->RFCB.Bcb,
+ StartOffset,
+ &BaseAddress,
+ &Valid,
+ &CacheSeg);
+ if (!NT_SUCCESS(Status))
+ {
+ return(Status);
+ }
+ }
+ else
+ {
+ Valid = FALSE;
+ /*
+ * If we are bypassing the cache and not writing starting on
+ * cluster boundary then allocate a temporary buffer
+ */
+ if (InternalOffset != 0)
+ {
+ BaseAddress = ExAllocatePool(NonPagedPool,
+ DeviceExt->BytesPerCluster);
+ if (BaseAddress == NULL)
+ {
+ return(STATUS_NO_MEMORY);
+ }
+ }
+ }
+ if (!Valid && InternalLength != DeviceExt->BytesPerCluster)
+ {
+ /*
+ * If the data in the cache isn't valid or we are bypassing the
+ * cache and not writing a cluster aligned, cluster sized region
+ * then read data in to base address
+ */
+ Status = VfatRawReadCluster(DeviceExt, FirstCluster, BaseAddress,
+ *CurrentCluster);
+ if (!NT_SUCCESS(Status))
+ {
+ if (!NoCache)
+ {
+ CcReleaseCacheSegment(Fcb->RFCB.Bcb, CacheSeg, FALSE);
+ }
+ else if (InternalOffset != 0)
+ {
+ ExFreePool(BaseAddress);
+ }
+ return(Status);
+ }
+ }
+ if (!NoCache || InternalLength != DeviceExt->BytesPerCluster)
+ {
+ /*
+ * If we are writing into the cache or we are writing from a
+ * temporary buffer then copy the data over
+ */
+ DPRINT1("InternalOffset 0x%x InternalLength 0x%x BA %x Byte1 %c\n",
+ InternalOffset, InternalLength, BaseAddress, *(PUCHAR)Source);
+ memcpy(BaseAddress + InternalOffset, Source, InternalLength);
+ }
+ /*
+ * Write the data back to disk
+ */
+ DPRINT("Writing 0x%x\n", *CurrentCluster);
+ Status = VfatRawWriteCluster(DeviceExt, FirstCluster, BaseAddress,
+ *CurrentCluster);
+ if (!NoCache)
+ {
+ CcReleaseCacheSegment(Fcb->RFCB.Bcb, CacheSeg, TRUE);
+ }
+ else if (InternalOffset != 0)
+ {
+ ExFreePool(BaseAddress);
+ }
+
+ Status = NextCluster(DeviceExt, FirstCluster, CurrentCluster, Extend);
+ if (!NT_SUCCESS(Status))
+ {
+ return(Status);
+ }
+ return(STATUS_SUCCESS);
+}
+
+NTSTATUS
+VfatWriteSmallCluster(PDEVICE_EXTENSION DeviceExt,
+ PVFATFCB Fcb,
+ ULONG StartOffset,
+ ULONG FirstCluster,
+ PULONG CurrentCluster,
+ PVOID Source,
+ ULONG NoCache,
+ ULONG InternalOffset,
+ ULONG InternalLength,
+ BOOLEAN Extend)
+{
+ BOOLEAN Valid;
+ PVOID BaseAddress;
+ PCACHE_SEGMENT CacheSeg;
+ NTSTATUS Status;
+ ULONG NCluster;
+ ULONG i;
+
+ /*
+ * Otherwise we read a page of clusters together
+ */
+
+ if (!NoCache)
+ {
+ Status = CcRequestCacheSegment(Fcb->RFCB.Bcb,
+ StartOffset,
+ &BaseAddress,
+ &Valid,
+ &CacheSeg);
+ if (!NT_SUCCESS(Status))
+ {
+ return(Status);
+ }
+ }
+ else
+ {
+ Valid = FALSE;
+ if (InternalOffset != 0)
+ {
+ BaseAddress = ExAllocatePool(NonPagedPool, PAGESIZE);
+ if (BaseAddress == NULL)
+ {
+ return(STATUS_NO_MEMORY);
+ }
+ }
+ else
+ {
+ BaseAddress = Source;
+ }
+ }
+
+ /*
+ * If necessary read all the data for the page, unfortunately the
+ * file length may not be page aligned in which case the page will
+ * only be partially filled.
+ * FIXME: So zero fill the rest?
+ */
+ if (!Valid || InternalLength != PAGESIZE)
+ {
+ NCluster = *CurrentCluster;
+
+ for (i = 0; i < (PAGESIZE / DeviceExt->BytesPerCluster); i++)
+ {
+ Status = VfatRawReadCluster(DeviceExt,
+ FirstCluster,
+ BaseAddress +
+ (i * DeviceExt->BytesPerCluster),
+ NCluster);
+ if (!NT_SUCCESS(Status))
+ {
+ if (!NoCache)
+ {
+ CcReleaseCacheSegment(Fcb->RFCB.Bcb, CacheSeg, FALSE);
+ }
+ else if (InternalOffset != 0)
+ {
+ ExFreePool(BaseAddress);
+ }
+ return(Status);
+ }
+ Status = NextCluster(DeviceExt, FirstCluster, &NCluster, Extend);
+ if (NCluster == 0xFFFFFFFF)
+ {
+ break;
+ }
+ }
+ }
+ else
+ {
+ /*
+ * Otherwise just move onto the next cluster
+ */
+ for (i = 0; i < (PAGESIZE / DeviceExt->BytesPerCluster); i++)
+ {
+ NextCluster(DeviceExt, FirstCluster, &NCluster, Extend);
+ if (NCluster == 0xFFFFFFFF)
+ {
+ break;
+ }
+ }
+ }
+
+ if (!NoCache || InternalLength != PAGESIZE)
+ {
+ /*
+ * Copy the caller's data if we are using the cache or writing
+ * from temporary buffer
+ */
+ memcpy(BaseAddress + InternalOffset, Source, InternalLength);
+ }
+
+ /*
+ * Write the data to the disk
+ */
+ NCluster = *CurrentCluster;
+
+ for (i = 0; i < (PAGESIZE / DeviceExt->BytesPerCluster); i++)
+ {
+ Status = VfatRawWriteCluster(DeviceExt,
+ FirstCluster,
+ BaseAddress +
+ (i * DeviceExt->BytesPerCluster),
+ NCluster);
+ if (!NT_SUCCESS(Status))
+ {
+ if (!NoCache)
+ {
+ CcReleaseCacheSegment(Fcb->RFCB.Bcb, CacheSeg, FALSE);
+ }
+ else if (InternalOffset != 0)
+ {
+ ExFreePool(BaseAddress);
+ }
+ return(Status);
+ }
+ Status = NextCluster(DeviceExt, FirstCluster, &NCluster, Extend);
+ if (NCluster == 0xFFFFFFFF)
+ {
+ break;
+ }
+ }
+ *CurrentCluster = NCluster;
+
+ if (!NoCache)
+ {
+ CcReleaseCacheSegment(Fcb->RFCB.Bcb, CacheSeg, TRUE);
+ }
+ else if (InternalOffset != 0)
+ {
+ ExFreePool(BaseAddress);
+ }
+ return(STATUS_SUCCESS);
+}
+
+NTSTATUS
+VfatWriteCluster(PDEVICE_EXTENSION DeviceExt,
+ PVFATFCB Fcb,
+ ULONG StartOffset,
+ ULONG FirstCluster,
+ PULONG CurrentCluster,
+ PVOID Source,
+ ULONG NoCache,
+ ULONG InternalOffset,
+ ULONG InternalLength,
+ BOOLEAN Extend)
+{
+
+
+ if (DeviceExt->BytesPerCluster >= PAGESIZE)
+ {
+ return(VfatWriteBigCluster(DeviceExt,
+ Fcb,
+ StartOffset,
+ FirstCluster,
+ CurrentCluster,
+ Source,
+ NoCache,
+ InternalOffset,
+ InternalLength,
+ Extend));
+ }
+ else
+ {
+ return(VfatWriteSmallCluster(DeviceExt,
+ Fcb,
+ StartOffset,
+ FirstCluster,
+ CurrentCluster,
+ Source,
+ NoCache,
+ InternalOffset,
+ InternalLength,
+ Extend));
+ }
+}
+
NTSTATUS
VfatWriteFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
- PVOID Buffer, ULONG Length, ULONG WriteOffset)
+ PVOID Buffer, ULONG Length, ULONG WriteOffset,
+ ULONG NoCache)
/*
* FUNCTION: Writes data to file
*/
{
ULONG CurrentCluster;
- ULONG FileOffset;
ULONG FirstCluster;
PVFATFCB Fcb;
PVFATCCB pCcb;
- PVOID Temp;
- ULONG TempLength, Length2 = Length;
+ ULONG TempLength;
LARGE_INTEGER SystemTime, LocalTime;
+ ULONG ChunkSize;
+ NTSTATUS Status;
+ BOOLEAN Extend;
DPRINT1 ("VfatWriteFile(FileObject %x, Buffer %x, Length %x, "
"WriteOffset %x\n", FileObject, Buffer, Length, WriteOffset);
assert (pCcb);
Fcb = pCcb->pFcb;
assert (Fcb);
+
+ if (DeviceExt->BytesPerCluster >= PAGESIZE)
+ {
+ ChunkSize = DeviceExt->BytesPerCluster;
+ }
+ else
+ {
+ ChunkSize = PAGESIZE;
+ }
+
if (DeviceExt->FatType == FAT32)
{
CurrentCluster =
CurrentCluster = Fcb->entry.FirstCluster;
}
FirstCluster = CurrentCluster;
-
- /* Allocate a buffer to hold 1 cluster of data */
- Temp = ExAllocatePool (NonPagedPool, DeviceExt->BytesPerCluster);
- assert (Temp);
-
+
/* Find the cluster according to the offset in the file */
- if (CurrentCluster == 1)
- {
- CurrentCluster = DeviceExt->rootStart + WriteOffset
- / DeviceExt->BytesPerCluster * DeviceExt->Boot->SectorsPerCluster;
- }
- else
+ if (CurrentCluster == 0)
{
- if (CurrentCluster == 0)
+ /*
+ * File of size zero
+ */
+ Status = NextCluster (DeviceExt, FirstCluster, &CurrentCluster,
+ TRUE);
+ if (DeviceExt->FatType == FAT32)
{
- /*
- * File of size zero
- */
- // CurrentCluster = GetNextWriteCluster (DeviceExt, 0);
- if (DeviceExt->FatType == FAT32)
- {
- Fcb->entry.FirstClusterHigh = CurrentCluster >> 16;
- Fcb->entry.FirstCluster = CurrentCluster;
- }
- else
- Fcb->entry.FirstCluster = CurrentCluster;
+ Fcb->entry.FirstClusterHigh = CurrentCluster >> 16;
+ Fcb->entry.FirstCluster = CurrentCluster;
}
else
{
- for (FileOffset = 0;
- FileOffset < WriteOffset / DeviceExt->BytesPerCluster;
- FileOffset++)
- {
-#if 0
- CurrentCluster =
- GetNextWriteCluster (DeviceExt, CurrentCluster);
-#endif
- }
+ Fcb->entry.FirstCluster = CurrentCluster;
}
- CHECKPOINT;
+ FirstCluster = CurrentCluster;
+ }
+ Status = OffsetToCluster(DeviceExt, FirstCluster, WriteOffset,
+ &CurrentCluster, TRUE);
+
+ if (WriteOffset + Length > Fcb->entry.FileSize &&
+ !(Fcb->entry.Attrib & FILE_ATTRIBUTE_DIRECTORY))
+ {
+ Fcb->entry.FileSize = WriteOffset + Length;
}
/*
* then we have to write only from the specified offset
*/
- if ((WriteOffset % DeviceExt->BytesPerCluster) != 0)
+ if ((WriteOffset % ChunkSize) != 0)
{
- CHECKPOINT;
- TempLength = min (Length, DeviceExt->BytesPerCluster -
- (WriteOffset % DeviceExt->BytesPerCluster));
- /* Read in the existing cluster data */
- if (FirstCluster == 1)
+ TempLength = min (Length, ChunkSize - (WriteOffset % ChunkSize));
+ if ((Length - TempLength) > 0)
{
- /* FIXME: Check status */
- VfatReadSectors (DeviceExt->StorageDevice,
- CurrentCluster,
- DeviceExt->Boot->SectorsPerCluster, Temp);
+ Extend = TRUE;
}
else
{
- VfatRawReadCluster (DeviceExt, FirstCluster, Temp, CurrentCluster);
- }
-
- /* Overwrite the last parts of the data as necessary */
- memcpy (Temp + (WriteOffset % DeviceExt->BytesPerCluster),
- Buffer, TempLength);
-
- /* Write the cluster back */
- Length2 -= TempLength;
- if (FirstCluster == 1)
- {
- VfatWriteSectors (DeviceExt->StorageDevice,
- CurrentCluster,
- DeviceExt->Boot->SectorsPerCluster, Temp);
- CurrentCluster += DeviceExt->Boot->SectorsPerCluster;
- }
- else
- {
- VfatWriteCluster (DeviceExt, Temp, CurrentCluster);
-#if 0
- if (Length2 > 0)
- CurrentCluster = GetNextWriteCluster (DeviceExt, CurrentCluster);
-#endif
+ Extend = FALSE;
}
+ Status = VfatWriteCluster(DeviceExt,
+ Fcb,
+ ROUND_DOWN(WriteOffset, ChunkSize),
+ FirstCluster,
+ &CurrentCluster,
+ Buffer,
+ NoCache,
+ WriteOffset % ChunkSize,
+ TempLength,
+ Extend);
Buffer = Buffer + TempLength;
+ Length = Length - TempLength;
+ WriteOffset = WriteOffset + TempLength;
}
- CHECKPOINT;
-
- /* Write the buffer in chunks of 1 cluster */
- while (Length2 >= DeviceExt->BytesPerCluster)
+ while (Length >= ChunkSize)
{
- CHECKPOINT;
- if (CurrentCluster == 0)
- {
- ExFreePool (Temp);
- return (STATUS_UNSUCCESSFUL);
- }
- Length2 -= DeviceExt->BytesPerCluster;
- if (FirstCluster == 1)
+ if ((Length - ChunkSize) > 0)
{
- VfatWriteSectors (DeviceExt->StorageDevice,
- CurrentCluster,
- DeviceExt->Boot->SectorsPerCluster, Buffer);
- CurrentCluster += DeviceExt->Boot->SectorsPerCluster;
+ Extend = TRUE;
}
else
{
- VfatWriteCluster (DeviceExt, Buffer, CurrentCluster);
-#if 0
- if (Length2 > 0)
- CurrentCluster = GetNextWriteCluster (DeviceExt, CurrentCluster);
-#endif
+ Extend = FALSE;
}
- Buffer = Buffer + DeviceExt->BytesPerCluster;
+ Status = VfatWriteCluster(DeviceExt,
+ Fcb,
+ ROUND_DOWN(WriteOffset, ChunkSize),
+ FirstCluster,
+ &CurrentCluster,
+ Buffer,
+ NoCache,
+ 0,
+ ChunkSize,
+ Extend);
+ Buffer = Buffer + ChunkSize;
+ Length = Length - ChunkSize;
+ WriteOffset = WriteOffset + ChunkSize;
}
- CHECKPOINT;
/* Write the remainder */
-
- if (Length2 > 0)
+ if (Length > 0)
{
- CHECKPOINT;
- if (CurrentCluster == 0)
- {
- ExFreePool (Temp);
- return (STATUS_UNSUCCESSFUL);
- }
- CHECKPOINT;
- /* Read in the existing cluster data */
- if (FirstCluster == 1)
- {
- /* FIXME: Check status */
- VfatReadSectors (DeviceExt->StorageDevice,
- CurrentCluster,
- DeviceExt->Boot->SectorsPerCluster, Temp);
- }
- else
- {
- VfatRawReadCluster (DeviceExt, FirstCluster, Temp, CurrentCluster);
- CHECKPOINT;
- memcpy (Temp, Buffer, Length2);
- CHECKPOINT;
- if (FirstCluster == 1)
- {
- VfatWriteSectors (DeviceExt->StorageDevice,
- CurrentCluster,
- DeviceExt->Boot->SectorsPerCluster, Temp);
- }
- else
- {
- VfatWriteCluster (DeviceExt, Temp, CurrentCluster);
- }
- }
- CHECKPOINT;
+ Status = VfatWriteCluster(DeviceExt,
+ Fcb,
+ ROUND_DOWN(WriteOffset, ChunkSize),
+ FirstCluster,
+ &CurrentCluster,
+ Buffer,
+ NoCache,
+ 0,
+ Length,
+ FALSE);
}
/* set dates and times */
- KeQuerySystemTime (&SystemTime);
- ExSystemTimeToLocalTime (&SystemTime, &LocalTime);
- FsdFileTimeToDosDateTime ((TIME *) & LocalTime,
- &Fcb->entry.UpdateDate, &Fcb->entry.UpdateTime);
- Fcb->entry.AccessDate = Fcb->entry.UpdateDate;
-
- if (Fcb->entry.FileSize < WriteOffset + Length
- && !(Fcb->entry.Attrib & FILE_ATTRIBUTE_DIRECTORY))
+ if (!(Fcb->entry.Attrib & FILE_ATTRIBUTE_DIRECTORY))
{
- Fcb->entry.FileSize = WriteOffset + Length;
- /*
- * update entry in directory
- */
- // updEntry (DeviceExt, FileObject);
+ KeQuerySystemTime (&SystemTime);
+ ExSystemTimeToLocalTime (&SystemTime, &LocalTime);
+ FsdFileTimeToDosDateTime ((TIME*)&LocalTime,
+ &Fcb->entry.UpdateDate,
+ &Fcb->entry.UpdateTime);
+ Fcb->entry.AccessDate = Fcb->entry.UpdateDate;
+ updEntry (DeviceExt, FileObject);
}
- ExFreePool (Temp);
return (STATUS_SUCCESS);
}
PFILE_OBJECT FileObject = Stack->FileObject;
PDEVICE_EXTENSION DeviceExt = DeviceObject->DeviceExtension;
NTSTATUS Status;
+ ULONG NoCache;
DPRINT ("VfatWrite(DeviceObject %x Irp %x)\n", DeviceObject, Irp);
Buffer = MmGetSystemAddressForMdl (Irp->MdlAddress);
Offset = Stack->Parameters.Write.ByteOffset.u.LowPart;
- Status = VfatWriteFile (DeviceExt, FileObject, Buffer, Length, Offset);
+ if (Irp->Flags & IRP_PAGING_IO ||
+ FileObject->Flags & FO_NO_INTERMEDIATE_BUFFERING)
+ {
+ NoCache = TRUE;
+ }
+ else
+ {
+ NoCache = FALSE;
+ }
+
+ Status = VfatWriteFile (DeviceExt, FileObject, Buffer, Length, Offset,
+ NoCache);
Irp->IoStatus.Status = Status;
Irp->IoStatus.Information = Length;
-/* $Id: vfat.h,v 1.23 2001/01/14 15:05:53 dwelch Exp $ */
+/* $Id: vfat.h,v 1.24 2001/01/16 09:55:02 dwelch Exp $ */
#include <ddk/ntifs.h>
PDEVICE_OBJECT StorageDevice;
PFILE_OBJECT StreamStorageDevice;
PBCB StorageBcb;
+ PFILE_OBJECT Fat12StorageDevice;
+ PBCB Fat12StorageBcb;
BootSector *Boot;
int rootDirectorySectors, FATStart, rootStart, dataStart;
int FATEntriesPerSector, FATUnit;
VfatQueryInformation(PDEVICE_OBJECT DeviceObject, PIRP Irp);
+NTSTATUS
+NextCluster(PDEVICE_EXTENSION DeviceExt,
+ ULONG FirstCluster,
+ PULONG CurrentCluster,
+ BOOLEAN Extend);
+
/* internal functions in blockdev.c */
NTSTATUS
VfatReadSectors(IN PDEVICE_OBJECT pDeviceObject,
PULONG LengthRead, ULONG NoCache);
NTSTATUS
VfatWriteFile(PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
- PVOID Buffer, ULONG Length, ULONG WriteOffset);
+ PVOID Buffer, ULONG Length, ULONG WriteOffset, ULONG NoCache);
NTSTATUS
-GetNextWriteCluster(PDEVICE_EXTENSION DeviceExt, ULONG CurrentCluster,
+GetNextWriteCluster(PDEVICE_EXTENSION DeviceExt,
+ ULONG FirstCluster,
+ ULONG CurrentCluster,
PULONG NextCluster);
BOOLEAN
IsDeletedEntry(PVOID Block, ULONG Offset);
wchar_t*
vfat_wcsncpy(wchar_t * dest, const wchar_t *src,size_t wcount);
NTSTATUS
-VfatWriteCluster(PDEVICE_EXTENSION DeviceExt, PVOID Buffer, ULONG Cluster);
+VfatRawWriteCluster(PDEVICE_EXTENSION DeviceExt,
+ ULONG FirstCluster, PVOID Buffer, ULONG Cluster);
/* internal functions in dirwr.c */
NTSTATUS
NTSTATUS
GetNextCluster(PDEVICE_EXTENSION DeviceExt,
ULONG CurrentCluster,
- PULONG NextCluster);
+ PULONG NextCluster,
+ BOOLEAN Extend);
NTSTATUS
VfatRawReadCluster (PDEVICE_EXTENSION DeviceExt,
ULONG FirstCluster,
*/
NTSTATUS
ReadVolumeLabel(PDEVICE_EXTENSION DeviceExt, PVPB Vpb);
+NTSTATUS
+VfatOpenFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
+ PWSTR FileName);
/*
* functions from shutdown.c
cp services/dd/vga/display/vgaddi.dll $1/reactos/system32/drivers
cp services/dd/vidport/vidport.sys $1/reactos/system32/drivers
cp services/fs/minix/minixfs.sys $1/reactos/system32/drivers
-cp apps/shell/shell.exe $1/reactos/system32
+cp apps/system/shell/shell.exe $1/reactos/system32
cp lib/ntdll/ntdll.dll $1/reactos/system32
cp lib/kernel32/kernel32.dll $1/reactos/system32
cp lib/crtdll/crtdll.dll $1/reactos/system32
-/* $Id: rw.c,v 1.14 2000/10/11 20:50:31 dwelch Exp $
+/* $Id: rw.c,v 1.15 2001/01/16 09:55:02 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
PIO_STATUS_BLOCK IoStatusBlock;
PLARGE_INTEGER ptrOffset;
- DbgPrint("ReadFile(hFile %x)\n", hFile);
-
if (IsConsoleHandle(hFile))
{
return(ReadConsoleA(hFile,
MmPageArray[i].SavedSwapEntry = 0;
InsertTailList(&UsedPageListHead, &MmPageArray[i].ListEntry);
}
+ KeReleaseSpinLock(&PageListLock, oldIrql);
return((PVOID)(start * 4096));
}
endif
CC = $(PREFIX)gcc
+CXX = $(PREFIX)g++
HOST_CC = gcc
HOST_NM = nm
CFLAGS := $(CFLAGS) -I$(PATH_TO_TOP)/include -pipe