Commit 001e0543 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

propsys: Handle VT_I4 type in VariantToString().

parent 2c752402
......@@ -436,7 +436,7 @@ PCWSTR WINAPI VariantToStringWithDefault(const VARIANT *pvar, const WCHAR *defau
*/
HRESULT WINAPI VariantToString(REFVARIANT var, PWSTR ret, UINT cch)
{
WCHAR *str = NULL;
WCHAR buffer[64], *str = buffer;
TRACE("%p, %p, %u.\n", var, ret, cch);
......@@ -445,15 +445,17 @@ HRESULT WINAPI VariantToString(REFVARIANT var, PWSTR ret, UINT cch)
if (!cch)
return E_INVALIDARG;
if (V_VT(var) == VT_BSTR)
switch (V_VT(var))
{
str = V_BSTR(var);
}
else
{
FIXME("Unsupported type %d.\n", V_VT(var));
return E_NOTIMPL;
case VT_BSTR:
str = V_BSTR(var);
break;
case VT_I4:
swprintf(buffer, ARRAY_SIZE(buffer), L"%d", V_I4(var));
break;
default:
FIXME("Unsupported type %d.\n", V_VT(var));
return E_NOTIMPL;
}
if (wcslen(str) > cch - 1)
......
......@@ -2290,6 +2290,13 @@ static void test_VariantToString(void)
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(!buff[0], "Unexpected buffer.\n");
buff[0] = 0;
V_VT(&v) = VT_I4;
V_I4(&v) = 567;
hr = VariantToString(&v, buff, 64);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(!wcscmp(buff, L"567"), "Unexpected buffer %s.\n", wine_dbgstr_w(buff));
V_VT(&v) = VT_BSTR;
V_BSTR(&v) = SysAllocString(L"test1");
......
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