X-Git-Url: https://git.reactos.org/?p=reactos.git;a=blobdiff_plain;f=reactos%2Fdll%2Fwin32%2Fwdmaud.drv%2Flegacy.c;h=d569d0ba00c9de1b69c429a38d088a320716111f;hp=45d3ed5ac67d0c030b8ceaffbce1ba0cf4f88903;hb=2f8f2409dd86d13ee7a2e50e591988851dc50689;hpb=ce1b8768d19f31b1174b70ab6a186eb726a337d4 diff --git a/reactos/dll/win32/wdmaud.drv/legacy.c b/reactos/dll/win32/wdmaud.drv/legacy.c index 45d3ed5ac67..d569d0ba00c 100644 --- a/reactos/dll/win32/wdmaud.drv/legacy.c +++ b/reactos/dll/win32/wdmaud.drv/legacy.c @@ -15,9 +15,12 @@ #include "wdmaud.h" +#include + #define KERNEL_DEVICE_NAME L"\\\\.\\wdmaud" -extern HANDLE KernelHandle; -extern DWORD OpenCount; + +HANDLE KernelHandle = INVALID_HANDLE_VALUE; +DWORD OpenCount = 0; DWORD WINAPI @@ -77,14 +80,16 @@ MixerEventThreadRoutine( return 0; } -VOID -WdmAudCleanupLegacy() +MMRESULT +WdmAudCleanupByLegacy() { - if ( KernelHandle != INVALID_HANDLE_VALUE ) + if (KernelHandle != INVALID_HANDLE_VALUE) { CloseHandle(KernelHandle); KernelHandle = INVALID_HANDLE_VALUE; } + + return MMSYSERR_NOERROR; } MMRESULT @@ -325,12 +330,11 @@ WdmAudSetMixerDeviceFormatByLegacy( WDMAUD_DEVICE_INFO DeviceInfo; HANDLE hThread; - Instance->hNotifyEvent = CreateEventW(NULL, FALSE, FALSE, NULL); if ( ! Instance->hNotifyEvent ) return MMSYSERR_NOMEM; - if (Instance->Handle != KernelHandle) + if (Instance->Handle != NULL) { /* device is already open */ return MMSYSERR_NOERROR; @@ -399,7 +403,7 @@ WdmAudSetWaveDeviceFormatByLegacy( return TranslateInternalMmResult(Result); } - if (Instance->Handle != KernelHandle) + if (Instance->Handle != NULL) { /* device is already open */ return MMSYSERR_NOERROR; @@ -494,7 +498,7 @@ WdmAudSetWaveDeviceFormatByLegacy( } MMRESULT -WriteFileEx_Committer2( +WdmAudCommitWaveBufferByLegacy( IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, IN PVOID OffsetPtr, IN DWORD Length, @@ -514,7 +518,7 @@ WriteFileEx_Committer2( VALIDATE_MMSYS_PARAMETER( CompletionRoutine ); GetSoundDeviceInstanceHandle(SoundDeviceInstance, &Handle); - + SND_ASSERT(Handle); Result = GetSoundDeviceFromInstance(SoundDeviceInstance, &SoundDevice); @@ -526,8 +530,6 @@ WriteFileEx_Committer2( Result = GetSoundDeviceType(SoundDevice, &DeviceType); SND_ASSERT( Result == MMSYSERR_NOERROR ); - SND_ASSERT(Handle); - ZeroMemory(&DeviceInfo, sizeof(WDMAUD_DEVICE_INFO)); DeviceInfo.Header.FrameExtent = Length; @@ -542,6 +544,8 @@ WriteFileEx_Committer2( DeviceInfo.hDevice = Handle; DeviceInfo.DeviceType = DeviceType; + + Overlap->Standard.hEvent = CreateEventW(NULL, FALSE, FALSE, NULL); if (DeviceType == WAVE_OUT_DEVICE_TYPE)