Test for conformance of SHCreateDirectoryExW with a Hwnd when target directory already exists
Signed-off-by: John Thomson git@johnthomson.fastmail.com.au --- As part of testing [PATCH] shell32: SHCreateDirectoryExW no CANCELLED for ALREADY_EXISTS --- dlls/shell32/tests/shlfileop.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
diff --git a/dlls/shell32/tests/shlfileop.c b/dlls/shell32/tests/shlfileop.c index 8fb4dcf66b..25eb05f440 100644 --- a/dlls/shell32/tests/shlfileop.c +++ b/dlls/shell32/tests/shlfileop.c @@ -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,21 @@ 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, "FindWindowA failed to produce a hwnd"); + 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, + "SHCreateDirectoryExW returned %d. Expected %d", + ret, ERROR_ALREADY_EXISTS); + RemoveDirectoryW(UNICODE_PATH); }
static void