[SHLWAPI_WINETEST] Sync with Wine Staging 1.7.47. CORE-9924

svn path=/trunk/; revision=68502
This commit is contained in:
Amine Khaldi 2015-07-20 22:58:24 +00:00
parent 3bed48c060
commit b652ba2ef1
4 changed files with 108 additions and 10 deletions

View file

@ -489,7 +489,8 @@ static void test_SHCreateStreamOnFileEx(DWORD mode, DWORD stgm)
static const CHAR testEx_txt[] = "\\testEx.txt";
BOOL delret;
trace("SHCreateStreamOnFileEx: testing mode %d, STGM flags %08x\n", mode, stgm);
if (winetest_debug > 1)
trace("SHCreateStreamOnFileEx: testing mode %d, STGM flags %08x\n", mode, stgm);
/* Don't used a fixed path for the testEx.txt file */
GetTempPathA(MAX_PATH, test_fileA);

View file

@ -75,6 +75,7 @@ static HRESULT (WINAPI *pSKSetValueW)(DWORD, LPCWSTR, LPCWSTR, DWORD, void*, DWO
static HRESULT (WINAPI *pSKDeleteValueW)(DWORD, LPCWSTR, LPCWSTR);
static HRESULT (WINAPI *pSKAllocValueW)(DWORD, LPCWSTR, LPCWSTR, DWORD*, void**, DWORD*);
static HWND (WINAPI *pSHSetParentHwnd)(HWND, HWND);
static HRESULT (WINAPI *pIUnknown_GetClassID)(IUnknown*, CLSID*);
static HMODULE hmlang;
static HRESULT (WINAPI *pLcidToRfc1766A)(LCID, LPSTR, INT);
@ -553,10 +554,10 @@ static void test_alloc_shared_remote(DWORD procid, HANDLE hmem)
hmem2 = pSHMapHandle(hmem, procid, GetCurrentProcessId(), 0, 0);
/* It seems like Windows Vista/2008 uses a different internal implementation
* for shared memory, and calling SHMapHandle fails with ERROR_INVALID_HANDLE. */
ok(hmem2 != NULL || broken(hmem2 == NULL && GetLastError() == ERROR_INVALID_HANDLE),
* for shared memory, and calling SHMapHandle fails. */
ok(hmem2 != NULL || broken(hmem2 == NULL),
"SHMapHandle failed: %u\n", GetLastError());
if (hmem2 == NULL && GetLastError() == ERROR_INVALID_HANDLE)
if (hmem2 == NULL)
{
win_skip("Subprocess failed to map shared memory, skipping test\n");
return;
@ -3053,6 +3054,7 @@ static void init_pointers(void)
MAKEFUNC(SHSetWindowBits, 165);
MAKEFUNC(SHSetParentHwnd, 167);
MAKEFUNC(ConnectToConnectionPoint, 168);
MAKEFUNC(IUnknown_GetClassID, 175);
MAKEFUNC(SHSearchMapInt, 198);
MAKEFUNC(SHCreateWorkerWindowA, 257);
MAKEFUNC(GUIDFromStringA, 269);
@ -3158,6 +3160,95 @@ static void test_SHSetParentHwnd(void)
DestroyWindow(hwnd2);
}
static HRESULT WINAPI testpersist_QI(IPersist *iface, REFIID riid, void **obj)
{
if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IPersist)) {
*obj = iface;
IPersist_AddRef(iface);
return S_OK;
}
*obj = NULL;
return E_NOINTERFACE;
}
static HRESULT WINAPI testpersist_QI2(IPersist *iface, REFIID riid, void **obj)
{
if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IPersistFolder)) {
*obj = iface;
IPersist_AddRef(iface);
return S_OK;
}
*obj = NULL;
return E_NOINTERFACE;
}
static ULONG WINAPI testpersist_AddRef(IPersist *iface)
{
return 2;
}
static ULONG WINAPI testpersist_Release(IPersist *iface)
{
return 1;
}
static HRESULT WINAPI testpersist_GetClassID(IPersist *iface, CLSID *clsid)
{
memset(clsid, 0xab, sizeof(*clsid));
return 0x8fff2222;
}
static IPersistVtbl testpersistvtbl = {
testpersist_QI,
testpersist_AddRef,
testpersist_Release,
testpersist_GetClassID
};
static IPersistVtbl testpersist2vtbl = {
testpersist_QI2,
testpersist_AddRef,
testpersist_Release,
testpersist_GetClassID
};
static IPersist testpersist = { &testpersistvtbl };
static IPersist testpersist2 = { &testpersist2vtbl };
static void test_IUnknown_GetClassID(void)
{
CLSID clsid, clsid2, clsid3;
HRESULT hr;
if (0) /* crashes on native systems */
hr = pIUnknown_GetClassID(NULL, NULL);
memset(&clsid, 0xcc, sizeof(clsid));
memset(&clsid3, 0xcc, sizeof(clsid3));
hr = pIUnknown_GetClassID(NULL, &clsid);
ok(hr == E_FAIL, "got 0x%08x\n", hr);
ok(IsEqualCLSID(&clsid, &CLSID_NULL) || broken(IsEqualCLSID(&clsid, &clsid3)) /* win2k, winxp, win2k3 */,
"got wrong clsid %s\n", wine_dbgstr_guid(&clsid));
memset(&clsid, 0xcc, sizeof(clsid));
memset(&clsid2, 0xab, sizeof(clsid2));
hr = pIUnknown_GetClassID((IUnknown*)&testpersist, &clsid);
ok(hr == 0x8fff2222, "got 0x%08x\n", hr);
ok(IsEqualCLSID(&clsid, &clsid2) || broken(IsEqualCLSID(&clsid, &clsid3)) /* win2k3 */,
"got wrong clsid %s\n", wine_dbgstr_guid(&clsid));
/* IPersistFolder is also supported */
memset(&clsid, 0xcc, sizeof(clsid));
memset(&clsid2, 0xab, sizeof(clsid2));
memset(&clsid3, 0xcc, sizeof(clsid3));
hr = pIUnknown_GetClassID((IUnknown*)&testpersist2, &clsid);
ok(hr == 0x8fff2222, "got 0x%08x\n", hr);
ok(IsEqualCLSID(&clsid, &clsid2) || broken(IsEqualCLSID(&clsid, &clsid3)) /* win2k3 */,
"got wrong clsid %s\n", wine_dbgstr_guid(&clsid));
}
START_TEST(ordinal)
{
char **argv;
@ -3212,6 +3303,7 @@ START_TEST(ordinal)
test_SHSetIniString();
test_SHGetShellKey();
test_SHSetParentHwnd();
test_IUnknown_GetClassID();
FreeLibrary(hshell32);
FreeLibrary(hmlang);

View file

@ -188,13 +188,18 @@ static const struct {
/* ################ */
static LPWSTR GetWideString(const char* szString)
static LPWSTR GetWideString(const char *src)
{
LPWSTR wszString = HeapAlloc(GetProcessHeap(), 0, (2*INTERNET_MAX_URL_LENGTH) * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, szString, -1, wszString, INTERNET_MAX_URL_LENGTH);
WCHAR *ret;
return wszString;
if (!src)
return NULL;
ret = HeapAlloc(GetProcessHeap(), 0, (2*INTERNET_MAX_URL_LENGTH) * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, src, -1, ret, INTERNET_MAX_URL_LENGTH);
return ret;
}
static void FreeWideString(LPWSTR wszString)

View file

@ -1150,7 +1150,7 @@ static void test_url_combine(const char *szUrl1, const char *szUrl2, DWORD dwFla
if (todo)
{
todo_wine ok(dwSize == dwExpectLen && (!SUCCEEDED(hr) || strcmp(szReturnUrl, szExpectUrl)==0),
todo_wine ok(dwSize == dwExpectLen && (FAILED(hr) || strcmp(szReturnUrl, szExpectUrl)==0),
"Expected %s (len=%d), but got %s (len=%d)\n", szExpectUrl, dwExpectLen, SUCCEEDED(hr) ? szReturnUrl : "(null)", dwSize);
}
else