Commit bf0f6792 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

shlwapi/tests: Enable compilation with long types.

parent 4ad1bab4
EXTRADEFS = -DWINE_NO_LONG_TYPES
TESTDLL = shlwapi.dll TESTDLL = shlwapi.dll
IMPORTS = shlwapi shell32 mlang oleaut32 ole32 user32 advapi32 IMPORTS = shlwapi shell32 mlang oleaut32 ole32 user32 advapi32
......
...@@ -23,8 +23,8 @@ ...@@ -23,8 +23,8 @@
#include "shlwapi.h" #include "shlwapi.h"
#include "shlguid.h" #include "shlguid.h"
#define expect(expected, got) ok ( expected == got, "Expected %d, got %d\n", expected, got) #define expect(expected, got) ok ( expected == got, "Expected %ld, got %ld\n", expected, got)
#define expect_hr(expected, got) ok ( expected == got, "Expected %08x, got %08x\n", expected, got) #define expect_hr(expected, got) ok ( expected == got, "Expected %08lx, got %08lx\n", expected, got)
static HRESULT (WINAPI *pAssocQueryStringA)(ASSOCF,ASSOCSTR,LPCSTR,LPCSTR,LPSTR,LPDWORD) = NULL; static HRESULT (WINAPI *pAssocQueryStringA)(ASSOCF,ASSOCSTR,LPCSTR,LPCSTR,LPSTR,LPDWORD) = NULL;
static HRESULT (WINAPI *pAssocQueryStringW)(ASSOCF,ASSOCSTR,LPCWSTR,LPCWSTR,LPWSTR,LPDWORD) = NULL; static HRESULT (WINAPI *pAssocQueryStringW)(ASSOCF,ASSOCSTR,LPCWSTR,LPCWSTR,LPWSTR,LPDWORD) = NULL;
...@@ -53,24 +53,24 @@ static void test_getstring_bad(void) ...@@ -53,24 +53,24 @@ static void test_getstring_bad(void)
len = 0xdeadbeef; len = 0xdeadbeef;
hr = pAssocQueryStringW(0, ASSOCSTR_EXECUTABLE, NULL, open, NULL, &len); hr = pAssocQueryStringW(0, ASSOCSTR_EXECUTABLE, NULL, open, NULL, &len);
expect_hr(E_INVALIDARG, hr); expect_hr(E_INVALIDARG, hr);
ok(len == 0xdeadbeef, "got %u\n", len); ok(len == 0xdeadbeef, "got %lu\n", len);
len = 0xdeadbeef; len = 0xdeadbeef;
hr = pAssocQueryStringW(0, ASSOCSTR_EXECUTABLE, badBad, open, NULL, &len); hr = pAssocQueryStringW(0, ASSOCSTR_EXECUTABLE, badBad, open, NULL, &len);
ok(hr == E_FAIL || ok(hr == E_FAIL ||
hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION), /* Win9x/WinMe/NT4/W2K/Vista/W2K8 */ hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION), /* Win9x/WinMe/NT4/W2K/Vista/W2K8 */
"Unexpected result : %08x\n", hr); "Unexpected result : %08lx\n", hr);
ok(len == 0xdeadbeef, "got %u\n", len); ok(len == 0xdeadbeef, "got %lu\n", len);
len = ARRAY_SIZE(buf); len = ARRAY_SIZE(buf);
hr = pAssocQueryStringW(0, ASSOCSTR_EXECUTABLE, dotBad, open, buf, &len); hr = pAssocQueryStringW(0, ASSOCSTR_EXECUTABLE, dotBad, open, buf, &len);
ok(hr == E_FAIL || ok(hr == E_FAIL ||
hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION) /* Win9x/WinMe/NT4/W2K/Vista/W2K8 */ || hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION) /* Win9x/WinMe/NT4/W2K/Vista/W2K8 */ ||
hr == S_OK /* Win8 */, hr == S_OK /* Win8 */,
"Unexpected result : %08x\n", hr); "Unexpected result : %08lx\n", hr);
if (hr == S_OK) if (hr == S_OK)
{ {
ok(len < ARRAY_SIZE(buf), "got %u\n", len); ok(len < ARRAY_SIZE(buf), "got %lu\n", len);
ok(!lstrcmpiW(buf + len - ARRAY_SIZE(openwith), openwith), "wrong data\n"); ok(!lstrcmpiW(buf + len - ARRAY_SIZE(openwith), openwith), "wrong data\n");
} }
...@@ -78,25 +78,25 @@ static void test_getstring_bad(void) ...@@ -78,25 +78,25 @@ static void test_getstring_bad(void)
hr = pAssocQueryStringW(0, ASSOCSTR_EXECUTABLE, dotHtml, invalid, NULL, &len); hr = pAssocQueryStringW(0, ASSOCSTR_EXECUTABLE, dotHtml, invalid, NULL, &len);
ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) || ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) ||
hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION), /* Win9x/WinMe/NT4/W2K/Vista/W2K8 */ hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION), /* Win9x/WinMe/NT4/W2K/Vista/W2K8 */
"Unexpected result : %08x\n", hr); "Unexpected result : %08lx\n", hr);
ok(len == 0xdeadbeef, "got %u\n", len); ok(len == 0xdeadbeef, "got %lu\n", len);
hr = pAssocQueryStringW(0, ASSOCSTR_EXECUTABLE, dotHtml, open, NULL, NULL); hr = pAssocQueryStringW(0, ASSOCSTR_EXECUTABLE, dotHtml, open, NULL, NULL);
ok(hr == E_UNEXPECTED || ok(hr == E_UNEXPECTED ||
hr == E_INVALIDARG, /* Win9x/WinMe/NT4/W2K/Vista/W2K8 */ hr == E_INVALIDARG, /* Win9x/WinMe/NT4/W2K/Vista/W2K8 */
"Unexpected result : %08x\n", hr); "Unexpected result : %08lx\n", hr);
len = 0xdeadbeef; len = 0xdeadbeef;
hr = pAssocQueryStringW(0, ASSOCSTR_FRIENDLYAPPNAME, NULL, open, NULL, &len); hr = pAssocQueryStringW(0, ASSOCSTR_FRIENDLYAPPNAME, NULL, open, NULL, &len);
expect_hr(E_INVALIDARG, hr); expect_hr(E_INVALIDARG, hr);
ok(len == 0xdeadbeef, "got %u\n", len); ok(len == 0xdeadbeef, "got %lu\n", len);
len = 0xdeadbeef; len = 0xdeadbeef;
hr = pAssocQueryStringW(0, ASSOCSTR_FRIENDLYAPPNAME, badBad, open, NULL, &len); hr = pAssocQueryStringW(0, ASSOCSTR_FRIENDLYAPPNAME, badBad, open, NULL, &len);
ok(hr == E_FAIL || ok(hr == E_FAIL ||
hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION), /* Win9x/WinMe/NT4/W2K/Vista/W2K8 */ hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION), /* Win9x/WinMe/NT4/W2K/Vista/W2K8 */
"Unexpected result : %08x\n", hr); "Unexpected result : %08lx\n", hr);
ok(len == 0xdeadbeef, "got %u\n", len); ok(len == 0xdeadbeef, "got %lu\n", len);
len = 0xdeadbeef; len = 0xdeadbeef;
hr = pAssocQueryStringW(0, ASSOCSTR_FRIENDLYAPPNAME, dotBad, open, NULL, &len); hr = pAssocQueryStringW(0, ASSOCSTR_FRIENDLYAPPNAME, dotBad, open, NULL, &len);
...@@ -104,22 +104,22 @@ static void test_getstring_bad(void) ...@@ -104,22 +104,22 @@ static void test_getstring_bad(void)
hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION) /* Win9x/WinMe/NT4/W2K/Vista/W2K8 */ || hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION) /* Win9x/WinMe/NT4/W2K/Vista/W2K8 */ ||
hr == HRESULT_FROM_WIN32(ERROR_NOT_FOUND) /* Win8 */ || hr == HRESULT_FROM_WIN32(ERROR_NOT_FOUND) /* Win8 */ ||
hr == S_FALSE, /* Win10 */ hr == S_FALSE, /* Win10 */
"Unexpected result : %08x\n", hr); "Unexpected result : %08lx\n", hr);
ok((hr == S_FALSE && len < ARRAY_SIZE(buf)) || len == 0xdeadbeef, ok((hr == S_FALSE && len < ARRAY_SIZE(buf)) || len == 0xdeadbeef,
"got hr=%08x and len=%u\n", hr, len); "got hr=%08lx and len=%lu\n", hr, len);
len = 0xdeadbeef; len = 0xdeadbeef;
hr = pAssocQueryStringW(0, ASSOCSTR_FRIENDLYAPPNAME, dotHtml, invalid, NULL, &len); hr = pAssocQueryStringW(0, ASSOCSTR_FRIENDLYAPPNAME, dotHtml, invalid, NULL, &len);
ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) || ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) ||
hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION) || /* W2K/Vista/W2K8 */ hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION) || /* W2K/Vista/W2K8 */
hr == E_FAIL, /* Win9x/WinMe/NT4 */ hr == E_FAIL, /* Win9x/WinMe/NT4 */
"Unexpected result : %08x\n", hr); "Unexpected result : %08lx\n", hr);
ok(len == 0xdeadbeef, "got %u\n", len); ok(len == 0xdeadbeef, "got %lu\n", len);
hr = pAssocQueryStringW(0, ASSOCSTR_FRIENDLYAPPNAME, dotHtml, open, NULL, NULL); hr = pAssocQueryStringW(0, ASSOCSTR_FRIENDLYAPPNAME, dotHtml, open, NULL, NULL);
ok(hr == E_UNEXPECTED || ok(hr == E_UNEXPECTED ||
hr == E_INVALIDARG, /* Win9x/WinMe/NT4/W2K/Vista/W2K8 */ hr == E_INVALIDARG, /* Win9x/WinMe/NT4/W2K/Vista/W2K8 */
"Unexpected result : %08x\n", hr); "Unexpected result : %08lx\n", hr);
} }
static void test_getstring_basic(void) static void test_getstring_basic(void)
...@@ -164,7 +164,7 @@ static void test_getstring_basic(void) ...@@ -164,7 +164,7 @@ static void test_getstring_basic(void)
ok(hr == S_FALSE || ok(hr == S_FALSE ||
hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) /* Win9x/NT4 */ || hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) /* Win9x/NT4 */ ||
hr == HRESULT_FROM_WIN32(ERROR_NOT_FOUND), /* Win8 */ hr == HRESULT_FROM_WIN32(ERROR_NOT_FOUND), /* Win8 */
"Unexpected result : %08x\n", hr); "Unexpected result : %08lx\n", hr);
if (hr != S_FALSE) if (hr != S_FALSE)
{ {
HeapFree(GetProcessHeap(), 0, executableName); HeapFree(GetProcessHeap(), 0, executableName);
...@@ -255,7 +255,7 @@ static void test_getstring_no_extra(void) ...@@ -255,7 +255,7 @@ static void test_getstring_no_extra(void)
hr = pAssocQueryStringA(0, ASSOCSTR_EXECUTABLE, dotWinetest, NULL, buf, &len); hr = pAssocQueryStringA(0, ASSOCSTR_EXECUTABLE, dotWinetest, NULL, buf, &len);
ok(hr == S_OK || ok(hr == S_OK ||
hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), /* XP and W2K3 */ hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), /* XP and W2K3 */
"Unexpected result : %08x\n", hr); "Unexpected result : %08lx\n", hr);
hr = pAssocQueryStringA(0, ASSOCSTR_EXECUTABLE, dotWinetest, "foo", buf, &len); hr = pAssocQueryStringA(0, ASSOCSTR_EXECUTABLE, dotWinetest, "foo", buf, &len);
expect_hr(S_OK, hr); expect_hr(S_OK, hr);
ok(strstr(buf, action) != NULL, ok(strstr(buf, action) != NULL,
...@@ -279,19 +279,19 @@ static void test_assoc_create(void) ...@@ -279,19 +279,19 @@ static void test_assoc_create(void)
} }
hr = pAssocCreate(IID_NULL, &IID_NULL, NULL); hr = pAssocCreate(IID_NULL, &IID_NULL, NULL);
ok(hr == E_INVALIDARG, "Unexpected result : %08x\n", hr); ok(hr == E_INVALIDARG, "Unexpected result : %08lx\n", hr);
hr = pAssocCreate(CLSID_QueryAssociations, &IID_NULL, (LPVOID*)&pqa); hr = pAssocCreate(CLSID_QueryAssociations, &IID_NULL, (LPVOID*)&pqa);
ok(hr == CLASS_E_CLASSNOTAVAILABLE || hr == E_NOTIMPL || hr == E_NOINTERFACE ok(hr == CLASS_E_CLASSNOTAVAILABLE || hr == E_NOTIMPL || hr == E_NOINTERFACE
, "Unexpected result : %08x\n", hr); , "Unexpected result : %08lx\n", hr);
hr = pAssocCreate(IID_NULL, &IID_IQueryAssociations, (LPVOID*)&pqa); hr = pAssocCreate(IID_NULL, &IID_IQueryAssociations, (LPVOID*)&pqa);
ok(hr == CLASS_E_CLASSNOTAVAILABLE || hr == E_NOTIMPL || hr == E_INVALIDARG ok(hr == CLASS_E_CLASSNOTAVAILABLE || hr == E_NOTIMPL || hr == E_INVALIDARG
, "Unexpected result : %08x\n", hr); , "Unexpected result : %08lx\n", hr);
hr = pAssocCreate(CLSID_QueryAssociations, &IID_IQueryAssociations, (LPVOID*)&pqa); hr = pAssocCreate(CLSID_QueryAssociations, &IID_IQueryAssociations, (LPVOID*)&pqa);
ok(hr == S_OK || hr == E_NOTIMPL /* win98 */ ok(hr == S_OK || hr == E_NOTIMPL /* win98 */
, "Unexpected result : %08x\n", hr); , "Unexpected result : %08lx\n", hr);
if(hr == S_OK) if(hr == S_OK)
{ {
IQueryAssociations_Release(pqa); IQueryAssociations_Release(pqa);
...@@ -299,7 +299,7 @@ static void test_assoc_create(void) ...@@ -299,7 +299,7 @@ static void test_assoc_create(void)
hr = pAssocCreate(CLSID_QueryAssociations, &IID_IUnknown, (LPVOID*)&pqa); hr = pAssocCreate(CLSID_QueryAssociations, &IID_IUnknown, (LPVOID*)&pqa);
ok(hr == S_OK || hr == E_NOTIMPL /* win98 */ ok(hr == S_OK || hr == E_NOTIMPL /* win98 */
, "Unexpected result : %08x\n", hr); , "Unexpected result : %08lx\n", hr);
if(hr == S_OK) if(hr == S_OK)
{ {
IQueryAssociations_Release(pqa); IQueryAssociations_Release(pqa);
......
...@@ -328,7 +328,7 @@ static void test_CList(void) ...@@ -328,7 +328,7 @@ static void test_CList(void)
else if (inserted) else if (inserted)
{ {
ok(inserted->cbSize == item->cbSize + sizeof(DATABLOCK_HEADER), ok(inserted->cbSize == item->cbSize + sizeof(DATABLOCK_HEADER),
"id %d wrong size %d\n", inserted->dwSignature, inserted->cbSize); "id %ld wrong size %ld\n", inserted->dwSignature, inserted->cbSize);
} }
if (inserted) if (inserted)
{ {
...@@ -449,7 +449,7 @@ static void test_CList(void) ...@@ -449,7 +449,7 @@ static void test_CList(void)
else if (inserted) else if (inserted)
{ {
ok(inserted->cbSize == item->cbSize + sizeof(DATABLOCK_HEADER), ok(inserted->cbSize == item->cbSize + sizeof(DATABLOCK_HEADER),
"id %d wrong size %d\n", inserted->dwSignature, inserted->cbSize); "id %ld wrong size %ld\n", inserted->dwSignature, inserted->cbSize);
} }
ok(!inserted || inserted->dwSignature == item->dwSignature, "find got wrong item\n"); ok(!inserted || inserted->dwSignature == item->dwSignature, "find got wrong item\n");
if (inserted) if (inserted)
......
...@@ -116,7 +116,7 @@ static void test_ClassIDs(void) ...@@ -116,7 +116,7 @@ static void test_ClassIDs(void)
{ {
dwLen = pSHStringFromGUIDA(*guids, szBuff, 256); dwLen = pSHStringFromGUIDA(*guids, szBuff, 256);
if (!i && dwLen == S_OK) is_vista = TRUE; /* seems to return an HRESULT on vista */ if (!i && dwLen == S_OK) is_vista = TRUE; /* seems to return an HRESULT on vista */
ok(dwLen == (is_vista ? S_OK : 39), "wrong size %u for id %d\n", dwLen, i); ok(dwLen == (is_vista ? S_OK : 39), "wrong size %lu for id %d\n", dwLen, i);
bRet = pGUIDFromStringA(szBuff, &guid); bRet = pGUIDFromStringA(szBuff, &guid);
ok(bRet != FALSE, "created invalid string '%s'\n", szBuff); ok(bRet != FALSE, "created invalid string '%s'\n", szBuff);
...@@ -130,7 +130,7 @@ static void test_ClassIDs(void) ...@@ -130,7 +130,7 @@ static void test_ClassIDs(void)
/* Test endianness */ /* Test endianness */
dwLen = pSHStringFromGUIDA(&IID_Endianness, szBuff, 256); dwLen = pSHStringFromGUIDA(&IID_Endianness, szBuff, 256);
ok(dwLen == (is_vista ? S_OK : 39), "wrong size %u for IID_Endianness\n", dwLen); ok(dwLen == (is_vista ? S_OK : 39), "wrong size %lu for IID_Endianness\n", dwLen);
ok(!strcmp(szBuff, "{01020304-0506-0708-090A-0B0C0D0E0F0A}"), ok(!strcmp(szBuff, "{01020304-0506-0708-090A-0B0C0D0E0F0A}"),
"Endianness Broken, got '%s'\n", szBuff); "Endianness Broken, got '%s'\n", szBuff);
...@@ -171,14 +171,14 @@ static void test_CLSIDFromProgIDWrap(void) ...@@ -171,14 +171,14 @@ static void test_CLSIDFromProgIDWrap(void)
pCLSIDFromProgIDWrap = (void*)GetProcAddress(hShlwapi,(char*)435); pCLSIDFromProgIDWrap = (void*)GetProcAddress(hShlwapi,(char*)435);
hres = pCLSIDFromProgIDWrap(wszStdPicture, &clsid); hres = pCLSIDFromProgIDWrap(wszStdPicture, &clsid);
ok(hres == S_OK, "CLSIDFromProgIDWrap failed: %08x\n", hres); ok(hres == S_OK, "CLSIDFromProgIDWrap failed: %08lx\n", hres);
ok(IsEqualGUID(&CLSID_StdPicture, &clsid), "wrong clsid\n"); ok(IsEqualGUID(&CLSID_StdPicture, &clsid), "wrong clsid\n");
hres = pCLSIDFromProgIDWrap(NULL, &clsid); hres = pCLSIDFromProgIDWrap(NULL, &clsid);
ok(hres == E_INVALIDARG, "CLSIDFromProgIDWrap failed: %08x, expected E_INVALIDARG\n", hres); ok(hres == E_INVALIDARG, "CLSIDFromProgIDWrap failed: %08lx, expected E_INVALIDARG\n", hres);
hres = pCLSIDFromProgIDWrap(wszStdPicture, NULL); hres = pCLSIDFromProgIDWrap(wszStdPicture, NULL);
ok(hres == E_INVALIDARG, "CLSIDFromProgIDWrap failed: %08x, expected E_INVALIDARG\n", hres); ok(hres == E_INVALIDARG, "CLSIDFromProgIDWrap failed: %08lx, expected E_INVALIDARG\n", hres);
} }
START_TEST(clsid) START_TEST(clsid)
......
...@@ -104,44 +104,44 @@ static void test_SHCreateThreadRef(void) ...@@ -104,44 +104,44 @@ static void test_SHCreateThreadRef(void)
/* start with a clean state */ /* start with a clean state */
hr = pSHSetThreadRef(NULL); hr = pSHSetThreadRef(NULL);
ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr); ok(hr == S_OK, "got 0x%lx (expected S_OK)\n", hr);
pobj = NULL; pobj = NULL;
refcount = 0xdeadbeef; refcount = 0xdeadbeef;
hr = pSHCreateThreadRef(&refcount, &pobj); hr = pSHCreateThreadRef(&refcount, &pobj);
ok((hr == S_OK) && pobj && (refcount == 1), ok((hr == S_OK) && pobj && (refcount == 1),
"got 0x%x and %p with %d (expected S_OK and '!= NULL' with 1)\n", "got 0x%lx and %p with %ld (expected S_OK and '!= NULL' with 1)\n",
hr, pobj, refcount); hr, pobj, refcount);
/* the object is not automatic set as ThreadRef */ /* the object is not automatic set as ThreadRef */
punk = NULL; punk = NULL;
hr = pSHGetThreadRef(&punk); hr = pSHGetThreadRef(&punk);
ok( (hr == E_NOINTERFACE) && (punk == NULL), ok( (hr == E_NOINTERFACE) && (punk == NULL),
"got 0x%x and %p (expected E_NOINTERFACE and NULL)\n", hr, punk); "got 0x%lx and %p (expected E_NOINTERFACE and NULL)\n", hr, punk);
/* set the object */ /* set the object */
hr = pSHSetThreadRef(pobj); hr = pSHSetThreadRef(pobj);
ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr); ok(hr == S_OK, "got 0x%lx (expected S_OK)\n", hr);
/* read back */ /* read back */
punk = NULL; punk = NULL;
hr = pSHGetThreadRef(&punk); hr = pSHGetThreadRef(&punk);
ok( (hr == S_OK) && (punk == pobj) && (refcount == 2), ok( (hr == S_OK) && (punk == pobj) && (refcount == 2),
"got 0x%x and %p with %d (expected S_OK and %p with 2)\n", "got 0x%lx and %p with %ld (expected S_OK and %p with 2)\n",
hr, punk, refcount, pobj); hr, punk, refcount, pobj);
/* free the ref from SHGetThreadRef */ /* free the ref from SHGetThreadRef */
if (SUCCEEDED(hr)) { if (SUCCEEDED(hr)) {
hr = IUnknown_Release(pobj); hr = IUnknown_Release(pobj);
ok((hr == 1) && (hr == refcount), ok((hr == 1) && (hr == refcount),
"got %d with %d (expected 1 with 1)\n", hr, refcount); "got %ld with %ld (expected 1 with 1)\n", hr, refcount);
} }
/* free the object */ /* free the object */
if (pobj) { if (pobj) {
hr = IUnknown_Release(pobj); hr = IUnknown_Release(pobj);
ok((hr == 0) && (hr == refcount), ok((hr == 0) && (hr == refcount),
"got %d with %d (expected 0 with 0)\n", hr, refcount); "got %ld with %ld (expected 0 with 0)\n", hr, refcount);
} }
if (0) { if (0) {
...@@ -149,25 +149,25 @@ static void test_SHCreateThreadRef(void) ...@@ -149,25 +149,25 @@ static void test_SHCreateThreadRef(void)
but the object no longer exist after the *_Release */ but the object no longer exist after the *_Release */
punk = NULL; punk = NULL;
hr = pSHGetThreadRef(&punk); hr = pSHGetThreadRef(&punk);
trace("got 0x%x and %p with %d\n", hr, punk, refcount); trace("got 0x%lx and %p with %ld\n", hr, punk, refcount);
} }
/* remove the dead object pointer */ /* remove the dead object pointer */
hr = pSHSetThreadRef(NULL); hr = pSHSetThreadRef(NULL);
ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr); ok(hr == S_OK, "got 0x%lx (expected S_OK)\n", hr);
/* parameter check */ /* parameter check */
if (0) { if (0) {
/* vista: E_INVALIDARG, XP: crash */ /* vista: E_INVALIDARG, XP: crash */
pobj = NULL; pobj = NULL;
hr = pSHCreateThreadRef(NULL, &pobj); hr = pSHCreateThreadRef(NULL, &pobj);
ok(hr == E_INVALIDARG, "got 0x%x (expected E_INVALIDARG)\n", hr); ok(hr == E_INVALIDARG, "got 0x%lx (expected E_INVALIDARG)\n", hr);
refcount = 0xdeadbeef; refcount = 0xdeadbeef;
/* vista: E_INVALIDARG, XP: crash */ /* vista: E_INVALIDARG, XP: crash */
hr = pSHCreateThreadRef(&refcount, NULL); hr = pSHCreateThreadRef(&refcount, NULL);
ok( (hr == E_INVALIDARG) && (refcount == 0xdeadbeef), ok( (hr == E_INVALIDARG) && (refcount == 0xdeadbeef),
"got 0x%x with 0x%x (expected E_INVALIDARG and oxdeadbeef)\n", "got 0x%lx with 0x%lx (expected E_INVALIDARG and oxdeadbeef)\n",
hr, refcount); hr, refcount);
} }
} }
...@@ -187,7 +187,7 @@ static void test_SHGetThreadRef(void) ...@@ -187,7 +187,7 @@ static void test_SHGetThreadRef(void)
punk = NULL; punk = NULL;
hr = pSHGetThreadRef(&punk); hr = pSHGetThreadRef(&punk);
ok( (hr == E_NOINTERFACE) && (punk == NULL), ok( (hr == E_NOINTERFACE) && (punk == NULL),
"got 0x%x and %p (expected E_NOINTERFACE and NULL)\n", hr, punk); "got 0x%lx and %p (expected E_NOINTERFACE and NULL)\n", hr, punk);
if (0) { if (0) {
/* this crash on Windows */ /* this crash on Windows */
...@@ -210,7 +210,7 @@ static void test_SHSetThreadRef(void) ...@@ -210,7 +210,7 @@ static void test_SHSetThreadRef(void)
/* start with a clean state */ /* start with a clean state */
hr = pSHSetThreadRef(NULL); hr = pSHSetThreadRef(NULL);
ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr); ok(hr == S_OK, "got 0x%lx (expected S_OK)\n", hr);
/* build and set out object */ /* build and set out object */
init_threadref(&ref, &refcount); init_threadref(&ref, &refcount);
...@@ -218,7 +218,7 @@ static void test_SHSetThreadRef(void) ...@@ -218,7 +218,7 @@ static void test_SHSetThreadRef(void)
refcount = 1; refcount = 1;
hr = pSHSetThreadRef(&ref.IUnknown_iface); hr = pSHSetThreadRef(&ref.IUnknown_iface);
ok( (hr == S_OK) && (refcount == 1) && (!AddRef_called), ok( (hr == S_OK) && (refcount == 1) && (!AddRef_called),
"got 0x%x with %d, %d (expected S_OK with 1, 0)\n", "got 0x%lx with %ld, %ld (expected S_OK with 1, 0)\n",
hr, refcount, AddRef_called); hr, refcount, AddRef_called);
/* read back our object */ /* read back our object */
...@@ -227,17 +227,17 @@ static void test_SHSetThreadRef(void) ...@@ -227,17 +227,17 @@ static void test_SHSetThreadRef(void)
punk = NULL; punk = NULL;
hr = pSHGetThreadRef(&punk); hr = pSHGetThreadRef(&punk);
ok( (hr == S_OK) && (punk == &ref.IUnknown_iface) && (refcount == 2) && (AddRef_called == 1), ok( (hr == S_OK) && (punk == &ref.IUnknown_iface) && (refcount == 2) && (AddRef_called == 1),
"got 0x%x and %p with %d, %d (expected S_OK and %p with 2, 1)\n", "got 0x%lx and %p with %ld, %ld (expected S_OK and %p with 2, 1)\n",
hr, punk, refcount, AddRef_called, &ref); hr, punk, refcount, AddRef_called, &ref);
/* clear the object pointer */ /* clear the object pointer */
hr = pSHSetThreadRef(NULL); hr = pSHSetThreadRef(NULL);
ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr); ok(hr == S_OK, "got 0x%lx (expected S_OK)\n", hr);
/* verify, that our object is no longer known as ThreadRef */ /* verify, that our object is no longer known as ThreadRef */
hr = pSHGetThreadRef(&punk); hr = pSHGetThreadRef(&punk);
ok( (hr == E_NOINTERFACE) && (punk == NULL), ok( (hr == E_NOINTERFACE) && (punk == NULL),
"got 0x%x and %p (expected E_NOINTERFACE and NULL)\n", hr, punk); "got 0x%lx and %p (expected E_NOINTERFACE and NULL)\n", hr, punk);
} }
......
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