[ros-diffs] [janderwald] 44326: [WDMAUD.DRV] - Implement support for resetting a stream (not yet used) - Don't translate the error again in QueryMixerInfo as SyncOverlappedDeviceIoControl has already translated the error - Don't touch the cbSize member when opening a wave device, as the caller might have passed a WAVEFORMAT struct instead a WAVEFORMATEX struct. Fixes winmm_winetest wave / mixer crashs - Query all available events when an mixer event is fired

janderwald at svn.reactos.org janderwald at svn.reactos.org
Sun Nov 29 23:58:34 CET 2009


Author: janderwald
Date: Sun Nov 29 23:58:33 2009
New Revision: 44326

URL: http://svn.reactos.org/svn/reactos?rev=44326&view=rev
Log:
[WDMAUD.DRV]
- Implement support for resetting a stream (not yet used)
- Don't translate the error again in QueryMixerInfo as SyncOverlappedDeviceIoControl has already translated the error
- Don't touch the cbSize member when opening a wave device, as the caller might have passed a WAVEFORMAT struct instead a WAVEFORMATEX struct. Fixes winmm_winetest wave / mixer crashs
- Query all available events when an mixer event is fired

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.c?rev=44326&r1=44325&r2=44326&view=diff
==============================================================================
--- trunk/reactos/dll/win32/wdmaud.drv/wdmaud.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/wdmaud.drv/wdmaud.c [iso-8859-1] Sun Nov 29 23:58:33 2009
@@ -321,24 +321,27 @@
             break;
         }
 
-        Result = SyncOverlappedDeviceIoControl(KernelHandle,
-                                               IOCTL_GET_MIXER_EVENT,
-                                               (LPVOID) &DeviceInfo,
-                                               sizeof(WDMAUD_DEVICE_INFO),
-                                               (LPVOID) &DeviceInfo,
-                                               sizeof(WDMAUD_DEVICE_INFO),
-                                               NULL);
-
-        if (Result == MMSYSERR_NOERROR)
-        {
-            DriverCallback(Instance->WinMM.ClientCallback,
-                           HIWORD(Instance->WinMM.Flags),
-                           Instance->WinMM.Handle,
-                           DeviceInfo.u.MixerEvent.NotificationType,
-                           Instance->WinMM.ClientCallbackInstanceData,
-                           (DWORD_PTR)DeviceInfo.u.MixerEvent.Value,
-                           0);
-        }
+        do
+        {
+            Result = SyncOverlappedDeviceIoControl(KernelHandle,
+                                                   IOCTL_GET_MIXER_EVENT,
+                                                   (LPVOID) &DeviceInfo,
+                                                   sizeof(WDMAUD_DEVICE_INFO),
+                                                   (LPVOID) &DeviceInfo,
+                                                   sizeof(WDMAUD_DEVICE_INFO),
+                                                   NULL);
+
+            if (Result == MMSYSERR_NOERROR)
+            {
+                DriverCallback(Instance->WinMM.ClientCallback,
+                               HIWORD(Instance->WinMM.Flags),
+                               Instance->WinMM.Handle,
+                               DeviceInfo.u.MixerEvent.NotificationType,
+                               Instance->WinMM.ClientCallbackInstanceData,
+                               (DWORD_PTR)DeviceInfo.u.MixerEvent.Value,
+                               0);
+            }
+        }while(Result == MMSYSERR_NOERROR);
     }while(TRUE);
 
     /* done */
@@ -443,7 +446,7 @@
     ZeroMemory(&DeviceInfo, sizeof(WDMAUD_DEVICE_INFO));
     DeviceInfo.DeviceType = DeviceType;
     DeviceInfo.DeviceIndex = DeviceId;
-    DeviceInfo.u.WaveFormatEx.cbSize = WaveFormat->cbSize;
+    DeviceInfo.u.WaveFormatEx.cbSize = sizeof(WAVEFORMATEX); //WaveFormat->cbSize;
     DeviceInfo.u.WaveFormatEx.wFormatTag = WaveFormat->wFormatTag;
 #ifdef USERMODE_MIXER
     DeviceInfo.u.WaveFormatEx.nChannels = 2;
@@ -747,6 +750,35 @@
 }
 
 MMRESULT
+ResetStream(
+    IN  struct _SOUND_DEVICE_INSTANCE* SoundDeviceInstance,
+    IN  MMDEVICE_TYPE DeviceType,
+    IN  BOOLEAN bStartReset)
+{
+    MMRESULT Result;
+    HANDLE Handle;
+    WDMAUD_DEVICE_INFO DeviceInfo;
+
+    Result = GetSoundDeviceInstanceHandle(SoundDeviceInstance, &Handle);
+    SND_ASSERT( Result == MMSYSERR_NOERROR );
+
+    ZeroMemory(&DeviceInfo, sizeof(WDMAUD_DEVICE_INFO));
+    DeviceInfo.hDevice = Handle;
+    DeviceInfo.DeviceType = DeviceType;
+    DeviceInfo.u.ResetStream = (bStartReset ? KSRESET_BEGIN : KSRESET_END);
+
+    Result = SyncOverlappedDeviceIoControl(KernelHandle,
+                                           IOCTL_RESET_STREAM,
+                                           (LPVOID) &DeviceInfo,
+                                           sizeof(WDMAUD_DEVICE_INFO),
+                                           (LPVOID) &DeviceInfo,
+                                           sizeof(WDMAUD_DEVICE_INFO),
+                                           NULL);
+    return Result;
+}
+
+
+MMRESULT
 QueryMixerInfo(
     IN  struct _SOUND_DEVICE_INSTANCE* SoundDeviceInstance,
     IN UINT uMsg,
@@ -808,7 +840,7 @@
 
     if ( ! MMSUCCESS(Result) )
     {
-        return TranslateInternalMmResult(Result);
+        return Result;
     }
 
     switch(uMsg)
@@ -876,6 +908,7 @@
         if (DeviceType == WAVE_IN_DEVICE_TYPE || DeviceType == WAVE_OUT_DEVICE_TYPE)
         {
             FuncTable.SetState = SetWdmWaveState;
+            FuncTable.ResetStream = ResetStream;
         }
 
         FuncTable.Open = OpenWdmSoundDevice;




More information about the Ros-diffs mailing list