[ros-diffs] [janderwald] 43035: [KS] - Store Object Header in FsContext2 - Fix allocation of create item entry in KsAllocateObjectCreateItem - Fix de-referencing in Ks[De]ReferenceSoftwareBusObject & Ks[De]ReferenceBusObject - Fake success in KsEnableEvent - Check if the list empty in KspFreeEventList - Handle GUID_NULL in KspPropertyHandler - Return STATUS_MORE_ENTRIES if outputbuffer is too small - Zero struct in KsRegisterWorker [PORTCLS] - Store dispatch context in FsContext - Ignore return value in interrupt sync routine [[Amine Khaldi]] - Disable assert for frame size check for now - Free buffer only if the irp was from kernel mode(hack 2 be removed) - remove unused includes [[Amine Khaldi]] - Don't attempt copying an empty resource list [[Amine Khaldi]] [WDMAUD_KERNEL] - Check if allocation succeeded [[Amine Khaldi]] [SYSAUDIO] - Store dispatch context in FsContext2

janderwald at svn.reactos.org janderwald at svn.reactos.org
Sat Sep 12 16:35:28 CEST 2009


Author: janderwald
Date: Sat Sep 12 16:35:27 2009
New Revision: 43035

URL: http://svn.reactos.org/svn/reactos?rev=43035&view=rev
Log:
[KS]
- Store Object Header in FsContext2
- Fix allocation of create item entry in KsAllocateObjectCreateItem
- Fix de-referencing in Ks[De]ReferenceSoftwareBusObject & Ks[De]ReferenceBusObject
- Fake success in KsEnableEvent
- Check if the list empty in KspFreeEventList
- Handle GUID_NULL in KspPropertyHandler
- Return STATUS_MORE_ENTRIES if outputbuffer is too small
- Zero struct in KsRegisterWorker
[PORTCLS]
- Store dispatch context in FsContext
- Ignore return value in interrupt sync routine [[Amine Khaldi]]
- Disable assert for frame size check for now
- Free buffer only if the irp was from kernel mode(hack 2 be removed)
- remove unused includes [[Amine Khaldi]]
- Don't attempt copying an empty resource list [[Amine Khaldi]]
[WDMAUD_KERNEL]
- Check if allocation succeeded [[Amine Khaldi]]
[SYSAUDIO]
- Store dispatch context in FsContext2


Modified:
    trunk/reactos/drivers/ksfilter/ks/allocators.c
    trunk/reactos/drivers/ksfilter/ks/api.c
    trunk/reactos/drivers/ksfilter/ks/connectivity.c
    trunk/reactos/drivers/ksfilter/ks/device.c
    trunk/reactos/drivers/ksfilter/ks/event.c
    trunk/reactos/drivers/ksfilter/ks/filter.c
    trunk/reactos/drivers/ksfilter/ks/irp.c
    trunk/reactos/drivers/ksfilter/ks/misc.c
    trunk/reactos/drivers/ksfilter/ks/pin.c
    trunk/reactos/drivers/ksfilter/ks/property.c
    trunk/reactos/drivers/ksfilter/ks/topology.c
    trunk/reactos/drivers/ksfilter/ks/worker.c
    trunk/reactos/drivers/wdm/audio/backpln/portcls/dispatcher.cpp
    trunk/reactos/drivers/wdm/audio/backpln/portcls/interrupt.cpp
    trunk/reactos/drivers/wdm/audio/backpln/portcls/irpstream.cpp
    trunk/reactos/drivers/wdm/audio/backpln/portcls/private.hpp
    trunk/reactos/drivers/wdm/audio/backpln/portcls/propertyhandler.cpp
    trunk/reactos/drivers/wdm/audio/backpln/portcls/registry.cpp
    trunk/reactos/drivers/wdm/audio/backpln/portcls/resource.cpp
    trunk/reactos/drivers/wdm/audio/backpln/portcls/undoc.cpp
    trunk/reactos/drivers/wdm/audio/legacy/wdmaud/control.c
    trunk/reactos/drivers/wdm/audio/sysaudio/control.c
    trunk/reactos/drivers/wdm/audio/sysaudio/pin.c
    trunk/reactos/drivers/wdm/audio/sysaudio/sysaudio.h

Modified: trunk/reactos/drivers/ksfilter/ks/allocators.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/allocators.c?rev=43035&r1=43034&r2=43035&view=diff
==============================================================================
--- trunk/reactos/drivers/ksfilter/ks/allocators.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/ksfilter/ks/allocators.c [iso-8859-1] Sat Sep 12 16:35:27 2009
@@ -445,7 +445,7 @@
     ASSERT(FileObject);
 
     /* get object header */
-    Header = (PKSIOBJECT_HEADER)FileObject->FsContext;
+    Header = (PKSIOBJECT_HEADER)FileObject->FsContext2;
 
     /* get real allocator */
     Status = Header->Unknown->lpVtbl->QueryInterface(Header->Unknown, &IID_IKsAllocator, (PVOID*)&Allocator);

Modified: trunk/reactos/drivers/ksfilter/ks/api.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/api.c?rev=43035&r1=43034&r2=43035&view=diff
==============================================================================
--- trunk/reactos/drivers/ksfilter/ks/api.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/ksfilter/ks/api.c [iso-8859-1] Sat Sep 12 16:35:27 2009
@@ -494,8 +494,8 @@
         Entry = (PCREATE_ITEM_ENTRY)CONTAINING_RECORD(RemoveHeadList(ListHead), CREATE_ITEM_ENTRY, Entry);
 
         /* caller shouldnt have any references */
-        ASSERT(Entry->ReferenceCount == 0);
-        ASSERT(IsListEmpty(&Entry->ObjectItemList));
+        //ASSERT(Entry->ReferenceCount == 0);
+        //ASSERT(IsListEmpty(&Entry->ObjectItemList));
 
         /* does the creator wish notification */
         if (Entry->ItemFreeCallback)
@@ -687,8 +687,7 @@
         }
     }
     /* store the object in the file object */
-    ASSERT(IoStack->FileObject->FsContext == NULL);
-    IoStack->FileObject->FsContext = ObjectHeader;
+    IoStack->FileObject->FsContext2 = ObjectHeader;
 
     /* store parent device */
     ObjectHeader->ParentDeviceObject = IoGetRelatedDeviceObject(IoStack->FileObject);
