[NTFS]
[reactos.git] / reactos / drivers / filesystems / ntfs / rw.c
index 336e107..13e9d86 100644 (file)
@@ -71,14 +71,17 @@ NtfsReadFile(PDEVICE_EXTENSION DeviceExt,
 
     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)
     {
         DPRINT1("Not enough memory!\n");
-        if (AllocatedBuffer)
-        {
-            ExFreePoolWithTag(ReadBuffer, TAG_NTFS);
-        }
         return STATUS_INSUFFICIENT_RESOURCES;
     }
 
@@ -87,10 +90,6 @@ NtfsReadFile(PDEVICE_EXTENSION DeviceExt,
     {
         DPRINT1("Can't find record!\n");
         ExFreePoolWithTag(FileRecord, TAG_NTFS);
-        if (AllocatedBuffer)
-        {
-            ExFreePoolWithTag(ReadBuffer, TAG_NTFS);
-        }
         return Status;
     }
 
@@ -98,13 +97,14 @@ NtfsReadFile(PDEVICE_EXTENSION DeviceExt,
     Status = FindAttribute(DeviceExt, FileRecord, AttributeData, Fcb->Stream, wcslen(Fcb->Stream), &DataContext);
     if (!NT_SUCCESS(Status))
     {
+        NTSTATUS BrowseStatus;
+        FIND_ATTR_CONTXT Context;
         PNTFS_ATTR_RECORD Attribute;
 
         DPRINT1("No '%S' data stream associated with file!\n", Fcb->Stream);
 
-        Attribute = (PNTFS_ATTR_RECORD)((ULONG_PTR)FileRecord + FileRecord->AttributeOffset);
-        while (Attribute < (PNTFS_ATTR_RECORD)((ULONG_PTR)FileRecord + FileRecord->BytesInUse) &&
-               Attribute->Type != AttributeEnd)
+        BrowseStatus = FindFirstAttribute(&Context, DeviceExt, FileRecord, FALSE, &Attribute);
+        while (NT_SUCCESS(BrowseStatus))
         {
             if (Attribute->Type == AttributeData)
             {
@@ -116,8 +116,9 @@ NtfsReadFile(PDEVICE_EXTENSION DeviceExt,
                 DPRINT1("Data stream: '%wZ' available\n", &Name);
             }
 
-            Attribute = (PNTFS_ATTR_RECORD)((ULONG_PTR)Attribute + Attribute->Length);
+            BrowseStatus = FindNextAttribute(&Context, &Attribute);
         }
+        FindCloseAttribute(&Context);
 
         ReleaseAttributeContext(DataContext);
         ExFreePoolWithTag(FileRecord, TAG_NTFS);