vbscript: Fix VT_UNKNOWN handling in is expressions.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
1c194f3b21
commit
47f3abb633
|
@ -1928,75 +1928,57 @@ static HRESULT interp_case(exec_ctx_t *ctx)
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT disp_cmp(IDispatch *disp1, IDispatch *disp2, VARIANT_BOOL *ret)
|
|
||||||
{
|
|
||||||
IObjectIdentity *identity;
|
|
||||||
IUnknown *unk1, *unk2;
|
|
||||||
HRESULT hres;
|
|
||||||
|
|
||||||
if(disp1 == disp2) {
|
|
||||||
*ret = VARIANT_TRUE;
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!disp1 || !disp2) {
|
|
||||||
*ret = VARIANT_FALSE;
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
hres = IDispatch_QueryInterface(disp1, &IID_IUnknown, (void**)&unk1);
|
|
||||||
if(FAILED(hres))
|
|
||||||
return hres;
|
|
||||||
|
|
||||||
hres = IDispatch_QueryInterface(disp2, &IID_IUnknown, (void**)&unk2);
|
|
||||||
if(FAILED(hres)) {
|
|
||||||
IUnknown_Release(unk1);
|
|
||||||
return hres;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(unk1 == unk2) {
|
|
||||||
*ret = VARIANT_TRUE;
|
|
||||||
}else {
|
|
||||||
hres = IUnknown_QueryInterface(unk1, &IID_IObjectIdentity, (void**)&identity);
|
|
||||||
if(SUCCEEDED(hres)) {
|
|
||||||
hres = IObjectIdentity_IsEqualObject(identity, unk2);
|
|
||||||
IObjectIdentity_Release(identity);
|
|
||||||
*ret = hres == S_OK ? VARIANT_TRUE : VARIANT_FALSE;
|
|
||||||
}else {
|
|
||||||
*ret = VARIANT_FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
IUnknown_Release(unk1);
|
|
||||||
IUnknown_Release(unk2);
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static HRESULT interp_is(exec_ctx_t *ctx)
|
static HRESULT interp_is(exec_ctx_t *ctx)
|
||||||
{
|
{
|
||||||
IDispatch *l, *r;
|
IUnknown *l = NULL, *r = NULL;
|
||||||
VARIANT v;
|
variant_val_t v;
|
||||||
HRESULT hres;
|
HRESULT hres = S_OK;
|
||||||
|
|
||||||
TRACE("\n");
|
TRACE("\n");
|
||||||
|
|
||||||
hres = stack_pop_disp(ctx, &r);
|
stack_pop_deref(ctx, &v);
|
||||||
|
if(V_VT(v.v) != VT_DISPATCH && V_VT(v.v) != VT_UNKNOWN) {
|
||||||
|
FIXME("Unhandled type %s\n", debugstr_variant(v.v));
|
||||||
|
hres = E_NOTIMPL;
|
||||||
|
}else if(V_UNKNOWN(v.v)) {
|
||||||
|
hres = IUnknown_QueryInterface(V_UNKNOWN(v.v), &IID_IUnknown, (void**)&r);
|
||||||
|
}
|
||||||
|
if(v.owned) VariantClear(v.v);
|
||||||
if(FAILED(hres))
|
if(FAILED(hres))
|
||||||
return hres;
|
return hres;
|
||||||
|
|
||||||
hres = stack_pop_disp(ctx, &l);
|
stack_pop_deref(ctx, &v);
|
||||||
|
if(V_VT(v.v) != VT_DISPATCH && V_VT(v.v) != VT_UNKNOWN) {
|
||||||
|
FIXME("Unhandled type %s\n", debugstr_variant(v.v));
|
||||||
|
hres = E_NOTIMPL;
|
||||||
|
}else if(V_UNKNOWN(v.v)) {
|
||||||
|
hres = IUnknown_QueryInterface(V_UNKNOWN(v.v), &IID_IUnknown, (void**)&l);
|
||||||
|
}
|
||||||
|
if(v.owned) VariantClear(v.v);
|
||||||
|
|
||||||
if(SUCCEEDED(hres)) {
|
if(SUCCEEDED(hres)) {
|
||||||
V_VT(&v) = VT_BOOL;
|
VARIANT res;
|
||||||
hres = disp_cmp(l, r, &V_BOOL(&v));
|
V_VT(&res) = VT_BOOL;
|
||||||
if(l)
|
if(r == l)
|
||||||
IDispatch_Release(l);
|
V_BOOL(&res) = VARIANT_TRUE;
|
||||||
|
else if(!r || !l)
|
||||||
|
V_BOOL(&res) = VARIANT_FALSE;
|
||||||
|
else {
|
||||||
|
IObjectIdentity *identity;
|
||||||
|
hres = IUnknown_QueryInterface(l, &IID_IObjectIdentity, (void**)&identity);
|
||||||
|
if(SUCCEEDED(hres)) {
|
||||||
|
hres = IObjectIdentity_IsEqualObject(identity, r);
|
||||||
|
IObjectIdentity_Release(identity);
|
||||||
|
}
|
||||||
|
V_BOOL(&res) = hres == S_OK ? VARIANT_TRUE : VARIANT_FALSE;
|
||||||
|
}
|
||||||
|
hres = stack_push(ctx, &res);
|
||||||
}
|
}
|
||||||
if(r)
|
if(r)
|
||||||
IDispatch_Release(r);
|
IUnknown_Release(r);
|
||||||
if(FAILED(hres))
|
if(l)
|
||||||
return hres;
|
IUnknown_Release(l);
|
||||||
|
return hres;
|
||||||
return stack_push(ctx, &v);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT interp_concat(exec_ctx_t *ctx)
|
static HRESULT interp_concat(exec_ctx_t *ctx)
|
||||||
|
|
|
@ -1202,6 +1202,7 @@ set x = obj
|
||||||
call ok(getVT(obj) = "VT_UNKNOWN*", "getVT(obj) = " & getVT(obj))
|
call ok(getVT(obj) = "VT_UNKNOWN*", "getVT(obj) = " & getVT(obj))
|
||||||
call ok(getVT(x) = "VT_UNKNOWN*", "getVT(x) = " & getVT(x))
|
call ok(getVT(x) = "VT_UNKNOWN*", "getVT(x) = " & getVT(x))
|
||||||
call ok(getVT(unkObj) = "VT_UNKNOWN", "getVT(unkObj) = " & getVT(unkObj))
|
call ok(getVT(unkObj) = "VT_UNKNOWN", "getVT(unkObj) = " & getVT(unkObj))
|
||||||
|
call ok(obj is unkObj, "obj is not unkObj")
|
||||||
|
|
||||||
' Array tests
|
' Array tests
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue