*
* Copyright 2003 Robert Shearman
*
- * This file contains the (internal) driver registration functions,
- * driver enumeration APIs and DirectDraw creation functions.
- *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
typedef struct EnumMonikerImpl
{
- const IEnumMonikerVtbl *lpVtbl;
+ IEnumMoniker IEnumMoniker_iface;
LONG ref;
IMoniker ** ppMoniker;
ULONG nMonikerCount;
static const IEnumMonikerVtbl EnumMonikerImpl_Vtbl;
+static inline EnumMonikerImpl *impl_from_IEnumMoniker(IEnumMoniker *iface)
+{
+ return CONTAINING_RECORD(iface, EnumMonikerImpl, IEnumMoniker_iface);
+}
+
static ULONG WINAPI EnumMonikerImpl_AddRef(LPENUMMONIKER iface);
HRESULT EnumMonikerImpl_Create(IMoniker ** ppMoniker, ULONG nMonikerCount, IEnumMoniker ** ppEnum)
if (!pemi)
return E_OUTOFMEMORY;
- pemi->lpVtbl = &EnumMonikerImpl_Vtbl;
+ pemi->IEnumMoniker_iface.lpVtbl = &EnumMonikerImpl_Vtbl;
pemi->ref = 1;
pemi->ppMoniker = CoTaskMemAlloc(nMonikerCount * sizeof(IMoniker*));
memcpy(pemi->ppMoniker, ppMoniker, nMonikerCount*sizeof(IMoniker*));
pemi->nMonikerCount = nMonikerCount;
pemi->index = 0;
- *ppEnum = (IEnumMoniker *)pemi;
+ *ppEnum = &pemi->IEnumMoniker_iface;
return S_OK;
}
REFIID riid,
LPVOID *ppvObj)
{
- EnumMonikerImpl *This = (EnumMonikerImpl *)iface;
+ EnumMonikerImpl *This = impl_from_IEnumMoniker(iface);
TRACE("\n\tIID:\t%s\n",debugstr_guid(riid));
if (This == NULL || ppvObj == NULL) return E_POINTER;
*/
static ULONG WINAPI EnumMonikerImpl_AddRef(LPENUMMONIKER iface)
{
- EnumMonikerImpl *This = (EnumMonikerImpl *)iface;
+ EnumMonikerImpl *This = impl_from_IEnumMoniker(iface);
ULONG ref;
if (This == NULL) return E_POINTER;
*/
static ULONG WINAPI EnumMonikerImpl_Release(LPENUMMONIKER iface)
{
- EnumMonikerImpl *This = (EnumMonikerImpl *)iface;
+ EnumMonikerImpl *This = impl_from_IEnumMoniker(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->() Release from %d\n", iface, ref + 1);
static HRESULT WINAPI EnumMonikerImpl_Next(LPENUMMONIKER iface, ULONG celt, IMoniker ** rgelt, ULONG * pceltFetched)
{
ULONG fetched;
- EnumMonikerImpl *This = (EnumMonikerImpl *)iface;
+ EnumMonikerImpl *This = impl_from_IEnumMoniker(iface);
TRACE("(%p)->(%d, %p, %p)\n", iface, celt, rgelt, pceltFetched);
static HRESULT WINAPI EnumMonikerImpl_Skip(LPENUMMONIKER iface, ULONG celt)
{
- EnumMonikerImpl *This = (EnumMonikerImpl *)iface;
+ EnumMonikerImpl *This = impl_from_IEnumMoniker(iface);
TRACE("(%p)->(%d)\n", iface, celt);
static HRESULT WINAPI EnumMonikerImpl_Reset(LPENUMMONIKER iface)
{
- EnumMonikerImpl *This = (EnumMonikerImpl *)iface;
+ EnumMonikerImpl *This = impl_from_IEnumMoniker(iface);
TRACE("(%p)->()\n", iface);