Author: janderwald
Date: Fri Nov 13 15:13:22 2009
New Revision: 44132
URL:
http://svn.reactos.org/svn/reactos?rev=44132&view=rev
Log:
[KS]
- Silent debug traces on request of Christoph
[CMIDRIVER]
- Remove link hacks
[WDMAUD_KERNEL]
- Silent debug traces on request of Christoph
- Reference notification event when the mixer is openend
- Fix a bug in the notification handler (double free due entry not removed from list)
Modified:
trunk/reactos/drivers/ksfilter/ks/irp.c
trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/mintopo.cpp
trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/mintopotables.hpp
trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/minwave.cpp
trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/minwavetables.hpp
trunk/reactos/drivers/wdm/audio/drivers/directory.rbuild
trunk/reactos/drivers/wdm/audio/legacy/wdmaud/control.c
trunk/reactos/drivers/wdm/audio/legacy/wdmaud/entry.c
trunk/reactos/drivers/wdm/audio/legacy/wdmaud/mixer.c
trunk/reactos/drivers/wdm/audio/legacy/wdmaud/wdmaud.h
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] Fri Nov 13 15:13:22 2009
@@ -1790,7 +1790,8 @@
PKSIOBJECT_HEADER ObjectHeader;
NTSTATUS Status;
- DPRINT1("KS / CREATE\n");
+ DPRINT("KS / CREATE\n");
+
/* get current stack location */
IoStack = IoGetCurrentIrpStackLocation(Irp);
/* get device extension */
Modified: trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/mintopo.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/drivers/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/mintopo.cpp [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/mintopo.cpp [iso-8859-1] Fri Nov 13
15:13:22 2009
@@ -32,6 +32,8 @@
#include "NtStrsafe.h"
#pragma code_seg("PAGE")
+
+const GUID KSPROPSETID_CMI = {0x2B81CDBB, 0xEE6C, 0x4ECC, {0x8A, 0xA5, 0x9A, 0x18, 0x8B,
0x02, 0x3D, 0xFF}};
HRESULT NTAPI CreateMiniportTopologyCMI(PUNKNOWN* Unknown, REFCLSID, PUNKNOWN
UnknownOuter, POOL_TYPE PoolType)
{
Modified: trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/mintopotables.hpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/drivers/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/mintopotables.hpp [iso-8859-1]
(original)
+++ trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/mintopotables.hpp [iso-8859-1] Fri
Nov 13 15:13:22 2009
@@ -354,13 +354,13 @@
(PCPFNPROPERTY_HANDLER)PropertyHandler_ComponentId
},
{
- &GUID_NULL,//&KSPROPSETID_CMI, //HACK
+ &KSPROPSETID_CMI,
KSPROPERTY_CMI_GET,
KSPROPERTY_TYPE_GET,
(PCPFNPROPERTY_HANDLER)PropertyHandler_Private
},
{
- &GUID_NULL,//&KSPROPSETID_CMI, //HACK
+ &KSPROPSETID_CMI,
KSPROPERTY_CMI_SET,
KSPROPERTY_TYPE_SET,
(PCPFNPROPERTY_HANDLER)PropertyHandler_Private
Modified: trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/minwave.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/drivers/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/minwave.cpp [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/minwave.cpp [iso-8859-1] Fri Nov 13
15:13:22 2009
@@ -469,6 +469,9 @@
STDMETHODIMP CMiniportWaveCMI::DataRangeIntersection(ULONG PinId, PKSDATARANGE
ClientDataRange, PKSDATARANGE MyDataRange, ULONG OutputBufferLength, PVOID
ResultantFormat, PULONG ResultantFormatLength)
{
//PAGED_CODE();
+ static const GUID KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF = {0x00000092L, 0x0000, 0x0010,
{0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
+
+
DBGPRINT(("CMiniportWaveCMI[%p]::DataRangeIntersection(%d, %p, %p, %d, %p,
%p)", this, PinId, ClientDataRange, MyDataRange, OutputBufferLength, ResultantFormat,
ResultantFormatLength));
if (PinId == PIN_WAVE_AC3_RENDER_SINK) {
@@ -482,7 +485,7 @@
}
- if (!IsEqualGUIDAligned(ClientDataRange->SubFormat,
GUID_NULL)//KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF) //HACK
+ if (!IsEqualGUIDAligned(ClientDataRange->SubFormat,
KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF)
&& !IsEqualGUIDAligned(ClientDataRange->SubFormat,
KSDATAFORMAT_SUBTYPE_WILDCARD)) {
// check for Vista
isAC3Pin = false;
Modified: trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/minwavetables.hpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/drivers/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/minwavetables.hpp [iso-8859-1]
(original)
+++ trunk/reactos/drivers/wdm/audio/drivers/CMIDriver/minwavetables.hpp [iso-8859-1] Fri
Nov 13 15:13:22 2009
@@ -65,7 +65,7 @@
0,
0,
STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO),
-
STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO),//STATICGUIDOF(KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF),
//HACK
+ STATICGUIDOF(KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF),
STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX)
},
MAX_CHANNELS_AC3,
Modified: trunk/reactos/drivers/wdm/audio/drivers/directory.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/drivers/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/drivers/directory.rbuild [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/drivers/directory.rbuild [iso-8859-1] Fri Nov 13
15:13:22 2009
@@ -4,6 +4,10 @@
<directory name="mpu401">
<xi:include href="mpu401/mpu401.rbuild" />
</directory>
+ <directory name="CMIDriver">
+ <xi:include href="CMIDriver/cmidriver.rbuild" />
+ </directory>
+
<!--directory name="sb16">
<xi:include href="sb16/sb16.rbuild" />
</directory-->
Modified: trunk/reactos/drivers/wdm/audio/legacy/wdmaud/control.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/legacy/w…
==============================================================================
--- 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] Fri Nov 13
15:13:22 2009
@@ -86,7 +86,7 @@
ULONG BytesReturned;
PFILE_OBJECT FileObject;
- //DPRINT1("WdmAudControlDeviceState\n");
+ DPRINT("WdmAudControlDeviceState\n");
Status = ObReferenceObjectByHandle(DeviceInfo->hDevice, GENERIC_READ |
GENERIC_WRITE, IoFileObjectType, KernelMode, (PVOID*)&FileObject, NULL);
if (!NT_SUCCESS(Status))
@@ -105,7 +105,7 @@
ObDereferenceObject(FileObject);
- //DPRINT1("WdmAudControlDeviceState Status %x\n", Status);
+ DPRINT("WdmAudControlDeviceState Status %x\n", Status);
return SetIrpIoStatus(Irp, Status, sizeof(WDMAUD_DEVICE_INFO));
}
@@ -154,6 +154,14 @@
ClientInfo->hPins[Index].Handle = NULL;
SetIrpIoStatus(Irp, STATUS_SUCCESS, sizeof(WDMAUD_DEVICE_INFO));
return STATUS_SUCCESS;
+ }
+ else if (ClientInfo->hPins[Index].Handle == DeviceInfo->hDevice &&
ClientInfo->hPins[Index].Type == MIXER_DEVICE_TYPE)
+ {
+ if (ClientInfo->hPins[Index].NotifyEvent)
+ {
+ ObDereferenceObject(ClientInfo->hPins[Index].NotifyEvent);
+ ClientInfo->hPins[Index].NotifyEvent = NULL;
+ }
}
}
Modified: trunk/reactos/drivers/wdm/audio/legacy/wdmaud/entry.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/legacy/w…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/legacy/wdmaud/entry.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/legacy/wdmaud/entry.c [iso-8859-1] Fri Nov 13 15:13:22
2009
@@ -22,7 +22,7 @@
NTSTATUS Status;
PWDMAUD_DEVICE_EXTENSION DeviceExtension;
- DPRINT1("WdmAudInstallDevice called\n");
+ DPRINT("WdmAudInstallDevice called\n");
Status = IoCreateDevice(DriverObject,
sizeof(WDMAUD_DEVICE_EXTENSION),
@@ -95,7 +95,7 @@
WdmAudUnload(
IN PDRIVER_OBJECT driver)
{
- DPRINT1("WdmAudUnload called\n");
+ DPRINT("WdmAudUnload called\n");
}
NTSTATUS
@@ -266,7 +266,7 @@
IN PUNICODE_STRING Registry_path
)
{
- DPRINT1("Wdmaud.sys loaded\n");
+ DPRINT("Wdmaud.sys loaded\n");
Driver->DriverUnload = WdmAudUnload;
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] Fri Nov 13 15:13:22
2009
@@ -1752,11 +1752,12 @@
ULONG Index;
PWDMAUD_HANDLE Handels;
PWDMAUD_DEVICE_EXTENSION DeviceExtension;
+ NTSTATUS Status;
+ PKEVENT EventObject = NULL;
DPRINT("WdmAudControlOpenMixer\n");
DeviceExtension = (PWDMAUD_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
-
if (DeviceInfo->DeviceIndex >= DeviceExtension->MixerInfoCount)
{
@@ -1764,13 +1765,26 @@
return SetIrpIoStatus(Irp, STATUS_UNSUCCESSFUL, 0);
}
+ if (DeviceInfo->u.hNotifyEvent)
+ {
+ Status = ObReferenceObjectByHandle(DeviceInfo->u.hNotifyEvent,
EVENT_MODIFY_STATE, ExEventObjectType, UserMode, (LPVOID*)&EventObject, NULL);
+
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("Invalid notify event passed %p from client %p\n",
DeviceInfo->u.hNotifyEvent, ClientInfo);
+ DbgBreakPoint();
+ return SetIrpIoStatus(Irp, STATUS_UNSUCCESSFUL, 0);
+ }
+ }
+
+
for(Index = 0; Index < ClientInfo->NumPins; Index++)
{
if (ClientInfo->hPins[Index].Handle == (HANDLE)DeviceInfo->DeviceIndex
&& ClientInfo->hPins[Index].Type == MIXER_DEVICE_TYPE)
{
/* re-use pseudo handle */
DeviceInfo->hDevice = (HANDLE)DeviceInfo->DeviceIndex;
- ClientInfo->hPins[Index].hNotifyEvent = DeviceInfo->u.hNotifyEvent;
+ ClientInfo->hPins[Index].NotifyEvent = EventObject;
return SetIrpIoStatus(Irp, STATUS_SUCCESS, sizeof(WDMAUD_DEVICE_INFO));
}
}
@@ -1788,7 +1802,7 @@
ClientInfo->hPins = Handels;
ClientInfo->hPins[ClientInfo->NumPins].Handle =
(HANDLE)DeviceInfo->DeviceIndex;
ClientInfo->hPins[ClientInfo->NumPins].Type = MIXER_DEVICE_TYPE;
- ClientInfo->hPins[ClientInfo->NumPins].hNotifyEvent =
DeviceInfo->u.hNotifyEvent;
+ ClientInfo->hPins[ClientInfo->NumPins].NotifyEvent = EventObject;
ClientInfo->NumPins++;
}
else
@@ -1849,7 +1863,7 @@
if (DeviceInfo->u.MixLine.dwSource >= MixerLineSrc->Line.cConnections)
{
- DPRINT1("dwSource %u Destinations %u\n",
DeviceInfo->u.MixLine.dwSource, MixerLineSrc->Line.cConnections);
+ DPRINT1("dwSource %u > Destinations %u\n",
DeviceInfo->u.MixLine.dwSource, MixerLineSrc->Line.cConnections);
/* invalid parameter */
return SetIrpIoStatus(Irp, STATUS_INVALID_PARAMETER, 0);
}
@@ -1903,7 +1917,7 @@
return SetIrpIoStatus(Irp, STATUS_SUCCESS, sizeof(WDMAUD_DEVICE_INFO));
}
- DPRINT1("Flags %x\n", DeviceInfo->Flags);
+ DPRINT("Flags %x\n", DeviceInfo->Flags);
UNIMPLEMENTED;
//DbgBreakPoint();
@@ -1960,14 +1974,14 @@
Index = 0;
for(Index = 0; Index < MixerLineSrc->Line.cControls; Index++)
{
- DPRINT1("dwControlType %x\n",
MixerLineSrc->LineControls[Index].dwControlType);
+ DPRINT("dwControlType %x\n",
MixerLineSrc->LineControls[Index].dwControlType);
if (DeviceInfo->u.MixControls.dwControlType ==
MixerLineSrc->LineControls[Index].dwControlType)
{
RtlMoveMemory(DeviceInfo->u.MixControls.pamxctrl,
&MixerLineSrc->LineControls[Index], sizeof(MIXERCONTROLW));
return SetIrpIoStatus(Irp, STATUS_SUCCESS, sizeof(WDMAUD_DEVICE_INFO));
}
}
- DPRINT1("DeviceInfo->u.MixControls.dwControlType %x not found in Line %x
cControls %u \n", DeviceInfo->u.MixControls.dwControlType,
DeviceInfo->u.MixControls.dwLineID, MixerLineSrc->Line.cControls);
+ DPRINT("DeviceInfo->u.MixControls.dwControlType %x not found in Line %x
cControls %u \n", DeviceInfo->u.MixControls.dwControlType,
DeviceInfo->u.MixControls.dwLineID, MixerLineSrc->Line.cControls);
return SetIrpIoStatus(Irp, STATUS_UNSUCCESSFUL, sizeof(WDMAUD_DEVICE_INFO));
}
else if (DeviceInfo->Flags == MIXER_GETLINECONTROLSF_ONEBYID)
@@ -1977,7 +1991,7 @@
/* invalid parameter */
return SetIrpIoStatus(Irp, STATUS_INVALID_PARAMETER, 0);
}
- DPRINT1("MixerId %u ControlId %u\n",(ULONG_PTR)DeviceInfo->hDevice,
DeviceInfo->u.MixControls.dwControlID);
+ DPRINT("MixerId %u ControlId %u\n",(ULONG_PTR)DeviceInfo->hDevice,
DeviceInfo->u.MixControls.dwControlID);
Status =
GetMixerControlById(&DeviceExtension->MixerInfo[(ULONG_PTR)DeviceInfo->hDevice],
DeviceInfo->u.MixControls.dwControlID, NULL, &MixerControl, NULL);
if (NT_SUCCESS(Status))
{
@@ -2047,7 +2061,7 @@
*InputValue = Value;
}
- DPRINT1("Status %x bSet %u NodeId %u Value %d PropertyId %u\n", Status,
bSet, NodeId, Value, PropertyId);
+ DPRINT("Status %x bSet %u NodeId %u Value %d PropertyId %u\n", Status,
bSet, NodeId, Value, PropertyId);
return Status;
}
@@ -2061,11 +2075,9 @@
PWDMAUD_DEVICE_EXTENSION DeviceExtension;
PLIST_ENTRY Entry;
PWDMAUD_CLIENT CurClient;
- PKEVENT EventObject;
PMIXER_EVENT Event;
KIRQL OldIrql;
ULONG Index;
- NTSTATUS Status;
/* get device extension */
DeviceExtension = (PWDMAUD_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
@@ -2085,22 +2097,13 @@
/* now iterate through all pins and try to find an matching handle */
for(Index = 0; Index < CurClient->NumPins; Index++)
{
- if (CurClient->hPins[Index].Handle == hMixer &&
CurClient->hPins[Index].Type == MIXER_DEVICE_TYPE &&
CurClient->hPins[Index].hNotifyEvent)
+ if (CurClient->hPins[Index].Handle == hMixer &&
CurClient->hPins[Index].Type == MIXER_DEVICE_TYPE &&
CurClient->hPins[Index].NotifyEvent)
{
- /* found a matching mixer handle and a valid notify event */
- Status =
ObReferenceObjectByHandle(CurClient->hPins[Index].hNotifyEvent, EVENT_MODIFY_STATE,
ExEventObjectType, UserMode, (LPVOID*)&EventObject, NULL);
- if (!NT_SUCCESS(Status))
- {
- DPRINT1("Invalid notify event passed %p from client %p\n",
CurClient->hPins[Index].hNotifyEvent, CurClient);
- break;
- }
-
/* allocate event entry */
Event = (PMIXER_EVENT)ExAllocatePool(NonPagedPool, sizeof(MIXER_EVENT));
if (!Event)
{
/* no memory */
- ObDereferenceObject(EventObject);
return STATUS_INSUFFICIENT_RESOURCES;
}
@@ -2112,11 +2115,12 @@
/* insert event entry */
InsertTailList(&CurClient->MixerEventList, &Event->Entry);
+ DPRINT("Notifying %p hMixer %p Value %x NotificationType %u\n",
CurClient->hPins[Index].NotifyEvent, hMixer, Value, NotificationType);
+
/* now signal the event */
- KeSetEvent(EventObject, 0, FALSE);
-
- /* dereference event */
- ObDereferenceObject(EventObject);
+ KeSetEvent(CurClient->hPins[Index].NotifyEvent, 0, FALSE);
+
+
/* search next client */
break;
@@ -2178,6 +2182,24 @@
return Status;
}
+
+ULONG
+GetVolumeControlIndex(
+ LPMIXERVOLUME_DATA VolumeData,
+ LONG Value)
+{
+ ULONG Index;
+
+ for(Index = 0; Index < VolumeData->ValuesCount; Index++)
+ {
+ if (VolumeData->Values[Index] > Value)
+ {
+ return VolumeData->InputSteppingDelta * Index;
+ }
+ }
+ return VolumeData->InputSteppingDelta * (VolumeData->ValuesCount-1);
+}
+
NTSTATUS
SetGetVolumeControlDetails(
@@ -2191,6 +2213,7 @@
{
LPMIXERCONTROLDETAILS_UNSIGNED Input;
LONG Value, Index, Channel = 0;
+ ULONG dwValue;
NTSTATUS Status;
LPMIXERVOLUME_DATA VolumeData;
@@ -2234,16 +2257,9 @@
if (!bSet)
{
- for(Index = 0; Index < VolumeData->ValuesCount; Index++)
- {
- if (VolumeData->Values[Index] > Value)
- {
- /* FIXME SEH */
- Input->dwValue = VolumeData->InputSteppingDelta * Index;
- return Status;
- }
- }
- Input->dwValue = VolumeData->InputSteppingDelta *
(VolumeData->ValuesCount-1);
+ dwValue = GetVolumeControlIndex(VolumeData, (LONG)Value);
+ /* FIXME SEH */
+ Input->dwValue = dwValue;
}
else
{
@@ -2283,6 +2299,7 @@
if (Event->hMixer == DeviceInfo->hDevice)
{
/* found an event for that particular device */
+ RemoveEntryList(&Event->Entry);
break;
}
@@ -2292,7 +2309,6 @@
/* move to next entry */
Entry = Entry->Flink;
}
-
/* release client context lock */
KeReleaseSpinLock(&DeviceExtension->Lock, OldIrql);
Modified: trunk/reactos/drivers/wdm/audio/legacy/wdmaud/wdmaud.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/legacy/w…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/legacy/wdmaud/wdmaud.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/legacy/wdmaud/wdmaud.h [iso-8859-1] Fri Nov 13
15:13:22 2009
@@ -31,7 +31,7 @@
SOUND_DEVICE_TYPE Type;
ULONG FilterId;
ULONG PinId;
- HANDLE hNotifyEvent;
+ PRKEVENT NotifyEvent;
}WDMAUD_HANDLE, *PWDMAUD_HANDLE;
typedef struct