How to look up vtable index of a method on the IWinHttpRequest interface?

StackOverflow https://stackoverflow.com/questions/20294838

  •  06-08-2022
  •  | 
  •  

문제

I assume it's in winhttp.dll somewhere, but I can't find any reference to it by dumping the DLL using bindump. Anyone have any suggestions on how I can find the vtable index of a method?

도움이 되었습니까?

해결책

The information is in the IDL file, httprequest.idl.

interface IWinHttpRequest : IDispatch
{
    [id(DISPID_HTTPREQUEST_SETPROXY), helpstring("Specify proxy configuration")]
    HRESULT SetProxy([in] HTTPREQUEST_PROXY_SETTING ProxySetting,
                     [in, optional] VARIANT ProxyServer,
                     [in, optional] VARIANT BypassList);

    [id(DISPID_HTTPREQUEST_SETCREDENTIALS), helpstring("Specify authentication credentials")]
    HRESULT SetCredentials([in] BSTR UserName,
                     [in] BSTR Password,
         [in] HTTPREQUEST_SETCREDENTIALS_FLAGS Flags);

    ....

From this you can read off the method indices. It's a bit tricky because you first have to count the method indices of the base interface IDispatch.

// IUnknown
0: QueryInterface
1: AddRef
2: Release
// IDispatch
3: GetTypeInfoCount
4: GetTypeInfo
5: GetIDsOfNames
6: Invoke
// IWinHttpRequest
7: SetProxy
8: SetCredentials
... etc. ...

You can remove the tedium by using theoffsetof macro.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top