[PATCH] shell32: SHCreateDirectoryExW no CANCELLED for ALREADY_EXISTS

Zhiyi Zhang zzhang at codeweavers.com
Mon Apr 15 21:18:49 CDT 2019



On 4/16/19 9:57 AM, John Thomson wrote:
> 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.
> ---
You can write some conformance tests and verify the behavior on TestBots(https://testbot.winehq.org/)

Thanks.
Zhiyi
>  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);




More information about the wine-devel mailing list