propsys: Add VT_CLSID support for PropVariantToGUID().

Signed-off-by: Jactry Zeng <jzeng@codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jactry Zeng 2019-02-16 00:15:39 +08:00 committed by Alexandre Julliard
parent e0a829db99
commit 6d2c277a8b
2 changed files with 16 additions and 6 deletions

View File

@ -739,6 +739,9 @@ HRESULT WINAPI PropVariantToGUID(const PROPVARIANT *ppropvar, GUID *guid)
return PROPVAR_WCHARToGUID(ppropvar->u.bstrVal, SysStringLen(ppropvar->u.bstrVal), guid); return PROPVAR_WCHARToGUID(ppropvar->u.bstrVal, SysStringLen(ppropvar->u.bstrVal), guid);
case VT_LPWSTR: case VT_LPWSTR:
return PROPVAR_WCHARToGUID(ppropvar->u.pwszVal, strlenW(ppropvar->u.pwszVal), guid); return PROPVAR_WCHARToGUID(ppropvar->u.pwszVal, strlenW(ppropvar->u.pwszVal), guid);
case VT_CLSID:
memcpy(guid, ppropvar->u.puuid, sizeof(*ppropvar->u.puuid));
return S_OK;
default: default:
FIXME("unsupported vt: %d\n", ppropvar->vt); FIXME("unsupported vt: %d\n", ppropvar->vt);

View File

@ -568,7 +568,7 @@ static void test_PropVariantToGUID(void)
hres = PropVariantToGUID(&propvar, &guid); hres = PropVariantToGUID(&propvar, &guid);
ok(hres == S_OK, "PropVariantToGUID failed %x\n", hres); ok(hres == S_OK, "PropVariantToGUID failed %x\n", hres);
ok(!memcmp(&IID_NULL, &guid, sizeof(GUID)), "incorrect GUID created: %s\n", wine_dbgstr_guid(&guid)); ok(IsEqualGUID(&IID_NULL, &guid), "incorrect GUID created: %s\n", wine_dbgstr_guid(&guid));
PropVariantClear(&propvar); PropVariantClear(&propvar);
hres = InitPropVariantFromGUIDAsString(&dummy_guid, &propvar); hres = InitPropVariantFromGUIDAsString(&dummy_guid, &propvar);
@ -576,7 +576,7 @@ static void test_PropVariantToGUID(void)
hres = PropVariantToGUID(&propvar, &guid); hres = PropVariantToGUID(&propvar, &guid);
ok(hres == S_OK, "PropVariantToGUID failed %x\n", hres); ok(hres == S_OK, "PropVariantToGUID failed %x\n", hres);
ok(!memcmp(&dummy_guid, &guid, sizeof(GUID)), "incorrect GUID created: %s\n", wine_dbgstr_guid(&guid)); ok(IsEqualGUID(&dummy_guid, &guid), "incorrect GUID created: %s\n", wine_dbgstr_guid(&guid));
ok(propvar.vt == VT_LPWSTR, "incorrect PROPVARIANT type: %d\n", propvar.vt); ok(propvar.vt == VT_LPWSTR, "incorrect PROPVARIANT type: %d\n", propvar.vt);
propvar.u.pwszVal[1] = 'd'; propvar.u.pwszVal[1] = 'd';
@ -584,7 +584,7 @@ static void test_PropVariantToGUID(void)
propvar.u.pwszVal[3] = 'a'; propvar.u.pwszVal[3] = 'a';
hres = PropVariantToGUID(&propvar, &guid); hres = PropVariantToGUID(&propvar, &guid);
ok(hres == S_OK, "PropVariantToGUID failed %x\n", hres); ok(hres == S_OK, "PropVariantToGUID failed %x\n", hres);
ok(!memcmp(&dummy_guid, &guid, sizeof(GUID)), "incorrect GUID created: %s\n", wine_dbgstr_guid(&guid)); ok(IsEqualGUID(&dummy_guid, &guid), "incorrect GUID created: %s\n", wine_dbgstr_guid(&guid));
propvar.u.pwszVal[1] = 'z'; propvar.u.pwszVal[1] = 'z';
hres = PropVariantToGUID(&propvar, &guid); hres = PropVariantToGUID(&propvar, &guid);
@ -597,7 +597,7 @@ static void test_PropVariantToGUID(void)
hres = VariantToGUID(&var, &guid); hres = VariantToGUID(&var, &guid);
ok(hres == S_OK, "VariantToGUID failed %x\n", hres); ok(hres == S_OK, "VariantToGUID failed %x\n", hres);
ok(!memcmp(&IID_NULL, &guid, sizeof(GUID)), "incorrect GUID created: %s\n", wine_dbgstr_guid(&guid)); ok(IsEqualGUID(&IID_NULL, &guid), "incorrect GUID created: %s\n", wine_dbgstr_guid(&guid));
VariantClear(&var); VariantClear(&var);
hres = InitVariantFromGUIDAsString(&dummy_guid, &var); hres = InitVariantFromGUIDAsString(&dummy_guid, &var);
@ -605,7 +605,7 @@ static void test_PropVariantToGUID(void)
hres = VariantToGUID(&var, &guid); hres = VariantToGUID(&var, &guid);
ok(hres == S_OK, "VariantToGUID failed %x\n", hres); ok(hres == S_OK, "VariantToGUID failed %x\n", hres);
ok(!memcmp(&dummy_guid, &guid, sizeof(GUID)), "incorrect GUID created: %s\n", wine_dbgstr_guid(&guid)); ok(IsEqualGUID(&dummy_guid, &guid), "incorrect GUID created: %s\n", wine_dbgstr_guid(&guid));
ok(V_VT(&var) == VT_BSTR, "incorrect VARIANT type: %d\n", V_VT(&var)); ok(V_VT(&var) == VT_BSTR, "incorrect VARIANT type: %d\n", V_VT(&var));
V_BSTR(&var)[1] = 'z'; V_BSTR(&var)[1] = 'z';
@ -618,7 +618,14 @@ static void test_PropVariantToGUID(void)
V_VT(&var) = VT_EMPTY; V_VT(&var) = VT_EMPTY;
hres = PropVariantToGUID(&propvar, &guid); hres = PropVariantToGUID(&propvar, &guid);
ok(hres == S_OK, "PropVariantToGUID failed %x\n", hres); ok(hres == S_OK, "PropVariantToGUID failed %x\n", hres);
ok(!memcmp(&dummy_guid, &guid, sizeof(GUID)), "incorrect GUID created: %s\n", wine_dbgstr_guid(&guid)); ok(IsEqualGUID(&dummy_guid, &guid), "incorrect GUID created: %s\n", wine_dbgstr_guid(&guid));
PropVariantClear(&propvar);
memset(&guid, 0, sizeof(guid));
InitPropVariantFromCLSID(&dummy_guid, &propvar);
hres = PropVariantToGUID(&propvar, &guid);
ok(hres == S_OK, "PropVariantToGUID failed %x\n", hres);
ok(IsEqualGUID(&dummy_guid, &guid), "incorrect GUID created: %s\n", wine_dbgstr_guid(&guid));
PropVariantClear(&propvar); PropVariantClear(&propvar);
} }