Andrew Eikum : mmdevapi: Set data pointer to NULL on IAudioCaptureClient::GetBuffer failure.

Alexandre Julliard julliard at winehq.org
Sun Oct 27 15:06:17 CDT 2019


Module: wine
Branch: master
Commit: 3c1ee2f80d122337f360ac583f739feddde52f6f
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=3c1ee2f80d122337f360ac583f739feddde52f6f

Author: Andrew Eikum <aeikum at codeweavers.com>
Date:   Thu Oct 24 11:28:35 2019 -0500

mmdevapi: Set data pointer to NULL on IAudioCaptureClient::GetBuffer failure.

Matches Windows 10 behavior.

Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/mmdevapi/tests/capture.c     | 9 ++++++---
 dlls/winealsa.drv/mmdevdrv.c      | 7 ++++++-
 dlls/wineandroid.drv/mmdevdrv.c   | 7 ++++++-
 dlls/winecoreaudio.drv/mmdevdrv.c | 7 ++++++-
 dlls/wineoss.drv/mmdevdrv.c       | 7 ++++++-
 dlls/winepulse.drv/mmdevdrv.c     | 7 ++++++-
 6 files changed, 36 insertions(+), 8 deletions(-)

diff --git a/dlls/mmdevapi/tests/capture.c b/dlls/mmdevapi/tests/capture.c
index 253ba3c762..5cf61ea824 100644
--- a/dlls/mmdevapi/tests/capture.c
+++ b/dlls/mmdevapi/tests/capture.c
@@ -122,7 +122,8 @@ static void test_capture(IAudioClient *ac, HANDLE handle, WAVEFORMATEX *wfx)
 
     hr = IAudioCaptureClient_GetBuffer(acc, &data, &frames, NULL, NULL, NULL);
     ok(hr == E_POINTER, "IAudioCaptureClient_GetBuffer(&ata, &frames, NULL) returns %08x\n", hr);
-    ok((DWORD_PTR)data == 0xdeadf00d, "data is reset to %p\n", data);
+    ok(broken((DWORD_PTR)data == 0xdeadf00d) || /* <= win8 */
+            data == NULL, "data is reset to %p\n", data);
     ok(frames == 0xdeadbeef, "frames is reset to %08x\n", frames);
     ok(flags == 0xabadcafe, "flags is reset to %08x\n", flags);
 
