Fix various warnings
Modified: trunk/reactos/drivers/fs/vfat/blockdev.c
Modified: trunk/reactos/drivers/fs/vfat/create.c
Modified: trunk/reactos/drivers/fs/vfat/dir.c
Modified: trunk/reactos/drivers/fs/vfat/dirwr.c
Modified: trunk/reactos/drivers/fs/vfat/fcb.c
Modified: trunk/reactos/drivers/fs/vfat/fsctl.c
Modified: trunk/reactos/drivers/fs/vfat/rw.c
Modified: trunk/reactos/drivers/fs/vfat/vfat.h
Modified: trunk/reactos/drivers/fs/vfat/volume.c

Modified: trunk/reactos/drivers/fs/vfat/blockdev.c
--- trunk/reactos/drivers/fs/vfat/blockdev.c	2005-02-24 16:48:16 UTC (rev 13733)
+++ trunk/reactos/drivers/fs/vfat/blockdev.c	2005-02-24 20:47:07 UTC (rev 13734)
@@ -15,7 +15,7 @@
 
 /* FUNCTIONS ***************************************************************/
 
-NTSTATUS STDCALL
+static NTSTATUS STDCALL
 VfatReadWritePartialCompletion (IN PDEVICE_OBJECT DeviceObject,
 				IN PIRP Irp,
 				IN PVOID Context)
