[PATCH 04/14] mshtml: Handle VT_DISPATCH in variant_to_nsstr.

Gabriel Ivăncescu gabrielopcode at gmail.com
Tue Nov 16 09:51:21 CST 2021


On 16/11/2021 17:03, Jacek Caban wrote:
> On 11/16/21 3:29 PM, Gabriel Ivăncescu wrote:
>> +        /* try toString() first */
>> +        memcpy(buf, L"toString", sizeof(L"toString"));
>> +        name = buf;
>> +        hres = IDispatch_GetIDsOfNames(disp, &IID_NULL, &name, 1, 0, 
>> &dispid);
>> +        if(SUCCEEDED(hres) && dispid != DISPID_UNKNOWN) {
>> +            DISPPARAMS params = { &strv, NULL, 0, 0 };
>> +            hres = IDispatch_Invoke(disp, dispid, &IID_NULL, lcid, 
>> DISPATCH_METHOD, &params, &strv, NULL, NULL);
>> +            if(SUCCEEDED(hres)) {
>> +                if(V_VT(&strv) == VT_BSTR) {
>> +                    nsAString_Init(nsstr, V_BSTR(&strv));
>> +                    SysFreeString(V_BSTR(&strv));
>> +                    break;
>> +                }
>> +                VariantClear(&strv);
>> +            }
>> +        }
> 
> 
> Why do we need it in addition to DISPID_VALUE?
> 
> 
> Thanks,
> 
> Jacek
> 

Well, for jscript objects, I wasn't sure if they were guaranteed to call 
the toString method on the value. Maybe I should actually test it and 
see what happens on an object with custom toString.



More information about the wine-devel mailing list