From: John Thomson Subject: [PATCH] shell32: SHCreateDirectoryExW no CANCELLED for ALREADY_EXISTS Message-Id: <20190416015731.5501-1-git@johnthomson.fastmail.com.au> Date: Tue, 16 Apr 2019 11:57:31 +1000 If SHCreateDirectoryExW is passed a non-null hWnd, but the directory already exists, ERROR_CANCELLED is returned, rather than ERROR_ALREADY_EXISTS An application relying on an expected return code may not proceed given the 0x4C7 1223 ERROR_CANCELLED, rather than a 0xB7 183 ERROR_ALREADY_EXISTS Warframe in-game screenshots (F6) demonstrates this behaviour Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47023 Signed-off-by: John Thomson --- My demo program of SHCreateDirectoryExW with a Hwnd returned a 183 on Windows 7, and a 1223 in wine. I would like someone else to confirm this. I am also unsure whether ERROR_FILE_EXISTS should also be returned as another exception to the rule. --- dlls/shell32/shlfileop.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dlls/shell32/shlfileop.c b/dlls/shell32/shlfileop.c index c7bd54d200..1515ad3891 100644 --- a/dlls/shell32/shlfileop.c +++ b/dlls/shell32/shlfileop.c @@ -763,7 +763,9 @@ int WINAPI SHCreateDirectoryExW(HWND hWnd, LPCWSTR path, LPSECURITY_ATTRIBUTES s } } - if (ret && hWnd && (ERROR_CANCELLED != ret)) + if (ret && hWnd && + ret != ERROR_CANCELLED && + ret != ERROR_ALREADY_EXISTS) { /* We failed and should show a dialog box */ FIXME("Show system error message, creating path %s, failed with error %d\n", debugstr_w(path), ret); -- 2.21.0