@@ -272,9 +272,9 @@
 NTSTATUS
 VfatBlockDeviceIoControl (IN PDEVICE_OBJECT DeviceObject,
 			  IN ULONG CtlCode,
-			  IN PVOID InputBuffer,
+			  IN PVOID InputBuffer OPTIONAL,
 			  IN ULONG InputBufferSize,
-			  IN OUT PVOID OutputBuffer,
+			  IN OUT PVOID OutputBuffer OPTIONAL,
 			  IN OUT PULONG OutputBufferSize,
 			  IN BOOLEAN Override)
 {

Modified: trunk/reactos/drivers/fs/vfat/create.c
--- trunk/reactos/drivers/fs/vfat/create.c	2005-02-24 16:48:16 UTC (rev 13733)
+++ trunk/reactos/drivers/fs/vfat/create.c	2005-02-24 20:47:07 UTC (rev 13734)
@@ -186,7 +186,7 @@
  */
 {
   PWCHAR PathNameBuffer;
-  ULONG PathNameBufferLength;
+  USHORT PathNameBufferLength;
   NTSTATUS Status;
   PVOID Context = NULL;
   PVOID Page;

Modified: trunk/reactos/drivers/fs/vfat/dir.c
--- trunk/reactos/drivers/fs/vfat/dir.c	2005-02-24 16:48:16 UTC (rev 13733)
+++ trunk/reactos/drivers/fs/vfat/dir.c	2005-02-24 20:47:07 UTC (rev 13734)
@@ -33,7 +33,7 @@
 
   TimeFields.Day = pddate->Day;
   TimeFields.Month = pddate->Month;
-  TimeFields.Year = DeviceExt->BaseDateYear + pddate->Year;
+  TimeFields.Year = (CSHORT)(DeviceExt->BaseDateYear + pddate->Year);
 
   RtlTimeFieldsToTime (&TimeFields, &LocalTime);
   ExLocalTimeToSystemTime(&LocalTime, SystemTime);
@@ -261,7 +261,7 @@
     pInfo->NextEntryOffset = 
       ULONG_ROUND_UP (sizeof (FILE_BOTH_DIR_INFORMATION) + DirContext->LongNameU.Length);
     RtlCopyMemory(pInfo->ShortName, DirContext->ShortNameU.Buffer, DirContext->ShortNameU.Length);
-    pInfo->ShortNameLength = DirContext->ShortNameU.Length;
+    pInfo->ShortNameLength = (CCHAR)DirContext->ShortNameU.Length;
     RtlCopyMemory (pInfo->FileName, DirContext->LongNameU.Buffer, DirContext->LongNameU.Length);
   //      pInfo->FileIndex=;
     FsdDosDateTimeToSystemTime (DeviceExt, DirContext->DirEntry.Fat.CreationDate,

Modified: trunk/reactos/drivers/fs/vfat/dirwr.c
--- trunk/reactos/drivers/fs/vfat/dirwr.c	2005-02-24 16:48:16 UTC (rev 13733)
+++ trunk/reactos/drivers/fs/vfat/dirwr.c	2005-02-24 20:47:07 UTC (rev 13734)
@@ -45,7 +45,7 @@
       return STATUS_SUCCESS;
     }
 
-  ASSERT (pFcb->parrentFcb);
+  ASSERT (pFcb->parentFcb);
   
   Offset.u.HighPart = 0;
   Offset.u.LowPart = dirIndex * SizeDirEntry;

Modified: trunk/reactos/drivers/fs/vfat/fcb.c
--- trunk/reactos/drivers/fs/vfat/fcb.c	2005-02-24 16:48:16 UTC (rev 13733)
+++ trunk/reactos/drivers/fs/vfat/fcb.c	2005-02-24 20:47:07 UTC (rev 13734)
@@ -72,7 +72,7 @@
 VOID
 vfatInitFcb(PVFATFCB Fcb, PUNICODE_STRING NameU)
 {
-  ULONG PathNameBufferLength;
+  USHORT PathNameBufferLength;
   
   if (NameU)
     PathNameBufferLength = NameU->Length + sizeof(WCHAR);
@@ -460,7 +460,7 @@
 {
   PVFATFCB  rcFCB;
   PWCHAR PathNameBuffer;
-  ULONG PathNameLength;
+  USHORT PathNameLength;
   ULONG Size;
   ULONG hash;
   
@@ -583,7 +583,7 @@
   fileObject->SectionObjectPointer = &fcb->SectionObjectPointers;
   fileObject->FsContext = fcb;
   fileObject->FsContext2 = newCCB;
-  DPRINT ("file open: fcb:%x PathName:%wZ file size: %d\n", fcb, &fcb->PathNameU, fcb->entry.FileSize);
+  DPRINT ("file open: fcb:%x PathName:%wZ\n", fcb, &fcb->PathNameU);
 
   return  STATUS_SUCCESS;
 }

Modified: trunk/reactos/drivers/fs/vfat/fsctl.c
--- trunk/reactos/drivers/fs/vfat/fsctl.c	2005-02-24 16:48:16 UTC (rev 13733)
+++ trunk/reactos/drivers/fs/vfat/fsctl.c	2005-02-24 20:47:07 UTC (rev 13734)
@@ -109,8 +109,8 @@
       }
       else if (DiskGeometry.MediaType == RemovableMedia &&
                PartitionInfo.PartitionNumber > 0 &&
-               PartitionInfo.StartingOffset.QuadPart == 0LL &&
-               PartitionInfo.PartitionLength.QuadPart > 0LL)
+               PartitionInfo.StartingOffset.QuadPart == 0 &&
+               PartitionInfo.PartitionLength.QuadPart > 0)
       {
          /* This is possible a removable media formated as super floppy */
          *RecognizedFS = TRUE;
@@ -298,7 +298,7 @@
             FatInfo.SectorsPerCluster = BootFatX->SectorsPerCluster;
             FatInfo.rootDirectorySectors = BootFatX->SectorsPerCluster;
             FatInfo.BytesPerCluster = BootFatX->SectorsPerCluster * DiskGeometry.BytesPerSector;
-	    FatInfo.Sectors = PartitionInfo.PartitionLength.QuadPart / DiskGeometry.BytesPerSector;
+            FatInfo.Sectors = (ULONG)(PartitionInfo.PartitionLength.QuadPart / DiskGeometry.BytesPerSector);
             if (FatInfo.Sectors / FatInfo.SectorsPerCluster < 65525)
             {
                DPRINT("FATX16\n");

Modified: trunk/reactos/drivers/fs/vfat/rw.c
--- trunk/reactos/drivers/fs/vfat/rw.c	2005-02-24 16:48:16 UTC (rev 13733)
+++ trunk/reactos/drivers/fs/vfat/rw.c	2005-02-24 20:47:07 UTC (rev 13734)
@@ -12,13 +12,7 @@
 
 /* INCLUDES *****************************************************************/
 
-#include <ddk/ntddk.h>
-#include <wchar.h>
-#include <ntos/minmax.h>
-
 #define NDEBUG
-#include <debug.h>
-
 #include "vfat.h"
 
 /*
@@ -728,7 +722,7 @@
       {
          DPRINT("VfatReadFile returned STATUS_VERIFY_REQUIRED\n");
          DeviceToVerify = IoGetDeviceToVerify(PsGetCurrentThread());
-         IoSetDeviceToVerify(PsGetCurrentThread(), NULL);
+         IoSetDeviceToVerify(PsGetCurrentThread(), DeviceToVerify);
          Status = IoVerifyVolume (DeviceToVerify, FALSE);
 
          if (NT_SUCCESS(Status))

Modified: trunk/reactos/drivers/fs/vfat/vfat.h
--- trunk/reactos/drivers/fs/vfat/vfat.h	2005-02-24 16:48:16 UTC (rev 13733)
+++ trunk/reactos/drivers/fs/vfat/vfat.h	2005-02-24 20:47:07 UTC (rev 13734)
@@ -28,6 +28,7 @@
 #define ROUND_UP(N, S) ((((N) + (S) - 1) / (S)) * (S))
 #define ROUND_DOWN(N, S) ((N) - ((N) % (S)))
 
+#include <pshpack1.h>
 struct _BootSector
 {
   unsigned char  magic0, res0, magic1;
@@ -45,7 +46,7 @@
   unsigned char  VolumeLabel[11], SysType[8];
   unsigned char  Res2[448];
   unsigned short Signatur1;
-} __attribute__((packed));
+};
 
 struct _BootSector32
 {
@@ -73,7 +74,7 @@
   unsigned char  VolumeLabel[11], SysType[8];		// 71
   unsigned char  Res2[420];				// 90
   unsigned short Signature1;				// 510
-} __attribute__((packed));
+};
 
 struct _BootSectorFatX
 {
@@ -83,7 +84,7 @@
    unsigned short FATCount;         // 12
    unsigned long Unknown;           // 14
    unsigned char Unused[4078];      // 18
-} __attribute__((packed));
+};
 
 struct _FsInfoSector
 {
@@ -94,35 +95,17 @@
   unsigned long  NextCluster;				// 492
   unsigned char  Res7[12];				// 496
   unsigned long  Signatur2;				// 508
-} __attribute__((packed));
+};
 
 typedef struct _BootSector BootSector;
 
-#define VFAT_CASE_LOWER_BASE	8  		// base is lower case
-#define VFAT_CASE_LOWER_EXT 	16 		// extension is lower case
-
-#define LONGNAME_MAX_LENGTH 	256		// max length for a long filename
-
-#define ENTRY_DELETED(DeviceExt, DirEntry) ((DeviceExt)->Flags & VCB_IS_FATX ? FATX_ENTRY_DELETED(&((DirEntry)->FatX)) : FAT_ENTRY_DELETED(&((DirEntry)->Fat)))
-#define ENTRY_VOLUME(DeviceExt, DirEntry)  ((DeviceExt)->Flags & VCB_IS_FATX ? FATX_ENTRY_VOLUME(&((DirEntry)->FatX)) : FAT_ENTRY_VOLUME(&((DirEntry)->Fat)))
-#define ENTRY_END(DeviceExt, DirEntry)     ((DeviceExt)->Flags & VCB_IS_FATX ? FATX_ENTRY_END(&((DirEntry)->FatX)) : FAT_ENTRY_END(&((DirEntry)->Fat)))
-
-#define FAT_ENTRY_DELETED(DirEntry)  ((DirEntry)->Filename[0] == 0xe5)
-#define FAT_ENTRY_END(DirEntry)      ((DirEntry)->Filename[0] == 0)
-#define FAT_ENTRY_LONG(DirEntry)     (((DirEntry)->Attrib & 0x3f) == 0x0f)
-#define FAT_ENTRY_VOLUME(DirEntry)   (((DirEntry)->Attrib & 0x1f) == 0x08)
-
-#define FATX_ENTRY_DELETED(DirEntry) ((DirEntry)->FilenameLength == 0xe5)
-#define FATX_ENTRY_END(DirEntry)     ((DirEntry)->FilenameLength == 0xff)
-#define FATX_ENTRY_LONG(DirEntry)    (FALSE)
-#define FATX_ENTRY_VOLUME(DirEntry)  (((DirEntry)->Attrib & 0x1f) == 0x08)
-
-#define FAT_ENTRIES_PER_PAGE   (PAGE_SIZE / sizeof (FAT_DIR_ENTRY))
-#define FATX_ENTRIES_PER_PAGE  (PAGE_SIZE / sizeof (FATX_DIR_ENTRY))
-
 struct _FATDirEntry
 {
-  unsigned char  Filename[8], Ext[3];
+  union
+  {
+     struct { unsigned char Filename[8], Ext[3]; };
+     unsigned char ShortName[11];
+  };
   unsigned char  Attrib;
   unsigned char  lCase;
   unsigned char  CreationTimeMs;
@@ -132,7 +115,7 @@
   unsigned short UpdateDate;                            //date create/update
   unsigned short FirstCluster;
   unsigned long  FileSize;
-} __attribute__((packed));
+};
 
 typedef struct _FATDirEntry FAT_DIR_ENTRY, *PFAT_DIR_ENTRY;
 
@@ -149,18 +132,8 @@
    unsigned short CreationDate;  // 58
    unsigned short AccessTime;    // 60
    unsigned short AccessDate;    // 62
-} __attribute__((packed));
-
-typedef struct _FATXDirEntry FATX_DIR_ENTRY, *PFATX_DIR_ENTRY;
-
-union _DIR_ENTRY
-{
-   FAT_DIR_ENTRY Fat;
-   FATX_DIR_ENTRY FatX;
 };
 
-typedef union _DIR_ENTRY DIR_ENTRY, *PDIR_ENTRY;
-
 struct _slot
 {
   unsigned char id;               // sequence number for slot
@@ -171,11 +144,44 @@
   WCHAR  name5_10[6];             // 6 more characters in name
   unsigned char start[2];         // starting cluster number
   WCHAR  name11_12[2];            // last 2 characters in name
-} __attribute__((packed));
+};
 
-
 typedef struct _slot slot;
 
+#include <poppack.h>
+
+#define VFAT_CASE_LOWER_BASE	8  		// base is lower case
+#define VFAT_CASE_LOWER_EXT 	16 		// extension is lower case
+
+#define LONGNAME_MAX_LENGTH 	256		// max length for a long filename
+
+#define ENTRY_DELETED(DeviceExt, DirEntry) ((DeviceExt)->Flags & VCB_IS_FATX ? FATX_ENTRY_DELETED(&((DirEntry)->FatX)) : FAT_ENTRY_DELETED(&((DirEntry)->Fat)))
+#define ENTRY_VOLUME(DeviceExt, DirEntry)  ((DeviceExt)->Flags & VCB_IS_FATX ? FATX_ENTRY_VOLUME(&((DirEntry)->FatX)) : FAT_ENTRY_VOLUME(&((DirEntry)->Fat)))
+#define ENTRY_END(DeviceExt, DirEntry)     ((DeviceExt)->Flags & VCB_IS_FATX ? FATX_ENTRY_END(&((DirEntry)->FatX)) : FAT_ENTRY_END(&((DirEntry)->Fat)))
+
+#define FAT_ENTRY_DELETED(DirEntry)  ((DirEntry)->Filename[0] == 0xe5)
+#define FAT_ENTRY_END(DirEntry)      ((DirEntry)->Filename[0] == 0)
+#define FAT_ENTRY_LONG(DirEntry)     (((DirEntry)->Attrib & 0x3f) == 0x0f)
+#define FAT_ENTRY_VOLUME(DirEntry)   (((DirEntry)->Attrib & 0x1f) == 0x08)
+
+#define FATX_ENTRY_DELETED(DirEntry) ((DirEntry)->FilenameLength == 0xe5)
+#define FATX_ENTRY_END(DirEntry)     ((DirEntry)->FilenameLength == 0xff)
+#define FATX_ENTRY_LONG(DirEntry)    (FALSE)
+#define FATX_ENTRY_VOLUME(DirEntry)  (((DirEntry)->Attrib & 0x1f) == 0x08)
+
+#define FAT_ENTRIES_PER_PAGE   (PAGE_SIZE / sizeof (FAT_DIR_ENTRY))
+#define FATX_ENTRIES_PER_PAGE  (PAGE_SIZE / sizeof (FATX_DIR_ENTRY))
+
+typedef struct _FATXDirEntry FATX_DIR_ENTRY, *PFATX_DIR_ENTRY;
+
+union _DIR_ENTRY
+{
+   FAT_DIR_ENTRY Fat;
+   FATX_DIR_ENTRY FatX;
+};
+
+typedef union _DIR_ENTRY DIR_ENTRY, *PDIR_ENTRY;
+
 #define BLOCKSIZE 512
 
 #define FAT16  (1)

Modified: trunk/reactos/drivers/fs/vfat/volume.c
--- trunk/reactos/drivers/fs/vfat/volume.c	2005-02-24 16:48:16 UTC (rev 13733)
+++ trunk/reactos/drivers/fs/vfat/volume.c	2005-02-24 20:47:07 UTC (rev 13734)
@@ -204,7 +204,7 @@
   LabelLen = FsLabelInfo->VolumeLabelLength / sizeof(WCHAR);
   RtlZeroMemory(&VolumeLabelDirEntry, SizeDirEntry);
   StringW.Buffer = FsLabelInfo->VolumeLabel;
-  StringW.Length = StringW.MaximumLength = FsLabelInfo->VolumeLabelLength;
+  StringW.Length = StringW.MaximumLength = (USHORT)FsLabelInfo->VolumeLabelLength;
   StringO.Buffer = cString;
   StringO.Length = 0;
   StringO.MaximumLength = 42;
@@ -288,7 +288,7 @@
   }
   
   /* Update volume label in memory */
-  DeviceObject->Vpb->VolumeLabelLength = FsLabelInfo->VolumeLabelLength;
+  DeviceObject->Vpb->VolumeLabelLength = (USHORT)FsLabelInfo->VolumeLabelLength;
   RtlCopyMemory(DeviceObject->Vpb->VolumeLabel, FsLabelInfo->VolumeLabel, DeviceObject->Vpb->VolumeLabelLength);
   
   return Status;