winmm: fix WOD_Open() WAVE_MAPPER no-device case.

Fabrice Bauzac libnoon at gmail.com
Tue Aug 20 12:06:13 CDT 2013


Hello,

Indeed, WID_Open certainly suffers from the same problem.

Here is the patch for both.

>From 51cee06af9f5901ca7310aad1077d4b07472da1e Mon Sep 17 00:00:00 2001
From: Fabrice Bauzac <libnoon at gmail.com>
Date: Tue, 20 Aug 2013 05:37:53 +0200
Subject: winmm: fix WOD_Open() and WID_Open() WAVE_MAPPER no-device case.

WOD_Open() and WID_Open() now return MMSYSERR_BADDEVICEID in case
WAVE_MAPPER is requested and no device is present.

Fixes #34305.
---
 dlls/winmm/waveform.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/dlls/winmm/waveform.c b/dlls/winmm/waveform.c
index 752e64d..bb91a22 100644
--- a/dlls/winmm/waveform.c
+++ b/dlls/winmm/waveform.c
@@ -1228,6 +1228,9 @@ static LRESULT WOD_Open(WINMM_OpenInfo *info)
         WINMM_MMDevice *mmdevice;

         if(WINMM_IsMapper(info->req_device)){
+            if (g_outmmdevices_count == 0) {
+                return MMSYSERR_BADDEVICEID;
+            }
             devices = g_out_mapper_devices;
             mmdevice = read_map(g_out_map, 0);
             lock = &g_devthread_lock;
@@ -1317,6 +1320,9 @@ static LRESULT WID_Open(WINMM_OpenInfo *info)
     HRESULT hr;

     if(WINMM_IsMapper(info->req_device)){
+        if (g_inmmdevices_count == 0) {
+    return MMSYSERR_BADDEVICEID;
+        }
         devices = g_in_mapper_devices;
         mmdevice = read_map(g_in_map, 0);
         lock = &g_devthread_lock;
-- 
1.8.1.2

Thanks!

Best regards
Fabrice



More information about the wine-devel mailing list