[CDFS]
authorPierre Schweitzer <pierre@reactos.org>
Fri, 28 Apr 2017 19:32:44 +0000 (19:32 +0000)
committerPierre Schweitzer <pierre@reactos.org>
Fri, 28 Apr 2017 19:32:44 +0000 (19:32 +0000)
Fix returned data handling on directory enumeration.
Patch by Giannis Adamopoulos

CORE-13143

svn path=/trunk/; revision=74430

reactos/drivers/filesystems/cdfs/dirctl.c

index 3289600..f49bd04 100644 (file)
@@ -689,20 +689,11 @@ CdfsQueryDirectory(PDEVICE_OBJECT DeviceObject,
 
             if (Status == STATUS_BUFFER_OVERFLOW)
             {
 
             if (Status == STATUS_BUFFER_OVERFLOW)
             {
-                if (Buffer0)
-                {
-                    Buffer0->NextEntryOffset = 0;
-                }
                 break;
             }
         }
         else
         {
                 break;
             }
         }
         else
         {
-            if (Buffer0)
-            {
-                Buffer0->NextEntryOffset = 0;
-            }
-
             if (First)
             {
                 Status = STATUS_NO_SUCH_FILE;
             if (First)
             {
                 Status = STATUS_NO_SUCH_FILE;
@@ -717,12 +708,13 @@ CdfsQueryDirectory(PDEVICE_OBJECT DeviceObject,
         Buffer0 = (PFILE_NAMES_INFORMATION)Buffer;
         Buffer0->FileIndex = FileIndex++;
         Ccb->Entry++;
         Buffer0 = (PFILE_NAMES_INFORMATION)Buffer;
         Buffer0->FileIndex = FileIndex++;
         Ccb->Entry++;
+        BufferLength -= Buffer0->NextEntryOffset;
 
         if (Stack->Flags & SL_RETURN_SINGLE_ENTRY)
         {
             break;
         }
 
         if (Stack->Flags & SL_RETURN_SINGLE_ENTRY)
         {
             break;
         }
-        BufferLength -= Buffer0->NextEntryOffset;
+
         Buffer += Buffer0->NextEntryOffset;
     }
 
         Buffer += Buffer0->NextEntryOffset;
     }
 
@@ -734,6 +726,7 @@ CdfsQueryDirectory(PDEVICE_OBJECT DeviceObject,
     if (FileIndex > 0)
     {
         Status = STATUS_SUCCESS;
     if (FileIndex > 0)
     {
         Status = STATUS_SUCCESS;
+        Irp->IoStatus.Information = Stack->Parameters.QueryDirectory.Length - BufferLength;
     }
 
     return(Status);
     }
 
     return(Status);
@@ -793,6 +786,8 @@ CdfsDirectoryControl(
     Irp = IrpContext->Irp;
     DeviceObject = IrpContext->DeviceObject;
 
     Irp = IrpContext->Irp;
     DeviceObject = IrpContext->DeviceObject;
 
+    Irp->IoStatus.Information = 0;
+
     switch (IrpContext->MinorFunction)
     {
     case IRP_MN_QUERY_DIRECTORY:
     switch (IrpContext->MinorFunction)
     {
     case IRP_MN_QUERY_DIRECTORY:
@@ -811,11 +806,6 @@ CdfsDirectoryControl(
         break;
     }
 
         break;
     }
 
-    if (Status != STATUS_PENDING)
-    {
-        Irp->IoStatus.Information = 0;
-    }
-
     return(Status);
 }
 
     return(Status);
 }