msdmo: Use an iface instead of a vtbl pointer in IEnumDMOImpl.

This commit is contained in:
Michael Stefaniuc 2010-11-29 00:54:16 +01:00 committed by Alexandre Julliard
parent 41dce7cfec
commit 8d959c9949

View File

@ -85,7 +85,7 @@ static const WCHAR szToGuidFmt[] =
typedef struct typedef struct
{ {
const IEnumDMOVtbl *lpVtbl; IEnumDMO IEnumDMO_iface;
LONG ref; LONG ref;
DWORD index; DWORD index;
const GUID* guidCategory; const GUID* guidCategory;
@ -97,6 +97,11 @@ typedef struct
HKEY hkey; HKEY hkey;
} IEnumDMOImpl; } IEnumDMOImpl;
static inline IEnumDMOImpl *impl_from_IEnumDMO(IEnumDMO *iface)
{
return CONTAINING_RECORD(iface, IEnumDMOImpl, IEnumDMO_iface);
}
static HRESULT read_types(HKEY root, LPCWSTR key, ULONG *supplied, ULONG requested, DMO_PARTIAL_MEDIATYPE* types); static HRESULT read_types(HKEY root, LPCWSTR key, ULONG *supplied, ULONG requested, DMO_PARTIAL_MEDIATYPE* types);
static const IEnumDMOVtbl edmovt; static const IEnumDMOVtbl edmovt;
@ -332,7 +337,7 @@ lend:
*/ */
static BOOL IEnumDMO_Destructor(IEnumDMO* iface) static BOOL IEnumDMO_Destructor(IEnumDMO* iface)
{ {
IEnumDMOImpl *This = (IEnumDMOImpl *)iface; IEnumDMOImpl *This = impl_from_IEnumDMO(iface);
TRACE("%p\n", This); TRACE("%p\n", This);
@ -366,7 +371,7 @@ static IEnumDMO * IEnumDMO_Constructor(
if (lpedmo) if (lpedmo)
{ {
lpedmo->ref = 1; lpedmo->ref = 1;
lpedmo->lpVtbl = &edmovt; lpedmo->IEnumDMO_iface.lpVtbl = &edmovt;
lpedmo->index = -1; lpedmo->index = -1;
lpedmo->guidCategory = guidCategory; lpedmo->guidCategory = guidCategory;
lpedmo->dwFlags = dwFlags; lpedmo->dwFlags = dwFlags;
@ -430,7 +435,7 @@ lerr:
*/ */
static ULONG WINAPI IEnumDMO_fnAddRef(IEnumDMO * iface) static ULONG WINAPI IEnumDMO_fnAddRef(IEnumDMO * iface)
{ {
IEnumDMOImpl *This = (IEnumDMOImpl *)iface; IEnumDMOImpl *This = impl_from_IEnumDMO(iface);
return InterlockedIncrement(&This->ref); return InterlockedIncrement(&This->ref);
} }
@ -443,7 +448,7 @@ static HRESULT WINAPI IEnumDMO_fnQueryInterface(
REFIID riid, REFIID riid,
LPVOID *ppvObj) LPVOID *ppvObj)
{ {
IEnumDMOImpl *This = (IEnumDMOImpl *)iface; IEnumDMOImpl *This = impl_from_IEnumDMO(iface);
*ppvObj = NULL; *ppvObj = NULL;
@ -467,7 +472,7 @@ static HRESULT WINAPI IEnumDMO_fnQueryInterface(
*/ */
static ULONG WINAPI IEnumDMO_fnRelease(IEnumDMO * iface) static ULONG WINAPI IEnumDMO_fnRelease(IEnumDMO * iface)
{ {
IEnumDMOImpl *This = (IEnumDMOImpl *)iface; IEnumDMOImpl *This = impl_from_IEnumDMO(iface);
ULONG refCount = InterlockedDecrement(&This->ref); ULONG refCount = InterlockedDecrement(&This->ref);
if (!refCount) if (!refCount)
@ -499,7 +504,7 @@ static HRESULT WINAPI IEnumDMO_fnNext(
UINT count = 0; UINT count = 0;
HRESULT hres = S_OK; HRESULT hres = S_OK;
IEnumDMOImpl *This = (IEnumDMOImpl *)iface; IEnumDMOImpl *This = impl_from_IEnumDMO(iface);
TRACE("--> (%p) %d %p %p %p\n", iface, cItemsToFetch, pCLSID, Names, pcItemsFetched); TRACE("--> (%p) %d %p %p %p\n", iface, cItemsToFetch, pCLSID, Names, pcItemsFetched);
@ -638,7 +643,7 @@ static HRESULT WINAPI IEnumDMO_fnNext(
*/ */
static HRESULT WINAPI IEnumDMO_fnSkip(IEnumDMO * iface, DWORD cItemsToSkip) static HRESULT WINAPI IEnumDMO_fnSkip(IEnumDMO * iface, DWORD cItemsToSkip)
{ {
IEnumDMOImpl *This = (IEnumDMOImpl *)iface; IEnumDMOImpl *This = impl_from_IEnumDMO(iface);
This->index += cItemsToSkip; This->index += cItemsToSkip;
@ -651,7 +656,7 @@ static HRESULT WINAPI IEnumDMO_fnSkip(IEnumDMO * iface, DWORD cItemsToSkip)
*/ */
static HRESULT WINAPI IEnumDMO_fnReset(IEnumDMO * iface) static HRESULT WINAPI IEnumDMO_fnReset(IEnumDMO * iface)
{ {
IEnumDMOImpl *This = (IEnumDMOImpl *)iface; IEnumDMOImpl *This = impl_from_IEnumDMO(iface);
This->index = -1; This->index = -1;
@ -664,7 +669,7 @@ static HRESULT WINAPI IEnumDMO_fnReset(IEnumDMO * iface)
*/ */
static HRESULT WINAPI IEnumDMO_fnClone(IEnumDMO * iface, IEnumDMO **ppEnum) static HRESULT WINAPI IEnumDMO_fnClone(IEnumDMO * iface, IEnumDMO **ppEnum)
{ {
IEnumDMOImpl *This = (IEnumDMOImpl *)iface; IEnumDMOImpl *This = impl_from_IEnumDMO(iface);
FIXME("(%p)->() to (%p)->() E_NOTIMPL\n", This, ppEnum); FIXME("(%p)->() to (%p)->() E_NOTIMPL\n", This, ppEnum);