https://bugs.winehq.org/show_bug.cgi?id=53888
Bug ID: 53888 Summary: vbscript does not allow Mid on non VT_BSTR Product: Wine Version: 7.20 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: vbscript Assignee: wine-bugs@winehq.org Reporter: jsm174@gmail.com Distribution: ---
While testing some scripts, I ran across a Mid call on a value that wasn't a string.
The following vbscript should display "3":
Dim string string = 7530 WScript.echo Mid(string, 3, 1)
Global_Mid returns E_NOTIMPL in this case:
if(V_VT(args) != VT_BSTR) { FIXME("args[0] = %s\n", debugstr_variant(args)); return E_NOTIMPL; }
A workaround for this is to match other string functions and use conv_str:
+ BSTR str, conv_str = NULL;
+ if(V_VT(args) != VT_BSTR) { + hres = to_string(args, &conv_str); + if(FAILED(hres)) + return hres; + str = conv_str; + }else { + str = V_BSTR(args); + }
+ SysFreeString(conv_str);