[wine-zh] SHFileOperationW 的问题(about Bug 34324)

  • From: Zhenbo Li <litimetal@xxxxxxxxx>
  • To: wine-zh@xxxxxxxxxxxxx
  • Date: Sat, 2 Nov 2013 13:19:56 +0800

Hi All,
Qian Hong 为 *Bug 34324* <http://bugs.winehq.org/show_bug.cgi?id=34324> - QQ2013
SP1 can't install 写了一个小 hack
<http://bugs.winehq.org/attachment.cgi?id=46397>

+    if (ret == 3) ret = 0x402;

我在 WIN 下做了个测试(需要的话我可以把测试代码发过去),发现 windows *XP* 下,如果 SHFileOperation (我这里没有用
SHFileOperationW)尝试删除文件,却发现文件不存在,就会返回 0x402   :An unknown error occurred.
This is typically due to an invalid path in the source or destination. This
error does not occur on Windows Vista and later.  (
http://msdn.microsoft.com/en-us/library/windows/desktop/bb762164%28v=vs.85%29.aspx
)

而 ret == 3,是 delete_files 里给出的返回值,含义为
#define ERROR_PATH_NOT_FOUND 3

===下面是个人的猜测了===
Windows 下,如果尝试删除不存在的文件,应该就会返回 0x402。那么,在 SHFileOperation 里,我们就应该检测 ret,然后返回
0x402

因为原先有了一句

if (ret == ERROR_CANCELLED)
         lpFileOp->fAnyOperationsAborted = TRUE;

那我能不能写一个
switch(ret) 呢?

-- 
Have a nice day!
Zhenbo Li

Other related posts: