Commit 2085922d authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

browseui: Use ifaces instead of vtbl pointers in ACLMulti.

parent 0e3c6078
...@@ -49,23 +49,28 @@ struct ACLMultiSublist { ...@@ -49,23 +49,28 @@ struct ACLMultiSublist {
}; };
typedef struct tagACLMulti { typedef struct tagACLMulti {
const IEnumStringVtbl *vtbl; IEnumString IEnumString_iface;
const IACListVtbl *aclVtbl; IACList IACList_iface;
const IObjMgrVtbl *objmgrVtbl; IObjMgr IObjMgr_iface;
LONG refCount; LONG refCount;
INT nObjs; INT nObjs;
INT currObj; INT currObj;
struct ACLMultiSublist *objs; struct ACLMultiSublist *objs;
} ACLMulti; } ACLMulti;
static inline ACLMulti *impl_from_IEnumString(IEnumString *iface)
{
return CONTAINING_RECORD(iface, ACLMulti, IEnumString_iface);
}
static inline ACLMulti *impl_from_IACList(IACList *iface) static inline ACLMulti *impl_from_IACList(IACList *iface)
{ {
return (ACLMulti *)((char *)iface - FIELD_OFFSET(ACLMulti, aclVtbl)); return CONTAINING_RECORD(iface, ACLMulti, IACList_iface);
} }
static inline ACLMulti *impl_from_IObjMgr(IObjMgr *iface) static inline ACLMulti *impl_from_IObjMgr(IObjMgr *iface)
{ {
return (ACLMulti *)((char *)iface - FIELD_OFFSET(ACLMulti, objmgrVtbl)); return CONTAINING_RECORD(iface, ACLMulti, IObjMgr_iface);
} }
static void release_obj(struct ACLMultiSublist *obj) static void release_obj(struct ACLMultiSublist *obj)
...@@ -90,7 +95,7 @@ static void ACLMulti_Destructor(ACLMulti *This) ...@@ -90,7 +95,7 @@ static void ACLMulti_Destructor(ACLMulti *This)
static HRESULT WINAPI ACLMulti_QueryInterface(IEnumString *iface, REFIID iid, LPVOID *ppvOut) static HRESULT WINAPI ACLMulti_QueryInterface(IEnumString *iface, REFIID iid, LPVOID *ppvOut)
{ {
ACLMulti *This = (ACLMulti *)iface; ACLMulti *This = impl_from_IEnumString(iface);
*ppvOut = NULL; *ppvOut = NULL;
if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_IEnumString)) if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_IEnumString))
...@@ -99,11 +104,11 @@ static HRESULT WINAPI ACLMulti_QueryInterface(IEnumString *iface, REFIID iid, LP ...@@ -99,11 +104,11 @@ static HRESULT WINAPI ACLMulti_QueryInterface(IEnumString *iface, REFIID iid, LP
} }
else if (IsEqualIID(iid, &IID_IACList)) else if (IsEqualIID(iid, &IID_IACList))
{ {
*ppvOut = &This->aclVtbl; *ppvOut = &This->IACList_iface;
} }
else if (IsEqualIID(iid, &IID_IObjMgr)) else if (IsEqualIID(iid, &IID_IObjMgr))
{ {
*ppvOut = &This->objmgrVtbl; *ppvOut = &This->IObjMgr_iface;
} }
if (*ppvOut) if (*ppvOut)
...@@ -118,13 +123,13 @@ static HRESULT WINAPI ACLMulti_QueryInterface(IEnumString *iface, REFIID iid, LP ...@@ -118,13 +123,13 @@ static HRESULT WINAPI ACLMulti_QueryInterface(IEnumString *iface, REFIID iid, LP
static ULONG WINAPI ACLMulti_AddRef(IEnumString *iface) static ULONG WINAPI ACLMulti_AddRef(IEnumString *iface)
{ {
ACLMulti *This = (ACLMulti *)iface; ACLMulti *This = impl_from_IEnumString(iface);
return InterlockedIncrement(&This->refCount); return InterlockedIncrement(&This->refCount);
} }
static ULONG WINAPI ACLMulti_Release(IEnumString *iface) static ULONG WINAPI ACLMulti_Release(IEnumString *iface)
{ {
ACLMulti *This = (ACLMulti *)iface; ACLMulti *This = impl_from_IEnumString(iface);
ULONG ret; ULONG ret;
ret = InterlockedDecrement(&This->refCount); ret = InterlockedDecrement(&This->refCount);
...@@ -173,7 +178,7 @@ static HRESULT WINAPI ACLMulti_Remove(IObjMgr *iface, IUnknown *obj) ...@@ -173,7 +178,7 @@ static HRESULT WINAPI ACLMulti_Remove(IObjMgr *iface, IUnknown *obj)
static HRESULT WINAPI ACLMulti_Next(IEnumString *iface, ULONG celt, LPOLESTR *rgelt, ULONG *pceltFetched) static HRESULT WINAPI ACLMulti_Next(IEnumString *iface, ULONG celt, LPOLESTR *rgelt, ULONG *pceltFetched)
{ {
ACLMulti *This = (ACLMulti *)iface; ACLMulti *This = impl_from_IEnumString(iface);
TRACE("(%p, %d, %p, %p)\n", iface, celt, rgelt, pceltFetched); TRACE("(%p, %d, %p, %p)\n", iface, celt, rgelt, pceltFetched);
while (This->currObj < This->nObjs) while (This->currObj < This->nObjs)
...@@ -196,7 +201,7 @@ static HRESULT WINAPI ACLMulti_Next(IEnumString *iface, ULONG celt, LPOLESTR *rg ...@@ -196,7 +201,7 @@ static HRESULT WINAPI ACLMulti_Next(IEnumString *iface, ULONG celt, LPOLESTR *rg
static HRESULT WINAPI ACLMulti_Reset(IEnumString *iface) static HRESULT WINAPI ACLMulti_Reset(IEnumString *iface)
{ {
ACLMulti *This = (ACLMulti *)iface; ACLMulti *This = impl_from_IEnumString(iface);
int i; int i;
This->currObj = 0; This->currObj = 0;
...@@ -252,19 +257,19 @@ static const IEnumStringVtbl ACLMultiVtbl = ...@@ -252,19 +257,19 @@ static const IEnumStringVtbl ACLMultiVtbl =
static HRESULT WINAPI ACLMulti_IObjMgr_QueryInterface(IObjMgr *iface, REFIID iid, LPVOID *ppvOut) static HRESULT WINAPI ACLMulti_IObjMgr_QueryInterface(IObjMgr *iface, REFIID iid, LPVOID *ppvOut)
{ {
ACLMulti *This = impl_from_IObjMgr(iface); ACLMulti *This = impl_from_IObjMgr(iface);
return ACLMulti_QueryInterface((IEnumString *)This, iid, ppvOut); return ACLMulti_QueryInterface(&This->IEnumString_iface, iid, ppvOut);
} }
static ULONG WINAPI ACLMulti_IObjMgr_AddRef(IObjMgr *iface) static ULONG WINAPI ACLMulti_IObjMgr_AddRef(IObjMgr *iface)
{ {
ACLMulti *This = impl_from_IObjMgr(iface); ACLMulti *This = impl_from_IObjMgr(iface);
return ACLMulti_AddRef((IEnumString *)This); return ACLMulti_AddRef(&This->IEnumString_iface);
} }
static ULONG WINAPI ACLMulti_IObjMgr_Release(IObjMgr *iface) static ULONG WINAPI ACLMulti_IObjMgr_Release(IObjMgr *iface)
{ {
ACLMulti *This = impl_from_IObjMgr(iface); ACLMulti *This = impl_from_IObjMgr(iface);
return ACLMulti_Release((IEnumString *)This); return ACLMulti_Release(&This->IEnumString_iface);
} }
static const IObjMgrVtbl ACLMulti_ObjMgrVtbl = static const IObjMgrVtbl ACLMulti_ObjMgrVtbl =
...@@ -280,19 +285,19 @@ static const IObjMgrVtbl ACLMulti_ObjMgrVtbl = ...@@ -280,19 +285,19 @@ static const IObjMgrVtbl ACLMulti_ObjMgrVtbl =
static HRESULT WINAPI ACLMulti_IACList_QueryInterface(IACList *iface, REFIID iid, LPVOID *ppvOut) static HRESULT WINAPI ACLMulti_IACList_QueryInterface(IACList *iface, REFIID iid, LPVOID *ppvOut)
{ {
ACLMulti *This = impl_from_IACList(iface); ACLMulti *This = impl_from_IACList(iface);
return ACLMulti_QueryInterface((IEnumString *)This, iid, ppvOut); return ACLMulti_QueryInterface(&This->IEnumString_iface, iid, ppvOut);
} }
static ULONG WINAPI ACLMulti_IACList_AddRef(IACList *iface) static ULONG WINAPI ACLMulti_IACList_AddRef(IACList *iface)
{ {
ACLMulti *This = impl_from_IACList(iface); ACLMulti *This = impl_from_IACList(iface);
return ACLMulti_AddRef((IEnumString *)This); return ACLMulti_AddRef(&This->IEnumString_iface);
} }
static ULONG WINAPI ACLMulti_IACList_Release(IACList *iface) static ULONG WINAPI ACLMulti_IACList_Release(IACList *iface)
{ {
ACLMulti *This = impl_from_IACList(iface); ACLMulti *This = impl_from_IACList(iface);
return ACLMulti_Release((IEnumString *)This); return ACLMulti_Release(&This->IEnumString_iface);
} }
static const IACListVtbl ACLMulti_ACListVtbl = static const IACListVtbl ACLMulti_ACListVtbl =
...@@ -314,9 +319,9 @@ HRESULT ACLMulti_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut) ...@@ -314,9 +319,9 @@ HRESULT ACLMulti_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut)
if (This == NULL) if (This == NULL)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
This->vtbl = &ACLMultiVtbl; This->IEnumString_iface.lpVtbl = &ACLMultiVtbl;
This->aclVtbl = &ACLMulti_ACListVtbl; This->IACList_iface.lpVtbl = &ACLMulti_ACListVtbl;
This->objmgrVtbl = &ACLMulti_ObjMgrVtbl; This->IObjMgr_iface.lpVtbl = &ACLMulti_ObjMgrVtbl;
This->refCount = 1; This->refCount = 1;
TRACE("returning %p\n", This); TRACE("returning %p\n", This);
......
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