[PATCH] winmm: return error in waveInMessage if either dwParam1 or dwParam2 is null

Louis Lenders xerox.xerox2000x at gmail.com
Tue Apr 24 05:20:39 CDT 2018


This fixes https://bugs.winehq.org/show_bug.cgi?id=44953

There was no test for waveInMessage, so I didn`t find it neat to put a test between the waveOutMessage tests, 
but the test for waveInMessage can be seen here:

https://testbot.winehq.org/JobDetails.pl?Key=37990


Signed-off-by: Louis Lenders <xerox.xerox2000x at gmail.com>
---
 dlls/winmm/waveform.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/dlls/winmm/waveform.c b/dlls/winmm/waveform.c
index 26fed17..045bf4a 100644
--- a/dlls/winmm/waveform.c
+++ b/dlls/winmm/waveform.c
@@ -3660,17 +3660,17 @@ UINT WINAPI waveInMessage(HWAVEIN hWaveIn, UINT uMessage,
     case DRV_QUERYMAPPABLE:
         return MMSYSERR_NOERROR;
     case DRVM_MAPPER_PREFERRED_GET:
-        if(dwParam1) {
-            if(g_inmmdevices_count > 0)
-                /* Device 0 is always the default device */
-                *(DWORD *)dwParam1 = 0;
-            else
-                *(DWORD *)dwParam1 = -1;
-        }
+        if(!dwParam1 || !dwParam2)
+            return MMSYSERR_INVALPARAM;
 
-        if(dwParam2)
-            /* Status flags */
-            *(DWORD *)dwParam2 = 0;
+        if(g_inmmdevices_count > 0)
+            /* Device 0 is always the default device */
+            *(DWORD *)dwParam1 = 0;
+        else
+            *(DWORD *)dwParam1 = -1;
+
+        /* Status flags */
+        *(DWORD *)dwParam2 = 0;
 
         return MMSYSERR_NOERROR;
     }
-- 
2.7.4




More information about the wine-devel mailing list