fusion: Support buffer size queries in IAssemblyName::GetName.
This commit is contained in:
parent
c5c7137212
commit
382b72d729
|
@ -369,19 +369,24 @@ static HRESULT WINAPI IAssemblyNameImpl_GetName(IAssemblyName *iface,
|
|||
WCHAR *pwzName)
|
||||
{
|
||||
IAssemblyNameImpl *name = impl_from_IAssemblyName(iface);
|
||||
DWORD len;
|
||||
|
||||
TRACE("(%p, %p, %p)\n", iface, lpcwBuffer, pwzName);
|
||||
|
||||
if (!name->name)
|
||||
if (name->name)
|
||||
len = strlenW(name->name) + 1;
|
||||
else
|
||||
len = 0;
|
||||
|
||||
if (*lpcwBuffer < len)
|
||||
{
|
||||
*pwzName = '\0';
|
||||
*lpcwBuffer = 0;
|
||||
return S_OK;
|
||||
*lpcwBuffer = len;
|
||||
return E_NOT_SUFFICIENT_BUFFER;
|
||||
}
|
||||
if (!name->name) lpcwBuffer[0] = 0;
|
||||
else strcpyW(pwzName, name->name);
|
||||
|
||||
lstrcpyW(pwzName, name->name);
|
||||
*lpcwBuffer = lstrlenW(pwzName) + 1;
|
||||
|
||||
*lpcwBuffer = len;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -421,12 +421,12 @@ static void test_CreateAssemblyNameObject(void)
|
|||
broken(hr == E_INVALIDARG), /* .NET 1.x */
|
||||
"Expected FUSION_E_INVALID_NAME, got %08x\n", hr);
|
||||
|
||||
str[0] = 'a';
|
||||
size = MAX_PATH;
|
||||
str[0] = '\0';
|
||||
hr = IAssemblyName_GetName(name, &size, str);
|
||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||
ok(!str[0], "Expected empty name\n");
|
||||
ok(size == 0, "Expected 0, got %d\n", size);
|
||||
ok(hr == S_OK, "got %08x\n", hr);
|
||||
ok(str[0] == 'a', "got %c\n", str[0]);
|
||||
ok(!size, "got %u\n", size);
|
||||
|
||||
hi = 0xbeefcace;
|
||||
lo = 0xcafebabe;
|
||||
|
@ -457,6 +457,26 @@ static void test_CreateAssemblyNameObject(void)
|
|||
broken(hr == S_OK), /* .NET 1.x */
|
||||
"Expected FUSION_E_INVALID_NAME, got %08x\n", hr);
|
||||
|
||||
size = 0;
|
||||
hr = IAssemblyName_GetName(name, &size, NULL);
|
||||
ok(hr == E_NOT_SUFFICIENT_BUFFER, "got %08x\n", hr);
|
||||
ok(size == 1, "got %u\n", size);
|
||||
|
||||
if (0) /* crash */
|
||||
{
|
||||
str[0] = '\0';
|
||||
hr = IAssemblyName_GetName(name, NULL, str);
|
||||
ok(hr == E_NOT_SUFFICIENT_BUFFER, "got %08x\n", hr);
|
||||
ok(!str[0], "got %c\n", str[0]);
|
||||
}
|
||||
|
||||
size = 0;
|
||||
str[0] = '\0';
|
||||
hr = IAssemblyName_GetName(name, &size, str);
|
||||
ok(hr == E_NOT_SUFFICIENT_BUFFER, "got %08x\n", hr);
|
||||
ok(!str[0], "got %c\n", str[0]);
|
||||
ok(size == 1, "got %u\n", size);
|
||||
|
||||
size = MAX_PATH;
|
||||
str[0] = '\0';
|
||||
hr = IAssemblyName_GetName(name, &size, str);
|
||||
|
@ -494,6 +514,13 @@ static void test_CreateAssemblyNameObject(void)
|
|||
ok_aw("wine", str);
|
||||
ok(size == 5, "Expected 5, got %d\n", size);
|
||||
|
||||
size = 0;
|
||||
str[0] = 0;
|
||||
hr = IAssemblyName_GetName(name, &size, str);
|
||||
ok(hr == E_NOT_SUFFICIENT_BUFFER, "got %08x\n", hr);
|
||||
ok(!str[0], "got %c\n", str[0]);
|
||||
ok(size == 5, "got %u\n", size);
|
||||
|
||||
size = MAX_PATH;
|
||||
str[0] = '\0';
|
||||
hr = IAssemblyName_GetName(name, &size, str);
|
||||
|
|
Loading…
Reference in New Issue