[NTFS] Fix 2 Clang-Cl warnings about CurrentKey->IndexEntry->Flags
[reactos.git] / drivers / filesystems / fs_rec / fs_rec.c
index a74d808..185d37c 100644 (file)
@@ -10,6 +10,7 @@
 /* INCLUDES *****************************************************************/
 
 #include "fs_rec.h"
+
 #define NDEBUG
 #include <debug.h>
 
@@ -60,7 +61,7 @@ FsRecLoadFileSystem(IN PDEVICE_OBJECT DeviceObject,
         /* Make sure that we haven't already loaded the FS */
         if (DeviceExtension->State != Loaded)
         {
-            /* Unregiser us, and set us as loaded */
+            /* Unregister us, and set us as loaded */
             IoUnregisterFileSystem(DeviceObject);
             DeviceExtension->State = Loaded;
         }
@@ -84,6 +85,8 @@ FsRecCreate(IN PDEVICE_OBJECT DeviceObject,
     NTSTATUS Status;
     PAGED_CODE();
 
+    UNREFERENCED_PARAMETER(DeviceObject);
+
     /* Make sure we have a file name */
     if (IoStack->FileObject->FileName.Length)
     {
@@ -111,6 +114,8 @@ FsRecClose(IN PDEVICE_OBJECT DeviceObject,
 {
     PAGED_CODE();
 
+    UNREFERENCED_PARAMETER(DeviceObject);
+
     /* Just complete the IRP and return success */
     IoCompleteRequest(Irp, IO_NO_INCREMENT);
     return STATUS_SUCCESS;
@@ -159,6 +164,24 @@ FsRecFsControl(IN PDEVICE_OBJECT DeviceObject,
             Status = FsRecExt2FsControl(DeviceObject, Irp);
             break;
 
+        case FS_TYPE_BTRFS:
+
+            /* Send BTRFS command */
+            Status = FsRecBtrfsFsControl(DeviceObject, Irp);
+            break;
+
+        case FS_TYPE_REISERFS:
+
+            /* Send REISERFS command */
+            Status = FsRecReiserfsFsControl(DeviceObject, Irp);
+            break;
+
+        case FS_TYPE_FFS:
+
+            /* Send FFS command */
+            Status = FsRecFfsFsControl(DeviceObject, Irp);
+            break;
+
         default:
 
             /* Unrecognized FS */
@@ -197,7 +220,8 @@ FsRecRegisterFs(IN PDRIVER_OBJECT DriverObject,
                 IN PCWSTR FsName,
                 IN PCWSTR RecognizerName,
                 IN ULONG FsType,
-                IN DEVICE_TYPE DeviceType)
+                IN DEVICE_TYPE DeviceType,
+                IN ULONG AdditionalFlags)
 {
     OBJECT_ATTRIBUTES ObjectAttributes;
     IO_STATUS_BLOCK IoStatus;
@@ -232,7 +256,7 @@ FsRecRegisterFs(IN PDRIVER_OBJECT DriverObject,
                           0);
     if (NT_SUCCESS(Status))
     {
-        /* We suceeded, close the handle */
+        /* We succeeded, close the handle */
         ZwClose(FileHandle);
     }
     else if (Status != STATUS_OBJECT_NAME_NOT_FOUND)
@@ -255,6 +279,9 @@ FsRecRegisterFs(IN PDRIVER_OBJECT DriverObject,
                             &DeviceObject);
     if (NT_SUCCESS(Status))
     {
+        /* Set additional flags in the device object */
+        DeviceObject->Flags |= AdditionalFlags;
+
         /* Get the device extension and set it up */
         DeviceExtension = DeviceObject->DeviceExtension;
         DeviceExtension->FsType = FsType;
@@ -293,9 +320,12 @@ DriverEntry(IN PDRIVER_OBJECT DriverObject,
 {
     ULONG DeviceCount = 0;
     NTSTATUS Status;
+    PDEVICE_OBJECT CdfsObject;
     PDEVICE_OBJECT UdfsObject;
     PAGED_CODE();
 
+    UNREFERENCED_PARAMETER(RegistryPath);
+
     /* Page the entire driver */
     MmPageEntireDriver(DriverEntry);
 
@@ -315,14 +345,26 @@ DriverEntry(IN PDRIVER_OBJECT DriverObject,
     DriverObject->MajorFunction[IRP_MJ_FILE_SYSTEM_CONTROL] = FsRecFsControl;
     DriverObject->DriverUnload = FsRecUnload;
 
-    /* Register CDFS */
+    /* Register CDFS for CDs */
     Status = FsRecRegisterFs(DriverObject,
                              NULL,
-                             NULL,
+                             &CdfsObject,
                              L"\\Cdfs",
                              L"\\FileSystem\\CdfsRecognizer",
                              FS_TYPE_CDFS,
-                             FILE_DEVICE_CD_ROM_FILE_SYSTEM);
+                             FILE_DEVICE_CD_ROM_FILE_SYSTEM,
+                             DO_LOW_PRIORITY_FILESYSTEM);
+    if (NT_SUCCESS(Status)) DeviceCount++;
+
+    /* Register CDFS for HDDs */
+    Status = FsRecRegisterFs(DriverObject,
+                             CdfsObject,
+                             NULL,
+                             L"\\CdfsHdd",
+                             L"\\FileSystem\\CdfsHddRecognizer",
+                             FS_TYPE_CDFS,
+                             FILE_DEVICE_DISK_FILE_SYSTEM,
+                             DO_LOW_PRIORITY_FILESYSTEM);
     if (NT_SUCCESS(Status)) DeviceCount++;
 
     /* Register UDFS for CDs */
@@ -332,7 +374,8 @@ DriverEntry(IN PDRIVER_OBJECT DriverObject,
                              L"\\UdfsCdRom",
                              L"\\FileSystem\\UdfsCdRomRecognizer",
                              FS_TYPE_UDFS,
-                             FILE_DEVICE_CD_ROM_FILE_SYSTEM);
+                             FILE_DEVICE_CD_ROM_FILE_SYSTEM,
+                             0);
     if (NT_SUCCESS(Status)) DeviceCount++;
 
     /* Register UDFS for HDDs */
@@ -342,7 +385,8 @@ DriverEntry(IN PDRIVER_OBJECT DriverObject,
                              L"\\UdfsDisk",
                              L"\\FileSystem\\UdfsDiskRecognizer",
                              FS_TYPE_UDFS,
-                             FILE_DEVICE_DISK_FILE_SYSTEM);
+                             FILE_DEVICE_DISK_FILE_SYSTEM,
+                             0);
     if (NT_SUCCESS(Status)) DeviceCount++;
 
     /* Register FAT */
@@ -352,7 +396,8 @@ DriverEntry(IN PDRIVER_OBJECT DriverObject,
                              L"\\Fat",
                              L"\\FileSystem\\FatRecognizer",
                              FS_TYPE_VFAT,
-                             FILE_DEVICE_DISK_FILE_SYSTEM);
+                             FILE_DEVICE_DISK_FILE_SYSTEM,
+                             0);
     if (NT_SUCCESS(Status)) DeviceCount++;
 
     /* Register NTFS */
@@ -362,18 +407,53 @@ DriverEntry(IN PDRIVER_OBJECT DriverObject,
                              L"\\Ntfs",
                              L"\\FileSystem\\NtfsRecognizer",
                              FS_TYPE_NTFS,
-                             FILE_DEVICE_DISK_FILE_SYSTEM);
+                             FILE_DEVICE_DISK_FILE_SYSTEM,
+                             0);
     if (NT_SUCCESS(Status)) DeviceCount++;
 
     /* Register EXT2 */
-    /*Status = FsRecRegisterFs(DriverObject,
+    Status = FsRecRegisterFs(DriverObject,
                              NULL,
                              NULL,
-                             L"\\Ext2",
+                             L"\\Ext2fs",
                              L"\\FileSystem\\Ext2Recognizer",
                              FS_TYPE_EXT2,
-                             FILE_DEVICE_DISK_FILE_SYSTEM);
-    if (NT_SUCCESS(Status)) DeviceCount++;*/
+                             FILE_DEVICE_DISK_FILE_SYSTEM,
+                             0);
+    if (NT_SUCCESS(Status)) DeviceCount++;
+
+    /* Register BTRFS */
+    Status = FsRecRegisterFs(DriverObject,
+                             NULL,
+                             NULL,
+                             L"\\Btrfs",
+                             L"\\FileSystem\\BtrfsRecognizer",
+                             FS_TYPE_BTRFS,
+                             FILE_DEVICE_DISK_FILE_SYSTEM,
+                             0);
+    if (NT_SUCCESS(Status)) DeviceCount++;
+
+    /* Register REISERFS */
+    Status = FsRecRegisterFs(DriverObject,
+                             NULL,
+                             NULL,
+                             L"\\Reiserfs",
+                             L"\\FileSystem\\ReiserfsRecognizer",
+                             FS_TYPE_REISERFS,
+                             FILE_DEVICE_DISK_FILE_SYSTEM,
+                             0);
+    if (NT_SUCCESS(Status)) DeviceCount++;
+
+    /* Register FFS */
+    Status = FsRecRegisterFs(DriverObject,
+                             NULL,
+                             NULL,
+                             L"\\ffs",
+                             L"\\FileSystem\\FfsRecognizer",
+                             FS_TYPE_FFS,
+                             FILE_DEVICE_DISK_FILE_SYSTEM,
+                             0);
+    if (NT_SUCCESS(Status)) DeviceCount++;
 
     /* Return appropriate Status */
     return (DeviceCount > 0) ? STATUS_SUCCESS : STATUS_IMAGE_ALREADY_LOADED;