Added experimental support for FAT and NTFS FSDs.
authorEric Kohl <eric.kohl@reactos.org>
Wed, 15 May 2002 18:05:00 +0000 (18:05 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Wed, 15 May 2002 18:05:00 +0000 (18:05 +0000)
Silenced debug messges.

svn path=/trunk/; revision=2954

12 files changed:
reactos/drivers/fs/cdfs/cdfs.c
reactos/drivers/fs/cdfs/fsctl.c
reactos/drivers/fs/fs_rec/blockdev.c
reactos/drivers/fs/fs_rec/cdfs.c
reactos/drivers/fs/fs_rec/fat.c
reactos/drivers/fs/fs_rec/fs_rec.c
reactos/drivers/fs/fs_rec/fs_rec.h
reactos/drivers/fs/fs_rec/ntfs.c
reactos/drivers/fs/vfat/cleanup.c
reactos/drivers/fs/vfat/close.c
reactos/drivers/fs/vfat/create.c
reactos/drivers/fs/vfat/iface.c

index e9b12c6..494eb39 100644 (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: cdfs.c,v 1.4 2002/05/15 09:39:54 ekohl Exp $
+/* $Id: cdfs.c,v 1.5 2002/05/15 18:01:30 ekohl Exp $
  *
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
@@ -58,7 +58,7 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
   NTSTATUS Status;
   UNICODE_STRING DeviceName;
 
-  DbgPrint("CDFS 0.0.2\n");
+  DPRINT("CDFS 0.0.2\n");
 
   RtlInitUnicodeString(&DeviceName,
                       L"\\Cdfs");
index 2eac711..16ed6cc 100644 (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.5 2002/05/14 23:16:23 ekohl Exp $
+/* $Id: fsctl.c,v 1.6 2002/05/15 18:01:30 ekohl Exp $
  *
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
@@ -118,8 +118,6 @@ CdfsGetSVDData(PUCHAR Buffer,
       JolietLevel = 3;
     }
 
-  /* Don't support Joliet yet! */
-//#if 0
   Vcb->CdInfo.JolietLevel = JolietLevel;
 
   if (JolietLevel != 0)
@@ -130,7 +128,6 @@ CdfsGetSVDData(PUCHAR Buffer,
       DPRINT("RootStart: %lu\n", Svd->RootDirRecord.ExtentLocationL);
       DPRINT("RootSize: %lu\n", Svd->RootDirRecord.DataLengthL);
     }
-//#endif
 }
 
 
index c8008bb..9ade078 100644 (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: blockdev.c,v 1.1 2002/05/15 09:40:47 ekohl Exp $
+/* $Id: blockdev.c,v 1.2 2002/05/15 18:02:59 ekohl Exp $
  *
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
@@ -48,11 +48,17 @@ FsRecReadSectors(IN PDEVICE_OBJECT DeviceObject,
   IO_STATUS_BLOCK IoStatus;
   LARGE_INTEGER Offset;
   ULONG BlockSize;
-  KEVENT Event;
+  PKEVENT Event;
   PIRP Irp;
   NTSTATUS Status;
 
-  KeInitializeEvent(&Event,
+  Event = ExAllocatePool(NonPagedPool, sizeof(KEVENT));
+  if (Event == NULL)
+    {
+      return(STATUS_INSUFFICIENT_RESOURCES);
+    }
+
+  KeInitializeEvent(Event,
                    NotificationEvent,
                    FALSE);
 
@@ -71,38 +77,90 @@ FsRecReadSectors(IN PDEVICE_OBJECT DeviceObject,
                                     Buffer,
                                     BlockSize,
                                     &Offset,
-                                    &Event,
+                                    Event,
                                     &IoStatus);
   if (Irp == NULL)
     {
       DPRINT("IoBuildSynchronousFsdRequest failed\n");
+      ExFreePool(Event);
       return(STATUS_INSUFFICIENT_RESOURCES);
     }
 
   DPRINT("Calling IO Driver... with irp %x\n", Irp);
   Status = IoCallDriver(DeviceObject, Irp);
-
-  DPRINT("Waiting for IO Operation for %x\n", Irp);
   if (Status == STATUS_PENDING)
     {
       DPRINT("Operation pending\n");
-      KeWaitForSingleObject(&Event, Suspended, KernelMode, FALSE, NULL);
-      DPRINT("Getting IO Status... for %x\n", Irp);
+      KeWaitForSingleObject(Event, Suspended, KernelMode, FALSE, NULL);
+      Status = IoStatus.Status;
+    }
+
+  ExFreePool(Event);
+
+  return(STATUS_SUCCESS);
+}
+
+
+NTSTATUS
+FsRecDeviceIoControl(IN PDEVICE_OBJECT DeviceObject,
+                    IN ULONG ControlCode,
+                    IN PVOID InputBuffer,
+                    IN ULONG InputBufferSize,
+                    IN OUT PVOID OutputBuffer,
+                    IN OUT PULONG OutputBufferSize)
+{
+  ULONG BufferSize = 0;
+  PKEVENT Event;
+  PIRP Irp;
+  IO_STATUS_BLOCK IoStatus;
+  NTSTATUS Status;
+
+  if (OutputBufferSize != NULL)
+    {
+      BufferSize = *OutputBufferSize;
+    }
+
+  Event = ExAllocatePool(NonPagedPool, sizeof(KEVENT));
+  if (Event == NULL)
+    {
+      return(STATUS_INSUFFICIENT_RESOURCES);
+    }
+
+  KeInitializeEvent(Event, NotificationEvent, FALSE);
+
+  DPRINT("Building device I/O control request ...\n");
+  Irp = IoBuildDeviceIoControlRequest(ControlCode,
+                                     DeviceObject,
+                                     InputBuffer,
+                                     InputBufferSize,
+                                     OutputBuffer,
+                                     BufferSize,
+                                     FALSE,
+                                     Event,
+                                     &IoStatus);
+  if (Irp == NULL)
+    {
+      DPRINT("IoBuildDeviceIoControlRequest() failed\n");
+      ExFreePool(Event);
+      return(STATUS_INSUFFICIENT_RESOURCES);
+    }
+
+  DPRINT("Calling IO Driver... with irp %x\n", Irp);
+  Status = IoCallDriver(DeviceObject, Irp);
+  if (Status == STATUS_PENDING)
+    {
+      KeWaitForSingleObject(Event, Suspended, KernelMode, FALSE, NULL);
       Status = IoStatus.Status;
     }
 
-  if (!NT_SUCCESS(Status))
+  if (OutputBufferSize)
     {
-      DPRINT("FsrecReadSectors() failed (Status %x)\n", Status);
-      DPRINT("(DeviceObject %x, DiskSector %x, Buffer %x, Offset 0x%I64x)\n",
-            DeviceObject, DiskSector, Buffer,
-            Offset.QuadPart);
-      return(Status);
+      *OutputBufferSize = BufferSize;
     }
 
-  DPRINT("Block request succeeded for %x\n", Irp);
+  ExFreePool(Event);
 
-  return(STATUS_SUCCESS);
+  return(Status);
 }
 
 /* EOF */
index 485b18a..3c0e9bf 100644 (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: cdfs.c,v 1.1 2002/05/15 09:40:47 ekohl Exp $
+/* $Id: cdfs.c,v 1.2 2002/05/15 18:02:59 ekohl Exp $
  *
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
 static NTSTATUS
 FsRecIsCdfsVolume(IN PDEVICE_OBJECT DeviceObject)
 {
+  DISK_GEOMETRY DiskGeometry;
   PUCHAR Buffer;
   NTSTATUS Status;
+  ULONG Size;
+
+  Size = sizeof(DISK_GEOMETRY);
+  Status = FsRecDeviceIoControl(DeviceObject,
+                               IOCTL_CDROM_GET_DRIVE_GEOMETRY,
+                               NULL,
+                               0,
+                               &DiskGeometry,
+                               &Size);
+  DPRINT("FsRecDeviceIoControl() Status %lx\n", Status);
+  if (!NT_SUCCESS(Status))
+    {
+      return(Status);
+    }
 
+  DPRINT("BytesPerSector: %lu\n", DiskGeometry.BytesPerSector);
   Buffer = ExAllocatePool(NonPagedPool,
-                         2048);
+                         DiskGeometry.BytesPerSector);
   if (Buffer == NULL)
     {
       return(STATUS_INSUFFICIENT_RESOURCES);
@@ -53,7 +69,7 @@ FsRecIsCdfsVolume(IN PDEVICE_OBJECT DeviceObject)
   Status = FsRecReadSectors(DeviceObject,
                            16, /* CDFS_PVD_SECTOR */
                            1,
-                           2048,
+                           DiskGeometry.BytesPerSector,
                            Buffer);
   if (!NT_SUCCESS(Status))
     {
@@ -90,7 +106,6 @@ FsRecCdfsFsControl(IN PDEVICE_OBJECT DeviceObject,
     {
       case IRP_MN_MOUNT_VOLUME:
        DPRINT("Cdfs: IRP_MN_MOUNT_VOLUME\n");
-
        Status = FsRecIsCdfsVolume(Stack->Parameters.MountVolume.DeviceObject);
        if (NT_SUCCESS(Status))
          {
@@ -102,7 +117,8 @@ FsRecCdfsFsControl(IN PDEVICE_OBJECT DeviceObject,
       case IRP_MN_LOAD_FILE_SYSTEM:
        DPRINT("Cdfs: IRP_MN_LOAD_FILE_SYSTEM\n");
 #if 0
-       RtlInitUnicodeString(&RegistryPath, FSD_REGISTRY_PATH);
+       RtlInitUnicodeString(&RegistryPath,
+                            L"\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Services\\Cdfs");
 #endif
        RtlInitUnicodeString(&RegistryPath,
                             L"\\SystemRoot\\system32\\drivers\\cdfs.sys");
index 2c93ac6..7989cb6 100644 (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: fat.c,v 1.1 2002/05/15 09:40:47 ekohl Exp $
+/* $Id: fat.c,v 1.2 2002/05/15 18:02:59 ekohl Exp $
  *
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
@@ -29,7 +29,7 @@
 
 #include <ddk/ntddk.h>
 
-//#define NDEBUG
+#define NDEBUG
 #include <debug.h>
 
 #include "fs_rec.h"
 
 /* FUNCTIONS ****************************************************************/
 
+static NTSTATUS
+FsRecIsFatVolume(IN PDEVICE_OBJECT DeviceObject)
+{
+  DISK_GEOMETRY DiskGeometry;
+  PUCHAR Buffer;
+  ULONG Size;
+  NTSTATUS Status;
+
+  Size = sizeof(DISK_GEOMETRY);
+  Status = FsRecDeviceIoControl(DeviceObject,
+                               IOCTL_DISK_GET_DRIVE_GEOMETRY,
+                               NULL,
+                               0,
+                               &DiskGeometry,
+                               &Size);
+  DPRINT("FsRecDeviceIoControl() Status %lx\n", Status);
+  if (!NT_SUCCESS(Status))
+    {
+      return(Status);
+    }
+
+  DPRINT("BytesPerSector: %lu\n", DiskGeometry.BytesPerSector);
+  Buffer = ExAllocatePool(NonPagedPool,
+                         DiskGeometry.BytesPerSector);
+  if (Buffer == NULL)
+    {
+      return(STATUS_INSUFFICIENT_RESOURCES);
+    }
+
+  Status = FsRecReadSectors(DeviceObject,
+                           0, /* Partition boot sector */
+                           1,
+                           DiskGeometry.BytesPerSector,
+                           Buffer);
+  if (!NT_SUCCESS(Status))
+    {
+      return(Status);
+    }
+
+  if ((strncmp(&Buffer[0x36], "FAT12", 5) == 0) ||
+      (strncmp(&Buffer[0x36], "FAT16", 5) == 0) ||
+      (strncmp(&Buffer[0x52], "FAT32", 5) == 0))
+    {
+      Status = STATUS_SUCCESS;
+    }
+  else
+    {
+      Status = STATUS_UNRECOGNIZED_VOLUME;
+    }
+
+  ExFreePool(Buffer);
+
+  return(Status);
+}
+
 
 NTSTATUS
 FsRecVfatFsControl(IN PDEVICE_OBJECT DeviceObject,
@@ -51,24 +106,20 @@ FsRecVfatFsControl(IN PDEVICE_OBJECT DeviceObject,
   switch (Stack->MinorFunction)
     {
       case IRP_MN_MOUNT_VOLUME:
-       DPRINT("Fat: IRP_MN_MOUNT_VOLUME\n");
-       Status = STATUS_INVALID_DEVICE_REQUEST;
-#if 0
+       DPRINT("FAT: IRP_MN_MOUNT_VOLUME\n");
        Status = FsRecIsFatVolume(Stack->Parameters.MountVolume.DeviceObject);
        if (NT_SUCCESS(Status))
          {
            DPRINT("Identified FAT volume\n");
            Status = STATUS_FS_DRIVER_REQUIRED;
          }
-#endif
        break;
 
       case IRP_MN_LOAD_FILE_SYSTEM:
-       DPRINT("Fat: IRP_MN_LOAD_FILE_SYSTEM\n");
-       Status = STATUS_INVALID_DEVICE_REQUEST;
+       DPRINT("FAT: IRP_MN_LOAD_FILE_SYSTEM\n");
 #if 0
-#if 0
-       RtlInitUnicodeString(&RegistryPath, FSD_REGISTRY_PATH);
+       RtlInitUnicodeString(&RegistryPath,
+                            L"\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Services\\Vfatfs");
 #endif
        RtlInitUnicodeString(&RegistryPath,
                             L"\\SystemRoot\\system32\\drivers\\vfatfs.sys");
@@ -81,11 +132,10 @@ FsRecVfatFsControl(IN PDEVICE_OBJECT DeviceObject,
          {
            IoUnregisterFileSystem(DeviceObject);
          }
-#endif
        break;
 
       default:
-       DPRINT("Fat: Unknown minor function %lx\n", Stack->MinorFunction);
+       DPRINT("FAT: Unknown minor function %lx\n", Stack->MinorFunction);
        Status = STATUS_INVALID_DEVICE_REQUEST;
        break;
     }
index 648bf68..8458b96 100644 (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: fs_rec.c,v 1.1 2002/05/15 09:40:47 ekohl Exp $
+/* $Id: fs_rec.c,v 1.2 2002/05/15 18:02:59 ekohl Exp $
  *
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
@@ -217,7 +217,6 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
        }
     }
 
-#if 0
   Status = FsRecRegisterFs(DriverObject,
                           L"\\Fat",
                           L"\\FileSystem\\FatRecognizer",
@@ -227,7 +226,6 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
     {
       DeviceCount++;
     }
-#endif
 
   Status = FsRecRegisterFs(DriverObject,
                           L"\\Ntfs",
index e5f3879..70dfc36 100644 (file)
@@ -1,39 +1,39 @@
 /*
-    This is a File System Recognizer for RomFs.
-    Copyright (C) 2001 Bo Brantén.
-    This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
   You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*/
-
-
-//
-// Registry path for the FSD and this driver
-//
-
-#define FSD_REGISTRY_PATH \
-    L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\RomFs"
-
-#define FSR_REGISTRY_PATH \
-    L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\RomFsRec"
+ *  ReactOS kernel
+ *  Copyright (C) 2002 ReactOS Team
+ *
*  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+/* $Id: fs_rec.h,v 1.2 2002/05/15 18:02:59 ekohl Exp $
+ *
+ * COPYRIGHT:        See COPYING in the top level directory
+ * PROJECT:          ReactOS kernel
+ * FILE:             services/fs/fs_rec/fs_rec.h
+ * PURPOSE:          Filesystem recognizer driver
+ * PROGRAMMER:       Eric Kohl
+ */
 
 
 /* Filesystem types (add new filesystems here)*/
+
 #define FS_TYPE_UNUSED         0
 #define FS_TYPE_VFAT           1
 #define FS_TYPE_NTFS           2
 #define FS_TYPE_CDFS           3
 
 
-
 typedef struct _DEVICE_EXTENSION
 {
   ULONG FsType;
@@ -49,6 +49,14 @@ FsRecReadSectors(IN PDEVICE_OBJECT DeviceObject,
                 IN ULONG SectorSize,
                 IN OUT PUCHAR Buffer);
 
+NTSTATUS
+FsRecDeviceIoControl(IN PDEVICE_OBJECT DeviceObject,
+                    IN ULONG ControlCode,
+                    IN PVOID InputBuffer,
+                    IN ULONG InputBufferSize,
+                    IN OUT PVOID OutputBuffer,
+                    IN OUT PULONG OutputBufferSize);
+
 
 /* cdfs.c */
 
@@ -57,17 +65,17 @@ FsRecCdfsFsControl(IN PDEVICE_OBJECT DeviceObject,
                   IN PIRP Irp);
 
 
-/* ntfs.c */
+/* fat.c */
 
 NTSTATUS
-FsRecNtfsFsControl(IN PDEVICE_OBJECT DeviceObject,
+FsRecVfatFsControl(IN PDEVICE_OBJECT DeviceObject,
                   IN PIRP Irp);
 
 
-/* vfat.c */
+/* ntfs.c */
 
 NTSTATUS
-FsRecVfatFsControl(IN PDEVICE_OBJECT DeviceObject,
+FsRecNtfsFsControl(IN PDEVICE_OBJECT DeviceObject,
                   IN PIRP Irp);
 
 /* EOF */
index 2fe143b..0e891ca 100644 (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: ntfs.c,v 1.1 2002/05/15 09:40:47 ekohl Exp $
+/* $Id: ntfs.c,v 1.2 2002/05/15 18:02:59 ekohl Exp $
  *
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
@@ -29,7 +29,7 @@
 
 #include <ddk/ntddk.h>
 
-//#define NDEBUG
+#define NDEBUG
 #include <debug.h>
 
 #include "fs_rec.h"
 
 /* FUNCTIONS ****************************************************************/
 
+static NTSTATUS
+FsRecIsNtfsVolume(IN PDEVICE_OBJECT DeviceObject)
+{
+  DISK_GEOMETRY DiskGeometry;
+  PUCHAR Buffer;
+  ULONG Size;
+  NTSTATUS Status;
+
+  Size = sizeof(DISK_GEOMETRY);
+  Status = FsRecDeviceIoControl(DeviceObject,
+                               IOCTL_DISK_GET_DRIVE_GEOMETRY,
+                               NULL,
+                               0,
+                               &DiskGeometry,
+                               &Size);
+  DPRINT("FsRecDeviceIoControl() Status %lx\n", Status);
+  if (!NT_SUCCESS(Status))
+    {
+      return(Status);
+    }
+
+  DPRINT("BytesPerSector: %lu\n", DiskGeometry.BytesPerSector);
+  Buffer = ExAllocatePool(NonPagedPool,
+                         DiskGeometry.BytesPerSector);
+  if (Buffer == NULL)
+    {
+      return(STATUS_INSUFFICIENT_RESOURCES);
+    }
+
+  Status = FsRecReadSectors(DeviceObject,
+                           0, /* Partition boot sector */
+                           1,
+                           DiskGeometry.BytesPerSector,
+                           Buffer);
+  if (!NT_SUCCESS(Status))
+    {
+      return(Status);
+    }
+
+  if (strncmp(&Buffer[3], "NTFS    ", 8) == 0)
+    {
+      Status = STATUS_SUCCESS;
+    }
+  else
+    {
+      Status = STATUS_UNRECOGNIZED_VOLUME;
+    }
+
+  ExFreePool(Buffer);
+
+  return(Status);
+}
+
 
 NTSTATUS
 FsRecNtfsFsControl(IN PDEVICE_OBJECT DeviceObject,
@@ -52,23 +105,20 @@ FsRecNtfsFsControl(IN PDEVICE_OBJECT DeviceObject,
     {
       case IRP_MN_MOUNT_VOLUME:
        DPRINT("NTFS: IRP_MN_MOUNT_VOLUME\n");
-       Status = STATUS_INVALID_DEVICE_REQUEST;
-#if 0
+
        Status = FsRecIsNtfsVolume(Stack->Parameters.MountVolume.DeviceObject);
        if (NT_SUCCESS(Status))
          {
            DPRINT("Identified NTFS volume\n");
            Status = STATUS_FS_DRIVER_REQUIRED;
          }
-#endif
        break;
 
       case IRP_MN_LOAD_FILE_SYSTEM:
        DPRINT("NTFS: IRP_MN_LOAD_FILE_SYSTEM\n");
-       Status = STATUS_INVALID_DEVICE_REQUEST;
 #if 0
-#if 0
-       RtlInitUnicodeString(&RegistryPath, FSD_REGISTRY_PATH);
+       RtlInitUnicodeString(&RegistryPath,
+                            L"\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Services\\Ntfs");
 #endif
        RtlInitUnicodeString(&RegistryPath,
                             L"\\SystemRoot\\system32\\drivers\\ntfs.sys");
@@ -81,7 +131,6 @@ FsRecNtfsFsControl(IN PDEVICE_OBJECT DeviceObject,
          {
            IoUnregisterFileSystem(DeviceObject);
          }
-#endif
        break;
 
       default:
index 576129b..c93593c 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: cleanup.c,v 1.3 2001/11/02 22:44:34 hbirr Exp $
+/* $Id: cleanup.c,v 1.4 2002/05/15 18:05:00 ekohl Exp $
  *
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
@@ -42,6 +42,12 @@ NTSTATUS VfatCleanup (PVFAT_IRP_CONTEXT IrpContext)
 
    DPRINT("VfatCleanup(DeviceObject %x, Irp %x)\n", DeviceObject, Irp);
 
+  if (IrpContext->DeviceObject == VfatGlobalData->DeviceObject)
+    {
+      Status = STATUS_SUCCESS;
+      goto ByeBye;
+    }
+
    if (!ExAcquireResourceExclusiveLite (&IrpContext->DeviceExt->DirResource, IrpContext->Flags & IRPCONTEXT_CANWAIT))
    {
      return VfatQueueRequest (IrpContext);
@@ -51,6 +57,7 @@ NTSTATUS VfatCleanup (PVFAT_IRP_CONTEXT IrpContext)
 
    ExReleaseResourceLite (&IrpContext->DeviceExt->DirResource);
 
+ByeBye:
    IrpContext->Irp->IoStatus.Status = Status;
    IrpContext->Irp->IoStatus.Information = 0;
 
index f8b0c37..1b5bea7 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: close.c,v 1.10 2002/05/05 20:18:33 hbirr Exp $
+/* $Id: close.c,v 1.11 2002/05/15 18:05:00 ekohl Exp $
  *
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
@@ -80,6 +80,13 @@ NTSTATUS VfatClose (PVFAT_IRP_CONTEXT IrpContext)
 
   DPRINT ("VfatClose(DeviceObject %x, Irp %x)\n", DeviceObject, Irp);
 
+  if (IrpContext->DeviceObject == VfatGlobalData->DeviceObject)
+    {
+      DPRINT("Closing file system\n");
+      Status = STATUS_SUCCESS;
+      goto ByeBye;
+    }
+
   if (!ExAcquireResourceExclusiveLite (&IrpContext->DeviceExt->DirResource, IrpContext->Flags & IRPCONTEXT_CANWAIT))
   {
      return VfatQueueRequest (IrpContext);
@@ -88,6 +95,7 @@ NTSTATUS VfatClose (PVFAT_IRP_CONTEXT IrpContext)
   Status = VfatCloseFile (IrpContext->DeviceExt, IrpContext->FileObject);
   ExReleaseResourceLite (&IrpContext->DeviceExt->DirResource);
 
+ByeBye:
   IrpContext->Irp->IoStatus.Status = Status;
   IrpContext->Irp->IoStatus.Information = 0;
   IoCompleteRequest (IrpContext->Irp, IO_NO_INCREMENT);
index 848be64..3413baa 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: create.c,v 1.40 2002/05/05 20:18:33 hbirr Exp $
+/* $Id: create.c,v 1.41 2002/05/15 18:05:00 ekohl Exp $
  *
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
@@ -816,7 +816,8 @@ NTSTATUS VfatCreate (PVFAT_IRP_CONTEXT IrpContext)
 
   assert (IrpContext);
 
-  if (IrpContext->DeviceObject->Size == sizeof (DEVICE_OBJECT))
+//  if (IrpContext->DeviceObject->Size == sizeof (DEVICE_OBJECT))
+  if (IrpContext->DeviceObject == VfatGlobalData->DeviceObject)
   {
      /* DeviceObject represents FileSystem instead of logical volume */
      DPRINT ("FsdCreate called with file system\n");
index 1069359..6f801c7 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: iface.c,v 1.62 2002/03/18 22:37:12 hbirr Exp $
+/* $Id: iface.c,v 1.63 2002/05/15 18:05:00 ekohl Exp $
  *
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
@@ -58,7 +58,7 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
    DPRINT("VFAT 0.0.6\n");
 
    RtlInitUnicodeString(&DeviceName,
-                       L"\\Device\\Vfat");
+                       L"\\Fat");
    Status = IoCreateDevice(DriverObject,
                           sizeof(VFAT_GLOBAL_DATA),
                           &DeviceName,