From: Fabian Maurer dark.shadow4@web.de
"out" got checked for null earlier, so we should do it here as well Also added a test that crashes otherwise
Signed-off-by: Fabian Maurer dark.shadow4@web.de --- dlls/mmdevapi/client.c | 3 +++ dlls/mmdevapi/tests/render.c | 16 ++++++++++++++++ 2 files changed, 19 insertions(+)
diff --git a/dlls/mmdevapi/client.c b/dlls/mmdevapi/client.c index 11a0a572d98..ef4dcedb68b 100644 --- a/dlls/mmdevapi/client.c +++ b/dlls/mmdevapi/client.c @@ -650,6 +650,9 @@ static HRESULT WINAPI client_IsFormatSupported(IAudioClient3 *iface, AUDCLNT_SHA
WINE_UNIX_CALL(is_format_supported, ¶ms);
+ if (params.result == S_FALSE && !out) + return AUDCLNT_E_UNSUPPORTED_FORMAT; + if (params.result == S_FALSE) *out = ¶ms.fmt_out->Format; else diff --git a/dlls/mmdevapi/tests/render.c b/dlls/mmdevapi/tests/render.c index 8e000f03acb..3e24ac45944 100644 --- a/dlls/mmdevapi/tests/render.c +++ b/dlls/mmdevapi/tests/render.c @@ -139,11 +139,23 @@ static void test_audioclient(void) HRESULT hr; ULONG ref; WAVEFORMATEX *pwfx, *pwfx2; + WAVEFORMATEXTENSIBLE format_float_error; REFERENCE_TIME t1, t2; HANDLE handle; BOOL offload_capable; AudioClientProperties client_props;
+ format_float_error.Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE); + format_float_error.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE; + format_float_error.Format.nAvgBytesPerSec = 384000; + format_float_error.Format.nBlockAlign = 8; + format_float_error.Format.nChannels = 2; + format_float_error.Format.nSamplesPerSec = 48000; + format_float_error.Format.wBitsPerSample = 32; + format_float_error.Samples.wValidBitsPerSample = 4; + format_float_error.dwChannelMask = 3; + format_float_error.SubFormat = KSDATAFORMAT_SUBTYPE_IEEE_FLOAT; + hr = IMMDevice_Activate(dev, &IID_IAudioClient3, CLSCTX_INPROC_SERVER, NULL, (void**)&ac3); ok(hr == S_OK || @@ -258,6 +270,10 @@ static void test_audioclient(void) "IsFormatSupported(Exclusive) call returns %08lx\n", hr); hexcl = hr;
+ hr = IAudioClient_IsFormatSupported(ac, AUDCLNT_SHAREMODE_EXCLUSIVE, &format_float_error.Format, NULL); + ok(hr == S_OK || hr == AUDCLNT_E_UNSUPPORTED_FORMAT || hr == AUDCLNT_E_EXCLUSIVE_MODE_NOT_ALLOWED, + "IsFormatSupported(Exclusive) call returns %08lx\n", hr); + pwfx2 = (WAVEFORMATEX*)0xDEADF00D; hr = IAudioClient_IsFormatSupported(ac, AUDCLNT_SHAREMODE_EXCLUSIVE, pwfx, &pwfx2); ok(hr == hexcl, "IsFormatSupported(Exclusive) call returns %08lx\n", hr);