fusion: Fix IAssemblyNameImpl_GetDisplayName behavior on too small buffer.
Signed-off-by: Piotr Caban <piotr@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
c222b86a52
commit
d790b160f9
|
@ -332,7 +332,10 @@ static HRESULT WINAPI IAssemblyNameImpl_GetDisplayName(IAssemblyName *iface,
|
||||||
size += lstrlenW(separator) + lstrlenW(procarch) + lstrlenW(equals) + lstrlenW(name->procarch);
|
size += lstrlenW(separator) + lstrlenW(procarch) + lstrlenW(equals) + lstrlenW(name->procarch);
|
||||||
|
|
||||||
if (size > *pccDisplayName)
|
if (size > *pccDisplayName)
|
||||||
return S_FALSE;
|
{
|
||||||
|
*pccDisplayName = size;
|
||||||
|
return E_NOT_SUFFICIENT_BUFFER;
|
||||||
|
}
|
||||||
|
|
||||||
/* Construct the string */
|
/* Construct the string */
|
||||||
lstrcpyW(szDisplayName, name->name);
|
lstrcpyW(szDisplayName, name->name);
|
||||||
|
|
|
@ -537,6 +537,13 @@ static void test_CreateAssemblyNameObject(void)
|
||||||
ok(str[0] == 'a', "got %c\n", str[0]);
|
ok(str[0] == 'a', "got %c\n", str[0]);
|
||||||
ok(size == 5, "got %u\n", size);
|
ok(size == 5, "got %u\n", size);
|
||||||
|
|
||||||
|
size = 0;
|
||||||
|
str[0] = 'a';
|
||||||
|
hr = IAssemblyName_GetDisplayName(name, str, &size, ASM_DISPLAYF_FULL);
|
||||||
|
ok(hr == E_NOT_SUFFICIENT_BUFFER, "got %08x\n", hr);
|
||||||
|
ok(str[0] == 'a', "got %c\n", str[0]);
|
||||||
|
ok(size == 5, "Wrong size %u\n", size);
|
||||||
|
|
||||||
size = MAX_PATH;
|
size = MAX_PATH;
|
||||||
hr = IAssemblyName_GetDisplayName(name, str, &size, ASM_DISPLAYF_FULL);
|
hr = IAssemblyName_GetDisplayName(name, str, &size, ASM_DISPLAYF_FULL);
|
||||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||||
|
|
Loading…
Reference in New Issue