@@ -719,6 +718,8 @@
     IN  PVOID Header)
 {
     PKSIOBJECT_HEADER ObjectHeader = (PKSIOBJECT_HEADER) Header;
+
+    DPRINT1("KsFreeObjectHeader Header %p Class %wZ\n", Header, &ObjectHeader->ObjectClass);
 
     if (ObjectHeader->ObjectClass.Buffer)
     {
@@ -825,7 +826,7 @@
         /* increment create item count */
         InterlockedIncrement(&Header->ItemListCount);
     }
-
+    DPRINT("KsAddObjectCreateItemToDeviceHeader Status %x\n", Status);
     return Status;
 }
 
@@ -898,7 +899,7 @@
         return STATUS_INVALID_PARAMETER_2;
 
     /* first allocate a create entry */
-    CreateEntry = AllocateItem(NonPagedPool, sizeof(PCREATE_ITEM_ENTRY));
+    CreateEntry = AllocateItem(NonPagedPool, sizeof(CREATE_ITEM_ENTRY));
 
     /* check for allocation success */
     if (!CreateEntry)
@@ -1121,7 +1122,7 @@
 
 
     /* get object header */
-    ObjectHeader = (PKSIOBJECT_HEADER)FileObject->FsContext;
+    ObjectHeader = (PKSIOBJECT_HEADER)FileObject->FsContext2;
 
     /* check if there is fast device io function */
     if (ObjectHeader && ObjectHeader->DispatchTable.FastDeviceIoControl)
@@ -1129,7 +1130,7 @@
         IoStatusBlock.Status = STATUS_UNSUCCESSFUL;
         IoStatusBlock.Information = 0;
 
-        /* it is send the request */
+        /* send the request */
         Status = ObjectHeader->DispatchTable.FastDeviceIoControl(FileObject, TRUE, InBuffer, InSize, OutBuffer, OutSize, IoControl, &IoStatusBlock, DeviceObject);
         /* check if the request was handled */
         //DPRINT("Handled %u Status %x Length %u\n", Status, IoStatusBlock.Status, IoStatusBlock.Information);

Modified: trunk/reactos/drivers/ksfilter/ks/connectivity.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/connectivity.c?rev=43035&r1=43034&r2=43035&view=diff
==============================================================================
--- trunk/reactos/drivers/ksfilter/ks/connectivity.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/ksfilter/ks/connectivity.c [iso-8859-1] Sat Sep 12 16:35:27 2009
@@ -199,6 +199,8 @@
 
     IoStack = IoGetCurrentIrpStackLocation(Irp);
     Buffer = Irp->UserBuffer;
