Author: janderwald Date: Sun Jul 12 02:02:30 2009 New Revision: 41894
URL: http://svn.reactos.org/svn/reactos?rev=41894&view=rev Log: [WDMAUD.DRV] - The wave / mixer / midi handles are kernel handles, consequently wdmaud_kernel must close them
Modified: trunk/reactos/dll/win32/wdmaud.drv/wdmaud.c
Modified: trunk/reactos/dll/win32/wdmaud.drv/wdmaud.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wdmaud.drv/wdmaud... ============================================================================== --- trunk/reactos/dll/win32/wdmaud.drv/wdmaud.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/wdmaud.drv/wdmaud.c [iso-8859-1] Sun Jul 12 02:02:30 2009 @@ -175,6 +175,18 @@ IN struct _SOUND_DEVICE_INSTANCE* SoundDeviceInstance, IN PVOID Handle) { + WDMAUD_DEVICE_INFO DeviceInfo; + MMRESULT Result; + MMDEVICE_TYPE DeviceType; + PSOUND_DEVICE SoundDevice; + + Result = GetSoundDeviceFromInstance(SoundDeviceInstance, &SoundDevice); + + if ( ! MMSUCCESS(Result) ) + { + return TranslateInternalMmResult(Result); + } + if ( OpenCount == 0 ) { return MMSYSERR_NOERROR; @@ -182,9 +194,23 @@
SND_ASSERT( KernelHandle != INVALID_HANDLE_VALUE );
+ Result = GetSoundDeviceType(SoundDevice, &DeviceType); + SND_ASSERT( Result == MMSYSERR_NOERROR ); + if (SoundDeviceInstance->Handle != (PVOID)KernelHandle) { - CloseHandle((HANDLE)SoundDeviceInstance->Handle); + ZeroMemory(&DeviceInfo, sizeof(WDMAUD_DEVICE_INFO)); + + DeviceInfo.DeviceType = DeviceType; + DeviceInfo.hDevice = SoundDeviceInstance->Handle; + + SyncOverlappedDeviceIoControl(KernelHandle, + IOCTL_CLOSE_WDMAUD, + (LPVOID) &DeviceInfo, + sizeof(WDMAUD_DEVICE_INFO), + (LPVOID) &DeviceInfo, + sizeof(WDMAUD_DEVICE_INFO), + NULL); }
--OpenCount;