Commit 9b6d198a authored by John Thomson's avatar John Thomson Committed by Alexandre Julliard

shell32: Do not fail in SHCreateDirectoryExW for ERROR_ALREADY_EXISTS.

parent a4c93936
......@@ -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);
......
......@@ -2543,6 +2543,7 @@ static void test_unicode(void)
int ret;
HANDLE file;
static const WCHAR UNICODE_PATH_TO[] = {'c',':','\\',0x00ae,0x00ae,'\0'};
HWND hwnd;
shfoW.hwnd = NULL;
shfoW.wFunc = FO_DELETE;
......@@ -2633,6 +2634,20 @@ static void test_unicode(void)
ok(GetLastError() == ERROR_SUCCESS ||
broken(GetLastError() == ERROR_INVALID_HANDLE), /* WinXp, win2k3 */
"Expected ERROR_SUCCESS, got %d\n", GetLastError());
/* Check SHCreateDirectoryExW with a Hwnd
* returns ERROR_ALREADY_EXISTS where a directory already exists */
/* Get any window handle */
hwnd = FindWindowA(NULL, NULL);
ok(hwnd != 0, "FindWindowA failed to produce a hwnd\n");
ret = SHCreateDirectoryExW(hwnd, UNICODE_PATH, NULL);
ok(!ret, "SHCreateDirectoryExW returned %d\n", ret);
/* Create already-existing directory */
ok(file_existsW(UNICODE_PATH), "The directory was not created\n");
ret = SHCreateDirectoryExW(hwnd, UNICODE_PATH, NULL);
ok(ret == ERROR_ALREADY_EXISTS,
"Expected ERROR_ALREADY_EXISTS, got %d\n", ret);
RemoveDirectoryW(UNICODE_PATH);
}
static void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment