On Sat, Oct 18, 2008 at 5:48 AM, Vitaly Perov vitperov@etersoft.ru wrote:
We've been over this before. This needs a test case. Either way, this doesn't look right. What are you trying to fix?
Some program call SHFileOperationW to move one folder to another without FOF_MULTIDESTFILES. The source folder contain subfolders, so SHFileOperationW is called recursively. To move subfolder function move_dir_to_dir is called. Now it pass parent lpFileOp to the new iteration of SHFileOperationW, so FOF_MULTIDESTFILES is no set (but it should be set, as we copy files to the folder). So in the function move_files the following condition is true:
if (!(lpFileOp->fFlags & FOF_MULTIDESTFILES) && !flFrom->bAnyDirectories && flFrom->dwNumFiles > flTo->dwNumFiles) { return ERROR_CANCELLED; }
and SHFileOperationW return error.
You never mentioned a specific program, so I still don't know if this is a real world bug you're running into. Either way, your logic is flawed, as fileOp.pTo is a single directory in this case, so using FOF_MULTIDESTFILES is wrong.