2 * Unit test of the SHFileOperation function.
4 * Copyright 2002 Andriy Palamarchuk
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 #define WINE_NOWINSOCK
29 #include "wine/test.h"
31 #ifndef FOF_NORECURSION
32 #define FOF_NORECURSION 0x1000
35 static CHAR CURR_DIR[MAX_PATH];
37 static HMODULE hshell32;
38 static int (WINAPI *pSHCreateDirectoryExA)(HWND, LPCSTR, LPSECURITY_ATTRIBUTES);
40 static void InitFunctionPointers(void)
42 hshell32 = GetModuleHandleA("shell32.dll");
43 pSHCreateDirectoryExA = (void*)GetProcAddress(hshell32, "SHCreateDirectoryExA");
46 /* creates a file with the specified name for tests */
47 static void createTestFile(const CHAR *name)
52 file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
53 ok(file != INVALID_HANDLE_VALUE, "Failure to open file %s\n", name);
54 WriteFile(file, name, strlen(name), &written, NULL);
55 WriteFile(file, "\n", strlen("\n"), &written, NULL);
59 static BOOL file_exists(const CHAR *name)
61 return GetFileAttributesA(name) != INVALID_FILE_ATTRIBUTES;
64 static BOOL file_has_content(const CHAR *name, const CHAR *content)
70 file = CreateFileA(name, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
71 if (file == INVALID_HANDLE_VALUE)
73 ReadFile(file, buf, MAX_PATH - 1, &read, NULL);
76 return strcmp(buf, content)==0;
79 /* initializes the tests */
80 static void init_shfo_tests(void)
84 GetCurrentDirectoryA(MAX_PATH, CURR_DIR);
85 len = lstrlenA(CURR_DIR);
87 if(len && (CURR_DIR[len-1] == '\\'))
90 createTestFile("test1.txt");
91 createTestFile("test2.txt");
92 createTestFile("test3.txt");
93 createTestFile("test_5.txt");
94 CreateDirectoryA("test4.txt", NULL);
95 CreateDirectoryA("testdir2", NULL);
96 CreateDirectoryA("testdir2\\nested", NULL);
97 createTestFile("testdir2\\one.txt");
98 createTestFile("testdir2\\nested\\two.txt");
101 /* cleans after tests */
102 static void clean_after_shfo_tests(void)
104 DeleteFileA("test1.txt");
105 DeleteFileA("test2.txt");
106 DeleteFileA("test3.txt");
107 DeleteFileA("test_5.txt");
108 DeleteFileA("one.txt");
109 DeleteFileA("test4.txt\\test1.txt");
110 DeleteFileA("test4.txt\\test2.txt");
111 DeleteFileA("test4.txt\\test3.txt");
112 RemoveDirectoryA("test4.txt");
113 DeleteFileA("testdir2\\one.txt");
114 DeleteFileA("testdir2\\test1.txt");
115 DeleteFileA("testdir2\\test2.txt");
116 DeleteFileA("testdir2\\test3.txt");
117 DeleteFileA("testdir2\\test4.txt\\test1.txt");
118 DeleteFileA("testdir2\\nested\\two.txt");
119 RemoveDirectoryA("testdir2\\test4.txt");
120 RemoveDirectoryA("testdir2\\nested");
121 RemoveDirectoryA("testdir2");
122 RemoveDirectoryA("c:\\testdir3");
123 DeleteFileA("nonexistent\\notreal\\test2.txt");
124 RemoveDirectoryA("nonexistent\\notreal");
125 RemoveDirectoryA("nonexistent");
129 static void test_get_file_info(void)
132 SHFILEINFO shfi, shfi2;
133 char notepad[MAX_PATH];
135 /* Test some flag combinations that MSDN claims are not allowed,
136 * but which work anyway
138 shfi.dwAttributes=0xdeadbeef;
139 rc=SHGetFileInfoA("c:\\nonexistent", FILE_ATTRIBUTE_DIRECTORY,
141 SHGFI_ATTRIBUTES | SHGFI_USEFILEATTRIBUTES);
142 todo_wine ok(rc, "SHGetFileInfoA(c:\\nonexistent | SHGFI_ATTRIBUTES) failed\n");
144 ok(shfi.dwAttributes != 0xdeadbeef, "dwFileAttributes is not set\n");
146 rc=SHGetFileInfoA("c:\\nonexistent", FILE_ATTRIBUTE_DIRECTORY,
148 SHGFI_EXETYPE | SHGFI_USEFILEATTRIBUTES);
149 todo_wine ok(rc == 1, "SHGetFileInfoA(c:\\nonexistent | SHGFI_EXETYPE) returned %d\n", rc);
151 /* Test SHGFI_USEFILEATTRIBUTES support */
152 strcpy(shfi.szDisplayName, "dummy");
153 shfi.iIcon=0xdeadbeef;
154 rc=SHGetFileInfoA("c:\\nonexistent", FILE_ATTRIBUTE_DIRECTORY,
156 SHGFI_ICONLOCATION | SHGFI_USEFILEATTRIBUTES);
157 ok(rc, "SHGetFileInfoA(c:\\nonexistent) failed\n");
160 ok(strcpy(shfi.szDisplayName, "dummy") != 0, "SHGetFileInfoA(c:\\nonexistent) displayname is not set\n");
161 ok(shfi.iIcon != 0xdeadbeef, "SHGetFileInfoA(c:\\nonexistent) iIcon is not set\n");
164 /* Wine does not have a default icon for text files, and Windows 98 fails
165 * if we give it an empty executable. So use notepad.exe as the test
167 if (SearchPath(NULL, "notepad.exe", NULL, sizeof(notepad), notepad, NULL))
169 strcpy(shfi.szDisplayName, "dummy");
170 shfi.iIcon=0xdeadbeef;
171 rc=SHGetFileInfoA(notepad, GetFileAttributes(notepad),
173 SHGFI_ICONLOCATION | SHGFI_USEFILEATTRIBUTES);
174 ok(rc, "SHGetFileInfoA(%s, SHGFI_USEFILEATTRIBUTES) failed\n", notepad);
175 strcpy(shfi2.szDisplayName, "dummy");
176 shfi2.iIcon=0xdeadbeef;
177 rc2=SHGetFileInfoA(notepad, 0,
178 &shfi2, sizeof(shfi2),
180 ok(rc2, "SHGetFileInfoA(%s) failed\n", notepad);
183 ok(lstrcmpi(shfi2.szDisplayName, shfi.szDisplayName) == 0, "wrong display name %s != %s\n", shfi.szDisplayName, shfi2.szDisplayName);
184 ok(shfi2.iIcon == shfi.iIcon, "wrong icon index %d != %d\n", shfi.iIcon, shfi2.iIcon);
188 /* with a directory now */
189 strcpy(shfi.szDisplayName, "dummy");
190 shfi.iIcon=0xdeadbeef;
191 rc=SHGetFileInfoA("test4.txt", GetFileAttributes("test4.txt"),
193 SHGFI_ICONLOCATION | SHGFI_USEFILEATTRIBUTES);
194 ok(rc, "SHGetFileInfoA(test4.txt/, SHGFI_USEFILEATTRIBUTES) failed\n");
195 strcpy(shfi2.szDisplayName, "dummy");
196 shfi2.iIcon=0xdeadbeef;
197 rc2=SHGetFileInfoA("test4.txt", 0,
198 &shfi2, sizeof(shfi2),
200 ok(rc2, "SHGetFileInfoA(test4.txt/) failed\n");
203 ok(lstrcmpi(shfi2.szDisplayName, shfi.szDisplayName) == 0, "wrong display name %s != %s\n", shfi.szDisplayName, shfi2.szDisplayName);
204 ok(shfi2.iIcon == shfi.iIcon, "wrong icon index %d != %d\n", shfi.iIcon, shfi2.iIcon);
210 puts into the specified buffer file names with current directory.
211 files - string with file names, separated by null characters. Ends on a double
214 static void set_curr_dir_path(CHAR *buf, const CHAR* files)
219 strcpy(buf, CURR_DIR);
224 buf += strlen(buf) + 1;
225 files += strlen(files) + 1;
231 /* tests the FO_DELETE action */
232 static void test_delete(void)
234 SHFILEOPSTRUCTA shfo;
236 CHAR buf[sizeof(CURR_DIR)+sizeof("/test?.txt")+1];
238 sprintf(buf, "%s\\%s", CURR_DIR, "test?.txt");
239 buf[strlen(buf) + 1] = '\0';
242 shfo.wFunc = FO_DELETE;
245 shfo.fFlags = FOF_FILESONLY | FOF_NOCONFIRMATION | FOF_SILENT;
246 shfo.hNameMappings = NULL;
247 shfo.lpszProgressTitle = NULL;
249 ok(!SHFileOperationA(&shfo), "Deletion was not successful\n");
250 ok(file_exists("test4.txt"), "Directory should not have been removed\n");
251 ok(!file_exists("test1.txt"), "File should have been removed\n");
253 ret = SHFileOperationA(&shfo);
254 ok(!ret, "Directory exists, but is not removed, ret=%d\n", ret);
255 ok(file_exists("test4.txt"), "Directory should not have been removed\n");
257 shfo.fFlags = FOF_NOCONFIRMATION | FOF_SILENT | FOF_NOERRORUI;
259 ok(!SHFileOperationA(&shfo), "Directory is not removed\n");
260 ok(!file_exists("test4.txt"), "Directory should have been removed\n");
262 ret = SHFileOperationA(&shfo);
263 ok(!ret, "The requested file does not exist, ret=%d\n", ret);
266 sprintf(buf, "%s\\%s", CURR_DIR, "test4.txt");
267 buf[strlen(buf) + 1] = '\0';
268 ok(MoveFileA("test1.txt", "test4.txt\\test1.txt"), "Filling the subdirectory failed\n");
269 ok(!SHFileOperationA(&shfo), "Directory is not removed\n");
270 ok(!file_exists("test4.txt"), "Directory is not removed\n");
273 shfo.pFrom = "test1.txt\0test4.txt\0";
274 ok(!SHFileOperationA(&shfo), "Directory and a file are not removed\n");
275 ok(!file_exists("test1.txt"), "The file should have been removed\n");
276 ok(!file_exists("test4.txt"), "Directory should have been removed\n");
277 ok(file_exists("test2.txt"), "This file should not have been removed\n");
279 /* FOF_FILESONLY does not delete a dir matching a wildcard */
281 shfo.fFlags |= FOF_FILESONLY;
282 shfo.pFrom = "*.txt\0";
283 ok(!SHFileOperation(&shfo), "Failed to delete files\n");
284 ok(!file_exists("test1.txt"), "test1.txt should have been removed\n");
285 ok(!file_exists("test_5.txt"), "test_5.txt should have been removed\n");
286 ok(file_exists("test4.txt"), "test4.txt should not have been removed\n");
288 /* FOF_FILESONLY only deletes a dir if explicitly specified */
290 shfo.pFrom = "test_?.txt\0test4.txt\0";
291 ok(!SHFileOperation(&shfo), "Failed to delete files and directory\n");
292 ok(!file_exists("test4.txt"), "test4.txt should have been removed\n");
293 ok(!file_exists("test_5.txt"), "test_5.txt should have been removed\n");
294 ok(file_exists("test1.txt"), "test1.txt should not have been removed\n");
296 /* try to delete an invalid filename */
299 shfo.fFlags &= ~FOF_FILESONLY;
300 shfo.fAnyOperationsAborted = FALSE;
301 ret = SHFileOperation(&shfo);
302 ok(ret == ERROR_ACCESS_DENIED, "Expected ERROR_ACCESS_DENIED, got %d\n", ret);
303 ok(!shfo.fAnyOperationsAborted, "Expected no aborted operations\n");
304 ok(file_exists("test1.txt"), "Expected test1.txt to exist\n");
306 /* try an invalid function */
308 shfo.pFrom = "test1.txt\0";
310 ret = SHFileOperation(&shfo);
311 ok(ret == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", ret);
312 ok(file_exists("test1.txt"), "Expected test1.txt to exist\n");
314 /* try an invalid list, only one null terminator */
317 shfo.wFunc = FO_DELETE;
318 ret = SHFileOperation(&shfo);
319 ok(ret == ERROR_ACCESS_DENIED, "Expected ERROR_ACCESS_DENIED, got %d\n", ret);
320 ok(file_exists("test1.txt"), "Expected test1.txt to exist\n");
322 /* delete a dir, and then a file inside the dir, same as
323 * deleting a nonexistent file
326 shfo.pFrom = "testdir2\0testdir2\\one.txt\0";
327 ret = SHFileOperation(&shfo);
328 ok(ret == ERROR_PATH_NOT_FOUND, "Expected ERROR_PATH_NOT_FOUND, got %d\n", ret);
329 ok(!file_exists("testdir2"), "Expected testdir2 to not exist\n");
330 ok(!file_exists("testdir2\\one.txt"), "Expected testdir2\\one.txt to not exist\n");
332 /* try the FOF_NORECURSION flag, continues deleting subdirs */
334 shfo.pFrom = "testdir2\0";
335 shfo.fFlags |= FOF_NORECURSION;
336 ret = SHFileOperation(&shfo);
337 ok(ret == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", ret);
338 ok(!file_exists("testdir2\\one.txt"), "Expected testdir2\\one.txt to not exist\n");
339 ok(!file_exists("testdir2\\nested"), "Expected testdir2\\nested to exist\n");
342 /* tests the FO_RENAME action */
343 static void test_rename(void)
345 SHFILEOPSTRUCTA shfo, shfo2;
346 CHAR from[5*MAX_PATH];
351 shfo.wFunc = FO_RENAME;
354 shfo.fFlags = FOF_NOCONFIRMATION | FOF_SILENT | FOF_NOERRORUI;
355 shfo.hNameMappings = NULL;
356 shfo.lpszProgressTitle = NULL;
358 set_curr_dir_path(from, "test1.txt\0");
359 set_curr_dir_path(to, "test4.txt\0");
360 ok(SHFileOperationA(&shfo), "File is not renamed moving to other directory "
361 "when specifying directory name only\n");
362 ok(file_exists("test1.txt"), "The file is removed\n");
364 set_curr_dir_path(from, "test3.txt\0");
365 set_curr_dir_path(to, "test4.txt\\test1.txt\0");
366 ok(!SHFileOperationA(&shfo), "File is renamed moving to other directory\n");
367 ok(file_exists("test4.txt\\test1.txt"), "The file is not renamed\n");
369 set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0");
370 set_curr_dir_path(to, "test6.txt\0test7.txt\0test8.txt\0");
371 retval = SHFileOperationA(&shfo); /* W98 returns 0, W2K and newer returns ERROR_GEN_FAILURE, both do nothing */
372 ok(!retval || retval == ERROR_GEN_FAILURE || retval == ERROR_INVALID_TARGET_HANDLE,
373 "Can't rename many files, retval = %d\n", retval);
374 ok(file_exists("test1.txt"), "The file is renamed - many files are specified\n");
376 memcpy(&shfo2, &shfo, sizeof(SHFILEOPSTRUCTA));
377 shfo2.fFlags |= FOF_MULTIDESTFILES;
379 set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0");
380 set_curr_dir_path(to, "test6.txt\0test7.txt\0test8.txt\0");
381 retval = SHFileOperationA(&shfo2); /* W98 returns 0, W2K and newer returns ERROR_GEN_FAILURE, both do nothing */
382 ok(!retval || retval == ERROR_GEN_FAILURE || retval == ERROR_INVALID_TARGET_HANDLE,
383 "Can't rename many files, retval = %d\n", retval);
384 ok(file_exists("test1.txt"), "The file is not renamed - many files are specified\n");
386 set_curr_dir_path(from, "test1.txt\0");
387 set_curr_dir_path(to, "test6.txt\0");
388 retval = SHFileOperationA(&shfo);
389 ok(!retval, "Rename file failed, retval = %d\n", retval);
390 ok(!file_exists("test1.txt"), "The file is not renamed\n");
391 ok(file_exists("test6.txt"), "The file is not renamed\n");
393 set_curr_dir_path(from, "test6.txt\0");
394 set_curr_dir_path(to, "test1.txt\0");
395 retval = SHFileOperationA(&shfo);
396 ok(!retval, "Rename file back failed, retval = %d\n", retval);
398 set_curr_dir_path(from, "test4.txt\0");
399 set_curr_dir_path(to, "test6.txt\0");
400 retval = SHFileOperationA(&shfo);
401 ok(!retval, "Rename dir failed, retval = %d\n", retval);
402 ok(!file_exists("test4.txt"), "The dir is not renamed\n");
403 ok(file_exists("test6.txt"), "The dir is not renamed\n");
405 set_curr_dir_path(from, "test6.txt\0");
406 set_curr_dir_path(to, "test4.txt\0");
407 retval = SHFileOperationA(&shfo);
408 ok(!retval, "Rename dir back failed, retval = %d\n", retval);
410 /* try to rename more than one file to a single file */
411 shfo.pFrom = "test1.txt\0test2.txt\0";
412 shfo.pTo = "a.txt\0";
413 retval = SHFileOperationA(&shfo);
414 ok(retval == ERROR_GEN_FAILURE, "Expected ERROR_GEN_FAILURE, got %d\n", retval);
415 ok(file_exists("test1.txt"), "Expected test1.txt to exist\n");
416 ok(file_exists("test2.txt"), "Expected test2.txt to exist\n");
418 /* pFrom doesn't exist */
419 shfo.pFrom = "idontexist\0";
420 shfo.pTo = "newfile\0";
421 retval = SHFileOperationA(&shfo);
422 ok(retval == 1026, "Expected 1026, got %d\n", retval);
423 ok(!file_exists("newfile"), "Expected newfile to not exist\n");
425 /* pTo already exist */
426 shfo.pFrom = "test1.txt\0";
427 shfo.pTo = "test2.txt\0";
428 retval = SHFileOperationA(&shfo);
429 ok(retval == ERROR_ALREADY_EXISTS, "Expected ERROR_ALREADY_EXISTS, got %d\n", retval);
431 /* pFrom is valid, but pTo is empty */
432 shfo.pFrom = "test1.txt\0";
434 retval = SHFileOperationA(&shfo);
435 ok(retval == ERROR_CANCELLED, "Expected ERROR_CANCELLED, got %d\n", retval);
436 ok(file_exists("test1.txt"), "Expected test1.txt to exist\n");
440 retval = SHFileOperationA(&shfo);
441 ok(retval == ERROR_ACCESS_DENIED, "Expected ERROR_ACCESS_DENIED, got %d\n", retval);
443 /* pFrom is NULL, commented out because it crashes on nt 4.0 */
446 retval = SHFileOperationA(&shfo);
447 ok(retval == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", retval);
451 /* tests the FO_COPY action */
452 static void test_copy(void)
454 SHFILEOPSTRUCTA shfo, shfo2;
455 CHAR from[5*MAX_PATH];
457 FILEOP_FLAGS tmp_flags;
461 shfo.wFunc = FO_COPY;
464 shfo.fFlags = FOF_NOCONFIRMATION | FOF_SILENT | FOF_NOERRORUI;
465 shfo.hNameMappings = NULL;
466 shfo.lpszProgressTitle = NULL;
468 set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0");
469 set_curr_dir_path(to, "test6.txt\0test7.txt\0test8.txt\0");
470 ok(SHFileOperationA(&shfo), "Can't copy many files\n");
471 ok(!file_exists("test6.txt"), "The file is not copied - many files are "
472 "specified as a target\n");
474 memcpy(&shfo2, &shfo, sizeof(SHFILEOPSTRUCTA));
475 shfo2.fFlags |= FOF_MULTIDESTFILES;
477 set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0");
478 set_curr_dir_path(to, "test6.txt\0test7.txt\0test8.txt\0");
479 ok(!SHFileOperationA(&shfo2), "Can't copy many files\n");
480 ok(file_exists("test6.txt"), "The file is copied - many files are "
481 "specified as a target\n");
482 DeleteFileA("test6.txt");
483 DeleteFileA("test7.txt");
484 RemoveDirectoryA("test8.txt");
486 /* number of sources do not correspond to number of targets */
487 set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0");
488 set_curr_dir_path(to, "test6.txt\0test7.txt\0");
489 ok(SHFileOperationA(&shfo2), "Can't copy many files\n");
490 ok(!file_exists("test6.txt"), "The file is not copied - many files are "
491 "specified as a target\n");
493 set_curr_dir_path(from, "test1.txt\0");
494 set_curr_dir_path(to, "test4.txt\0");
495 ok(!SHFileOperationA(&shfo), "Prepare test to check how directories are copied recursively\n");
496 ok(file_exists("test4.txt\\test1.txt"), "The file is copied\n");
498 set_curr_dir_path(from, "test?.txt\0");
499 set_curr_dir_path(to, "testdir2\0");
500 ok(!file_exists("testdir2\\test1.txt"), "The file is not copied yet\n");
501 ok(!file_exists("testdir2\\test4.txt"), "The directory is not copied yet\n");
502 ok(!SHFileOperationA(&shfo), "Files and directories are copied to directory\n");
503 ok(file_exists("testdir2\\test1.txt"), "The file is copied\n");
504 ok(file_exists("testdir2\\test4.txt"), "The directory is copied\n");
505 ok(file_exists("testdir2\\test4.txt\\test1.txt"), "The file in subdirectory is copied\n");
506 clean_after_shfo_tests();
509 shfo.fFlags |= FOF_FILESONLY;
510 ok(!file_exists("testdir2\\test1.txt"), "The file is not copied yet\n");
511 ok(!file_exists("testdir2\\test4.txt"), "The directory is not copied yet\n");
512 ok(!SHFileOperationA(&shfo), "Files are copied to other directory\n");
513 ok(file_exists("testdir2\\test1.txt"), "The file is copied\n");
514 ok(!file_exists("testdir2\\test4.txt"), "The directory is copied\n");
515 clean_after_shfo_tests();
518 set_curr_dir_path(from, "test1.txt\0test2.txt\0");
519 ok(!file_exists("testdir2\\test1.txt"), "The file is not copied yet\n");
520 ok(!file_exists("testdir2\\test2.txt"), "The file is not copied yet\n");
521 ok(!SHFileOperationA(&shfo), "Files are copied to other directory\n");
522 ok(file_exists("testdir2\\test1.txt"), "The file is copied\n");
523 ok(file_exists("testdir2\\test2.txt"), "The file is copied\n");
524 clean_after_shfo_tests();
526 /* Copying multiple files with one not existing as source, fails the
527 entire operation in Win98/ME/2K/XP, but not in 95/NT */
529 tmp_flags = shfo.fFlags;
530 set_curr_dir_path(from, "test1.txt\0test10.txt\0test2.txt\0");
531 ok(!file_exists("testdir2\\test1.txt"), "The file is not copied yet\n");
532 ok(!file_exists("testdir2\\test2.txt"), "The file is not copied yet\n");
533 retval = SHFileOperationA(&shfo);
535 /* Win 95/NT returns success but copies only the files up to the nonexistent source */
536 ok(file_exists("testdir2\\test1.txt"), "The file is not copied\n");
539 /* Win 98/ME/2K/XP fail the entire operation with return code 1026 if one source file does not exist */
540 ok(retval == 1026, "Files are copied to other directory\n");
541 ok(!file_exists("testdir2\\test1.txt"), "The file is copied\n");
543 ok(!file_exists("testdir2\\test2.txt"), "The file is copied\n");
544 shfo.fFlags = tmp_flags;
546 /* copy into a nonexistent directory */
548 shfo.fFlags = FOF_NOCONFIRMMKDIR;
549 set_curr_dir_path(from, "test1.txt\0");
550 set_curr_dir_path(to, "nonexistent\\notreal\\test2.txt\0");
551 retval= SHFileOperation(&shfo);
552 ok(!retval, "Error copying into nonexistent directory\n");
553 ok(file_exists("nonexistent"), "nonexistent not created\n");
554 ok(file_exists("nonexistent\\notreal"), "nonexistent\\notreal not created\n");
555 ok(file_exists("nonexistent\\notreal\\test2.txt"), "Directory not created\n");
556 ok(!file_exists("nonexistent\\notreal\\test1.txt"), "test1.txt should not exist\n");
558 /* a relative dest directory is OK */
559 clean_after_shfo_tests();
561 shfo.pFrom = "test1.txt\0test2.txt\0test3.txt\0";
562 shfo.pTo = "testdir2\0";
563 retval = SHFileOperation(&shfo);
564 ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
565 ok(file_exists("testdir2\\test1.txt"), "Expected testdir2\\test1 to exist\n");
567 /* try to copy files to a file */
568 clean_after_shfo_tests();
572 set_curr_dir_path(from, "test1.txt\0test2.txt\0");
573 set_curr_dir_path(to, "test3.txt\0");
574 retval = SHFileOperation(&shfo);
575 ok(retval == ERROR_CANCELLED, "Expected ERROR_CANCELLED, got %d\n", retval);
576 ok(shfo.fAnyOperationsAborted, "Expected aborted operations\n");
577 ok(!file_exists("test3.txt\\test2.txt"), "Expected test3.txt\\test2.txt to not exist\n");
579 /* try to copy many files to nonexistent directory */
581 shfo.fAnyOperationsAborted = FALSE;
582 retval = SHFileOperation(&shfo);
583 ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
584 ok(DeleteFile("test3.txt\\test1.txt"), "Expected test3.txt\\test1.txt to exist\n");
585 ok(DeleteFile("test3.txt\\test2.txt"), "Expected test3.txt\\test1.txt to exist\n");
586 ok(RemoveDirectory(to), "Expected test3.txt to exist\n");
588 /* send in FOF_MULTIDESTFILES with too many destination files */
590 shfo.pFrom = "test1.txt\0test2.txt\0test3.txt\0";
591 shfo.pTo = "testdir2\\a.txt\0testdir2\\b.txt\0testdir2\\c.txt\0testdir2\\d.txt\0";
592 shfo.fFlags |= FOF_NOERRORUI | FOF_MULTIDESTFILES;
593 retval = SHFileOperation(&shfo);
594 ok(retval == ERROR_CANCELLED, "Expected ERROR_CANCELLED, got %d\n", retval);
595 ok(shfo.fAnyOperationsAborted, "Expected aborted operations\n");
596 ok(!file_exists("testdir2\\a.txt"), "Expected testdir2\\a.txt to not exist\n");
598 /* send in FOF_MULTIDESTFILES with too many destination files */
599 shfo.pFrom = "test1.txt\0test2.txt\0test3.txt\0";
600 shfo.pTo = "e.txt\0f.txt\0";
601 shfo.fAnyOperationsAborted = FALSE;
602 retval = SHFileOperation(&shfo);
603 ok(retval == ERROR_CANCELLED, "Expected ERROR_CANCELLED, got %d\n", retval);
604 ok(shfo.fAnyOperationsAborted, "Expected aborted operations\n");
605 ok(!file_exists("e.txt"), "Expected e.txt to not exist\n");
607 /* use FOF_MULTIDESTFILES with files and a source directory */
608 shfo.pFrom = "test1.txt\0test2.txt\0test4.txt\0";
609 shfo.pTo = "testdir2\\a.txt\0testdir2\\b.txt\0testdir2\\c.txt\0";
610 shfo.fAnyOperationsAborted = FALSE;
611 retval = SHFileOperation(&shfo);
612 ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
613 ok(DeleteFile("testdir2\\a.txt"), "Expected testdir2\\a.txt to exist\n");
614 ok(DeleteFile("testdir2\\b.txt"), "Expected testdir2\\b.txt to exist\n");
615 ok(RemoveDirectory("testdir2\\c.txt"), "Expected testdir2\\c.txt to exist\n");
617 /* try many dest files without FOF_MULTIDESTFILES flag */
618 shfo.pFrom = "test1.txt\0test2.txt\0test3.txt\0";
619 shfo.pTo = "a.txt\0b.txt\0c.txt\0";
620 shfo.fAnyOperationsAborted = FALSE;
621 shfo.fFlags &= ~FOF_MULTIDESTFILES;
622 retval = SHFileOperation(&shfo);
623 ok(retval == ERROR_CANCELLED, "Expected ERROR_CANCELLED, got %d\n", retval);
624 ok(!file_exists("a.txt"), "Expected a.txt to not exist\n");
627 shfo.pFrom = "test?.txt\0";
628 shfo.pTo = "testdir2\0";
629 shfo.fFlags &= ~FOF_MULTIDESTFILES;
630 retval = SHFileOperation(&shfo);
631 ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
632 ok(file_exists("testdir2\\test1.txt"), "Expected testdir2\\test1.txt to exist\n");
634 /* try a glob with FOF_FILESONLY */
635 clean_after_shfo_tests();
637 shfo.pFrom = "test?.txt\0";
638 shfo.fFlags |= FOF_FILESONLY;
639 retval = SHFileOperation(&shfo);
640 ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
641 ok(file_exists("testdir2\\test1.txt"), "Expected testdir2\\test1.txt to exist\n");
642 ok(!file_exists("testdir2\\test4.txt"), "Expected testdir2\\test4.txt to not exist\n");
644 /* try a glob with FOF_MULTIDESTFILES and the same number
645 * of dest files that we would expect
647 clean_after_shfo_tests();
649 shfo.pTo = "testdir2\\a.txt\0testdir2\\b.txt\0testdir2\\c.txt\0testdir2\\d.txt\0";
650 shfo.fFlags &= ~FOF_FILESONLY;
651 shfo.fFlags |= FOF_MULTIDESTFILES;
652 retval = SHFileOperation(&shfo);
653 ok(retval == ERROR_CANCELLED, "Expected ERROR_CANCELLED, got %d\n", retval);
654 ok(shfo.fAnyOperationsAborted, "Expected aborted operations\n");
655 ok(!file_exists("testdir2\\a.txt"), "Expected testdir2\\test1.txt to not exist\n");
656 ok(!RemoveDirectory("b.txt"), "b.txt should not exist\n");
658 /* copy one file to two others, second is ignored */
659 clean_after_shfo_tests();
661 shfo.pFrom = "test1.txt\0";
662 shfo.pTo = "b.txt\0c.txt\0";
663 shfo.fAnyOperationsAborted = FALSE;
664 retval = SHFileOperation(&shfo);
665 ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
666 ok(DeleteFile("b.txt"), "Expected b.txt to exist\n");
667 ok(!DeleteFile("c.txt"), "Expected c.txt to not exist\n");
669 /* copy two file to three others, all fail */
670 shfo.pFrom = "test1.txt\0test2.txt\0";
671 shfo.pTo = "b.txt\0c.txt\0d.txt\0";
672 retval = SHFileOperation(&shfo);
673 ok(retval == ERROR_CANCELLED, "Expected ERROR_CANCELLED, got %d\n", retval);
674 ok(shfo.fAnyOperationsAborted, "Expected operations to be aborted\n");
675 ok(!DeleteFile("b.txt"), "Expected b.txt to not exist\n");
677 /* copy one file and one directory to three others */
678 shfo.pFrom = "test1.txt\0test4.txt\0";
679 shfo.pTo = "b.txt\0c.txt\0d.txt\0";
680 shfo.fAnyOperationsAborted = FALSE;
681 retval = SHFileOperation(&shfo);
682 ok(retval == ERROR_CANCELLED, "Expected ERROR_CANCELLED, got %d\n", retval);
683 ok(shfo.fAnyOperationsAborted, "Expected operations to be aborted\n");
684 ok(!DeleteFile("b.txt"), "Expected b.txt to not exist\n");
685 ok(!DeleteFile("c.txt"), "Expected c.txt to not exist\n");
687 /* copy a directory with a file beneath it, plus some files */
688 createTestFile("test4.txt\\a.txt");
689 shfo.pFrom = "test4.txt\0test1.txt\0";
690 shfo.pTo = "testdir2\0";
691 shfo.fFlags &= ~FOF_MULTIDESTFILES;
692 shfo.fAnyOperationsAborted = FALSE;
693 retval = SHFileOperation(&shfo);
694 ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
695 ok(DeleteFile("testdir2\\test1.txt"), "Expected newdir\\test1.txt to exist\n");
696 ok(DeleteFile("testdir2\\test4.txt\\a.txt"), "Expected a.txt to exist\n");
697 ok(RemoveDirectory("testdir2\\test4.txt"), "Expected testdir2\\test4.txt to exist\n");
699 /* copy one directory and a file in that dir to another dir */
700 shfo.pFrom = "test4.txt\0test4.txt\\a.txt\0";
701 shfo.pTo = "testdir2\0";
702 retval = SHFileOperation(&shfo);
703 ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
704 ok(DeleteFile("testdir2\\test4.txt\\a.txt"), "Expected a.txt to exist\n");
705 ok(DeleteFile("testdir2\\a.txt"), "Expected testdir2\\a.txt to exist\n");
707 /* copy a file in a directory first, and then the directory to a nonexistent dir */
708 shfo.pFrom = "test4.txt\\a.txt\0test4.txt\0";
709 shfo.pTo = "nonexistent\0";
710 retval = SHFileOperation(&shfo);
711 ok(retval == ERROR_CANCELLED, "Expected ERROR_CANCELLED, got %d\n", retval);
712 ok(shfo.fAnyOperationsAborted, "Expected operations to be aborted\n");
713 ok(!file_exists("nonexistent\\test4.txt"), "Expected nonexistent\\test4.txt to not exist\n");
714 DeleteFile("test4.txt\\a.txt");
716 /* destination is same as source file */
717 shfo.pFrom = "test1.txt\0test2.txt\0test3.txt\0";
718 shfo.pTo = "b.txt\0test2.txt\0c.txt\0";
719 shfo.fAnyOperationsAborted = FALSE;
720 shfo.fFlags = FOF_NOERRORUI | FOF_MULTIDESTFILES;
721 retval = SHFileOperation(&shfo);
722 ok(retval == ERROR_NO_MORE_SEARCH_HANDLES,
723 "Expected ERROR_NO_MORE_SEARCH_HANDLES, got %d\n", retval);
724 ok(!shfo.fAnyOperationsAborted, "Expected no operations to be aborted\n");
725 ok(DeleteFile("b.txt"), "Expected b.txt to exist\n");
726 ok(!file_exists("c.txt"), "Expected c.txt to not exist\n");
728 /* destination is same as source directory */
729 shfo.pFrom = "test1.txt\0test4.txt\0test3.txt\0";
730 shfo.pTo = "b.txt\0test4.txt\0c.txt\0";
731 shfo.fAnyOperationsAborted = FALSE;
732 retval = SHFileOperation(&shfo);
733 ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
734 ok(DeleteFile("b.txt"), "Expected b.txt to exist\n");
735 ok(!file_exists("c.txt"), "Expected c.txt to not exist\n");
737 /* copy a directory into itself, error displayed in UI */
738 shfo.pFrom = "test4.txt\0";
739 shfo.pTo = "test4.txt\\newdir\0";
740 shfo.fFlags &= ~FOF_MULTIDESTFILES;
741 shfo.fAnyOperationsAborted = FALSE;
742 retval = SHFileOperation(&shfo);
743 ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
744 ok(!RemoveDirectory("test4.txt\\newdir"), "Expected test4.txt\\newdir to not exist\n");
746 /* copy a directory to itself, error displayed in UI */
747 shfo.pFrom = "test4.txt\0";
748 shfo.pTo = "test4.txt\0";
749 shfo.fAnyOperationsAborted = FALSE;
750 retval = SHFileOperation(&shfo);
751 ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
753 /* copy a file into a directory, and the directory into itself */
754 shfo.pFrom = "test1.txt\0test4.txt\0";
755 shfo.pTo = "test4.txt\0";
756 shfo.fAnyOperationsAborted = FALSE;
757 shfo.fFlags |= FOF_NOCONFIRMATION;
758 retval = SHFileOperation(&shfo);
759 ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
760 ok(DeleteFile("test4.txt\\test1.txt"), "Expected test4.txt\\test1.txt to exist\n");
762 /* copy a file to a file, and the directory into itself */
763 shfo.pFrom = "test1.txt\0test4.txt\0";
764 shfo.pTo = "test4.txt\\a.txt\0";
765 shfo.fAnyOperationsAborted = FALSE;
766 retval = SHFileOperation(&shfo);
767 ok(retval == ERROR_CANCELLED, "Expected ERROR_CANCELLED, got %d\n", retval);
768 ok(!file_exists("test4.txt\\a.txt"), "Expected test4.txt\\a.txt to not exist\n");
770 /* copy a nonexistent file to a nonexistent directory */
771 shfo.pFrom = "e.txt\0";
772 shfo.pTo = "nonexistent\0";
773 shfo.fAnyOperationsAborted = FALSE;
774 retval = SHFileOperation(&shfo);
775 ok(retval == 1026, "Expected 1026, got %d\n", retval);
776 ok(!file_exists("nonexistent\\e.txt"), "Expected nonexistent\\e.txt to not exist\n");
777 ok(!file_exists("nonexistent"), "Expected nonexistent to not exist\n");
779 /* Overwrite tests */
780 clean_after_shfo_tests();
782 shfo.fFlags = FOF_NOCONFIRMATION;
783 shfo.pFrom = "test1.txt\0";
784 shfo.pTo = "test2.txt\0";
785 shfo.fAnyOperationsAborted = FALSE;
786 /* without FOF_NOCOFIRMATION the confirmation is Yes/No */
787 retval = SHFileOperation(&shfo);
788 ok(retval == 0, "Expected 0, got %d\n", retval);
789 ok(file_has_content("test2.txt", "test1.txt\n"), "The file was not copied\n");
791 shfo.pFrom = "test3.txt\0test1.txt\0";
792 shfo.pTo = "test2.txt\0one.txt\0";
793 shfo.fFlags = FOF_NOCONFIRMATION | FOF_MULTIDESTFILES;
794 /* without FOF_NOCOFIRMATION the confirmation is Yes/Yes to All/No/Cancel */
795 retval = SHFileOperation(&shfo);
796 ok(retval == 0, "Expected 0, got %d\n", retval);
797 ok(file_has_content("test2.txt", "test3.txt\n"), "The file was not copied\n");
799 shfo.pFrom = "one.txt\0";
800 shfo.pTo = "testdir2\0";
801 shfo.fFlags = FOF_NOCONFIRMATION;
802 /* without FOF_NOCOFIRMATION the confirmation is Yes/No */
803 retval = SHFileOperation(&shfo);
804 ok(retval == 0, "Expected 0, got %d\n", retval);
805 ok(file_has_content("testdir2\\one.txt", "test1.txt\n"), "The file was not copied\n");
807 createTestFile("test4.txt\\test1.txt");
808 shfo.pFrom = "test4.txt\0";
809 shfo.pTo = "testdir2\0";
810 shfo.fFlags = FOF_NOCONFIRMATION;
811 ok(!SHFileOperation(&shfo), "First SHFileOperation failed\n");
812 createTestFile("test4.txt\\.\\test1.txt"); /* modify the content of the file */
813 /* without FOF_NOCOFIRMATION the confirmation is "This folder already contains a folder named ..." */
814 retval = SHFileOperation(&shfo);
815 ok(retval == 0, "Expected 0, got %d\n", retval);
816 ok(file_has_content("testdir2\\test4.txt\\test1.txt", "test4.txt\\.\\test1.txt\n"), "The file was not copied\n");
819 /* tests the FO_MOVE action */
820 static void test_move(void)
822 SHFILEOPSTRUCTA shfo, shfo2;
823 CHAR from[5*MAX_PATH];
828 shfo.wFunc = FO_MOVE;
831 shfo.fFlags = FOF_NOCONFIRMATION | FOF_SILENT | FOF_NOERRORUI;
832 shfo.hNameMappings = NULL;
833 shfo.lpszProgressTitle = NULL;
835 set_curr_dir_path(from, "test1.txt\0");
836 set_curr_dir_path(to, "test4.txt\0");
837 ok(!SHFileOperationA(&shfo), "Prepare test to check how directories are moved recursively\n");
838 ok(!file_exists("test1.txt"), "test1.txt should not exist\n");
839 ok(file_exists("test4.txt\\test1.txt"), "The file is not moved\n");
841 set_curr_dir_path(from, "test?.txt\0");
842 set_curr_dir_path(to, "testdir2\0");
843 ok(!file_exists("testdir2\\test2.txt"), "The file is not moved yet\n");
844 ok(!file_exists("testdir2\\test4.txt"), "The directory is not moved yet\n");
845 ok(!SHFileOperationA(&shfo), "Files and directories are moved to directory\n");
846 ok(file_exists("testdir2\\test2.txt"), "The file is moved\n");
847 ok(file_exists("testdir2\\test4.txt"), "The directory is moved\n");
848 ok(file_exists("testdir2\\test4.txt\\test1.txt"), "The file in subdirectory is moved\n");
850 clean_after_shfo_tests();
853 memcpy(&shfo2, &shfo, sizeof(SHFILEOPSTRUCTA));
854 shfo2.fFlags |= FOF_MULTIDESTFILES;
856 set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0");
857 set_curr_dir_path(to, "test6.txt\0test7.txt\0test8.txt\0");
858 ok(!SHFileOperationA(&shfo2), "Move many files\n");
859 ok(file_exists("test6.txt"), "The file is moved - many files are "
860 "specified as a target\n");
861 DeleteFileA("test6.txt");
862 DeleteFileA("test7.txt");
863 RemoveDirectoryA("test8.txt");
867 /* number of sources do not correspond to number of targets */
868 set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0");
869 set_curr_dir_path(to, "test6.txt\0test7.txt\0");
870 ok(SHFileOperationA(&shfo2), "Can't move many files\n");
871 ok(!file_exists("test6.txt"), "The file is not moved - many files are "
872 "specified as a target\n");
876 set_curr_dir_path(from, "test3.txt\0");
877 set_curr_dir_path(to, "test4.txt\\test1.txt\0");
878 ok(!SHFileOperationA(&shfo), "File is moved moving to other directory\n");
879 ok(file_exists("test4.txt\\test1.txt"), "The file is moved\n");
881 set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0");
882 set_curr_dir_path(to, "test6.txt\0test7.txt\0test8.txt\0");
883 ok(SHFileOperationA(&shfo), "Cannot move many files\n");
884 ok(file_exists("test1.txt"), "The file is not moved. Many files are specified\n");
885 ok(file_exists("test4.txt"), "The directory is not moved. Many files are specified\n");
887 set_curr_dir_path(from, "test1.txt\0");
888 set_curr_dir_path(to, "test6.txt\0");
889 ok(!SHFileOperationA(&shfo), "Move file\n");
890 ok(!file_exists("test1.txt"), "The file is moved\n");
891 ok(file_exists("test6.txt"), "The file is moved\n");
892 set_curr_dir_path(from, "test6.txt\0");
893 set_curr_dir_path(to, "test1.txt\0");
894 ok(!SHFileOperationA(&shfo), "Move file back\n");
896 set_curr_dir_path(from, "test4.txt\0");
897 set_curr_dir_path(to, "test6.txt\0");
898 ok(!SHFileOperationA(&shfo), "Move dir\n");
899 ok(!file_exists("test4.txt"), "The dir is moved\n");
900 ok(file_exists("test6.txt"), "The dir is moved\n");
901 set_curr_dir_path(from, "test6.txt\0");
902 set_curr_dir_path(to, "test4.txt\0");
903 ok(!SHFileOperationA(&shfo), "Move dir back\n");
905 /* move one file to two others */
907 shfo.pFrom = "test1.txt\0";
908 shfo.pTo = "a.txt\0b.txt\0";
909 retval = SHFileOperationA(&shfo);
910 ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
911 ok(!file_exists("test1.txt"), "Expected test1.txt to not exist\n");
912 ok(DeleteFile("a.txt"), "Expected a.txt to exist\n");
913 ok(!file_exists("b.txt"), "Expected b.txt to not exist\n");
915 /* move two files to one other */
916 shfo.pFrom = "test2.txt\0test3.txt\0";
917 shfo.pTo = "test1.txt\0";
918 retval = SHFileOperationA(&shfo);
919 ok(retval == ERROR_CANCELLED, "Expected ERROR_CANCELLED, got %d\n", retval);
920 ok(!file_exists("test1.txt"), "Expected test1.txt to not exist\n");
921 ok(file_exists("test2.txt"), "Expected test2.txt to exist\n");
922 ok(file_exists("test3.txt"), "Expected test3.txt to exist\n");
924 /* move a directory into itself */
925 shfo.pFrom = "test4.txt\0";
926 shfo.pTo = "test4.txt\\b.txt\0";
927 retval = SHFileOperationA(&shfo);
928 ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
929 ok(!RemoveDirectory("test4.txt\\b.txt"), "Expected test4.txt\\b.txt to not exist\n");
930 ok(file_exists("test4.txt"), "Expected test4.txt to exist\n");
932 /* move many files without FOF_MULTIDESTFILES */
933 shfo.pFrom = "test2.txt\0test3.txt\0";
934 shfo.pTo = "d.txt\0e.txt\0";
935 retval = SHFileOperationA(&shfo);
936 ok(retval == ERROR_CANCELLED, "Expected ERROR_CANCELLED, got %d\n", retval);
937 ok(!DeleteFile("d.txt"), "Expected d.txt to not exist\n");
938 ok(!DeleteFile("e.txt"), "Expected e.txt to not exist\n");
940 /* number of sources != number of targets */
941 shfo.pTo = "d.txt\0";
942 shfo.fFlags |= FOF_MULTIDESTFILES;
943 retval = SHFileOperationA(&shfo);
944 ok(retval == ERROR_CANCELLED, "Expected ERROR_CANCELLED, got %d\n", retval);
945 ok(!DeleteFile("d.txt"), "Expected d.txt to not exist\n");
947 /* FO_MOVE does not create dest directories */
948 shfo.pFrom = "test2.txt\0";
949 shfo.pTo = "dir1\\dir2\\test2.txt\0";
950 retval = SHFileOperationA(&shfo);
951 ok(retval == ERROR_CANCELLED, "Expected ERROR_CANCELLED, got %d\n", retval);
952 ok(!file_exists("dir1"), "Expected dir1 to not exist\n");
954 /* try to overwrite an existing file */
955 shfo.pTo = "test3.txt\0";
956 retval = SHFileOperationA(&shfo);
957 ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
958 ok(!file_exists("test2.txt"), "Expected test2.txt to not exist\n");
959 ok(file_exists("test3.txt"), "Expected test3.txt to exist\n");
962 static void test_sh_create_dir(void)
967 if(!pSHCreateDirectoryExA)
969 trace("skipping SHCreateDirectoryExA tests\n");
973 set_curr_dir_path(path, "testdir2\\test4.txt\0");
974 ret = pSHCreateDirectoryExA(NULL, path, NULL);
975 ok(ERROR_SUCCESS == ret, "SHCreateDirectoryEx failed to create directory recursively, ret = %d\n", ret);
976 ok(file_exists("testdir2"), "The first directory is not created\n");
977 ok(file_exists("testdir2\\test4.txt"), "The second directory is not created\n");
979 ret = pSHCreateDirectoryExA(NULL, path, NULL);
980 ok(ERROR_ALREADY_EXISTS == ret, "SHCreateDirectoryEx should fail to create existing directory, ret = %d\n", ret);
982 ret = pSHCreateDirectoryExA(NULL, "c:\\testdir3", NULL);
983 ok(file_exists("c:\\testdir3"), "The directory is not created\n");
986 START_TEST(shlfileop)
988 InitFunctionPointers();
990 clean_after_shfo_tests();
993 test_get_file_info();
994 clean_after_shfo_tests();
998 clean_after_shfo_tests();
1002 clean_after_shfo_tests();
1006 clean_after_shfo_tests();
1010 clean_after_shfo_tests();
1012 test_sh_create_dir();
1013 clean_after_shfo_tests();