72 trace(
"unexpected Release(%p) called\n",
This);
87 iface->
ref = refcount;
100 if (!pSHCreateThreadRef) {
101 win_skip(
"SHCreateThreadRef not found\n");
106 hr = pSHSetThreadRef(
NULL);
107 ok(
hr ==
S_OK,
"got 0x%x (expected S_OK)\n",
hr);
110 refcount = 0xdeadbeef;
111 hr = pSHCreateThreadRef(&refcount, &pobj);
112 ok((
hr ==
S_OK) && pobj && (refcount == 1),
113 "got 0x%x and %p with %d (expected S_OK and '!= NULL' with 1)\n",
118 hr = pSHGetThreadRef(&punk);
120 "got 0x%x and %p (expected E_NOINTERFACE and NULL)\n",
hr, punk);
123 hr = pSHSetThreadRef(pobj);
124 ok(
hr ==
S_OK,
"got 0x%x (expected S_OK)\n",
hr);
128 hr = pSHGetThreadRef(&punk);
129 ok( (
hr ==
S_OK) && (punk == pobj) && (refcount == 2),
130 "got 0x%x and %p with %d (expected S_OK and %p with 2)\n",
131 hr, punk, refcount, pobj);
135 hr = IUnknown_Release(pobj);
136 ok((
hr == 1) && (
hr == refcount),
137 "got %d with %d (expected 1 with 1)\n",
hr, refcount);
142 hr = IUnknown_Release(pobj);
143 ok((
hr == 0) && (
hr == refcount),
144 "got %d with %d (expected 0 with 0)\n",
hr, refcount);
151 hr = pSHGetThreadRef(&punk);
152 trace(
"got 0x%x and %p with %d\n",
hr, punk, refcount);
156 hr = pSHSetThreadRef(
NULL);
157 ok(
hr ==
S_OK,
"got 0x%x (expected S_OK)\n",
hr);
163 hr = pSHCreateThreadRef(
NULL, &pobj);
166 refcount = 0xdeadbeef;
168 hr = pSHCreateThreadRef(&refcount,
NULL);
170 "got 0x%x with 0x%x (expected E_INVALIDARG and oxdeadbeef)\n",
182 if (!pSHGetThreadRef) {
183 win_skip(
"SHGetThreadRef not found\n");
188 hr = pSHGetThreadRef(&punk);
190 "got 0x%x and %p (expected E_NOINTERFACE and NULL)\n",
hr, punk);
194 pSHGetThreadRef(
NULL);
206 if (!pSHSetThreadRef) {
207 win_skip(
"SHSetThreadRef not found\n");
212 hr = pSHSetThreadRef(
NULL);
213 ok(
hr ==
S_OK,
"got 0x%x (expected S_OK)\n",
hr);
219 hr = pSHSetThreadRef(&
ref.IUnknown_iface);
221 "got 0x%x with %d, %d (expected S_OK with 1, 0)\n",
228 hr = pSHGetThreadRef(&punk);
230 "got 0x%x and %p with %d, %d (expected S_OK and %p with 2, 1)\n",
234 hr = pSHSetThreadRef(
NULL);
235 ok(
hr ==
S_OK,
"got 0x%x (expected S_OK)\n",
hr);
238 hr = pSHGetThreadRef(&punk);
240 "got 0x%x and %p (expected E_NOINTERFACE and NULL)\n",
hr, punk);
#define InterlockedIncrement
#define InterlockedDecrement
#define GetProcAddress(x, y)
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
static ULONG WINAPI threadref_Release(IUnknown *iface)
static threadref * impl_from_IUnknown(IUnknown *iface)
static ULONG WINAPI threadref_AddRef(IUnknown *iface)
static HRESULT WINAPI threadref_QueryInterface(IUnknown *iface, REFIID riid, LPVOID *ppvObj)
static const IUnknownVtbl threadref_vt
static void test_SHCreateThreadRef(void)
static void init_threadref(threadref *iface, LONG *refcount)
static void test_SHSetThreadRef(void)
static DWORD AddRef_called
static void test_SHGetThreadRef(void)
static __inline const char * wine_dbgstr_guid(const GUID *id)
#define CONTAINING_RECORD(address, type, field)