[WDMAUD] Close mixers on cleanup. Should fix CORE-10735 definitely (#21)

[WDMAUD] Close mixers on cleanup. CORE-10735
This commit is contained in:
Sylvain Deverre 2017-10-08 11:29:17 +02:00 committed by GitHub
parent d788a52c79
commit c51df789e8
3 changed files with 36 additions and 1 deletions

View file

@ -326,6 +326,7 @@ WdmAudCleanup(
/* found an still open audio pin */ /* found an still open audio pin */
ZwClose(pClient->hPins[Index].Handle); ZwClose(pClient->hPins[Index].Handle);
} }
WdmAudCloseAllMixers(DeviceObject, pClient, Index);
} }
/* free pin array */ /* free pin array */

View file

@ -480,7 +480,7 @@ WdmAudControlCloseMixer(
IN ULONG Index) IN ULONG Index)
{ {
/* Remove event associated to this client */ /* Remove event associated to this client */
if (MMixerClose(&MixerContext, DeviceInfo->DeviceIndex, ClientInfo, EventCallback)) if (MMixerClose(&MixerContext, DeviceInfo->DeviceIndex, ClientInfo, EventCallback) != MM_STATUS_SUCCESS)
{ {
DPRINT1("Failed to close mixer\n"); DPRINT1("Failed to close mixer\n");
return SetIrpIoStatus(Irp, STATUS_UNSUCCESSFUL, sizeof(WDMAUD_DEVICE_INFO)); return SetIrpIoStatus(Irp, STATUS_UNSUCCESSFUL, sizeof(WDMAUD_DEVICE_INFO));
@ -497,6 +497,34 @@ WdmAudControlCloseMixer(
return SetIrpIoStatus(Irp, STATUS_SUCCESS, sizeof(WDMAUD_DEVICE_INFO)); return SetIrpIoStatus(Irp, STATUS_SUCCESS, sizeof(WDMAUD_DEVICE_INFO));
} }
VOID
WdmAudCloseAllMixers(
IN PDEVICE_OBJECT DeviceObject,
IN PWDMAUD_CLIENT ClientInfo,
IN ULONG Index)
{
ULONG DeviceCount, DeviceIndex;
/* Get all mixers */
DeviceCount = GetSysAudioDeviceCount(DeviceObject);
/* Close every mixer attached to the device */
for (DeviceIndex = 0; DeviceIndex < DeviceCount; DeviceIndex++)
{
if (MMixerClose(&MixerContext, DeviceIndex, ClientInfo, EventCallback) != MM_STATUS_SUCCESS)
{
DPRINT1("Failed to close mixer for device %lu\n", DeviceIndex);
}
}
/* Dereference event */
if (ClientInfo->hPins[Index].NotifyEvent)
{
ObDereferenceObject(ClientInfo->hPins[Index].NotifyEvent);
ClientInfo->hPins[Index].NotifyEvent = NULL;
}
}
NTSTATUS NTSTATUS
NTAPI NTAPI
WdmAudGetControlDetails( WdmAudGetControlDetails(

View file

@ -136,6 +136,12 @@ WdmAudControlCloseMixer(
IN PWDMAUD_CLIENT ClientInfo, IN PWDMAUD_CLIENT ClientInfo,
IN ULONG Index); IN ULONG Index);
VOID
WdmAudCloseAllMixers(
IN PDEVICE_OBJECT DeviceObject,
IN PWDMAUD_CLIENT ClientInfo,
IN ULONG Index);
NTSTATUS NTSTATUS
WdmAudControlOpenWave( WdmAudControlOpenWave(
IN PDEVICE_OBJECT DeviceObject, IN PDEVICE_OBJECT DeviceObject,