+
+    DPRINT("KsPinPropertyHandler Irp %p Property %p Data %p DescriptorsCount %u Descriptor %p OutputLength %u Id %x\n", Irp, Property, Data, DescriptorsCount, Descriptor, IoStack->Parameters.DeviceIoControl.OutputBufferLength, Property->Id);
 
     switch(Property->Id)
     {

Modified: trunk/reactos/drivers/ksfilter/ks/device.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/device.c?rev=43035&r1=43034&r2=43035&view=diff
==============================================================================
--- trunk/reactos/drivers/ksfilter/ks/device.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/ksfilter/ks/device.c [iso-8859-1] Sat Sep 12 16:35:27 2009
@@ -570,7 +570,7 @@
     if (IoStack->FileObject->RelatedFileObject != NULL)
     {
         /* request is to instantiate a pin / node / clock / allocator */
-        ObjectHeader = (PKSIOBJECT_HEADER)IoStack->FileObject->RelatedFileObject->FsContext;
+        ObjectHeader = (PKSIOBJECT_HEADER)IoStack->FileObject->RelatedFileObject->FsContext2;
 
         /* sanity check */
         ASSERT(ObjectHeader);
@@ -717,7 +717,7 @@
      PKSIDEVICE_HEADER DeviceHeader = (PKSIDEVICE_HEADER)Header;
 
      /* get device interface */
-     Device = (IKsDevice*)&DeviceHeader->lpVtblIKsDevice;
+     Device = (IKsDevice*)DeviceHeader->lpVtblIKsDevice;
 
      if (Device)
      {
@@ -741,7 +741,7 @@
      PKSIDEVICE_HEADER DeviceHeader = (PKSIDEVICE_HEADER)Header;
 
      /* get device interface */
-     Device = (IKsDevice*)&DeviceHeader->lpVtblIKsDevice;
+     Device = (IKsDevice*)DeviceHeader->lpVtblIKsDevice;
 
      if (Device)
      {
@@ -766,7 +766,7 @@
      PKSIDEVICE_HEADER DeviceHeader = (PKSIDEVICE_HEADER)Header;
 
      /* get device interface */
-     Device = (IKsDevice*)&DeviceHeader->lpVtblIKsDevice;
+     Device = (IKsDevice*)DeviceHeader->lpVtblIKsDevice;
 
      if (Device)
      {
@@ -783,11 +783,14 @@
 NTAPI
 KsDereferenceSoftwareBusObject(
     IN KSDEVICE_HEADER  Header)
-{     IKsDevice * Device;
+{
+     IKsDevice * Device;
      PKSIDEVICE_HEADER DeviceHeader = (PKSIDEVICE_HEADER)Header;
 
+     DPRINT1("KsDereferenceSoftwareBusObject DeviceHeader %p\n", Header);
+
      /* get device interface */
-     Device = (IKsDevice*)&DeviceHeader->lpVtblIKsDevice;
+     Device = (IKsDevice*)DeviceHeader->lpVtblIKsDevice;
 
      if (Device)
      {

Modified: trunk/reactos/drivers/ksfilter/ks/event.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/event.c?rev=43035&r1=43034&r2=43035&view=diff
==============================================================================
--- trunk/reactos/drivers/ksfilter/ks/event.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/ksfilter/ks/event.c [iso-8859-1] Sat Sep 12 16:35:27 2009
@@ -87,7 +87,7 @@
     IN  PVOID EventsLock OPTIONAL)
 {
     UNIMPLEMENTED;
-    return STATUS_UNSUCCESSFUL;
+    return STATUS_SUCCESS;
 }
 
 /*
@@ -218,7 +218,7 @@
 KsDiscardEvent(
     IN  PKSEVENT_ENTRY EventEntry)
 {
-    UNIMPLEMENTED;
+    //UNIMPLEMENTED;
 }
 
 
@@ -232,6 +232,9 @@
 
     /* check valid input */
     if (!Ctx || !Ctx->List)
+        return FALSE;
+
+    if (IsListEmpty(Ctx->List))
         return FALSE;
 
     /* remove first entry */
@@ -358,7 +361,7 @@
     IoStack = IoGetCurrentIrpStackLocation(Irp);
 
     /* now get the object header */
-    ObjectHeader =(PKSIOBJECT_HEADER)IoStack->FileObject->FsContext;
+    ObjectHeader =(PKSIOBJECT_HEADER)IoStack->FileObject->FsContext2;
 
     /* sanity check */
     ASSERT(ObjectHeader->ObjectType);

Modified: trunk/reactos/drivers/ksfilter/ks/filter.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/filter.c?rev=43035&r1=43034&r2=43035&view=diff
==============================================================================
--- trunk/reactos/drivers/ksfilter/ks/filter.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/ksfilter/ks/filter.c [iso-8859-1] Sat Sep 12 16:35:27 2009
@@ -444,7 +444,7 @@
     /* santiy check */
     ASSERT(IoStack->FileObject != NULL);
 
-    ObjectHeader = (PKSIOBJECT_HEADER)IoStack->FileObject->FsContext;
+    ObjectHeader = (PKSIOBJECT_HEADER)IoStack->FileObject->FsContext2;
 
     /* sanity is important */
     ASSERT(ObjectHeader != NULL);
@@ -1529,7 +1529,7 @@
     ASSERT(IoStack->FileObject);
 
     /* get object header */
-    ObjectHeader = (PKSIOBJECT_HEADER)IoStack->FileObject->FsContext;
+    ObjectHeader = (PKSIOBJECT_HEADER)IoStack->FileObject->FsContext2;
 
     if (ObjectHeader->Type == KsObjectTypeFilter)
     {

Modified: trunk/reactos/drivers/ksfilter/ks/irp.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/irp.c?rev=43035&r1=43034&r2=43035&view=diff
==============================================================================
--- trunk/reactos/drivers/ksfilter/ks/irp.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/ksfilter/ks/irp.c [iso-8859-1] Sat Sep 12 16:35:27 2009
@@ -555,7 +555,7 @@
     if (RequestorMode || ExGetPreviousMode() == KernelMode)
     {
         /* requestor is from kernel land */
-        ObjectHeader = (PKSIOBJECT_HEADER)FileObject->FsContext;
+        ObjectHeader = (PKSIOBJECT_HEADER)FileObject->FsContext2;
 
         if (ObjectHeader)
         {
@@ -1348,6 +1348,8 @@
     PLIST_ENTRY CurEntry;
     KIRQL OldIrql;
 
+    DPRINT("KsRemoveIrpFromCancelableQueue ListHead %p SpinLock %p ListLocation %x RemovalOperation %x\n", QueueHead, SpinLock, ListLocation, RemovalOperation);
+
     /* check parameters */
     if (!QueueHead || !SpinLock)
         return NULL;
@@ -1572,6 +1574,8 @@
     PKSPIN_LOCK SpinLock;
     KIRQL OldLevel;
 
+    DPRINT("KsRemoveSpecificIrpFromCancelableQueue %p\n", Irp);
+
     /* get internal queue lock */
     SpinLock = KSQUEUE_SPINLOCK_IRP_STORAGE(Irp);
 
@@ -1603,6 +1607,7 @@
     PIO_STACK_LOCATION IoStack;
     KIRQL OldLevel;
 
+    DPRINT1("KsAddIrpToCancelableQueue QueueHead %p SpinLock %p Irp %p ListLocation %x DriverCancel %p\n", QueueHead, SpinLock, Irp, ListLocation, DriverCancel);
     /* check for required parameters */
     if (!QueueHead || !SpinLock || !Irp)
         return;
@@ -1796,7 +1801,7 @@
     if (IoStack->FileObject->RelatedFileObject != NULL)
     {
         /* request is to instantiate a pin / node / clock / allocator */
-        ObjectHeader = (PKSIOBJECT_HEADER)IoStack->FileObject->RelatedFileObject->FsContext;
+        ObjectHeader = (PKSIOBJECT_HEADER)IoStack->FileObject->RelatedFileObject->FsContext2;
 
         /* sanity check */
         ASSERT(ObjectHeader);
@@ -1858,7 +1863,7 @@
     ASSERT(IoStack->FileObject);
 
     /* get object header */
-    ObjectHeader = (PKSIOBJECT_HEADER) IoStack->FileObject->FsContext;
+    ObjectHeader = (PKSIOBJECT_HEADER) IoStack->FileObject->FsContext2;
 
     if (!ObjectHeader)
     {
@@ -1931,11 +1936,18 @@
     IN  PDRIVER_OBJECT DriverObject,
     IN  ULONG MajorFunction)
 {
+    DPRINT("KsSetMajorFunctionHandler Function %x\n", MajorFunction);
+#if 0
+    // HACK
+    // for MS PORTCLS
+    //
+    DriverObject->MajorFunction[IRP_MJ_CREATE] = KspCreate;
+#endif
+
     switch ( MajorFunction )
     {
         case IRP_MJ_CREATE:
             DriverObject->MajorFunction[MajorFunction] = KspCreate;
-            break;
             break;
         case IRP_MJ_DEVICE_CONTROL:
         case IRP_MJ_CLOSE:
@@ -1947,6 +1959,7 @@
             DriverObject->MajorFunction[MajorFunction] = KspDispatchIrp;
             break;
         default:
+            DPRINT1("NotSupported %x\n", MajorFunction);
             return STATUS_INVALID_PARAMETER;
     };
 
@@ -1966,6 +1979,8 @@
     PIO_STACK_LOCATION IoStack;
     PKSIDEVICE_HEADER DeviceHeader;
     PDEVICE_EXTENSION DeviceExtension;
+
+    DPRINT("KsDispatchIrp DeviceObject %p Irp %p\n", DeviceObject, Irp);
 
     /* get device extension */
     DeviceExtension = (PDEVICE_EXTENSION)DeviceObject->DeviceExtension;

Modified: trunk/reactos/drivers/ksfilter/ks/misc.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/misc.c?rev=43035&r1=43034&r2=43035&view=diff
==============================================================================
--- trunk/reactos/drivers/ksfilter/ks/misc.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/ksfilter/ks/misc.c [iso-8859-1] Sat Sep 12 16:35:27 2009
@@ -151,7 +151,7 @@
     PKSIOBJECT_HEADER ObjectHeader;
 
     /* get object header */
-    ObjectHeader = (PKSIOBJECT_HEADER)FileObject->FsContext;
+    ObjectHeader = (PKSIOBJECT_HEADER)FileObject->FsContext2;
 
     /* return associated object */
     return ObjectHeader->ObjectType;
@@ -169,7 +169,7 @@
     PKSIOBJECT_HEADER ObjectHeader;
 
     /* get object header */
-    ObjectHeader = (PKSIOBJECT_HEADER)FileObject->FsContext;
+    ObjectHeader = (PKSIOBJECT_HEADER)FileObject->FsContext2;
     /* return type */
     return ObjectHeader->Type;
 }
@@ -188,7 +188,7 @@
     /* get current irp stack */
     IoStack = IoGetCurrentIrpStackLocation(Irp);
     /* get object header */
-    ObjectHeader = (PKSIOBJECT_HEADER)IoStack->FileObject->FsContext;
+    ObjectHeader = (PKSIOBJECT_HEADER)IoStack->FileObject->FsContext2;
     /* return type */
     return ObjectHeader->Type;
 }

Modified: trunk/reactos/drivers/ksfilter/ks/pin.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/pin.c?rev=43035&r1=43034&r2=43035&view=diff
==============================================================================
--- trunk/reactos/drivers/ksfilter/ks/pin.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/ksfilter/ks/pin.c [iso-8859-1] Sat Sep 12 16:35:27 2009
@@ -548,7 +548,7 @@
     PIO_STACK_LOCATION IoStack = IoGetCurrentIrpStackLocation(Irp);
 
     /* get object header */
-    ObjectHeader = (PKSIOBJECT_HEADER)IoStack->FileObject->FsContext;
+    ObjectHeader = (PKSIOBJECT_HEADER)IoStack->FileObject->FsContext2;
     /* return object type */
     return (PKSPIN)ObjectHeader->ObjectType;
 
@@ -904,10 +904,10 @@
 
     /* sanity check */
     ASSERT(IoStack->FileObject);
-    ASSERT(IoStack->FileObject->FsContext);
+    ASSERT(IoStack->FileObject->FsContext2);
 
     /* get the object header */
-    ObjectHeader = (PKSIOBJECT_HEADER)IoStack->FileObject->FsContext;
+    ObjectHeader = (PKSIOBJECT_HEADER)IoStack->FileObject->FsContext2;
 
     /* locate ks pin implemention fro KSPIN offset */
     This = (IKsPinImpl*)CONTAINING_RECORD(ObjectHeader->ObjectType, IKsPinImpl, Pin);
@@ -961,10 +961,10 @@
 
     /* sanity check */
     ASSERT(IoStack->FileObject);
-    ASSERT(IoStack->FileObject->FsContext);
+    ASSERT(IoStack->FileObject->FsContext2);
 
     /* get the object header */
-    ObjectHeader = (PKSIOBJECT_HEADER)IoStack->FileObject->FsContext;
+    ObjectHeader = (PKSIOBJECT_HEADER)IoStack->FileObject->FsContext2;
 
     /* locate ks pin implemention fro KSPIN offset */
     This = (IKsPinImpl*)CONTAINING_RECORD(ObjectHeader->ObjectType, IKsPinImpl, Pin);

Modified: trunk/reactos/drivers/ksfilter/ks/property.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/property.c?rev=43035&r1=43034&r2=43035&view=diff
==============================================================================
--- trunk/reactos/drivers/ksfilter/ks/property.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/ksfilter/ks/property.c [iso-8859-1] Sat Sep 12 16:35:27 2009
@@ -25,6 +25,8 @@
 
     for(Index = 0; Index < PropertySetCount; Index++)
     {
+        ASSERT(PropertySet[Index].Set);
+
         if (IsEqualGUIDAligned(&Property->Set, PropertySet[Index].Set))
         {
             for(ItemIndex = 0; ItemIndex < PropertySet[Index].PropertiesCount; ItemIndex++)
@@ -42,7 +44,7 @@
                     {
                         /* too small output buffer */
                         IoStatus->Information = PropertySet[Index].PropertyItem[ItemIndex].MinData;
-                        return STATUS_BUFFER_TOO_SMALL;
+                        return STATUS_MORE_ENTRIES;
                     }
 #if 0
                     if (Property->Flags & KSPROPERTY_TYPE_BASICSUPPORT)
@@ -112,6 +114,8 @@
     PIO_STACK_LOCATION IoStack;
     NTSTATUS Status;
     PFNKSHANDLER PropertyHandler = NULL;
+    ULONG Index;
+    LPGUID Guid;
 
     /* get current irp stack */
     IoStack = IoGetCurrentIrpStackLocation(Irp);
@@ -126,17 +130,13 @@
 
     /* FIXME probe the input / output buffer if from user mode */
 
-
     /* get input property request */
     Property = (PKSPROPERTY)IoStack->Parameters.DeviceIoControl.Type3InputBuffer;
 
+    DPRINT("KspPropertyHandler Irp %p PropertySetsCount %u PropertySet %p Allocator %p PropertyItemSize %u ExpectedPropertyItemSize %u\n", Irp, PropertySetsCount, PropertySet, Allocator, PropertyItemSize, sizeof(KSPROPERTY_ITEM));
+
     /* sanity check */
     ASSERT(PropertyItemSize == 0 || PropertyItemSize == sizeof(KSPROPERTY_ITEM));
-    if (IsEqualGUIDAligned(&Property->Set, &KSPROPSETID_Topology))
-    {
-        /* use KsTopologyPropertyHandler for this business */
-        return STATUS_INVALID_PARAMETER;
-    }
 
     /* find the property handler */
     Status = FindPropertyHandler(&Irp->IoStatus, PropertySet, PropertySetsCount, Property, IoStack->Parameters.DeviceIoControl.InputBufferLength, IoStack->Parameters.DeviceIoControl.OutputBufferLength, Irp->UserBuffer, &PropertyHandler);
@@ -165,6 +165,26 @@
                 Status = PropertyHandler(Irp, Property, Irp->UserBuffer);
             }
         }
+    }
+    else if (IsEqualGUIDAligned(&Property->Set, &GUID_NULL) && Property->Id == 0 && Property->Flags == KSPROPERTY_TYPE_SETSUPPORT)
+    {
+        // store output size
+        Irp->IoStatus.Information = sizeof(GUID) * PropertySetsCount;
+        if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(GUID) * PropertySetsCount)
+        {
+            // buffer too small
+            return STATUS_BUFFER_OVERFLOW;
+        }
+
+        // get output buffer
+        Guid = (LPGUID)Irp->UserBuffer;
+
+       // copy property guids from property sets
+       for(Index = 0; Index < PropertySetsCount; Index++)
+       {
+           RtlMoveMemory(&Guid[Index], PropertySet[Index].Set, sizeof(GUID));
+       }
+       return STATUS_SUCCESS;
     }
 
     /* done */

Modified: trunk/reactos/drivers/ksfilter/ks/topology.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/topology.c?rev=43035&r1=43034&r2=43035&view=diff
==============================================================================
--- trunk/reactos/drivers/ksfilter/ks/topology.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/ksfilter/ks/topology.c [iso-8859-1] Sat Sep 12 16:35:27 2009
@@ -160,6 +160,8 @@
     HANDLE hKey;
     PKEY_VALUE_PARTIAL_INFORMATION KeyInfo;
 
+    DPRINT("KsTopologyPropertyHandler Irp %p Property %p Data %p Topology %p\n", Irp, Property, Data, Topology);
+
     if (Property->Flags != KSPROPERTY_TYPE_GET)
     {
         Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED;

Modified: trunk/reactos/drivers/ksfilter/ks/worker.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/worker.c?rev=43035&r1=43034&r2=43035&view=diff
==============================================================================
--- trunk/reactos/drivers/ksfilter/ks/worker.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/ksfilter/ks/worker.c [iso-8859-1] Sat Sep 12 16:35:27 2009
@@ -46,6 +46,9 @@
 
     do
     {
+        /* sanity check */
+        ASSERT(!IsListEmpty(&KsWorker->QueuedWorkItems));
+
         /* remove first entry */
         Entry = RemoveHeadList(&KsWorker->QueuedWorkItems);
         /* get offset to work item */
@@ -95,7 +98,7 @@
     }
 
     /* allocate worker context */
-    KsWorker = ExAllocatePool(NonPagedPool, sizeof(KSIWORKER));
+    KsWorker = AllocateItem(NonPagedPool, sizeof(KSIWORKER));
     if (!KsWorker)
         return STATUS_INSUFFICIENT_RESOURCES;
 
@@ -103,8 +106,6 @@
     ExInitializeWorkItem(&KsWorker->WorkItem, WorkItemRoutine, (PVOID)KsWorker);
     /* setup type */
     KsWorker->Type = WorkQueueType;
-    /* set counter to zero */
-    KsWorker->Counter = 0;
     /* Initialize work item queue */
     InitializeListHead(&KsWorker->QueuedWorkItems);
     /* initialize work item lock */

Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/dispatcher.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/portcls/dispatcher.cpp?rev=43035&r1=43034&r2=43035&view=diff
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/dispatcher.cpp [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/dispatcher.cpp [iso-8859-1] Sat Sep 12 16:35:27 2009
@@ -22,7 +22,7 @@
     IoStack = IoGetCurrentIrpStackLocation(Irp);
 
     // access IrpTarget
-    IrpTarget = (IIrpTarget *)IoStack->FileObject->FsContext2;
+    IrpTarget = (IIrpTarget *)IoStack->FileObject->FsContext;
 
     // let IrpTarget handle request
     return IrpTarget->DeviceIoControl(DeviceObject, Irp);
@@ -41,7 +41,7 @@
     IoStack = IoGetCurrentIrpStackLocation(Irp);
 
     // access IrpTarget
-    IrpTarget = (IIrpTarget *)IoStack->FileObject->FsContext2;
+    IrpTarget = (IIrpTarget *)IoStack->FileObject->FsContext;
 
 
     // let IrpTarget handle request
@@ -61,7 +61,7 @@
     IoStack = IoGetCurrentIrpStackLocation(Irp);
 
     // access IrpTarget
-    IrpTarget = (IIrpTarget *)IoStack->FileObject->FsContext2;
+    IrpTarget = (IIrpTarget *)IoStack->FileObject->FsContext;
 
 
     // let IrpTarget handle request
@@ -81,7 +81,7 @@
     IoStack = IoGetCurrentIrpStackLocation(Irp);
 
     // access IrpTarget
-    IrpTarget = (IIrpTarget *)IoStack->FileObject->FsContext2;
+    IrpTarget = (IIrpTarget *)IoStack->FileObject->FsContext;
 
 
     // let IrpTarget handle request
@@ -101,7 +101,7 @@
     IoStack = IoGetCurrentIrpStackLocation(Irp);
 
     // access IrpTarget
-    IrpTarget = (IIrpTarget *)IoStack->FileObject->FsContext2;
+    IrpTarget = (IIrpTarget *)IoStack->FileObject->FsContext;
 
 
     // let IrpTarget handle request
@@ -121,7 +121,7 @@
     IoStack = IoGetCurrentIrpStackLocation(Irp);
 
     // access IrpTarget
-    IrpTarget = (IIrpTarget *)IoStack->FileObject->FsContext2;
+    IrpTarget = (IIrpTarget *)IoStack->FileObject->FsContext;
 
 
     // let IrpTarget handle request
@@ -141,7 +141,7 @@
     IoStack = IoGetCurrentIrpStackLocation(Irp);
 
     // access IrpTarget
-    IrpTarget = (IIrpTarget *)IoStack->FileObject->FsContext2;
+    IrpTarget = (IIrpTarget *)IoStack->FileObject->FsContext;
 
 
     // let IrpTarget handle request
@@ -164,7 +164,7 @@
     IIrpTarget * IrpTarget;
 
     // access IrpTarget
-    IrpTarget = (IIrpTarget *)FileObject->FsContext2;
+    IrpTarget = (IIrpTarget *)FileObject->FsContext;
 
     // let IrpTarget handle request
     return IrpTarget->FastDeviceIoControl(FileObject, Wait, InputBuffer, InputBufferLength, OutputBuffer, OutputBufferLength, IoControlCode, IoStatus, DeviceObject);
@@ -186,7 +186,7 @@
     IIrpTarget * IrpTarget;
 
     // access IrpTarget
-    IrpTarget = (IIrpTarget *)FileObject->FsContext2;
+    IrpTarget = (IIrpTarget *)FileObject->FsContext;
 
     // let IrpTarget handle request
     return IrpTarget->FastRead(FileObject, FileOffset, Length, Wait, LockKey, Buffer, IoStatus, DeviceObject);
@@ -207,7 +207,7 @@
     IIrpTarget * IrpTarget;
 
     // access IrpTarget
-    IrpTarget = (IIrpTarget *)FileObject->FsContext2;
+    IrpTarget = (IIrpTarget *)FileObject->FsContext;
     // let IrpTarget handle request
     return IrpTarget->FastWrite(FileObject, FileOffset, Length, Wait, LockKey, Buffer, IoStatus, DeviceObject);
 }
@@ -242,7 +242,7 @@
     // get current irp stack location
     IoStack = IoGetCurrentIrpStackLocation(Irp);
 
-    IoStack->FileObject->FsContext2 = (PVOID)Target;
+    IoStack->FileObject->FsContext = (PVOID)Target;
 
     Status = KsAllocateObjectHeader(&ObjectHeader, CreateItemCount, CreateItem, Irp, &DispatchTable);
     DPRINT("KsAllocateObjectHeader result %x\n", Status);

Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/interrupt.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/portcls/interrupt.cpp?rev=43035&r1=43034&r2=43035&view=diff
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/interrupt.cpp [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/interrupt.cpp [iso-8859-1] Sat Sep 12 16:35:27 2009
@@ -180,7 +180,7 @@
         while (CurEntry != &This->m_ServiceRoutines)
         {
             Entry = CONTAINING_RECORD(CurEntry, SYNC_ENTRY, ListEntry);
-            Status = Entry->SyncRoutine((CInterruptSync*)This, Entry->DynamicContext);
+            Entry->SyncRoutine((CInterruptSync*)This, Entry->DynamicContext);
             CurEntry = CurEntry->Flink;
         }
         DPRINT("Returning TRUE with mode InterruptSyncModeAll\n");

Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/irpstream.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/portcls/irpstream.cpp?rev=43035&r1=43034&r2=43035&view=diff
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/irpstream.cpp [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/irpstream.cpp [iso-8859-1] Sat Sep 12 16:35:27 2009
@@ -147,7 +147,7 @@
     PC_ASSERT(Header);
 
     // dont exceed max frame size
-    PC_ASSERT(m_MaxFrameSize >= Header->DataUsed);
+    //PC_ASSERT(m_MaxFrameSize >= Header->DataUsed);
 
     // increment num mappings
     InterlockedIncrement(&m_NumMappings);
@@ -282,7 +282,7 @@
         
         m_Irp->IoStatus.Information = StreamHeader->FrameExtent;
 
-        if (m_Irp->RequestorMode != KernelMode)
+        if (m_Irp->RequestorMode == KernelMode)
         {
             // HACK - WDMAUD should pass PKSSTREAM_HEADERs
             ExFreePool(StreamHeader->Data);

Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/private.hpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/portcls/private.hpp?rev=43035&r1=43034&r2=43035&view=diff
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/private.hpp [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/private.hpp [iso-8859-1] Sat Sep 12 16:35:27 2009
@@ -17,15 +17,10 @@
 
 #include <dmusicks.h>
 #include <kcom.h>
-#include "stdunk.h"
 #include "interfaces.hpp"
 #include <ks.h>
 #include <ksmedia.h>
-#include <stdio.h>
-#include <math.h>
 #include <intrin.h>
-
-#include <assert.h>
 
 #define TAG_PORTCLASS 'SLCP'
 

Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/propertyhandler.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/portcls/propertyhandler.cpp?rev=43035&r1=43034&r2=43035&view=diff
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/propertyhandler.cpp [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/propertyhandler.cpp [iso-8859-1] Sat Sep 12 16:35:27 2009
@@ -139,7 +139,7 @@
     IoStack = IoGetCurrentIrpStackLocation(Irp);
 
     // Get the IrpTarget
-    IrpTarget = (IIrpTarget*)IoStack->FileObject->FsContext2;
+    IrpTarget = (IIrpTarget*)IoStack->FileObject->FsContext;
     // Get the parent
     Status = IrpTarget->QueryInterface(IID_IPort, (PVOID*)&Port);
     if (!NT_SUCCESS(Status))

Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/registry.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/portcls/registry.cpp?rev=43035&r1=43034&r2=43035&view=diff
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/registry.cpp [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/registry.cpp [iso-8859-1] Sat Sep 12 16:35:27 2009
@@ -168,6 +168,7 @@
     {
         ZwClose(hKey);
         delete RegistryKey;
+        return Status;
     }
 
     *RegistrySubKey = (PREGISTRYKEY)RegistryKey;

Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/resource.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/portcls/resource.cpp?rev=43035&r1=43034&r2=43035&view=diff
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/resource.cpp [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/resource.cpp [iso-8859-1] Sat Sep 12 16:35:27 2009
@@ -348,6 +348,14 @@
         delete NewList;
     }
 
+    if (!TranslatedResourceList)
+    {
+        //
+        // empty resource list
+        //
+        return STATUS_SUCCESS;
+    }
+
     // calculate translated resource list size
     ResourceCount = TranslatedResourceList->List[0].PartialResourceList.Count;
 #ifdef _MSC_VER
@@ -371,7 +379,7 @@
     NewTranslatedResources = (PCM_RESOURCE_LIST)AllocateItem(PoolType, NewTranslatedSize, TAG_PORTCLASS);
     if (!NewTranslatedResources)
     {
-        FreeItem(NewList, TAG_PORTCLASS);
+        delete NewList;
         return STATUS_INSUFFICIENT_RESOURCES;
     }
 
@@ -379,8 +387,7 @@
     NewUntranslatedResources = (PCM_RESOURCE_LIST)AllocateItem(PoolType, NewUntranslatedSize, TAG_PORTCLASS);
     if (!NewUntranslatedResources)
     {
-        FreeItem(NewList, TAG_PORTCLASS);
-        FreeItem(NewTranslatedResources, TAG_PORTCLASS);
+        delete NewList;
         return STATUS_INSUFFICIENT_RESOURCES;
     }
 

Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/undoc.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/portcls/undoc.cpp?rev=43035&r1=43034&r2=43035&view=diff
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/undoc.cpp [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/undoc.cpp [iso-8859-1] Sat Sep 12 16:35:27 2009
@@ -25,8 +25,8 @@
 {
     PC_ASSERT(FileObject);
 
-    // IrpTarget is stored in FsContext2
-    return (IIrpTarget*)FileObject->FsContext2;
+    // IrpTarget is stored in FsContext
+    return (IIrpTarget*)FileObject->FsContext;
 }
 
 IIrpTarget *

Modified: trunk/reactos/drivers/wdm/audio/legacy/wdmaud/control.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/legacy/wdmaud/control.c?rev=43035&r1=43034&r2=43035&view=diff
==============================================================================
--- trunk/reactos/drivers/wdm/audio/legacy/wdmaud/control.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/legacy/wdmaud/control.c [iso-8859-1] Sat Sep 12 16:35:27 2009
@@ -554,6 +554,12 @@
     /* read DriverDescName value */
     PartialInformation = ReadKeyValue(hSubKey, &DriverDescName);
 
+    if (!PartialInformation)
+    {
+        /* failed to read driver desc key */
+        return STATUS_UNSUCCESSFUL;
+    }
+
     /* copy key name */
     Length = min(ProductNameSize * sizeof(WCHAR), PartialInformation->DataLength);
     RtlMoveMemory(ProductName, (PVOID)PartialInformation->Data, Length);
@@ -948,16 +954,16 @@
     IN PIRP LowerIrp,
     IN PVOID  Context)
 {
-    PIRP Irp;
+    //PIRP Irp;
     ASSERT(LowerIrp->PendingReturned == FALSE);
     /* get original irp */
-    Irp = (PIRP)Context;
+    //Irp = (PIRP)Context;
 
     /* save status */
-    Irp->IoStatus.Status = LowerIrp->IoStatus.Status;
-    Irp->IoStatus.Information = LowerIrp->IoStatus.Information;
+    //Irp->IoStatus.Status = LowerIrp->IoStatus.Status;
+    //Irp->IoStatus.Information = LowerIrp->IoStatus.Information;
     /* complete request */
-    IoCompleteRequest(Irp, IO_SOUND_INCREMENT);
+    //IoCompleteRequest(Irp, IO_SOUND_INCREMENT);
     /* return success to free irp */
     return STATUS_SUCCESS;
 }
@@ -1130,14 +1136,17 @@
     IoSetCompletionRoutine(LowerIrp, WdmAudWriteCompletion, (PVOID)Irp, TRUE, TRUE, TRUE);
 
     /* mark irp as pending */
-    IoMarkIrpPending(Irp);
-
+    //IoMarkIrpPending(Irp);
+    Irp->IoStatus.Information = DeviceInfo->BufferSize;
+    Irp->IoStatus.Status = STATUS_SUCCESS;
+    IoCompleteRequest(Irp, IO_NO_INCREMENT);
+    DPRINT1("Wrote %u\n", DeviceInfo->BufferSize);
     /* call the driver */
     Status = IoCallDriver(IoGetRelatedDeviceObject(FileObject), LowerIrp);
 
     /* dereference file object */
     ObDereferenceObject(FileObject);
 
-    return STATUS_PENDING;
+    return STATUS_SUCCESS;
 #endif
 }

Modified: trunk/reactos/drivers/wdm/audio/sysaudio/control.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/sysaudio/control.c?rev=43035&r1=43034&r2=43035&view=diff
==============================================================================
--- trunk/reactos/drivers/wdm/audio/sysaudio/control.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/sysaudio/control.c [iso-8859-1] Sat Sep 12 16:35:27 2009
@@ -79,10 +79,10 @@
     Entry = GetListEntry(&DeviceExtension->KsAudioDeviceList, DeviceNumber);
     ASSERT(Entry != NULL);
 
-    /* store device entry in FsContext2
+    /* store device entry in FsContext
      * see pin.c DispatchCreateSysAudioPin for details
      */
-    IoStack->FileObject->FsContext2 = (PVOID)Entry;
+    IoStack->FileObject->FsContext = (PVOID)Entry;
 
     return SetIrpIoStatus(Irp, STATUS_SUCCESS, 0);
 }

Modified: trunk/reactos/drivers/wdm/audio/sysaudio/pin.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/sysaudio/pin.c?rev=43035&r1=43034&r2=43035&view=diff
==============================================================================
--- trunk/reactos/drivers/wdm/audio/sysaudio/pin.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/sysaudio/pin.c [iso-8859-1] Sat Sep 12 16:35:27 2009
@@ -25,8 +25,8 @@
     /* Get current stack location */
     IoStack = IoGetCurrentIrpStackLocation(Irp);
 
-    /* The dispatch context is stored in the FsContext2 member */
-    Context = (PDISPATCH_CONTEXT)IoStack->FileObject->FsContext2;
+    /* The dispatch context is stored in the FsContext member */
+    Context = (PDISPATCH_CONTEXT)IoStack->FileObject->FsContext;
 
     /* Sanity check */
     ASSERT(Context);
@@ -76,8 +76,8 @@
     /* Get current stack location */
     IoStack = IoGetCurrentIrpStackLocation(Irp);
 
-    /* The dispatch context is stored in the FsContext2 member */
-    Context = (PDISPATCH_CONTEXT)IoStack->FileObject->FsContext2;
+    /* The dispatch context is stored in the FsContext member */
+    Context = (PDISPATCH_CONTEXT)IoStack->FileObject->FsContext;
 
     /* Sanity check */
     ASSERT(Context);
@@ -136,8 +136,8 @@
     /* Get current stack location */
     IoStack = IoGetCurrentIrpStackLocation(Irp);
 
-    /* The dispatch context is stored in the FsContext2 member */
-    Context = (PDISPATCH_CONTEXT)IoStack->FileObject->FsContext2;
+    /* The dispatch context is stored in the FsContext member */
+    Context = (PDISPATCH_CONTEXT)IoStack->FileObject->FsContext;
 
     /* Sanity check */
     ASSERT(Context);
@@ -210,8 +210,8 @@
     /* Get current stack location */
     IoStack = IoGetCurrentIrpStackLocation(Irp);
 
-    /* The dispatch context is stored in the FsContext2 member */
-    Context = (PDISPATCH_CONTEXT)IoStack->FileObject->FsContext2;
+    /* The dispatch context is stored in the FsContext member */
+    Context = (PDISPATCH_CONTEXT)IoStack->FileObject->FsContext;
 
     /* Sanity check */
     ASSERT(Context);
@@ -282,8 +282,8 @@
     /* Get current stack location */
     IoStack = IoGetCurrentIrpStackLocation(Irp);
 
-    /* The dispatch context is stored in the FsContext2 member */
-    Context = (PDISPATCH_CONTEXT)IoStack->FileObject->FsContext2;
+    /* The dispatch context is stored in the FsContext member */
+    Context = (PDISPATCH_CONTEXT)IoStack->FileObject->FsContext;
 
     if (Context->Handle)
     {
@@ -379,7 +379,7 @@
 
     DPRINT("Pin_fnFastWrite called DeviceObject %p Irp %p\n", DeviceObject);
 
-    Context = (PDISPATCH_CONTEXT)FileObject->FsContext2;
+    Context = (PDISPATCH_CONTEXT)FileObject->FsContext;
 
     if (Context->hMixerPin)
     {
@@ -404,7 +404,7 @@
 
     Status = KsStreamIo(RealFileObject, NULL, NULL, NULL, NULL, 0, IoStatus, Buffer, Length, KSSTREAM_WRITE, UserMode);
 
-    ObDereferenceObject(RealFileObject);
+    //ObDereferenceObject(RealFileObject);
 
     if (NT_SUCCESS(Status))
         return TRUE;
@@ -636,7 +636,6 @@
     IN PIRP Irp)
 {
     NTSTATUS Status = STATUS_SUCCESS;
-    KSOBJECT_HEADER ObjectHeader;
     PIO_STACK_LOCATION IoStack;
     PKSAUDIO_DEVICE_ENTRY DeviceEntry;
     PKSPIN_CONNECT Connect = NULL;
@@ -650,10 +649,10 @@
     /* sanity checks */
     ASSERT(IoStack->FileObject);
     ASSERT(IoStack->FileObject->RelatedFileObject);
-    ASSERT(IoStack->FileObject->RelatedFileObject->FsContext2);
+    ASSERT(IoStack->FileObject->RelatedFileObject->FsContext);
 
     /* get current attached virtual device */
-    DeviceEntry = (PKSAUDIO_DEVICE_ENTRY)IoStack->FileObject->RelatedFileObject->FsContext2;
+    DeviceEntry = (PKSAUDIO_DEVICE_ENTRY)IoStack->FileObject->RelatedFileObject->FsContext;
 
     /* now validate pin connect request */
     Status = KsValidateConnectRequest(Irp, DeviceEntry->PinDescriptorsCount, DeviceEntry->PinDescriptors, &Connect);
@@ -681,7 +680,7 @@
     RtlZeroMemory(DispatchContext, sizeof(DISPATCH_CONTEXT));
 
     /* allocate object header */
-    Status = KsAllocateObjectHeader(&ObjectHeader, 0, NULL, Irp, &PinTable);
+    Status = KsAllocateObjectHeader(&DispatchContext->ObjectHeader, 0, NULL, Irp, &PinTable);
     if (!NT_SUCCESS(Status))
     {
         /* failed */
@@ -696,13 +695,13 @@
     if (!NT_SUCCESS(Status))
     {
         /* failed */
-        KsFreeObjectHeader(ObjectHeader);
+        KsFreeObjectHeader(DispatchContext->ObjectHeader);
         ExFreePool(DispatchContext);
     }
     else
     {
         /* store dispatch context */
-        IoStack->FileObject->FsContext2 = (PVOID)DispatchContext;
+        IoStack->FileObject->FsContext = (PVOID)DispatchContext;
     }
 
 

Modified: trunk/reactos/drivers/wdm/audio/sysaudio/sysaudio.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/sysaudio/sysaudio.h?rev=43035&r1=43034&r2=43035&view=diff
==============================================================================
--- trunk/reactos/drivers/wdm/audio/sysaudio/sysaudio.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/sysaudio/sysaudio.h [iso-8859-1] Sat Sep 12 16:35:27 2009
@@ -22,8 +22,8 @@
     LIST_ENTRY Entry;                                  // device entry for KsAudioDeviceList
     UNICODE_STRING DeviceName;                         // symbolic link of audio device
 
-    HANDLE Handle;                          // handle to audio sub device
-    PFILE_OBJECT FileObject;                // file objecto to audio sub device
+    HANDLE Handle;                          // handle to audio device
+    PFILE_OBJECT FileObject;                // file objecto to audio device
 
     PIN_INFO * Pins;                        // array of PIN_INFO
     ULONG PinDescriptorsCount;              // number of pin descriptors
@@ -55,6 +55,7 @@
 
 typedef struct
 {
+    KSOBJECT_HEADER ObjectHeader;                        // pin object header
     HANDLE Handle;                                       // audio irp pin handle
     ULONG PinId;                                         // pin id of device
     PKSAUDIO_DEVICE_ENTRY AudioEntry;                 // pointer to audio device entry




More information about the Ros-diffs mailing list