shlwapi: Use an iface instead of an vtbl pointer in threadref.

This commit is contained in:
Michael Stefaniuc 2010-11-30 00:04:06 +01:00 committed by Alexandre Julliard
parent abb850c9c4
commit 9093312bdf
1 changed files with 11 additions and 6 deletions

View File

@ -122,13 +122,18 @@ typedef struct tagSHLWAPI_THREAD_INFO
typedef struct
{
const IUnknownVtbl* lpVtbl;
IUnknown IUnknown_iface;
LONG *ref;
} threadref;
static inline threadref *impl_from_IUnknown(IUnknown *iface)
{
return CONTAINING_RECORD(iface, threadref, IUnknown_iface);
}
static HRESULT WINAPI threadref_QueryInterface(IUnknown *iface, REFIID riid, LPVOID *ppvObj)
{
threadref * This = (threadref *)iface;
threadref * This = impl_from_IUnknown(iface);
TRACE("(%p, %s, %p)\n", This, debugstr_guid(riid), ppvObj);
@ -149,7 +154,7 @@ static HRESULT WINAPI threadref_QueryInterface(IUnknown *iface, REFIID riid, LPV
static ULONG WINAPI threadref_AddRef(IUnknown *iface)
{
threadref * This = (threadref *)iface;
threadref * This = impl_from_IUnknown(iface);
TRACE("(%p)\n", This);
return InterlockedIncrement(This->ref);
@ -158,7 +163,7 @@ static ULONG WINAPI threadref_AddRef(IUnknown *iface)
static ULONG WINAPI threadref_Release(IUnknown *iface)
{
LONG refcount;
threadref * This = (threadref *)iface;
threadref * This = impl_from_IUnknown(iface);
TRACE("(%p)\n", This);
@ -199,11 +204,11 @@ HRESULT WINAPI SHCreateThreadRef(LONG *lprefcount, IUnknown **lppUnknown)
return E_INVALIDARG;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(threadref));
This->lpVtbl = &threadref_vt;
This->IUnknown_iface.lpVtbl = &threadref_vt;
This->ref = lprefcount;
*lprefcount = 1;
*lppUnknown = (IUnknown *) This;
*lppUnknown = &This->IUnknown_iface;
TRACE("=> returning S_OK with %p\n", This);
return S_OK;
}