Hi,
As you can see in the attached patch file, I wrote a function file_operation_on_data() which uses a WIN32_FIND_DATAW to do a file operation; however, for some reason, tests start to fire when using the function:
../../../tools/runtest -q -P wine -M shell32.dll -T ../../.. -p shell32_test.exe.so shellpath.c && touch shellpath.ok fixme:shell:_SHGetUserProfilePath unsupported for user other than current or default fixme:shell:_SHGetUserProfilePath unsupported for user other than current or default ../../../tools/runtest -q -P wine -M shell32.dll -T ../../.. -p shell32_test.exe.so shlfileop.c && touch shlfileop.ok shlfileop.c:276: Test failed: Files and directories are copied to directory shlfileop.c:277: Test failed: The file is copied shlfileop.c:278: Test failed: The directory is copied shlfileop.c:279: Test failed: The file in subdirectory is copied shlfileop.c:287: Test failed: The file is copied shlfileop.c:345: Test failed: Files and directories are moved to directory shlfileop.c:346: Test failed: The file is moved shlfileop.c:347: Test failed: The directory is moved shlfileop.c:348: Test failed: The file in subdirectory is moved make[1]: *** [shlfileop.ok] Error 9
How can I find out where the problem is? Nothing *should* have changed by inserting that function I think, but I must be missing something here
regards,
Joris
Index: dlls/shell32/shlfileop.c =================================================================== RCS file: /home/wine/wine/dlls/shell32/shlfileop.c,v retrieving revision 1.51 diff -u -r1.51 shlfileop.c --- dlls/shell32/shlfileop.c 14 Jan 2005 16:51:14 -0000 1.51 +++ dlls/shell32/shlfileop.c 18 Jan 2005 16:23:43 -0000 @@ -945,6 +945,40 @@ return 0; }
+static int file_operation_invalid_handle(long FuncSwitch, LPWSTR pFromFile, DWORD ToPathAttr, LPWSTR pTempFrom) +{ + BOOL b_Mask = (NULL != StrPBrkW(&pFromFile[1], wWildcardChars)); + if ((FO_DELETE == FuncSwitch) && (b_Mask)) + { + DWORD FromPathAttr; + pFromFile[0] = '\0'; + FromPathAttr = GetFileAttributesW(pTempFrom); + pFromFile[0] = '\'; + if (IsAttribDir(FromPathAttr)) + { + /* FO_DELETE with mask and without found is valid */ + return 0; + } + } + /* root (without mask) is also not allowed as source, tested in W98 */ + return ERROR_SHELL_INTERNAL_FILE_NOT_FOUND; +} + +static int file_operation_on_data(WIN32_FIND_DATAW *wfd,SHFILEOPSTRUCTW *nFileOp, LPWSTR *pFromFile,LPWSTR *pToFile) +{ + LPWSTR lpFileName = wfd->cAlternateFileName; + if (!lpFileName[0]) + lpFileName = wfd->cFileName; + if (IsDotDir(lpFileName) || + (IsAttribDir(wfd->dwFileAttributes) && (nFileOp->fFlags & FOF_FILESONLY))) + { + return 0; /* next name in pTempFrom(dir) */ + } + SHFileStrCpyCatW(&(*pToFile[1]), lpFileName, NULL); + SHFileStrCpyCatW(&(*pFromFile[1]), lpFileName, NULL); + return SHFileOperationW (nFileOp); +} + /************************************************************************* * SHFileOperationW [SHELL32.@] * @@ -964,7 +998,6 @@ LPWSTR pTempTo = NULL; LPWSTR pFromFile; LPWSTR pToFile = NULL; - LPWSTR lpFileName; int retCode = 0; DWORD ToAttr; DWORD ToPathAttr; @@ -986,8 +1019,6 @@ long FuncSwitch = (nFileOp.wFunc & FO_MASK); long level= nFileOp.wFunc>>4;
- int ret; - /* default no error */ nFileOp.fAnyOperationsAborted = FALSE;
@@ -1016,10 +1047,9 @@ * create dir 0 0 0 0 0 0 1 0 */
- ret = file_operation_checkFlags(nFileOp); - if (ret != 0) + retCode = file_operation_checkFlags(nFileOp); + if (retCode) { - retCode = ret; goto shfileop_end; }
@@ -1108,20 +1138,7 @@ hFind = FindFirstFileW(pFrom, &wfd); if (INVALID_HANDLE_VALUE == hFind) { - if ((FO_DELETE == FuncSwitch) && (b_Mask)) - { - DWORD FromPathAttr; - pFromFile[0] = '\0'; - FromPathAttr = GetFileAttributesW(pTempFrom); - pFromFile[0] = '\'; - if (IsAttribDir(FromPathAttr)) - { - /* FO_DELETE with mask and without found is valid */ - goto shfileop_end; - } - } - /* root (without mask) is also not allowed as source, tested in W98 */ - retCode = ERROR_SHELL_INTERNAL_FILE_NOT_FOUND; + retCode = file_operation_invalid_handle(FuncSwitch,pFromFile,ToPathAttr,pTempFrom); goto shfileop_end; }
@@ -1130,11 +1147,10 @@ /* ??? b_Mask = (!SHFileStrICmpA(&pFromFile[1], &wfd.cFileName[0], HIGH_ADR, HIGH_ADR)); */ if (!pTo) /* FO_DELETE */ { - ret = file_operation_delete(&wfd,nFileOp,pFromFile,pTempFrom,&hFind); - /* if ret is not 0, nFileOp.fAnyOperationsAborted is TRUE */ - if (ret != 0) + retCode = file_operation_delete(&wfd,nFileOp,pFromFile,pTempFrom,&hFind); + /* if retCode is not 0, nFileOp.fAnyOperationsAborted is TRUE */ + if (retCode) { - retCode = ret; goto shfileop_end; } continue; @@ -1202,15 +1218,7 @@ nFileOp.fFlags = (nFileOp.fFlags | FOF_MULTIDESTFILES); do { - lpFileName = wfd.cAlternateFileName; - if (!lpFileName[0]) - lpFileName = wfd.cFileName; - if (IsDotDir(lpFileName) || - (IsAttribDir(wfd.dwFileAttributes) && (nFileOp.fFlags & FOF_FILESONLY))) - continue; /* next name in pTempFrom(dir) */ - SHFileStrCpyCatW(&pToFile[1], lpFileName, NULL); - SHFileStrCpyCatW(&pFromFile[1], lpFileName, NULL); - retCode = SHFileOperationW (&nFileOp); + retCode = file_operation_on_data(&wfd,&nFileOp,&pFromFile,&pToFile); } while(!nFileOp.fAnyOperationsAborted && FindNextFileW(hFind, &wfd)); } FindClose(hFind); @@ -1369,7 +1377,7 @@ nFileOp.fAnyOperationsAborted ? "TRUE":"FALSE", retCode, debugstr_w(pFrom), pTo ? "-> ":"", debugstr_w(pTo));
- lpFileOp->fAnyOperationsAborted = nFileOp.fAnyOperationsAborted; + /*lpFileOp->fAnyOperationsAborted = nFileOp.fAnyOperationsAborted;*/ return retCode; }