Commit 389a7f54 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

mshtml: COM cleanup for all the IServiceProvider ifaces.

parent 22022d13
......@@ -1773,7 +1773,7 @@ static BOOL htmldoc_qi(HTMLDocument *This, REFIID riid, void **ppv)
*ppv = &This->IOleInPlaceObjectWindowless_iface;
}else if(IsEqualGUID(&IID_IServiceProvider, riid)) {
TRACE("(%p)->(IID_IServiceProvider, %p)\n", This, ppv);
*ppv = SERVPROV(This);
*ppv = &This->IServiceProvider_iface;
}else if(IsEqualGUID(&IID_IOleCommandTarget, riid)) {
TRACE("(%p)->(IID_IOleCommandTarget, %p)\n", This, ppv);
*ppv = CMDTARGET(This);
......
......@@ -193,7 +193,7 @@ static HRESULT WINAPI HTMLWindow2_QueryInterface(IHTMLWindow2 *iface, REFIID rii
*ppv = HTMLPRIVWINDOW(This);
}else if(IsEqualGUID(&IID_IServiceProvider, riid)) {
TRACE("(%p)->(IID_IServiceProvider %p)\n", This, ppv);
*ppv = SERVPROV(This);
*ppv = &This->IServiceProvider_iface;
}else if(dispex_query_interface(&This->dispex, riid, ppv)) {
return *ppv ? S_OK : E_NOINTERFACE;
}
......@@ -2119,29 +2119,32 @@ static const IDispatchExVtbl WindowDispExVtbl = {
WindowDispEx_GetNameSpaceParent
};
#define SERVPROV_THIS(iface) DEFINE_THIS(HTMLWindow, ServiceProvider, iface)
static inline HTMLWindow *impl_from_IServiceProvider(IServiceProvider *iface)
{
return CONTAINING_RECORD(iface, HTMLWindow, IServiceProvider_iface);
}
static HRESULT WINAPI HTMLWindowSP_QueryInterface(IServiceProvider *iface, REFIID riid, void **ppv)
{
HTMLWindow *This = SERVPROV_THIS(iface);
HTMLWindow *This = impl_from_IServiceProvider(iface);
return IHTMLWindow2_QueryInterface(HTMLWINDOW2(This), riid, ppv);
}
static ULONG WINAPI HTMLWindowSP_AddRef(IServiceProvider *iface)
{
HTMLWindow *This = SERVPROV_THIS(iface);
HTMLWindow *This = impl_from_IServiceProvider(iface);
return IHTMLWindow2_AddRef(HTMLWINDOW2(This));
}
static ULONG WINAPI HTMLWindowSP_Release(IServiceProvider *iface)
{
HTMLWindow *This = SERVPROV_THIS(iface);
HTMLWindow *This = impl_from_IServiceProvider(iface);
return IHTMLWindow2_Release(HTMLWINDOW2(This));
}
static HRESULT WINAPI HTMLWindowSP_QueryService(IServiceProvider *iface, REFGUID guidService, REFIID riid, void **ppv)
{
HTMLWindow *This = SERVPROV_THIS(iface);
HTMLWindow *This = impl_from_IServiceProvider(iface);
if(IsEqualGUID(guidService, &IID_IHTMLWindow2)) {
TRACE("IID_IHTMLWindow2\n");
......@@ -2153,11 +2156,10 @@ static HRESULT WINAPI HTMLWindowSP_QueryService(IServiceProvider *iface, REFGUID
if(!This->doc_obj)
return E_NOINTERFACE;
return IServiceProvider_QueryService(SERVPROV(&This->doc_obj->basedoc), guidService, riid, ppv);
return IServiceProvider_QueryService(&This->doc_obj->basedoc.IServiceProvider_iface,
guidService, riid, ppv);
}
#undef SERVPROV_THIS
static const IServiceProviderVtbl ServiceProviderVtbl = {
HTMLWindowSP_QueryInterface,
HTMLWindowSP_AddRef,
......@@ -2204,7 +2206,7 @@ HRESULT HTMLWindow_Create(HTMLDocumentObj *doc_obj, nsIDOMWindow *nswindow, HTML
window->lpHTMLWindow4Vtbl = &HTMLWindow4Vtbl;
window->lpIHTMLPrivateWindowVtbl = &HTMLPrivateWindowVtbl;
window->lpIDispatchExVtbl = &WindowDispExVtbl;
window->lpServiceProviderVtbl = &ServiceProviderVtbl;
window->IServiceProvider_iface.lpVtbl = &ServiceProviderVtbl;
window->ref = 1;
window->doc_obj = doc_obj;
......
......@@ -265,7 +265,7 @@ struct HTMLWindow {
const IHTMLWindow4Vtbl *lpHTMLWindow4Vtbl;
const IHTMLPrivateWindowVtbl *lpIHTMLPrivateWindowVtbl;
const IDispatchExVtbl *lpIDispatchExVtbl;
const IServiceProviderVtbl *lpServiceProviderVtbl;
IServiceProvider IServiceProvider_iface;
LONG ref;
......@@ -357,7 +357,7 @@ struct HTMLDocument {
IOleInPlaceActiveObject IOleInPlaceActiveObject_iface;
IViewObjectEx IViewObjectEx_iface;
IOleInPlaceObjectWindowless IOleInPlaceObjectWindowless_iface;
const IServiceProviderVtbl *lpServiceProviderVtbl;
IServiceProvider IServiceProvider_iface;
const IOleCommandTargetVtbl *lpOleCommandTargetVtbl;
const IOleControlVtbl *lpOleControlVtbl;
const IHlinkTargetVtbl *lpHlinkTargetVtbl;
......@@ -625,7 +625,6 @@ struct HTMLDocumentNode {
#define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
#define HTMLWINDOW3(x) ((IHTMLWindow3*) &(x)->lpHTMLWindow3Vtbl)
#define HTMLWINDOW4(x) ((IHTMLWindow4*) &(x)->lpHTMLWindow4Vtbl)
#define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
#define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
#define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
#define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
......
......@@ -68,7 +68,7 @@ typedef struct {
struct BSCallback {
const IBindStatusCallbackVtbl *lpBindStatusCallbackVtbl;
const IServiceProviderVtbl *lpServiceProviderVtbl;
IServiceProvider IServiceProvider_iface;
const IHttpNegotiate2Vtbl *lpHttpNegotiate2Vtbl;
const IInternetBindInfoVtbl *lpInternetBindInfoVtbl;
......@@ -252,7 +252,7 @@ static HRESULT WINAPI BindStatusCallback_QueryInterface(IBindStatusCallback *ifa
*ppv = STATUSCLB(This);
}else if(IsEqualGUID(&IID_IServiceProvider, riid)) {
TRACE("(%p)->(IID_IServiceProvider %p)\n", This, ppv);
*ppv = SERVPROV(This);
*ppv = &This->IServiceProvider_iface;
}else if(IsEqualGUID(&IID_IHttpNegotiate, riid)) {
TRACE("(%p)->(IID_IHttpNegotiate %p)\n", This, ppv);
*ppv = HTTPNEG(This);
......@@ -570,37 +570,38 @@ static const IInternetBindInfoVtbl InternetBindInfoVtbl = {
InternetBindInfo_GetBindString
};
#define SERVPROV_THIS(iface) DEFINE_THIS(BSCallback, ServiceProvider, iface)
static inline BSCallback *impl_from_IServiceProvider(IServiceProvider *iface)
{
return CONTAINING_RECORD(iface, BSCallback, IServiceProvider_iface);
}
static HRESULT WINAPI BSCServiceProvider_QueryInterface(IServiceProvider *iface,
REFIID riid, void **ppv)
{
BSCallback *This = SERVPROV_THIS(iface);
BSCallback *This = impl_from_IServiceProvider(iface);
return IBindStatusCallback_QueryInterface(STATUSCLB(This), riid, ppv);
}
static ULONG WINAPI BSCServiceProvider_AddRef(IServiceProvider *iface)
{
BSCallback *This = SERVPROV_THIS(iface);
BSCallback *This = impl_from_IServiceProvider(iface);
return IBindStatusCallback_AddRef(STATUSCLB(This));
}
static ULONG WINAPI BSCServiceProvider_Release(IServiceProvider *iface)
{
BSCallback *This = SERVPROV_THIS(iface);
BSCallback *This = impl_from_IServiceProvider(iface);
return IBindStatusCallback_Release(STATUSCLB(This));
}
static HRESULT WINAPI BSCServiceProvider_QueryService(IServiceProvider *iface,
REFGUID guidService, REFIID riid, void **ppv)
{
BSCallback *This = SERVPROV_THIS(iface);
BSCallback *This = impl_from_IServiceProvider(iface);
TRACE("(%p)->(%s %s %p)\n", This, debugstr_guid(guidService), debugstr_guid(riid), ppv);
return E_NOINTERFACE;
}
#undef SERVPROV_THIS
static const IServiceProviderVtbl ServiceProviderVtbl = {
BSCServiceProvider_QueryInterface,
BSCServiceProvider_AddRef,
......@@ -611,7 +612,7 @@ static const IServiceProviderVtbl ServiceProviderVtbl = {
static void init_bscallback(BSCallback *This, const BSCallbackVtbl *vtbl, IMoniker *mon, DWORD bindf)
{
This->lpBindStatusCallbackVtbl = &BindStatusCallbackVtbl;
This->lpServiceProviderVtbl = &ServiceProviderVtbl;
This->IServiceProvider_iface.lpVtbl = &ServiceProviderVtbl;
This->lpHttpNegotiate2Vtbl = &HttpNegotiate2Vtbl;
This->lpInternetBindInfoVtbl = &InternetBindInfoVtbl;
This->vtbl = vtbl;
......
......@@ -1180,7 +1180,8 @@ static HRESULT WINAPI PHServiceProvider_QueryService(IServiceProvider *iface, RE
return E_NOINTERFACE;
}
return IServiceProvider_QueryService(SERVPROV(This->doc->basedoc.window), guidService, riid, ppv);
return IServiceProvider_QueryService(&This->doc->basedoc.window->IServiceProvider_iface,
guidService, riid, ppv);
}
static const IServiceProviderVtbl ServiceProviderVtbl = {
......
......@@ -55,7 +55,7 @@ struct ScriptHost {
const IActiveScriptSiteInterruptPollVtbl *lpIActiveScriptSiteInterruptPollVtbl;
const IActiveScriptSiteWindowVtbl *lpIActiveScriptSiteWindowVtbl;
const IActiveScriptSiteDebugVtbl *lpIActiveScriptSiteDebugVtbl;
const IServiceProviderVtbl *lpServiceProviderVtbl;
IServiceProvider IServiceProvider_iface;
LONG ref;
......@@ -250,7 +250,7 @@ static HRESULT WINAPI ActiveScriptSite_QueryInterface(IActiveScriptSite *iface,
*ppv = ACTSCPDBG(This);
}else if(IsEqualGUID(&IID_IServiceProvider, riid)) {
TRACE("(%p)->(IID_IServiceProvider %p)\n", This, ppv);
*ppv = SERVPROV(This);
*ppv = &This->IServiceProvider_iface;
}else if(IsEqualGUID(&IID_ICanHandleException, riid)) {
TRACE("(%p)->(IID_ICanHandleException not supported %p)\n", This, ppv);
return E_NOINTERFACE;
......@@ -542,30 +542,33 @@ static const IActiveScriptSiteDebugVtbl ActiveScriptSiteDebugVtbl = {
ActiveScriptSiteDebug_OnScriptErrorDebug
};
#define SERVPROV_THIS(iface) DEFINE_THIS(ScriptHost, ServiceProvider, iface)
static inline ScriptHost *impl_from_IServiceProvider(IServiceProvider *iface)
{
return CONTAINING_RECORD(iface, ScriptHost, IServiceProvider_iface);
}
static HRESULT WINAPI ASServiceProvider_QueryInterface(IServiceProvider *iface, REFIID riid, void **ppv)
{
ScriptHost *This = SERVPROV_THIS(iface);
ScriptHost *This = impl_from_IServiceProvider(iface);
return IActiveScriptSite_QueryInterface(ACTSCPSITE(This), riid, ppv);
}
static ULONG WINAPI ASServiceProvider_AddRef(IServiceProvider *iface)
{
ScriptHost *This = SERVPROV_THIS(iface);
ScriptHost *This = impl_from_IServiceProvider(iface);
return IActiveScriptSite_AddRef(ACTSCPSITE(This));
}
static ULONG WINAPI ASServiceProvider_Release(IServiceProvider *iface)
{
ScriptHost *This = SERVPROV_THIS(iface);
ScriptHost *This = impl_from_IServiceProvider(iface);
return IActiveScriptSite_Release(ACTSCPSITE(This));
}
static HRESULT WINAPI ASServiceProvider_QueryService(IServiceProvider *iface, REFGUID guidService,
REFIID riid, void **ppv)
{
ScriptHost *This = SERVPROV_THIS(iface);
ScriptHost *This = impl_from_IServiceProvider(iface);
if(IsEqualGUID(&SID_SInternetHostSecurityManager, guidService)) {
TRACE("(%p)->(SID_SInternetHostSecurityManager)\n", This);
......@@ -580,8 +583,6 @@ static HRESULT WINAPI ASServiceProvider_QueryService(IServiceProvider *iface, RE
return E_NOINTERFACE;
}
#undef SERVPROV_THIS
static const IServiceProviderVtbl ASServiceProviderVtbl = {
ASServiceProvider_QueryInterface,
ASServiceProvider_AddRef,
......@@ -599,7 +600,7 @@ static ScriptHost *create_script_host(HTMLWindow *window, const GUID *guid)
ret->lpIActiveScriptSiteInterruptPollVtbl = &ActiveScriptSiteInterruptPollVtbl;
ret->lpIActiveScriptSiteWindowVtbl = &ActiveScriptSiteWindowVtbl;
ret->lpIActiveScriptSiteDebugVtbl = &ActiveScriptSiteDebugVtbl;
ret->lpServiceProviderVtbl = &ASServiceProviderVtbl;
ret->IServiceProvider_iface.lpVtbl = &ASServiceProviderVtbl;
ret->ref = 1;
ret->window = window;
ret->script_state = SCRIPTSTATE_UNINITIALIZED;
......
......@@ -207,31 +207,34 @@ static IOleUndoManager *create_undomgr(void)
* IServiceProvider implementation
*/
#define SERVPROV_THIS(iface) DEFINE_THIS(HTMLDocument, ServiceProvider, iface)
static inline HTMLDocument *impl_from_IServiceProvider(IServiceProvider *iface)
{
return CONTAINING_RECORD(iface, HTMLDocument, IServiceProvider_iface);
}
static HRESULT WINAPI ServiceProvider_QueryInterface(IServiceProvider *iface, REFIID riid, void **ppv)
{
HTMLDocument *This = SERVPROV_THIS(iface);
HTMLDocument *This = impl_from_IServiceProvider(iface);
return htmldoc_query_interface(This, riid, ppv);
}
static ULONG WINAPI ServiceProvider_AddRef(IServiceProvider *iface)
{
HTMLDocument *This = SERVPROV_THIS(iface);
HTMLDocument *This = impl_from_IServiceProvider(iface);
return htmldoc_addref(This);
}
static ULONG WINAPI ServiceProvider_Release(IServiceProvider *iface)
{
HTMLDocument *This = SERVPROV_THIS(iface);
HTMLDocument *This = impl_from_IServiceProvider(iface);
return htmldoc_release(This);
}
static HRESULT WINAPI ServiceProvider_QueryService(IServiceProvider *iface, REFGUID guidService,
REFIID riid, void **ppv)
{
HTMLDocument *This = SERVPROV_THIS(iface);
HTMLDocument *This = impl_from_IServiceProvider(iface);
if(IsEqualGUID(&CLSID_CMarkup, guidService)) {
FIXME("(%p)->(CLSID_CMarkup %s %p)\n", This, debugstr_guid(riid), ppv);
return E_NOINTERFACE;
......@@ -276,5 +279,5 @@ static const IServiceProviderVtbl ServiceProviderVtbl = {
void HTMLDocument_Service_Init(HTMLDocument *This)
{
This->lpServiceProviderVtbl = &ServiceProviderVtbl;
This->IServiceProvider_iface.lpVtbl = &ServiceProviderVtbl;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment