https://bugs.winehq.org/show_bug.cgi?id=53867
Bug ID: 53867 Summary: vbscript fails to retrieve property array by index 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: ---
Given the following vbscript, access to aObj.ModIn(x) and aObj.ModOut(x) fail:
dim RubbersD : Set RubbersD = new Dampener RubbersD.addpoint 0, 0, 1.1 RubbersD.addpoint 1, 3.77, 0.97 RubbersD.addpoint 2, 5.76, 0.967 RubbersD.addpoint 3, 15.84, 0.874 RubbersD.addpoint 4, 56, 0.64
dim SleevesD : Set SleevesD = new Dampener SleevesD.CopyCoef RubbersD, 0.85
Class Dampener Public ModIn, ModOut Private Sub Class_Initialize : redim ModIn(5) : redim Modout(5): End Sub
Public Sub AddPoint(aIdx, aX, aY) ModIn(aIdx) = aX ModOut(aIdx) = aY End Sub
Public Sub CopyCoef(aObj, aCoef) dim x : for x = 0 to uBound(aObj.ModIn) addpoint x, aObj.ModIn(x), aObj.ModOut(x)*aCoef Next End Sub End Class
It seems invoke_variant_prop in vbdisp.c has specific code that looks to see if there is an argument, and if so fails.
I've added a block that only fails if there are arguments and the variant is not an ARRAY. I lifted the code from array_access in interp.c. Unfortunately array_access is not available to vbdisp.c:
static HRESULT invoke_variant_prop(script_ctx_t *ctx, VARIANT *v, WORD flags, DISPPARAMS *dp, VARIANT *res) { HRESULT hres;
switch(flags) { case DISPATCH_PROPERTYGET|DISPATCH_METHOD: case DISPATCH_PROPERTYGET: if(dp->cArgs) { if (V_ISARRAY(v)) { SAFEARRAY *array = V_ARRAY(v);
unsigned i, argc = arg_cnt(dp); LONG *indices;
if(!array) { FIXME("NULL array\n"); return E_FAIL; } . . . else { WARN("called with arguments\n"); return DISP_E_MEMBERNOTFOUND; /* That's what tests show */ }
https://bugs.winehq.org/show_bug.cgi?id=53867
--- Comment #1 from Nikolay Sivov bunglehead@gmail.com --- This looks reasonable, I think, if arguments for such properties can only mean array indices. I suppose V_ISARRAY() check ensures that. Note that it's not a problem to reuse array_access(), no benefit in duplicating it. Execution context is not used in this helper, we can get rid of it there.
https://bugs.winehq.org/show_bug.cgi?id=53867
Nikolay Sivov bunglehead@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Status|UNCONFIRMED |NEW
--- Comment #2 from Nikolay Sivov bunglehead@gmail.com --- Confirming, just sent a fix https://gitlab.winehq.org/wine/wine/-/merge_requests/1409.
https://bugs.winehq.org/show_bug.cgi?id=53867
--- Comment #3 from Jason Millard jsm174@gmail.com --- Fantastic. Implemented your patch and working great! Thanks again!
https://bugs.winehq.org/show_bug.cgi?id=53867
--- Comment #4 from Nikolay Sivov bunglehead@gmail.com --- We'll need symmetrical change at some point to write to such properties, I haven't looked at that.
https://bugs.winehq.org/show_bug.cgi?id=53867
Nikolay Sivov bunglehead@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |eeecf6f034ff72cb3ba3285227b | |eb70bd9b82a37 Status|NEW |RESOLVED Resolution|--- |FIXED
--- Comment #5 from Nikolay Sivov bunglehead@gmail.com --- Marking fixed, eeecf6f034ff72cb3ba3285227beb70bd9b82a37.
https://bugs.winehq.org/show_bug.cgi?id=53867
--- Comment #6 from Jason Millard jsm174@gmail.com --- (In reply to Nikolay Sivov from comment #4)
We'll need symmetrical change at some point to write to such properties, I haven't looked at that.
Okay. Is that at all related to https://bugs.winehq.org/show_bug.cgi?id=53877
https://bugs.winehq.org/show_bug.cgi?id=53867
--- Comment #7 from Nikolay Sivov bunglehead@gmail.com --- No, I was talking about assigning values to properties. Like in your sample script doing aObj.ModIn(x) = value. That will go through PROPERTYPUT.
https://bugs.winehq.org/show_bug.cgi?id=53867
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #8 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 7.22.
https://bugs.winehq.org/show_bug.cgi?id=53867
Michael Stefaniuc mstefani@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |7.0.x
https://bugs.winehq.org/show_bug.cgi?id=53867
Michael Stefaniuc mstefani@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|7.0.x |---
--- Comment #9 from Michael Stefaniuc mstefani@winehq.org --- Drop 7.0.x target milestone from bugs that didn't make it.