https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b8dc669cfeed6374dc0ad6...
commit b8dc669cfeed6374dc0ad6dc5caea8e1bd898454 Author: Amine Khaldi amine.khaldi@reactos.org AuthorDate: Sat Nov 30 14:50:08 2019 +0100 Commit: Amine Khaldi amine.khaldi@reactos.org CommitDate: Sat Nov 30 14:50:08 2019 +0100
[SHELL32_WINETEST] Sync with Wine Staging 4.18. CORE-16441 --- modules/rostests/winetests/shell32/autocomplete.c | 19 +++++++- modules/rostests/winetests/shell32/shellole.c | 26 +++++++++- modules/rostests/winetests/shell32/shellpath.c | 3 ++ .../rostests/winetests/shell32/shfldr_special.c | 55 ++++++++++++++++++++++ modules/rostests/winetests/shell32/shlexec.c | 22 ++++----- modules/rostests/winetests/shell32/shlfileop.c | 15 ++++++ modules/rostests/winetests/shell32/shlfolder.c | 2 + 7 files changed, 127 insertions(+), 15 deletions(-)
diff --git a/modules/rostests/winetests/shell32/autocomplete.c b/modules/rostests/winetests/shell32/autocomplete.c index 4ef124c9d2f..ce68d21f045 100644 --- a/modules/rostests/winetests/shell32/autocomplete.c +++ b/modules/rostests/winetests/shell32/autocomplete.c @@ -494,7 +494,7 @@ static void check_dropdown_(const char *file, UINT line, IAutoCompleteDropDown * } }
-static void test_aclist_expand(HWND hwnd_edit, void *enumerator) +static void test_aclist_expand(HWND hwnd_edit, void *enumerator, IAutoCompleteDropDown *acdropdown) { struct string_enumerator *obj = (struct string_enumerator*)enumerator; static WCHAR str1[] = {'t','e','s','t',0}; @@ -502,6 +502,7 @@ static void test_aclist_expand(HWND hwnd_edit, void *enumerator) static WCHAR str2[] = {'t','e','s','t','\','f','o','o','\','b','a','r','\','b','a',0}; static WCHAR str2a[] = {'t','e','s','t','\','f','o','o','\','b','a','r','\',0}; static WCHAR str2b[] = {'t','e','s','t','\','f','o','o','\','b','a','r','\','b','a','z','_','b','b','q','\',0}; + HRESULT hr; obj->num_resets = 0;
ok(obj->num_expand == 0, "Expected 0 expansions, got %u\n", obj->num_expand); @@ -546,6 +547,20 @@ static void test_aclist_expand(HWND hwnd_edit, void *enumerator) dispatch_messages(); ok(obj->num_expand == 4, "Expected 4 expansions, got %u\n", obj->num_expand); ok(obj->num_resets == 5, "Expected 5 resets, got %u\n", obj->num_resets); + SendMessageW(hwnd_edit, WM_SETTEXT, 0, (LPARAM)str1a); + SendMessageW(hwnd_edit, EM_SETSEL, ARRAY_SIZE(str1a) - 1, ARRAY_SIZE(str1a) - 1); + SendMessageW(hwnd_edit, WM_CHAR, 'f', 1); + dispatch_messages(); + ok(obj->num_expand == 5, "Expected 5 expansions, got %u\n", obj->num_expand); + ok(lstrcmpW(obj->last_expand, str1a) == 0, "Expected %s, got %s\n", wine_dbgstr_w(str1a), wine_dbgstr_w(obj->last_expand)); + ok(obj->num_resets == 6, "Expected 6 resets, got %u\n", obj->num_resets); + hr = IAutoCompleteDropDown_ResetEnumerator(acdropdown); + ok(hr == S_OK, "IAutoCompleteDropDown_ResetEnumerator failed: %x\n", hr); + SendMessageW(hwnd_edit, WM_CHAR, 'o', 1); + dispatch_messages(); + ok(obj->num_expand == 6, "Expected 6 expansions, got %u\n", obj->num_expand); + ok(lstrcmpW(obj->last_expand, str1a) == 0, "Expected %s, got %s\n", wine_dbgstr_w(str1a), wine_dbgstr_w(obj->last_expand)); + ok(obj->num_resets == 7, "Expected 7 resets, got %u\n", obj->num_resets); }
static void test_prefix_filtering(HWND hwnd_edit) @@ -775,7 +790,7 @@ static void test_custom_source(void) SendMessageW(hwnd_edit, WM_GETTEXT, ARRAY_SIZE(buffer), (LPARAM)buffer); ok(lstrcmpW(str_aut, buffer) == 0, "Expected %s, got %s\n", wine_dbgstr_w(str_aut), wine_dbgstr_w(buffer));
- test_aclist_expand(hwnd_edit, enumerator); + test_aclist_expand(hwnd_edit, enumerator, acdropdown); obj->num_resets = 0;
hr = IAutoCompleteDropDown_ResetEnumerator(acdropdown); diff --git a/modules/rostests/winetests/shell32/shellole.c b/modules/rostests/winetests/shell32/shellole.c index 27964afcd36..15d85f93029 100644 --- a/modules/rostests/winetests/shell32/shellole.c +++ b/modules/rostests/winetests/shell32/shellole.c @@ -747,6 +747,7 @@ static void test_SHCreateQueryCancelAutoPlayMoniker(void) IMoniker_Release(mon); }
+#define WM_EXPECTED_VALUE WM_APP #define DROPTEST_FILENAME "c:\wintest.bin" struct DragParam { HWND hwnd; @@ -755,11 +756,20 @@ struct DragParam {
static LRESULT WINAPI drop_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { + static BOOL expected; + switch (msg) { + case WM_EXPECTED_VALUE: + { + expected = lparam; + break; + } case WM_DROPFILES: { HDROP hDrop = (HDROP)wparam; char filename[MAX_PATH] = "dummy"; + POINT pt; + BOOL r; UINT num; num = DragQueryFileA(hDrop, 0xffffffff, NULL, 0); ok(num == 1, "expected 1, got %u\n", num); @@ -768,6 +778,10 @@ static LRESULT WINAPI drop_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARA num = DragQueryFileA(hDrop, 0, filename, sizeof(filename)); ok(num == strlen(DROPTEST_FILENAME), "got %u\n", num); ok(!strcmp(filename, DROPTEST_FILENAME), "got %s\n", filename); + r = DragQueryPoint(hDrop, &pt); + ok(r == expected, "expected %d, got %d\n", expected, r); + ok(pt.x == 10, "expected 10, got %d\n", pt.x); + ok(pt.y == 20, "expected 20, got %d\n", pt.y); DragFinish(hDrop); return 0; } @@ -822,7 +836,7 @@ static DWORD WINAPI drop_window_therad(void *arg) return 0; }
-static void test_DragQueryFile(void) +static void test_DragQueryFile(BOOL non_client_flag) { struct DragParam param; HANDLE hThread; @@ -841,6 +855,9 @@ static void test_DragQueryFile(void)
hDrop = GlobalAlloc(GHND, sizeof(DROPFILES) + (strlen(DROPTEST_FILENAME) + 2) * sizeof(WCHAR)); pDrop = GlobalLock(hDrop); + pDrop->pt.x = 10; + pDrop->pt.y = 20; + pDrop->fNC = non_client_flag; pDrop->pFiles = sizeof(DROPFILES); ret = MultiByteToWideChar(CP_ACP, 0, DROPTEST_FILENAME, -1, (LPWSTR)(pDrop + 1), strlen(DROPTEST_FILENAME) + 1); @@ -848,6 +865,9 @@ static void test_DragQueryFile(void) pDrop->fWide = TRUE; GlobalUnlock(hDrop);
+ r = PostMessageA(param.hwnd, WM_EXPECTED_VALUE, 0, !non_client_flag); + ok(r, "got %d\n", r); + r = PostMessageA(param.hwnd, WM_DROPFILES, (WPARAM)hDrop, 0); ok(r, "got %d\n", r);
@@ -860,6 +880,7 @@ static void test_DragQueryFile(void) CloseHandle(param.ready); CloseHandle(hThread); } +#undef WM_EXPECTED_VALUE #undef DROPTEST_FILENAME
static void test_SHCreateSessionKey(void) @@ -938,7 +959,8 @@ START_TEST(shellole)
test_SHPropStg_functions(); test_SHCreateQueryCancelAutoPlayMoniker(); - test_DragQueryFile(); + test_DragQueryFile(TRUE); + test_DragQueryFile(FALSE); test_SHCreateSessionKey(); test_dragdrophelper();
diff --git a/modules/rostests/winetests/shell32/shellpath.c b/modules/rostests/winetests/shell32/shellpath.c index 38b56f01d37..f768f44c8b7 100644 --- a/modules/rostests/winetests/shell32/shellpath.c +++ b/modules/rostests/winetests/shell32/shellpath.c @@ -1875,7 +1875,10 @@ if (0) { /* crashes */ path = NULL; hr = pSHGetKnownFolderPath(folder_id, KF_FLAG_DEFAULT, NULL, &path); if (FAILED(hr)) + { + ok(path == NULL, "expected path == NULL\n"); continue; + } ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr); ok(path != NULL, "expected path != NULL\n");
diff --git a/modules/rostests/winetests/shell32/shfldr_special.c b/modules/rostests/winetests/shell32/shfldr_special.c index 09d82f088ba..e2a29d73db3 100644 --- a/modules/rostests/winetests/shell32/shfldr_special.c +++ b/modules/rostests/winetests/shell32/shfldr_special.c @@ -31,6 +31,7 @@ #define WIN32_LEAN_AND_MEAN #include <windows.h> #include "shellapi.h" +#include "shlwapi.h" #include "shlobj.h"
#include "wine/test.h" @@ -240,10 +241,64 @@ static void test_desktop_folder(void) IShellFolder_Release(psf); }
+static void test_desktop_displaynameof(void) +{ + static WCHAR MyComputer[] = { ':',':','{','2','0','D','0','4','F','E','0','-','3','A','E','A','-','1','0','6','9','-','A','2','D','8','-','0','8','0','0','2','B','3','0','3','0','9','D','}', 0 }; + static WCHAR MyDocuments[] = { ':',':','{','4','5','0','D','8','F','B','A','-','A','D','2','5','-','1','1','D','0','-','9','8','A','8','-','0','8','0','0','3','6','1','B','1','1','0','3','}', 0 }; + static WCHAR RecycleBin[] = { ':',':','{','6','4','5','F','F','0','4','0','-','5','0','8','1','-','1','0','1','B','-','9','F','0','8','-','0','0','A','A','0','0','2','F','9','5','4','E','}', 0 }; + static WCHAR ControlPanel[]= { ':',':','{','2','0','D','0','4','F','E','0','-','3','A','E','A','-','1','0','6','9','-','A','2','D','8','-','0','8','0','0','2','B','3','0','3','0','9','D','}','\', + ':',':','{','2','1','E','C','2','0','2','0','-','3','A','E','A','-','1','0','6','9','-','A','2','D','D','-','0','8','0','0','2','B','3','0','3','0','9','D','}', 0 }; + static WCHAR *folders[] = { MyComputer, MyDocuments, RecycleBin, ControlPanel }; + IShellFolder *desktop; + ITEMIDLIST *pidl; + STRRET strret; + DWORD eaten; + HRESULT hr; + UINT i; + + hr = SHGetDesktopFolder(&desktop); + ok(hr == S_OK, "SHGetDesktopFolder failed with error 0x%08x\n", hr); + if (FAILED(hr)) return; + + for (i = 0; i < ARRAY_SIZE(folders); i++) + { + WCHAR name1[MAX_PATH], name2[MAX_PATH]; + + hr = IShellFolder_ParseDisplayName(desktop, NULL, NULL, folders[i], &eaten, &pidl, NULL); + ok(hr == S_OK, "IShellFolder::ParseDisplayName failed with error 0x%08x\n", hr); + if (FAILED(hr)) continue; + + hr = IShellFolder_GetDisplayNameOf(desktop, pidl, SHGDN_INFOLDER, &strret); + ok(hr == S_OK, "IShellFolder::GetDisplayNameOf failed with error 0x%08x\n", hr); + hr = StrRetToBufW(&strret, pidl, name1, ARRAY_SIZE(name1)); + ok(hr == S_OK, "StrRetToBuf failed with error 0x%08x\n", hr); + + hr = IShellFolder_GetDisplayNameOf(desktop, pidl, SHGDN_INFOLDER | SHGDN_FORPARSING | SHGDN_FORADDRESSBAR, &strret); + ok(hr == S_OK, "IShellFolder::GetDisplayNameOf failed with error 0x%08x\n", hr); + hr = StrRetToBufW(&strret, pidl, name2, ARRAY_SIZE(name2)); + ok(hr == S_OK, "StrRetToBuf failed with error 0x%08x\n", hr); + + ok(!lstrcmpW(name1, name2), "the display names are not equal: %s vs %s\n", wine_dbgstr_w(name1), wine_dbgstr_w(name2)); + ok(name1[0] != ':' || name1[1] != ':', "display name is a GUID: %s\n", wine_dbgstr_w(name1)); + + hr = IShellFolder_GetDisplayNameOf(desktop, pidl, SHGDN_INFOLDER | SHGDN_FORPARSING, &strret); + ok(hr == S_OK, "IShellFolder::GetDisplayNameOf failed with error 0x%08x\n", hr); + hr = StrRetToBufW(&strret, pidl, name1, ARRAY_SIZE(name1)); + ok(hr == S_OK, "StrRetToBuf failed with error 0x%08x\n", hr); + + ok(lstrcmpW(name1, name2), "the display names are equal: %s\n", wine_dbgstr_w(name1)); + ok(name1[0] == ':' && name1[1] == ':', "display name is not a GUID: %s\n", wine_dbgstr_w(name1)); + + ILFree(pidl); + } + IShellFolder_Release(desktop); +} + START_TEST(shfldr_special) { test_parse_for_entire_network(); test_parse_for_control_panel(); test_printers_folder(); test_desktop_folder(); + test_desktop_displaynameof(); } diff --git a/modules/rostests/winetests/shell32/shlexec.c b/modules/rostests/winetests/shell32/shlexec.c index b140280a5e0..af4b8e33850 100644 --- a/modules/rostests/winetests/shell32/shlexec.c +++ b/modules/rostests/winetests/shell32/shlexec.c @@ -119,15 +119,15 @@ static char* decodeA(const char* str) return ptr; }
-static void WINETEST_PRINTF_ATTR(2,3) childPrintf(HANDLE h, const char* fmt, ...) +static void WINAPIV WINETEST_PRINTF_ATTR(2,3) childPrintf(HANDLE h, const char* fmt, ...) { - va_list valist; + __ms_va_list valist; char buffer[1024]; DWORD w;
- va_start(valist, fmt); + __ms_va_start(valist, fmt); vsprintf(buffer, fmt, valist); - va_end(valist); + __ms_va_end(valist); WriteFile(h, buffer, strlen(buffer), &w, NULL); }
@@ -353,16 +353,16 @@ static void dump_child_(const char* file, int line) ***/
static char shell_call[2048]; -static void WINETEST_PRINTF_ATTR(2,3) _okShell(int condition, const char *msg, ...) +static void WINAPIV WINETEST_PRINTF_ATTR(2,3) _okShell(int condition, const char *msg, ...) { - va_list valist; + __ms_va_list valist; char buffer[2048];
strcpy(buffer, shell_call); strcat(buffer, " "); - va_start(valist, msg); + __ms_va_start(valist, msg); vsprintf(buffer+strlen(buffer), msg, valist); - va_end(valist); + __ms_va_end(valist); winetest_ok(condition, "%s", buffer); } #define okShell_(file, line) (winetest_set_location(file, line), 0) ? (void)0 : _okShell @@ -2831,7 +2831,7 @@ static void test_directory(void) okShell(rc > 32, "returned %lu\n", rc); okChildInt("argcA", 4); okChildString("argvA3", "Exec"); - todo_wine okChildPath("longPath", path); + okChildPath("longPath", path); SetCurrentDirectoryA(curdir);
rc=shell_execute_ex(SEE_MASK_NOZONECHECKS|SEE_MASK_FLAG_NO_UI, @@ -2844,7 +2844,7 @@ static void test_directory(void) okShell(rc > 32, "returned %lu\n", rc); okChildInt("argcA", 4); okChildString("argvA3", "Exec"); - todo_wine okChildPath("longPath", path); + okChildPath("longPath", path);
/* Specify it through an environment variable */ rc=shell_execute_ex(SEE_MASK_NOZONECHECKS|SEE_MASK_FLAG_NO_UI, @@ -2856,7 +2856,7 @@ static void test_directory(void) okShell(rc > 32, "returned %lu\n", rc); okChildInt("argcA", 4); okChildString("argvA3", "Exec"); - todo_wine okChildPath("longPath", path); + okChildPath("longPath", path);
/* Not a colon-separated directory list */ sprintf(dirpath, "%s:%s", curdir, tmpdir); diff --git a/modules/rostests/winetests/shell32/shlfileop.c b/modules/rostests/winetests/shell32/shlfileop.c index 9768e18de33..32870dc93ed 100644 --- a/modules/rostests/winetests/shell32/shlfileop.c +++ b/modules/rostests/winetests/shell32/shlfileop.c @@ -2547,6 +2547,7 @@ static void test_unicode(void) int ret; HANDLE file; static const WCHAR UNICODE_PATH_TO[] = {'c',':','\',0x00ae,0x00ae,'\0'}; + HWND hwnd;
shfoW.hwnd = NULL; shfoW.wFunc = FO_DELETE; @@ -2637,6 +2638,20 @@ static void test_unicode(void) ok(GetLastError() == ERROR_SUCCESS || broken(GetLastError() == ERROR_INVALID_HANDLE), /* WinXp, win2k3 */ "Expected ERROR_SUCCESS, got %d\n", GetLastError()); + + /* Check SHCreateDirectoryExW with a Hwnd + * returns ERROR_ALREADY_EXISTS where a directory already exists */ + /* Get any window handle */ + hwnd = FindWindowA(NULL, NULL); + ok(hwnd != 0, "FindWindowA failed to produce a hwnd\n"); + ret = SHCreateDirectoryExW(hwnd, UNICODE_PATH, NULL); + ok(!ret, "SHCreateDirectoryExW returned %d\n", ret); + /* Create already-existing directory */ + ok(file_existsW(UNICODE_PATH), "The directory was not created\n"); + ret = SHCreateDirectoryExW(hwnd, UNICODE_PATH, NULL); + ok(ret == ERROR_ALREADY_EXISTS, + "Expected ERROR_ALREADY_EXISTS, got %d\n", ret); + RemoveDirectoryW(UNICODE_PATH); }
static void diff --git a/modules/rostests/winetests/shell32/shlfolder.c b/modules/rostests/winetests/shell32/shlfolder.c index f2bd6408ab7..4f22273c452 100644 --- a/modules/rostests/winetests/shell32/shlfolder.c +++ b/modules/rostests/winetests/shell32/shlfolder.c @@ -3859,6 +3859,8 @@ static void test_ShellItemArrayEnumItems(void) for(i = 0; i < done; i++) ILFree(apidl[i]); } + + IShellFolder_Release(psf); }