[2/2] winhttp: Add custom implementation of IWinHttpRequest::Invoke(DISPID_HTTPREQUEST_OPTION).

Dmitry Timoshkov dmitry at baikal.ru
Wed Sep 2 04:49:08 CDT 2015


Hi Jacek,

thanks for the review,

Jacek Caban <jacek at codeweavers.com> wrote:

> On 09/02/15 07:44, Dmitry Timoshkov wrote:
> > +    if (member == DISPID_HTTPREQUEST_OPTION)
> 
> Why can't we use standard, ITypeInfo-based implementation here?

The tests (1/2 and existing ones) show that ITypeInfo->Invoke doesn't work
for a lot of cases when native IWinHttpRequest::Invoke succeeds. In fact,
after a lot of attempts I failed to force ITypeInfo->Invoke work at all
under Windows using same code that winhttp request (and many other places
in Wine) uses to load a typelib from winhttp.dll and forward Invoke to
ITypeInfo implementation.

> > +    {
> > +        VARIANT ret_value, option;
> > +        UINT err_pos;
> > +
> > +        if (!result) result = &ret_value;
> > +        if (!arg_err) arg_err = &err_pos;
> > +
> > +        VariantInit( &option );
> > +        VariantInit( result );
> > +
> > +        if (flags == DISPATCH_PROPERTYPUT)
> > +        {
> > +            hr = DispGetParam( params, 0, VT_I4, &option, arg_err );
> > +            if (FAILED(hr)) return hr;
> > +
> > +            hr = IWinHttpRequest_put_Option( &request->IWinHttpRequest_iface, V_I4( &option ), params->rgvarg[0] );
> > +            if (FAILED(hr))
> > +                WARN("put_Option(%d) failed: %x\n", V_I4( &option ), hr);
> > +            return hr;
> > +        }
> > +        else if (flags & (DISPATCH_PROPERTYGET | DISPATCH_METHOD))
> > +        {
> > +            hr = DispGetParam( params, 0, VT_I4, &option, arg_err );
> > +            if (FAILED(hr)) return hr;
> > +
> > +            hr = IWinHttpRequest_get_Option( &request->IWinHttpRequest_iface, V_I4( &option ), result );
> > +            if (FAILED(hr))
> > +                WARN("get_Option(%d) failed: %x\n", V_I4( &option ), hr);
> > +            return hr;
> > +        }
> > +
> > +        return S_OK;
> 
> I don't think silently returning S_OK is right for not handled flags.

Do you have some particular flags in mind? I tried to follow the test results,
although probably the tests don't cover every case.

-- 
Dmitry.



More information about the wine-devel mailing list