oleaut32: Fix return value when converting from NULL interface pointers.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
d283051b6b
commit
806ea12766
|
@ -5889,6 +5889,16 @@ static void test_IUnknownChangeTypeEx(void)
|
|||
|
||||
lcid = MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT);
|
||||
|
||||
/* NULL IUnknown -> IDispatch */
|
||||
V_VT(&vSrc) = VT_UNKNOWN;
|
||||
V_UNKNOWN(&vSrc) = NULL;
|
||||
VariantInit(&vDst);
|
||||
V_DISPATCH(&vDst) = (void*)0xdeadbeef;
|
||||
hres = VariantChangeTypeEx(&vDst, &vSrc, lcid, 0, VT_DISPATCH);
|
||||
ok(hres == S_OK && V_VT(&vDst) == VT_DISPATCH && V_DISPATCH(&vDst) == NULL,
|
||||
"change unk(src,dst): expected 0x%08x,%d,%p, got 0x%08x,%d,%p\n",
|
||||
S_OK, VT_DISPATCH, NULL, hres, V_VT(&vDst), V_DISPATCH(&vDst));
|
||||
|
||||
V_VT(&vSrc) = VT_UNKNOWN;
|
||||
V_UNKNOWN(&vSrc) = pu;
|
||||
|
||||
|
@ -6033,6 +6043,16 @@ static void test_IDispatchChangeTypeEx(void)
|
|||
|
||||
lcid = MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT);
|
||||
|
||||
/* NULL IDispatch -> IUnknown */
|
||||
V_VT(&vSrc) = VT_DISPATCH;
|
||||
V_DISPATCH(&vSrc) = NULL;
|
||||
VariantInit(&vDst);
|
||||
V_UNKNOWN(&vDst) = (void*)0xdeadbeef;
|
||||
hres = VariantChangeTypeEx(&vDst, &vSrc, lcid, 0, VT_UNKNOWN);
|
||||
ok(hres == S_OK && V_VT(&vDst) == VT_UNKNOWN && V_UNKNOWN(&vDst) == NULL,
|
||||
"change unk(src,dst): expected 0x%08x,%d,%p, got 0x%08x,%d,%p\n",
|
||||
S_OK, VT_UNKNOWN, NULL, hres, V_VT(&vDst), V_UNKNOWN(&vDst));
|
||||
|
||||
V_VT(&vSrc) = VT_DISPATCH;
|
||||
V_DISPATCH(&vSrc) = pd;
|
||||
|
||||
|
|
|
@ -469,7 +469,10 @@ static inline HRESULT VARIANT_Coerce(VARIANTARG* pd, LCID lcid, USHORT wFlags,
|
|||
{
|
||||
case VT_DISPATCH:
|
||||
if (V_DISPATCH(ps) == NULL)
|
||||
{
|
||||
V_UNKNOWN(pd) = NULL;
|
||||
res = S_OK;
|
||||
}
|
||||
else
|
||||
res = IDispatch_QueryInterface(V_DISPATCH(ps), &IID_IUnknown, (LPVOID*)&V_UNKNOWN(pd));
|
||||
break;
|
||||
|
@ -481,7 +484,10 @@ static inline HRESULT VARIANT_Coerce(VARIANTARG* pd, LCID lcid, USHORT wFlags,
|
|||
{
|
||||
case VT_UNKNOWN:
|
||||
if (V_UNKNOWN(ps) == NULL)
|
||||
{
|
||||
V_DISPATCH(pd) = NULL;
|
||||
res = S_OK;
|
||||
}
|
||||
else
|
||||
res = IUnknown_QueryInterface(V_UNKNOWN(ps), &IID_IDispatch, (LPVOID*)&V_DISPATCH(pd));
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue