Author: janderwald
Date: Tue Jun 9 18:50:24 2009
New Revision: 41357
URL:
http://svn.reactos.org/svn/reactos?rev=41357&view=rev
Log:
- Add a few sanity assert to KsCreate
- Pass a create item and use an object class when creating an object header
- Return zero mixer count when wdmaud fails to enumerate virtual device count
- Should fix high cpu usage after installing audio drivers
Modified:
trunk/reactos/drivers/ksfilter/ks/irp.c
trunk/reactos/drivers/wdm/audio/filters/kmixer/filter.c
trunk/reactos/drivers/wdm/audio/legacy/wdmaud/mixer.c
trunk/reactos/drivers/wdm/audio/sysaudio/control.c
trunk/reactos/drivers/wdm/audio/sysaudio/dispatcher.c
Modified: trunk/reactos/drivers/ksfilter/ks/irp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/irp.c?…
==============================================================================
--- trunk/reactos/drivers/ksfilter/ks/irp.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/ksfilter/ks/irp.c [iso-8859-1] Tue Jun 9 18:50:24 2009
@@ -759,7 +759,13 @@
}
else if (DeviceHeader->ItemList[Index].bCreated &&
IoStack->FileObject->FileName.Buffer != NULL)
{
- ULONG Length =
wcslen(DeviceHeader->ItemList[Index].ObjectHeader->CreateItem->ObjectClass.Buffer);
+ ULONG Length;
+
+ ASSERT(DeviceHeader->ItemList[Index].ObjectHeader);
+ ASSERT(DeviceHeader->ItemList[Index].ObjectHeader->CreateItem);
+
ASSERT(DeviceHeader->ItemList[Index].ObjectHeader->CreateItem->ObjectClass.Buffer);
+
+ Length =
wcslen(DeviceHeader->ItemList[Index].ObjectHeader->CreateItem->ObjectClass.Buffer);
/* filter for that type has already exists */
if
(!_wcsnicmp(DeviceHeader->ItemList[Index].ObjectHeader->CreateItem->ObjectClass.Buffer,
Modified: trunk/reactos/drivers/wdm/audio/filters/kmixer/filter.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/filters/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/filters/kmixer/filter.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/filters/kmixer/filter.c [iso-8859-1] Tue Jun 9
18:50:24 2009
@@ -189,6 +189,7 @@
KSOBJECT_HEADER ObjectHeader;
PIO_STACK_LOCATION IoStatus;
LPWSTR Buffer;
+ PKSOBJECT_CREATE_ITEM CreateItem;
static LPWSTR KS_NAME_PIN = L"{146F1A80-4791-11D0-A5D6-28DB04C10000}";
@@ -211,8 +212,23 @@
}
}
+ /* allocate create item */
+ CreateItem = ExAllocatePool(NonPagedPool, sizeof(KSOBJECT_CREATE_ITEM));
+ if (!CreateItem)
+ {
+ Irp->IoStatus.Information = 0;
+ Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES;
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+ return STATUS_INSUFFICIENT_RESOURCES;
+ }
+
+ /* zero create struct */
+ RtlZeroMemory(CreateItem, sizeof(KSOBJECT_CREATE_ITEM));
+
+ RtlInitUnicodeString(&CreateItem->ObjectClass, L"KMixer");
+
/* allocate object header */
- Status = KsAllocateObjectHeader(&ObjectHeader, 0, NULL, Irp,
&DispatchTable);
+ Status = KsAllocateObjectHeader(&ObjectHeader, 1, CreateItem, Irp,
&DispatchTable);
DPRINT("KsAllocateObjectHeader result %x\n", Status);
/* complete the irp */
Modified: trunk/reactos/drivers/wdm/audio/legacy/wdmaud/mixer.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/legacy/w…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/legacy/wdmaud/mixer.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/legacy/wdmaud/mixer.c [iso-8859-1] Tue Jun 9 18:50:24
2009
@@ -133,7 +133,6 @@
NTSTATUS Status;
PWDMAUD_DEVICE_EXTENSION DeviceExtension;
-
Pin.Property.Set = KSPROPSETID_Sysaudio;
Pin.Property.Id = KSPROPERTY_SYSAUDIO_DEVICE_COUNT;
Pin.Property.Flags = KSPROPERTY_TYPE_GET;
@@ -143,7 +142,7 @@
Count = 0;
Status = KsSynchronousIoControlDevice(DeviceExtension->FileObject, KernelMode,
IOCTL_KS_PROPERTY, (PVOID)&Pin, sizeof(KSPROPERTY), (PVOID)&Count, sizeof(ULONG),
&BytesReturned);
if (!NT_SUCCESS(Status) || !Count)
- return STATUS_UNSUCCESSFUL;
+ return 0;
NumPins = 0;
for(Index = 0; Index < Count; Index++)
Modified: trunk/reactos/drivers/wdm/audio/sysaudio/control.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/sysaudio…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/sysaudio/control.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/sysaudio/control.c [iso-8859-1] Tue Jun 9 18:50:24
2009
@@ -256,7 +256,7 @@
HANDLE PinHandle;
PFILE_OBJECT FileObject;
- Status = KsCreatePin(KMixerHandle, PinConnect, GENERIC_READ | GENERIC_WRITE,
&PinHandle);
+ Status = KsoCreatePin(KMixerHandle, PinConnect, GENERIC_READ | GENERIC_WRITE,
&PinHandle, L"KMixer");
if (!NT_SUCCESS(Status))
{
@@ -419,7 +419,7 @@
DPRINT1("creating virtual pin\n");
/* now create the virtual audio pin which is exposed to wdmaud */
- Status = KsCreatePin(Filter, WorkerContext->PinConnect, GENERIC_READ |
GENERIC_WRITE, &VirtualPinHandle);
+ Status = KsoCreatePin(Filter, WorkerContext->PinConnect, GENERIC_READ |
GENERIC_WRITE, &VirtualPinHandle, L"SysAudio");
if (!NT_SUCCESS(Status))
{
Modified: trunk/reactos/drivers/wdm/audio/sysaudio/dispatcher.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/sysaudio…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/sysaudio/dispatcher.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/sysaudio/dispatcher.c [iso-8859-1] Tue Jun 9 18:50:24
2009
@@ -346,6 +346,7 @@
/* store create context */
CreateItem->Context = (PVOID)Client;
+ RtlInitUnicodeString(&CreateItem->ObjectClass, L"SysAudio");
/* store the object in FsContext */
IoStatus->FileObject->FsContext2 = (PVOID)Client;