[PATCH] shell32: SHCreateDirectoryExW no CANCELLED for ALREADY_EXISTS

John Thomson git at johnthomson.fastmail.com.au
Mon Apr 15 20:57:31 CDT 2019


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 <git at johnthomson.fastmail.com.au>
---
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




More information about the wine-devel mailing list