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);
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);
static ULONG WINAPI threadref_Release(IUnknown *iface)
{
LONG refcount;
- threadref * This = (threadref *)iface;
+ threadref * This = impl_from_IUnknown(iface);
TRACE("(%p)\n", This);
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;
}
ti.pfnThreadProc = pfnThreadProc;
ti.pfnCallback = pfnCallback;
ti.pData = pData;
- ti.bInitCom = dwFlags & CTF_COINIT ? TRUE : FALSE;
+ ti.bInitCom = (dwFlags & CTF_COINIT) != 0;
ti.hEvent = CreateEventW(NULL,FALSE,FALSE,NULL);
/* Hold references to the current thread and IE process, if desired */
TRACE("(%s,%d)\n", debugstr_a(lpszName), iInitial);
if (lpszName)
- MultiByteToWideChar(0, 0, lpszName, -1, szBuff, MAX_PATH);
+ MultiByteToWideChar(CP_ACP, 0, lpszName, -1, szBuff, MAX_PATH);
return SHGlobalCounterCreateNamedW(lpszName ? szBuff : NULL, iInitial);
}