Commit 9093312b authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

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

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