From: Bernhard Übelacker bernhardu@mailbox.org
Followup of 0eab97ffa8. --- dlls/shell32/tests/shlfileop.c | 75 +++++++++++++++------------------- 1 file changed, 32 insertions(+), 43 deletions(-)
diff --git a/dlls/shell32/tests/shlfileop.c b/dlls/shell32/tests/shlfileop.c index d69995d06eb..96d21317a94 100644 --- a/dlls/shell32/tests/shlfileop.c +++ b/dlls/shell32/tests/shlfileop.c @@ -46,7 +46,7 @@ broken(retval == ret_prewin32),\ "Expected %d, got %ld\n", ret, retval)
-static BOOL old_shell32 = FALSE; +static DLLVERSIONINFO dllver;
static CHAR CURR_DIR[MAX_PATH]; static const WCHAR UNICODE_PATH[] = L"c:\\x00ae\0"; @@ -831,9 +831,17 @@ static void test_rename(void) check_file_operation(FO_RENAME, FOF_NO_UI, "test1.txt\0", "test2.txt\0", ERROR_SUCCESS, FALSE, FALSE, FALSE); - check_file_operation(FO_RENAME, FOF_NO_UI, - "testdir2\0", "testdir4\0", - ERROR_SUCCESS, FALSE, TRUE, FALSE); + /* Hangs with Windows 7 */ + if (winetest_platform_is_wine || + dllver.dwMajorVersion > 6 || + (dllver.dwMajorVersion == 6 && dllver.dwMinorVersion > 1)) + { + check_file_operation(FO_RENAME, FOF_NO_UI, + "testdir2\0", "testdir4\0", + ERROR_SUCCESS, FALSE, TRUE, FALSE); + } + else + win_skip("Skip FO_RENAME with already existing target directory.\n");
/* Empty source or target. */ clean_after_shfo_tests(); @@ -2489,42 +2497,26 @@ test_shlmenu(void) { DestroyMenu (src_menu); }
-/* Check for old shell32 (4.0.x) */ -static BOOL is_old_shell32(void) +/* Documentation states function DllGetVersion appeared first in shell32.dll version 4.71. */ +static void init_dllver(void) { - SHFILEOPSTRUCTA shfo; - CHAR from[5*MAX_PATH]; - CHAR to[5*MAX_PATH]; - DWORD retval; + HMODULE hdll; + HRESULT (WINAPI *pDllGetVersion)(DLLVERSIONINFO*);
- shfo.hwnd = NULL; - shfo.wFunc = FO_COPY; - shfo.pFrom = from; - shfo.pTo = to; - /* FOF_NOCONFIRMMKDIR is needed for old shell32 */ - shfo.fFlags = FOF_NOCONFIRMATION | FOF_SILENT | FOF_NOERRORUI | FOF_MULTIDESTFILES | FOF_NOCONFIRMMKDIR; - shfo.hNameMappings = NULL; - shfo.lpszProgressTitle = NULL; - - set_curr_dir_path(from, "test1.txt\0test2.txt\0test3.txt\0"); - set_curr_dir_path(to, "test6.txt\0test7.txt\0"); - retval = SHFileOperationA(&shfo); - - /* Delete extra files on old shell32 and Vista+*/ - DeleteFileA("test6.txt\test1.txt"); - /* Delete extra files on old shell32 */ - DeleteFileA("test6.txt\test2.txt"); - DeleteFileA("test6.txt\test3.txt"); - /* Delete extra directory on old shell32 and Vista+ */ - RemoveDirectoryA("test6.txt"); - /* Delete extra files/directories on Vista+*/ - DeleteFileA("test7.txt\test2.txt"); - RemoveDirectoryA("test7.txt"); - - if (retval == ERROR_SUCCESS) - return TRUE; - - return FALSE; + hdll=GetModuleHandleA("shell32.dll"); + pDllGetVersion=(void*)GetProcAddress(hdll, "DllGetVersion"); + if (pDllGetVersion) + { + dllver.cbSize=sizeof(dllver); + pDllGetVersion(&dllver); + trace("major=%ld minor=%ld build=%ld platform=%ld\n", + dllver.dwMajorVersion, dllver.dwMinorVersion, + dllver.dwBuildNumber, dllver.dwPlatformID); + } + else + { + memset(&dllver, 0, sizeof(dllver)); + } }
struct progress_sink @@ -3199,11 +3191,8 @@ static void test_file_operation(void)
START_TEST(shlfileop) { - clean_after_shfo_tests(); - - init_shfo_tests(); - old_shell32 = is_old_shell32(); - if (old_shell32) + init_dllver(); + if (dllver.dwMajorVersion < 4 || (dllver.dwMajorVersion == 4 && dllver.dwMinorVersion < 71)) win_skip("Need to cater for old shell32 (4.0.x) on Win95\n");
clean_after_shfo_tests();