mirror of
https://gitlab.winehq.org/wine/wine.git
synced 2024-11-19 17:06:04 -07:00
propsys: Support converting to BSTR for PropVariantToVariant.
This commit is contained in:
parent
05ba3c4c4f
commit
909075ed57
2 changed files with 10 additions and 16 deletions
|
@ -1069,6 +1069,8 @@ INT WINAPI PropVariantCompareEx(REFPROPVARIANT propvar1, REFPROPVARIANT propvar2
|
|||
|
||||
HRESULT WINAPI PropVariantToVariant(const PROPVARIANT *propvar, VARIANT *var)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
TRACE("propvar %p, var %p, propvar->vt %#x.\n", propvar, var, propvar ? propvar->vt : 0);
|
||||
|
||||
if (!var || !propvar)
|
||||
|
@ -1115,12 +1117,19 @@ HRESULT WINAPI PropVariantToVariant(const PROPVARIANT *propvar, VARIANT *var)
|
|||
case VT_R8:
|
||||
V_R8(var) = propvar->dblVal;
|
||||
break;
|
||||
case VT_LPSTR:
|
||||
case VT_LPWSTR:
|
||||
case VT_BSTR:
|
||||
case VT_CLSID:
|
||||
var->vt = VT_BSTR;
|
||||
hr = PropVariantToBSTR(propvar, &V_BSTR(var));
|
||||
break;
|
||||
default:
|
||||
FIXME("Unsupported type %d.\n", propvar->vt);
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT WINAPI VariantToPropVariant(const VARIANT *var, PROPVARIANT *propvar)
|
||||
|
|
|
@ -2592,14 +2592,10 @@ static void test_PropVariantToVariant(void)
|
|||
propvar.vt = VT_BSTR;
|
||||
propvar.bstrVal = SysAllocString(L"test");
|
||||
hr = PropVariantToVariant(&propvar, &var);
|
||||
todo_wine
|
||||
ok(hr == S_OK, "PropVariantToVariant returned %#lx.\n", hr);
|
||||
if (hr == S_OK)
|
||||
{
|
||||
ok(V_VT(&var) == VT_BSTR, "Unexpected V_VT(&var) %d.\n", V_VT(&var));
|
||||
ok(V_BSTR(&var) != propvar.bstrVal, "Got same string pointer.\n");
|
||||
ok(!wcscmp(V_BSTR(&var), propvar.bstrVal), "Unexpected V_BSTR(&var) %s.\n", debugstr_w(V_BSTR(&var)));
|
||||
}
|
||||
PropVariantClear(&propvar);
|
||||
VariantClear(&var);
|
||||
|
||||
|
@ -2608,36 +2604,25 @@ static void test_PropVariantToVariant(void)
|
|||
hr = PropVariantToVariant(&propvar, &var);
|
||||
todo_wine
|
||||
ok(hr == 39, "PropVariantToVariant returned %#lx.\n", hr);
|
||||
if (hr == 39)
|
||||
{
|
||||
ok(V_VT(&var) == VT_BSTR, "Unexpected V_VT(&var) %d.\n", V_VT(&var));
|
||||
ok(!wcscmp(V_BSTR(&var), dummy_guid_str), "Unexpected V_BSTR(&var) %s.\n", debugstr_w(V_BSTR(&var)));
|
||||
}
|
||||
VariantClear(&var);
|
||||
|
||||
propvar.vt = VT_LPSTR;
|
||||
propvar.pszVal = (char *)topic;
|
||||
hr = PropVariantToVariant(&propvar, &var);
|
||||
todo_wine
|
||||
ok(hr == S_OK, "PropVariantToVariant returned %#lx.\n", hr);
|
||||
if (hr == S_OK)
|
||||
{
|
||||
ok(V_VT(&var) == VT_BSTR, "Unexpected V_VT(&var) %d.\n", V_VT(&var));
|
||||
ok(!wcscmp(V_BSTR(&var), topicW), "Unexpected V_BSTR(&var) %s.\n", debugstr_w(V_BSTR(&var)));
|
||||
}
|
||||
VariantClear(&var);
|
||||
|
||||
propvar.vt = VT_LPWSTR;
|
||||
propvar.pwszVal = (WCHAR *)topicW;
|
||||
hr = PropVariantToVariant(&propvar, &var);
|
||||
todo_wine
|
||||
ok(hr == S_OK, "PropVariantToVariant returned %#lx.\n", hr);
|
||||
if (hr == S_OK)
|
||||
{
|
||||
ok(V_VT(&var) == VT_BSTR, "Unexpected V_VT(&var) %d.\n", V_VT(&var));
|
||||
ok(V_BSTR(&var) != topicW, "Got same string pointer.\n");
|
||||
ok(!wcscmp(V_BSTR(&var), topicW), "Unexpected V_BSTR(&var) %s.\n", debugstr_w(V_BSTR(&var)));
|
||||
}
|
||||
VariantClear(&var);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue