diff --git a/dlls/shdocvw/navigate.c b/dlls/shdocvw/navigate.c index 6d73fd98b29..f527c3ec0d5 100644 --- a/dlls/shdocvw/navigate.c +++ b/dlls/shdocvw/navigate.c @@ -881,30 +881,30 @@ HRESULT go_home(DocHost *This) return navigate_url(This, wszPageName, NULL, NULL, NULL, NULL); } -#define HLINKFRAME_THIS(iface) DEFINE_THIS(WebBrowser, HlinkFrame, iface) +#define HLINKFRAME_THIS(iface) DEFINE_THIS(HlinkFrame, IHlinkFrame, iface) static HRESULT WINAPI HlinkFrame_QueryInterface(IHlinkFrame *iface, REFIID riid, void **ppv) { - WebBrowser *This = HLINKFRAME_THIS(iface); - return IWebBrowser2_QueryInterface(WEBBROWSER2(This), riid, ppv); + HlinkFrame *This = HLINKFRAME_THIS(iface); + return IUnknown_QueryInterface(This->outer, riid, ppv); } static ULONG WINAPI HlinkFrame_AddRef(IHlinkFrame *iface) { - WebBrowser *This = HLINKFRAME_THIS(iface); - return IWebBrowser2_AddRef(WEBBROWSER2(This)); + HlinkFrame *This = HLINKFRAME_THIS(iface); + return IUnknown_AddRef(This->outer); } static ULONG WINAPI HlinkFrame_Release(IHlinkFrame *iface) { - WebBrowser *This = HLINKFRAME_THIS(iface); - return IWebBrowser2_Release(WEBBROWSER2(This)); + HlinkFrame *This = HLINKFRAME_THIS(iface); + return IUnknown_Release(This->outer); } static HRESULT WINAPI HlinkFrame_SetBrowseContext(IHlinkFrame *iface, IHlinkBrowseContext *pihlbc) { - WebBrowser *This = HLINKFRAME_THIS(iface); + HlinkFrame *This = HLINKFRAME_THIS(iface); FIXME("(%p)->(%p)\n", This, pihlbc); return E_NOTIMPL; } @@ -912,7 +912,7 @@ static HRESULT WINAPI HlinkFrame_SetBrowseContext(IHlinkFrame *iface, static HRESULT WINAPI HlinkFrame_GetBrowseContext(IHlinkFrame *iface, IHlinkBrowseContext **ppihlbc) { - WebBrowser *This = HLINKFRAME_THIS(iface); + HlinkFrame *This = HLINKFRAME_THIS(iface); FIXME("(%p)->(%p)\n", This, ppihlbc); return E_NOTIMPL; } @@ -920,7 +920,7 @@ static HRESULT WINAPI HlinkFrame_GetBrowseContext(IHlinkFrame *iface, static HRESULT WINAPI HlinkFrame_Navigate(IHlinkFrame *iface, DWORD grfHLNF, LPBC pbc, IBindStatusCallback *pibsc, IHlink *pihlNavigate) { - WebBrowser *This = HLINKFRAME_THIS(iface); + HlinkFrame *This = HLINKFRAME_THIS(iface); IMoniker *mon; LPWSTR location = NULL; @@ -945,13 +945,13 @@ static HRESULT WINAPI HlinkFrame_Navigate(IHlinkFrame *iface, DWORD grfHLNF, LPB return E_NOTIMPL; } - return navigate_hlink(&This->doc_host, mon, pbc, pibsc); + return navigate_hlink(This->doc_host, mon, pbc, pibsc); } static HRESULT WINAPI HlinkFrame_OnNavigate(IHlinkFrame *iface, DWORD grfHLNF, IMoniker *pimkTarget, LPCWSTR pwzLocation, LPCWSTR pwzFriendlyName, DWORD dwreserved) { - WebBrowser *This = HLINKFRAME_THIS(iface); + HlinkFrame *This = HLINKFRAME_THIS(iface); FIXME("(%p)->(%08x %p %s %s %d)\n", This, grfHLNF, pimkTarget, debugstr_w(pwzLocation), debugstr_w(pwzFriendlyName), dwreserved); return E_NOTIMPL; @@ -960,7 +960,7 @@ static HRESULT WINAPI HlinkFrame_OnNavigate(IHlinkFrame *iface, DWORD grfHLNF, static HRESULT WINAPI HlinkFrame_UpdateHlink(IHlinkFrame *iface, ULONG uHLID, IMoniker *pimkTarget, LPCWSTR pwzLocation, LPCWSTR pwzFriendlyName) { - WebBrowser *This = HLINKFRAME_THIS(iface); + HlinkFrame *This = HLINKFRAME_THIS(iface); FIXME("(%p)->(%u %p %s %s)\n", This, uHLID, pimkTarget, debugstr_w(pwzLocation), debugstr_w(pwzFriendlyName)); return E_NOTIMPL; @@ -1103,8 +1103,28 @@ static const ITargetFrame2Vtbl TargetFrame2Vtbl = { TargetFrame2_GetTargetAlias }; +BOOL HlinkFrame_QI(HlinkFrame *This, REFIID riid, void **ppv) +{ + if(IsEqualGUID(&IID_IHlinkFrame, riid)) { + TRACE("(%p)->(IID_IHlinkFrame %p)\n", This, ppv); + *ppv = HLINKFRAME(This); + }else { + return FALSE; + } + + IUnknown_AddRef((IUnknown*)*ppv); + return TRUE; +} + +void HlinkFrame_Init(HlinkFrame *This, IUnknown *outer, DocHost *doc_host) +{ + This->lpIHlinkFrameVtbl = &HlinkFrameVtbl; + + This->outer = outer; + This->doc_host = doc_host; +} + void WebBrowser_HlinkFrame_Init(WebBrowser *This) { - This->lpHlinkFrameVtbl = &HlinkFrameVtbl; This->lpITargetFrame2Vtbl = &TargetFrame2Vtbl; } diff --git a/dlls/shdocvw/shdocvw.h b/dlls/shdocvw/shdocvw.h index d1787cb85c4..790eb73de6a 100644 --- a/dlls/shdocvw/shdocvw.h +++ b/dlls/shdocvw/shdocvw.h @@ -66,6 +66,13 @@ typedef struct { IUnknown *impl; } ConnectionPointContainer; +typedef struct { + const IHlinkFrameVtbl *lpIHlinkFrameVtbl; + + IUnknown *outer; + DocHost *doc_host; +} HlinkFrame; + struct _task_header_t; typedef void (*task_proc_t)(DocHost*, struct _task_header_t*); @@ -128,10 +135,10 @@ struct WebBrowser { const IViewObject2Vtbl *lpViewObjectVtbl; const IOleInPlaceActiveObjectVtbl *lpOleInPlaceActiveObjectVtbl; const IOleCommandTargetVtbl *lpOleCommandTargetVtbl; - const IHlinkFrameVtbl *lpHlinkFrameVtbl; const ITargetFrame2Vtbl *lpITargetFrame2Vtbl; const IServiceProviderVtbl *lpServiceProviderVtbl; const IDataObjectVtbl *lpDataObjectVtbl; + HlinkFrame hlink_frame; LONG ref; @@ -188,7 +195,6 @@ struct InternetExplorer { #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObjectVtbl); #define ACTIVEOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl) #define OLECMD(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl) -#define HLINKFRAME(x) ((IHlinkFrame*) &(x)->lpHlinkFrameVtbl) #define DATAOBJECT(x) ((IDataObject*) &(x)->lpDataObjectVtbl) #define TARGETFRAME2(x) ((ITargetFrame2*) &(x)->lpITargetFrame2Vtbl) @@ -203,6 +209,8 @@ struct InternetExplorer { #define INPLACEFRAME(x) ((IOleInPlaceFrame*) &(x)->lpOleInPlaceFrameVtbl) +#define HLINKFRAME(x) ((IHlinkFrame*) &(x)->lpIHlinkFrameVtbl) + void WebBrowser_OleObject_Init(WebBrowser*); void WebBrowser_ViewObject_Init(WebBrowser*); void WebBrowser_DataObject_Init(WebBrowser*); @@ -223,6 +231,9 @@ void DocHost_ClientSite_Release(DocHost*); void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*); void ConnectionPointContainer_Destroy(ConnectionPointContainer*); +void HlinkFrame_Init(HlinkFrame*,IUnknown*,DocHost*); +BOOL HlinkFrame_QI(HlinkFrame*,REFIID,void**); + HRESULT WebBrowserV1_Create(IUnknown*,REFIID,void**); HRESULT WebBrowserV2_Create(IUnknown*,REFIID,void**); diff --git a/dlls/shdocvw/webbrowser.c b/dlls/shdocvw/webbrowser.c index 47996863785..de12aa5c801 100644 --- a/dlls/shdocvw/webbrowser.c +++ b/dlls/shdocvw/webbrowser.c @@ -100,9 +100,6 @@ static HRESULT WINAPI WebBrowser_QueryInterface(IWebBrowser2 *iface, REFIID riid }else if(IsEqualGUID(&IID_IOleCommandTarget, riid)) { TRACE("(%p)->(IID_IOleCommandTarget %p)\n", This, ppv); *ppv = OLECMD(This); - }else if(IsEqualGUID(&IID_IHlinkFrame, riid)) { - TRACE("(%p)->(IID_IHlinkFrame %p)\n", This, ppv); - *ppv = HLINKFRAME(This); }else if(IsEqualGUID(&IID_ITargetFrame2, riid)) { TRACE("(%p)->(IID_ITargetFrame2 %p)\n", This, ppv); *ppv = TARGETFRAME2(This); @@ -133,6 +130,8 @@ static HRESULT WINAPI WebBrowser_QueryInterface(IWebBrowser2 *iface, REFIID riid }else if(IsEqualGUID(&IID_IViewObjectEx, riid)) { TRACE("(%p)->(IID_IViewObjectEx %p) returning NULL\n", This, ppv); return E_NOINTERFACE; + }else if(HlinkFrame_QI(&This->hlink_frame, riid, ppv)) { + return S_OK; } if(*ppv) { @@ -1159,6 +1158,8 @@ static HRESULT WebBrowser_Create(INT version, IUnknown *pOuter, REFIID riid, voi WebBrowser_ClassInfo_Init(ret); WebBrowser_HlinkFrame_Init(ret); + HlinkFrame_Init(&ret->hlink_frame, (IUnknown*)WEBBROWSER2(ret), &ret->doc_host); + SHDOCVW_LockModule(); hres = IWebBrowser_QueryInterface(WEBBROWSER(ret), riid, ppv);