Make vfatfs compile using VC6.

Patch by Mike Nordell.

svn path=/trunk/; revision=5252
This commit is contained in:
Casper Hornstrup 2003-07-24 19:00:42 +00:00
parent f312ea4371
commit 2b7294bcd1
24 changed files with 166 additions and 102 deletions

View file

@ -11,7 +11,9 @@
#include <ddk/ntddk.h>
#ifndef NDEBUG
#define NDEBUG
#endif
#include <debug.h>
#include "vfat.h"

View file

@ -1,4 +1,4 @@
/* $Id: cleanup.c,v 1.11 2003/02/13 22:24:16 hbirr Exp $
/* $Id: cleanup.c,v 1.12 2003/07/24 19:00:42 chorns Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -11,7 +11,9 @@
#include <ddk/ntddk.h>
#ifndef NDEBUG
#define NDEBUG
#endif
#include <debug.h>
#include "vfat.h"
@ -61,7 +63,7 @@ NTSTATUS VfatCleanup (PVFAT_IRP_CONTEXT IrpContext)
{
NTSTATUS Status;
DPRINT("VfatCleanup(DeviceObject %x, Irp %x)\n", DeviceObject, Irp);
DPRINT("VfatCleanup(DeviceObject %x, Irp %x)\n", IrpContext->DeviceObject, IrpContext->Irp);
if (IrpContext->DeviceObject == VfatGlobalData->DeviceObject)
{
@ -69,7 +71,8 @@ NTSTATUS VfatCleanup (PVFAT_IRP_CONTEXT IrpContext)
goto ByeBye;
}
if (!ExAcquireResourceExclusiveLite (&IrpContext->DeviceExt->DirResource, IrpContext->Flags & IRPCONTEXT_CANWAIT))
if (!ExAcquireResourceExclusiveLite (&IrpContext->DeviceExt->DirResource,
(BOOLEAN)(IrpContext->Flags & IRPCONTEXT_CANWAIT)))
{
return VfatQueueRequest (IrpContext);
}

View file

@ -1,4 +1,4 @@
/* $Id: close.c,v 1.18 2003/06/07 11:34:36 chorns Exp $
/* $Id: close.c,v 1.19 2003/07/24 19:00:42 chorns Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -11,7 +11,9 @@
#include <ddk/ntddk.h>
#ifndef NDEBUG
#define NDEBUG
#endif
#include <debug.h>
#include "vfat.h"
@ -84,7 +86,7 @@ NTSTATUS VfatClose (PVFAT_IRP_CONTEXT IrpContext)
{
NTSTATUS Status;
DPRINT ("VfatClose(DeviceObject %x, Irp %x)\n", DeviceObject, Irp);
DPRINT ("VfatClose(DeviceObject %x, Irp %x)\n", IrpContext->DeviceObject, IrpContext->Irp);
if (IrpContext->DeviceObject == VfatGlobalData->DeviceObject)
{

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: create.c,v 1.61 2003/07/09 19:59:21 hbirr Exp $
/* $Id: create.c,v 1.62 2003/07/24 19:00:42 chorns Exp $
*
* PROJECT: ReactOS kernel
* FILE: services/fs/vfat/create.c
@ -31,7 +31,9 @@
#include <wchar.h>
#include <limits.h>
#ifndef NDEBUG
#define NDEBUG
#endif
#include <debug.h>
#include "vfat.h"
@ -185,7 +187,6 @@ FindFile (PDEVICE_EXTENSION DeviceExt,
ULONG len;
ULONG DirIndex;
ULONG FirstCluster;
ULONG Read;
BOOL isRoot;
PVOID Context = NULL;
PVOID Page;
@ -609,7 +610,7 @@ VfatCreateFile (PDEVICE_OBJECT DeviceObject, PIRP Irp)
ULONG Attributes;
Attributes = Stack->Parameters.Create.FileAttributes;
Status = VfatAddEntry (DeviceExt, FileObject, RequestedOptions,
Attributes & FILE_ATTRIBUTE_VALID_FLAGS);
(UCHAR)(Attributes & FILE_ATTRIBUTE_VALID_FLAGS));
if (NT_SUCCESS (Status))
{
pFcb = FileObject->FsContext;
@ -769,7 +770,7 @@ NTSTATUS VfatCreate (PVFAT_IRP_CONTEXT IrpContext)
IrpContext->Irp->IoStatus.Status = Status;
IoCompleteRequest (IrpContext->Irp,
NT_SUCCESS(Status) ? IO_DISK_INCREMENT : IO_NO_INCREMENT);
(CCHAR)(NT_SUCCESS(Status) ? IO_DISK_INCREMENT : IO_NO_INCREMENT));
VfatFreeIrpContext(IrpContext);
return(Status);
}

View file

@ -1,5 +1,5 @@
/*
* $Id: dir.c,v 1.28 2003/02/13 22:24:16 hbirr Exp $
* $Id: dir.c,v 1.29 2003/07/24 19:00:42 chorns Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -13,7 +13,9 @@
#include <ddk/ntddk.h>
#include <wchar.h>
#ifndef NDEBUG
#define NDEBUG
#endif
#include <debug.h>
#include "vfat.h"
@ -211,7 +213,8 @@ NTSTATUS DoQuery (PVFAT_IRP_CONTEXT IrpContext)
pCcb = (PVFATCCB) IrpContext->FileObject->FsContext2;
pFcb = (PVFATFCB) IrpContext->FileObject->FsContext;
if (!ExAcquireResourceSharedLite(&pFcb->MainResource, IrpContext->Flags & IRPCONTEXT_CANWAIT))
if (!ExAcquireResourceSharedLite(&pFcb->MainResource,
(BOOLEAN)(IrpContext->Flags & IRPCONTEXT_CANWAIT)))
{
return STATUS_PENDING;
}

View file

@ -1,4 +1,4 @@
/* $Id: direntry.c,v 1.12 2002/12/22 11:26:01 gvg Exp $
/* $Id: direntry.c,v 1.13 2003/07/24 19:00:42 chorns Exp $
*
*
* FILE: DirEntry.c
@ -15,7 +15,9 @@
#include <wchar.h>
#include <limits.h>
#ifndef NDEBUG
#define NDEBUG
#endif
#include <debug.h>
#include "vfat.h"

View file

@ -1,4 +1,4 @@
/* $Id: dirwr.c,v 1.36 2003/05/11 09:51:26 hbirr Exp $
/* $Id: dirwr.c,v 1.37 2003/07/24 19:00:42 chorns Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -14,7 +14,9 @@
#include <wchar.h>
#include <string.h>
#ifndef NDEBUG
#define NDEBUG
#endif
#include <debug.h>
#include "vfat.h"
@ -42,8 +44,10 @@ VfatUpdateEntry (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT pFileObject)
PVFATFCB pDirFcb, pFcb;
LARGE_INTEGER Offset;
/*
DPRINT ("updEntry PathFileName \'%S\'\n",
((PVFATCCB)(pFileObject->FsContext2))->pFcb->PathName);
*/
pFcb = (PVFATFCB)pFileObject->FsContext;
assert (pFcb);
@ -144,8 +148,8 @@ findDirSpace(PDEVICE_EXTENSION DeviceExt,
return FALSE;
}
// clear the new dir cluster
FileOffset.u.LowPart = pDirFcb->RFCB.FileSize.QuadPart -
DeviceExt->FatInfo.BytesPerCluster;
FileOffset.u.LowPart = (DWORD)(pDirFcb->RFCB.FileSize.QuadPart -
DeviceExt->FatInfo.BytesPerCluster);
CcMapData (pDirFcb->FileObject, &FileOffset, DeviceExt->FatInfo.BytesPerCluster,
TRUE, &Context, (PVOID*)&pFatEntry);
RtlZeroMemory(pFatEntry, DeviceExt->FatInfo.BytesPerCluster);
@ -202,7 +206,7 @@ VfatAddEntry (PDEVICE_EXTENSION DeviceExt,
{
if (PathFileName[i] == L'\\')
{
posCar = i;
posCar = (short)i;
}
}
if (posCar == -1)
@ -243,7 +247,7 @@ VfatAddEntry (PDEVICE_EXTENSION DeviceExt,
{
if (FileName[i] == '.')
{
posCar = i;
posCar = (short)i;
if (i == j)
{
j++;
@ -252,11 +256,11 @@ VfatAddEntry (PDEVICE_EXTENSION DeviceExt,
}
if (!posCar)
{
posCar = i;
posCar = (short)i;
}
if (posCar < j)
{
posCar = i;
posCar = (short)i;
needTilde = TRUE;
}
if (posCar > 8)
@ -332,8 +336,8 @@ VfatAddEntry (PDEVICE_EXTENSION DeviceExt,
//try first with xxxxxx~y.zzz
for (i = 1; i < 10; i++)
{
DirName[posCar-1] = '0' + i;
pEntry->Filename[posCar - 1] = '0' + i;
DirName[posCar-1] = (WCHAR)('0' + i);
pEntry->Filename[posCar - 1] = (unsigned char)('0' + i);
Status = FindFile (DeviceExt, &FileFcb, pDirFcb, DirName, NULL, NULL);
if (!NT_SUCCESS(Status))
{
@ -473,7 +477,7 @@ VfatAddEntry (PDEVICE_EXTENSION DeviceExt,
if (needLong)
{
// calculate checksum for 8.3 name
for (pSlots[0].alias_checksum = i = 0; i < 11; i++)
for (pSlots[0].alias_checksum = 0, i = 0; i < 11; i++)
{
pSlots[0].alias_checksum = (((pSlots[0].alias_checksum & 1) << 7
| ((pSlots[0].alias_checksum & 0xfe) >> 1))
@ -523,9 +527,9 @@ VfatAddEntry (PDEVICE_EXTENSION DeviceExt,
}
if (DeviceExt->FatInfo.FatType == FAT32)
{
pEntry->FirstClusterHigh = CurrentCluster >> 16;
pEntry->FirstClusterHigh = (unsigned short)(CurrentCluster >> 16);
}
pEntry->FirstCluster = CurrentCluster;
pEntry->FirstCluster = (unsigned short)CurrentCluster;
}
size = DeviceExt->FatInfo.BytesPerCluster / sizeof(FATDirEntry);
@ -554,7 +558,7 @@ VfatAddEntry (PDEVICE_EXTENSION DeviceExt,
CcMapData (pDirFcb->FileObject, &FileOffset,
nbSlots * sizeof(FATDirEntry) - size,
TRUE, &Context, (PVOID*)&pFatEntry);
memcpy(pFatEntry, (PVOID)Buffer + size, nbSlots * sizeof(FATDirEntry) - size);
memcpy(pFatEntry, (PVOID)(Buffer + size), nbSlots * sizeof(FATDirEntry) - size);
}
CcSetDirtyPinnedData(Context, NULL);
CcUnpinData(Context);
@ -616,8 +620,7 @@ delEntry (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT pFileObject)
PVFATFCB pFcb = NULL, pDirFcb = NULL;
NTSTATUS status;
PWSTR pName;
ULONG Entry = 0, startEntry, Read, CurrentCluster, NextCluster, i;
FATDirEntry DirEntry;
ULONG Entry = 0, startEntry, CurrentCluster, NextCluster, i;
DPRINT ("delEntry PathFileName \'%S\'\n", pFileObject->FileName.Buffer);

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: ea.c,v 1.1 2002/08/14 20:58:31 dwelch Exp $
/* $Id: ea.c,v 1.2 2003/07/24 19:00:42 chorns Exp $
*
* PROJECT: ReactOS kernel
* FILE: services/fs/vfat/ea.c
@ -31,7 +31,9 @@
#include <wchar.h>
#include <limits.h>
#ifndef NDEBUG
#define NDEBUG
#endif
#include <debug.h>
#include "vfat.h"

View file

@ -1,5 +1,5 @@
/*
* $Id: fat.c,v 1.41 2003/01/04 02:07:18 hbirr Exp $
* $Id: fat.c,v 1.42 2003/07/24 19:00:42 chorns Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -15,7 +15,9 @@
#include <wchar.h>
#include <ntos/minmax.h>
#ifndef NDEBUG
#define NDEBUG
#endif
#include <debug.h>
#include "vfat.h"
@ -39,7 +41,6 @@ Fat32GetNextCluster(PDEVICE_EXTENSION DeviceExt,
*/
{
PVOID BaseAddress;
NTSTATUS Status;
ULONG FATOffset;
ULONG ChunkSize;
PVOID Context;
@ -52,7 +53,7 @@ Fat32GetNextCluster(PDEVICE_EXTENSION DeviceExt,
{
return STATUS_UNSUCCESSFUL;
}
CurrentCluster = (*(PULONG)(BaseAddress + (FATOffset % ChunkSize))) & 0x0fffffff;
CurrentCluster = (*(PULONG)((char*)BaseAddress + (FATOffset % ChunkSize))) & 0x0fffffff;
if (CurrentCluster >= 0xffffff8 && CurrentCluster <= 0xfffffff)
CurrentCluster = 0xffffffff;
CcUnpinData(Context);
@ -69,7 +70,6 @@ Fat16GetNextCluster(PDEVICE_EXTENSION DeviceExt,
*/
{
PVOID BaseAddress;
NTSTATUS Status;
ULONG FATOffset;
ULONG ChunkSize;
PVOID Context;
@ -82,7 +82,7 @@ Fat16GetNextCluster(PDEVICE_EXTENSION DeviceExt,
{
return STATUS_UNSUCCESSFUL;
}
CurrentCluster = *((PUSHORT)(BaseAddress + (FATOffset % ChunkSize)));
CurrentCluster = *((PUSHORT)((char*)BaseAddress + (FATOffset % ChunkSize)));
if (CurrentCluster >= 0xfff8 && CurrentCluster <= 0xffff)
CurrentCluster = 0xffffffff;
CcUnpinData(Context);
@ -99,9 +99,7 @@ Fat12GetNextCluster(PDEVICE_EXTENSION DeviceExt,
*/
{
PUSHORT CBlock;
ULONG FATOffset;
ULONG Entry;
NTSTATUS Status;
PVOID BaseAddress;
PVOID Context;
LARGE_INTEGER Offset;
@ -114,7 +112,7 @@ Fat12GetNextCluster(PDEVICE_EXTENSION DeviceExt,
{
return STATUS_UNSUCCESSFUL;
}
CBlock = (PUSHORT)(BaseAddress + (CurrentCluster * 12) / 8);
CBlock = (PUSHORT)((char*)BaseAddress + (CurrentCluster * 12) / 8);
if ((CurrentCluster % 2) == 0)
{
Entry = *CBlock & 0x0fff;
@ -143,7 +141,6 @@ FAT16FindAvailableCluster(PDEVICE_EXTENSION DeviceExt,
ULONG FatLength;
ULONG StartCluster;
ULONG i, j;
NTSTATUS Status;
PVOID BaseAddress;
ULONG ChunkSize;
PVOID Context = 0;
@ -173,7 +170,7 @@ FAT16FindAvailableCluster(PDEVICE_EXTENSION DeviceExt,
return STATUS_UNSUCCESSFUL;
}
CHECKPOINT;
Block = (PUSHORT)(BaseAddress + i % ChunkSize);
Block = (PUSHORT)((char*)BaseAddress + i % ChunkSize);
}
if (*Block == 0)
@ -202,13 +199,11 @@ FAT12FindAvailableCluster(PDEVICE_EXTENSION DeviceExt, PULONG Cluster)
*/
{
ULONG FatLength;
ULONG FATOffset;
ULONG StartCluster;
ULONG Entry;
PUSHORT CBlock;
ULONG i, j;
PVOID BaseAddress;
NTSTATUS Status;
PVOID Context;
LARGE_INTEGER Offset;
@ -226,7 +221,7 @@ FAT12FindAvailableCluster(PDEVICE_EXTENSION DeviceExt, PULONG Cluster)
{
for (i = StartCluster; i < FatLength; i++)
{
CBlock = (PUSHORT)(BaseAddress + (i * 12) / 8);
CBlock = (PUSHORT)((char*)BaseAddress + (i * 12) / 8);
if ((i % 2) == 0)
{
Entry = *CBlock & 0xfff;
@ -259,7 +254,6 @@ FAT32FindAvailableCluster (PDEVICE_EXTENSION DeviceExt, PULONG Cluster)
ULONG FatLength;
ULONG StartCluster;
ULONG i, j;
NTSTATUS Status;
PVOID BaseAddress;
ULONG ChunkSize;
PVOID Context = 0;
@ -287,7 +281,7 @@ FAT32FindAvailableCluster (PDEVICE_EXTENSION DeviceExt, PULONG Cluster)
DPRINT1("CcMapData(Offset %x, Length %d) failed\n", (ULONG)Offset.QuadPart, ChunkSize);
return STATUS_UNSUCCESSFUL;
}
Block = (PULONG)(BaseAddress + i % ChunkSize);
Block = (PULONG)((char*)BaseAddress + i % ChunkSize);
}
if ((*Block & 0x0fffffff) == 0)
@ -316,12 +310,10 @@ FAT12CountAvailableClusters(PDEVICE_EXTENSION DeviceExt)
* FUNCTION: Counts free cluster in a FAT12 table
*/
{
ULONG FATOffset;
ULONG Entry;
PVOID BaseAddress;
ULONG ulCount = 0;
ULONG i;
NTSTATUS Status;
ULONG numberofclusters;
LARGE_INTEGER Offset;
PVOID Context;
@ -337,7 +329,7 @@ FAT12CountAvailableClusters(PDEVICE_EXTENSION DeviceExt)
for (i = 2; i < numberofclusters; i++)
{
CBlock = (PUSHORT)(BaseAddress + (i * 12) / 8);
CBlock = (PUSHORT)((char*)BaseAddress + (i * 12) / 8);
if ((i % 2) == 0)
{
Entry = *CBlock & 0x0fff;
@ -369,7 +361,6 @@ FAT16CountAvailableClusters(PDEVICE_EXTENSION DeviceExt)
ULONG ulCount = 0;
ULONG i;
ULONG ChunkSize;
NTSTATUS Status;
PVOID Context = NULL;
LARGE_INTEGER Offset;
ULONG FatLength;
@ -391,7 +382,7 @@ FAT16CountAvailableClusters(PDEVICE_EXTENSION DeviceExt)
{
return STATUS_UNSUCCESSFUL;
}
Block = (PUSHORT)(BaseAddress + i % ChunkSize);
Block = (PUSHORT)((char*)BaseAddress + i % ChunkSize);
}
if (*Block == 0)
ulCount++;
@ -416,7 +407,6 @@ FAT32CountAvailableClusters(PDEVICE_EXTENSION DeviceExt)
ULONG ulCount = 0;
ULONG i;
ULONG ChunkSize;
NTSTATUS Status;
PVOID Context = NULL;
LARGE_INTEGER Offset;
ULONG FatLength;
@ -437,7 +427,7 @@ FAT32CountAvailableClusters(PDEVICE_EXTENSION DeviceExt)
{
return STATUS_UNSUCCESSFUL;
}
Block = (PULONG)(BaseAddress + i % ChunkSize);
Block = (PULONG)((char*)BaseAddress + i % ChunkSize);
}
if ((*Block & 0x0fffffff) == 0)
ulCount++;
@ -487,8 +477,6 @@ FAT12WriteCluster(PDEVICE_EXTENSION DeviceExt,
ULONG FATsector;
ULONG FATOffset;
PUCHAR CBlock;
int i;
NTSTATUS Status;
PVOID BaseAddress;
PVOID Context;
LARGE_INTEGER Offset;
@ -506,7 +494,7 @@ FAT12WriteCluster(PDEVICE_EXTENSION DeviceExt,
if ((ClusterToWrite % 2) == 0)
{
*OldValue = CBlock[FATOffset] + ((CBlock[FATOffset + 1] & 0x0f) << 8);
CBlock[FATOffset] = NewValue;
CBlock[FATOffset] = (UCHAR)NewValue;
CBlock[FATOffset + 1] &= 0xf0;
CBlock[FATOffset + 1] |= (NewValue & 0xf00) >> 8;
}
@ -515,7 +503,7 @@ FAT12WriteCluster(PDEVICE_EXTENSION DeviceExt,
*OldValue = (CBlock[FATOffset] >> 4) + (CBlock[FATOffset + 1] << 4);
CBlock[FATOffset] &= 0x0f;
CBlock[FATOffset] |= (NewValue & 0xf) << 4;
CBlock[FATOffset + 1] = NewValue >> 4;
CBlock[FATOffset + 1] = (UCHAR)(NewValue >> 4);
}
/* Write the changed FAT sector(s) to disk */
FATsector = FATOffset / DeviceExt->FatInfo.BytesPerSector;
@ -534,9 +522,7 @@ FAT16WriteCluster(PDEVICE_EXTENSION DeviceExt,
*/
{
PVOID BaseAddress;
NTSTATUS Status;
ULONG FATOffset;
ULONG i;
ULONG ChunkSize;
PVOID Context;
LARGE_INTEGER Offset;
@ -551,9 +537,9 @@ FAT16WriteCluster(PDEVICE_EXTENSION DeviceExt,
}
DPRINT("Writing 0x%x for offset 0x%x 0x%x\n", NewValue, FATOffset,
ClusterToWrite);
Cluster = ((PUSHORT)(BaseAddress + (FATOffset % ChunkSize)));
Cluster = ((PUSHORT)((char*)BaseAddress + (FATOffset % ChunkSize)));
*OldValue = *Cluster;
*Cluster = NewValue;
*Cluster = (USHORT)NewValue;
CcSetDirtyPinnedData(Context, NULL);
CcUnpinData(Context);
return(STATUS_SUCCESS);
@ -569,9 +555,7 @@ FAT32WriteCluster(PDEVICE_EXTENSION DeviceExt,
*/
{
PVOID BaseAddress;
NTSTATUS Status;
ULONG FATOffset;
ULONG i;
ULONG ChunkSize;
PVOID Context;
LARGE_INTEGER Offset;
@ -587,7 +571,7 @@ FAT32WriteCluster(PDEVICE_EXTENSION DeviceExt,
}
DPRINT("Writing 0x%x for offset 0x%x 0x%x\n", NewValue, FATOffset,
ClusterToWrite);
Cluster = ((PULONG)(BaseAddress + (FATOffset % ChunkSize)));
Cluster = ((PULONG)((char*)BaseAddress + (FATOffset % ChunkSize)));
*OldValue = *Cluster & 0x0fffffff;
*Cluster = (*Cluster & 0xf0000000) | (NewValue & 0x0fffffff);

View file

@ -1,4 +1,4 @@
/* $Id: fcb.c,v 1.30 2003/07/21 21:53:47 royce Exp $
/* $Id: fcb.c,v 1.31 2003/07/24 19:00:42 chorns Exp $
*
*
* FILE: fcb.c
@ -15,7 +15,9 @@
#include <wchar.h>
#include <limits.h>
#ifndef NDEBUG
#define NDEBUG
#endif
#include <debug.h>
#include "vfat.h"
@ -205,12 +207,9 @@ vfatGrabFCBFromTable(PDEVICE_EXTENSION pVCB, PWSTR pFileName)
{
KIRQL oldIrql;
PVFATFCB rcFCB;
PLIST_ENTRY current_entry;
ULONG Hash;
PWCHAR ObjectName = NULL;
ULONG len;
ULONG index;
ULONG currentindex;
HASHENTRY* entry;
@ -323,8 +322,8 @@ vfatMakeRootFCB(PDEVICE_EXTENSION pVCB)
if (pVCB->FatInfo.FatType == FAT32)
{
CurrentCluster = FirstCluster = pVCB->FatInfo.RootCluster;
FCB->entry.FirstCluster = FirstCluster & 0xffff;
FCB->entry.FirstClusterHigh = FirstCluster >> 16;
FCB->entry.FirstCluster = (unsigned short)(FirstCluster & 0xffff);
FCB->entry.FirstClusterHigh = (unsigned short)(FirstCluster >> 16);
while (CurrentCluster != 0xffffffff && NT_SUCCESS(Status))
{
@ -449,7 +448,6 @@ vfatAttachFCBToFileObject (PDEVICE_EXTENSION vcb,
PVFATFCB fcb,
PFILE_OBJECT fileObject)
{
NTSTATUS status;
PVFATCCB newCCB;
newCCB = ExAllocateFromNPagedLookasideList(&VfatGlobalData->CcbLookasideList);

View file

@ -1,4 +1,4 @@
/* $Id: finfo.c,v 1.30 2003/06/07 11:34:36 chorns Exp $
/* $Id: finfo.c,v 1.31 2003/07/24 19:00:42 chorns Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -13,7 +13,9 @@
#include <ddk/ntddk.h>
#include <wchar.h>
#ifndef NDEBUG
#define NDEBUG
#endif
#include <debug.h>
#include "vfat.h"
@ -110,13 +112,13 @@ VfatSetBasicInformation(PFILE_OBJECT FileObject,
&(FCB->entry.UpdateDate),
&(FCB->entry.UpdateTime));
FCB->entry.Attrib = (FCB->entry.Attrib &
FCB->entry.Attrib = (unsigned char)((FCB->entry.Attrib &
(FILE_ATTRIBUTE_DIRECTORY | 0x48)) |
(BasicInfo->FileAttributes &
(FILE_ATTRIBUTE_ARCHIVE |
FILE_ATTRIBUTE_SYSTEM |
FILE_ATTRIBUTE_HIDDEN |
FILE_ATTRIBUTE_READONLY));
FILE_ATTRIBUTE_READONLY)));
DPRINT("Setting attributes 0x%02x\n", FCB->entry.Attrib);
VfatUpdateEntry(DeviceExt, FileObject);
@ -393,7 +395,7 @@ VOID UpdateFileSize(PFILE_OBJECT FileObject, PVFATFCB Fcb, ULONG Size, ULONG Clu
}
else
{
Fcb->RFCB.AllocationSize.QuadPart = 0LL;
Fcb->RFCB.AllocationSize.QuadPart = (LONGLONG)0;
}
if (!vfatFCBIsDirectory(Fcb))
{
@ -416,7 +418,6 @@ VfatSetAllocationSizeInformation(PFILE_OBJECT FileObject,
{
ULONG OldSize;
ULONG Cluster, FirstCluster;
ULONG Offset;
NTSTATUS Status;
ULONG ClusterSize = DeviceExt->FatInfo.BytesPerCluster;
@ -467,8 +468,8 @@ VfatSetAllocationSizeInformation(PFILE_OBJECT FileObject,
}
return STATUS_DISK_FULL;
}
Fcb->entry.FirstCluster = (FirstCluster & 0x0000FFFF);
Fcb->entry.FirstClusterHigh = (FirstCluster & 0xFFFF0000) >> 16;
Fcb->entry.FirstCluster = (unsigned short)(FirstCluster & 0x0000FFFF);
Fcb->entry.FirstClusterHigh = (unsigned short)((FirstCluster & 0xFFFF0000) >> 16);
}
else
{
@ -560,7 +561,8 @@ NTSTATUS VfatQueryInformation(PVFAT_IRP_CONTEXT IrpContext)
if (!(FCB->Flags & FCB_IS_PAGE_FILE))
{
if (!ExAcquireResourceSharedLite(&FCB->MainResource, IrpContext->Flags & IRPCONTEXT_CANWAIT))
if (!ExAcquireResourceSharedLite(&FCB->MainResource,
(BOOLEAN)(IrpContext->Flags & IRPCONTEXT_CANWAIT)))
{
return VfatQueueRequest (IrpContext);
}
@ -662,7 +664,8 @@ NTSTATUS VfatSetInformation(PVFAT_IRP_CONTEXT IrpContext)
if (!(FCB->Flags & FCB_IS_PAGE_FILE))
{
if (!ExAcquireResourceExclusiveLite(&FCB->MainResource, CanWait))
if (!ExAcquireResourceExclusiveLite(&FCB->MainResource,
(BOOLEAN)CanWait))
{
return(VfatQueueRequest (IrpContext));
}

View file

@ -1,4 +1,4 @@
/* $Id: flush.c,v 1.2 2003/02/13 22:24:17 hbirr Exp $
/* $Id: flush.c,v 1.3 2003/07/24 19:00:42 chorns Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -12,7 +12,9 @@
#include <ddk/ntddk.h>
#include "vfat.h"
#ifndef NDEBUG
#define NDEBUG
#endif
#include <debug.h>
/* FUNCTIONS ****************************************************************/

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: fsctl.c,v 1.18 2003/07/21 21:53:47 royce Exp $
/* $Id: fsctl.c,v 1.19 2003/07/24 19:00:42 chorns Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -29,7 +29,9 @@
#include <ddk/ntddk.h>
#include <wchar.h>
#ifndef NDEBUG
#define NDEBUG
#endif
#include <debug.h>
#include "vfat.h"
@ -211,7 +213,6 @@ VfatMount (PVFAT_IRP_CONTEXT IrpContext)
PVFATFCB Fcb = NULL;
PVFATFCB VolumeFcb = NULL;
PVFATCCB Ccb = NULL;
LARGE_INTEGER timeout;
PDEVICE_OBJECT DeviceToMount;
DPRINT("VfatMount(IrpContext %x)\n", IrpContext);

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: iface.c,v 1.68 2003/02/09 18:02:55 hbirr Exp $
/* $Id: iface.c,v 1.69 2003/07/24 19:00:42 chorns Exp $
*
* PROJECT: ReactOS kernel
* FILE: services/fs/vfat/iface.c
@ -28,7 +28,9 @@
#include <ddk/ntddk.h>
#ifndef NDEBUG
#define NDEBUG
#endif
#include <debug.h>
#include "vfat.h"

View file

@ -1,4 +1,4 @@
/* $Id: misc.c,v 1.8 2003/07/10 11:03:51 chorns Exp $
/* $Id: misc.c,v 1.9 2003/07/24 19:00:42 chorns Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -13,7 +13,9 @@
#include <ddk/ntddk.h>
#include <wchar.h>
#ifndef NDEBUG
#define NDEBUG
#endif
#include <debug.h>
#include "vfat.h"
@ -57,7 +59,7 @@ NTSTATUS VfatLockControl(
Fail:;
IrpContext->Irp->IoStatus.Status = Status;
IofCompleteRequest(IrpContext->Irp, NT_SUCCESS(Status) ? IO_DISK_INCREMENT : IO_NO_INCREMENT);
IofCompleteRequest(IrpContext->Irp, (CCHAR)(NT_SUCCESS(Status) ? IO_DISK_INCREMENT : IO_NO_INCREMENT));
VfatFreeIrpContext(IrpContext);
return Status;
}
@ -152,7 +154,7 @@ VOID VfatFreeIrpContext (PVFAT_IRP_CONTEXT IrpContext)
PVFAT_IRP_CONTEXT VfatAllocateIrpContext(PDEVICE_OBJECT DeviceObject, PIRP Irp)
{
PVFAT_IRP_CONTEXT IrpContext;
PIO_STACK_LOCATION Stack;
/*PIO_STACK_LOCATION Stack;*/
UCHAR MajorFunction;
DPRINT ("VfatAllocateIrpContext(DeviceObject %x, Irp %x)\n", DeviceObject, Irp);

View file

@ -1,5 +1,5 @@
/* $Id: rw.c,v 1.57 2003/07/21 21:53:47 royce Exp $
/* $Id: rw.c,v 1.58 2003/07/24 19:00:42 chorns Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -15,7 +15,9 @@
#include <wchar.h>
#include <ntos/minmax.h>
#ifndef NDEBUG
#define NDEBUG
#endif
#include <debug.h>
#include "vfat.h"
@ -76,9 +78,11 @@ OffsetToCluster(PDEVICE_EXTENSION DeviceExt,
ULONG CurrentCluster;
ULONG i;
NTSTATUS Status;
/*
DPRINT("OffsetToCluster(DeviceExt %x, Fcb %x, FirstCluster %x,"
" FileOffset %x, Cluster %x, Extend %d)\n", DeviceExt,
Fcb, FirstCluster, FileOffset, Cluster, Extend);
*/
if (FirstCluster == 0)
{
DbgPrint("OffsetToCluster is called with FirstCluster = 0!\n");
@ -269,7 +273,15 @@ VfatReadFileData (PVFAT_IRP_CONTEXT IrpContext, PVOID Buffer,
if (NT_SUCCESS(Status))
{
*LengthRead += BytesDone;
/* GCC allows arithmetics on the void type. Conforming compilers do not. */
#ifdef __GNUC__
Buffer += BytesDone;
#else
{
char* pBuf = (char*)Buffer + BytesDone;
Buffer = (PVOID)pBuf;
}
#endif
Length -= BytesDone;
ReadOffset.u.LowPart += BytesDone;
}
@ -422,7 +434,15 @@ NTSTATUS VfatWriteFileData(PVFAT_IRP_CONTEXT IrpContext,
Status = VfatWriteDisk (DeviceExt->StorageDevice, &StartOffset, BytesDone, Buffer);
if (NT_SUCCESS(Status))
{
/* GCC allows arithmetics on the void type. Conforming compilers do not. */
#ifdef __GNUC__
Buffer += BytesDone;
#else
{
char* pBuf = (char*)Buffer + BytesDone;
Buffer = (PVOID)pBuf;
}
#endif
Length -= BytesDone;
WriteOffset.u.LowPart += BytesDone;
}
@ -440,7 +460,7 @@ VfatRead(PVFAT_IRP_CONTEXT IrpContext)
PERESOURCE Resource = NULL;
LARGE_INTEGER ByteOffset;
PVOID Buffer;
PDEVICE_OBJECT DeviceToVerify;
/*PDEVICE_OBJECT DeviceToVerify;*/
ULONG BytesPerSector;
assert(IrpContext);
@ -531,7 +551,8 @@ VfatRead(PVFAT_IRP_CONTEXT IrpContext)
{
Resource = &Fcb->MainResource;
}
if (!ExAcquireResourceSharedLite(Resource, IrpContext->Flags & IRPCONTEXT_CANWAIT))
if (!ExAcquireResourceSharedLite(Resource,
(BOOLEAN)(IrpContext->Flags & IRPCONTEXT_CANWAIT)))
{
Resource = NULL;
Status = STATUS_PENDING;
@ -579,7 +600,7 @@ VfatRead(PVFAT_IRP_CONTEXT IrpContext)
CcRosInitializeFileCache(IrpContext->FileObject, CacheSize);
}
if (!CcCopyRead(IrpContext->FileObject, &ByteOffset, Length,
IrpContext->Flags & IRPCONTEXT_CANWAIT, Buffer,
(BOOLEAN)(IrpContext->Flags & IRPCONTEXT_CANWAIT), Buffer,
&IrpContext->Irp->IoStatus))
{
Status = STATUS_PENDING;
@ -597,7 +618,7 @@ VfatRead(PVFAT_IRP_CONTEXT IrpContext)
CHECKPOINT;
if (ByteOffset.QuadPart + Length > ROUND_UP(Fcb->RFCB.FileSize.QuadPart, BytesPerSector))
{
Length = ROUND_UP(Fcb->RFCB.FileSize.QuadPart, BytesPerSector) - ByteOffset.QuadPart;
Length = (ULONG)(ROUND_UP(Fcb->RFCB.FileSize.QuadPart, BytesPerSector) - ByteOffset.QuadPart);
}
Buffer = VfatGetUserBuffer(IrpContext->Irp);
@ -661,7 +682,7 @@ ByeBye:
}
IoCompleteRequest(IrpContext->Irp,
NT_SUCCESS(Status) ? IO_DISK_INCREMENT : IO_NO_INCREMENT);
(CCHAR)(NT_SUCCESS(Status) ? IO_DISK_INCREMENT : IO_NO_INCREMENT));
VfatFreeIrpContext(IrpContext);
}
DPRINT("%x\n", Status);
@ -787,7 +808,8 @@ NTSTATUS VfatWrite (PVFAT_IRP_CONTEXT IrpContext)
if (Fcb->Flags & FCB_IS_PAGE_FILE)
{
if (!ExAcquireResourceSharedLite(Resource, IrpContext->Flags & IRPCONTEXT_CANWAIT))
if (!ExAcquireResourceSharedLite(Resource,
(BOOLEAN)(IrpContext->Flags & IRPCONTEXT_CANWAIT)))
{
Resource = NULL;
Status = STATUS_PENDING;
@ -796,7 +818,8 @@ NTSTATUS VfatWrite (PVFAT_IRP_CONTEXT IrpContext)
}
else
{
if (!ExAcquireResourceExclusiveLite(Resource, IrpContext->Flags & IRPCONTEXT_CANWAIT))
if (!ExAcquireResourceExclusiveLite(Resource,
(BOOLEAN)(IrpContext->Flags & IRPCONTEXT_CANWAIT)))
{
Resource = NULL;
Status = STATUS_PENDING;
@ -952,7 +975,7 @@ ByeBye:
}
IoCompleteRequest(IrpContext->Irp,
NT_SUCCESS(Status) ? IO_DISK_INCREMENT : IO_NO_INCREMENT);
(CCHAR)(NT_SUCCESS(Status) ? IO_DISK_INCREMENT : IO_NO_INCREMENT));
VfatFreeIrpContext(IrpContext);
}
DPRINT("%x\n", Status);

View file

@ -1,4 +1,4 @@
/* $Id: shutdown.c,v 1.5 2003/02/09 18:02:55 hbirr Exp $
/* $Id: shutdown.c,v 1.6 2003/07/24 19:00:42 chorns Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -11,7 +11,9 @@
#include <ddk/ntddk.h>
#ifndef NDEBUG
#define NDEBUG
#endif
#include <debug.h>
#include "vfat.h"

View file

@ -1,4 +1,4 @@
/* $Id: string.c,v 1.9 2002/11/11 21:49:18 hbirr Exp $
/* $Id: string.c,v 1.10 2003/07/24 19:00:42 chorns Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -13,7 +13,9 @@
#include <ddk/ntddk.h>
#include <wchar.h>
#ifndef NDEBUG
#define NDEBUG
#endif
#include <debug.h>
#include "vfat.h"

View file

@ -1,4 +1,4 @@
/* $Id: vfat.h,v 1.58 2003/06/07 11:34:36 chorns Exp $ */
/* $Id: vfat.h,v 1.59 2003/07/24 19:00:42 chorns Exp $ */
#include <ddk/ntifs.h>
@ -433,6 +433,11 @@ NTSTATUS GetNextCluster (PDEVICE_EXTENSION DeviceExt,
NTSTATUS CountAvailableClusters (PDEVICE_EXTENSION DeviceExt,
PLARGE_INTEGER Clusters);
NTSTATUS
WriteCluster(PDEVICE_EXTENSION DeviceExt,
ULONG ClusterToWrite,
ULONG NewValue);
/* ------------------------------------------------------ direntry.c */
ULONG vfatDirEntryGetFirstCluster (PDEVICE_EXTENSION pDeviceExt,
@ -461,6 +466,8 @@ PVFATFCB vfatNewFCB (PWCHAR pFileName);
VOID vfatDestroyFCB (PVFATFCB pFCB);
VOID vfatDestroyCCB(PVFATCCB pCcb);
VOID vfatGrabFCB (PDEVICE_EXTENSION pVCB,
PVFATFCB pFCB);
@ -479,6 +486,8 @@ PVFATFCB vfatOpenRootFCB (PDEVICE_EXTENSION pVCB);
BOOL vfatFCBIsDirectory (PVFATFCB FCB);
BOOL vfatFCBIsRoot(PVFATFCB FCB);
NTSTATUS vfatAttachFCBToFileObject (PDEVICE_EXTENSION vcb,
PVFATFCB fcb,
PFILE_OBJECT fileObject);

View file

@ -1,4 +1,4 @@
/* $Id: volume.c,v 1.20 2003/07/20 23:09:01 hbirr Exp $
/* $Id: volume.c,v 1.21 2003/07/24 19:00:42 chorns Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -12,7 +12,9 @@
#include <ddk/ntddk.h>
#include <wchar.h>
#ifndef NDEBUG
#define NDEBUG
#endif
#include <debug.h>
#include "vfat.h"
@ -181,7 +183,8 @@ NTSTATUS VfatQueryVolumeInformation(PVFAT_IRP_CONTEXT IrpContext)
DPRINT("VfatQueryVolumeInformation(IrpContext %x)\n", IrpContext);
if (!ExAcquireResourceSharedLite(&((PDEVICE_EXTENSION)IrpContext->DeviceObject->DeviceExtension)->DirResource, IrpContext->Flags & IRPCONTEXT_CANWAIT))
if (!ExAcquireResourceSharedLite(&((PDEVICE_EXTENSION)IrpContext->DeviceObject->DeviceExtension)->DirResource,
(BOOLEAN)(IrpContext->Flags & IRPCONTEXT_CANWAIT)))
{
return VfatQueueRequest (IrpContext);
}
@ -253,7 +256,8 @@ NTSTATUS VfatSetVolumeInformation(PVFAT_IRP_CONTEXT IrpContext)
DPRINT1("VfatSetVolumeInformation(IrpContext %x)\n", IrpContext);
if (!ExAcquireResourceExclusiveLite(&((PDEVICE_EXTENSION)IrpContext->DeviceObject->DeviceExtension)->DirResource, IrpContext->Flags & IRPCONTEXT_CANWAIT))
if (!ExAcquireResourceExclusiveLite(&((PDEVICE_EXTENSION)IrpContext->DeviceObject->DeviceExtension)->DirResource,
(BOOLEAN)(IrpContext->Flags & IRPCONTEXT_CANWAIT)))
{
return VfatQueueRequest (IrpContext);
}

View file

@ -40,8 +40,8 @@ VOID STDCALL KeAcquireSpinLockAtDpcLevel (IN PKSPIN_LOCK SpinLock);
//NTOSAPI
//DDKFASTAPI
STDCALL
VOID
STDCALL
KeReleaseSpinLockFromDpcLevel(
IN PKSPIN_LOCK SpinLock);

View file

@ -31,7 +31,12 @@
#endif
#endif
/* TODO: Make the output of file/line and the debug message atomic */
#ifdef __GNUC__
#define DPRINT1(args...) do { DbgPrint("(%s:%d) ",__FILE__,__LINE__); DbgPrint(args); } while(0);
#else
#define DPRINT1 DbgPrint("(%s:%d) ",__FILE__,__LINE__); DbgPrint
#endif
#define CHECKPOINT1 do { DbgPrint("%s:%d\n",__FILE__,__LINE__); } while(0);
@ -39,7 +44,11 @@
#define DPRINT(args...) do { DbgPrint("(%s:%d) ",__FILE__,__LINE__); DbgPrint(args); } while(0);
#define CHECKPOINT do { DbgPrint("%s:%d\n",__FILE__,__LINE__); } while(0);
#else
#ifdef __GNUC__
#define DPRINT(args...)
#else
#define DPRINT
#endif /* __GNUC__ */
#define CHECKPOINT
#endif /* NDEBUG */

View file

@ -44,8 +44,13 @@ typedef short SHORT;
#ifndef __USE_W32API
#ifdef i386
#ifdef __GNUC__
#define STDCALL __attribute__ ((stdcall))
#define CDECL __attribute__ ((cdecl))
#else
#define STDCALL __stdcall
#define CDECL __cdecl
#endif
#define CALLBACK WINAPI
#define PASCAL WINAPI
#else

View file

@ -1,4 +1,4 @@
/* $Id: reg.c,v 1.28 2003/07/21 03:38:42 royce Exp $
/* $Id: reg.c,v 1.29 2003/07/24 19:00:42 chorns Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
@ -1820,7 +1820,7 @@ RegQueryMultipleValuesW (HKEY hKey,
LPWSTR lpValueBuf,
LPDWORD ldwTotsize)
{
int i;
ULONG i;
DWORD maxBytes = *ldwTotsize;
HRESULT status;
LPSTR bufptr = (LPSTR)lpValueBuf;