Jacek Caban (@jacek) commented about dlls/vbscript/global.c:
{ + BSTR conv_str = NULL; vbscode_t *code; + BSTR str; HRESULT hres;
TRACE("%s\n", debugstr_variant(arg));
- if(V_VT(arg) != VT_BSTR) { + if(V_VT(arg) == VT_BSTR) { + str = V_BSTR(arg); + }else if(V_VT(arg) == VT_DISPATCH) { + hres = dispatch_to_string(This->ctx, V_DISPATCH(arg), &conv_str); + if(FAILED(hres)) + return hres; + str = conv_str; I wonder if we should special-case VT_DISPATCH here. Most vbscript code simply uses `to_string`, which should work here for other argument types as well. `VariantCopy` is obviously faster, but as this case shows, it is not correct for corner cases (and probably not a popular code path anyway).
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/10600#note_136765