From: Francis De Brabandere <francisdb@gmail.com> On Windows, Property Let receives the object (VT_DISPATCH) directly, not its default value. Fix invoke_vbdisp to skip default-value extraction in the Property Let/Set code path, and select the function based on the dispatch flags instead of the value type. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53844 --- dlls/vbscript/tests/lang.vbs | 27 +++++++++++++++++++++++++++ dlls/vbscript/vbdisp.c | 4 ++-- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/dlls/vbscript/tests/lang.vbs b/dlls/vbscript/tests/lang.vbs index c364f12c00b..897ccef135f 100644 --- a/dlls/vbscript/tests/lang.vbs +++ b/dlls/vbscript/tests/lang.vbs @@ -2108,6 +2108,7 @@ Class TestPropParam Public oDict Public gotNothing Public m_obj + Public m_objType Public Property Set bar(obj) Set m_obj = obj @@ -2126,6 +2127,14 @@ Class TestPropParam Public Property Let ten(a,b,c,d,e,f,g,h,i,j) oDict = a & b & c & d & e & f & g & h & i & j End Property + Public Property Let objProp(aInput) + m_objType = getVT(aInput) + If IsObject(aInput) Then + Set m_obj = aInput + Else + m_obj = aInput + End If + End Property End Class Set x = new TestPropParam @@ -2141,6 +2150,24 @@ Set x.foo("123") = Nothing call ok(x.oDict = "123","x.oDict = " & x.oDict & " expected 123") call ok(x.gotNothing=True,"x.gotNothing = " & x.gotNothing & " expected true") +' Property Let receives VT_DISPATCH argument as-is (does not extract default value) +Set y = New EndTestClassWithProperty +y.x = 42 +x.objProp = y +call ok(x.m_objType = "VT_DISPATCH*", "Property Let aInput type: " & x.m_objType & " expected VT_DISPATCH*") +call ok(x.m_obj = 42, "Property Let with object argument failed, m_obj = " & x.m_obj) + +' Property Let receives object without default property as VT_DISPATCH +Set z = New EmptyClass +x.objProp = z +call ok(x.m_objType = "VT_DISPATCH*", "Property Let no-default aInput type: " & x.m_objType & " expected VT_DISPATCH*") + +' Set with only Property Let defined should fail (no fallback to Let) +On Error Resume Next +Set x.objProp = y +call ok(Err.Number = 438, "Set Property Let only: Err.Number = " & Err.Number & " expected 438") +On Error GoTo 0 + set x = new TestPropSyntax set x.prop = new TestPropSyntax set x.prop.prop = new TestPropSyntax diff --git a/dlls/vbscript/vbdisp.c b/dlls/vbscript/vbdisp.c index 0ede0cfd6ba..d9f0fbb856a 100644 --- a/dlls/vbscript/vbdisp.c +++ b/dlls/vbscript/vbdisp.c @@ -219,14 +219,14 @@ static HRESULT invoke_vbdisp(vbdisp_t *This, DISPID id, DWORD flags, BOOL extern dp.rgvarg = buf; } - hres = get_propput_arg(This->desc->ctx, params, flags, dp.rgvarg, &needs_release); + hres = get_propput_arg(This->desc->ctx, params, flags | DISPATCH_PROPERTYPUTREF, dp.rgvarg, &needs_release); if(FAILED(hres)) { if(dp.rgvarg != buf) free(dp.rgvarg); return hres; } - func = This->desc->funcs[id].entries[V_VT(dp.rgvarg) == VT_DISPATCH ? VBDISP_SET : VBDISP_LET]; + func = This->desc->funcs[id].entries[(flags & DISPATCH_PROPERTYPUTREF) ? VBDISP_SET : VBDISP_LET]; if(!func) { FIXME("no letter/setter\n"); if(dp.rgvarg != buf) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10373