[NTFS]
authorPierre Schweitzer <pierre@reactos.org>
Sun, 14 Feb 2016 22:44:54 +0000 (22:44 +0000)
committerPierre Schweitzer <pierre@reactos.org>
Sun, 14 Feb 2016 22:44:54 +0000 (22:44 +0000)
Cowardly refuse to continue processing (enumerating/reading) when stumbling upon a compressed entry.
This avoids infinite loops when enumerating, incorrect files contents when reading.

CORE-10814 #resolve #comment 'Fixed' with r70750

svn path=/trunk/; revision=70750

reactos/drivers/filesystems/ntfs/dirctl.c
reactos/drivers/filesystems/ntfs/fcb.c
reactos/drivers/filesystems/ntfs/ntfs.h
reactos/drivers/filesystems/ntfs/rw.c

index a9d16fd..53e70ba 100644 (file)
@@ -298,6 +298,13 @@ NtfsQueryDirectory(PNTFS_IRP_CONTEXT IrpContext)
     FileInformationClass = Stack->Parameters.QueryDirectory.FileInformationClass;
     FileIndex = Stack->Parameters.QueryDirectory.FileIndex;
 
     FileInformationClass = Stack->Parameters.QueryDirectory.FileInformationClass;
     FileIndex = Stack->Parameters.QueryDirectory.FileIndex;
 
+    if (NtfsFCBIsCompressed(Fcb))
+    {
+        DPRINT1("Compressed directory!\n");
+        UNIMPLEMENTED;
+        return STATUS_NOT_IMPLEMENTED;
+    }
+
     if (SearchPattern != NULL)
     {
         if (!Ccb->DirectorySearchPattern)
     if (SearchPattern != NULL)
     {
         if (!Ccb->DirectorySearchPattern)
index 278ea3e..e3ac61f 100644 (file)
@@ -137,6 +137,12 @@ NtfsFCBIsReparsePoint(PNTFS_FCB Fcb)
 }
 
 
 }
 
 
+BOOLEAN
+NtfsFCBIsCompressed(PNTFS_FCB Fcb)
+{
+    return ((Fcb->Entry.FileAttributes & NTFS_FILE_TYPE_COMPRESSED) == NTFS_FILE_TYPE_COMPRESSED); 
+}
+
 BOOLEAN
 NtfsFCBIsRoot(PNTFS_FCB Fcb)
 {
 BOOLEAN
 NtfsFCBIsRoot(PNTFS_FCB Fcb)
 {
index 037bbe4..0ecd315 100644 (file)
@@ -642,6 +642,9 @@ NtfsFCBIsDirectory(PNTFS_FCB Fcb);
 BOOLEAN
 NtfsFCBIsReparsePoint(PNTFS_FCB Fcb);
 
 BOOLEAN
 NtfsFCBIsReparsePoint(PNTFS_FCB Fcb);
 
+BOOLEAN
+NtfsFCBIsCompressed(PNTFS_FCB Fcb);
+
 BOOLEAN
 NtfsFCBIsRoot(PNTFS_FCB Fcb);
 
 BOOLEAN
 NtfsFCBIsRoot(PNTFS_FCB Fcb);
 
index 572bd85..13e9d86 100644 (file)
@@ -71,6 +71,13 @@ NtfsReadFile(PDEVICE_EXTENSION DeviceExt,
 
     Fcb = (PNTFS_FCB)FileObject->FsContext;
 
 
     Fcb = (PNTFS_FCB)FileObject->FsContext;
 
+    if (NtfsFCBIsCompressed(Fcb))
+    {
+        DPRINT1("Compressed file!\n");
+        UNIMPLEMENTED;
+        return STATUS_NOT_IMPLEMENTED;
+    }
+
     FileRecord = ExAllocatePoolWithTag(NonPagedPool, DeviceExt->NtfsInfo.BytesPerFileRecord, TAG_NTFS);
     if (FileRecord == NULL)
     {
     FileRecord = ExAllocatePoolWithTag(NonPagedPool, DeviceExt->NtfsInfo.BytesPerFileRecord, TAG_NTFS);
     if (FileRecord == NULL)
     {