Commit 5a3c146d authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

mshtml: Use an iface instead of a vtbl pointer in HTMLPluginsCollection.

parent 973a25a0
...@@ -49,27 +49,28 @@ static inline OmNavigator *impl_from_IOmNavigator(IOmNavigator *iface) ...@@ -49,27 +49,28 @@ static inline OmNavigator *impl_from_IOmNavigator(IOmNavigator *iface)
struct HTMLPluginsCollection { struct HTMLPluginsCollection {
DispatchEx dispex; DispatchEx dispex;
const IHTMLPluginsCollectionVtbl *lpIHTMLPluginsCollectionVtbl; IHTMLPluginsCollection IHTMLPluginsCollection_iface;
LONG ref; LONG ref;
OmNavigator *navigator; OmNavigator *navigator;
}; };
#define HTMLPLUGINSCOL(x) ((IHTMLPluginsCollection*) &(x)->lpIHTMLPluginsCollectionVtbl) static inline HTMLPluginsCollection *impl_from_IHTMLPluginsCollection(IHTMLPluginsCollection *iface)
{
#define HTMLPLUGINCOL_THIS(iface) DEFINE_THIS(HTMLPluginsCollection, IHTMLPluginsCollection, iface) return CONTAINING_RECORD(iface, HTMLPluginsCollection, IHTMLPluginsCollection_iface);
}
static HRESULT WINAPI HTMLPluginsCollection_QueryInterface(IHTMLPluginsCollection *iface, REFIID riid, void **ppv) static HRESULT WINAPI HTMLPluginsCollection_QueryInterface(IHTMLPluginsCollection *iface, REFIID riid, void **ppv)
{ {
HTMLPluginsCollection *This = HTMLPLUGINCOL_THIS(iface); HTMLPluginsCollection *This = impl_from_IHTMLPluginsCollection(iface);
if(IsEqualGUID(&IID_IUnknown, riid)) { if(IsEqualGUID(&IID_IUnknown, riid)) {
TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv); TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
*ppv = HTMLPLUGINSCOL(This); *ppv = &This->IHTMLPluginsCollection_iface;
}else if(IsEqualGUID(&IID_IHTMLPluginsCollection, riid)) { }else if(IsEqualGUID(&IID_IHTMLPluginsCollection, riid)) {
TRACE("(%p)->(IID_IHTMLPluginCollection %p)\n", This, ppv); TRACE("(%p)->(IID_IHTMLPluginCollection %p)\n", This, ppv);
*ppv = HTMLPLUGINSCOL(This); *ppv = &This->IHTMLPluginsCollection_iface;
}else if(dispex_query_interface(&This->dispex, riid, ppv)) { }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
return *ppv ? S_OK : E_NOINTERFACE; return *ppv ? S_OK : E_NOINTERFACE;
}else { }else {
...@@ -84,7 +85,7 @@ static HRESULT WINAPI HTMLPluginsCollection_QueryInterface(IHTMLPluginsCollectio ...@@ -84,7 +85,7 @@ static HRESULT WINAPI HTMLPluginsCollection_QueryInterface(IHTMLPluginsCollectio
static ULONG WINAPI HTMLPluginsCollection_AddRef(IHTMLPluginsCollection *iface) static ULONG WINAPI HTMLPluginsCollection_AddRef(IHTMLPluginsCollection *iface)
{ {
HTMLPluginsCollection *This = HTMLPLUGINCOL_THIS(iface); HTMLPluginsCollection *This = impl_from_IHTMLPluginsCollection(iface);
LONG ref = InterlockedIncrement(&This->ref); LONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) ref=%d\n", This, ref); TRACE("(%p) ref=%d\n", This, ref);
...@@ -94,7 +95,7 @@ static ULONG WINAPI HTMLPluginsCollection_AddRef(IHTMLPluginsCollection *iface) ...@@ -94,7 +95,7 @@ static ULONG WINAPI HTMLPluginsCollection_AddRef(IHTMLPluginsCollection *iface)
static ULONG WINAPI HTMLPluginsCollection_Release(IHTMLPluginsCollection *iface) static ULONG WINAPI HTMLPluginsCollection_Release(IHTMLPluginsCollection *iface)
{ {
HTMLPluginsCollection *This = HTMLPLUGINCOL_THIS(iface); HTMLPluginsCollection *This = impl_from_IHTMLPluginsCollection(iface);
LONG ref = InterlockedDecrement(&This->ref); LONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) ref=%d\n", This, ref); TRACE("(%p) ref=%d\n", This, ref);
...@@ -111,21 +112,21 @@ static ULONG WINAPI HTMLPluginsCollection_Release(IHTMLPluginsCollection *iface) ...@@ -111,21 +112,21 @@ static ULONG WINAPI HTMLPluginsCollection_Release(IHTMLPluginsCollection *iface)
static HRESULT WINAPI HTMLPluginsCollection_GetTypeInfoCount(IHTMLPluginsCollection *iface, UINT *pctinfo) static HRESULT WINAPI HTMLPluginsCollection_GetTypeInfoCount(IHTMLPluginsCollection *iface, UINT *pctinfo)
{ {
HTMLPluginsCollection *This = HTMLPLUGINCOL_THIS(iface); HTMLPluginsCollection *This = impl_from_IHTMLPluginsCollection(iface);
return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->dispex), pctinfo); return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->dispex), pctinfo);
} }
static HRESULT WINAPI HTMLPluginsCollection_GetTypeInfo(IHTMLPluginsCollection *iface, UINT iTInfo, static HRESULT WINAPI HTMLPluginsCollection_GetTypeInfo(IHTMLPluginsCollection *iface, UINT iTInfo,
LCID lcid, ITypeInfo **ppTInfo) LCID lcid, ITypeInfo **ppTInfo)
{ {
HTMLPluginsCollection *This = HTMLPLUGINCOL_THIS(iface); HTMLPluginsCollection *This = impl_from_IHTMLPluginsCollection(iface);
return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->dispex), iTInfo, lcid, ppTInfo); return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->dispex), iTInfo, lcid, ppTInfo);
} }
static HRESULT WINAPI HTMLPluginsCollection_GetIDsOfNames(IHTMLPluginsCollection *iface, REFIID riid, static HRESULT WINAPI HTMLPluginsCollection_GetIDsOfNames(IHTMLPluginsCollection *iface, REFIID riid,
LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
{ {
HTMLPluginsCollection *This = HTMLPLUGINCOL_THIS(iface); HTMLPluginsCollection *This = impl_from_IHTMLPluginsCollection(iface);
return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->dispex), riid, rgszNames, cNames, lcid, rgDispId); return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->dispex), riid, rgszNames, cNames, lcid, rgDispId);
} }
...@@ -133,27 +134,25 @@ static HRESULT WINAPI HTMLPluginsCollection_Invoke(IHTMLPluginsCollection *iface ...@@ -133,27 +134,25 @@ static HRESULT WINAPI HTMLPluginsCollection_Invoke(IHTMLPluginsCollection *iface
REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
EXCEPINFO *pExcepInfo, UINT *puArgErr) EXCEPINFO *pExcepInfo, UINT *puArgErr)
{ {
HTMLPluginsCollection *This = HTMLPLUGINCOL_THIS(iface); HTMLPluginsCollection *This = impl_from_IHTMLPluginsCollection(iface);
return IDispatchEx_Invoke(DISPATCHEX(&This->dispex), dispIdMember, riid, lcid, return IDispatchEx_Invoke(DISPATCHEX(&This->dispex), dispIdMember, riid, lcid,
wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
} }
static HRESULT WINAPI HTMLPluginsCollection_get_length(IHTMLPluginsCollection *iface, LONG *p) static HRESULT WINAPI HTMLPluginsCollection_get_length(IHTMLPluginsCollection *iface, LONG *p)
{ {
HTMLPluginsCollection *This = HTMLPLUGINCOL_THIS(iface); HTMLPluginsCollection *This = impl_from_IHTMLPluginsCollection(iface);
FIXME("(%p)->(%p)\n", This, p); FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI HTMLPluginsCollection_refresh(IHTMLPluginsCollection *iface, VARIANT_BOOL reload) static HRESULT WINAPI HTMLPluginsCollection_refresh(IHTMLPluginsCollection *iface, VARIANT_BOOL reload)
{ {
HTMLPluginsCollection *This = HTMLPLUGINCOL_THIS(iface); HTMLPluginsCollection *This = impl_from_IHTMLPluginsCollection(iface);
FIXME("(%p)->(%x)\n", This, reload); FIXME("(%p)->(%x)\n", This, reload);
return E_NOTIMPL; return E_NOTIMPL;
} }
#undef HTMLPLUGINSCOL_THIS
static const IHTMLPluginsCollectionVtbl HTMLPluginsCollectionVtbl = { static const IHTMLPluginsCollectionVtbl HTMLPluginsCollectionVtbl = {
HTMLPluginsCollection_QueryInterface, HTMLPluginsCollection_QueryInterface,
HTMLPluginsCollection_AddRef, HTMLPluginsCollection_AddRef,
...@@ -185,11 +184,12 @@ static HRESULT create_plugins_collection(OmNavigator *navigator, HTMLPluginsColl ...@@ -185,11 +184,12 @@ static HRESULT create_plugins_collection(OmNavigator *navigator, HTMLPluginsColl
if(!col) if(!col)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
col->lpIHTMLPluginsCollectionVtbl = &HTMLPluginsCollectionVtbl; col->IHTMLPluginsCollection_iface.lpVtbl = &HTMLPluginsCollectionVtbl;
col->ref = 1; col->ref = 1;
col->navigator = navigator; col->navigator = navigator;
init_dispex(&col->dispex, (IUnknown*)HTMLPLUGINSCOL(col), &HTMLPluginsCollection_dispex); init_dispex(&col->dispex, (IUnknown*)&col->IHTMLPluginsCollection_iface,
&HTMLPluginsCollection_dispex);
*ret = col; *ret = col;
return S_OK; return S_OK;
...@@ -240,7 +240,7 @@ static ULONG WINAPI OmNavigator_Release(IOmNavigator *iface) ...@@ -240,7 +240,7 @@ static ULONG WINAPI OmNavigator_Release(IOmNavigator *iface)
if(!ref) { if(!ref) {
if(This->plugins) { if(This->plugins) {
This->plugins->navigator = NULL; This->plugins->navigator = NULL;
IHTMLPluginsCollection_Release(HTMLPLUGINSCOL(This->plugins)); IHTMLPluginsCollection_Release(&This->plugins->IHTMLPluginsCollection_iface);
} }
release_dispex(&This->dispex); release_dispex(&This->dispex);
heap_free(This); heap_free(This);
...@@ -399,10 +399,10 @@ static HRESULT WINAPI OmNavigator_get_plugins(IOmNavigator *iface, IHTMLPluginsC ...@@ -399,10 +399,10 @@ static HRESULT WINAPI OmNavigator_get_plugins(IOmNavigator *iface, IHTMLPluginsC
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
}else { }else {
IHTMLPluginsCollection_AddRef(HTMLPLUGINSCOL(This->plugins)); IHTMLPluginsCollection_AddRef(&This->plugins->IHTMLPluginsCollection_iface);
} }
*p = HTMLPLUGINSCOL(This->plugins); *p = &This->plugins->IHTMLPluginsCollection_iface;
return S_OK; return S_OK;
} }
......
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