diff --git a/dlls/urlmon/binding.c b/dlls/urlmon/binding.c index 14f11a7b0f8..9f126feb89b 100644 --- a/dlls/urlmon/binding.c +++ b/dlls/urlmon/binding.c @@ -200,7 +200,7 @@ static void mime_available(Binding *This, LPCWSTR mime) static void stop_binding(Binding *binding, HRESULT hres, LPCWSTR str) { if(binding->state & BINDING_LOCKED) { - IInternetProtocolEx_UnlockRequest(PROTOCOLEX(binding->protocol)); + IInternetProtocolEx_UnlockRequest(&binding->protocol->IInternetProtocolEx_iface); binding->state &= ~BINDING_LOCKED; } @@ -342,7 +342,7 @@ static void create_object(Binding *binding) stop_binding(binding, hres, NULL); if(FAILED(hres)) - IInternetProtocolEx_Terminate(PROTOCOLEX(binding->protocol), 0); + IInternetProtocolEx_Terminate(&binding->protocol->IInternetProtocolEx_iface, 0); } static void cache_file_available(Binding *This, const WCHAR *file_name) @@ -862,7 +862,7 @@ static ULONG WINAPI Binding_Release(IBinding *iface) if(This->callback) IBindStatusCallback_Release(This->callback); if(This->protocol) - IInternetProtocolEx_Release(PROTOCOLEX(This->protocol)); + IInternetProtocolEx_Release(&This->protocol->IInternetProtocolEx_iface); if(This->service_provider) IServiceProvider_Release(This->service_provider); if(This->stgmed_buf) @@ -898,7 +898,8 @@ static HRESULT WINAPI Binding_Abort(IBinding *iface) if(This->state & BINDING_ABORTED) return E_FAIL; - hres = IInternetProtocolEx_Abort(PROTOCOLEX(This->protocol), E_ABORT, ERROR_SUCCESS); + hres = IInternetProtocolEx_Abort(&This->protocol->IInternetProtocolEx_iface, E_ABORT, + ERROR_SUCCESS); if(FAILED(hres)) return hres; @@ -1115,7 +1116,8 @@ static void report_data(Binding *This, DWORD bscf, ULONG progress, ULONG progres HRESULT hres; if(!(This->state & BINDING_LOCKED)) { - HRESULT hres = IInternetProtocolEx_LockRequest(PROTOCOLEX(This->protocol), 0); + HRESULT hres = IInternetProtocolEx_LockRequest( + &This->protocol->IInternetProtocolEx_iface, 0); if(SUCCEEDED(hres)) This->state |= BINDING_LOCKED; } @@ -1156,7 +1158,7 @@ static HRESULT WINAPI InternetProtocolSink_ReportResult(IInternetProtocolSink *i TRACE("(%p)->(%08x %d %s)\n", This, hrResult, dwError, debugstr_w(szResult)); stop_binding(This, hrResult, szResult); - IInternetProtocolEx_Terminate(PROTOCOLEX(This->protocol), 0); + IInternetProtocolEx_Terminate(&This->protocol->IInternetProtocolEx_iface, 0); return S_OK; } @@ -1459,7 +1461,7 @@ static HRESULT Binding_Create(IMoniker *mon, Binding *binding_ctx, IUri *uri, IB if(binding_ctx) { ret->protocol = binding_ctx->protocol; - IInternetProtocolEx_AddRef(PROTOCOLEX(ret->protocol)); + IInternetProtocolEx_AddRef(&ret->protocol->IInternetProtocolEx_iface); }else { hres = create_binding_protocol(TRUE, &ret->protocol); if(FAILED(hres)) { @@ -1501,7 +1503,7 @@ static HRESULT Binding_Create(IMoniker *mon, Binding *binding_ctx, IUri *uri, IB IUnknown_AddRef(&ret->stgmed_buf->IUnknown_iface); ret->clipboard_format = binding_ctx->clipboard_format; }else { - ret->stgmed_buf = create_stgmed_buf(PROTOCOLEX(ret->protocol)); + ret->stgmed_buf = create_stgmed_buf(&ret->protocol->IInternetProtocolEx_iface); } if(to_obj) { @@ -1547,8 +1549,8 @@ static HRESULT start_binding(IMoniker *mon, Binding *binding_ctx, IUri *uri, IBi report_data(binding, BSCF_FIRSTDATANOTIFICATION | (binding_ctx->download_state == END_DOWNLOAD ? BSCF_LASTDATANOTIFICATION : 0), 0, 0); }else { - hres = IInternetProtocolEx_StartEx(PROTOCOLEX(binding->protocol), uri, PROTSINK(binding), - BINDINF(binding), PI_APARTMENTTHREADED|PI_MIMEVERIFICATION, 0); + hres = IInternetProtocolEx_StartEx(&binding->protocol->IInternetProtocolEx_iface, uri, + PROTSINK(binding), BINDINF(binding), PI_APARTMENTTHREADED|PI_MIMEVERIFICATION, 0); TRACE("start ret %08x\n", hres); @@ -1590,7 +1592,7 @@ HRESULT bind_to_storage(IUri *uri, IBindCtx *pbc, REFIID riid, void **ppv) if(binding->hres == S_OK && binding->stgmed_buf->init) { if((binding->state & BINDING_STOPPED) && (binding->state & BINDING_LOCKED)) - IInternetProtocolEx_UnlockRequest(PROTOCOLEX(binding->protocol)); + IInternetProtocolEx_UnlockRequest(&binding->protocol->IInternetProtocolEx_iface); hres = binding->stgmed_obj->vtbl->get_result(binding->stgmed_obj, binding->bindf, ppv); }else if(binding->bindf & BINDF_ASYNCHRONOUS) { diff --git a/dlls/urlmon/bindprot.c b/dlls/urlmon/bindprot.c index 952077d889b..d982b43b38d 100644 --- a/dlls/urlmon/bindprot.c +++ b/dlls/urlmon/bindprot.c @@ -68,7 +68,7 @@ static LRESULT WINAPI notif_wnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM This->continue_call--; } - IInternetProtocolEx_Release(PROTOCOLEX(This)); + IInternetProtocolEx_Release(&This->IInternetProtocolEx_iface); return 0; } case WM_MK_RELEASE: { @@ -167,7 +167,7 @@ static void push_task(BindProtocol *This, task_header_t *task, task_proc_t proc) LeaveCriticalSection(&This->section); if(do_post) { - IInternetProtocolEx_AddRef(PROTOCOLEX(This)); + IInternetProtocolEx_AddRef(&This->IInternetProtocolEx_iface); PostMessageW(This->notif_hwnd, WM_MK_CONTINUE, 0, (LPARAM)This); } } @@ -244,25 +244,28 @@ static void mime_available(BindProtocol *This, LPCWSTR mime, BOOL verified) } } -#define PROTOCOL_THIS(iface) DEFINE_THIS(BindProtocol, IInternetProtocolEx, iface) +static inline BindProtocol *impl_from_IInternetProtocolEx(IInternetProtocolEx *iface) +{ + return CONTAINING_RECORD(iface, BindProtocol, IInternetProtocolEx_iface); +} static HRESULT WINAPI BindProtocol_QueryInterface(IInternetProtocolEx *iface, REFIID riid, void **ppv) { - BindProtocol *This = PROTOCOL_THIS(iface); + BindProtocol *This = impl_from_IInternetProtocolEx(iface); *ppv = NULL; if(IsEqualGUID(&IID_IUnknown, riid)) { TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv); - *ppv = PROTOCOLEX(This); + *ppv = &This->IInternetProtocolEx_iface; }else if(IsEqualGUID(&IID_IInternetProtocolRoot, riid)) { TRACE("(%p)->(IID_IInternetProtocolRoot %p)\n", This, ppv); - *ppv = PROTOCOLEX(This); + *ppv = &This->IInternetProtocolEx_iface; }else if(IsEqualGUID(&IID_IInternetProtocol, riid)) { TRACE("(%p)->(IID_IInternetProtocol %p)\n", This, ppv); - *ppv = PROTOCOLEX(This); + *ppv = &This->IInternetProtocolEx_iface; }else if(IsEqualGUID(&IID_IInternetProtocolEx, riid)) { TRACE("(%p)->(IID_IInternetProtocolEx %p)\n", This, ppv); - *ppv = PROTOCOLEX(This); + *ppv = &This->IInternetProtocolEx_iface; }else if(IsEqualGUID(&IID_IInternetBindInfo, riid)) { TRACE("(%p)->(IID_IInternetBindInfo %p)\n", This, ppv); *ppv = BINDINFO(This); @@ -316,7 +319,7 @@ static HRESULT WINAPI BindProtocol_QueryInterface(IInternetProtocolEx *iface, RE static ULONG WINAPI BindProtocol_AddRef(IInternetProtocolEx *iface) { - BindProtocol *This = PROTOCOL_THIS(iface); + BindProtocol *This = impl_from_IInternetProtocolEx(iface); LONG ref = InterlockedIncrement(&This->ref); TRACE("(%p) ref=%d\n", This, ref); return ref; @@ -324,7 +327,7 @@ static ULONG WINAPI BindProtocol_AddRef(IInternetProtocolEx *iface) static ULONG WINAPI BindProtocol_Release(IInternetProtocolEx *iface) { - BindProtocol *This = PROTOCOL_THIS(iface); + BindProtocol *This = impl_from_IInternetProtocolEx(iface); LONG ref = InterlockedDecrement(&This->ref); TRACE("(%p) ref=%d\n", This, ref); @@ -362,7 +365,7 @@ static HRESULT WINAPI BindProtocol_Start(IInternetProtocolEx *iface, LPCWSTR szU IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE_PTR dwReserved) { - BindProtocol *This = PROTOCOL_THIS(iface); + BindProtocol *This = impl_from_IInternetProtocolEx(iface); IUri *uri; HRESULT hres; @@ -373,8 +376,8 @@ static HRESULT WINAPI BindProtocol_Start(IInternetProtocolEx *iface, LPCWSTR szU if(FAILED(hres)) return hres; - hres = IInternetProtocolEx_StartEx(PROTOCOLEX(This), uri, pOIProtSink, pOIBindInfo, - grfPI, (HANDLE*)dwReserved); + hres = IInternetProtocolEx_StartEx(&This->IInternetProtocolEx_iface, uri, pOIProtSink, + pOIBindInfo, grfPI, (HANDLE*)dwReserved); IUri_Release(uri); return hres; @@ -382,7 +385,7 @@ static HRESULT WINAPI BindProtocol_Start(IInternetProtocolEx *iface, LPCWSTR szU static HRESULT WINAPI BindProtocol_Continue(IInternetProtocolEx *iface, PROTOCOLDATA *pProtocolData) { - BindProtocol *This = PROTOCOL_THIS(iface); + BindProtocol *This = impl_from_IInternetProtocolEx(iface); TRACE("(%p)->(%p)\n", This, pProtocolData); @@ -392,7 +395,7 @@ static HRESULT WINAPI BindProtocol_Continue(IInternetProtocolEx *iface, PROTOCOL static HRESULT WINAPI BindProtocol_Abort(IInternetProtocolEx *iface, HRESULT hrReason, DWORD dwOptions) { - BindProtocol *This = PROTOCOL_THIS(iface); + BindProtocol *This = impl_from_IInternetProtocolEx(iface); TRACE("(%p)->(%08x %08x)\n", This, hrReason, dwOptions); @@ -401,7 +404,7 @@ static HRESULT WINAPI BindProtocol_Abort(IInternetProtocolEx *iface, HRESULT hrR static HRESULT WINAPI BindProtocol_Terminate(IInternetProtocolEx *iface, DWORD dwOptions) { - BindProtocol *This = PROTOCOL_THIS(iface); + BindProtocol *This = impl_from_IInternetProtocolEx(iface); TRACE("(%p)->(%08x)\n", This, dwOptions); @@ -410,14 +413,14 @@ static HRESULT WINAPI BindProtocol_Terminate(IInternetProtocolEx *iface, DWORD d static HRESULT WINAPI BindProtocol_Suspend(IInternetProtocolEx *iface) { - BindProtocol *This = PROTOCOL_THIS(iface); + BindProtocol *This = impl_from_IInternetProtocolEx(iface); FIXME("(%p)\n", This); return E_NOTIMPL; } static HRESULT WINAPI BindProtocol_Resume(IInternetProtocolEx *iface) { - BindProtocol *This = PROTOCOL_THIS(iface); + BindProtocol *This = impl_from_IInternetProtocolEx(iface); FIXME("(%p)\n", This); return E_NOTIMPL; } @@ -425,7 +428,7 @@ static HRESULT WINAPI BindProtocol_Resume(IInternetProtocolEx *iface) static HRESULT WINAPI BindProtocol_Read(IInternetProtocolEx *iface, void *pv, ULONG cb, ULONG *pcbRead) { - BindProtocol *This = PROTOCOL_THIS(iface); + BindProtocol *This = impl_from_IInternetProtocolEx(iface); TRACE("(%p)->(%p %u %p)\n", This, pv, cb, pcbRead); @@ -437,14 +440,14 @@ static HRESULT WINAPI BindProtocol_Read(IInternetProtocolEx *iface, void *pv, static HRESULT WINAPI BindProtocol_Seek(IInternetProtocolEx *iface, LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition) { - BindProtocol *This = PROTOCOL_THIS(iface); + BindProtocol *This = impl_from_IInternetProtocolEx(iface); FIXME("(%p)->(%d %d %p)\n", This, dlibMove.u.LowPart, dwOrigin, plibNewPosition); return E_NOTIMPL; } static HRESULT WINAPI BindProtocol_LockRequest(IInternetProtocolEx *iface, DWORD dwOptions) { - BindProtocol *This = PROTOCOL_THIS(iface); + BindProtocol *This = impl_from_IInternetProtocolEx(iface); TRACE("(%p)->(%08x)\n", This, dwOptions); @@ -453,7 +456,7 @@ static HRESULT WINAPI BindProtocol_LockRequest(IInternetProtocolEx *iface, DWORD static HRESULT WINAPI BindProtocol_UnlockRequest(IInternetProtocolEx *iface) { - BindProtocol *This = PROTOCOL_THIS(iface); + BindProtocol *This = impl_from_IInternetProtocolEx(iface); TRACE("(%p)\n", This); @@ -464,7 +467,7 @@ static HRESULT WINAPI BindProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUr IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE *dwReserved) { - BindProtocol *This = PROTOCOL_THIS(iface); + BindProtocol *This = impl_from_IInternetProtocolEx(iface); IInternetProtocol *protocol = NULL; IInternetProtocolEx *protocolex; IInternetPriority *priority; @@ -579,8 +582,6 @@ void set_binding_sink(BindProtocol *This, IInternetProtocolSink *sink, IInternet IInternetBindInfo_Release(bind_info); } -#undef PROTOCOL_THIS - static const IInternetProtocolExVtbl BindProtocolVtbl = { BindProtocol_QueryInterface, BindProtocol_AddRef, @@ -612,13 +613,13 @@ static HRESULT WINAPI ProtocolHandler_QueryInterface(IInternetProtocol *iface, R static ULONG WINAPI ProtocolHandler_AddRef(IInternetProtocol *iface) { BindProtocol *This = impl_from_IInternetProtocol(iface); - return IInternetProtocolEx_AddRef(PROTOCOLEX(This)); + return IInternetProtocolEx_AddRef(&This->IInternetProtocolEx_iface); } static ULONG WINAPI ProtocolHandler_Release(IInternetProtocol *iface) { BindProtocol *This = impl_from_IInternetProtocol(iface); - return IInternetProtocolEx_Release(PROTOCOLEX(This)); + return IInternetProtocolEx_Release(&This->IInternetProtocolEx_iface); } static HRESULT WINAPI ProtocolHandler_Start(IInternetProtocol *iface, LPCWSTR szUrl, @@ -777,19 +778,19 @@ static HRESULT WINAPI BindInfo_QueryInterface(IInternetBindInfo *iface, REFIID riid, void **ppv) { BindProtocol *This = BINDINFO_THIS(iface); - return IInternetProtocolEx_QueryInterface(PROTOCOLEX(This), riid, ppv); + return IInternetProtocolEx_QueryInterface(&This->IInternetProtocolEx_iface, riid, ppv); } static ULONG WINAPI BindInfo_AddRef(IInternetBindInfo *iface) { BindProtocol *This = BINDINFO_THIS(iface); - return IInternetProtocolEx_AddRef(PROTOCOLEX(This)); + return IInternetProtocolEx_AddRef(&This->IInternetProtocolEx_iface); } static ULONG WINAPI BindInfo_Release(IInternetBindInfo *iface) { BindProtocol *This = BINDINFO_THIS(iface); - return IInternetProtocolEx_Release(PROTOCOLEX(This)); + return IInternetProtocolEx_Release(&This->IInternetProtocolEx_iface); } static HRESULT WINAPI BindInfo_GetBindInfo(IInternetBindInfo *iface, @@ -836,19 +837,19 @@ static HRESULT WINAPI InternetPriority_QueryInterface(IInternetPriority *iface, REFIID riid, void **ppv) { BindProtocol *This = PRIORITY_THIS(iface); - return IInternetProtocolEx_QueryInterface(PROTOCOLEX(This), riid, ppv); + return IInternetProtocolEx_QueryInterface(&This->IInternetProtocolEx_iface, riid, ppv); } static ULONG WINAPI InternetPriority_AddRef(IInternetPriority *iface) { BindProtocol *This = PRIORITY_THIS(iface); - return IInternetProtocolEx_AddRef(PROTOCOLEX(This)); + return IInternetProtocolEx_AddRef(&This->IInternetProtocolEx_iface); } static ULONG WINAPI InternetPriority_Release(IInternetPriority *iface) { BindProtocol *This = PRIORITY_THIS(iface); - return IInternetProtocolEx_Release(PROTOCOLEX(This)); + return IInternetProtocolEx_Release(&This->IInternetProtocolEx_iface); } static HRESULT WINAPI InternetPriority_SetPriority(IInternetPriority *iface, LONG nPriority) @@ -888,19 +889,19 @@ static HRESULT WINAPI BPInternetProtocolSink_QueryInterface(IInternetProtocolSin REFIID riid, void **ppv) { BindProtocol *This = PROTSINK_THIS(iface); - return IInternetProtocolEx_QueryInterface(PROTOCOLEX(This), riid, ppv); + return IInternetProtocolEx_QueryInterface(&This->IInternetProtocolEx_iface, riid, ppv); } static ULONG WINAPI BPInternetProtocolSink_AddRef(IInternetProtocolSink *iface) { BindProtocol *This = PROTSINK_THIS(iface); - return IInternetProtocolEx_AddRef(PROTOCOLEX(This)); + return IInternetProtocolEx_AddRef(&This->IInternetProtocolEx_iface); } static ULONG WINAPI BPInternetProtocolSink_Release(IInternetProtocolSink *iface) { BindProtocol *This = PROTSINK_THIS(iface); - return IInternetProtocolEx_Release(PROTOCOLEX(This)); + return IInternetProtocolEx_Release(&This->IInternetProtocolEx_iface); } typedef struct { @@ -1197,19 +1198,19 @@ static const IInternetProtocolSinkVtbl InternetProtocolSinkVtbl = { static HRESULT WINAPI WinInetHttpInfo_QueryInterface(IWinInetHttpInfo *iface, REFIID riid, void **ppv) { BindProtocol *This = INETINFO_THIS(iface); - return IInternetProtocolEx_QueryInterface(PROTOCOLEX(This), riid, ppv); + return IInternetProtocolEx_QueryInterface(&This->IInternetProtocolEx_iface, riid, ppv); } static ULONG WINAPI WinInetHttpInfo_AddRef(IWinInetHttpInfo *iface) { BindProtocol *This = INETINFO_THIS(iface); - return IInternetProtocolEx_AddRef(PROTOCOLEX(This)); + return IInternetProtocolEx_AddRef(&This->IInternetProtocolEx_iface); } static ULONG WINAPI WinInetHttpInfo_Release(IWinInetHttpInfo *iface) { BindProtocol *This = INETINFO_THIS(iface); - return IInternetProtocolEx_Release(PROTOCOLEX(This)); + return IInternetProtocolEx_Release(&This->IInternetProtocolEx_iface); } static HRESULT WINAPI WinInetHttpInfo_QueryOption(IWinInetHttpInfo *iface, DWORD dwOption, @@ -1244,19 +1245,19 @@ static HRESULT WINAPI BPServiceProvider_QueryInterface(IServiceProvider *iface, REFIID riid, void **ppv) { BindProtocol *This = SERVPROV_THIS(iface); - return IInternetProtocolEx_QueryInterface(PROTOCOLEX(This), riid, ppv); + return IInternetProtocolEx_QueryInterface(&This->IInternetProtocolEx_iface, riid, ppv); } static ULONG WINAPI BPServiceProvider_AddRef(IServiceProvider *iface) { BindProtocol *This = SERVPROV_THIS(iface); - return IInternetProtocolEx_AddRef(PROTOCOLEX(This)); + return IInternetProtocolEx_AddRef(&This->IInternetProtocolEx_iface); } static ULONG WINAPI BPServiceProvider_Release(IServiceProvider *iface) { BindProtocol *This = SERVPROV_THIS(iface); - return IInternetProtocolEx_Release(PROTOCOLEX(This)); + return IInternetProtocolEx_Release(&This->IInternetProtocolEx_iface); } static HRESULT WINAPI BPServiceProvider_QueryService(IServiceProvider *iface, @@ -1285,7 +1286,7 @@ HRESULT create_binding_protocol(BOOL from_urlmon, BindProtocol **protocol) { BindProtocol *ret = heap_alloc_zero(sizeof(BindProtocol)); - ret->lpIInternetProtocolExVtbl = &BindProtocolVtbl; + ret->IInternetProtocolEx_iface.lpVtbl = &BindProtocolVtbl; ret->lpInternetBindInfoVtbl = &InternetBindInfoVtbl; ret->lpInternetPriorityVtbl = &InternetPriorityVtbl; ret->lpServiceProviderVtbl = &ServiceProviderVtbl; diff --git a/dlls/urlmon/session.c b/dlls/urlmon/session.c index c39b6ea5d80..fc36c0bcceb 100644 --- a/dlls/urlmon/session.c +++ b/dlls/urlmon/session.c @@ -437,7 +437,7 @@ static HRESULT WINAPI InternetSession_CreateBinding(IInternetSession *iface, if(FAILED(hres)) return hres; - *ppOInetProt = (IInternetProtocol*)PROTOCOLEX(protocol); + *ppOInetProt = (IInternetProtocol*)&protocol->IInternetProtocolEx_iface; return S_OK; } diff --git a/dlls/urlmon/urlmon_main.h b/dlls/urlmon/urlmon_main.h index 68818e47838..1fafa82f66f 100644 --- a/dlls/urlmon/urlmon_main.h +++ b/dlls/urlmon/urlmon_main.h @@ -169,7 +169,7 @@ HRESULT create_protocol_proxy(IInternetProtocol*,IInternetProtocolSink*,Protocol typedef struct _task_header_t task_header_t; typedef struct { - const IInternetProtocolExVtbl *lpIInternetProtocolExVtbl; + IInternetProtocolEx IInternetProtocolEx_iface; const IInternetBindInfoVtbl *lpInternetBindInfoVtbl; const IInternetPriorityVtbl *lpInternetPriorityVtbl; const IServiceProviderVtbl *lpServiceProviderVtbl; @@ -210,8 +210,6 @@ typedef struct { ProtocolProxy *filter_proxy; } BindProtocol; -#define PROTOCOLEX(x) ((IInternetProtocolEx*) &(x)->lpIInternetProtocolExVtbl) - HRESULT create_binding_protocol(BOOL,BindProtocol**); void set_binding_sink(BindProtocol*,IInternetProtocolSink*,IInternetBindInfo*);