@@ -147,7 +148,8 @@ static void test_capture(IAudioClient *ac, HANDLE handle, WAVEFORMATEX *wfx)
         sum = pos;
     }else if (hr == AUDCLNT_S_BUFFER_EMPTY){
         ok(!frames, "Amount of frames locked with empty buffer is %u!\n", frames);
-        ok(data == (void*)0xdeadf00d, "No data changed to %p\n", data);
+        ok(broken(data == (void*)0xdeadf00d) || /* <= win8 */
+                data == NULL, "No data changed to %p\n", data);
     }
 
     trace("Wait'ed position %d pad %u flags %x, amount of frames locked: %u\n",
@@ -228,7 +230,8 @@ static void test_capture(IAudioClient *ac, HANDLE handle, WAVEFORMATEX *wfx)
         hr = IAudioCaptureClient_GetBuffer(acc, &data2, &frames2, &flags, &pos, &qpc);
         ok(hr == AUDCLNT_E_OUT_OF_ORDER, "Out of order IAudioCaptureClient_GetBuffer returns %08x\n", hr);
         ok(frames2 == 0xabadcafe, "Out of order frames changed to %x\n", frames2);
-        ok(data2 == (void*)0xdeadf00d, "Out of order data changed to %p\n", data2);
+        ok(broken(data2 == (void*)0xdeadf00d) /* <= win8 */ ||
+                data2 == NULL, "Out of order data changed to %p\n", data2);
         ok(flags == 0xabadcafe, "Out of order flags changed to %x\n", flags);
         ok(pos == 0xdeadbeef, "Out of order position changed to %x\n", (UINT)pos);
         ok(qpc == 0xdeadbeef, "Out of order timer changed to %x\n", (UINT)qpc);
diff --git a/dlls/winealsa.drv/mmdevdrv.c b/dlls/winealsa.drv/mmdevdrv.c
index 4f1270b33c..5bc71da77a 100644
--- a/dlls/winealsa.drv/mmdevdrv.c
+++ b/dlls/winealsa.drv/mmdevdrv.c
@@ -2883,7 +2883,12 @@ static HRESULT WINAPI AudioCaptureClient_GetBuffer(IAudioCaptureClient *iface,
     TRACE("(%p)->(%p, %p, %p, %p, %p)\n", This, data, frames, flags,
             devpos, qpcpos);
 
-    if(!data || !frames || !flags)
+    if(!data)
+        return E_POINTER;
+
+    *data = NULL;
+
+    if(!frames || !flags)
         return E_POINTER;
 
     EnterCriticalSection(&This->lock);
diff --git a/dlls/wineandroid.drv/mmdevdrv.c b/dlls/wineandroid.drv/mmdevdrv.c
index 1dafe02f4c..e10b3debf1 100644
--- a/dlls/wineandroid.drv/mmdevdrv.c
+++ b/dlls/wineandroid.drv/mmdevdrv.c
@@ -1845,7 +1845,12 @@ static HRESULT WINAPI AudioCaptureClient_GetBuffer(IAudioCaptureClient *iface,
     TRACE("(%p)->(%p, %p, %p, %p, %p)\n", This, data, frames, flags,
             devpos, qpcpos);
 
-    if(!data || !frames || !flags)
+    if(!data)
+        return E_POINTER;
+
+    *data = NULL;
+
+    if(!frames || !flags)
         return E_POINTER;
 
     EnterCriticalSection(&This->lock);
diff --git a/dlls/winecoreaudio.drv/mmdevdrv.c b/dlls/winecoreaudio.drv/mmdevdrv.c
index be2b5e7e1e..d595f43007 100644
--- a/dlls/winecoreaudio.drv/mmdevdrv.c
+++ b/dlls/winecoreaudio.drv/mmdevdrv.c
@@ -2442,7 +2442,12 @@ static HRESULT WINAPI AudioCaptureClient_GetBuffer(IAudioCaptureClient *iface,
     TRACE("(%p)->(%p, %p, %p, %p, %p)\n", This, data, frames, flags,
             devpos, qpcpos);
 
-    if(!data || !frames || !flags)
+    if(!data)
+        return E_POINTER;
+
+    *data = NULL;
+
+    if(!frames || !flags)
         return E_POINTER;
 
     OSSpinLockLock(&This->lock);
diff --git a/dlls/wineoss.drv/mmdevdrv.c b/dlls/wineoss.drv/mmdevdrv.c
index dca40ecd77..c6b6e8effe 100644
--- a/dlls/wineoss.drv/mmdevdrv.c
+++ b/dlls/wineoss.drv/mmdevdrv.c
@@ -2007,7 +2007,12 @@ static HRESULT WINAPI AudioCaptureClient_GetBuffer(IAudioCaptureClient *iface,
     TRACE("(%p)->(%p, %p, %p, %p, %p)\n", This, data, frames, flags,
             devpos, qpcpos);
 
-    if(!data || !frames || !flags)
+    if(!data)
+        return E_POINTER;
+
+    *data = NULL;
+
+    if(!frames || !flags)
         return E_POINTER;
 
     EnterCriticalSection(&This->lock);
diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c
index 1c647c73d6..61f0e03c9f 100644
--- a/dlls/winepulse.drv/mmdevdrv.c
+++ b/dlls/winepulse.drv/mmdevdrv.c
@@ -2511,7 +2511,12 @@ static HRESULT WINAPI AudioCaptureClient_GetBuffer(IAudioCaptureClient *iface,
     TRACE("(%p)->(%p, %p, %p, %p, %p)\n", This, data, frames, flags,
             devpos, qpcpos);
 
-    if (!data || !frames || !flags)
+    if (!data)
+       return E_POINTER;
+
+    *data = NULL;
+
+    if (!frames || !flags)
         return E_POINTER;
 
     pthread_mutex_lock(&pulse_lock);




More information about the wine-cvs mailing list