Changelog - dlls/shell32/shlfileop.c Fix a return value in SHFileOperation and add some extra tests to internal helper functions necessary to deal with shortcomings of kernel32 functions for the time being. - dlls/shell32/tests/shlfileop.c Fix the last two shell32 test errors under Win98 I'm currently planning on reorganizing SHFileOperation to make it managable as well as get some special quirks out of it. For the time being I left the W98_FO_FUNCTION define in for some extended tests to compare with existing systems. Rolf Kalbermatter Index: dlls/shell32/shlfileop.c =================================================================== RCS file: /home/wine/wine/dlls/shell32/shlfileop.c,v retrieving revision 1.33 diff -u -r1.33 shlfileop.c --- dlls/shell32/shlfileop.c 5 Sep 2003 23:08:31 -0000 1.33 +++ dlls/shell32/shlfileop.c 26 Sep 2003 20:04:19 -0000 @@ -258,7 +258,11 @@ implementation does create directories with wildcard characters without objection!! Once this is fixed, this here can go away. */ SetLastError(ERROR_INVALID_NAME); +#ifdef W98_FO_FUNCTION /* W98 */ + return ERROR_FILE_NOT_FOUND; +#else return ERROR_INVALID_NAME; +#endif } if (CreateDirectoryW(path, sec)) @@ -413,6 +417,19 @@ TRACE("(%s %s %s)\n", debugstr_w(src), debugstr_w(dest), bRename ? "renameIfExists" : ""); + if (StrPBrkW(dest, wWildcardChars)) + { + /* FIXME: This test is currently necessary since our MoveFile + implementation does create files with wildcard characters + without objection!! Once this is fixed, this here can go away. */ + SetLastError(ERROR_INVALID_NAME); +#ifdef W98_FO_FUNCTION /* W98 */ + return ERROR_FILE_NOT_FOUND; +#else + return ERROR_INVALID_NAME; +#endif + } + ret = MoveFileW(src, dest); if (!ret) { @@ -946,16 +963,11 @@ if (FO_RENAME == FuncSwitch) { /* temporary only for FO_RENAME */ -/* ??? b_Mask = (NULL != strrbrk(pFrom,"*?")); */ if (b_MultiTo || b_MultiFrom || (b_Mask && !b_ToInvalidTail)) { - /* no work, only RC=0 */ -/* ??? nFileOp.fAnyOperationsAborted = TRUE; */ -/*#define W98_FO_RENEME */ -#ifdef W98_FO_RENEME - goto shfileop_normal; +#ifndef W98_FO_FUNCTION + retCode = ERROR_GEN_FAILURE; /* W2K ERROR_GEN_FAILURE, W98 returns no error */ #endif - retCode = 0x1; /* 1 value unknown, W98 returns no error */ goto shfileop_error; } } Index: dlls/shell32/tests/shlfileop.c =================================================================== RCS file: /home/wine/wine/dlls/shell32/tests/shlfileop.c,v retrieving revision 1.9 diff -u -r1.9 shlfileop.c --- dlls/shell32/tests/shlfileop.c 5 Sep 2003 23:08:30 -0000 1.9 +++ dlls/shell32/tests/shlfileop.c 26 Sep 2003 20:04:19 -0000 @@ -21,6 +21,7 @@ #include <stdarg.h> #include <stdio.h> +#define WINE_NOWINSOCK #include "windef.h" #include "winbase.h" #include "wtypes.h" @@ -153,6 +154,7 @@ SHFILEOPSTRUCTA shfo, shfo2; CHAR from[MAX_PATH]; CHAR to[MAX_PATH]; + DWORD retval; shfo.hwnd = NULL; shfo.wFunc = FO_RENAME; @@ -175,7 +177,8 @@ set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0"); set_curr_dir_path(to, "test6.txt\0test7.txt\0test8.txt\0"); - ok(SHFileOperationA(&shfo), "Can't rename many files"); + retval = SHFileOperationA(&shfo); /* W98 returns 0, W2K and newer returns ERROR_GEN_FAILURE, both do nothing */ + ok(!retval || retval == ERROR_GEN_FAILURE, "Can't rename many files, retval = %lx", retval); ok(file_exists(".\\test1.txt"), "The file is not renamed - many files are specified "); memcpy(&shfo2, &shfo, sizeof(SHFILEOPSTRUCTA)); @@ -183,14 +186,15 @@ set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0"); set_curr_dir_path(to, "test6.txt\0test7.txt\0test8.txt\0"); - ok(SHFileOperationA(&shfo2), "Can't rename many files"); + retval = SHFileOperationA(&shfo2); /* W98 returns 0, W2K and newer returns ERROR_GEN_FAILURE, both do nothing */ + ok(!retval || retval == ERROR_GEN_FAILURE, "Can't rename many files, retval = %lx", retval); ok(file_exists(".\\test1.txt"), "The file is not renamed - many files are specified "); set_curr_dir_path(from, "test1.txt\0"); set_curr_dir_path(to, "test6.txt\0"); ok(!SHFileOperationA(&shfo), "Rename file"); ok(!file_exists(".\\test1.txt"), "The file is renamed"); - ok(file_exists(".\\test6.txt"), "The file is renamed "); + ok(file_exists(".\\test6.txt"), "The file is renamed"); set_curr_dir_path(from, "test6.txt\0"); set_curr_dir_path(to, "test1.txt\0"); ok(!SHFileOperationA(&shfo), "Rename file back");