shell32: Fix SHFileOperation when deleting a nonexistent directory.

Alexandre Julliard julliard at winehq.org
Mon May 19 08:57:37 CDT 2014


Zhenbo Li <litimetal at gmail.com> writes:

> @@ -353,8 +353,13 @@ static BOOL SHELL_DeleteDirectoryW(HWND hwnd, LPCWSTR pszDir, BOOL bShowUI)
>  	HANDLE  hFind;
>  	WIN32_FIND_DATAW wfd;
>  	WCHAR   szTemp[MAX_PATH];
> +	DWORD   attrib;
>  
>  	/* Make sure the directory exists before eventually prompting the user */
> +	attrib = GetFileAttributesW(pszDir);
> +	if (attrib == INVALID_FILE_ATTRIBUTES || !(attrib & FILE_ATTRIBUTE_DIRECTORY))
> +	  return FALSE;

It would be better to avoid a redundant file lookup, particularly since
it's only to set last error (which BTW you are not setting at all in the
non-directory case).

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list