Commit 653d04d7 authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

mmdevapi: Warn if returned device name is too long.

parent f5fc65ab
......@@ -1378,6 +1378,7 @@ static HRESULT WINAPI MMDevPropStore_GetAt(IPropertyStore *iface, DWORD prop, PR
static HRESULT WINAPI MMDevPropStore_GetValue(IPropertyStore *iface, REFPROPERTYKEY key, PROPVARIANT *pv)
{
MMDevPropStore *This = impl_from_IPropertyStore(iface);
HRESULT hres;
TRACE("(%p)->(\"%s,%lu\", %p)\n", This, key ? debugstr_guid(&key->fmtid) : NULL, key ? key->pid : 0, pv);
if (!key || !pv)
......@@ -1397,7 +1398,19 @@ static HRESULT WINAPI MMDevPropStore_GetValue(IPropertyStore *iface, REFPROPERTY
return S_OK;
}
return MMDevice_GetPropValue(&This->parent->devguid, This->parent->flow, key, pv);
hres = MMDevice_GetPropValue(&This->parent->devguid, This->parent->flow, key, pv);
if (FAILED(hres))
return hres;
if (WARN_ON(mmdevapi))
{
if ((IsEqualPropertyKey(*key, DEVPKEY_Device_FriendlyName) ||
IsEqualPropertyKey(*key, DEVPKEY_DeviceInterface_FriendlyName) ||
IsEqualPropertyKey(*key, DEVPKEY_Device_DeviceDesc)) &&
pv->vt == VT_LPWSTR && wcslen(pv->pwszVal) > 62)
WARN("Returned name exceeds length limit of some broken apps/libs, might crash: %s\n", debugstr_w(pv->pwszVal));
}
return hres;
}
static HRESULT WINAPI MMDevPropStore_SetValue(IPropertyStore *iface, REFPROPERTYKEY key, REFPROPVARIANT pv)
......
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