Merge r51067
[reactos.git] / reactos / drivers / wdm / audio / legacy / wdmaud / control.c
index ee5d03f..3343405 100644 (file)
@@ -402,28 +402,6 @@ IoCompletion (
     /* sanity check */
     ASSERT(Header);
 
-    /* iterate through all stream headers and collect size */
-    do
-    {
-        if (Context->Function == IOCTL_KS_READ_STREAM)
-        {
-            /* length is stored in DataUsed */
-            Length += Header->DataUsed;
-        }
-        else
-        {
-            /* length stored in frameextend */
-            Length += Header->FrameExtent;
-        }
-
-        /* subtract size */
-        Context->Length -= Header->Size;
-
-        /* move to next stream header */
-        Header = (PKSSTREAM_HEADER)((ULONG_PTR)Header + Header->Size);
-
-    }while(Context->Length);
-
     /* time to free all allocated mdls */
     Mdl = Irp->MdlAddress;
 
@@ -452,15 +430,12 @@ IoCompletion (
     /* now free the mdl */
     IoFreeMdl(Context->Mdl);
 
-    /* now free the stream header */
-    ExFreePool(Irp->AssociatedIrp.SystemBuffer);
-
     DPRINT("IoCompletion Irp %p IoStatus %lx Information %lx Length %lu\n", Irp, Irp->IoStatus.Status, Irp->IoStatus.Information, Length);
 
-    if (Irp->IoStatus.Status == STATUS_SUCCESS)
+    if (!NT_SUCCESS(Irp->IoStatus.Status))
     {
-        /* store the length */
-        Irp->IoStatus.Information = Length;
+        /* failed */
+        Irp->IoStatus.Information = 0;
     }
 
     /* free context */
@@ -469,7 +444,6 @@ IoCompletion (
     return STATUS_SUCCESS;
 }
 
-
 NTSTATUS
 NTAPI
 WdmAudReadWrite(