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);
https://bugs.winehq.org/show_bug.cgi?id=53888
Nikolay Sivov bunglehead@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever confirmed|0 |1
--- Comment #1 from Nikolay Sivov bunglehead@gmail.com --- Thanks, confirming. I sent some fixes https://gitlab.winehq.org/wine/wine/-/merge_requests/1288.
As a note to myself, or anyone to clean this up further - we could either add another helper that returns original string or allocated one after conversion, or convert unconditionally all the time. We have instances of both now.
https://bugs.winehq.org/show_bug.cgi?id=53888
Nikolay Sivov bunglehead@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|NEW |RESOLVED Fixed by SHA1| |d2c2c0c4a31b29cce1be9b3162d | |18bfac756aa33
--- Comment #2 from Nikolay Sivov bunglehead@gmail.com --- This should work now, d2c2c0c4a31b29cce1be9b3162d18bfac756aa33.
https://bugs.winehq.org/show_bug.cgi?id=53888
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #3 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 7.21.
https://bugs.winehq.org/show_bug.cgi?id=53888
Michael Stefaniuc mstefani@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |7.0.x
https://bugs.winehq.org/show_bug.cgi?id=53888
Michael Stefaniuc mstefani@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|7.0.x |---
--- Comment #4 from Michael Stefaniuc mstefani@winehq.org --- Drop 7.0.x target milestone from bugs that didn't make it.