From 94cda5e0777ea9271f43b51ad9f931c4f7ab18a6 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Tue, 12 Jul 2016 10:49:51 +0000 Subject: [PATCH] [SHELL32_WINETEST] Sync with Wine Staging 1.9.14. svn path=/trunk/; revision=71900 --- rostests/winetests/shell32/appbar.c | 5 ++- rostests/winetests/shell32/assoc.c | 48 +++++++++++++++----------- rostests/winetests/shell32/brsfolder.c | 14 +++----- rostests/winetests/shell32/ebrowser.c | 12 +++---- rostests/winetests/shell32/shlfolder.c | 4 +-- 5 files changed, 39 insertions(+), 44 deletions(-) diff --git a/rostests/winetests/shell32/appbar.c b/rostests/winetests/shell32/appbar.c index ca72f3fd43a..dbac4e64f4e 100644 --- a/rostests/winetests/shell32/appbar.c +++ b/rostests/winetests/shell32/appbar.c @@ -196,9 +196,8 @@ static void register_testwindow_class(void) #define test_window_rects(a, b) \ ok(!IntersectRect(&rc, &windows[a].allocated_rect, &windows[b].allocated_rect), \ - "rectangles intersect (%i,%i,%i,%i)/(%i,%i,%i,%i)\n", \ - windows[a].allocated_rect.left, windows[a].allocated_rect.top, windows[a].allocated_rect.right, windows[a].allocated_rect.bottom, \ - windows[b].allocated_rect.left, windows[b].allocated_rect.top, windows[b].allocated_rect.right, windows[b].allocated_rect.bottom) + "rectangles intersect %s / %s\n", wine_dbgstr_rect(&windows[a].allocated_rect), \ + wine_dbgstr_rect(&windows[b].allocated_rect)) static void test_setpos(void) { diff --git a/rostests/winetests/shell32/assoc.c b/rostests/winetests/shell32/assoc.c index c4250389f9b..2cd06d2c08e 100644 --- a/rostests/winetests/shell32/assoc.c +++ b/rostests/winetests/shell32/assoc.c @@ -104,31 +104,36 @@ static void getstring_test(LPCWSTR assocName, HKEY progIdKey, ASSOCSTR str, LPCW { IQueryAssociations *assoc; HRESULT hr; - WCHAR *buffer; + WCHAR *buffer = NULL; DWORD len; hr = CoCreateInstance(&CLSID_QueryAssociations, NULL, CLSCTX_INPROC_SERVER, &IID_IQueryAssociations, (void*)&assoc); ok_(__FILE__, line)(hr == S_OK, "failed to create IQueryAssociations, 0x%x\n", hr); - hr = IQueryAssociations_Init(assoc, 0, assocName, progIdKey, NULL); + hr = IQueryAssociations_Init(assoc, ASSOCF_NONE, assocName, progIdKey, NULL); ok_(__FILE__, line)(hr == S_OK, "IQueryAssociations::Init failed, 0x%x\n", hr); - hr = IQueryAssociations_GetString(assoc, 0, str, NULL, NULL, &len); - if (hr != S_FALSE) { - if (expected_string) { - ok_(__FILE__, line)(SUCCEEDED(hr), "GetString returned 0x%x, expected success\n", hr); - } else { - ok_(__FILE__, line)(FAILED(hr), "GetString returned 0x%x, expected failure\n", hr); + hr = IQueryAssociations_GetString(assoc, ASSOCF_NONE, str, NULL, NULL, &len); + if (expected_string) { + ok_(__FILE__, line)(hr == S_FALSE, "GetString returned 0x%x, expected S_FALSE\n", hr); + if (hr != S_FALSE) { + /* don't try to allocate memory using uninitialized len */ + IQueryAssociations_Release(assoc); + return; } - } - buffer = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); - ok_(__FILE__, line)(buffer != NULL, "out of memory\n"); - hr = IQueryAssociations_GetString(assoc, 0, str, NULL, buffer, &len); + buffer = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + ok_(__FILE__, line)(buffer != NULL, "out of memory\n"); + hr = IQueryAssociations_GetString(assoc, 0, str, NULL, buffer, &len); + ok_(__FILE__, line)(hr == S_OK, "GetString returned 0x%x, expected S_OK\n", hr); - if (expected_string) { ok_(__FILE__, line)(lstrcmpW(buffer, expected_string) == 0, "GetString returned %s, expected %s\n", wine_dbgstr_w(buffer), wine_dbgstr_w(expected_string)); + } else { + ok_(__FILE__, line)(FAILED(hr), "GetString returned 0x%x, expected failure\n", hr); } + + IQueryAssociations_Release(assoc); + HeapFree(GetProcessHeap(), 0, buffer); } static void test_IQueryAssociations_GetString(void) @@ -176,17 +181,18 @@ static void test_IQueryAssociations_GetString(void) getstring_test(test_progidW, NULL, ASSOCSTR_DEFAULTICON, test_iconW, __LINE__); getstring_test(NULL, test_progid_key, ASSOCSTR_DEFAULTICON, test_iconW, __LINE__); - RegDeleteKeyW(HKEY_CLASSES_ROOT, test_extensionW); + RegDeleteKeyW(test_progid_key, DefaultIconW); RegDeleteKeyW(HKEY_CLASSES_ROOT, test_progidW); + RegDeleteKeyW(HKEY_CLASSES_ROOT, test_extensionW); hr = CoCreateInstance(&CLSID_QueryAssociations, NULL, CLSCTX_INPROC_SERVER, &IID_IQueryAssociations, (void*)&assoc); ok(hr == S_OK, "failed to create object, 0x%x\n", hr); - hr = IQueryAssociations_Init(assoc, 0, httpW, NULL, NULL); + hr = IQueryAssociations_Init(assoc, ASSOCF_NONE, httpW, NULL, NULL); ok(hr == S_OK, "Init failed, 0x%x\n", hr); len = 0; - hr = IQueryAssociations_GetString(assoc, 0, ASSOCSTR_EXECUTABLE, NULL, NULL, &len); + hr = IQueryAssociations_GetString(assoc, ASSOCF_NONE, ASSOCSTR_EXECUTABLE, NULL, NULL, &len); ok(hr == S_FALSE, "got 0x%08x\n", hr); ok(len > 0, "got wrong needed length, %d\n", len); @@ -195,7 +201,7 @@ static void test_IQueryAssociations_GetString(void) WCHAR buffW[MAX_PATH]; DWORD len; - hr = IQueryAssociations_Init(assoc, 0, ptr->key, NULL, NULL); + hr = IQueryAssociations_Init(assoc, ASSOCF_NONE, ptr->key, NULL, NULL); ok(hr == S_OK, "%d: Init failed, 0x%x\n", i, hr); len = ptr->len; @@ -232,17 +238,17 @@ static void test_IQueryAssociations_Init(void) hr = CoCreateInstance(&CLSID_QueryAssociations, NULL, CLSCTX_INPROC_SERVER, &IID_IQueryAssociations, (void*)&assoc); ok(hr == S_OK, "failed to create object, 0x%x\n", hr); - hr = IQueryAssociations_Init(assoc, 0, NULL, NULL, NULL); + hr = IQueryAssociations_Init(assoc, ASSOCF_NONE, NULL, NULL, NULL); ok(hr == E_INVALIDARG, "Init failed, 0x%08x\n", hr); - hr = IQueryAssociations_Init(assoc, 0, httpW, NULL, NULL); + hr = IQueryAssociations_Init(assoc, ASSOCF_NONE, httpW, NULL, NULL); ok(hr == S_OK, "Init failed, 0x%08x\n", hr); - hr = IQueryAssociations_Init(assoc, 0, badW, NULL, NULL); + hr = IQueryAssociations_Init(assoc, ASSOCF_NONE, badW, NULL, NULL); ok(hr == S_OK || broken(hr == S_FALSE) /* pre-vista */, "Init failed, 0x%08x\n", hr); len = 0; - hr = IQueryAssociations_GetString(assoc, 0, ASSOCSTR_EXECUTABLE, NULL, NULL, &len); + hr = IQueryAssociations_GetString(assoc, ASSOCF_NONE, ASSOCSTR_EXECUTABLE, NULL, NULL, &len); ok(hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION) || broken(hr == E_FAIL) /* pre-vista */, "got 0x%08x\n", hr); IQueryAssociations_Release(assoc); diff --git a/rostests/winetests/shell32/brsfolder.c b/rostests/winetests/shell32/brsfolder.c index 0ef5bb15fe4..bf29d1169f2 100644 --- a/rostests/winetests/shell32/brsfolder.c +++ b/rostests/winetests/shell32/brsfolder.c @@ -248,10 +248,8 @@ static void test_click_make_new_folder_button(void) shfileop.fFlags = FOF_NOCONFIRMATION|FOF_NOERRORUI|FOF_SILENT; SHFileOperationA(&shfileop); - if (pidl) - CoTaskMemFree(pidl); - if (test_folder_pidl) - CoTaskMemFree(test_folder_pidl); + CoTaskMemFree(pidl); + CoTaskMemFree(test_folder_pidl); test_folder_object->lpVtbl->Release(test_folder_object); CoUninitialize(); @@ -346,16 +344,12 @@ static void test_selection(void) /* test without flags */ bi.ulFlags = 0; pidl = SHBrowseForFolderA(&bi); - - if (pidl) - CoTaskMemFree(pidl); + CoTaskMemFree(pidl); /* test with flag */ bi.ulFlags = BIF_NEWDIALOGSTYLE; pidl = SHBrowseForFolderA(&bi); - - if (pidl) - CoTaskMemFree(pidl); + CoTaskMemFree(pidl); IShellFolder_Release(desktop_object); diff --git a/rostests/winetests/shell32/ebrowser.c b/rostests/winetests/shell32/ebrowser.c index 57f52c9ec22..56d20dc108d 100644 --- a/rostests/winetests/shell32/ebrowser.c +++ b/rostests/winetests/shell32/ebrowser.c @@ -818,8 +818,7 @@ static void test_initialization(void) ok(hr == S_OK, "Got 0x%08x\n", hr); GetClientRect(eb_hwnd, &eb_rc); - ok(EqualRect(&eb_rc, &exp_rc), "Got client rect (%d, %d)-(%d, %d)\n", - eb_rc.left, eb_rc.top, eb_rc.right, eb_rc.bottom); + ok(EqualRect(&eb_rc, &exp_rc), "Got client rect %s\n", wine_dbgstr_rect(&eb_rc)); GetWindowRect(eb_hwnd, &eb_rc); ok(eb_rc.right - eb_rc.left == 50, "Got window width %d\n", eb_rc.right - eb_rc.left); @@ -1142,8 +1141,7 @@ static void test_basics(void) GetClientRect(eb_hwnd, &eb_rc); MapWindowPoints(eb_hwnd, hwnd, (POINT*)&eb_rc, 2); - ok(EqualRect(&eb_rc, &exp_rc), "Got rect (%d, %d) - (%d, %d)\n", - eb_rc.left, eb_rc.top, eb_rc.right, eb_rc.bottom); + ok(EqualRect(&eb_rc, &exp_rc), "Got rect %s\n", wine_dbgstr_rect(&eb_rc)); /* Try resizing with invalid hdwp */ rc.bottom = 25; @@ -1152,16 +1150,14 @@ static void test_basics(void) ok(hr == E_FAIL, "Got 0x%08x\n", hr); GetClientRect(eb_hwnd, &eb_rc); MapWindowPoints(eb_hwnd, hwnd, (POINT*)&eb_rc, 2); - ok(EqualRect(&eb_rc, &exp_rc), "Got rect (%d, %d) - (%d, %d)\n", - eb_rc.left, eb_rc.top, eb_rc.right, eb_rc.bottom); + ok(EqualRect(&eb_rc, &exp_rc), "Got rect %s\n", wine_dbgstr_rect(&eb_rc)); hdwp = NULL; hr = IExplorerBrowser_SetRect(peb, &hdwp, rc); ok(hr == S_OK, "Got 0x%08x\n", hr); GetClientRect(eb_hwnd, &eb_rc); MapWindowPoints(eb_hwnd, hwnd, (POINT*)&eb_rc, 2); - ok(EqualRect(&eb_rc, &exp_rc2), "Got rect (%d, %d) - (%d, %d)\n", - eb_rc.left, eb_rc.top, eb_rc.right, eb_rc.bottom); + ok(EqualRect(&eb_rc, &exp_rc2), "Got rect %s\n", wine_dbgstr_rect(&eb_rc)); IShellBrowser_Release(psb); } diff --git a/rostests/winetests/shell32/shlfolder.c b/rostests/winetests/shell32/shlfolder.c index 3e0a7a1ff5b..8f62a481b4c 100644 --- a/rostests/winetests/shell32/shlfolder.c +++ b/rostests/winetests/shell32/shlfolder.c @@ -3088,7 +3088,7 @@ static void test_SHGetIDListFromObject(void) punkimpl->ifaces = ifaces; punkimpl->unknown = 0; - hres = pSHGetIDListFromObject((IUnknown*)punkimpl, &pidl); + hres = pSHGetIDListFromObject(&punkimpl->IUnknown_iface, &pidl); ok(hres == E_NOINTERFACE, "Got %x\n", hres); ok(ifaces[0].count, "interface not requested.\n"); ok(ifaces[1].count, "interface not requested.\n"); @@ -3260,7 +3260,7 @@ static void test_SHGetItemFromObject(void) punkimpl->unknown = 0; /* The same as SHGetIDListFromObject */ - hres = pSHGetIDListFromObject((IUnknown*)punkimpl, &pidl); + hres = pSHGetIDListFromObject(&punkimpl->IUnknown_iface, &pidl); ok(hres == E_NOINTERFACE, "Got %x\n", hres); ok(ifaces[0].count, "interface not requested.\n"); ok(ifaces[1].count, "interface not requested.\n"); -- 2.17.1