forked from Mirrors/wine-wine
propsys: Add support for VT_CLSID in PropVariantCompareEx().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>stable
parent
63e03de9c7
commit
0a508e49d6
|
@ -807,6 +807,9 @@ static BOOL isemptyornull(const PROPVARIANT *propvar)
|
||||||
}
|
}
|
||||||
return i == propvar->u.parray->cDims;
|
return i == propvar->u.parray->cDims;
|
||||||
}
|
}
|
||||||
|
if (propvar->vt == VT_CLSID)
|
||||||
|
return !propvar->u.puuid;
|
||||||
|
|
||||||
/* FIXME: vectors, byrefs, errors? */
|
/* FIXME: vectors, byrefs, errors? */
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -893,8 +896,12 @@ INT WINAPI PropVariantCompareEx(REFPROPVARIANT propvar1, REFPROPVARIANT propvar2
|
||||||
else
|
else
|
||||||
res = lstrcmpA(propvar1->u.pszVal, propvar2_converted->u.pszVal);
|
res = lstrcmpA(propvar1->u.pszVal, propvar2_converted->u.pszVal);
|
||||||
break;
|
break;
|
||||||
|
case VT_CLSID:
|
||||||
|
res = memcmp(propvar1->u.puuid, propvar2->u.puuid, sizeof(*propvar1->u.puuid));
|
||||||
|
if (res) res = res > 0 ? 1 : -1;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
FIXME("vartype %d not handled\n", propvar1->vt);
|
FIXME("vartype %#x not handled\n", propvar1->vt);
|
||||||
res = -1;
|
res = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -660,6 +660,7 @@ static void test_PropVariantToStringAlloc(void)
|
||||||
static void test_PropVariantCompare(void)
|
static void test_PropVariantCompare(void)
|
||||||
{
|
{
|
||||||
PROPVARIANT empty, null, emptyarray, i2_0, i2_2, i4_large, i4_largeneg, i4_2, str_2, str_02, str_b;
|
PROPVARIANT empty, null, emptyarray, i2_0, i2_2, i4_large, i4_largeneg, i4_2, str_2, str_02, str_b;
|
||||||
|
PROPVARIANT clsid_null, clsid, clsid2;
|
||||||
INT res;
|
INT res;
|
||||||
static const WCHAR str_2W[] = {'2', 0};
|
static const WCHAR str_2W[] = {'2', 0};
|
||||||
static const WCHAR str_02W[] = {'0', '2', 0};
|
static const WCHAR str_02W[] = {'0', '2', 0};
|
||||||
|
@ -704,6 +705,12 @@ static void test_PropVariantCompare(void)
|
||||||
str_02.u.bstrVal = SysAllocString(str_02W);
|
str_02.u.bstrVal = SysAllocString(str_02W);
|
||||||
str_b.vt = VT_BSTR;
|
str_b.vt = VT_BSTR;
|
||||||
str_b.u.bstrVal = SysAllocString(str_bW);
|
str_b.u.bstrVal = SysAllocString(str_bW);
|
||||||
|
clsid_null.vt = VT_CLSID;
|
||||||
|
clsid_null.u.puuid = NULL;
|
||||||
|
clsid.vt = VT_CLSID;
|
||||||
|
clsid.u.puuid = (GUID *)&dummy_guid;
|
||||||
|
clsid2.vt = VT_CLSID;
|
||||||
|
clsid2.u.puuid = (GUID *)&GUID_NULL;
|
||||||
|
|
||||||
res = PropVariantCompareEx(&empty, &empty, 0, 0);
|
res = PropVariantCompareEx(&empty, &empty, 0, 0);
|
||||||
ok(res == 0, "res=%i\n", res);
|
ok(res == 0, "res=%i\n", res);
|
||||||
|
@ -772,6 +779,34 @@ static void test_PropVariantCompare(void)
|
||||||
res = PropVariantCompareEx(&i4_large, &str_b, 0, 0);
|
res = PropVariantCompareEx(&i4_large, &str_b, 0, 0);
|
||||||
todo_wine ok(res == -5 /* ??? */, "res=%i\n", res);
|
todo_wine ok(res == -5 /* ??? */, "res=%i\n", res);
|
||||||
|
|
||||||
|
/* VT_CLSID */
|
||||||
|
res = PropVariantCompareEx(&clsid_null, &clsid_null, 0, 0);
|
||||||
|
ok(res == 0, "res=%i\n", res);
|
||||||
|
|
||||||
|
res = PropVariantCompareEx(&clsid_null, &clsid_null, 0, PVCF_TREATEMPTYASGREATERTHAN);
|
||||||
|
ok(res == 0, "res=%i\n", res);
|
||||||
|
|
||||||
|
res = PropVariantCompareEx(&clsid, &clsid, 0, 0);
|
||||||
|
ok(res == 0, "res=%i\n", res);
|
||||||
|
|
||||||
|
res = PropVariantCompareEx(&clsid, &clsid2, 0, 0);
|
||||||
|
ok(res == 1, "res=%i\n", res);
|
||||||
|
|
||||||
|
res = PropVariantCompareEx(&clsid2, &clsid, 0, 0);
|
||||||
|
ok(res == -1, "res=%i\n", res);
|
||||||
|
|
||||||
|
res = PropVariantCompareEx(&clsid_null, &clsid, 0, 0);
|
||||||
|
ok(res == -1, "res=%i\n", res);
|
||||||
|
|
||||||
|
res = PropVariantCompareEx(&clsid, &clsid_null, 0, 0);
|
||||||
|
ok(res == 1, "res=%i\n", res);
|
||||||
|
|
||||||
|
res = PropVariantCompareEx(&clsid_null, &clsid, 0, PVCF_TREATEMPTYASGREATERTHAN);
|
||||||
|
ok(res == 1, "res=%i\n", res);
|
||||||
|
|
||||||
|
res = PropVariantCompareEx(&clsid, &clsid_null, 0, PVCF_TREATEMPTYASGREATERTHAN);
|
||||||
|
ok(res == -1, "res=%i\n", res);
|
||||||
|
|
||||||
SysFreeString(str_2.u.bstrVal);
|
SysFreeString(str_2.u.bstrVal);
|
||||||
SysFreeString(str_02.u.bstrVal);
|
SysFreeString(str_02.u.bstrVal);
|
||||||
SysFreeString(str_b.u.bstrVal);
|
SysFreeString(str_b.u.bstrVal);
|
||||||
|
|
Loading…
Reference in New Issue