Commit db87636c authored by Andrew Eikum's avatar Andrew Eikum Committed by Alexandre Julliard

mmdevapi: Support older version of the AudioClientProperties structure.

Warframe when using a win10 prefix uses an xaudio2_9redist.dll which uses the older AudioClientProperties structure (missing the Options member). Based on a patch by Alistair Leslie-Hughes. Signed-off-by: 's avatarAndrew Eikum <aeikum@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 01563ba9
...@@ -276,6 +276,7 @@ static void test_audioclient(void) ...@@ -276,6 +276,7 @@ static void test_audioclient(void)
hr = IAudioClient2_SetClientProperties(ac2, NULL); hr = IAudioClient2_SetClientProperties(ac2, NULL);
ok(hr == E_POINTER, "SetClientProperties with NULL props gave wrong error: %08x\n", hr); ok(hr == E_POINTER, "SetClientProperties with NULL props gave wrong error: %08x\n", hr);
/* invalid cbSize */
client_props.cbSize = 0; client_props.cbSize = 0;
client_props.bIsOffload = FALSE; client_props.bIsOffload = FALSE;
client_props.eCategory = AudioCategory_BackgroundCapableMedia; client_props.eCategory = AudioCategory_BackgroundCapableMedia;
...@@ -284,7 +285,8 @@ static void test_audioclient(void) ...@@ -284,7 +285,8 @@ static void test_audioclient(void)
hr = IAudioClient2_SetClientProperties(ac2, &client_props); hr = IAudioClient2_SetClientProperties(ac2, &client_props);
ok(hr == E_INVALIDARG, "SetClientProperties with invalid cbSize gave wrong error: %08x\n", hr); ok(hr == E_INVALIDARG, "SetClientProperties with invalid cbSize gave wrong error: %08x\n", hr);
client_props.cbSize = sizeof(client_props); /* offload consistency */
client_props.cbSize = sizeof(client_props) - sizeof(client_props.Options);
client_props.bIsOffload = TRUE; client_props.bIsOffload = TRUE;
hr = IAudioClient2_SetClientProperties(ac2, &client_props); hr = IAudioClient2_SetClientProperties(ac2, &client_props);
...@@ -293,10 +295,18 @@ static void test_audioclient(void) ...@@ -293,10 +295,18 @@ static void test_audioclient(void)
else else
ok(hr == S_OK, "SetClientProperties(offload) failed: %08x\n", hr); ok(hr == S_OK, "SetClientProperties(offload) failed: %08x\n", hr);
/* disable offload */
client_props.bIsOffload = FALSE; client_props.bIsOffload = FALSE;
hr = IAudioClient2_SetClientProperties(ac2, &client_props); hr = IAudioClient2_SetClientProperties(ac2, &client_props);
ok(hr == S_OK, "SetClientProperties failed: %08x\n", hr); ok(hr == S_OK, "SetClientProperties failed: %08x\n", hr);
/* Options field added in Win 8.1 */
client_props.cbSize = sizeof(client_props);
hr = IAudioClient2_SetClientProperties(ac2, &client_props);
ok(hr == S_OK ||
broken(hr == E_INVALIDARG) /* <= win8 */,
"SetClientProperties failed: %08x\n", hr);
IAudioClient2_Release(ac2); IAudioClient2_Release(ac2);
} }
else else
......
...@@ -2676,21 +2676,29 @@ static HRESULT WINAPI AudioClient_SetClientProperties(IAudioClient3 *iface, ...@@ -2676,21 +2676,29 @@ static HRESULT WINAPI AudioClient_SetClientProperties(IAudioClient3 *iface,
const AudioClientProperties *prop) const AudioClientProperties *prop)
{ {
ACImpl *This = impl_from_IAudioClient3(iface); ACImpl *This = impl_from_IAudioClient3(iface);
const Win8AudioClientProperties *legacy_prop = (const Win8AudioClientProperties *)prop;
TRACE("(%p)->(%p)\n", This, prop); TRACE("(%p)->(%p)\n", This, prop);
if(!prop) if(!legacy_prop)
return E_POINTER; return E_POINTER;
if(prop->cbSize != sizeof(*prop)) if(legacy_prop->cbSize == sizeof(AudioClientProperties)){
TRACE("{ bIsOffload: %u, eCategory: 0x%x, Options: 0x%x }\n",
legacy_prop->bIsOffload,
legacy_prop->eCategory,
prop->Options);
}else if(legacy_prop->cbSize == sizeof(Win8AudioClientProperties)){
TRACE("{ bIsOffload: %u, eCategory: 0x%x }\n",
legacy_prop->bIsOffload,
legacy_prop->eCategory);
}else{
WARN("Unsupported Size = %d\n", legacy_prop->cbSize);
return E_INVALIDARG; return E_INVALIDARG;
}
TRACE("{ bIsOffload: %u, eCategory: 0x%x, Options: 0x%x }\n",
prop->bIsOffload,
prop->eCategory,
prop->Options);
if(prop->bIsOffload) if(legacy_prop->bIsOffload)
return AUDCLNT_E_ENDPOINT_OFFLOAD_NOT_CAPABLE; return AUDCLNT_E_ENDPOINT_OFFLOAD_NOT_CAPABLE;
return S_OK; return S_OK;
......
...@@ -1635,21 +1635,29 @@ static HRESULT WINAPI AudioClient_SetClientProperties(IAudioClient3 *iface, ...@@ -1635,21 +1635,29 @@ static HRESULT WINAPI AudioClient_SetClientProperties(IAudioClient3 *iface,
const AudioClientProperties *prop) const AudioClientProperties *prop)
{ {
ACImpl *This = impl_from_IAudioClient3(iface); ACImpl *This = impl_from_IAudioClient3(iface);
const Win8AudioClientProperties *legacy_prop = (const Win8AudioClientProperties *)prop;
TRACE("(%p)->(%p)\n", This, prop); TRACE("(%p)->(%p)\n", This, prop);
if(!prop) if(!legacy_prop)
return E_POINTER; return E_POINTER;
if(prop->cbSize != sizeof(*prop)) if(legacy_prop->cbSize == sizeof(AudioClientProperties)){
TRACE("{ bIsOffload: %u, eCategory: 0x%x, Options: 0x%x }\n",
legacy_prop->bIsOffload,
legacy_prop->eCategory,
prop->Options);
}else if(legacy_prop->cbSize == sizeof(Win8AudioClientProperties)){
TRACE("{ bIsOffload: %u, eCategory: 0x%x }\n",
legacy_prop->bIsOffload,
legacy_prop->eCategory);
}else{
WARN("Unsupported Size = %d\n", legacy_prop->cbSize);
return E_INVALIDARG; return E_INVALIDARG;
}
TRACE("{ bIsOffload: %u, eCategory: 0x%x, Options: 0x%x }\n",
prop->bIsOffload,
prop->eCategory,
prop->Options);
if(prop->bIsOffload) if(legacy_prop->bIsOffload)
return AUDCLNT_E_ENDPOINT_OFFLOAD_NOT_CAPABLE; return AUDCLNT_E_ENDPOINT_OFFLOAD_NOT_CAPABLE;
return S_OK; return S_OK;
......
...@@ -2243,21 +2243,29 @@ static HRESULT WINAPI AudioClient_SetClientProperties(IAudioClient3 *iface, ...@@ -2243,21 +2243,29 @@ static HRESULT WINAPI AudioClient_SetClientProperties(IAudioClient3 *iface,
const AudioClientProperties *prop) const AudioClientProperties *prop)
{ {
ACImpl *This = impl_from_IAudioClient3(iface); ACImpl *This = impl_from_IAudioClient3(iface);
const Win8AudioClientProperties *legacy_prop = (const Win8AudioClientProperties *)prop;
TRACE("(%p)->(%p)\n", This, prop); TRACE("(%p)->(%p)\n", This, prop);
if(!prop) if(!legacy_prop)
return E_POINTER; return E_POINTER;
if(prop->cbSize != sizeof(*prop)) if(legacy_prop->cbSize == sizeof(AudioClientProperties)){
TRACE("{ bIsOffload: %u, eCategory: 0x%x, Options: 0x%x }\n",
legacy_prop->bIsOffload,
legacy_prop->eCategory,
prop->Options);
}else if(legacy_prop->cbSize == sizeof(Win8AudioClientProperties)){
TRACE("{ bIsOffload: %u, eCategory: 0x%x }\n",
legacy_prop->bIsOffload,
legacy_prop->eCategory);
}else{
WARN("Unsupported Size = %d\n", legacy_prop->cbSize);
return E_INVALIDARG; return E_INVALIDARG;
}
TRACE("{ bIsOffload: %u, eCategory: 0x%x, Options: 0x%x }\n",
prop->bIsOffload,
prop->eCategory,
prop->Options);
if(prop->bIsOffload) if(legacy_prop->bIsOffload)
return AUDCLNT_E_ENDPOINT_OFFLOAD_NOT_CAPABLE; return AUDCLNT_E_ENDPOINT_OFFLOAD_NOT_CAPABLE;
return S_OK; return S_OK;
......
...@@ -1800,21 +1800,29 @@ static HRESULT WINAPI AudioClient_SetClientProperties(IAudioClient3 *iface, ...@@ -1800,21 +1800,29 @@ static HRESULT WINAPI AudioClient_SetClientProperties(IAudioClient3 *iface,
const AudioClientProperties *prop) const AudioClientProperties *prop)
{ {
ACImpl *This = impl_from_IAudioClient3(iface); ACImpl *This = impl_from_IAudioClient3(iface);
const Win8AudioClientProperties *legacy_prop = (const Win8AudioClientProperties *)prop;
TRACE("(%p)->(%p)\n", This, prop); TRACE("(%p)->(%p)\n", This, prop);
if(!prop) if(!legacy_prop)
return E_POINTER; return E_POINTER;
if(prop->cbSize != sizeof(*prop)) if(legacy_prop->cbSize == sizeof(AudioClientProperties)){
TRACE("{ bIsOffload: %u, eCategory: 0x%x, Options: 0x%x }\n",
legacy_prop->bIsOffload,
legacy_prop->eCategory,
prop->Options);
}else if(legacy_prop->cbSize == sizeof(Win8AudioClientProperties)){
TRACE("{ bIsOffload: %u, eCategory: 0x%x }\n",
legacy_prop->bIsOffload,
legacy_prop->eCategory);
}else{
WARN("Unsupported Size = %d\n", legacy_prop->cbSize);
return E_INVALIDARG; return E_INVALIDARG;
}
TRACE("{ bIsOffload: %u, eCategory: 0x%x, Options: 0x%x }\n",
prop->bIsOffload,
prop->eCategory,
prop->Options);
if(prop->bIsOffload) if(legacy_prop->bIsOffload)
return AUDCLNT_E_ENDPOINT_OFFLOAD_NOT_CAPABLE; return AUDCLNT_E_ENDPOINT_OFFLOAD_NOT_CAPABLE;
return S_OK; return S_OK;
......
...@@ -2248,21 +2248,29 @@ static HRESULT WINAPI AudioClient_SetClientProperties(IAudioClient3 *iface, ...@@ -2248,21 +2248,29 @@ static HRESULT WINAPI AudioClient_SetClientProperties(IAudioClient3 *iface,
const AudioClientProperties *prop) const AudioClientProperties *prop)
{ {
ACImpl *This = impl_from_IAudioClient3(iface); ACImpl *This = impl_from_IAudioClient3(iface);
const Win8AudioClientProperties *legacy_prop = (const Win8AudioClientProperties *)prop;
TRACE("(%p)->(%p)\n", This, prop); TRACE("(%p)->(%p)\n", This, prop);
if(!prop) if(!legacy_prop)
return E_POINTER; return E_POINTER;
if(prop->cbSize != sizeof(*prop)) if(legacy_prop->cbSize == sizeof(AudioClientProperties)){
TRACE("{ bIsOffload: %u, eCategory: 0x%x, Options: 0x%x }\n",
legacy_prop->bIsOffload,
legacy_prop->eCategory,
prop->Options);
}else if(legacy_prop->cbSize == sizeof(Win8AudioClientProperties)){
TRACE("{ bIsOffload: %u, eCategory: 0x%x }\n",
legacy_prop->bIsOffload,
legacy_prop->eCategory);
}else{
WARN("Unsupported Size = %d\n", legacy_prop->cbSize);
return E_INVALIDARG; return E_INVALIDARG;
}
TRACE("{ bIsOffload: %u, eCategory: 0x%x, Options: 0x%x }\n",
prop->bIsOffload,
prop->eCategory,
prop->Options);
if(prop->bIsOffload) if(legacy_prop->bIsOffload)
return AUDCLNT_E_ENDPOINT_OFFLOAD_NOT_CAPABLE; return AUDCLNT_E_ENDPOINT_OFFLOAD_NOT_CAPABLE;
return S_OK; return S_OK;
......
...@@ -126,6 +126,14 @@ typedef struct _AudioClientProperties ...@@ -126,6 +126,14 @@ typedef struct _AudioClientProperties
AUDCLNT_STREAMOPTIONS Options; AUDCLNT_STREAMOPTIONS Options;
} AudioClientProperties; } AudioClientProperties;
typedef struct _Win8AudioClientProperties
{
UINT32 cbSize;
BOOL bIsOffload;
AUDIO_STREAM_CATEGORY eCategory;
/* Options field added in Win 8.1 */
} Win8AudioClientProperties;
[ [
local, local,
pointer_default(unique), pointer_default(unique),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment