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");
45 pSHCreateDirectoryExA = (void*)GetProcAddress(hshell32, "SHCreateDirectoryExA");
48 /* creates a file with the specified name for tests */
49 static void createTestFile(const CHAR *name)
54 file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
55 ok(file != INVALID_HANDLE_VALUE, "Failure to open file %s\n", name);
56 WriteFile(file, name, strlen(name), &written, NULL);
57 WriteFile(file, "\n", strlen("\n"), &written, NULL);
61 static BOOL file_exists(const CHAR *name)
63 return GetFileAttributesA(name) != INVALID_FILE_ATTRIBUTES;
66 static BOOL file_has_content(const CHAR *name, const CHAR *content)
72 file = CreateFileA(name, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
73 if (file == INVALID_HANDLE_VALUE)
75 ReadFile(file, buf, MAX_PATH - 1, &read, NULL);
78 return strcmp(buf, content)==0;
81 /* initializes the tests */
82 static void init_shfo_tests(void)
86 GetCurrentDirectoryA(MAX_PATH, CURR_DIR);
87 len = lstrlenA(CURR_DIR);
89 if(len && (CURR_DIR[len-1] == '\\'))
92 createTestFile("test1.txt");
93 createTestFile("test2.txt");
94 createTestFile("test3.txt");
95 createTestFile("test_5.txt");
96 CreateDirectoryA("test4.txt", NULL);
97 CreateDirectoryA("testdir2", NULL);
98 CreateDirectoryA("testdir2\\nested", NULL);
99 createTestFile("testdir2\\one.txt");
100 createTestFile("testdir2\\nested\\two.txt");
103 /* cleans after tests */
104 static void clean_after_shfo_tests(void)
106 DeleteFileA("test1.txt");
107 DeleteFileA("test2.txt");
108 DeleteFileA("test3.txt");
109 DeleteFileA("test_5.txt");
110 DeleteFileA("one.txt");
111 DeleteFileA("test4.txt\\test1.txt");
112 DeleteFileA("test4.txt\\test2.txt");
113 DeleteFileA("test4.txt\\test3.txt");
114 RemoveDirectoryA("test4.txt");
115 DeleteFileA("testdir2\\one.txt");
116 DeleteFileA("testdir2\\test1.txt");
117 DeleteFileA("testdir2\\test2.txt");
118 DeleteFileA("testdir2\\test3.txt");
119 DeleteFileA("testdir2\\test4.txt\\test1.txt");
120 DeleteFileA("testdir2\\nested\\two.txt");
121 RemoveDirectoryA("testdir2\\test4.txt");
122 RemoveDirectoryA("testdir2\\nested");
123 RemoveDirectoryA("testdir2");
124 RemoveDirectoryA("c:\\testdir3");
125 DeleteFileA("nonexistent\\notreal\\test2.txt");
126 RemoveDirectoryA("nonexistent\\notreal");
127 RemoveDirectoryA("nonexistent");
131 static void test_get_file_info(void)
134 SHFILEINFO shfi, shfi2;
135 char notepad[MAX_PATH];
137 /* Test some flag combinations that MSDN claims are not allowed,
138 * but which work anyway
140 shfi.dwAttributes=0xdeadbeef;
141 rc=SHGetFileInfoA("c:\\nonexistent", FILE_ATTRIBUTE_DIRECTORY,
143 SHGFI_ATTRIBUTES | SHGFI_USEFILEATTRIBUTES);
144 todo_wine ok(rc, "SHGetFileInfoA(c:\\nonexistent | SHGFI_ATTRIBUTES) failed\n");
146 ok(shfi.dwAttributes != 0xdeadbeef, "dwFileAttributes is not set\n");
148 rc=SHGetFileInfoA("c:\\nonexistent", FILE_ATTRIBUTE_DIRECTORY,
150 SHGFI_EXETYPE | SHGFI_USEFILEATTRIBUTES);
151 todo_wine ok(rc == 1, "SHGetFileInfoA(c:\\nonexistent | SHGFI_EXETYPE) returned %d\n", rc);
153 /* Test SHGFI_USEFILEATTRIBUTES support */
154 strcpy(shfi.szDisplayName, "dummy");
155 shfi.iIcon=0xdeadbeef;
156 rc=SHGetFileInfoA("c:\\nonexistent", FILE_ATTRIBUTE_DIRECTORY,
158 SHGFI_ICONLOCATION | SHGFI_USEFILEATTRIBUTES);
159 ok(rc, "SHGetFileInfoA(c:\\nonexistent) failed\n");
162 ok(strcpy(shfi.szDisplayName, "dummy") != 0, "SHGetFileInfoA(c:\\nonexistent) displayname is not set\n");
163 ok(shfi.iIcon != 0xdeadbeef, "SHGetFileInfoA(c:\\nonexistent) iIcon is not set\n");
166 /* Wine does not have a default icon for text files, and Windows 98 fails
167 * if we give it an empty executable. So use notepad.exe as the test
169 if (SearchPath(NULL, "notepad.exe", NULL, sizeof(notepad), notepad, NULL))
171 strcpy(shfi.szDisplayName, "dummy");
172 shfi.iIcon=0xdeadbeef;
173 rc=SHGetFileInfoA(notepad, GetFileAttributes(notepad),
175 SHGFI_ICONLOCATION | SHGFI_USEFILEATTRIBUTES);
176 ok(rc, "SHGetFileInfoA(%s, SHGFI_USEFILEATTRIBUTES) failed\n", notepad);
177 strcpy(shfi2.szDisplayName, "dummy");
178 shfi2.iIcon=0xdeadbeef;
179 rc2=SHGetFileInfoA(notepad, 0,
180 &shfi2, sizeof(shfi2),
182 ok(rc2, "SHGetFileInfoA(%s) failed\n", notepad);
185 ok(lstrcmpi(shfi2.szDisplayName, shfi.szDisplayName) == 0, "wrong display name %s != %s\n", shfi.szDisplayName, shfi2.szDisplayName);
186 ok(shfi2.iIcon == shfi.iIcon, "wrong icon index %d != %d\n", shfi.iIcon, shfi2.iIcon);
190 /* with a directory now */
191 strcpy(shfi.szDisplayName, "dummy");
192 shfi.iIcon=0xdeadbeef;
193 rc=SHGetFileInfoA("test4.txt", GetFileAttributes("test4.txt"),
195 SHGFI_ICONLOCATION | SHGFI_USEFILEATTRIBUTES);
196 ok(rc, "SHGetFileInfoA(test4.txt/, SHGFI_USEFILEATTRIBUTES) failed\n");
197 strcpy(shfi2.szDisplayName, "dummy");
198 shfi2.iIcon=0xdeadbeef;
199 rc2=SHGetFileInfoA("test4.txt", 0,
200 &shfi2, sizeof(shfi2),
202 ok(rc2, "SHGetFileInfoA(test4.txt/) failed\n");
205 ok(lstrcmpi(shfi2.szDisplayName, shfi.szDisplayName) == 0, "wrong display name %s != %s\n", shfi.szDisplayName, shfi2.szDisplayName);
206 ok(shfi2.iIcon == shfi.iIcon, "wrong icon index %d != %d\n", shfi.iIcon, shfi2.iIcon);
212 puts into the specified buffer file names with current directory.
213 files - string with file names, separated by null characters. Ends on a double
216 static void set_curr_dir_path(CHAR *buf, const CHAR* files)
221 strcpy(buf, CURR_DIR);
226 buf += strlen(buf) + 1;
227 files += strlen(files) + 1;
233 /* tests the FO_DELETE action */
234 static void test_delete(void)
236 SHFILEOPSTRUCTA shfo;
238 CHAR buf[sizeof(CURR_DIR)+sizeof("/test?.txt")+1];
240 sprintf(buf, "%s\\%s", CURR_DIR, "test?.txt");
241 buf[strlen(buf) + 1] = '\0';
244 shfo.wFunc = FO_DELETE;
247 shfo.fFlags = FOF_FILESONLY | FOF_NOCONFIRMATION | FOF_SILENT;
248 shfo.hNameMappings = NULL;
249 shfo.lpszProgressTitle = NULL;
251 ok(!SHFileOperationA(&shfo), "Deletion was not successful\n");
252 ok(file_exists("test4.txt"), "Directory should not have been removed\n");
253 ok(!file_exists("test1.txt"), "File should have been removed\n");
255 ret = SHFileOperationA(&shfo);
256 ok(!ret, "Directory exists, but is not removed, ret=%d\n", ret);
257 ok(file_exists("test4.txt"), "Directory should not have been removed\n");
259 shfo.fFlags = FOF_NOCONFIRMATION | FOF_SILENT | FOF_NOERRORUI;
261 ok(!SHFileOperationA(&shfo), "Directory is not removed\n");
262 ok(!file_exists("test4.txt"), "Directory should have been removed\n");
264 ret = SHFileOperationA(&shfo);
265 ok(!ret, "The requested file does not exist, ret=%d\n", ret);
268 sprintf(buf, "%s\\%s", CURR_DIR, "test4.txt");
269 buf[strlen(buf) + 1] = '\0';
270 ok(MoveFileA("test1.txt", "test4.txt\\test1.txt"), "Filling the subdirectory failed\n");
271 ok(!SHFileOperationA(&shfo), "Directory is not removed\n");
272 ok(!file_exists("test4.txt"), "Directory is not removed\n");
275 shfo.pFrom = "test1.txt\0test4.txt\0";
276 ok(!SHFileOperationA(&shfo), "Directory and a file are not removed\n");
277 ok(!file_exists("test1.txt"), "The file should have been removed\n");
278 ok(!file_exists("test4.txt"), "Directory should have been removed\n");
279 ok(file_exists("test2.txt"), "This file should not have been removed\n");
281 /* FOF_FILESONLY does not delete a dir matching a wildcard */
283 shfo.fFlags |= FOF_FILESONLY;
284 shfo.pFrom = "*.txt\0";
285 ok(!SHFileOperation(&shfo), "Failed to delete files\n");
286 ok(!file_exists("test1.txt"), "test1.txt should have been removed\n");
287 ok(!file_exists("test_5.txt"), "test_5.txt should have been removed\n");
288 ok(file_exists("test4.txt"), "test4.txt should not have been removed\n");
290 /* FOF_FILESONLY only deletes a dir if explicitly specified */
292 shfo.pFrom = "test_?.txt\0test4.txt\0";
293 ok(!SHFileOperation(&shfo), "Failed to delete files and directory\n");
294 ok(!file_exists("test4.txt"), "test4.txt should have been removed\n");
295 ok(!file_exists("test_5.txt"), "test_5.txt should have been removed\n");
296 ok(file_exists("test1.txt"), "test1.txt should not have been removed\n");
298 /* try to delete an invalid filename */
301 shfo.fFlags &= ~FOF_FILESONLY;
302 shfo.fAnyOperationsAborted = FALSE;
303 ret = SHFileOperation(&shfo);
304 ok(ret == ERROR_ACCESS_DENIED, "Expected ERROR_ACCESS_DENIED, got %d\n", ret);
305 ok(!shfo.fAnyOperationsAborted, "Expected no aborted operations\n");
306 ok(file_exists("test1.txt"), "Expected test1.txt to exist\n");
308 /* try an invalid function */
310 shfo.pFrom = "test1.txt\0";
312 ret = SHFileOperation(&shfo);
313 ok(ret == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", ret);
314 ok(file_exists("test1.txt"), "Expected test1.txt to exist\n");
316 /* try an invalid list, only one null terminator */
319 shfo.wFunc = FO_DELETE;
320 ret = SHFileOperation(&shfo);
321 ok(ret == ERROR_ACCESS_DENIED, "Expected ERROR_ACCESS_DENIED, got %d\n", ret);
322 ok(file_exists("test1.txt"), "Expected test1.txt to exist\n");
324 /* delete a dir, and then a file inside the dir, same as
325 * deleting a nonexistent file
328 shfo.pFrom = "testdir2\0testdir2\\one.txt\0";
329 ret = SHFileOperation(&shfo);
330 ok(ret == ERROR_PATH_NOT_FOUND, "Expected ERROR_PATH_NOT_FOUND, got %d\n", ret);
331 ok(!file_exists("testdir2"), "Expected testdir2 to not exist\n");
332 ok(!file_exists("testdir2\\one.txt"), "Expected testdir2\\one.txt to not exist\n");
334 /* try the FOF_NORECURSION flag, continues deleting subdirs */
336 shfo.pFrom = "testdir2\0";
337 shfo.fFlags |= FOF_NORECURSION;
338 ret = SHFileOperation(&shfo);
339 ok(ret == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", ret);
340 ok(!file_exists("testdir2\\one.txt"), "Expected testdir2\\one.txt to not exist\n");
341 ok(!file_exists("testdir2\\nested"), "Expected testdir2\\nested to exist\n");
344 /* tests the FO_RENAME action */
345 static void test_rename(void)
347 SHFILEOPSTRUCTA shfo, shfo2;
348 CHAR from[5*MAX_PATH];
353 shfo.wFunc = FO_RENAME;
356 shfo.fFlags = FOF_NOCONFIRMATION | FOF_SILENT | FOF_NOERRORUI;
357 shfo.hNameMappings = NULL;
358 shfo.lpszProgressTitle = NULL;
360 set_curr_dir_path(from, "test1.txt\0");
361 set_curr_dir_path(to, "test4.txt\0");
362 ok(SHFileOperationA(&shfo), "File is not renamed moving to other directory "
363 "when specifying directory name only\n");
364 ok(file_exists("test1.txt"), "The file is removed\n");
366 set_curr_dir_path(from, "test3.txt\0");
367 set_curr_dir_path(to, "test4.txt\\test1.txt\0");
368 ok(!SHFileOperationA(&shfo), "File is renamed moving to other directory\n");
369 ok(file_exists("test4.txt\\test1.txt"), "The file is not renamed\n");
371 set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0");
372 set_curr_dir_path(to, "test6.txt\0test7.txt\0test8.txt\0");
373 retval = SHFileOperationA(&shfo); /* W98 returns 0, W2K and newer returns ERROR_GEN_FAILURE, both do nothing */
374 ok(!retval || retval == ERROR_GEN_FAILURE || retval == ERROR_INVALID_TARGET_HANDLE,
375 "Can't rename many files, retval = %d\n", retval);
376 ok(file_exists("test1.txt"), "The file is renamed - many files are specified\n");
378 memcpy(&shfo2, &shfo, sizeof(SHFILEOPSTRUCTA));
379 shfo2.fFlags |= FOF_MULTIDESTFILES;
381 set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0");
382 set_curr_dir_path(to, "test6.txt\0test7.txt\0test8.txt\0");
383 retval = SHFileOperationA(&shfo2); /* W98 returns 0, W2K and newer returns ERROR_GEN_FAILURE, both do nothing */
384 ok(!retval || retval == ERROR_GEN_FAILURE || retval == ERROR_INVALID_TARGET_HANDLE,
385 "Can't rename many files, retval = %d\n", retval);
386 ok(file_exists("test1.txt"), "The file is not renamed - many files are specified\n");
388 set_curr_dir_path(from, "test1.txt\0");
389 set_curr_dir_path(to, "test6.txt\0");
390 retval = SHFileOperationA(&shfo);
391 ok(!retval, "Rename file failed, retval = %d\n", retval);
392 ok(!file_exists("test1.txt"), "The file is not renamed\n");
393 ok(file_exists("test6.txt"), "The file is not renamed\n");
395 set_curr_dir_path(from, "test6.txt\0");
396 set_curr_dir_path(to, "test1.txt\0");
397 retval = SHFileOperationA(&shfo);
398 ok(!retval, "Rename file back failed, retval = %d\n", retval);
400 set_curr_dir_path(from, "test4.txt\0");
401 set_curr_dir_path(to, "test6.txt\0");
402 retval = SHFileOperationA(&shfo);
403 ok(!retval, "Rename dir failed, retval = %d\n", retval);
404 ok(!file_exists("test4.txt"), "The dir is not renamed\n");
405 ok(file_exists("test6.txt"), "The dir is not renamed\n");
407 set_curr_dir_path(from, "test6.txt\0");
408 set_curr_dir_path(to, "test4.txt\0");
409 retval = SHFileOperationA(&shfo);
410 ok(!retval, "Rename dir back failed, retval = %d\n", retval);
412 /* try to rename more than one file to a single file */
413 shfo.pFrom = "test1.txt\0test2.txt\0";
414 shfo.pTo = "a.txt\0";
415 retval = SHFileOperationA(&shfo);
416 ok(retval == ERROR_GEN_FAILURE, "Expected ERROR_GEN_FAILURE, got %d\n", retval);
417 ok(file_exists("test1.txt"), "Expected test1.txt to exist\n");
418 ok(file_exists("test2.txt"), "Expected test2.txt to exist\n");
420 /* pFrom doesn't exist */
421 shfo.pFrom = "idontexist\0";
422 shfo.pTo = "newfile\0";
423 retval = SHFileOperationA(&shfo);
424 ok(retval == 1026, "Expected 1026, got %d\n", retval);
425 ok(!file_exists("newfile"), "Expected newfile to not exist\n");
427 /* pTo already exist */
428 shfo.pFrom = "test1.txt\0";
429 shfo.pTo = "test2.txt\0";
430 retval = SHFileOperationA(&shfo);
431 ok(retval == ERROR_ALREADY_EXISTS, "Expected ERROR_ALREADY_EXISTS, got %d\n", retval);
433 /* pFrom is valid, but pTo is empty */
434 shfo.pFrom = "test1.txt\0";
436 retval = SHFileOperationA(&shfo);
437 ok(retval == ERROR_CANCELLED, "Expected ERROR_CANCELLED, got %d\n", retval);
438 ok(file_exists("test1.txt"), "Expected test1.txt to exist\n");
442 retval = SHFileOperationA(&shfo);
443 ok(retval == ERROR_ACCESS_DENIED, "Expected ERROR_ACCESS_DENIED, got %d\n", retval);
445 /* pFrom is NULL, commented out because it crashes on nt 4.0 */
448 retval = SHFileOperationA(&shfo);
449 ok(retval == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", retval);
453 /* tests the FO_COPY action */
454 static void test_copy(void)
456 SHFILEOPSTRUCTA shfo, shfo2;
457 CHAR from[5*MAX_PATH];
459 FILEOP_FLAGS tmp_flags;
463 shfo.wFunc = FO_COPY;
466 shfo.fFlags = FOF_NOCONFIRMATION | FOF_SILENT | FOF_NOERRORUI;
467 shfo.hNameMappings = NULL;
468 shfo.lpszProgressTitle = NULL;
470 set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0");
471 set_curr_dir_path(to, "test6.txt\0test7.txt\0test8.txt\0");
472 ok(SHFileOperationA(&shfo), "Can't copy many files\n");
473 ok(!file_exists("test6.txt"), "The file is not copied - many files are "
474 "specified as a target\n");
476 memcpy(&shfo2, &shfo, sizeof(SHFILEOPSTRUCTA));
477 shfo2.fFlags |= FOF_MULTIDESTFILES;
479 set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0");
480 set_curr_dir_path(to, "test6.txt\0test7.txt\0test8.txt\0");
481 ok(!SHFileOperationA(&shfo2), "Can't copy many files\n");
482 ok(file_exists("test6.txt"), "The file is copied - many files are "
483 "specified as a target\n");
484 DeleteFileA("test6.txt");
485 DeleteFileA("test7.txt");
486 RemoveDirectoryA("test8.txt");
488 /* number of sources do not correspond to number of targets */
489 set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0");
490 set_curr_dir_path(to, "test6.txt\0test7.txt\0");
491 ok(SHFileOperationA(&shfo2), "Can't copy many files\n");
492 ok(!file_exists("test6.txt"), "The file is not copied - many files are "
493 "specified as a target\n");
495 set_curr_dir_path(from, "test1.txt\0");
496 set_curr_dir_path(to, "test4.txt\0");
497 ok(!SHFileOperationA(&shfo), "Prepare test to check how directories are copied recursively\n");
498 ok(file_exists("test4.txt\\test1.txt"), "The file is copied\n");
500 set_curr_dir_path(from, "test?.txt\0");
501 set_curr_dir_path(to, "testdir2\0");
502 ok(!file_exists("testdir2\\test1.txt"), "The file is not copied yet\n");
503 ok(!file_exists("testdir2\\test4.txt"), "The directory is not copied yet\n");
504 ok(!SHFileOperationA(&shfo), "Files and directories are copied to directory\n");
505 ok(file_exists("testdir2\\test1.txt"), "The file is copied\n");
506 ok(file_exists("testdir2\\test4.txt"), "The directory is copied\n");
507 ok(file_exists("testdir2\\test4.txt\\test1.txt"), "The file in subdirectory is copied\n");
508 clean_after_shfo_tests();
511 shfo.fFlags |= FOF_FILESONLY;
512 ok(!file_exists("testdir2\\test1.txt"), "The file is not copied yet\n");
513 ok(!file_exists("testdir2\\test4.txt"), "The directory is not copied yet\n");
514 ok(!SHFileOperationA(&shfo), "Files are copied to other directory\n");
515 ok(file_exists("testdir2\\test1.txt"), "The file is copied\n");
516 ok(!file_exists("testdir2\\test4.txt"), "The directory is copied\n");
517 clean_after_shfo_tests();
520 set_curr_dir_path(from, "test1.txt\0test2.txt\0");
521 ok(!file_exists("testdir2\\test1.txt"), "The file is not copied yet\n");
522 ok(!file_exists("testdir2\\test2.txt"), "The file is not copied yet\n");
523 ok(!SHFileOperationA(&shfo), "Files are copied to other directory\n");
524 ok(file_exists("testdir2\\test1.txt"), "The file is copied\n");
525 ok(file_exists("testdir2\\test2.txt"), "The file is copied\n");
526 clean_after_shfo_tests();
528 /* Copying multiple files with one not existing as source, fails the
529 entire operation in Win98/ME/2K/XP, but not in 95/NT */
531 tmp_flags = shfo.fFlags;
532 set_curr_dir_path(from, "test1.txt\0test10.txt\0test2.txt\0");
533 ok(!file_exists("testdir2\\test1.txt"), "The file is not copied yet\n");
534 ok(!file_exists("testdir2\\test2.txt"), "The file is not copied yet\n");
535 retval = SHFileOperationA(&shfo);
537 /* Win 95/NT returns success but copies only the files up to the nonexistent source */
538 ok(file_exists("testdir2\\test1.txt"), "The file is not copied\n");
541 /* Win 98/ME/2K/XP fail the entire operation with return code 1026 if one source file does not exist */
542 ok(retval == 1026, "Files are copied to other directory\n");
543 ok(!file_exists("testdir2\\test1.txt"), "The file is copied\n");
545 ok(!file_exists("testdir2\\test2.txt"), "The file is copied\n");
546 shfo.fFlags = tmp_flags;
548 /* copy into a nonexistent directory */
550 shfo.fFlags = FOF_NOCONFIRMMKDIR;
551 set_curr_dir_path(from, "test1.txt\0");
552 set_curr_dir_path(to, "nonexistent\\notreal\\test2.txt\0");
553 retval= SHFileOperation(&shfo);
554 ok(!retval, "Error copying into nonexistent directory\n");
555 ok(file_exists("nonexistent"), "nonexistent not created\n");
556 ok(file_exists("nonexistent\\notreal"), "nonexistent\\notreal not created\n");
557 ok(file_exists("nonexistent\\notreal\\test2.txt"), "Directory not created\n");
558 ok(!file_exists("nonexistent\\notreal\\test1.txt"), "test1.txt should not exist\n");
560 /* a relative dest directory is OK */
561 clean_after_shfo_tests();
563 shfo.pFrom = "test1.txt\0test2.txt\0test3.txt\0";
564 shfo.pTo = "testdir2\0";
565 retval = SHFileOperation(&shfo);
566 ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
567 ok(file_exists("testdir2\\test1.txt"), "Expected testdir2\\test1 to exist\n");
569 /* try to copy files to a file */
570 clean_after_shfo_tests();
574 set_curr_dir_path(from, "test1.txt\0test2.txt\0");
575 set_curr_dir_path(to, "test3.txt\0");
576 retval = SHFileOperation(&shfo);
577 ok(retval == ERROR_CANCELLED, "Expected ERROR_CANCELLED, got %d\n", retval);
578 ok(shfo.fAnyOperationsAborted, "Expected aborted operations\n");
579 ok(!file_exists("test3.txt\\test2.txt"), "Expected test3.txt\\test2.txt to not exist\n");
581 /* try to copy many files to nonexistent directory */
583 shfo.fAnyOperationsAborted = FALSE;
584 retval = SHFileOperation(&shfo);
585 ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
586 ok(DeleteFile("test3.txt\\test1.txt"), "Expected test3.txt\\test1.txt to exist\n");
587 ok(DeleteFile("test3.txt\\test2.txt"), "Expected test3.txt\\test1.txt to exist\n");
588 ok(RemoveDirectory(to), "Expected test3.txt to exist\n");
590 /* send in FOF_MULTIDESTFILES with too many destination files */
592 shfo.pFrom = "test1.txt\0test2.txt\0test3.txt\0";
593 shfo.pTo = "testdir2\\a.txt\0testdir2\\b.txt\0testdir2\\c.txt\0testdir2\\d.txt\0";
594 shfo.fFlags |= FOF_NOERRORUI | FOF_MULTIDESTFILES;
595 retval = SHFileOperation(&shfo);
596 ok(retval == ERROR_CANCELLED, "Expected ERROR_CANCELLED, got %d\n", retval);
597 ok(shfo.fAnyOperationsAborted, "Expected aborted operations\n");
598 ok(!file_exists("testdir2\\a.txt"), "Expected testdir2\\a.txt to not exist\n");
600 /* send in FOF_MULTIDESTFILES with too many destination files */
601 shfo.pFrom = "test1.txt\0test2.txt\0test3.txt\0";
602 shfo.pTo = "e.txt\0f.txt\0";
603 shfo.fAnyOperationsAborted = FALSE;
604 retval = SHFileOperation(&shfo);
605 ok(retval == ERROR_CANCELLED, "Expected ERROR_CANCELLED, got %d\n", retval);
606 ok(shfo.fAnyOperationsAborted, "Expected aborted operations\n");
607 ok(!file_exists("e.txt"), "Expected e.txt to not exist\n");
609 /* use FOF_MULTIDESTFILES with files and a source directory */
610 shfo.pFrom = "test1.txt\0test2.txt\0test4.txt\0";
611 shfo.pTo = "testdir2\\a.txt\0testdir2\\b.txt\0testdir2\\c.txt\0";
612 shfo.fAnyOperationsAborted = FALSE;
613 retval = SHFileOperation(&shfo);
614 ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
615 ok(DeleteFile("testdir2\\a.txt"), "Expected testdir2\\a.txt to exist\n");
616 ok(DeleteFile("testdir2\\b.txt"), "Expected testdir2\\b.txt to exist\n");
617 ok(RemoveDirectory("testdir2\\c.txt"), "Expected testdir2\\c.txt to exist\n");
619 /* try many dest files without FOF_MULTIDESTFILES flag */
620 shfo.pFrom = "test1.txt\0test2.txt\0test3.txt\0";
621 shfo.pTo = "a.txt\0b.txt\0c.txt\0";
622 shfo.fAnyOperationsAborted = FALSE;
623 shfo.fFlags &= ~FOF_MULTIDESTFILES;
624 retval = SHFileOperation(&shfo);
625 ok(retval == ERROR_CANCELLED, "Expected ERROR_CANCELLED, got %d\n", retval);
626 ok(!file_exists("a.txt"), "Expected a.txt to not exist\n");
629 shfo.pFrom = "test?.txt\0";
630 shfo.pTo = "testdir2\0";
631 shfo.fFlags &= ~FOF_MULTIDESTFILES;
632 retval = SHFileOperation(&shfo);
633 ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
634 ok(file_exists("testdir2\\test1.txt"), "Expected testdir2\\test1.txt to exist\n");
636 /* try a glob with FOF_FILESONLY */
637 clean_after_shfo_tests();
639 shfo.pFrom = "test?.txt\0";
640 shfo.fFlags |= FOF_FILESONLY;
641 retval = SHFileOperation(&shfo);
642 ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
643 ok(file_exists("testdir2\\test1.txt"), "Expected testdir2\\test1.txt to exist\n");
644 ok(!file_exists("testdir2\\test4.txt"), "Expected testdir2\\test4.txt to not exist\n");
646 /* try a glob with FOF_MULTIDESTFILES and the same number
647 * of dest files that we would expect
649 clean_after_shfo_tests();
651 shfo.pTo = "testdir2\\a.txt\0testdir2\\b.txt\0testdir2\\c.txt\0testdir2\\d.txt\0";
652 shfo.fFlags &= ~FOF_FILESONLY;
653 shfo.fFlags |= FOF_MULTIDESTFILES;
654 retval = SHFileOperation(&shfo);
655 ok(retval == ERROR_CANCELLED, "Expected ERROR_CANCELLED, got %d\n", retval);
656 ok(shfo.fAnyOperationsAborted, "Expected aborted operations\n");
657 ok(!file_exists("testdir2\\a.txt"), "Expected testdir2\\test1.txt to not exist\n");
658 ok(!RemoveDirectory("b.txt"), "b.txt should not exist\n");
660 /* copy one file to two others, second is ignored */
661 clean_after_shfo_tests();
663 shfo.pFrom = "test1.txt\0";
664 shfo.pTo = "b.txt\0c.txt\0";
665 shfo.fAnyOperationsAborted = FALSE;
666 retval = SHFileOperation(&shfo);
667 ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
668 ok(DeleteFile("b.txt"), "Expected b.txt to exist\n");
669 ok(!DeleteFile("c.txt"), "Expected c.txt to not exist\n");
671 /* copy two file to three others, all fail */
672 shfo.pFrom = "test1.txt\0test2.txt\0";
673 shfo.pTo = "b.txt\0c.txt\0d.txt\0";
674 retval = SHFileOperation(&shfo);
675 ok(retval == ERROR_CANCELLED, "Expected ERROR_CANCELLED, got %d\n", retval);
676 ok(shfo.fAnyOperationsAborted, "Expected operations to be aborted\n");
677 ok(!DeleteFile("b.txt"), "Expected b.txt to not exist\n");
679 /* copy one file and one directory to three others */
680 shfo.pFrom = "test1.txt\0test4.txt\0";
681 shfo.pTo = "b.txt\0c.txt\0d.txt\0";
682 shfo.fAnyOperationsAborted = FALSE;
683 retval = SHFileOperation(&shfo);
684 ok(retval == ERROR_CANCELLED, "Expected ERROR_CANCELLED, got %d\n", retval);
685 ok(shfo.fAnyOperationsAborted, "Expected operations to be aborted\n");
686 ok(!DeleteFile("b.txt"), "Expected b.txt to not exist\n");
687 ok(!DeleteFile("c.txt"), "Expected c.txt to not exist\n");
689 /* copy a directory with a file beneath it, plus some files */
690 createTestFile("test4.txt\\a.txt");
691 shfo.pFrom = "test4.txt\0test1.txt\0";
692 shfo.pTo = "testdir2\0";
693 shfo.fFlags &= ~FOF_MULTIDESTFILES;
694 shfo.fAnyOperationsAborted = FALSE;
695 retval = SHFileOperation(&shfo);
696 ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
697 ok(DeleteFile("testdir2\\test1.txt"), "Expected newdir\\test1.txt to exist\n");
698 ok(DeleteFile("testdir2\\test4.txt\\a.txt"), "Expected a.txt to exist\n");
699 ok(RemoveDirectory("testdir2\\test4.txt"), "Expected testdir2\\test4.txt to exist\n");
701 /* copy one directory and a file in that dir to another dir */
702 shfo.pFrom = "test4.txt\0test4.txt\\a.txt\0";
703 shfo.pTo = "testdir2\0";
704 retval = SHFileOperation(&shfo);
705 ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
706 ok(DeleteFile("testdir2\\test4.txt\\a.txt"), "Expected a.txt to exist\n");
707 ok(DeleteFile("testdir2\\a.txt"), "Expected testdir2\\a.txt to exist\n");
709 /* copy a file in a directory first, and then the directory to a nonexistent dir */
710 shfo.pFrom = "test4.txt\\a.txt\0test4.txt\0";
711 shfo.pTo = "nonexistent\0";
712 retval = SHFileOperation(&shfo);
713 ok(retval == ERROR_CANCELLED, "Expected ERROR_CANCELLED, got %d\n", retval);
714 ok(shfo.fAnyOperationsAborted, "Expected operations to be aborted\n");
715 ok(!file_exists("nonexistent\\test4.txt"), "Expected nonexistent\\test4.txt to not exist\n");
716 DeleteFile("test4.txt\\a.txt");
718 /* destination is same as source file */
719 shfo.pFrom = "test1.txt\0test2.txt\0test3.txt\0";
720 shfo.pTo = "b.txt\0test2.txt\0c.txt\0";
721 shfo.fAnyOperationsAborted = FALSE;
722 shfo.fFlags = FOF_NOERRORUI | FOF_MULTIDESTFILES;
723 retval = SHFileOperation(&shfo);
724 ok(retval == ERROR_NO_MORE_SEARCH_HANDLES,
725 "Expected ERROR_NO_MORE_SEARCH_HANDLES, got %d\n", retval);
726 ok(!shfo.fAnyOperationsAborted, "Expected no operations to be aborted\n");
727 ok(DeleteFile("b.txt"), "Expected b.txt to exist\n");
728 ok(!file_exists("c.txt"), "Expected c.txt to not exist\n");
730 /* destination is same as source directory */
731 shfo.pFrom = "test1.txt\0test4.txt\0test3.txt\0";
732 shfo.pTo = "b.txt\0test4.txt\0c.txt\0";
733 shfo.fAnyOperationsAborted = FALSE;
734 retval = SHFileOperation(&shfo);
735 ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
736 ok(DeleteFile("b.txt"), "Expected b.txt to exist\n");
737 ok(!file_exists("c.txt"), "Expected c.txt to not exist\n");
739 /* copy a directory into itself, error displayed in UI */
740 shfo.pFrom = "test4.txt\0";
741 shfo.pTo = "test4.txt\\newdir\0";
742 shfo.fFlags &= ~FOF_MULTIDESTFILES;
743 shfo.fAnyOperationsAborted = FALSE;
744 retval = SHFileOperation(&shfo);
745 ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
746 ok(!RemoveDirectory("test4.txt\\newdir"), "Expected test4.txt\\newdir to not exist\n");
748 /* copy a directory to itself, error displayed in UI */
749 shfo.pFrom = "test4.txt\0";
750 shfo.pTo = "test4.txt\0";
751 shfo.fAnyOperationsAborted = FALSE;
752 retval = SHFileOperation(&shfo);
753 ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
755 /* copy a file into a directory, and the directory into itself */
756 shfo.pFrom = "test1.txt\0test4.txt\0";
757 shfo.pTo = "test4.txt\0";
758 shfo.fAnyOperationsAborted = FALSE;
759 shfo.fFlags |= FOF_NOCONFIRMATION;
760 retval = SHFileOperation(&shfo);
761 ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
762 ok(DeleteFile("test4.txt\\test1.txt"), "Expected test4.txt\\test1.txt to exist\n");
764 /* copy a file to a file, and the directory into itself */
765 shfo.pFrom = "test1.txt\0test4.txt\0";
766 shfo.pTo = "test4.txt\\a.txt\0";
767 shfo.fAnyOperationsAborted = FALSE;
768 retval = SHFileOperation(&shfo);
769 ok(retval == ERROR_CANCELLED, "Expected ERROR_CANCELLED, got %d\n", retval);
770 ok(!file_exists("test4.txt\\a.txt"), "Expected test4.txt\\a.txt to not exist\n");
772 /* copy a nonexistent file to a nonexistent directory */
773 shfo.pFrom = "e.txt\0";
774 shfo.pTo = "nonexistent\0";
775 shfo.fAnyOperationsAborted = FALSE;
776 retval = SHFileOperation(&shfo);
777 ok(retval == 1026, "Expected 1026, got %d\n", retval);
778 ok(!file_exists("nonexistent\\e.txt"), "Expected nonexistent\\e.txt to not exist\n");
779 ok(!file_exists("nonexistent"), "Expected nonexistent to not exist\n");
781 /* Overwrite tests */
782 clean_after_shfo_tests();
784 shfo.fFlags = FOF_NOCONFIRMATION;
785 shfo.pFrom = "test1.txt\0";
786 shfo.pTo = "test2.txt\0";
787 shfo.fAnyOperationsAborted = FALSE;
788 /* without FOF_NOCOFIRMATION the confirmation is Yes/No */
789 retval = SHFileOperation(&shfo);
790 ok(retval == 0, "Expected 0, got %d\n", retval);
791 ok(file_has_content("test2.txt", "test1.txt\n"), "The file was not copied\n");
793 shfo.pFrom = "test3.txt\0test1.txt\0";
794 shfo.pTo = "test2.txt\0one.txt\0";
795 shfo.fFlags = FOF_NOCONFIRMATION | FOF_MULTIDESTFILES;
796 /* without FOF_NOCOFIRMATION the confirmation is Yes/Yes to All/No/Cancel */
797 retval = SHFileOperation(&shfo);
798 ok(retval == 0, "Expected 0, got %d\n", retval);
799 ok(file_has_content("test2.txt", "test3.txt\n"), "The file was not copied\n");
801 shfo.pFrom = "one.txt\0";
802 shfo.pTo = "testdir2\0";
803 shfo.fFlags = FOF_NOCONFIRMATION;
804 /* without FOF_NOCOFIRMATION the confirmation is Yes/No */
805 retval = SHFileOperation(&shfo);
806 ok(retval == 0, "Expected 0, got %d\n", retval);
807 ok(file_has_content("testdir2\\one.txt", "test1.txt\n"), "The file was not copied\n");
809 createTestFile("test4.txt\\test1.txt");
810 shfo.pFrom = "test4.txt\0";
811 shfo.pTo = "testdir2\0";
812 shfo.fFlags = FOF_NOCONFIRMATION;
813 ok(!SHFileOperation(&shfo), "First SHFileOperation failed\n");
814 createTestFile("test4.txt\\.\\test1.txt"); /* modify the content of the file */
815 /* without FOF_NOCOFIRMATION the confirmation is "This folder already contains a folder named ..." */
816 retval = SHFileOperation(&shfo);
817 ok(retval == 0, "Expected 0, got %d\n", retval);
818 ok(file_has_content("testdir2\\test4.txt\\test1.txt", "test4.txt\\.\\test1.txt\n"), "The file was not copied\n");
821 /* tests the FO_MOVE action */
822 static void test_move(void)
824 SHFILEOPSTRUCTA shfo, shfo2;
825 CHAR from[5*MAX_PATH];
830 shfo.wFunc = FO_MOVE;
833 shfo.fFlags = FOF_NOCONFIRMATION | FOF_SILENT | FOF_NOERRORUI;
834 shfo.hNameMappings = NULL;
835 shfo.lpszProgressTitle = NULL;
837 set_curr_dir_path(from, "test1.txt\0");
838 set_curr_dir_path(to, "test4.txt\0");
839 ok(!SHFileOperationA(&shfo), "Prepare test to check how directories are moved recursively\n");
840 ok(!file_exists("test1.txt"), "test1.txt should not exist\n");
841 ok(file_exists("test4.txt\\test1.txt"), "The file is not moved\n");
843 set_curr_dir_path(from, "test?.txt\0");
844 set_curr_dir_path(to, "testdir2\0");
845 ok(!file_exists("testdir2\\test2.txt"), "The file is not moved yet\n");
846 ok(!file_exists("testdir2\\test4.txt"), "The directory is not moved yet\n");
847 ok(!SHFileOperationA(&shfo), "Files and directories are moved to directory\n");
848 ok(file_exists("testdir2\\test2.txt"), "The file is moved\n");
849 ok(file_exists("testdir2\\test4.txt"), "The directory is moved\n");
850 ok(file_exists("testdir2\\test4.txt\\test1.txt"), "The file in subdirectory is moved\n");
852 clean_after_shfo_tests();
855 memcpy(&shfo2, &shfo, sizeof(SHFILEOPSTRUCTA));
856 shfo2.fFlags |= FOF_MULTIDESTFILES;
858 set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0");
859 set_curr_dir_path(to, "test6.txt\0test7.txt\0test8.txt\0");
860 ok(!SHFileOperationA(&shfo2), "Move many files\n");
861 ok(file_exists("test6.txt"), "The file is moved - many files are "
862 "specified as a target\n");
863 DeleteFileA("test6.txt");
864 DeleteFileA("test7.txt");
865 RemoveDirectoryA("test8.txt");
869 /* number of sources do not correspond to number of targets */
870 set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0");
871 set_curr_dir_path(to, "test6.txt\0test7.txt\0");
872 ok(SHFileOperationA(&shfo2), "Can't move many files\n");
873 ok(!file_exists("test6.txt"), "The file is not moved - many files are "
874 "specified as a target\n");
878 set_curr_dir_path(from, "test3.txt\0");
879 set_curr_dir_path(to, "test4.txt\\test1.txt\0");
880 ok(!SHFileOperationA(&shfo), "File is moved moving to other directory\n");
881 ok(file_exists("test4.txt\\test1.txt"), "The file is moved\n");
883 set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0");
884 set_curr_dir_path(to, "test6.txt\0test7.txt\0test8.txt\0");
885 ok(SHFileOperationA(&shfo), "Cannot move many files\n");
886 ok(file_exists("test1.txt"), "The file is not moved. Many files are specified\n");
887 ok(file_exists("test4.txt"), "The directory is not moved. Many files are specified\n");
889 set_curr_dir_path(from, "test1.txt\0");
890 set_curr_dir_path(to, "test6.txt\0");
891 ok(!SHFileOperationA(&shfo), "Move file\n");
892 ok(!file_exists("test1.txt"), "The file is moved\n");
893 ok(file_exists("test6.txt"), "The file is moved\n");
894 set_curr_dir_path(from, "test6.txt\0");
895 set_curr_dir_path(to, "test1.txt\0");
896 ok(!SHFileOperationA(&shfo), "Move file back\n");
898 set_curr_dir_path(from, "test4.txt\0");
899 set_curr_dir_path(to, "test6.txt\0");
900 ok(!SHFileOperationA(&shfo), "Move dir\n");
901 ok(!file_exists("test4.txt"), "The dir is moved\n");
902 ok(file_exists("test6.txt"), "The dir is moved\n");
903 set_curr_dir_path(from, "test6.txt\0");
904 set_curr_dir_path(to, "test4.txt\0");
905 ok(!SHFileOperationA(&shfo), "Move dir back\n");
907 /* move one file to two others */
909 shfo.pFrom = "test1.txt\0";
910 shfo.pTo = "a.txt\0b.txt\0";
911 retval = SHFileOperationA(&shfo);
912 ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
913 ok(!file_exists("test1.txt"), "Expected test1.txt to not exist\n");
914 ok(DeleteFile("a.txt"), "Expected a.txt to exist\n");
915 ok(!file_exists("b.txt"), "Expected b.txt to not exist\n");
917 /* move two files to one other */
918 shfo.pFrom = "test2.txt\0test3.txt\0";
919 shfo.pTo = "test1.txt\0";
920 retval = SHFileOperationA(&shfo);
921 ok(retval == ERROR_CANCELLED, "Expected ERROR_CANCELLED, got %d\n", retval);
922 ok(!file_exists("test1.txt"), "Expected test1.txt to not exist\n");
923 ok(file_exists("test2.txt"), "Expected test2.txt to exist\n");
924 ok(file_exists("test3.txt"), "Expected test3.txt to exist\n");
926 /* move a directory into itself */
927 shfo.pFrom = "test4.txt\0";
928 shfo.pTo = "test4.txt\\b.txt\0";
929 retval = SHFileOperationA(&shfo);
930 ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
931 ok(!RemoveDirectory("test4.txt\\b.txt"), "Expected test4.txt\\b.txt to not exist\n");
932 ok(file_exists("test4.txt"), "Expected test4.txt to exist\n");
934 /* move many files without FOF_MULTIDESTFILES */
935 shfo.pFrom = "test2.txt\0test3.txt\0";
936 shfo.pTo = "d.txt\0e.txt\0";
937 retval = SHFileOperationA(&shfo);
938 ok(retval == ERROR_CANCELLED, "Expected ERROR_CANCELLED, got %d\n", retval);
939 ok(!DeleteFile("d.txt"), "Expected d.txt to not exist\n");
940 ok(!DeleteFile("e.txt"), "Expected e.txt to not exist\n");
942 /* number of sources != number of targets */
943 shfo.pTo = "d.txt\0";
944 shfo.fFlags |= FOF_MULTIDESTFILES;
945 retval = SHFileOperationA(&shfo);
946 ok(retval == ERROR_CANCELLED, "Expected ERROR_CANCELLED, got %d\n", retval);
947 ok(!DeleteFile("d.txt"), "Expected d.txt to not exist\n");
949 /* FO_MOVE does not create dest directories */
950 shfo.pFrom = "test2.txt\0";
951 shfo.pTo = "dir1\\dir2\\test2.txt\0";
952 retval = SHFileOperationA(&shfo);
953 ok(retval == ERROR_CANCELLED, "Expected ERROR_CANCELLED, got %d\n", retval);
954 ok(!file_exists("dir1"), "Expected dir1 to not exist\n");
956 /* try to overwrite an existing file */
957 shfo.pTo = "test3.txt\0";
958 retval = SHFileOperationA(&shfo);
959 ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
960 ok(!file_exists("test2.txt"), "Expected test2.txt to not exist\n");
961 ok(file_exists("test3.txt"), "Expected test3.txt to exist\n");
964 static void test_sh_create_dir(void)
969 if(!pSHCreateDirectoryExA)
971 trace("skipping SHCreateDirectoryExA tests\n");
975 set_curr_dir_path(path, "testdir2\\test4.txt\0");
976 ret = pSHCreateDirectoryExA(NULL, path, NULL);
977 ok(ERROR_SUCCESS == ret, "SHCreateDirectoryEx failed to create directory recursively, ret = %d\n", ret);
978 ok(file_exists("testdir2"), "The first directory is not created\n");
979 ok(file_exists("testdir2\\test4.txt"), "The second directory is not created\n");
981 ret = pSHCreateDirectoryExA(NULL, path, NULL);
982 ok(ERROR_ALREADY_EXISTS == ret, "SHCreateDirectoryEx should fail to create existing directory, ret = %d\n", ret);
984 ret = pSHCreateDirectoryExA(NULL, "c:\\testdir3", NULL);
985 ok(file_exists("c:\\testdir3"), "The directory is not created\n");
988 START_TEST(shlfileop)
990 InitFunctionPointers();
992 clean_after_shfo_tests();
995 test_get_file_info();
996 clean_after_shfo_tests();
1000 clean_after_shfo_tests();
1004 clean_after_shfo_tests();
1008 clean_after_shfo_tests();
1012 clean_after_shfo_tests();
1014 test_sh_create_dir();
1015 clean_after_shfo_tests();