[PATCH 0/1] MR10373: vbscript: Allow Property Let to accept VT_DISPATCH arguments.
When assigning an object (VT_DISPATCH) to a property, Wine looks for Property Set. If only Property Let is defined, fall back to using it with the object's default value. This allows code that uses Property Let with object arguments (which extracts the default value) to work when Property Set is not defined. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53844 -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10373
From: Francis De Brabandere <francisdb@gmail.com> When assigning an object (VT_DISPATCH) to a property, Wine looks for Property Set. If only Property Let is defined, fall back to using it with the object's default value. This allows code that uses Property Let with object arguments (which extracts the default value) to work when Property Set is not defined. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53844 --- dlls/vbscript/tests/lang.vbs | 9 +++++++++ dlls/vbscript/vbdisp.c | 3 +++ 2 files changed, 12 insertions(+) diff --git a/dlls/vbscript/tests/lang.vbs b/dlls/vbscript/tests/lang.vbs index c364f12c00b..f51621ae8db 100644 --- a/dlls/vbscript/tests/lang.vbs +++ b/dlls/vbscript/tests/lang.vbs @@ -2126,6 +2126,9 @@ 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_obj = aInput + End Property End Class Set x = new TestPropParam @@ -2141,6 +2144,12 @@ 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 should accept object (VT_DISPATCH) arguments (extracts default value) +Set y = New EndTestClassWithProperty +y.x = 42 +x.objProp = y +call ok(x.m_obj = 42, "Property Let with object argument failed, m_obj = " & x.m_obj) + 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..5bd4e7bdabb 100644 --- a/dlls/vbscript/vbdisp.c +++ b/dlls/vbscript/vbdisp.c @@ -226,7 +226,10 @@ static HRESULT invoke_vbdisp(vbdisp_t *This, DISPID id, DWORD flags, BOOL extern return hres; } + func = This->desc->funcs[id].entries[V_VT(dp.rgvarg) == VT_DISPATCH ? VBDISP_SET : VBDISP_LET]; + if(!func) + func = This->desc->funcs[id].entries[VBDISP_LET]; if(!func) { FIXME("no letter/setter\n"); if(dp.rgvarg != buf) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10373
Jacek Caban (@jacek) commented about dlls/vbscript/tests/lang.vbs:
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_obj = aInput
Looks good overall, but please verify that `aInput` is an object here (and not converted prior to the call) with something like `getVT(x) = "VT_DISPATCH*"`. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10373#note_132781
participants (3)
-
Francis De Brabandere -
Francis De Brabandere (@francisdb) -
Jacek Caban (@jacek)