Author: janderwald
Date: Wed Dec 22 18:53:08 2010
New Revision: 50104
URL:
http://svn.reactos.org/svn/reactos?rev=50104&view=rev
Log:
[KS]
- Add sanity checks
- Acquire device entry lock before dealing with device entries
- Fix acquiring bus device extension for parent bus device object
- Store result in irp io status block
- get install interface from assoicated system buffer
- Fixes install of new audio devices with ros ks in windows
- Tested with VBOX 3.2.10+WINXP+SP3
Modified:
branches/audio-bringup/drivers/ksfilter/ks/filter.c
branches/audio-bringup/drivers/ksfilter/ks/swenum.c
Modified: branches/audio-bringup/drivers/ksfilter/ks/filter.c
URL:
http://svn.reactos.org/svn/reactos/branches/audio-bringup/drivers/ksfilter/…
==============================================================================
--- branches/audio-bringup/drivers/ksfilter/ks/filter.c [iso-8859-1] (original)
+++ branches/audio-bringup/drivers/ksfilter/ks/filter.c [iso-8859-1] Wed Dec 22 18:53:08
2010
@@ -1858,7 +1858,6 @@
if (!KsGateCaptureThreshold(Gate))
{
/* filter control gate is closed */
- DPRINT1("Gate %p Closed %x\n", Gate, Gate->Count);
return;
}
DPRINT1("processing\n");
Modified: branches/audio-bringup/drivers/ksfilter/ks/swenum.c
URL:
http://svn.reactos.org/svn/reactos/branches/audio-bringup/drivers/ksfilter/…
==============================================================================
--- branches/audio-bringup/drivers/ksfilter/ks/swenum.c [iso-8859-1] (original)
+++ branches/audio-bringup/drivers/ksfilter/ks/swenum.c [iso-8859-1] Wed Dec 22 18:53:08
2010
@@ -972,6 +972,9 @@
HANDLE hKey, hDeviceKey, hInterfaceKey, hReferenceKey;
NTSTATUS Status;
OBJECT_ATTRIBUTES ObjectAttributes;
+
+ /* sanity check */
+ ASSERT(InstallInterface);
/* calculate length */
Length = wcslen(InstallInterface->ReferenceString);
@@ -1059,13 +1062,18 @@
PLIST_ENTRY Entry;
PBUS_DEVICE_ENTRY DeviceEntry;
PSWENUM_INSTALL_INTERFACE InstallInterface;
+ KIRQL OldLevel;
PBUS_INSTALL_ENUM_CONTEXT Context = (PBUS_INSTALL_ENUM_CONTEXT)Ctx;
/* get current irp stack location */
IoStack = IoGetCurrentIrpStackLocation(Context->Irp);
/* get install request */
- InstallInterface =
(PSWENUM_INSTALL_INTERFACE)IoStack->Parameters.DeviceIoControl.Type3InputBuffer;
+ InstallInterface =
(PSWENUM_INSTALL_INTERFACE)Context->Irp->AssociatedIrp.SystemBuffer;
+
+ /* sanity check */
+ ASSERT(InstallInterface);
+ ASSERT(Context->BusDeviceExtension);
if (IoStack->Parameters.DeviceIoControl.InputBufferLength <
sizeof(SWENUM_INSTALL_INTERFACE))
{
@@ -1094,6 +1102,9 @@
/* done */
return;
}
+
+ /* acquire device entry lock */
+ KeAcquireSpinLock(&Context->BusDeviceExtension->Lock, &OldLevel);
/* now iterate all device entries */
Entry = Context->BusDeviceExtension->Common.Entry.Flink;
@@ -1114,7 +1125,13 @@
break;
}
}
- }
+
+ /* move to next entry */
+ Entry = Entry->Flink;
+ }
+
+ /* release device entry lock */
+ KeReleaseSpinLock(&Context->BusDeviceExtension->Lock, OldLevel);
/* signal that bus driver relations has changed */
IoInvalidateDeviceRelations(Context->BusDeviceExtension->PhysicalDeviceObject,
BusRelations);
@@ -1364,7 +1381,7 @@
DeviceExtension = (PDEV_EXTENSION)IoStack->DeviceObject->DeviceExtension;
/* get bus device extension */
- BusDeviceExtension =
(PBUS_ENUM_DEVICE_EXTENSION)DeviceExtension->Ext->BusDeviceExtension;
+ BusDeviceExtension = (PBUS_ENUM_DEVICE_EXTENSION)DeviceExtension->Ext;
/* sanity checks */
ASSERT(BusDeviceExtension);
@@ -1715,7 +1732,7 @@
PDEV_EXTENSION DeviceExtension;
PBUS_ENUM_DEVICE_EXTENSION BusDeviceExtension;
- DPRINT1("KsGetBusEnumPnpDeviceObject\n");
+ DPRINT1("KsInstallBusEnumInterface\n");
/* get current irp stack location */
IoStack = IoGetCurrentIrpStackLocation(Irp);
@@ -1737,7 +1754,7 @@
DeviceExtension = (PDEV_EXTENSION)IoStack->DeviceObject->DeviceExtension;
/* get bus device extension */
- BusDeviceExtension = DeviceExtension->Ext->BusDeviceExtension;
+ BusDeviceExtension = (PBUS_ENUM_DEVICE_EXTENSION)DeviceExtension->Ext;
/* initialize context */
@@ -1748,9 +1765,11 @@
/* queue the work item */
ExQueueWorkItem(&Context.WorkItem, DelayedWorkQueue);
-
/* wait for completion */
KeWaitForSingleObject(&Context.Event, Executive, KernelMode, FALSE, NULL);
+
+ /* store result */
+ Irp->IoStatus.Status = Context.Status;
/* done */
return Context.Status;