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 */ }